@nice2dev/ui 1.4.15 → 1.4.17

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 (33) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/NiceAlert-RVTgQxCE.cjs +1 -0
  3. package/dist/NiceDataGrid-DpSADM9L.cjs +10 -0
  4. package/dist/NiceForm-CzH9IPmZ.cjs +1 -0
  5. package/dist/{NiceHtmlEditor-By7R1wRo.cjs → NiceHtmlEditor-BEWNA_UI.cjs} +1 -1
  6. package/dist/NiceLoginForm-Bkm5j80r.cjs +1 -0
  7. package/dist/{NiceMention-i7n2BoMw.cjs → NiceMention-CrJJtDJx.cjs} +1 -1
  8. package/dist/{NiceModuleLifecyclePanel-DVHQuhc-.cjs → NiceModuleLifecyclePanel-CxVQOIIA.cjs} +1 -1
  9. package/dist/{NicePagination-D9JguOl0.cjs → NicePagination-CnKYyKI5.cjs} +1 -1
  10. package/dist/{NicePivotGrid-B_7iQJys.cjs → NicePivotGrid-BshofJh1.cjs} +1 -1
  11. package/dist/NiceSavedQueryPanel-C40zmo8O.cjs +587 -0
  12. package/dist/{NiceScheduler-B2DamQ_L.cjs → NiceScheduler-CSWtLS5G.cjs} +1 -1
  13. package/dist/{core-lazy-ChKRuEPb.cjs → core-lazy-DUKT6R8d.cjs} +1 -1
  14. package/dist/data/NiceRowEditDialog.mjs +42 -35
  15. package/dist/data/NiceTreeGrid.mjs +512 -474
  16. package/dist/data.cjs +1 -1
  17. package/dist/data.d.ts +30 -3
  18. package/dist/editors/forms/NiceForm.mjs +55 -52
  19. package/dist/editors/inputs/NiceRadioGroup.mjs +12 -12
  20. package/dist/editors/inputs/NiceSelect.mjs +51 -51
  21. package/dist/editors.cjs +1 -1
  22. package/dist/feedback.cjs +1 -1
  23. package/dist/index.cjs +101 -101
  24. package/dist/index.d.ts +31 -4
  25. package/dist/lazy.cjs +1 -1
  26. package/dist/navigation.cjs +1 -1
  27. package/dist/{no-code-CN_q6TcB.cjs → no-code-DPc82kyy.cjs} +11 -11
  28. package/dist/no-code.cjs +1 -1
  29. package/package.json +4 -4
  30. package/dist/NiceDataGrid-B1AOjgjm.cjs +0 -10
  31. package/dist/NiceForm-fmePSeA9.cjs +0 -1
  32. package/dist/NiceLoginForm-C2-WgRn0.cjs +0 -1
  33. package/dist/NiceSavedQueryPanel-ChY4HwpM.cjs +0 -587
