diff --git a/web/src/App.css b/web/src/App.css index d703b0d..4f7a3bb 100644 --- a/web/src/App.css +++ b/web/src/App.css @@ -1,4 +1,4 @@ -.ant-select-selection-item { +.custom-select-selection-item .ant-select-selection-item { background-color: #ecfdf3 !important; color: #1f5f35 !important; box-shadow: inset 0 0 0 1px #2ea64b38 !important; diff --git a/web/src/components/TreeFilterDropdown/TreeFilterDropdown.css b/web/src/components/TreeFilterDropdown/TreeFilterDropdown.css index adf8ee1..9bc8d7c 100644 --- a/web/src/components/TreeFilterDropdown/TreeFilterDropdown.css +++ b/web/src/components/TreeFilterDropdown/TreeFilterDropdown.css @@ -1,3 +1,3 @@ .filterTree .ant-tree-switcher-noop { display: none !important; -} +} \ No newline at end of file diff --git a/web/src/components/TreeFilterDropdown/TreeFilterDropdown.tsx b/web/src/components/TreeFilterDropdown/TreeFilterDropdown.tsx index 7a3fc46..161893b 100644 --- a/web/src/components/TreeFilterDropdown/TreeFilterDropdown.tsx +++ b/web/src/components/TreeFilterDropdown/TreeFilterDropdown.tsx @@ -1,6 +1,6 @@ import { SearchOutlined } from '@ant-design/icons'; import { Button, Input, Space, Tree } from 'antd'; -import { useEffect, useMemo, useState } from 'react'; +import { ReactNode, useEffect, useMemo, useState } from 'react'; import './TreeFilterDropdown.css'; export type OptionType = { @@ -17,6 +17,7 @@ interface TreeFilterDropdownProps { selectedKeys: string[]; onChange: (keys: string[]) => void; onClose: () => void; + warningBlock?: ReactNode } export const TreeFilterDropdown: React.FC = ({ @@ -26,6 +27,7 @@ export const TreeFilterDropdown: React.FC = ({ selectedKeys, onChange, onClose, + warningBlock, }) => { const [query, setQuery] = useState(''); @@ -99,7 +101,7 @@ export const TreeFilterDropdown: React.FC = ({ return (
{title}
- + {warningBlock}
Поиск
} @@ -116,32 +118,19 @@ export const TreeFilterDropdown: React.FC = ({
{ + onCheck={(keys) => { const newChecked = Array.isArray(keys) ? keys : keys.checked; - const targetKey = e.node.key as string; - const isChecked = newChecked.includes(targetKey); - if (isChecked) { - setCheckedKeys(Array.from(new Set([...checkedKeys, ...newChecked.map(String)]))); - } else { - const keysToRemove = [targetKey]; - const findChildren = (node: OptionType) => { - if (node.children) { - node.children.forEach((child) => { - keysToRemove.push(child.key); - findChildren(child); - }); - } - }; - findChildren(e.node); + const allVisibleKeys = getAllNodeKeys(filteredTreeData); + const hiddenKeys = checkedKeys.filter((k) => !allVisibleKeys.includes(k)); - setCheckedKeys(checkedKeys.filter((k) => !keysToRemove.includes(k))); - } + const finalKeys = Array.from(new Set([...newChecked.map(String), ...hiddenKeys])); + + setCheckedKeys(finalKeys); }} expandedKeys={expandedKeys} onExpand={(keys) => setExpandedKeys(keys as string[])} diff --git a/web/src/utils/chessTableCellFormatValue.ts b/web/src/utils/chessTableCellFormatValue.ts index 7c27739..64f6123 100644 --- a/web/src/utils/chessTableCellFormatValue.ts +++ b/web/src/utils/chessTableCellFormatValue.ts @@ -1,4 +1,8 @@ -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); @@ -30,15 +34,22 @@ export const chessTableCellFormatValue = (val: string | number | null | undefine newFrac = `${intPart.slice(-shift)}${fracPart}`; } - strVal = `${isNegative ? '-' : ''}${newInt}.${newFrac.slice(0, 4)}`; + strVal = `${isNegative ? '-' : ''}${newInt}.${newFrac}`; } } const num = Number(strVal); if (Number.isNaN(num)) return strVal; - return new Intl.NumberFormat('ru-RU', { + const formatted = new Intl.NumberFormat('ru-RU', { minimumFractionDigits: decimals, maximumFractionDigits: decimals, - }).format(num); -}; + }).format(strVal as any); + + const zeroString = `0${decimals > 0 ? ',' + '0'.repeat(decimals) : ''}`; + if (formatted === `-${zeroString}`) { + return zeroString; + } + + return formatted; +}; \ No newline at end of file diff --git a/web/src/widgets/CatalogueJurForm/CatalogueJurForm.tsx b/web/src/widgets/CatalogueJurForm/CatalogueJurForm.tsx index bd865e0..fa3a1a1 100644 --- a/web/src/widgets/CatalogueJurForm/CatalogueJurForm.tsx +++ b/web/src/widgets/CatalogueJurForm/CatalogueJurForm.tsx @@ -213,6 +213,7 @@ export const CatalogueJurForm: React.FC = ({ open, onCancel, onOk, jurId label='Альтернативные наименования' extra='Введите синоним и нажмите Enter. Можно добавить несколько значений.'>