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.esm.js CHANGED
@@ -10525,9 +10525,9 @@ function TableInner({
10525
10525
 
10526
10526
  // Custom column type (editable in-table)
10527
10527
  if (col && col.type === "custom") {
10528
- const customComp = col["modal-comp"];
10529
- if (customComp) {
10530
- return /*#__PURE__*/React__default.createElement("customComp", {
10528
+ const CustomComp = col["modal-comp"];
10529
+ if (CustomComp) {
10530
+ return /*#__PURE__*/React__default.createElement(CustomComp, {
10531
10531
  value: v
10532
10532
  });
10533
10533
  }
@@ -10677,6 +10677,50 @@ function TableInner({
10677
10677
  });
10678
10678
  }
10679
10679
 
10680
+ // Date column type (editable date picker)
10681
+ if (col && col.type === "date") {
10682
+ const dateValue = isNoData ? "" : v == null ? "" : v instanceof Date ? v.toISOString().slice(0, 10) : String(v).slice(0, 10);
10683
+ return /*#__PURE__*/React__default.createElement("input", {
10684
+ type: "date",
10685
+ className: "table-cell-input",
10686
+ value: dateValue,
10687
+ placeholder: isNoData ? "..." : undefined,
10688
+ title: isNoData ? translate("noData") : dateValue,
10689
+ onClick: e => {
10690
+ e.stopPropagation();
10691
+ triggerCellCallback(row, col, dateValue);
10692
+ },
10693
+ onChange: e => {
10694
+ const next = e.target.value;
10695
+ setLocalData(prev => {
10696
+ if (isGrouped) {
10697
+ return prev.map(g => ({
10698
+ ...g,
10699
+ rows: (g.rows || []).map(r => r.id === row.id ? {
10700
+ ...r,
10701
+ [accessor]: next
10702
+ } : r)
10703
+ }));
10704
+ }
10705
+ return (prev || []).map(r => r.id === row.id ? {
10706
+ ...r,
10707
+ [accessor]: next
10708
+ } : r);
10709
+ });
10710
+ refreshTriggerRef.current?.();
10711
+ try {
10712
+ onCellChangeRef.current?.(row, accessor, next);
10713
+ } catch (err) {
10714
+ console.error("onCellChange error", err);
10715
+ }
10716
+ },
10717
+ style: {
10718
+ border: "1px solid var(--border-light, #ccc)",
10719
+ padding: "2px 4px"
10720
+ }
10721
+ });
10722
+ }
10723
+
10680
10724
  // Number column type (format decimals) - default two decimals
10681
10725
  if (col && col.type === "number") {
10682
10726
  if (isNoData) {