@@ -1,19 +1,19 @@
1
- import { jsx as a, jsxs as h, Fragment as ve } from "react/jsx-runtime";
2
- import { useNiceTranslation as vr, useNiceAccessMode as wr, useControllableState as at, useVirtualScroll as Cr, useTreeFocus as Sr, NiceThemeContext as xr, useOverlayFocus as Nr, useRovingFocus as Er, NiceIcon as te } from "@nice2dev/ui-core";
3
- import Tr, { useCallback as u, useMemo as g, useState as T, useRef as A, useEffect as be, useContext as Ar, memo as Mr } from "react";
4
- import { createPortal as Dr } from "react-dom";
5
- import { NiceHighlight as Rr } from "../typography/NiceHighlight.mjs";
6
- import { NiceRowEditDialog as Kr, rowEditFormItems as Pr } from "./NiceRowEditDialog.mjs";
7
- import { buildTreeFromNested as Gr, buildTreeFromFlat as Lr, attachLoadedChildren as Ir, collectParentKeys as It, filterTreeBySearch as Or, filterTreeChecked as $r, collectExpandableKeys as zr, sortTree as Vr, flattenVisible as Yr, collectKeys as Br } from "./NiceTreeGrid.helpers.mjs";
8
- import { buildTreeCheckIndex as Fr, normalizeCheckedKeys as jr, computeTreeCheck as An, emitCheckedKeys as Ot, toggleTreeCheck as Hr, setTreeChecked as Mn } from "./treeCheck.mjs";
9
- import { useTreeRowDrop as Ur, treeKeyboardMove as Wr, treeKeyboardTarget as qr } from "./treeRowDrop.mjs";
10
- const Xr = [], Jr = [], $t = [], Qr = /* @__PURE__ */ new Set(), Zr = /* @__PURE__ */ new Map(), ea = [], ta = /* @__PURE__ */ new Map(), na = /* @__PURE__ */ new Map(), Dn = [
1
+ import { jsx as a, jsxs as p, Fragment as be } from "react/jsx-runtime";
2
+ import { useNiceTranslation as $r, useNiceAccessMode as zr, useControllableState as it, useVirtualScroll as Vr, useTreeFocus as Yr, NiceThemeContext as Br, useOverlayFocus as Fr, useRovingFocus as Hr, NiceIcon as te } from "@nice2dev/ui-core";
3
+ import jr, { useCallback as u, useMemo as g, useState as k, useRef as A, useEffect as ke, useImperativeHandle as Ur, useContext as Wr, memo as qr } from "react";
4
+ import { createPortal as Xr } from "react-dom";
5
+ import { NiceHighlight as Jr } from "../typography/NiceHighlight.mjs";
6
+ import { NiceRowEditDialog as Qr, rowEditFormItems as Zr } from "./NiceRowEditDialog.mjs";
7
+ import { buildTreeFromNested as ea, buildTreeFromFlat as ta, attachLoadedChildren as na, collectParentKeys as Yt, filterTreeBySearch as ra, filterTreeChecked as aa, collectExpandableKeys as oa, sortTree as ia, flattenVisible as ca, collectKeys as la } from "./NiceTreeGrid.helpers.mjs";
8
+ import { buildTreeCheckIndex as sa, normalizeCheckedKeys as da, computeTreeCheck as In, emitCheckedKeys as Bt, toggleTreeCheck as ua, setTreeChecked as $n } from "./treeCheck.mjs";
9
+ import { useTreeRowDrop as ga, treeKeyboardMove as fa, treeKeyboardTarget as ha } from "./treeRowDrop.mjs";
10
+ const pa = [], ma = [], Ft = [], ya = /* @__PURE__ */ new Set(), _a = /* @__PURE__ */ new Map(), va = [], ka = /* @__PURE__ */ new Map(), ba = /* @__PURE__ */ new Map(), zn = [
11
11
  "expandAll",
12
12
  "collapseAll",
13
13
  "onlyChecked",
14
14
  "clearChecked"
15
- ], Rn = 10;
16
- function ra({
15
+ ], Vn = 10;
16
+ function wa({
17
17
  node: b,
18
18
  level: ne,
19
19
  posInSet: Y,
@@ -23,45 +23,45 @@ function ra({
23
23
  columns: L,
24
24
  highlight: xe,
25
25
  query: re,
26
- expandable: C,
27
- expanded: E,
26
+ expandable: x,
27
+ expanded: T,
28
28
  busy: ae,
29
- expandLabel: Ne,
29
+ expandLabel: Ee,
30
30
  collapseLabel: oe,
31
- subtreeAction: ce,
32
- subtreeLabel: Ee,
33
- checkMode: I,
34
- hasCheckbox: S,
35
- checkState: le,
36
- checkLabel: ot,
37
- locked: p,
31
+ subtreeAction: ie,
32
+ subtreeLabel: Ne,
33
+ checkMode: O,
34
+ hasCheckbox: w,
35
+ checkState: ce,
36
+ checkLabel: ct,
37
+ locked: h,
38
38
  countChecked: Te,
39
- countTotal: ie,
39
+ countTotal: le,
40
40
  countTitle: Ae,
41
41
  selectColumn: Me,
42
- selected: O,
42
+ selected: I,
43
43
  selectLabel: se,
44
- readOnly: De,
45
- className: Re,
44
+ readOnly: Re,
45
+ className: De,
46
46
  clickable: Ke,
47
47
  height: D,
48
- draggable: ct,
48
+ draggable: lt,
49
49
  drop: Pe,
50
- dragging: lt,
50
+ dragging: st,
51
51
  handlers: $
52
52
  }) {
53
- const B = S ? /* @__PURE__ */ a(
53
+ const B = w ? /* @__PURE__ */ a(
54
54
  "input",
55
55
  {
56
56
  type: "checkbox",
57
57
  className: "nice-treegrid__check-input",
58
- checked: le === "checked",
58
+ checked: ce === "checked",
59
59
  ref: (m) => {
60
- m && (m.indeterminate = le === "indeterminate");
60
+ m && (m.indeterminate = ce === "indeterminate");
61
61
  },
62
- disabled: p || De,
62
+ disabled: h || Re,
63
63
  tabIndex: -1,
64
- "aria-label": ot,
64
+ "aria-label": ct,
65
65
  onClick: (m) => m.stopPropagation(),
66
66
  onChange: (m) => {
67
67
  $.toggleCheck(b.key), m.currentTarget.closest("tr")?.focus({ preventScroll: !0 });
@@ -69,104 +69,104 @@ function ra({
69
69
  }
70
70
  ) : null, Ge = [
71
71
  "nice-treegrid__row",
72
- I !== "none" && !S ? "nice-treegrid__row--info" : "",
73
- p ? "nice-treegrid__row--disabled" : "",
74
- S && le === "checked" ? "nice-treegrid__row--checked" : "",
75
- O ? "nice-datagrid__row--selected" : "",
72
+ O !== "none" && !w ? "nice-treegrid__row--info" : "",
73
+ h ? "nice-treegrid__row--disabled" : "",
74
+ w && ce === "checked" ? "nice-treegrid__row--checked" : "",
75
+ I ? "nice-datagrid__row--selected" : "",
76
76
  Pe ? `nice-treegrid__row--drop-${Pe}` : "",
77
- lt ? "nice-treegrid__row--dragging" : "",
78
- Re ?? ""
77
+ st ? "nice-treegrid__row--dragging" : "",
78
+ De ?? ""
79
79
  ].filter(Boolean).join(" ");
80
- return /* @__PURE__ */ h(
80
+ return /* @__PURE__ */ p(
81
81
  "tr",
82
82
  {
83
83
  className: Ge,
84
84
  "data-key": b.key,
85
- draggable: ct || void 0,
85
+ draggable: lt || void 0,
86
86
  tabIndex: -1,
87
87
  "aria-level": ne,
88
88
  "aria-posinset": Y,
89
89
  "aria-setsize": we,
90
90
  "aria-rowindex": Se,
91
- "aria-expanded": C ? E : void 0,
92
- "aria-selected": O,
93
- "aria-disabled": p || void 0,
91
+ "aria-expanded": x ? T : void 0,
92
+ "aria-selected": I,
93
+ "aria-disabled": h || void 0,
94
94
  "aria-busy": ae || void 0,
95
95
  onClick: () => $.rowClick(b),
96
96
  style: Ke || D !== void 0 ? { cursor: Ke ? "pointer" : void 0, height: D } : void 0,
97
97
  children: [
98
- I === "column" && /* @__PURE__ */ a("td", { className: "nice-datagrid__checkbox nice-treegrid__check-cell", children: B }),
98
+ O === "column" && /* @__PURE__ */ a("td", { className: "nice-datagrid__checkbox nice-treegrid__check-cell", children: B }),
99
99
  Me && /* @__PURE__ */ a("td", { className: "nice-datagrid__checkbox", children: /* @__PURE__ */ a(
100
100
  "input",
101
101
  {
102
102
  type: "checkbox",
103
- checked: !!O,
103
+ checked: !!I,
104
104
  onChange: () => $.toggleSelected(b.key),
105
105
  onClick: (m) => m.stopPropagation(),
106
- disabled: De,
106
+ disabled: Re,
107
107
  tabIndex: -1,
108
108
  "aria-label": se
109
109
  }
110
110
  ) }),
111
111
  L.map((m, F) => {
112
112
  const de = b.data[m.field];
113
- return /* @__PURE__ */ h("td", { style: { textAlign: m.align }, children: [
114
- F === 0 && /* @__PURE__ */ h(ve, { children: [
113
+ return /* @__PURE__ */ p("td", { style: { textAlign: m.align }, children: [
114
+ F === 0 && /* @__PURE__ */ p(be, { children: [
115
115
  /* @__PURE__ */ a("span", { className: "nice-treegrid__indent", style: { width: (ne - 1) * 20 } }),
116
116
  /* @__PURE__ */ a(
117
117
  "button",
118
118
  {
119
119
  type: "button",
120
- className: `nice-treegrid__toggle ${C ? "" : "nice-treegrid__toggle--leaf"}`,
120
+ className: `nice-treegrid__toggle ${x ? "" : "nice-treegrid__toggle--leaf"}`,
121
121
  onClick: (z) => {
122
- z.stopPropagation(), C && $.toggleExpand(b.key, z.altKey || z.shiftKey);
122
+ z.stopPropagation(), x && $.toggleExpand(b.key, z.altKey || z.shiftKey);
123
123
  },
124
124
  tabIndex: -1,
125
- "aria-hidden": C ? void 0 : !0,
126
- "aria-label": C ? E ? oe : Ne : void 0,
127
- children: C ? /* @__PURE__ */ a(te, { name: E ? "chevron-down" : "chevron-right", size: 12 }) : ""
125
+ "aria-hidden": x ? void 0 : !0,
126
+ "aria-label": x ? T ? oe : Ee : void 0,
127
+ children: x ? /* @__PURE__ */ a(te, { name: T ? "chevron-down" : "chevron-right", size: 12 }) : ""
128
128
  }
129
129
  ),
130
- I === "tree" && /* @__PURE__ */ a(
130
+ O === "tree" && /* @__PURE__ */ a(
131
131
  "span",
132
132
  {
133
- className: `nice-treegrid__check${S ? "" : " nice-treegrid__check--none"}`,
133
+ className: `nice-treegrid__check${w ? "" : " nice-treegrid__check--none"}`,
134
134
  children: B
135
135
  }
136
136
  )
137
137
  ] }),
138
138
  m.render ? m.render(de, b.data, Ce) : xe[F] && re ? /* @__PURE__ */ a(
139
- Rr,
139
+ Jr,
140
140
  {
141
141
  text: String(de ?? ""),
142
142
  query: re,
143
143
  highlightClassName: "nice-treegrid__match"
144
144
  }
145
145
  ) : String(de ?? ""),
146
- F === 0 && ie > 0 && /* @__PURE__ */ h(
146
+ F === 0 && le > 0 && /* @__PURE__ */ p(
147
147
  "span",
148
148
  {
149
- className: `nice-treegrid__count${Te === ie ? " nice-treegrid__count--full" : ""}`,
149
+ className: `nice-treegrid__count${Te === le ? " nice-treegrid__count--full" : ""}`,
150
150
  title: Ae,
151
151
  children: [
152
152
  Te,
153
153
  "/",
154
- ie
154
+ le
155
155
  ]
156
156
  }
157
157
  ),
158
- F === 0 && ce && /* @__PURE__ */ a(
158
+ F === 0 && ie && /* @__PURE__ */ a(
159
159
  "button",
160
160
  {
161
161
  type: "button",
162
162
  className: "nice-treegrid__row-action",
163
163
  tabIndex: -1,
164
- "aria-label": Ee,
165
- title: Ee,
164
+ "aria-label": Ne,
165
+ title: Ne,
166
166
  onClick: (z) => {
167
- z.stopPropagation(), $.setSubtreeExpanded(b.key, ce === "expand");
167
+ z.stopPropagation(), $.setSubtreeExpanded(b.key, ie === "expand");
168
168
  },
169
- children: /* @__PURE__ */ a(te, { name: ce === "expand" ? "expand" : "collapse", size: 12 })
169
+ children: /* @__PURE__ */ a(te, { name: ie === "expand" ? "expand" : "collapse", size: 12 })
170
170
  }
171
171
  )
172
172
  ] }, m.field);
@@ -175,10 +175,10 @@ function ra({
175
175
  }
176
176
  );
177
177
  }
178
- const aa = /* @__PURE__ */ Mr(ra);
179
- function pa({
180
- columns: b = Xr,
181
- data: ne = Jr,
178
+ const Ca = /* @__PURE__ */ qr(wa);
179
+ function Pa({
180
+ columns: b = pa,
181
+ data: ne = ma,
182
182
  keyField: Y = "id",
183
183
  parentKeyField: we = "parentId",
184
184
  nested: Ce = !1,
@@ -186,31 +186,31 @@ function pa({
186
186
  expandedKeys: L,
187
187
  defaultExpandedKeys: xe,
188
188
  onExpandedChange: re,
189
- hasChildren: C,
190
- loadChildren: E,
189
+ hasChildren: x,
190
+ loadChildren: T,
191
191
  rowActions: ae,
192
- defaultExpandAll: Ne = !1,
192
+ defaultExpandAll: Ee = !1,
193
193
  sortable: oe = !0,
194
- sortField: ce,
195
- sortDirection: Ee,
196
- onSort: I,
197
- selectable: S,
198
- selectedKeys: le,
199
- onSelectionChange: ot,
200
- checkable: p,
194
+ sortField: ie,
195
+ sortDirection: Ne,
196
+ onSort: O,
197
+ selectable: w,
198
+ selectedKeys: ce,
199
+ onSelectionChange: ct,
200
+ checkable: h,
201
201
  checkedKeys: Te,
202
- defaultCheckedKeys: ie,
202
+ defaultCheckedKeys: le,
203
203
  onCheckedChange: Ae,
204
204
  checkStrategy: Me = "all",
205
- isRowCheckable: O,
205
+ isRowCheckable: I,
206
206
  isRowDisabled: se,
207
- checkboxPlacement: De = "tree",
208
- checkOnRowClick: Re,
207
+ checkboxPlacement: Re = "tree",
208
+ checkOnRowClick: De,
209
209
  showCheckedCount: Ke,
210
210
  checkedSummary: D,
211
- showSelectAll: ct = !0,
211
+ showSelectAll: lt = !0,
212
212
  showOnlyChecked: Pe,
213
- defaultShowOnlyChecked: lt,
213
+ defaultShowOnlyChecked: st,
214
214
  onShowOnlyCheckedChange: $,
215
215
  toolbarActions: B,
216
216
  searchable: Ge,
@@ -218,337 +218,344 @@ function pa({
218
218
  searchText: F,
219
219
  defaultSearchText: de,
220
220
  onSearchChange: z,
221
- searchFields: zt,
221
+ searchFields: Ht,
222
222
  searchFilter: ue,
223
- searchKeepDescendants: Vt = !1,
224
- searchAutoExpand: Yt = !0,
225
- highlightMatches: Bt = !0,
226
- rowClassName: it,
227
- getRowLabel: Ft,
228
- virtualScroll: Kn,
223
+ searchKeepDescendants: jt = !1,
224
+ searchAutoExpand: Ut = !0,
225
+ highlightMatches: Wt = !0,
226
+ rowClassName: dt,
227
+ getRowLabel: qt,
228
+ virtualScroll: Yn,
229
229
  rowHeight: ge = 36,
230
- height: st,
231
- striped: Pn,
232
- compact: Gn,
233
- size: Ln = "md",
234
- loading: jt,
235
- disabled: In,
236
- readOnly: On,
230
+ height: ut,
231
+ striped: Bn,
232
+ compact: Fn,
233
+ size: Hn = "md",
234
+ loading: Xt,
235
+ disabled: jn,
236
+ readOnly: Un,
237
237
  error: Le,
238
- emptyText: $n,
239
- toolbar: Ht,
240
- onRowClick: Ut,
241
- contextMenuItems: Ie,
242
- rowDraggable: dt,
243
- canDrop: Wt,
244
- onRowDrop: ut,
245
- editMode: zn,
246
- formItems: Vn,
247
- formColumns: Yn = 2,
248
- editFormTitle: Bn,
249
- formProps: Fn,
250
- onRowEdit: qt,
251
- className: jn,
252
- style: Hn,
253
- id: Xt,
254
- testId: Un,
255
- "data-testid": Wn,
256
- accessMode: qn,
257
- "aria-label": Xn,
258
- "aria-labelledby": Jn
238
+ emptyText: Wn,
239
+ toolbar: Jt,
240
+ onRowClick: Qt,
241
+ contextMenuItems: Oe,
242
+ rowDraggable: gt,
243
+ canDrop: Zt,
244
+ onRowDrop: ft,
245
+ editMode: qn,
246
+ formItems: Xn,
247
+ formColumns: Jn = 2,
248
+ editFormTitle: Qn,
249
+ formProps: Zn,
250
+ onRowEdit: en,
251
+ apiRef: er,
252
+ selectionMode: tr,
253
+ selectedKey: ht,
254
+ defaultSelectedKey: nr,
255
+ onSelectedKeyChange: rr,
256
+ className: ar,
257
+ style: or,
258
+ id: tn,
259
+ testId: ir,
260
+ "data-testid": cr,
261
+ accessMode: lr,
262
+ "aria-label": sr,
263
+ "aria-labelledby": dr
259
264
  }) {
260
- const { t: i } = vr(), gt = wr(qn, Xt), R = !!In || gt === "disabled", M = !!On || gt === "readOnly", Oe = u(
261
- (e, t) => Ce ? Gr(e, Se, Y, t) : Lr(e, Y, we, t),
265
+ const { t: l } = $r(), pt = zr(lr, tn), M = !!jn || pt === "disabled", R = !!Un || pt === "readOnly", Ie = u(
266
+ (e, t) => Ce ? ea(e, Se, Y, t) : ta(e, Y, we, t),
262
267
  [Y, we, Ce, Se]
263
- ), ft = g(() => Oe(ne, 0), [Oe, ne]), [fe, Qn] = T(ta), [ht, pt] = T(na), v = g(
264
- () => fe.size > 0 ? Ir(ft, fe, Oe) : ft,
265
- [ft, fe, Oe]
268
+ ), mt = g(() => Ie(ne, 0), [Ie, ne]), [fe, ur] = k(ka), [yt, _t] = k(ba), C = g(
269
+ () => fe.size > 0 ? na(mt, fe, Ie) : mt,
270
+ [mt, fe, Ie]
266
271
  ), f = g(() => {
267
272
  const e = /* @__PURE__ */ new Map(), t = (n) => n.forEach((r) => {
268
273
  e.set(r.key, r), t(r.children);
269
274
  });
270
- return t(v), e;
271
- }, [v]), $e = !!C || !!E, w = u(
275
+ return t(C), e;
276
+ }, [C]), $e = !!x || !!T, S = u(
272
277
  (e) => {
273
278
  if (!$e)
274
279
  return !1;
275
280
  const t = f.get(e);
276
- return !!t && t.children.length === 0 && !fe.has(e) && (C ? C(t.data) : !0);
281
+ return !!t && t.children.length === 0 && !fe.has(e) && (x ? x(t.data) : !0);
277
282
  },
278
- [$e, f, fe, C]
279
- ), mt = A(/* @__PURE__ */ new Set()), yt = A(!0);
280
- be(() => (yt.current = !0, () => {
281
- yt.current = !1;
283
+ [$e, f, fe, x]
284
+ ), vt = A(/* @__PURE__ */ new Set()), kt = A(!0);
285
+ ke(() => (kt.current = !0, () => {
286
+ kt.current = !1;
282
287
  }), []);
283
- const Jt = u(
288
+ const nn = u(
284
289
  (e) => {
285
290
  const t = f.get(e);
286
- if (!E || !t || mt.current.has(e))
291
+ if (!T || !t || vt.current.has(e))
287
292
  return;
288
- mt.current.add(e);
293
+ vt.current.add(e);
289
294
  const n = (r) => {
290
- mt.current.delete(e), yt.current && (r && Qn((l) => new Map(l).set(e, r)), pt((l) => {
291
- const c = new Map(l);
292
- return r ? c.delete(e) : c.set(e, "error"), c;
295
+ vt.current.delete(e), kt.current && (r && ur((c) => new Map(c).set(e, r)), _t((c) => {
296
+ const i = new Map(c);
297
+ return r ? i.delete(e) : i.set(e, "error"), i;
293
298
  }));
294
299
  };
295
- pt((r) => new Map(r).set(e, "loading")), E(t.data).then(
300
+ _t((r) => new Map(r).set(e, "loading")), T(t.data).then(
296
301
  (r) => n(Array.isArray(r) ? r : []),
297
302
  () => n(null)
298
303
  );
299
304
  },
300
- [E, f]
301
- ), Zn = u((e) => {
302
- pt((t) => {
305
+ [T, f]
306
+ ), gr = u((e) => {
307
+ _t((t) => {
303
308
  const n = new Map(t);
304
309
  return n.delete(e), n;
305
310
  });
306
- }, []), K = g(() => b.filter((e) => !e.hidden), [b]), ze = g(() => It(v), [v]), [_t, er] = T(null), he = g(() => {
311
+ }, []), K = g(() => b.filter((e) => !e.hidden), [b]), ze = g(() => Yt(C), [C]), [bt, fr] = k(null), he = g(() => {
307
312
  if (L)
308
313
  return new Set(L);
309
- if (_t)
310
- return _t;
311
- const e = new Set(xe ?? $t);
312
- return Ne && ze.forEach((t) => e.add(t)), e;
313
- }, [L, _t, xe, Ne, ze]), kt = A(he);
314
- kt.current = he;
314
+ if (bt)
315
+ return bt;
316
+ const e = new Set(xe ?? Ft);
317
+ return Ee && ze.forEach((t) => e.add(t)), e;
318
+ }, [L, bt, xe, Ee, ze]), wt = A(he);
319
+ wt.current = he;
315
320
  const Ve = u(
316
321
  (e) => {
317
- kt.current = e, L || er(e), re?.([...e]);
322
+ wt.current = e, L || fr(e), re?.([...e]);
318
323
  },
319
324
  [L, re]
320
- ), [Qt, tr] = T({
325
+ ), [rn, hr] = k({
321
326
  field: "",
322
327
  dir: null
323
- }), j = ce ?? Qt.field, P = Ee ?? Qt.dir, nr = u(
328
+ }), H = ie ?? rn.field, P = Ne ?? rn.dir, pr = u(
324
329
  (e) => {
325
- const t = j === e ? P === "asc" ? "desc" : P === "desc" ? null : "asc" : "asc";
326
- I ? I(e, t) : tr({ field: e, dir: t });
330
+ const t = H === e ? P === "asc" ? "desc" : P === "desc" ? null : "asc" : "asc";
331
+ O ? O(e, t) : hr({ field: e, dir: t });
327
332
  },
328
- [j, P, I]
329
- ), [rr, Zt] = at({
330
- value: le,
331
- fallbackValue: Qr,
332
- onChange: ot,
333
+ [H, P, O]
334
+ ), Ye = tr === "single" && !w, [mr, yr] = k(nr ?? null), an = ht !== void 0 ? ht : mr, [_r, on] = it({
335
+ value: ce,
336
+ fallbackValue: ya,
337
+ onChange: ct,
333
338
  componentName: "NiceTreeGrid"
334
- }), Ye = u(
339
+ }), Be = u(
335
340
  (e) => {
336
- Zt((t) => {
341
+ on((t) => {
337
342
  const n = new Set(t);
338
343
  return n.has(e) ? n.delete(e) : n.add(e), n;
339
344
  });
340
345
  },
341
- [Zt]
346
+ [on]
342
347
  ), o = g(
343
- () => p ? Fr(v, {
348
+ () => h ? sa(C, {
344
349
  getKey: (e) => e.key,
345
350
  getChildren: (e) => e.children,
346
- isCheckable: O ? (e) => O(e.data) : void 0,
351
+ isCheckable: I ? (e) => I(e.data) : void 0,
347
352
  isDisabled: se ? (e) => se(e.data) : void 0
348
353
  }) : null,
349
- [p, v, O, se]
350
- ), [en, tn] = at({
354
+ [h, C, I, se]
355
+ ), [cn, ln] = it({
351
356
  value: Te,
352
- defaultValue: ie,
353
- fallbackValue: $t,
357
+ defaultValue: le,
358
+ fallbackValue: Ft,
354
359
  componentName: "NiceTreeGrid"
355
360
  }), s = g(
356
- () => o ? jr(o, en) : null,
357
- [o, en]
361
+ () => o ? da(o, cn) : null,
362
+ [o, cn]
358
363
  ), y = g(
359
- () => o && s ? An(o, s.leaves) : null,
364
+ () => o && s ? In(o, s.leaves) : null,
360
365
  [o, s]
361
- ), nn = g(() => {
366
+ ), sn = g(() => {
362
367
  if (typeof D != "function" || !o || !s || !y)
363
368
  return null;
364
- const e = Ot(o, s.leaves, "leaves"), t = [];
369
+ const e = Bt(o, s.leaves, "leaves"), t = [];
365
370
  return e.forEach((n) => {
366
371
  const r = f.get(n);
367
372
  r && t.push(r.data);
368
373
  }), { checked: y.total.checked, total: y.total.total, leafKeys: e, rows: t };
369
- }, [D, o, s, y, f]), H = u(
374
+ }, [D, o, s, y, f]), j = u(
370
375
  (e, t) => {
371
376
  if (!o || !s || e === s.leaves)
372
377
  return;
373
- const n = Ot(o, e, Me, s.unknown);
374
- tn(n), Ae?.(n, {
378
+ const n = Bt(o, e, Me, s.unknown);
379
+ ln(n), Ae?.(n, {
375
380
  ...t,
376
- leafKeys: Ot(o, e, "leaves"),
377
- halfCheckedKeys: [...An(o, e).halfChecked]
381
+ leafKeys: Bt(o, e, "leaves"),
382
+ halfCheckedKeys: [...In(o, e).halfChecked]
378
383
  });
379
384
  },
380
- [o, s, Me, tn, Ae]
381
- ), Be = u(
385
+ [o, s, Me, ln, Ae]
386
+ ), Fe = u(
382
387
  (e) => {
383
388
  if (!o || !s)
384
389
  return;
385
- const t = Hr(o, s.leaves, e);
386
- H(t, {
390
+ const t = ua(o, s.leaves, e);
391
+ j(t, {
387
392
  source: "row",
388
393
  checked: t.size > s.leaves.size,
389
394
  key: e,
390
395
  row: f.get(e)?.data
391
396
  });
392
397
  },
393
- [o, s, H, f]
394
- ), [Fe, bt] = at({
398
+ [o, s, j, f]
399
+ ), [He, Ct] = it({
395
400
  value: F,
396
401
  defaultValue: de,
397
402
  fallbackValue: "",
398
403
  onChange: z,
399
404
  componentName: "NiceTreeGrid"
400
- }), x = Fe.trim(), je = g(
401
- () => zt ?? K.map((e) => e.field),
402
- [zt, K]
405
+ }), E = He.trim(), je = g(
406
+ () => Ht ?? K.map((e) => e.field),
407
+ [Ht, K]
403
408
  ), U = g(() => {
404
- if (!x)
409
+ if (!E)
405
410
  return null;
406
- const e = x.toLowerCase();
407
- return Or(v, ue ? (n) => ue(n.data, x) : (n) => je.some(
411
+ const e = E.toLowerCase();
412
+ return ra(C, ue ? (n) => ue(n.data, E) : (n) => je.some(
408
413
  (r) => String(n.data[r] ?? "").toLowerCase().includes(e)
409
- ), Vt);
410
- }, [v, x, ue, je, Vt]), pe = U?.tree ?? v, [rn, ar] = at({
414
+ ), jt);
415
+ }, [C, E, ue, je, jt]), pe = U?.tree ?? C, [dn, vr] = it({
411
416
  value: Pe,
412
- defaultValue: lt,
417
+ defaultValue: st,
413
418
  fallbackValue: !1,
414
419
  onChange: $,
415
420
  componentName: "NiceTreeGrid"
416
- }), G = !!p && rn && y !== null, W = g(
417
- () => G && y && o ? $r(pe, {
421
+ }), G = !!h && dn && y !== null, W = g(
422
+ () => G && y && o ? aa(pe, {
418
423
  state: y.state,
419
424
  isCheckable: o.isCheckable,
420
425
  isLeaf: o.isLeaf
421
426
  }) : pe,
422
427
  [G, y, o, pe]
423
- ), q = x !== "" || G, X = `${x}
424
- ${G ? 1 : 0}`, [an, on] = T(
428
+ ), q = E !== "" || G, X = `${E}
429
+ ${G ? 1 : 0}`, [un, gn] = k(
425
430
  () => ({ key: "", map: /* @__PURE__ */ new Map() })
426
- ), cn = an.key === X ? an.map : Zr, ln = g(() => {
431
+ ), fn = un.key === X ? un.map : _a, hn = g(() => {
427
432
  const e = /* @__PURE__ */ new Set();
428
- return U && Yt && U.expand.forEach((t) => e.add(t)), G && o && It(W).forEach((t) => {
433
+ return U && Ut && U.expand.forEach((t) => e.add(t)), G && o && Yt(W).forEach((t) => {
429
434
  o.isLeaf(t) || e.add(t);
430
435
  }), e;
431
- }, [U, Yt, G, o, W]), N = u(
432
- (e) => q ? cn.get(e) ?? (he.has(e) || ln.has(e)) : he.has(e),
433
- [q, cn, he, ln]
434
- ), He = u(
436
+ }, [U, Ut, G, o, W]), N = u(
437
+ (e) => q ? fn.get(e) ?? (he.has(e) || hn.has(e)) : he.has(e),
438
+ [q, fn, he, hn]
439
+ ), Ue = u(
435
440
  (e, t) => {
436
- const n = kt.current;
441
+ const n = wt.current;
437
442
  if (e.some((r) => n.has(r) !== t)) {
438
443
  const r = new Set(n);
439
- e.forEach((l) => t ? r.add(l) : r.delete(l)), Ve(r);
444
+ e.forEach((c) => t ? r.add(c) : r.delete(c)), Ve(r);
440
445
  }
441
- q && on((r) => {
442
- const l = new Map(r.key === X ? r.map : void 0);
443
- return e.forEach((c) => l.set(c, t)), { key: X, map: l };
446
+ q && gn((r) => {
447
+ const c = new Map(r.key === X ? r.map : void 0);
448
+ return e.forEach((i) => c.set(i, t)), { key: X, map: c };
444
449
  });
445
450
  },
446
451
  [Ve, q, X]
447
- ), sn = u(
448
- (e) => e.children.length > 0 || w(e.key),
449
- [w]
450
- ), me = A(/* @__PURE__ */ new Set()), Ue = u(
452
+ ), pn = u(
453
+ (e) => e.children.length > 0 || S(e.key),
454
+ [S]
455
+ ), me = A(/* @__PURE__ */ new Set()), We = u(
451
456
  (e, t) => {
452
- const n = e.flatMap((r) => zr(r, sn));
457
+ const n = e.flatMap((r) => oa(r, pn));
453
458
  n.forEach((r) => {
454
- t ? w(r) && me.current.add(r) : me.current.delete(r);
455
- }), He(n, t);
459
+ t ? S(r) && me.current.add(r) : me.current.delete(r);
460
+ }), Ue(n, t);
456
461
  },
457
- [sn, w, He]
462
+ [pn, S, Ue]
458
463
  ), ye = u(
459
464
  (e, t) => {
460
465
  const n = f.get(e);
461
- n && Ue([n], t);
466
+ n && We([n], t);
462
467
  },
463
- [f, Ue]
464
- ), We = u(
468
+ [f, We]
469
+ ), qe = u(
465
470
  (e, t) => {
466
471
  const n = !N(e);
467
- t ? ye(e, n) : He([e], n);
472
+ t ? ye(e, n) : Ue([e], n);
468
473
  },
469
- [N, ye, He]
470
- ), dn = A({ nodeByKey: f, isPending: w, setSubtreesExpanded: Ue });
471
- dn.current = { nodeByKey: f, isPending: w, setSubtreesExpanded: Ue }, be(() => {
472
- const { nodeByKey: e, isPending: t, setSubtreesExpanded: n } = dn.current, r = [];
473
- for (const l of [...me.current]) {
474
- const c = e.get(l);
475
- (!c || c.children.length > 0 || !t(l)) && (me.current.delete(l), r.push(...c?.children ?? []));
474
+ [N, ye, Ue]
475
+ ), mn = A({ nodeByKey: f, isPending: S, setSubtreesExpanded: We });
476
+ mn.current = { nodeByKey: f, isPending: S, setSubtreesExpanded: We }, ke(() => {
477
+ const { nodeByKey: e, isPending: t, setSubtreesExpanded: n } = mn.current, r = [];
478
+ for (const c of [...me.current]) {
479
+ const i = e.get(c);
480
+ (!i || i.children.length > 0 || !t(c)) && (me.current.delete(c), r.push(...i?.children ?? []));
476
481
  }
477
482
  r.length > 0 && n(r, !0);
478
- }, [v]);
479
- const or = u(
483
+ }, [C]);
484
+ const kr = u(
480
485
  (e) => {
481
- e || me.current.clear(), Ve(e ? new Set(ze) : /* @__PURE__ */ new Set()), q && on({
486
+ e || me.current.clear(), Ve(e ? new Set(ze) : /* @__PURE__ */ new Set()), q && gn({
482
487
  key: X,
483
- map: new Map(It(W).map((t) => [t, e]))
488
+ map: new Map(Yt(W).map((t) => [t, e]))
484
489
  });
485
490
  },
486
491
  [Ve, ze, q, X, W]
487
- ), qe = g(
488
- () => Vr(W, j, P),
489
- [W, j, P]
490
- ), un = u(
491
- (e) => w(e.key) ? ht.get(e.key) === "error" ? "error" : "loading" : null,
492
- [w, ht]
493
- ), k = g(
494
- () => Yr(qe, N, $e ? un : void 0),
495
- [qe, N, $e, un]
496
- ), vt = ae === !0 || Array.isArray(ae) && ae.includes("expandSubtree"), cr = g(() => {
492
+ ), Xe = g(
493
+ () => ia(W, H, P),
494
+ [W, H, P]
495
+ ), yn = u(
496
+ (e) => S(e.key) ? yt.get(e.key) === "error" ? "error" : "loading" : null,
497
+ [S, yt]
498
+ ), v = g(
499
+ () => ca(Xe, N, $e ? yn : void 0),
500
+ [Xe, N, $e, yn]
501
+ ), St = ae === !0 || Array.isArray(ae) && ae.includes("expandSubtree"), br = g(() => {
497
502
  const e = /* @__PURE__ */ new Set();
498
- if (!vt)
503
+ if (!St)
499
504
  return e;
500
505
  const t = (n) => {
501
506
  if (n.children.length === 0)
502
- return !w(n.key);
507
+ return !S(n.key);
503
508
  let r = N(n.key);
504
- return n.children.forEach((l) => {
505
- t(l) || (r = !1);
509
+ return n.children.forEach((c) => {
510
+ t(c) || (r = !1);
506
511
  }), r && e.add(n.key), r;
507
512
  };
508
- return v.forEach(t), e;
509
- }, [vt, v, w, N]);
510
- be(() => {
511
- E && k.forEach((e) => {
512
- e.placeholder === "loading" && Jt(e.node.key);
513
+ return C.forEach(t), e;
514
+ }, [St, C, S, N]);
515
+ ke(() => {
516
+ T && v.forEach((e) => {
517
+ e.placeholder === "loading" && nn(e.node.key);
513
518
  });
514
- }, [k, E, Jt]);
515
- const J = g(() => o ? x ? Br(pe).filter((e) => o.isLeaf(e)) : o.leaves : $t, [o, x, pe]), gn = g(() => {
519
+ }, [v, T, nn]);
520
+ const J = g(() => o ? E ? la(pe).filter((e) => o.isLeaf(e)) : o.leaves : Ft, [o, E, pe]), _n = g(() => {
516
521
  if (!s || J.length === 0)
517
522
  return "unchecked";
518
523
  let e = 0;
519
524
  for (const t of J)
520
525
  s.leaves.has(t) && e++;
521
526
  return e === 0 ? "unchecked" : e === J.length ? "checked" : "indeterminate";
522
- }, [s, J]), lr = u(() => {
527
+ }, [s, J]), wr = u(() => {
523
528
  if (!o || !s)
524
529
  return;
525
530
  const e = J.filter((n) => !o.isLocked(n)), t = !e.every((n) => s.leaves.has(n));
526
- H(Mn(o, s.leaves, e, t), {
531
+ j($n(o, s.leaves, e, t), {
527
532
  source: "selectAll",
528
533
  checked: t
529
534
  });
530
- }, [o, s, J, H]), ir = u(() => {
531
- o && s && H(Mn(o, s.leaves, o.leaves, !1), {
535
+ }, [o, s, J, j]), Cr = u(() => {
536
+ o && s && j($n(o, s.leaves, o.leaves, !1), {
532
537
  source: "clear",
533
538
  checked: !1
534
539
  });
535
- }, [o, s, H]), fn = (e) => {
536
- M || R || (p && Re && o?.isCheckable(e.key) ? Be(e.key) : p && S && Ye(e.key), Ut?.(e.data));
540
+ }, [o, s, j]), vn = (e) => {
541
+ !Ye || M || e === an || (ht === void 0 && yr(e), rr?.(e, f.get(e)?.data ?? null));
542
+ }, kn = (e) => {
543
+ vn(e.key), !(R || M) && (h && De && o?.isCheckable(e.key) ? Fe(e.key) : h && w && Be(e.key), Qt?.(e.data));
537
544
  }, Q = A({
538
- toggleExpand: We,
545
+ toggleExpand: qe,
539
546
  setSubtreeExpanded: ye,
540
- toggleCheck: Be,
541
- toggleSelected: Ye,
542
- rowClick: fn
547
+ toggleCheck: Fe,
548
+ toggleSelected: Be,
549
+ rowClick: kn
543
550
  });
544
551
  Q.current = {
545
- toggleExpand: We,
552
+ toggleExpand: qe,
546
553
  setSubtreeExpanded: ye,
547
- toggleCheck: Be,
548
- toggleSelected: Ye,
549
- rowClick: fn
554
+ toggleCheck: Fe,
555
+ toggleSelected: Be,
556
+ rowClick: kn
550
557
  };
551
- const hn = g(
558
+ const bn = g(
552
559
  () => ({
553
560
  toggleExpand: (e, t) => Q.current.toggleExpand(e, t),
554
561
  setSubtreeExpanded: (e, t) => Q.current.setSubtreeExpanded(e, t),
@@ -557,103 +564,128 @@ ${G ? 1 : 0}`, [an, on] = T(
557
564
  rowClick: (e) => Q.current.rowClick(e)
558
565
  }),
559
566
  []
560
- ), V = !!dt && !!ut && !M && !R, wt = g(() => {
567
+ ), V = !!gt && !!ft && !R && !M, xt = g(() => {
561
568
  const e = /* @__PURE__ */ new Map();
562
569
  if (!V)
563
570
  return e;
564
571
  const t = (n, r) => {
565
- const l = n.map((c) => c.key);
566
- n.forEach((c) => {
567
- e.set(c.key, { parent: r, siblings: l }), t(c.children, c.key);
572
+ const c = n.map((i) => i.key);
573
+ n.forEach((i) => {
574
+ e.set(i.key, { parent: r, siblings: c }), t(i.children, i.key);
568
575
  });
569
576
  };
570
- return t(qe, null), e;
571
- }, [V, qe]), pn = u(
577
+ return t(Xe, null), e;
578
+ }, [V, Xe]), wn = u(
572
579
  (e, t) => {
573
580
  const n = /* @__PURE__ */ new Set();
574
- for (let r = e; r != null && !n.has(r); r = wt.get(r)?.parent) {
581
+ for (let r = e; r != null && !n.has(r); r = xt.get(r)?.parent) {
575
582
  if (r === t)
576
583
  return !0;
577
584
  n.add(r);
578
585
  }
579
586
  return !1;
580
587
  },
581
- [wt]
582
- ), Ct = (e) => {
588
+ [xt]
589
+ ), Et = (e) => {
583
590
  const t = f.get(e);
584
- return !!t && (typeof dt == "function" ? dt(t.data) : !0);
585
- }, mn = (e, t, n) => {
586
- const r = f.get(e), l = f.get(t);
587
- return !r || !l || pn(t, e) ? !1 : Wt ? Wt(r.data, l.data, n) : !0;
588
- }, Xe = Ur({
591
+ return !!t && (typeof gt == "function" ? gt(t.data) : !0);
592
+ }, Cn = (e, t, n) => {
593
+ const r = f.get(e), c = f.get(t);
594
+ return !r || !c || wn(t, e) ? !1 : Zt ? Zt(r.data, c.data, n) : !0;
595
+ }, Je = ga({
589
596
  enabled: V,
590
597
  rowSelector: "tr.nice-treegrid__row",
591
- canDrag: Ct,
592
- isWithin: pn,
593
- canDrop: mn,
594
- onDrop: (e, t, n) => ut?.(e, t, n),
598
+ canDrag: Et,
599
+ isWithin: wn,
600
+ canDrop: Cn,
601
+ onDrop: (e, t, n) => ft?.(e, t, n),
595
602
  onHoverOpen: (e) => {
596
603
  const t = f.get(e);
597
- t && (t.children.length > 0 || w(e)) && !N(e) && We(e);
604
+ t && (t.children.length > 0 || S(e)) && !N(e) && qe(e);
598
605
  }
599
- }), [sr, yn] = T(""), St = zn === "popup" && !!qt && !M && !R, [Je, Qe] = T(
606
+ }), [Sr, Sn] = k(""), Nt = qn === "popup" && !!en && !R && !M, [Qe, Tt] = k(
600
607
  null
601
- ), _n = (e) => {
608
+ ), [xr, Ze] = k(null), [Er, xn] = k(!1), At = (e) => {
602
609
  const t = e === void 0 ? void 0 : f.get(e);
603
- St && t && Qe({ key: t.key, data: { ...t.data } });
604
- }, _ = !!Kn, Ze = A(null), [kn, dr] = T(typeof st == "number" ? st : 480);
605
- be(() => {
606
- const e = Ze.current;
610
+ Nt && t && (Ze(null), Tt({ key: t.key, data: { ...t.data } }));
611
+ }, En = () => {
612
+ Tt(null), Ze(null);
613
+ }, et = (e) => {
614
+ if (e === !1 || typeof e == "string") {
615
+ Ze(
616
+ typeof e == "string" && e ? e : l("treeGrid.saveFailed", "The row could not be saved.")
617
+ );
618
+ return;
619
+ }
620
+ En();
621
+ }, Nn = (e) => e instanceof Error ? e.message : String(e), Nr = (e, t) => {
622
+ let n;
623
+ try {
624
+ n = en?.(e, t);
625
+ } catch (r) {
626
+ et(Nn(r));
627
+ return;
628
+ }
629
+ if (n instanceof Promise) {
630
+ xn(!0), Ze(null), n.then(et, (r) => et(Nn(r))).finally(() => xn(!1));
631
+ return;
632
+ }
633
+ et(n);
634
+ };
635
+ Ur(er, () => ({ editRow: (e) => At(e) }));
636
+ const _ = !!Yn, tt = A(null), [Tn, Tr] = k(typeof ut == "number" ? ut : 480);
637
+ ke(() => {
638
+ const e = tt.current;
607
639
  if (!_ || !e || typeof ResizeObserver > "u")
608
640
  return;
609
641
  const t = new ResizeObserver(() => {
610
- e.clientHeight > 0 && dr(e.clientHeight);
642
+ e.clientHeight > 0 && Tr(e.clientHeight);
611
643
  });
612
644
  return t.observe(e), () => t.disconnect();
613
645
  }, [_]);
614
- const xt = Cr({
615
- itemCount: _ ? k.length : 0,
646
+ const Mt = Vr({
647
+ itemCount: _ ? v.length : 0,
616
648
  itemHeight: ge,
617
- containerHeight: kn,
649
+ containerHeight: Tn,
618
650
  overscan: 8
619
- }), Nt = _ ? xt.startIndex : 0, Et = _ ? xt.endIndex : k.length, Tt = A(null), bn = A(N);
620
- bn.current = N, Sr(Tt, {
651
+ }), Rt = _ ? Mt.startIndex : 0, Dt = _ ? Mt.endIndex : v.length, Kt = A(null), An = A(N);
652
+ An.current = N, Yr(Kt, {
621
653
  itemSelector: "tr.nice-treegrid__row",
622
- enabled: !R,
654
+ enabled: !M,
623
655
  onToggle: (e, t) => {
624
656
  const n = e.dataset.key;
625
- n !== void 0 && e.hasAttribute("aria-expanded") && bn.current(n) !== t && hn.toggleExpand(n);
657
+ n !== void 0 && e.hasAttribute("aria-expanded") && An.current(n) !== t && bn.toggleExpand(n);
626
658
  }
627
659
  });
628
- const ur = Ar(xr), At = A(null), [Z, vn] = T(null), Mt = u(() => vn(null), []);
629
- Nr(At, {
660
+ const Ar = Wr(Br), Pt = A(null), [Z, Mn] = k(null), Gt = u(() => Mn(null), []);
661
+ Fr(Pt, {
630
662
  open: !!Z,
631
663
  modal: !1,
632
664
  initialFocus: '[role="menuitem"]:not([disabled])',
633
- onClose: Mt
634
- }), Er(At, { orientation: "vertical", itemSelector: '[role="menuitem"]' });
635
- const wn = (e, t, n) => {
636
- const r = Ie ? f.get(e) : void 0, l = r ? Ie?.(r.data) : void 0;
637
- return l?.some((c) => !c.divider) ? (vn({ key: e, x: t, y: n, items: l }), !0) : !1;
638
- }, Dt = u(
639
- (e) => [...Tt.current?.querySelectorAll("tr.nice-treegrid__row") ?? []].find(
665
+ onClose: Gt
666
+ }), Hr(Pt, { orientation: "vertical", itemSelector: '[role="menuitem"]' });
667
+ const Rn = (e, t, n) => {
668
+ const r = Oe ? f.get(e) : void 0, c = r ? Oe?.(r.data) : void 0;
669
+ return c?.some((i) => !i.divider) ? (Mn({ key: e, x: t, y: n, items: c }), !0) : !1;
670
+ }, Lt = u(
671
+ (e) => [...Kt.current?.querySelectorAll("tr.nice-treegrid__row") ?? []].find(
640
672
  (t) => t.dataset.key === e
641
673
  ),
642
674
  []
643
- ), [Rt, Kt] = T(null);
644
- be(() => {
645
- if (Rt === null)
675
+ ), [Ot, It] = k(null);
676
+ ke(() => {
677
+ if (Ot === null)
646
678
  return;
647
- const e = Dt(Rt);
648
- e && (e.focus(), Kt(null));
649
- }, [Rt, Nt, Et, Dt]);
650
- const gr = (e) => {
651
- const t = k[e]?.placeholder ? e - 1 : e, n = k[t]?.node.key;
679
+ const e = Lt(Ot);
680
+ e && (e.focus(), It(null));
681
+ }, [Ot, Rt, Dt, Lt]);
682
+ const Mr = (e) => {
683
+ const t = v[e]?.placeholder ? e - 1 : e, n = v[t]?.node.key;
652
684
  if (n === void 0)
653
685
  return;
654
- const r = Dt(n);
655
- r ? r.focus() : _ && Ze.current && (Ze.current.scrollTop = Math.max(0, t * ge - kn / 2), Kt(n));
656
- }, fr = (e) => {
686
+ const r = Lt(n);
687
+ r ? r.focus() : _ && tt.current && (tt.current.scrollTop = Math.max(0, t * ge - Tn / 2), It(n));
688
+ }, Rr = (e) => {
657
689
  const t = e.target;
658
690
  if (e.altKey || e.ctrlKey || e.metaKey || !t.matches?.("tr.nice-treegrid__row"))
659
691
  return;
@@ -661,89 +693,93 @@ ${G ? 1 : 0}`, [an, on] = T(
661
693
  if (e.shiftKey && (e.key === "ArrowRight" || e.key === "ArrowLeft")) {
662
694
  if (t.hasAttribute("aria-expanded")) {
663
695
  e.preventDefault();
664
- const c = getComputedStyle(t).direction === "rtl";
665
- ye(n, e.key === "ArrowRight" !== c);
696
+ const i = getComputedStyle(t).direction === "rtl";
697
+ ye(n, e.key === "ArrowRight" !== i);
666
698
  }
667
699
  return;
668
700
  }
669
701
  if (e.key === " ") {
670
- if (M)
702
+ if (Ye && !h) {
703
+ e.preventDefault(), vn(n);
704
+ return;
705
+ }
706
+ if (R)
671
707
  return;
672
- p && o?.isCheckable(n) ? (e.preventDefault(), Be(n)) : S && (e.preventDefault(), Ye(n));
708
+ h && o?.isCheckable(n) ? (e.preventDefault(), Fe(n)) : w && (e.preventDefault(), Be(n));
673
709
  return;
674
710
  }
675
711
  if (!(e.key === "PageDown" || e.key === "PageUp") && !(_ && (e.key === "Home" || e.key === "End")))
676
712
  return;
677
- const l = k.findIndex((c) => c.node.key === n);
678
- l < 0 || (e.preventDefault(), gr(
679
- e.key === "PageDown" ? Math.min(k.length - 1, l + Rn) : e.key === "PageUp" ? Math.max(0, l - Rn) : e.key === "Home" ? 0 : k.length - 1
713
+ const c = v.findIndex((i) => i.node.key === n);
714
+ c < 0 || (e.preventDefault(), Mr(
715
+ e.key === "PageDown" ? Math.min(v.length - 1, c + Vn) : e.key === "PageUp" ? Math.max(0, c - Vn) : e.key === "Home" ? 0 : v.length - 1
680
716
  ));
681
- }, hr = i("controls.expand", "Expand"), pr = i("controls.collapse", "Collapse"), Cn = K[0]?.field, et = (e) => Ft ? Ft(e.data) : String((Cn != null ? e.data[Cn] : void 0) ?? e.key), Sn = (e, t) => i("treeGrid.checkedSummary", "{checked} of {total} selected").replace("{checked}", String(e)).replace("{total}", String(t)), mr = (e) => {
717
+ }, Dr = l("controls.expand", "Expand"), Kr = l("controls.collapse", "Collapse"), Dn = K[0]?.field, nt = (e) => qt ? qt(e.data) : String((Dn != null ? e.data[Dn] : void 0) ?? e.key), Kn = (e, t) => l("treeGrid.checkedSummary", "{checked} of {total} selected").replace("{checked}", String(e)).replace("{total}", String(t)), Pr = (e) => {
682
718
  const t = e.target;
683
719
  if (!V || !t.matches?.("tr.nice-treegrid__row"))
684
720
  return !1;
685
- const n = Wr(e, getComputedStyle(t).direction === "rtl");
721
+ const n = fa(e, getComputedStyle(t).direction === "rtl");
686
722
  if (!n)
687
723
  return !1;
688
724
  e.preventDefault();
689
- const r = t.dataset.key ?? "", l = wt.get(r), c = l ? qr(n, r, l.parent, l.siblings) : null, d = f.get(r), ee = c ? f.get(c.key) : void 0;
690
- if (!c || !d || !ee || !Ct(r) || !mn(r, c.key, c.position))
691
- return yn(
692
- i("treeDrop.cannotMove", "Cannot move {label} there").replace(
725
+ const r = t.dataset.key ?? "", c = xt.get(r), i = c ? ha(n, r, c.parent, c.siblings) : null, d = f.get(r), ee = i ? f.get(i.key) : void 0;
726
+ if (!i || !d || !ee || !Et(r) || !Cn(r, i.key, i.position))
727
+ return Sn(
728
+ l("treeDrop.cannotMove", "Cannot move {label} there").replace(
693
729
  "{label}",
694
- d ? et(d) : r
730
+ d ? nt(d) : r
695
731
  )
696
732
  ), !0;
697
- c.position === "inside" && !N(c.key) && We(c.key), ut?.(r, c.key, c.position), Kt(r);
698
- const rt = c.position === "before" ? i("treeDrop.movedBefore", "{label} moved before {target}") : c.position === "after" ? i("treeDrop.movedAfter", "{label} moved after {target}") : i("treeDrop.movedInside", "{label} moved into {target}");
699
- return yn(
700
- rt.replace("{label}", et(d)).replace("{target}", et(ee))
733
+ i.position === "inside" && !N(i.key) && qe(i.key), ft?.(r, i.key, i.position), It(r);
734
+ const ot = i.position === "before" ? l("treeDrop.movedBefore", "{label} moved before {target}") : i.position === "after" ? l("treeDrop.movedAfter", "{label} moved after {target}") : l("treeDrop.movedInside", "{label} moved into {target}");
735
+ return Sn(
736
+ ot.replace("{label}", nt(d)).replace("{target}", nt(ee))
701
737
  ), !0;
702
- }, yr = g(() => {
738
+ }, Gr = g(() => {
703
739
  const e = new Set(je);
704
- return K.map((t) => Bt && !ue && e.has(t.field));
705
- }, [K, je, Bt, ue]), Pt = B === !0 ? p ? Dn : Dn.slice(0, 2) : Array.isArray(B) ? B.filter((e) => p || e === "expandAll" || e === "collapseAll") : ea, tt = p ? De === "column" ? "column" : "tree" : "none", nt = !!S && !p, _e = K.length + (tt === "column" || nt ? 1 : 0), xn = [
706
- ["checked", !y || D === !1 ? null : nn && typeof D == "function" ? D(nn) : Sn(y.total.checked, y.total.total)],
740
+ return K.map((t) => Wt && !ue && e.has(t.field));
741
+ }, [K, je, Wt, ue]), $t = B === !0 ? h ? zn : zn.slice(0, 2) : Array.isArray(B) ? B.filter((e) => h || e === "expandAll" || e === "collapseAll") : va, rt = h ? Re === "column" ? "column" : "tree" : "none", at = !!w && !h, _e = K.length + (rt === "column" || at ? 1 : 0), Pn = [
742
+ ["checked", !y || D === !1 ? null : sn && typeof D == "function" ? D(sn) : Kn(y.total.checked, y.total.total)],
707
743
  [
708
744
  "matches",
709
- U ? i("treeGrid.matchCount", "{count} matching rows").replace(
745
+ U ? l("treeGrid.matchCount", "{count} matching rows").replace(
710
746
  "{count}",
711
747
  String(U.matched.size)
712
748
  ) : null
713
749
  ]
714
750
  ].filter(([, e]) => e != null && e !== !1 && e !== "");
715
- if (gt === "hidden")
751
+ if (pt === "hidden")
716
752
  return null;
717
- const Gt = p && ct && o && o.leaves.length > 0 ? /* @__PURE__ */ a(
753
+ const zt = h && lt && o && o.leaves.length > 0 ? /* @__PURE__ */ a(
718
754
  "input",
719
755
  {
720
756
  type: "checkbox",
721
757
  className: "nice-treegrid__check-input nice-treegrid__select-all",
722
- checked: gn === "checked",
758
+ checked: _n === "checked",
723
759
  ref: (e) => {
724
- e && (e.indeterminate = gn === "indeterminate");
760
+ e && (e.indeterminate = _n === "indeterminate");
725
761
  },
726
- disabled: M || R,
727
- "aria-label": x ? i("treeGrid.selectAllResults", "Select all results") : i("controls.selectAll", "Select all"),
762
+ disabled: R || M,
763
+ "aria-label": E ? l("treeGrid.selectAllResults", "Select all results") : l("controls.selectAll", "Select all"),
728
764
  onClick: (e) => e.stopPropagation(),
729
- onChange: lr
765
+ onChange: wr
730
766
  }
731
- ) : null, _r = (e) => {
767
+ ) : null, Lr = (e) => {
732
768
  const t = {
733
- expandAll: { icon: "expand", label: i("treeGrid.expandAll", "Expand all") },
734
- collapseAll: { icon: "collapse", label: i("treeGrid.collapseAll", "Collapse all") },
735
- onlyChecked: { icon: "filter", label: i("treeGrid.showOnlyChecked", "Show selected only") },
736
- clearChecked: { icon: "eraser", label: i("treeGrid.clearChecked", "Clear selection") }
769
+ expandAll: { icon: "expand", label: l("treeGrid.expandAll", "Expand all") },
770
+ collapseAll: { icon: "collapse", label: l("treeGrid.collapseAll", "Collapse all") },
771
+ onlyChecked: { icon: "filter", label: l("treeGrid.showOnlyChecked", "Show selected only") },
772
+ clearChecked: { icon: "eraser", label: l("treeGrid.clearChecked", "Clear selection") }
737
773
  }[e];
738
- return /* @__PURE__ */ h(
774
+ return /* @__PURE__ */ p(
739
775
  "button",
740
776
  {
741
777
  type: "button",
742
778
  className: `nice-btn nice-btn--sm nice-btn--ghost nice-treegrid__action${e === "onlyChecked" && G ? " nice-treegrid__action--active" : ""}`,
743
779
  "aria-pressed": e === "onlyChecked" ? G : void 0,
744
- disabled: R || e === "clearChecked" && (M || !y || y.total.checked === 0),
780
+ disabled: M || e === "clearChecked" && (R || !y || y.total.checked === 0),
745
781
  onClick: () => {
746
- e === "expandAll" || e === "collapseAll" ? or(e === "expandAll") : e === "onlyChecked" ? ar(!rn) : ir();
782
+ e === "expandAll" || e === "collapseAll" ? kr(e === "expandAll") : e === "onlyChecked" ? vr(!dn) : Cr();
747
783
  },
748
784
  children: [
749
785
  /* @__PURE__ */ a(te, { name: t.icon, size: 14 }),
@@ -752,16 +788,16 @@ ${G ? 1 : 0}`, [an, on] = T(
752
788
  },
753
789
  e
754
790
  );
755
- }, kr = (e) => {
756
- const { node: t, level: n, posInSet: r, setSize: l, placeholder: c } = k[e], d = t.key;
757
- if (c)
791
+ }, Or = (e) => {
792
+ const { node: t, level: n, posInSet: r, setSize: c, placeholder: i } = v[e], d = t.key;
793
+ if (i)
758
794
  return /* @__PURE__ */ a(
759
795
  "tr",
760
796
  {
761
- className: `nice-treegrid__placeholder nice-treegrid__placeholder--${c}`,
797
+ className: `nice-treegrid__placeholder nice-treegrid__placeholder--${i}`,
762
798
  "aria-level": n,
763
799
  style: _ ? { height: ge } : void 0,
764
- children: /* @__PURE__ */ h("td", { colSpan: _e, children: [
800
+ children: /* @__PURE__ */ p("td", { colSpan: _e, children: [
765
801
  /* @__PURE__ */ a("span", { className: "nice-treegrid__indent", style: { width: (n - 1) * 20 } }),
766
802
  /* @__PURE__ */ a(
767
803
  "span",
@@ -770,111 +806,111 @@ ${G ? 1 : 0}`, [an, on] = T(
770
806
  "aria-hidden": "true"
771
807
  }
772
808
  ),
773
- c === "loading" ? /* @__PURE__ */ h(ve, { children: [
809
+ i === "loading" ? /* @__PURE__ */ p(be, { children: [
774
810
  /* @__PURE__ */ a("span", { className: "nice-spinner nice-spinner--sm", "aria-hidden": "true" }),
775
- /* @__PURE__ */ a("span", { role: "status", children: i("treeGrid.loading", "Loading…") })
776
- ] }) : /* @__PURE__ */ h(ve, { children: [
777
- /* @__PURE__ */ a("span", { role: "alert", children: i("treeGrid.loadError", "Could not load the rows.") }),
811
+ /* @__PURE__ */ a("span", { role: "status", children: l("treeGrid.loading", "Loading…") })
812
+ ] }) : /* @__PURE__ */ p(be, { children: [
813
+ /* @__PURE__ */ a("span", { role: "alert", children: l("treeGrid.loadError", "Could not load the rows.") }),
778
814
  /* @__PURE__ */ a(
779
815
  "button",
780
816
  {
781
817
  type: "button",
782
818
  className: "nice-btn nice-btn--sm nice-btn--ghost",
783
- onClick: () => Zn(d),
784
- children: i("treeGrid.retry", "Retry")
819
+ onClick: () => gr(d),
820
+ children: l("treeGrid.retry", "Retry")
785
821
  }
786
822
  )
787
823
  ] })
788
824
  ] })
789
825
  },
790
- `${d}\0${c}`
826
+ `${d}\0${i}`
791
827
  );
792
- const ee = t.children.length > 0 || w(d), rt = ee && N(d), Lt = vt && ee ? cr.has(d) ? "collapse" : "expand" : null, Tn = !!o?.isCheckable(d), ke = Ke && y && o && !o.isLeaf(d) ? y.count(d) : null, br = et(t);
828
+ const ee = t.children.length > 0 || S(d), ot = ee && N(d), Vt = St && ee ? br.has(d) ? "collapse" : "expand" : null, On = !!o?.isCheckable(d), ve = Ke && y && o && !o.isLeaf(d) ? y.count(d) : null, Ir = nt(t);
793
829
  return /* @__PURE__ */ a(
794
- aa,
830
+ Ca,
795
831
  {
796
832
  node: t,
797
833
  level: n,
798
834
  posInSet: r,
799
- setSize: l,
835
+ setSize: c,
800
836
  rowIndex: e,
801
837
  ariaRowIndex: _ ? e + 2 : void 0,
802
838
  columns: K,
803
- highlight: yr,
804
- query: x,
839
+ highlight: Gr,
840
+ query: E,
805
841
  expandable: ee,
806
- expanded: rt,
807
- busy: rt && ht.get(d) === "loading",
808
- expandLabel: hr,
809
- collapseLabel: pr,
810
- subtreeAction: Lt,
811
- subtreeLabel: Lt === "expand" ? i("treeGrid.expandSubtree", "Expand all below") : Lt === "collapse" ? i("treeGrid.collapseSubtree", "Collapse all below") : "",
812
- checkMode: tt,
813
- hasCheckbox: Tn,
842
+ expanded: ot,
843
+ busy: ot && yt.get(d) === "loading",
844
+ expandLabel: Dr,
845
+ collapseLabel: Kr,
846
+ subtreeAction: Vt,
847
+ subtreeLabel: Vt === "expand" ? l("treeGrid.expandSubtree", "Expand all below") : Vt === "collapse" ? l("treeGrid.collapseSubtree", "Collapse all below") : "",
848
+ checkMode: rt,
849
+ hasCheckbox: On,
814
850
  checkState: y ? y.state(d) : "unchecked",
815
- checkLabel: Tn ? i("treeGrid.checkRow", "Select {label}").replace("{label}", br) : "",
851
+ checkLabel: On ? l("treeGrid.checkRow", "Select {label}").replace("{label}", Ir) : "",
816
852
  locked: !!o?.isLocked(d),
817
- countChecked: ke?.checked ?? 0,
818
- countTotal: ke?.total ?? 0,
819
- countTitle: ke ? Sn(ke.checked, ke.total) : "",
820
- selectColumn: nt,
821
- selected: S ? rr.has(d) : void 0,
822
- selectLabel: nt ? i("controls.selectRow", "Select row {key}").replace("{key}", d) : "",
823
- readOnly: M,
824
- className: typeof it == "function" ? it(t.data, e) : it,
825
- clickable: !M && (!!Ut || !!Re || !!p && !!S),
853
+ countChecked: ve?.checked ?? 0,
854
+ countTotal: ve?.total ?? 0,
855
+ countTitle: ve ? Kn(ve.checked, ve.total) : "",
856
+ selectColumn: at,
857
+ selected: w ? _r.has(d) : Ye ? an === d : void 0,
858
+ selectLabel: at ? l("controls.selectRow", "Select row {key}").replace("{key}", d) : "",
859
+ readOnly: R,
860
+ className: typeof dt == "function" ? dt(t.data, e) : dt,
861
+ clickable: Ye || !R && (!!Qt || !!De || !!h && !!w),
826
862
  height: _ ? ge : void 0,
827
- draggable: V && Ct(d),
828
- drop: Xe.target?.key === d ? Xe.target.position : null,
829
- dragging: Xe.dragKey === d,
830
- handlers: hn
863
+ draggable: V && Et(d),
864
+ drop: Je.target?.key === d ? Je.target.position : null,
865
+ dragging: Je.dragKey === d,
866
+ handlers: bn
831
867
  },
832
868
  d
833
869
  );
834
- }, Nn = [];
835
- for (let e = Nt; e < Et; e++)
836
- Nn.push(kr(e));
837
- const En = (e, t) => e > 0 ? /* @__PURE__ */ a("tr", { className: "nice-treegrid__spacer", "aria-hidden": "true", children: /* @__PURE__ */ a("td", { colSpan: _e, style: { height: e * ge } }) }, t) : null;
838
- return /* @__PURE__ */ h(
870
+ }, Gn = [];
871
+ for (let e = Rt; e < Dt; e++)
872
+ Gn.push(Or(e));
873
+ const Ln = (e, t) => e > 0 ? /* @__PURE__ */ a("tr", { className: "nice-treegrid__spacer", "aria-hidden": "true", children: /* @__PURE__ */ a("td", { colSpan: _e, style: { height: e * ge } }) }, t) : null;
874
+ return /* @__PURE__ */ p(
839
875
  "div",
840
876
  {
841
- id: Xt,
842
- "data-testid": Wn ?? Un,
843
- className: `nice-treegrid nice-datagrid ${R ? "nice-treegrid--disabled" : ""} ${M ? "nice-treegrid--readonly" : ""} ${Le ? "nice-treegrid--error" : ""} ${_ ? "nice-treegrid--virtual" : ""} ${jn || ""}`,
844
- style: Hn,
845
- "aria-disabled": R || void 0,
846
- "aria-busy": jt || void 0,
877
+ id: tn,
878
+ "data-testid": cr ?? ir,
879
+ className: `nice-treegrid nice-datagrid ${M ? "nice-treegrid--disabled" : ""} ${R ? "nice-treegrid--readonly" : ""} ${Le ? "nice-treegrid--error" : ""} ${_ ? "nice-treegrid--virtual" : ""} ${ar || ""}`,
880
+ style: or,
881
+ "aria-disabled": M || void 0,
882
+ "aria-busy": Xt || void 0,
847
883
  "aria-invalid": !!Le || void 0,
848
884
  children: [
849
- (Ge || Ht || Pt.length > 0) && /* @__PURE__ */ h("div", { className: "nice-datagrid__toolbar nice-treegrid__toolbar", children: [
850
- Ge && /* @__PURE__ */ h("div", { className: "nice-datagrid__search nice-treegrid__search", children: [
885
+ (Ge || Jt || $t.length > 0) && /* @__PURE__ */ p("div", { className: "nice-datagrid__toolbar nice-treegrid__toolbar", children: [
886
+ Ge && /* @__PURE__ */ p("div", { className: "nice-datagrid__search nice-treegrid__search", children: [
851
887
  /* @__PURE__ */ a(
852
888
  "input",
853
889
  {
854
890
  type: "search",
855
- value: Fe,
856
- onChange: (e) => bt(e.target.value),
891
+ value: He,
892
+ onChange: (e) => Ct(e.target.value),
857
893
  onKeyDown: (e) => {
858
- e.key === "Escape" && Fe && (e.preventDefault(), bt(""));
894
+ e.key === "Escape" && He && (e.preventDefault(), Ct(""));
859
895
  },
860
- placeholder: m || i("controls.search", "Search..."),
861
- "aria-label": m || i("controls.search", "Search...")
896
+ placeholder: m || l("controls.search", "Search..."),
897
+ "aria-label": m || l("controls.search", "Search...")
862
898
  }
863
899
  ),
864
- Fe && /* @__PURE__ */ a(
900
+ He && /* @__PURE__ */ a(
865
901
  "button",
866
902
  {
867
903
  type: "button",
868
904
  className: "nice-treegrid__search-clear",
869
- onClick: () => bt(""),
870
- "aria-label": i("treeGrid.clearSearch", "Clear search"),
905
+ onClick: () => Ct(""),
906
+ "aria-label": l("treeGrid.clearSearch", "Clear search"),
871
907
  children: /* @__PURE__ */ a(te, { name: "close", size: 12 })
872
908
  }
873
909
  )
874
910
  ] }),
875
- Pt.length > 0 && /* @__PURE__ */ a("div", { className: "nice-treegrid__actions", children: Pt.map(_r) }),
876
- Ht,
877
- xn.length > 0 && /* @__PURE__ */ a("span", { className: "nice-treegrid__summary", role: "status", children: xn.map(([e, t], n) => /* @__PURE__ */ h(Tr.Fragment, { children: [
911
+ $t.length > 0 && /* @__PURE__ */ a("div", { className: "nice-treegrid__actions", children: $t.map(Lr) }),
912
+ Jt,
913
+ Pn.length > 0 && /* @__PURE__ */ a("span", { className: "nice-treegrid__summary", role: "status", children: Pn.map(([e, t], n) => /* @__PURE__ */ p(jr.Fragment, { children: [
878
914
  n > 0 && " · ",
879
915
  t
880
916
  ] }, e)) })
@@ -882,57 +918,57 @@ ${G ? 1 : 0}`, [an, on] = T(
882
918
  /* @__PURE__ */ a(
883
919
  "div",
884
920
  {
885
- ref: Ze,
921
+ ref: tt,
886
922
  className: "nice-datagrid__table-wrap",
887
- style: _ ? { height: st ?? 480, overflow: "auto" } : void 0,
888
- onScroll: _ ? xt.onScroll : void 0,
889
- children: /* @__PURE__ */ h(
923
+ style: _ ? { height: ut ?? 480, overflow: "auto" } : void 0,
924
+ onScroll: _ ? Mt.onScroll : void 0,
925
+ children: /* @__PURE__ */ p(
890
926
  "table",
891
927
  {
892
- ref: Tt,
928
+ ref: Kt,
893
929
  role: "treegrid",
894
- "aria-label": Xn,
895
- "aria-labelledby": Jn,
896
- "aria-multiselectable": S || p || void 0,
897
- "aria-rowcount": _ ? k.length + 1 : void 0,
898
- className: `nice-table nice-table--${Ln} ${Pn ? "nice-table--striped" : ""} ${Gn ? "nice-table--compact" : ""}`,
930
+ "aria-label": sr,
931
+ "aria-labelledby": dr,
932
+ "aria-multiselectable": w || h || void 0,
933
+ "aria-rowcount": _ ? v.length + 1 : void 0,
934
+ className: `nice-table nice-table--${Hn} ${Bn ? "nice-table--striped" : ""} ${Fn ? "nice-table--compact" : ""}`,
899
935
  onKeyDownCapture: (e) => {
900
- if (Ie && (e.key === "ContextMenu" || e.key === "F10" && e.shiftKey)) {
936
+ if (Oe && (e.key === "ContextMenu" || e.key === "F10" && e.shiftKey)) {
901
937
  const t = e.target.closest("tr.nice-treegrid__row"), n = t?.getBoundingClientRect();
902
- if (t?.dataset.key !== void 0 && n && wn(t.dataset.key, n.left + 24, n.bottom)) {
938
+ if (t?.dataset.key !== void 0 && n && Rn(t.dataset.key, n.left + 24, n.bottom)) {
903
939
  e.preventDefault(), e.stopPropagation();
904
940
  return;
905
941
  }
906
942
  }
907
- if (!mr(e)) {
908
- if (St && e.key === "F2") {
943
+ if (!Pr(e)) {
944
+ if (Nt && e.key === "F2") {
909
945
  const t = e.target.closest("tr.nice-treegrid__row");
910
946
  if (t) {
911
- e.preventDefault(), _n(t.dataset.key);
947
+ e.preventDefault(), At(t.dataset.key);
912
948
  return;
913
949
  }
914
950
  }
915
- fr(e);
951
+ Rr(e);
916
952
  }
917
953
  },
918
- onContextMenu: Ie ? (e) => {
954
+ onContextMenu: Oe ? (e) => {
919
955
  const t = e.target.closest(
920
956
  "tr.nice-treegrid__row"
921
957
  );
922
- t?.dataset.key !== void 0 && wn(t.dataset.key, e.clientX, e.clientY) && e.preventDefault();
958
+ t?.dataset.key !== void 0 && Rn(t.dataset.key, e.clientX, e.clientY) && e.preventDefault();
923
959
  } : void 0,
924
960
  children: [
925
- /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ h("tr", { children: [
926
- tt === "column" && /* @__PURE__ */ a("th", { className: "nice-datagrid__checkbox nice-treegrid__th-check", children: Gt }),
927
- nt && /* @__PURE__ */ a("th", { className: "nice-datagrid__checkbox", style: { width: 36 } }),
928
- K.map((e, t) => /* @__PURE__ */ h(
961
+ /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ p("tr", { children: [
962
+ rt === "column" && /* @__PURE__ */ a("th", { className: "nice-datagrid__checkbox nice-treegrid__th-check", children: zt }),
963
+ at && /* @__PURE__ */ a("th", { className: "nice-datagrid__checkbox", style: { width: 36 } }),
964
+ K.map((e, t) => /* @__PURE__ */ p(
929
965
  "th",
930
966
  {
931
967
  style: { width: e.width, minWidth: e.minWidth, textAlign: e.align },
932
968
  className: oe && e.sortable !== !1 ? "nice-datagrid__th--sortable" : void 0,
933
- onClick: () => oe && e.sortable !== !1 && nr(e.field),
969
+ onClick: () => oe && e.sortable !== !1 && pr(e.field),
934
970
  children: [
935
- t === 0 && tt === "tree" && Gt && /* @__PURE__ */ h(ve, { children: [
971
+ t === 0 && rt === "tree" && zt && /* @__PURE__ */ p(be, { children: [
936
972
  /* @__PURE__ */ a(
937
973
  "span",
938
974
  {
@@ -940,18 +976,18 @@ ${G ? 1 : 0}`, [an, on] = T(
940
976
  "aria-hidden": "true"
941
977
  }
942
978
  ),
943
- /* @__PURE__ */ a("span", { className: "nice-treegrid__check", children: Gt })
979
+ /* @__PURE__ */ a("span", { className: "nice-treegrid__check", children: zt })
944
980
  ] }),
945
981
  e.header,
946
982
  oe && e.sortable !== !1 && /* @__PURE__ */ a(
947
983
  "span",
948
984
  {
949
985
  className: "nice-table__sort-icon",
950
- style: { opacity: j === e.field && P ? void 0 : 0.3 },
986
+ style: { opacity: H === e.field && P ? void 0 : 0.3 },
951
987
  children: /* @__PURE__ */ a(
952
988
  te,
953
989
  {
954
- name: j === e.field && P ? P === "asc" ? "sort-asc" : "sort-desc" : "sort",
990
+ name: H === e.field && P ? P === "asc" ? "sort-asc" : "sort-desc" : "sort",
955
991
  size: 12
956
992
  }
957
993
  )
@@ -965,11 +1001,11 @@ ${G ? 1 : 0}`, [an, on] = T(
965
1001
  /* @__PURE__ */ a(
966
1002
  "tbody",
967
1003
  {
968
- ...V ? Xe.handlers : void 0,
969
- onDoubleClick: St ? (e) => _n(
1004
+ ...V ? Je.handlers : void 0,
1005
+ onDoubleClick: Nt ? (e) => At(
970
1006
  e.target.closest("tr.nice-treegrid__row")?.dataset.key
971
1007
  ) : void 0,
972
- children: jt ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: _e, className: "nice-datagrid__empty", children: /* @__PURE__ */ a("div", { className: "nice-spinner nice-spinner--md", style: { margin: "0 auto" } }) }) }) : Le ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a(
1008
+ children: Xt ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: _e, className: "nice-datagrid__empty", children: /* @__PURE__ */ a("div", { className: "nice-spinner nice-spinner--md", style: { margin: "0 auto" } }) }) }) : Le ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a(
973
1009
  "td",
974
1010
  {
975
1011
  colSpan: _e,
@@ -977,10 +1013,10 @@ ${G ? 1 : 0}`, [an, on] = T(
977
1013
  role: "alert",
978
1014
  children: Le
979
1015
  }
980
- ) }) : k.length === 0 ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: _e, className: "nice-datagrid__empty", children: x ? i("controls.noResults", "No results") : $n || i("controls.noData", "No data available") }) }) : /* @__PURE__ */ h(ve, { children: [
981
- En(Nt, "top"),
982
- Nn,
983
- En(k.length - Et, "bottom")
1016
+ ) }) : v.length === 0 ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: _e, className: "nice-datagrid__empty", children: E ? l("controls.noResults", "No results") : Wn || l("controls.noData", "No data available") }) }) : /* @__PURE__ */ p(be, { children: [
1017
+ Ln(Rt, "top"),
1018
+ Gn,
1019
+ Ln(v.length - Dt, "bottom")
984
1020
  ] })
985
1021
  }
986
1022
  )
@@ -989,17 +1025,17 @@ ${G ? 1 : 0}`, [an, on] = T(
989
1025
  )
990
1026
  }
991
1027
  ),
992
- Z && typeof document < "u" && Dr(
1028
+ Z && typeof document < "u" && Xr(
993
1029
  /* @__PURE__ */ a(
994
1030
  "div",
995
1031
  {
996
- ref: At,
1032
+ ref: Pt,
997
1033
  className: "nice-treegrid__menu",
998
1034
  role: "menu",
999
- "aria-label": i("treeGrid.rowMenu", "Row actions"),
1035
+ "aria-label": l("treeGrid.rowMenu", "Row actions"),
1000
1036
  style: { position: "fixed", left: Z.x, top: Z.y },
1001
1037
  children: Z.items.map(
1002
- (e) => e.divider ? /* @__PURE__ */ a("div", { className: "nice-treegrid__menu-divider", role: "separator" }, e.id) : /* @__PURE__ */ h(
1038
+ (e) => e.divider ? /* @__PURE__ */ a("div", { className: "nice-treegrid__menu-divider", role: "separator" }, e.id) : /* @__PURE__ */ p(
1003
1039
  "button",
1004
1040
  {
1005
1041
  type: "button",
@@ -1007,7 +1043,7 @@ ${G ? 1 : 0}`, [an, on] = T(
1007
1043
  className: `nice-treegrid__menu-item${e.danger ? " nice-treegrid__menu-item--danger" : ""}`,
1008
1044
  disabled: e.disabled,
1009
1045
  onClick: () => {
1010
- Mt(), e.onSelect?.();
1046
+ Gt(), e.onSelect?.();
1011
1047
  },
1012
1048
  children: [
1013
1049
  e.icon && /* @__PURE__ */ a(te, { name: e.icon, size: 14 }),
@@ -1019,30 +1055,32 @@ ${G ? 1 : 0}`, [an, on] = T(
1019
1055
  )
1020
1056
  }
1021
1057
  ),
1022
- ur?.portalTarget ?? document.body
1058
+ Ar?.portalTarget ?? document.body
1023
1059
  ),
1024
- Je && /* @__PURE__ */ a(
1025
- Kr,
1060
+ Qe && /* @__PURE__ */ a(
1061
+ Qr,
1026
1062
  {
1027
- title: Bn,
1028
- items: Vn ?? Pr(b, Y),
1029
- data: Je.data,
1030
- columns: Yn,
1031
- formProps: Fn,
1032
- onClose: () => Qe(null),
1033
- onFieldChange: (e, t) => Qe((n) => n && { ...n, data: { ...n.data, [e]: t } }),
1063
+ title: Qn,
1064
+ items: Xn ?? Zr(b, Y),
1065
+ data: Qe.data,
1066
+ columns: Jn,
1067
+ formProps: Zn,
1068
+ error: xr,
1069
+ saving: Er,
1070
+ onClose: En,
1071
+ onFieldChange: (e, t) => Tt((n) => n && { ...n, data: { ...n.data, [e]: t } }),
1034
1072
  onSubmit: (e) => {
1035
- qt?.(Je.key, { ...Je.data, ...e }), Qe(null);
1073
+ Nr(Qe.key, { ...Qe.data, ...e });
1036
1074
  }
1037
1075
  }
1038
1076
  ),
1039
- V && /* @__PURE__ */ a("span", { className: "nice-sr-only", role: "status", "aria-live": "polite", children: sr }),
1077
+ V && /* @__PURE__ */ a("span", { className: "nice-sr-only", role: "status", "aria-live": "polite", children: Sr }),
1040
1078
  Z && // a click outside the menu closes it
1041
- /* @__PURE__ */ a("div", { className: "nice-treegrid__menu-backdrop", "aria-hidden": "true", onMouseDown: Mt })
1079
+ /* @__PURE__ */ a("div", { className: "nice-treegrid__menu-backdrop", "aria-hidden": "true", onMouseDown: Gt })
1042
1080
  ]
1043
1081
  }
1044
1082
  );
1045
1083
  }
1046
1084
  export {
1047
- pa as NiceTreeGrid
1085
+ Pa as NiceTreeGrid
1048
1086
  };