@nice2dev/ui 1.4.12 → 1.4.14

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