форматирование
This commit is contained in:
parent
ea9cb4a084
commit
601a125349
@ -1,3 +1,3 @@
|
|||||||
.filterTree .ant-tree-switcher-noop {
|
.filterTree .ant-tree-switcher-noop {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { SearchOutlined } from '@ant-design/icons';
|
import { SearchOutlined } from '@ant-design/icons';
|
||||||
import { Button, Input, Space, Tree } from 'antd';
|
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';
|
import './TreeFilterDropdown.css';
|
||||||
|
|
||||||
export type OptionType = {
|
export type OptionType = {
|
||||||
@ -17,7 +17,7 @@ interface TreeFilterDropdownProps {
|
|||||||
selectedKeys: string[];
|
selectedKeys: string[];
|
||||||
onChange: (keys: string[]) => void;
|
onChange: (keys: string[]) => void;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
warningBlock?: ReactNode
|
warningBlock?: ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TreeFilterDropdown: React.FC<TreeFilterDropdownProps> = ({
|
export const TreeFilterDropdown: React.FC<TreeFilterDropdownProps> = ({
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
export const chessTableCellFormatValue = (
|
export const chessTableCellFormatValue = (val: string | number | null | undefined, units: string, decimals: number) => {
|
||||||
val: string | number | null | undefined,
|
|
||||||
units: string,
|
|
||||||
decimals: number
|
|
||||||
) => {
|
|
||||||
if (val === undefined || val === null || val === '') return '';
|
if (val === undefined || val === null || val === '') return '';
|
||||||
|
|
||||||
let strVal = String(val);
|
let strVal = String(val);
|
||||||
@ -46,10 +42,10 @@ export const chessTableCellFormatValue = (
|
|||||||
maximumFractionDigits: decimals,
|
maximumFractionDigits: decimals,
|
||||||
}).format(strVal as any);
|
}).format(strVal as any);
|
||||||
|
|
||||||
const zeroString = `0${decimals > 0 ? ',' + '0'.repeat(decimals) : ''}`;
|
const zeroString = `0${decimals > 0 ? `,${'0'.repeat(decimals)}` : ''}`;
|
||||||
if (formatted === `-${zeroString}`) {
|
if (formatted === `-${zeroString}`) {
|
||||||
return zeroString;
|
return zeroString;
|
||||||
}
|
}
|
||||||
|
|
||||||
return formatted;
|
return formatted;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -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>
|
<Text strong>{chessTableCellFormatValue(sumAmounts(data.articles.map((a) => a.group_total)) ?? '0', units, decimals)}</Text>
|
||||||
</Table.Summary.Cell>
|
</Table.Summary.Cell>
|
||||||
</Table.Summary.Row>
|
</Table.Summary.Row>
|
||||||
|
|||||||
@ -18,7 +18,6 @@ interface ConsolidationChessTableI {
|
|||||||
isFullscreen?: boolean;
|
isFullscreen?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type TotalRow = {
|
type TotalRow = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@ -92,11 +91,11 @@ export const ConsolidationChessTable: React.FC<ConsolidationChessTableI> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
data.companies.forEach((colCompany) => {
|
data.companies.forEach((colCompany) => {
|
||||||
const amountsToSum: string[] = [];
|
const amountsToSum: string[] = [];
|
||||||
|
|
||||||
data.companies.forEach((rowCompany) => {
|
data.companies.forEach((rowCompany) => {
|
||||||
const cell = matrixData[rowCompany.id]?.[colCompany.id];
|
const cell = matrixData[rowCompany.id]?.[colCompany.id];
|
||||||
if (cell?.amount_a) {
|
if (cell?.amount_a) {
|
||||||
amountsToSum.push(cell.amount_a);
|
amountsToSum.push(cell.amount_a);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -18,7 +18,7 @@ interface ConsolidationChessTableFilterI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const buildTree = (items: Account[]): OptionType[] => {
|
const buildTree = (items: Account[]): OptionType[] => {
|
||||||
const map: Record<string, OptionType> = {};
|
const map: Record<string, OptionType> = {};
|
||||||
const roots: OptionType[] = [];
|
const roots: OptionType[] = [];
|
||||||
|
|
||||||
items.forEach((item) => {
|
items.forEach((item) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user