trotl-table 1.0.83 → 1.0.85

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 CHANGED
@@ -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) {
@@ -10760,8 +10804,8 @@ function TableInner({
10760
10804
  const min = String(dateObj.getMinutes()).padStart(2, "0");
10761
10805
  return `${d}-${m}-${y} ${h}:${min}`;
10762
10806
  }
10763
- // Fallback: use toLocaleString with 24-hour option
10764
- return dateObj.toLocaleString(undefined, {
10807
+ // Fallback: use Slovenian locale with 24-hour option
10808
+ return dateObj.toLocaleString("sl-SI", {
10765
10809
  hour12: false
10766
10810
  });
10767
10811
  }
@@ -10773,7 +10817,8 @@ function TableInner({
10773
10817
  month: "2-digit",
10774
10818
  year: "numeric",
10775
10819
  hour: "2-digit",
10776
- minute: "2-digit"
10820
+ minute: "2-digit",
10821
+ hour12: false
10777
10822
  }) : "-";
10778
10823
  }
10779
10824
  if (isUndefinedLike) {