@nice2dev/ui 1.4.13 → 1.4.15

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