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.esm.js CHANGED
@@ -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) {
@@ -10738,8 +10782,8 @@ function TableInner({
10738
10782
  const min = String(dateObj.getMinutes()).padStart(2, "0");
10739
10783
  return `${d}-${m}-${y} ${h}:${min}`;
10740
10784
  }
10741
- // Fallback: use toLocaleString with 24-hour option
10742
- return dateObj.toLocaleString(undefined, {
10785
+ // Fallback: use Slovenian locale with 24-hour option
10786
+ return dateObj.toLocaleString("sl-SI", {
10743
10787
  hour12: false
10744
10788
  });
10745
10789
  }
@@ -10751,7 +10795,8 @@ function TableInner({
10751
10795
  month: "2-digit",
10752
10796
  year: "numeric",
10753
10797
  hour: "2-digit",
10754
- minute: "2-digit"
10798
+ minute: "2-digit",
10799
+ hour12: false
10755
10800
  }) : "-";
10756
10801
  }
10757
10802
  if (isUndefinedLike) {