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