trotl-table 1.0.82 → 1.0.84
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.
- package/dist/Table.cjs.js +47 -3
- package/dist/Table.cjs.js.map +1 -1
- package/dist/Table.esm.js +47 -3
- package/dist/Table.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/Table.cjs.js
CHANGED
|
@@ -10547,9 +10547,9 @@ function TableInner({
|
|
|
10547
10547
|
|
|
10548
10548
|
// Custom column type (editable in-table)
|
|
10549
10549
|
if (col && col.type === "custom") {
|
|
10550
|
-
const
|
|
10551
|
-
if (
|
|
10552
|
-
return /*#__PURE__*/React.createElement(
|
|
10550
|
+
const CustomComp = col["modal-comp"];
|
|
10551
|
+
if (CustomComp) {
|
|
10552
|
+
return /*#__PURE__*/React.createElement(CustomComp, {
|
|
10553
10553
|
value: v
|
|
10554
10554
|
});
|
|
10555
10555
|
}
|
|
@@ -10699,6 +10699,50 @@ function TableInner({
|
|
|
10699
10699
|
});
|
|
10700
10700
|
}
|
|
10701
10701
|
|
|
10702
|
+
// Date column type (editable date picker)
|
|
10703
|
+
if (col && col.type === "date") {
|
|
10704
|
+
const dateValue = isNoData ? "" : v == null ? "" : v instanceof Date ? v.toISOString().slice(0, 10) : String(v).slice(0, 10);
|
|
10705
|
+
return /*#__PURE__*/React.createElement("input", {
|
|
10706
|
+
type: "date",
|
|
10707
|
+
className: "table-cell-input",
|
|
10708
|
+
value: dateValue,
|
|
10709
|
+
placeholder: isNoData ? "..." : undefined,
|
|
10710
|
+
title: isNoData ? translate("noData") : dateValue,
|
|
10711
|
+
onClick: e => {
|
|
10712
|
+
e.stopPropagation();
|
|
10713
|
+
triggerCellCallback(row, col, dateValue);
|
|
10714
|
+
},
|
|
10715
|
+
onChange: e => {
|
|
10716
|
+
const next = e.target.value;
|
|
10717
|
+
setLocalData(prev => {
|
|
10718
|
+
if (isGrouped) {
|
|
10719
|
+
return prev.map(g => ({
|
|
10720
|
+
...g,
|
|
10721
|
+
rows: (g.rows || []).map(r => r.id === row.id ? {
|
|
10722
|
+
...r,
|
|
10723
|
+
[accessor]: next
|
|
10724
|
+
} : r)
|
|
10725
|
+
}));
|
|
10726
|
+
}
|
|
10727
|
+
return (prev || []).map(r => r.id === row.id ? {
|
|
10728
|
+
...r,
|
|
10729
|
+
[accessor]: next
|
|
10730
|
+
} : r);
|
|
10731
|
+
});
|
|
10732
|
+
refreshTriggerRef.current?.();
|
|
10733
|
+
try {
|
|
10734
|
+
onCellChangeRef.current?.(row, accessor, next);
|
|
10735
|
+
} catch (err) {
|
|
10736
|
+
console.error("onCellChange error", err);
|
|
10737
|
+
}
|
|
10738
|
+
},
|
|
10739
|
+
style: {
|
|
10740
|
+
border: "1px solid var(--border-light, #ccc)",
|
|
10741
|
+
padding: "2px 4px"
|
|
10742
|
+
}
|
|
10743
|
+
});
|
|
10744
|
+
}
|
|
10745
|
+
|
|
10702
10746
|
// Number column type (format decimals) - default two decimals
|
|
10703
10747
|
if (col && col.type === "number") {
|
|
10704
10748
|
if (isNoData) {
|