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