impact-nova 1.7.39 → 1.7.41

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.
Files changed (44) hide show
  1. package/dist/components/ui/ag-grid-react/cell-renderers/editors/date-cell-editor.js +58 -48
  2. package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.d.ts +0 -2
  3. package/dist/components/ui/ag-grid-react/headers/advanced-filter/advanced-filter-dialog.js +212 -218
  4. package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.d.ts +2 -2
  5. package/dist/components/ui/ag-grid-react/headers/advanced-filter/column-filter-section.js +97 -127
  6. package/dist/components/ui/ag-grid-react/headers/components/date-filter-picker.d.ts +39 -0
  7. package/dist/components/ui/ag-grid-react/headers/header-search-input.js +433 -299
  8. package/dist/components/ui/ag-grid-react/headers/utils/date-utils.d.ts +33 -1
  9. package/dist/components/ui/ag-grid-react/headers/utils/date-utils.js +60 -26
  10. package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.d.ts +11 -10
  11. package/dist/components/ui/ag-grid-react/headers/utils/filter-utils.js +284 -260
  12. package/dist/components/ui/ag-grid-react/index.js +24 -25
  13. package/dist/components/ui/data-table/column-indicator.d.ts +17 -0
  14. package/dist/components/ui/data-table/column-indicator.js +30 -0
  15. package/dist/components/ui/data-table/data-table-column-list.js +210 -154
  16. package/dist/components/ui/data-table/data-table.js +60 -59
  17. package/dist/components/ui/data-table/index.d.ts +3 -0
  18. package/dist/components/ui/data-table/index.js +34 -28
  19. package/dist/components/ui/data-table/indicator-legend.d.ts +8 -0
  20. package/dist/components/ui/data-table/indicator-legend.js +20 -0
  21. package/dist/components/ui/data-table/pin-switch.d.ts +30 -0
  22. package/dist/components/ui/data-table/pin-switch.js +75 -0
  23. package/dist/components/ui/date-picker/date-picker.js +65 -63
  24. package/dist/components/ui/date-picker/date-range-picker.js +77 -75
  25. package/dist/components/ui/nested-list/components/NestedListContent.js +7 -7
  26. package/dist/components/ui/nested-list/components/SortableItem.d.ts +10 -0
  27. package/dist/components/ui/nested-list/components/SortableItem.js +91 -83
  28. package/dist/components/ui/nested-list/nested-list.js +184 -178
  29. package/dist/components/ui/types/ag-grid.types.d.ts +16 -2
  30. package/dist/components/ui/types/date-picker.types.d.ts +4 -0
  31. package/dist/components/ui/types/nested-list.types.d.ts +12 -0
  32. package/dist/i18n/defaultMessages.d.ts +10 -0
  33. package/dist/i18n/defaultMessages.js +16 -8
  34. package/dist/i18n/locales/de.js +8 -0
  35. package/dist/i18n/locales/es.js +8 -0
  36. package/dist/i18n/locales/hi.js +8 -0
  37. package/dist/i18n/locales/kn.js +8 -0
  38. package/dist/icons/assets/archive.svg.js +5 -0
  39. package/dist/icons/index.d.ts +1 -0
  40. package/dist/icons/index.js +280 -278
  41. package/dist/impact-nova.css +1 -1
  42. package/dist/index.js +180 -174
  43. package/package.json +1 -1
  44. package/tailwind.config.js +16 -0
@@ -13,13 +13,13 @@ import { AG_GRID_VALUE_FORMATTERS as ye } from "./value-formatters.js";
13
13
  /* empty css */
14
14
  const be = re(() => import("./headers/advanced-filter/advanced-filter-dialog.js"));
15
15
  ie.registerModules([se, ce, ue]);
