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