diff --git a/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx b/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx index cb95337..98e196b 100644 --- a/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx +++ b/Components/Calculation/Form/Insurance/InsuranceTable/config.tsx @@ -3,6 +3,7 @@ import type { ColumnsType } from 'antd/lib/table'; import { MAX_INSURANCE } from 'constants/values'; import InputNumber from 'Elements/InputNumber'; import Select from 'Elements/Select'; +import { formatter, parser } from 'tools/number'; import { buildOptionComponent, buildValueComponent } from './builders'; import type * as Insurance from './types'; @@ -40,7 +41,17 @@ export const columns: ColumnsType = [ render: (_, record) => { const Component = buildValueComponent(record.key, InputNumber, 'insCost'); - return ; + return ( + + ); }, }, { diff --git a/Components/Calculation/config/elements-props.ts b/Components/Calculation/config/elements-props.ts index e085c7c..4cc2ec7 100644 --- a/Components/Calculation/config/elements-props.ts +++ b/Components/Calculation/config/elements-props.ts @@ -1,15 +1,9 @@ import { MAX_FRANCHISE, MAX_LEASING_PERIOD } from 'constants/values'; import DownloadOutlined from 'Elements/icons/DownloadOutlined'; import date from 'tools/date'; +import { formatter, parser } from 'tools/number'; import type { ElementsProps } from './elements-components'; -function parser(value?: string) { - const normalized = (value || '0').replace(/\s/g, '').replaceAll(',', '.'); - - return Number.parseFloat(normalized); -} -const formatter = (value?: number) => Intl.NumberFormat('ru').format(value || 0); - const props: Partial = { tbxLeaseObjectPrice: { min: 0, diff --git a/tools/number.ts b/tools/number.ts new file mode 100644 index 0000000..69e24b1 --- /dev/null +++ b/tools/number.ts @@ -0,0 +1,6 @@ +export function parser(value?: string) { + const normalized = (value || '0').replace(/\s/g, '').replaceAll(',', '.'); + + return Number.parseFloat(normalized); +} +export const formatter = (value?: number) => Intl.NumberFormat('ru').format(value || 0);