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