fix PaymentsTable
This commit is contained in:
parent
1d5328db73
commit
96e792b91d
@ -8,7 +8,9 @@ export function buildValueComponent<T>(index: number, Component: ComponentType<T
|
|||||||
const [value, setValue] = usePaymentValue(index);
|
const [value, setValue] = usePaymentValue(index);
|
||||||
const status = useRowStatus(index);
|
const status = useRowStatus(index);
|
||||||
|
|
||||||
return <Component setValue={setValue} status={status} value={value} {...props} />;
|
return (
|
||||||
|
<Component onChange={setValue} disabled={status === 'Disabled'} value={value} {...props} />
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,6 +19,8 @@ export function buildSumComponent<T>(index: number, Component: ComponentType<T>)
|
|||||||
const [value, setValue] = usePaymentSum(index);
|
const [value, setValue] = usePaymentSum(index);
|
||||||
const status = useRowStatus(index);
|
const status = useRowStatus(index);
|
||||||
|
|
||||||
return <Component setValue={setValue} status={status} value={value} {...props} />;
|
return (
|
||||||
|
<Component onChange={setValue} disabled={status === 'Disabled'} value={value} {...props} />
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable react/forbid-component-props */
|
||||||
/* eslint-disable canonical/sort-keys */
|
/* eslint-disable canonical/sort-keys */
|
||||||
import { buildSumComponent, buildValueComponent } from './builders';
|
import { buildSumComponent, buildValueComponent } from './builders';
|
||||||
import type { ColumnsType } from 'antd/lib/table';
|
import type { ColumnsType } from 'antd/lib/table';
|
||||||
@ -32,7 +33,17 @@ export const columns: ColumnsType<Payment> = [
|
|||||||
render: (_value, payment) => {
|
render: (_value, payment) => {
|
||||||
const Component = buildValueComponent(payment.num, InputNumber);
|
const Component = buildValueComponent(payment.num, InputNumber);
|
||||||
|
|
||||||
return <Component max={100} min={0} precision={payment.num === 0 ? 4 : 2} step={1} />;
|
return (
|
||||||
|
<Component
|
||||||
|
max={100}
|
||||||
|
min={0}
|
||||||
|
precision={payment.num === 0 ? 4 : 2}
|
||||||
|
step={1}
|
||||||
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -42,7 +53,18 @@ export const columns: ColumnsType<Payment> = [
|
|||||||
render: (_value, payment) => {
|
render: (_value, payment) => {
|
||||||
const Component = buildSumComponent(payment.num, InputNumber);
|
const Component = buildSumComponent(payment.num, InputNumber);
|
||||||
|
|
||||||
return <Component min={0} precision={2} step={1000} formatter={formatter} parser={parser} />;
|
return (
|
||||||
|
<Component
|
||||||
|
min={0}
|
||||||
|
precision={2}
|
||||||
|
step={1000}
|
||||||
|
formatter={formatter}
|
||||||
|
parser={parser}
|
||||||
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user