- fixed NaN value is given fo rundefined input values;
This commit is contained in:
@@ -6,12 +6,17 @@ const DefaultCell = ({ getValue, row: { index }, column: { id }, table }) => {
|
|||||||
table.options.meta?.updateData(index, id, e.target.value);
|
table.options.meta?.updateData(index, id, e.target.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onFocus = (e) => {
|
||||||
|
e.target.select();
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<input
|
<input
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
value={initialValue ?? ''}
|
value={initialValue ?? ''}
|
||||||
onChange={(e) => table.options.meta?.updateData(index, id, e.target.value)}
|
onChange={(e) => table.options.meta?.updateData(index, id, e.target.value)}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
|
onFocus={onFocus}
|
||||||
className="w-full px-2 py-1 border rounded"
|
className="w-full px-2 py-1 border rounded"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const LastRowCell = ({columnId, lastRows, columnMeta = {}, getColumnDataFn}) =>
|
|||||||
|
|
||||||
if (columnMeta.enableFormula) {
|
if (columnMeta.enableFormula) {
|
||||||
const getAllRowsValues = getColumnDataFn(columnId)
|
const getAllRowsValues = getColumnDataFn(columnId)
|
||||||
.map(v => isEmpty(v) ? 0 : v);
|
.map(v => isEmpty(v) || isNil(v) ? 0 : v);
|
||||||
|
|
||||||
if (cellValue === 'sum') {
|
if (cellValue === 'sum') {
|
||||||
cellValue = sum(getAllRowsValues);
|
cellValue = sum(getAllRowsValues);
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table })
|
|||||||
table.options.meta?.updateData(index, id, numValue);
|
table.options.meta?.updateData(index, id, numValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onFocus = (e) => {
|
||||||
|
e.target.select();
|
||||||
|
}
|
||||||
|
|
||||||
const onChange = (e) => {
|
const onChange = (e) => {
|
||||||
if (e.target.value === 0 || !isNaN(e.target.value)) {
|
if (e.target.value === 0 || !isNaN(e.target.value)) {
|
||||||
table.options.meta?.updateData(index, id, e.target.value);
|
table.options.meta?.updateData(index, id, e.target.value);
|
||||||
@@ -19,6 +23,7 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table })
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
value={initialValue ?? 0}
|
value={initialValue ?? 0}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
onFocus={onFocus}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
step="any"
|
step="any"
|
||||||
className="w-full px-2 py-1 border rounded"
|
className="w-full px-2 py-1 border rounded"
|
||||||
|
|||||||
Reference in New Issue
Block a user