форматирование

This commit is contained in:
Grog 2026-10-22 14:36:18 +03:00
parent ea9cb4a084
commit 601a125349
6 changed files with 10 additions and 15 deletions

View File

@ -1,3 +1,3 @@
.filterTree .ant-tree-switcher-noop {
display: none !important;
}
}

View File

@ -1,6 +1,6 @@
import { SearchOutlined } from '@ant-design/icons';
import { Button, Input, Space, Tree } from 'antd';
import { ReactNode, useEffect, useMemo, useState } from 'react';
import { type ReactNode, useEffect, useMemo, useState } from 'react';
import './TreeFilterDropdown.css';
export type OptionType = {
@ -17,7 +17,7 @@ interface TreeFilterDropdownProps {
selectedKeys: string[];
onChange: (keys: string[]) => void;
onClose: () => void;
warningBlock?: ReactNode
warningBlock?: ReactNode;
}
export const TreeFilterDropdown: React.FC<TreeFilterDropdownProps> = ({

View File

@ -1,8 +1,4 @@
export const chessTableCellFormatValue = (
val: string | number | null | undefined,
units: string,
decimals: number
) => {
export const chessTableCellFormatValue = (val: string | number | null | undefined, units: string, decimals: number) => {
if (val === undefined || val === null || val === '') return '';
let strVal = String(val);
@ -46,10 +42,10 @@ export const chessTableCellFormatValue = (
maximumFractionDigits: decimals,
}).format(strVal as any);
const zeroString = `0${decimals > 0 ? ',' + '0'.repeat(decimals) : ''}`;
const zeroString = `0${decimals > 0 ? `,${'0'.repeat(decimals)}` : ''}`;
if (formatted === `-${zeroString}`) {
return zeroString;
}
return formatted;
};
};

View File

@ -122,7 +122,7 @@ export const ConsolidationChessResTable: React.FC<ConsolidationChessResTableI> =
);
})}
<Table.Summary.Cell index={data.companies.length + 1} align='right' >
<Table.Summary.Cell index={data.companies.length + 1} align='right'>
<Text strong>{chessTableCellFormatValue(sumAmounts(data.articles.map((a) => a.group_total)) ?? '0', units, decimals)}</Text>
</Table.Summary.Cell>
</Table.Summary.Row>

View File

@ -18,7 +18,6 @@ interface ConsolidationChessTableI {
isFullscreen?: boolean;
}
type TotalRow = {
id: string;
name: string;
@ -92,11 +91,11 @@ export const ConsolidationChessTable: React.FC<ConsolidationChessTableI> = ({
};
data.companies.forEach((colCompany) => {
const amountsToSum: string[] = [];
const amountsToSum: string[] = [];
data.companies.forEach((rowCompany) => {
const cell = matrixData[rowCompany.id]?.[colCompany.id];
if (cell?.amount_a) {
if (cell?.amount_a) {
amountsToSum.push(cell.amount_a);
}
});

View File

@ -18,7 +18,7 @@ interface ConsolidationChessTableFilterI {
}
const buildTree = (items: Account[]): OptionType[] => {
const map: Record<string, OptionType> = {};
const map: Record<string, OptionType> = {};
const roots: OptionType[] = [];
items.forEach((item) => {