16
- const x = "", T = "", H = (s) => {
16
+ const x = "", I = "", H = (s) => {
17
17
  if (!s) return;
18
18
  const r = s.cellRendererParams?.splits;
19
19
  if (Array.isArray(r) && r.length > 0) return r;
20
20
  const l = s.cellEditorParams?.splits;
21
21
  if (Array.isArray(l) && l.length > 0) return l;
22
- }, V = (s, r) => {
22
+ }, _ = (s, r) => {
23
23
  const l = [];
24
24
  for (const g of r) {
25
25
  const f = g?.field?.split(".").pop();
@@ -44,7 +44,7 @@ const x = "", T = "", H = (s) => {
44
44
  l.push("");
45
45
  }
46
46
  return l;
47
- }, _ = (s) => {
47
+ }, V = (s) => {
48
48
  if (typeof navigator < "u" && navigator.clipboard?.writeText) {
49
49
  navigator.clipboard.writeText(s).catch(() => K(s));
50
50
  return;
@@ -69,7 +69,7 @@ function De({
69
69
  onGridReady: a,
70
70
  ...u
71
71
  }) {
72
- const c = b(null), h = b(null), [F, w] = j(null), [I, E] = j(!1), [O, D] = j(null), [W, L] = j(!1), M = b(null), P = b(null), S = b(null), U = v(() => [], []), $ = C(() => ({
72
+ const c = b(null), h = b(null), [F, w] = j(null), [P, M] = j(!1), [O, D] = j(null), [W, L] = j(!1), S = b(null), T = b(null), E = b(null), U = v(() => [], []), $ = C(() => ({
73
73
  numericColumn: {
74
74
  cellClass: "ag-right-aligned-cell",
75
75
  headerClass: "ag-right-aligned-header",
@@ -102,10 +102,10 @@ function De({
102
102
  c.current.setGridOption("context", { ...e, activeSearchColumnId: null }), c.current.refreshHeader();
103
103
  },
104
104
  openAdvancedFilter: (e) => {
105
- D(e || null), E(!0);
105
+ D(e || null), M(!0);
106
106
  },
107
107
  closeAdvancedFilter: () => {
108
- E(!1), D(null);
108
+ M(!1), D(null);
109
109
  },
110
110
  applyAdvancedFilter: (e) => {
111
111
  if (!c.current) return;
@@ -113,17 +113,17 @@ function De({
113
113
  c.current.setFilterModel(t), c.current.onFilterChanged();
114
114
  },
115
115
  openMenu: (e, t, o = "column") => {
116
- M.current = e, P.current = t, S.current = o, L(!0);
116
+ S.current = e, T.current = t, E.current = o, L(!0);
117
117
  },
118
118
  closeMenu: () => {
119
- M.current = null, P.current = null, S.current = null, L(!1);
119
+ S.current = null, T.current = null, E.current = null, L(!1);
120
120
  },
121
121
  // Getters read from refs - O(1) per header, no memory allocation
122
122
  get activeMenuColumnId() {
123
- return M.current;
123
+ return S.current;
124
124
  },
125
125
  get activeMenuVariant() {
126
- return S.current;
126
+ return E.current;
127
127
  }
128
128
  }), []), q = v((e) => {
129
129
  c.current = e.api, w(e.api);
@@ -157,7 +157,7 @@ function De({
157
157
  suppressHeaderKeyboardEvent: (e) => {
158
158
  const { event: t } = e, o = t.target;
159
159
  if (o.tagName === "INPUT" || o.tagName === "TEXTAREA")
160
- return !(t.key === "Enter" || t.key === "Escape" || t.key === "Tab");
160
+ return !(t.key === "Escape" || t.key === "Tab");
161
161
  if (t.key === "Enter" || t.key === " ") {
162
162
  const n = o.closest(".ag-header-cell");
163
163
  if (n) {
@@ -189,12 +189,12 @@ function De({
189
189
  if (t == null || typeof t != "object") return t;
190
190
  const o = H(e.column?.getColDef());
191
191
  if (o && o.length > 0) {
192
- const n = V(t, o);
192
+ const n = _(t, o);
193
193
  if (o.length === 1) {
194
194
  const d = o[0]?.field?.split(".").pop(), y = d ? t[d] : void 0;
195
195
  return y && typeof y == "object" && "value" in y ? y.value ?? "" : n[0];
196
196
  }
197
- return T + n.join(x);
197
+ return I + n.join(x);
198
198
  }
199
199
  const i = Object.entries(t).map(([, n]) => n && typeof n == "object" && "value" in n ? n.value : typeof n != "object" && typeof n < "u" ? n : null).filter((n) => n != null);
200
200
  return i.length === 0 ? "" : i.length === 1 ? i[0] : i.join(x);
@@ -211,8 +211,8 @@ function De({
211
211
  return e.value;
212
212
  }, []), Y = v((e) => {
213
213
  const t = e?.data ?? "";
214
- if (!t.includes(x) && !t.includes(T)) {
215
- _(t);
214
+ if (!t.includes(x) && !t.includes(I)) {
215
+ V(t);
216
216
  return;
217
217
  }
218
218
  const o = [], i = t.split(`
@@ -223,7 +223,7 @@ function De({
223
223
  o.push("");
224
224
  continue;
225
225
  }
226
- const k = d.split(" ").map((p) => p.startsWith(T) ? { isSplit: !0, slots: p.slice(1).split(x) } : { isSplit: !1, slots: p.split(x) }), N = Math.max(1, ...k.map((p) => p.slots.length));
226
+ const k = d.split(" ").map((p) => p.startsWith(I) ? { isSplit: !0, slots: p.slice(1).split(x) } : { isSplit: !1, slots: p.split(x) }), N = Math.max(1, ...k.map((p) => p.slots.length));
227
227
  if (N === 1) {
228
228
  o.push(k.map((p) => p.slots[0] ?? "").join(" "));
229
229
  continue;
@@ -233,7 +233,7 @@ function De({
233
233
  o.push(te.join(" "));
234
234
  }
235
235
  }
236
- _(o.join(`
236
+ V(o.join(`
237
237
  `));
238
238
  }, []), R = v((e) => {
239
239
  const t = e.value;
@@ -241,7 +241,7 @@ function De({
241
241
  if (typeof t != "object") return String(t);
242
242
  const o = H(e.column?.getColDef());
243
243
  if (o && o.length > 0) {
244
- const n = V(t, o);
244
+ const n = _(t, o);
245
245
  return o.length === 1 ? n[0] : n.join(`
246
246
  `);
247
247
  }
@@ -293,7 +293,7 @@ function De({
293
293
  /* @__PURE__ */ m(
294
294
  xe,
295
295
  {
296
- isOpen: I,
296
+ isOpen: P,
297
297
  columnId: O,
298
298
  gridApi: F,
299
299
  onClose: A.closeAdvancedFilter,
@@ -304,10 +304,10 @@ function De({
304
304
  Fe,
305
305
  {
306
306
  isOpen: W,
307
- columnId: M.current,
307
+ columnId: S.current,
308
308
  gridApi: F,
309
- anchor: P.current,
310
- variant: S.current,
309
+ anchor: T.current,
310
+ variant: E.current,
311
311
  onClose: A.closeMenu
312
312
  }
313
313
  )
@@ -323,7 +323,7 @@ function xe({
323
323
  if (!s || !r || !l) return null;
324
324
  const a = l.getColumn(r);
325
325
  if (!a) return null;
326
- const u = a.getColDef(), c = u.headerComponentParams, h = he(u), F = h.text !== -1 || h.number !== -1 || h.date !== -1, w = h.set !== -1, E = u.filter === "agMultiColumnFilter" && (F || w) ? "multi" : u.filter === "agNumberColumnFilter" ? "number" : u.filter === "agDateColumnFilter" ? "date" : u.filter === "agSetColumnFilter" || c?.selectOptions ? "select" : "text", O = Ce(l.getFilterModel());
326
+ const u = a.getColDef(), c = u.headerComponentParams, h = he(u), F = h.text !== -1 || h.number !== -1 || h.date !== -1, w = h.set !== -1, M = u.filter === "agMultiColumnFilter" && (F || w) ? "multi" : u.filter === "agNumberColumnFilter" ? "number" : u.filter === "agDateColumnFilter" ? "date" : u.filter === "agSetColumnFilter" || c?.selectOptions ? "select" : "text", O = Ce(l.getFilterModel());
327
327
  return /* @__PURE__ */ m(le, { fallback: null, children: /* @__PURE__ */ m(
328
328
  be,
329
329
  {
@@ -332,10 +332,9 @@ function xe({
332
332
  onApply: f,
333
333
  columnId: r,
334
334
  columnLabel: u.headerName || r,
335
- columnType: E,
335
+ columnType: M,
336
336
  selectOptions: c?.selectOptions,
337
337
  isMultiSelect: c?.isMultiSelect,
338
- datePickerVariant: c?.datePickerVariant,
339
338
  initialModel: O,
340
339
  api: l
341
340
  }
@@ -0,0 +1,17 @@
1
+ export type IndicatorType = 'sort' | 'filter';
2
+ interface ColumnIndicatorProps {
3
+ /** Type of indicator - determines color and label */
4
+ type: IndicatorType;
5
+ /** Additional CSS classes */
6
+ className?: string;
7
+ }
8
+ /**
9
+ * Small colored badge indicating column state (sorted or filtered).
10
+ * Uses design tokens for colors and i18n for accessibility labels.
11
+ *
12
+ * @example
13
+ * <ColumnIndicator type="sort" />
14
+ * <ColumnIndicator type="filter" />
15
+ */
16
+ export declare const ColumnIndicator: React.FC<ColumnIndicatorProps>;
17
+ export {};
@@ -0,0 +1,30 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { cn as n } from "../../../lib/utils.js";
3
+ import { useImpactNovaI18n as s } from "../../../i18n/ImpactNovaI18nContext.js";
4
+ const c = ({
5
+ type: r,
6
+ className: l
7
+ }) => {
8
+ const { t: a } = s(), t = {
9
+ sort: {
10
+ colorClass: "bg-indicator-sort",
11
+ label: a("dataTable.indicatorSortedAriaLabel")
12
+ },
13
+ filter: {
14
+ colorClass: "bg-indicator-filter",
15
+ label: a("dataTable.indicatorFilteredAriaLabel")
16
+ }
17
+ }, { colorClass: i, label: o } = t[r];
18
+ return /* @__PURE__ */ e(
19
+ "span",
20
+ {
21
+ className: n("w-2 h-2 rounded-[2px] inline-block shrink-0", i, l),
22
+ title: o,
23
+ "aria-label": o
24
+ }
25
+ );
26
+ };
27
+ c.displayName = "ColumnIndicator";
28
+ export {
29
+ c as ColumnIndicator
30
+ };
@@ -1,106 +1,114 @@
1
- import { jsx as U } from "react/jsx-runtime";
2
- import { useState as j, useRef as R, useCallback as L, useEffect as B } from "react";
3
- import { useDataTable as ee } from "./data-table-context.js";
4
- import { NestedList as te } from "../nested-list/nested-list.js";
5
- import { SelectionMode as ne } from "../types/nested-list.types.js";
6
- import { mergePartialOrderedColumnState as le } from "./data-table-column-state.js";
7
- import { useImpactNovaI18n as oe } from "../../../i18n/ImpactNovaI18nContext.js";
8
- function re(v) {
9
- const T = [];
10
- let h = v.getOriginalParent();
11
- for (; h; ) {
12
- const M = h.getColGroupDef();
13
- M?.headerName && M?.children && T.push(h), h = h.getOriginalParent();
1
+ import { jsxs as ce, jsx as y } from "react/jsx-runtime";
2
+ import { useState as W, useRef as R, useCallback as g, useEffect as J } from "react";
3
+ import { useDataTable as se } from "./data-table-context.js";
4
+ import { NestedList as ae } from "../nested-list/nested-list.js";
5
+ import { SelectionMode as de } from "../types/nested-list.types.js";
6
+ import { mergePartialOrderedColumnState as ue } from "./data-table-column-state.js";
7
+ import { PinSwitch as fe } from "./pin-switch.js";
8
+ import { ColumnIndicator as Q } from "./column-indicator.js";
9
+ import { IndicatorLegend as pe } from "./indicator-legend.js";
10
+ import { useImpactNovaI18n as he } from "../../../i18n/ImpactNovaI18nContext.js";
11
+ function me(E) {
12
+ const P = [];
13
+ let C = E.getOriginalParent();
14
+ for (; C; ) {
15
+ const w = C.getColGroupDef();
16
+ w?.headerName && w?.children && P.push(C), C = C.getOriginalParent();
14
17
  }
15
- return T.reverse(), T;
18
+ return P.reverse(), P;
16
19
  }
17
- const ce = 300, q = 100, he = ({
18
- enableApplyDiscard: v = !1,
19
- showSearch: T = !0,
20
- showSelectAll: h = !0,
21
- showCollapse: M = !0
20
+ const ge = 300, K = 100, Ee = ({
21
+ enableApplyDiscard: E = !1,
22
+ showSearch: P = !0,
23
+ showSelectAll: C = !0,
24
+ showCollapse: w = !0
22
25
  }) => {
23
- const { gridApi: e } = ee(), { t: D } = oe(), [Y, F] = j([]), [H, J] = j(!1), k = R(!1), z = R(null), x = R(0), W = R({}), [K, Q] = j(!1), E = L(() => {
24
- if (!e || k.current) return;
25
- const r = e.getColumnState(), u = e.getColumns() || [], c = new Map(u.map((l) => [l.getColId(), l])), i = [], s = [], t = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
26
- f.set(i, "f"), f.set(s, "s");
27
- let P = 0;
28
- const G = (l) => {
29
- let n = f.get(l);
30
- return n === void 0 && (n = `n${P++}`, f.set(l, n)), n;
31
- }, N = (l, n) => {
32
- const o = l.getGroupId(), C = G(n), I = `${o}::${C}`, b = t.get(I);
33
- if (b && b.list === n && n[n.length - 1] === b.node)
34
- return b.node;
35
- const y = S.get(I) || 0;
36
- S.set(I, y + 1);
37
- const p = l.getColGroupDef(), w = {
38
- id: y === 0 ? `${o}__${C}` : `${o}__${C}__${y}`,
39
- label: p?.headerName || o,
26
+ const { gridApi: n } = se(), { t: L } = he(), [X, F] = W([]), [Z, ee] = W(!1), N = R(!1), $ = R(null), M = R(0), V = R({}), [B, te] = W(!1), x = g(() => {
27
+ if (!n || N.current) return;
28
+ const r = n.getColumnState(), i = n.getColumns() || [], t = new Map(i.map((o) => [o.getColId(), o])), s = [], l = [], e = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
29
+ f.set(s, "f"), f.set(l, "s");
30
+ let p = 0;
31
+ const T = (o) => {
32
+ let c = f.get(o);
33
+ return c === void 0 && (c = `n${p++}`, f.set(o, c)), c;
34
+ }, h = (o, c) => {
35
+ const a = o.getGroupId(), S = T(c), D = `${a}::${S}`, k = e.get(D);
36
+ if (k && k.list === c && c[c.length - 1] === k.node)
37
+ return k.node;
38
+ const _ = v.get(D) || 0;
39
+ v.set(D, _ + 1);
40
+ const O = o.getColGroupDef(), A = {
41
+ id: _ === 0 ? `${a}__${S}` : `${a}__${S}__${_}`,
42
+ label: O?.headerName || a,
40
43
  checked: !0,
41
44
  children: [],
42
45
  category: "group"
43
46
  };
44
- return n.push(w), t.set(I, { list: n, node: w }), w;
47
+ return c.push(A), e.set(D, { list: c, node: A }), A;
45
48
  };
46
- let a = 0, $ = 0, m = 0, d = 0;
47
- r.forEach((l) => {
48
- const n = c.get(l.colId);
49
- if (!n) return;
50
- let o = e.getDisplayNameForColumn(n, "header");
51
- if (o === "") return;
52
- if (o == null) {
53
- const p = n.getColDef();
54
- if (p.headerName === "") return;
55
- o = p.headerName || p.field || l.colId;
49
+ let d = 0, j = 0, m = 0, u = 0;
50
+ r.forEach((o) => {
51
+ const c = t.get(o.colId);
52
+ if (!c) return;
53
+ let a = n.getDisplayNameForColumn(c, "header");
54
+ if (a === "") return;
55
+ if (a == null) {
56
+ const b = c.getColDef();
57
+ if (b.headerName === "") return;
58
+ a = b.headerName || b.field || o.colId;
56
59
  }
57
- if (!o || o.trim() === "")
60
+ if (!a || a.trim() === "")
58
61
  return;
59
- const C = !l.hide, I = {
60
- id: l.colId,
61
- label: o,
62
- checked: C
62
+ const S = !o.hide, D = !!o.sort, k = c.isFilterActive(), _ = o.pinned === "left" ? "left" : o.pinned === "right" ? "right" : null, O = {
63
+ id: o.colId,
64
+ label: a,
65
+ checked: S,
66
+ data: {
67
+ hasSortApplied: D,
68
+ hasFilterApplied: k,
69
+ pinned: _
70
+ }
63
71
  };
64
- l.pinned ? (a++, C && $++) : (m++, C && d++);
65
- const b = l.pinned ? i : s, y = re(n);
66
- if (y.length > 0) {
67
- let p = b, O = null;
68
- for (const w of y)
69
- O = N(w, p), p = O.children;
70
- O.children.push(I);
72
+ o.pinned ? (d++, S && j++) : (m++, S && u++);
73
+ const U = o.pinned ? s : l, A = me(c);
74
+ if (A.length > 0) {
75
+ let b = U, q = null;
76
+ for (const ie of A)
77
+ q = h(ie, b), b = q.children;
78
+ q.children.push(O);
71
79
  } else
72
- b.push(I);
80
+ U.push(O);
73
81
  });
74
- const g = (l) => {
75
- let n = l.length > 0;
76
- for (const o of l)
77
- o.children && (o.checked = g(o.children)), o.checked || (n = !1);
78
- return n;
82
+ const I = (o) => {
83
+ let c = o.length > 0;
84
+ for (const a of o)
85
+ a.children && (a.checked = I(a.children)), a.checked || (c = !1);
86
+ return c;
79
87
  };
80
- g(i), g(s);
81
- const _ = [
88
+ I(s), I(l);
89
+ const G = [
82
90
  {
83
91
  id: "root-frozen",
84
- label: D("dataTable.frozenColumns"),
85
- checked: a > 0 && $ === a,
86
- children: i,
92
+ label: L("dataTable.frozenColumns"),
93
+ checked: d > 0 && j === d,
94
+ children: s,
87
95
  category: "structure",
88
96
  isDragDisabled: !0
89
97
  },
90
98
  {
91
99
  id: "root-scrollable",
92
- label: D("dataTable.scrollableColumns"),
93
- checked: m > 0 && d === m,
94
- children: s,
100
+ label: L("dataTable.scrollableColumns"),
101
+ checked: m > 0 && u === m,
102
+ children: l,
95
103
  category: "structure",
96
104
  isDragDisabled: !0
97
105
  }
98
106
  ];
99
- F(_), J(!0);
100
- }, [e, D]);
101
- B(() => {
102
- if (!e) return;
103
- const r = setTimeout(() => E(), 0), u = [
107
+ F(G), ee(!0);
108
+ }, [n, L]);
109
+ J(() => {
110
+ if (!n) return;
111
+ const r = setTimeout(() => x(), 0), i = [
104
112
  "columnVisible",
105
113
  "columnPinned",
106
114
  "columnMoved",
@@ -112,115 +120,163 @@ const ce = 300, q = 100, he = ({
112
120
  "columnEverythingChanged",
113
121
  "dragStopped",
114
122
  "columnValueChanged",
115
- "displayedColumnsChanged"
123
+ "displayedColumnsChanged",
124
+ "sortChanged",
125
+ "filterChanged"
116
126
  ];
117
- let c = null;
118
- const i = () => {
119
- c && clearTimeout(c), c = setTimeout(() => {
120
- if (c = null, k.current) return;
121
- const s = z.current?.querySelector('[data-component="nested-list"] .overflow-y-auto');
122
- s && (x.current = s.scrollTop), E(), Q((t) => !t);
127
+ let t = null;
128
+ const s = () => {
129
+ t && clearTimeout(t), t = setTimeout(() => {
130
+ if (t = null, N.current) return;
131
+ const l = $.current?.querySelector('[data-component="nested-list"] .overflow-y-auto');
132
+ l && (M.current = l.scrollTop), x(), te((e) => !e);
123
133
  }, 150);
124
134
  };
125
- return e.isDestroyed() || u.forEach((s) => e.addEventListener(s, i)), () => {
126
- clearTimeout(r), c && clearTimeout(c), e.isDestroyed() || u.forEach((s) => e.removeEventListener(s, i));
135
+ return n.isDestroyed() || i.forEach((l) => n.addEventListener(l, s)), () => {
136
+ clearTimeout(r), t && clearTimeout(t), n.isDestroyed() || i.forEach((l) => n.removeEventListener(l, s));
127
137
  };
128
- }, [e, E]), B(() => {
129
- if (x.current === 0) return;
138
+ }, [n, x]), J(() => {
139
+ if (M.current === 0) return;
130
140
  const r = requestAnimationFrame(() => {
131
- const u = z.current?.querySelector('[data-component="nested-list"] .overflow-y-auto');
132
- u && (u.scrollTop = x.current, x.current = 0);
141
+ const i = $.current?.querySelector('[data-component="nested-list"] .overflow-y-auto');
142
+ i && (i.scrollTop = M.current, M.current = 0);
133
143
  });
134
144
  return () => cancelAnimationFrame(r);
135
- }, [K]);
136
- const V = L((r) => {
137
- const u = [], c = (i, s) => {
138
- i.forEach((t) => {
139
- if (t.id === "root-frozen") {
140
- t.children && c(t.children, "left");
145
+ }, [B]);
146
+ const Y = g((r) => {
147
+ const i = [], t = (s, l) => {
148
+ s.forEach((e) => {
149
+ if (e.id === "root-frozen") {
150
+ e.children && t(e.children, "left");
141
151
  return;
142
152
  }
143
- if (t.id === "root-scrollable") {
144
- t.children && c(t.children, null);
153
+ if (e.id === "root-scrollable") {
154
+ e.children && t(e.children, null);
145
155
  return;
146
156
  }
147
- t.category === "group" || t.children && t.children.length > 0 ? t.children && c(t.children, s) : e?.getColumn(t.id) && u.push({
148
- colId: t.id,
149
- pinned: s,
150
- hide: !t.checked
151
- });
157
+ if (e.category === "group" || e.children && e.children.length > 0)
158
+ e.children && t(e.children, l);
159
+ else if (n?.getColumn(e.id)) {
160
+ let p;
161
+ if (l === null)
162
+ p = null;
163
+ else {
164
+ const h = e.data?.pinned;
165
+ p = h === "left" || h === "right" ? h : l;
166
+ }
167
+ i.push({
168
+ colId: e.id,
169
+ pinned: p,
170
+ hide: !e.checked
171
+ });
172
+ }
152
173
  });
153
174
  };
154
- return c(r, null), u;
155
- }, [e]), A = L((r) => {
156
- if (!e) return;
157
- k.current = !0;
158
- const u = V(r);
159
- if (u.length === 0) {
175
+ return t(r, null), i;
176
+ }, [n]), z = g((r) => {
177
+ if (!n) return;
178
+ N.current = !0;
179
+ const i = Y(r);
180
+ if (i.length === 0) {
160
181
  setTimeout(() => {
161
- k.current = !1;
162
- }, q);
182
+ N.current = !1;
183
+ }, K);
163
184
  return;
164
185
  }
165
- const c = e.getColumnState(), i = le(c, u), s = new Set(c.filter((a) => a.pinned).map((a) => a.colId)), t = i.filter((a) => a.pinned && !s.has(a.colId)), S = new Set(t.map((a) => a.colId));
166
- e.applyColumnState({ state: i, applyOrder: !0 });
186
+ const t = n.getColumnState(), s = ue(t, i), l = new Set(t.filter((d) => d.pinned).map((d) => d.colId)), e = s.filter((d) => d.pinned && !l.has(d.colId)), v = new Set(e.map((d) => d.colId));
187
+ n.applyColumnState({ state: s, applyOrder: !0 });
167
188
  const f = () => {
168
- k.current = !1, E();
189
+ N.current = !1, x();
169
190
  };
170
- if (S.size === 0) {
171
- setTimeout(f, q);
191
+ if (v.size === 0) {
192
+ setTimeout(f, K);
172
193
  return;
173
194
  }
174
- let P = !1, G = null;
175
- const N = () => {
176
- if (P || e.isDestroyed()) return;
177
- const a = e.getColumnState();
178
- if (t.filter((m) => {
179
- const d = a.find((g) => g.colId === m.colId);
180
- return d && !d.pinned;
195
+ let p = !1, T = null;
196
+ const h = () => {
197
+ if (p || n.isDestroyed()) return;
198
+ const d = n.getColumnState();
199
+ if (e.filter((m) => {
200
+ const u = d.find((I) => I.colId === m.colId);
201
+ return u && !u.pinned;
181
202
  }).length > 0) {
182
- P = !0, G && clearTimeout(G), e.removeEventListener("columnPinned", N);
183
- const m = i.filter((d) => d.pinned && !S.has(d.colId));
203
+ p = !0, T && clearTimeout(T), n.removeEventListener("columnPinned", h);
204
+ const m = s.filter((u) => u.pinned && !v.has(u.colId));
184
205
  if (m.length > 0) {
185
- const d = m[0], g = i.map(
186
- (_) => _.colId === d.colId ? { ..._, pinned: null } : _
206
+ const u = m[0], I = s.map(
207
+ (G) => G.colId === u.colId ? { ...G, pinned: null } : G
187
208
  );
188
- e.applyColumnState({ state: g, applyOrder: !0 });
209
+ n.applyColumnState({ state: I, applyOrder: !0 });
189
210
  }
190
- setTimeout(f, q);
211
+ setTimeout(f, K);
191
212
  }
192
213
  };
193
- e.addEventListener("columnPinned", N), G = setTimeout(() => {
194
- e.removeEventListener("columnPinned", N), P || f();
195
- }, ce);
196
- }, [e, V, E]), X = L((r) => {
197
- A(r);
198
- }, [A]), Z = L((r) => {
199
- v || A(r), F(r);
200
- }, [v, A]);
201
- return H ? /* @__PURE__ */ U("div", { ref: z, className: "flex flex-col h-full bg-canvas-elevated", children: /* @__PURE__ */ U(
202
- te,
214
+ n.addEventListener("columnPinned", h), T = setTimeout(() => {
215
+ n.removeEventListener("columnPinned", h), p || f();
216
+ }, ge);
217
+ }, [n, Y, x]), ne = g((r) => {
218
+ z(r);
219
+ }, [z]), re = g((r) => {
220
+ E || z(r), F(r);
221
+ }, [E, z]), H = g((r, i) => {
222
+ F((t) => {
223
+ const s = (l) => l.map((e) => e.id === r ? {
224
+ ...e,
225
+ data: {
226
+ ...e.data,
227
+ pinned: i
228
+ }
229
+ } : e.children ? {
230
+ ...e,
231
+ children: s(e.children)
232
+ } : e);
233
+ return s(t);
234
+ }), n && n.applyColumnState({
235
+ state: [{ colId: r, pinned: i }]
236
+ });
237
+ }, [n]), le = g((r, i) => {
238
+ if (!i.isLeaf) return null;
239
+ const t = r.data;
240
+ return !t?.hasSortApplied && !t?.hasFilterApplied ? null : /* @__PURE__ */ ce("span", { className: "inline-flex items-center gap-1 ml-1.5 shrink-0", children: [
241
+ t?.hasSortApplied && /* @__PURE__ */ y(Q, { type: "sort" }),
242
+ t?.hasFilterApplied && /* @__PURE__ */ y(Q, { type: "filter" })
243
+ ] });
244
+ }, []), oe = g((r, i) => {
245
+ const t = r.data;
246
+ return r.category === "structure" ? r.id !== "root-frozen" ? null : /* @__PURE__ */ y(pe, {}) : !i.isLeaf || !(t?.pinned === "left" || t?.pinned === "right") ? null : /* @__PURE__ */ y(
247
+ fe,
248
+ {
249
+ value: t?.pinned ?? null,
250
+ onChange: (l) => H(r.id, l),
251
+ className: "shrink-0"
252
+ }
253
+ );
254
+ }, [H]);
255
+ return Z ? /* @__PURE__ */ y("div", { ref: $, className: "flex flex-col h-full bg-canvas-elevated", children: /* @__PURE__ */ y(
256
+ ae,
203
257
  {
204
- items: Y,
205
- onChange: Z,
206
- onSubmit: X,
207
- enableApplyDiscard: v,
208
- enableSearch: T,
209
- enableSelectAll: h,
258
+ items: X,
259
+ onChange: re,
260
+ onSubmit: ne,
261
+ renderLabelExtras: le,
262
+ renderActions: oe,
263
+ enableApplyDiscard: E,
264
+ enableSearch: P,
265
+ enableSelectAll: C,
210
266
  enableDragDrop: !0,
211
267
  enableCollapse: !0,
212
- enableGlobalCollapse: M,
213
- selectionMode: ne.CASCADE_DOWN,
214
- searchPlaceholder: D("dataTable.searchColumnsPlaceholder"),
268
+ enableGlobalCollapse: w,
269
+ selectionMode: de.CASCADE_DOWN,
270
+ searchPlaceholder: L("dataTable.searchColumnsPlaceholder"),
215
271
  className: "h-full",
216
- initialCollapsedItems: W.current,
272
+ initialCollapsedItems: V.current,
217
273
  onCollapseChange: (r) => {
218
- W.current = r;
274
+ V.current = r;
219
275
  }
220
276
  },
221
- K ? "sync-a" : "sync-b"
222
- ) }) : /* @__PURE__ */ U("div", { className: "p-4 text-[13px] text-content-placeholder", children: D("dataTable.loadingColumns") });
277
+ B ? "sync-a" : "sync-b"
278
+ ) }) : /* @__PURE__ */ y("div", { className: "p-4 text-[13px] text-content-placeholder", children: L("dataTable.loadingColumns") });
223
279
  };
224
280
  export {
225
- he as DataTableColumnList
281
+ Ee as DataTableColumnList
226
282
  };