39 lines
861 B
TypeScript
39 lines
861 B
TypeScript
/* eslint-disable import/prefer-default-export */
|
|
import type { ColumnsType } from 'antd/lib/table';
|
|
import InputNumber from 'Elements/InputNumber';
|
|
|
|
import { buildValueComponent } from './builders';
|
|
|
|
type Payment = {
|
|
key: number;
|
|
num: number;
|
|
paymentRelation: number;
|
|
};
|
|
|
|
export const columns: ColumnsType<Payment> = [
|
|
{
|
|
key: 'num',
|
|
dataIndex: 'num',
|
|
title: '#',
|
|
width: '7%',
|
|
render: (_value, payment) => payment.num + 1,
|
|
},
|
|
{
|
|
key: 'paymentRelation',
|
|
dataIndex: 'paymentRelation',
|
|
title: '% платежа',
|
|
render: (_value, payment) => {
|
|
const Component = buildValueComponent(payment.num, InputNumber);
|
|
|
|
return (
|
|
<Component
|
|
min={payment.num === 0 ? 0 : 0.01}
|
|
max={100}
|
|
step={1}
|
|
precision={payment.num === 0 ? 4 : 2}
|
|
/>
|
|
);
|
|
},
|
|
},
|
|
];
|