es-grid-template 1.8.51 → 1.8.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -558,12 +558,55 @@ const TableContainerEdit = props => {
|
|
|
558
558
|
|
|
559
559
|
const columnOri = columnTarget.columnDef.meta ?? {};
|
|
560
560
|
const isEdit = typeof columnOri?.editEnable === 'function' ? columnOri.editEnable(childData[targetRow]) : columnOri.editEnable;
|
|
561
|
+
|
|
562
|
+
// if (isEdit) {
|
|
563
|
+
|
|
564
|
+
// const columnKey = allCols[targetCol].id
|
|
565
|
+
|
|
566
|
+
// childData[targetRow] = { ...childData[targetRow], [columnKey]: cellValue.trim() }
|
|
567
|
+
|
|
568
|
+
// pastedColumns.add(columnKey)
|
|
569
|
+
// }
|
|
570
|
+
|
|
561
571
|
if (isEdit) {
|
|
562
572
|
const columnKey = allCols[targetCol].id;
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
573
|
+
|
|
574
|
+
// if (columnOri.type === 'number' && isFormattedNumber(cellValue.trim())) {
|
|
575
|
+
if (columnOri.type === 'number') {
|
|
576
|
+
if (cellValue.trim() === '') {
|
|
577
|
+
childData[targetRow] = {
|
|
578
|
+
...childData[targetRow],
|
|
579
|
+
[columnKey]: null
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
if (isFormattedNumber(cellValue.trim()) || !isNaN(Number(cellValue.trim()))) {
|
|
583
|
+
const colFormat = typeof columnOri.format === 'function' ? columnOri.format(record) : columnOri.format;
|
|
584
|
+
const valuePasteFormat = detectSeparators(cellValue.trim());
|
|
585
|
+
const cellFormat = getFormat(colFormat, format);
|
|
586
|
+
const thousandSeparator = valuePasteFormat?.thousandSeparator;
|
|
587
|
+
const decimalSeparator = valuePasteFormat?.decimalSeparator;
|
|
588
|
+
const dec = cellFormat?.decimalScale;
|
|
589
|
+
const numericFormatProps = {
|
|
590
|
+
thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
|
|
591
|
+
decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
|
|
592
|
+
allowNegative: cellFormat?.allowNegative ?? true,
|
|
593
|
+
prefix: cellFormat?.prefix,
|
|
594
|
+
suffix: cellFormat?.suffix,
|
|
595
|
+
decimalScale: dec,
|
|
596
|
+
fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
|
|
597
|
+
};
|
|
598
|
+
const val = removeNumericFormat(cellValue.trim(), undefined, numericFormatProps);
|
|
599
|
+
childData[targetRow] = {
|
|
600
|
+
...childData[targetRow],
|
|
601
|
+
[columnKey]: Number(val)
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
} else {
|
|
605
|
+
childData[targetRow] = {
|
|
606
|
+
...childData[targetRow],
|
|
607
|
+
[columnKey]: cellValue.trim()
|
|
608
|
+
};
|
|
609
|
+
}
|
|
567
610
|
pastedColumns.add(columnKey);
|
|
568
611
|
}
|
|
569
612
|
});
|
|
@@ -565,12 +565,55 @@ const TableContainerEdit = props => {
|
|
|
565
565
|
|
|
566
566
|
const columnOri = columnTarget.columnDef.meta ?? {};
|
|
567
567
|
const isEdit = typeof columnOri?.editEnable === 'function' ? columnOri.editEnable(childData[targetRow]) : columnOri.editEnable;
|
|
568
|
+
|
|
569
|
+
// if (isEdit) {
|
|
570
|
+
|
|
571
|
+
// const columnKey = allCols[targetCol].id
|
|
572
|
+
|
|
573
|
+
// childData[targetRow] = { ...childData[targetRow], [columnKey]: cellValue.trim() }
|
|
574
|
+
|
|
575
|
+
// pastedColumns.add(columnKey)
|
|
576
|
+
// }
|
|
577
|
+
|
|
568
578
|
if (isEdit) {
|
|
569
579
|
const columnKey = allCols[targetCol].id;
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
580
|
+
|
|
581
|
+
// if (columnOri.type === 'number' && isFormattedNumber(cellValue.trim())) {
|
|
582
|
+
if (columnOri.type === 'number') {
|
|
583
|
+
if (cellValue.trim() === '') {
|
|
584
|
+
childData[targetRow] = {
|
|
585
|
+
...childData[targetRow],
|
|
586
|
+
[columnKey]: null
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
if ((0, _utils.isFormattedNumber)(cellValue.trim()) || !isNaN(Number(cellValue.trim()))) {
|
|
590
|
+
const colFormat = typeof columnOri.format === 'function' ? columnOri.format(record) : columnOri.format;
|
|
591
|
+
const valuePasteFormat = (0, _utils.detectSeparators)(cellValue.trim());
|
|
592
|
+
const cellFormat = (0, _utils.getFormat)(colFormat, format);
|
|
593
|
+
const thousandSeparator = valuePasteFormat?.thousandSeparator;
|
|
594
|
+
const decimalSeparator = valuePasteFormat?.decimalSeparator;
|
|
595
|
+
const dec = cellFormat?.decimalScale;
|
|
596
|
+
const numericFormatProps = {
|
|
597
|
+
thousandSeparator: (0, _utils.checkThousandSeparator)(thousandSeparator, decimalSeparator),
|
|
598
|
+
decimalSeparator: (0, _utils.checkDecimalSeparator)(thousandSeparator, decimalSeparator),
|
|
599
|
+
allowNegative: cellFormat?.allowNegative ?? true,
|
|
600
|
+
prefix: cellFormat?.prefix,
|
|
601
|
+
suffix: cellFormat?.suffix,
|
|
602
|
+
decimalScale: dec,
|
|
603
|
+
fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
|
|
604
|
+
};
|
|
605
|
+
const val = (0, _reactNumericComponent.removeNumericFormat)(cellValue.trim(), undefined, numericFormatProps);
|
|
606
|
+
childData[targetRow] = {
|
|
607
|
+
...childData[targetRow],
|
|
608
|
+
[columnKey]: Number(val)
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
} else {
|
|
612
|
+
childData[targetRow] = {
|
|
613
|
+
...childData[targetRow],
|
|
614
|
+
[columnKey]: cellValue.trim()
|
|
615
|
+
};
|
|
616
|
+
}
|
|
574
617
|
pastedColumns.add(columnKey);
|
|
575
618
|
}
|
|
576
619
|
});
|