@progress/kendo-react-treelist 15.2.0-develop.1 → 15.2.0-develop.3
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/TreeList.d.ts +10 -121
- package/TreeList.js +1 -1
- package/TreeList.mjs +840 -526
- package/TreeListNoRecords.d.ts +8 -6
- package/TreeListNoRecords.js +1 -1
- package/TreeListNoRecords.mjs +15 -12
- package/cells/EditCells/TreeListBooleanEditor.js +1 -1
- package/cells/EditCells/TreeListBooleanEditor.mjs +5 -5
- package/cells/EditCells/TreeListDateEditor.js +1 -1
- package/cells/EditCells/TreeListDateEditor.mjs +9 -9
- package/cells/EditCells/TreeListNumericEditor.js +1 -1
- package/cells/EditCells/TreeListNumericEditor.mjs +9 -9
- package/cells/EditCells/TreeListTextEditor.js +1 -1
- package/cells/EditCells/TreeListTextEditor.mjs +4 -4
- package/cells/TreeListCell.js +1 -1
- package/cells/TreeListCell.mjs +10 -10
- package/cells/TreeListSelectionCell.js +1 -1
- package/cells/TreeListSelectionCell.mjs +1 -1
- package/dist/cdn/js/kendo-react-treelist.js +1 -1
- package/header/TreeListHeaderSelectionCell.d.ts +10 -6
- package/header/TreeListHeaderSelectionCell.js +1 -1
- package/header/TreeListHeaderSelectionCell.mjs +16 -14
- package/index.d.mts +5 -7
- package/index.d.ts +5 -7
- package/index.js +1 -1
- package/index.mjs +49 -50
- package/interfaces/events.d.ts +6 -6
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +9 -9
- package/rows/TreeListDraggableRow.d.ts +7 -26
- package/rows/TreeListDraggableRow.js +1 -1
- package/rows/TreeListDraggableRow.mjs +88 -77
- package/rows/TreeListRow.js +1 -1
- package/rows/TreeListRow.mjs +1 -1
- package/TreeListMcpWrapper.d.ts +0 -17
- package/TreeListMcpWrapper.js +0 -8
- package/TreeListMcpWrapper.mjs +0 -18
package/TreeList.mjs
CHANGED
|
@@ -5,582 +5,896 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import { readColumns as
|
|
12
|
-
import { setHeaderRowsTop as
|
|
13
|
-
import { TreeListCell as
|
|
14
|
-
import { TreeListNoRecords as
|
|
15
|
-
import { TreeListRow as
|
|
16
|
-
import { packageMetadata as
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
8
|
+
import * as t from "react";
|
|
9
|
+
import c from "prop-types";
|
|
10
|
+
import { validatePackage as tn, getLicenseMessage as nn, getNestedValue as D, memoizeOne as nt, useWebMcpRegister as rn, noop as rt, getter as an, classNames as ke, WatermarkOverlay as at, canUseDOM as on } from "@progress/kendo-react-common";
|
|
11
|
+
import { readColumns as ln, mapColumns as cn, ColumnResize as sn, CommonDragLogic as un, tableKeyboardNavigation as K, getSelectionOptions as ot, tableKeyboardNavigationTools as Se, tableColumnsVirtualization as dn, Header as fn, FilterRow as gn, HeaderRow as hn, TableKeyboardNavigationContext as lt, tableKeyboardNavigationScopeAttributes as ct, TableSelection as st, tableKeyboardNavigationBodyAttributes as it, DropClue as ut, DragClue as dt, flatData as mn } from "@progress/kendo-react-data-tools";
|
|
12
|
+
import { setHeaderRowsTop as pn, tableRowsVirtualization as bn } from "./utils/index.mjs";
|
|
13
|
+
import { TreeListCell as vn } from "./cells/TreeListCell.mjs";
|
|
14
|
+
import { TreeListNoRecords as Cn } from "./TreeListNoRecords.mjs";
|
|
15
|
+
import { TreeListRow as Rn } from "./rows/TreeListRow.mjs";
|
|
16
|
+
import { packageMetadata as ft } from "./package-metadata.mjs";
|
|
17
|
+
const gt = t.forwardRef((H, ht) => {
|
|
18
|
+
var Ye;
|
|
19
|
+
const {
|
|
20
|
+
columns: B = [],
|
|
21
|
+
filterRow: xe,
|
|
22
|
+
scrollable: O = "scrollable",
|
|
23
|
+
resizable: Ie = !1,
|
|
24
|
+
reorderable: V = !1,
|
|
25
|
+
skip: G,
|
|
26
|
+
take: J,
|
|
27
|
+
data: ae = [],
|
|
28
|
+
rowHeight: Fe,
|
|
29
|
+
columnVirtualization: mt,
|
|
30
|
+
selectable: A,
|
|
31
|
+
selectedField: oe,
|
|
32
|
+
editField: pt,
|
|
33
|
+
expandField: le,
|
|
34
|
+
subItemsField: U,
|
|
35
|
+
dataItemKey: De,
|
|
36
|
+
id: Q,
|
|
37
|
+
style: ce,
|
|
38
|
+
className: He,
|
|
39
|
+
toolbar: Me,
|
|
40
|
+
noRecords: bt,
|
|
41
|
+
tableProps: vt,
|
|
42
|
+
pager: X,
|
|
43
|
+
sort: $,
|
|
44
|
+
sortable: Ct,
|
|
45
|
+
filter: Rt,
|
|
46
|
+
columnMenu: Et,
|
|
47
|
+
columnMenuFilter: wt,
|
|
48
|
+
row: yt,
|
|
49
|
+
editRow: Ne,
|
|
50
|
+
rowRender: kt,
|
|
51
|
+
cellRender: St,
|
|
52
|
+
headerCellRender: xt
|
|
53
|
+
} = H, C = t.useRef(null), se = t.useRef(null), E = t.useRef(null), Y = t.useRef(null), M = t.useRef(null), j = t.useRef(null), Te = t.useRef(!1), ie = t.useRef(!1), ue = t.useRef(!1), de = t.useRef(0), fe = t.useRef(0), Z = t.useRef(!1), ee = t.useRef(0), ge = t.useRef([]), _ = t.useRef([]), w = t.useRef([]), q = t.useRef([]), s = t.useRef(H);
|
|
54
|
+
s.current = H;
|
|
55
|
+
const y = t.useRef({ current: void 0 }), x = t.useRef({ current: void 0 }), Le = t.useMemo(() => !tn(ft, { component: "TreeList" }), []), Pe = t.useMemo(() => nn(ft), []), b = t.useRef(null), R = t.useRef(null), [, It] = t.useReducer((e) => !e, !0), T = Q ? Q + "-treelist" : void 0, ze = () => {
|
|
56
|
+
var e;
|
|
57
|
+
if (on)
|
|
58
|
+
return ((e = C.current) == null ? void 0 : e.ownerDocument) || document;
|
|
59
|
+
}, We = t.useCallback(
|
|
60
|
+
(e) => !!D(le, e),
|
|
61
|
+
[le]
|
|
62
|
+
), Ke = t.useCallback(
|
|
63
|
+
(e) => !!D(U, e),
|
|
64
|
+
[U]
|
|
65
|
+
), Ft = t.useCallback(
|
|
66
|
+
(e) => {
|
|
67
|
+
const n = [];
|
|
68
|
+
return We(e) && Ke(e) && n.push(...D(U, e)), n;
|
|
69
|
+
},
|
|
70
|
+
[We, Ke, U]
|
|
71
|
+
), he = t.useMemo(
|
|
72
|
+
() => nt((e, n) => ln(e, {
|
|
73
|
+
prevId: 0,
|
|
74
|
+
idPrefix: n
|
|
75
|
+
})),
|
|
76
|
+
[]
|
|
77
|
+
), me = t.useMemo(
|
|
78
|
+
() => nt(
|
|
79
|
+
(e, n) => cn(e, n)
|
|
80
|
+
),
|
|
81
|
+
[]
|
|
82
|
+
), g = t.useRef(null), Dt = t.useCallback((e) => {
|
|
83
|
+
if (!C.current)
|
|
84
|
+
return;
|
|
85
|
+
const { rowIndex: n = 0 } = e, r = s.current, a = r.rowHeight || 0, l = E.current || C.current;
|
|
86
|
+
if (r.scrollable === "virtual" || a)
|
|
87
|
+
l.scroll(0, (n - 1) * a);
|
|
88
|
+
else {
|
|
89
|
+
const u = (E.current || C.current).querySelector(
|
|
90
|
+
`tbody > tr:nth-child(${n})`
|
|
91
|
+
);
|
|
92
|
+
if (u) {
|
|
93
|
+
const o = u.offsetTop - ee.current;
|
|
94
|
+
l.scroll(0, o);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}, []);
|
|
98
|
+
if (t.useImperativeHandle(
|
|
99
|
+
g,
|
|
100
|
+
() => ({
|
|
101
|
+
get element() {
|
|
102
|
+
return C.current;
|
|
103
|
+
},
|
|
104
|
+
props: H,
|
|
105
|
+
scrollIntoView: Dt
|
|
106
|
+
})
|
|
107
|
+
), t.useImperativeHandle(ht, () => g.current), rn("treelist", g, H, H.webMcp), !b.current) {
|
|
108
|
+
const e = (a, l, u, o, d) => {
|
|
109
|
+
var p, i, f;
|
|
110
|
+
const h = (p = b.current) == null ? void 0 : p.colGroupMain;
|
|
111
|
+
if (h) {
|
|
112
|
+
let v = 0;
|
|
113
|
+
const m = h.children;
|
|
114
|
+
for (let F = 0; F < m.length; F++) {
|
|
115
|
+
const W = m[F].style.width;
|
|
116
|
+
if (!W) {
|
|
117
|
+
v = 0;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
v += parseFloat(W);
|
|
30
121
|
}
|
|
122
|
+
v = Math.round(v);
|
|
123
|
+
const N = v ? v + "px" : "";
|
|
124
|
+
M.current && (M.current.style.width = N), j.current && (j.current.style.width = N);
|
|
31
125
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
126
|
+
if (s.current.onColumnResize) {
|
|
127
|
+
let v = 0;
|
|
128
|
+
const m = (f = (i = b.current) == null ? void 0 : i.colGroupMain) == null ? void 0 : f.children;
|
|
129
|
+
if (m)
|
|
130
|
+
for (let S = 0; S < m.length; S++)
|
|
131
|
+
v += parseFloat(m[S].style.width || "0");
|
|
132
|
+
const F = w.current.filter(
|
|
133
|
+
(S) => S.declarationIndex >= 0 && S.parentIndex === -1
|
|
134
|
+
), W = (S) => (S.sort((re, Ee) => re.declarationIndex - Ee.declarationIndex), S.map((re) => {
|
|
135
|
+
const {
|
|
136
|
+
declarationIndex: Ee,
|
|
137
|
+
parentIndex: Zt,
|
|
138
|
+
depth: en,
|
|
139
|
+
colSpan: we,
|
|
140
|
+
rowSpan: ye,
|
|
141
|
+
index: wn,
|
|
142
|
+
kFirst: yn,
|
|
143
|
+
groupable: kn,
|
|
144
|
+
children: et,
|
|
145
|
+
...tt
|
|
146
|
+
} = re;
|
|
147
|
+
return et.length ? { children: W(et), ...tt } : tt;
|
|
148
|
+
})), Ze = {
|
|
149
|
+
columns: W(F),
|
|
150
|
+
totalWidth: v,
|
|
151
|
+
index: a,
|
|
152
|
+
nativeEvent: o,
|
|
153
|
+
newWidth: l,
|
|
154
|
+
oldWidth: u,
|
|
155
|
+
end: d,
|
|
156
|
+
target: g.current
|
|
48
157
|
};
|
|
49
|
-
|
|
158
|
+
s.current.onColumnResize(Ze);
|
|
50
159
|
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}, this.onRowDrag = (e) => {
|
|
56
|
-
this.props.onRowDrag && this.props.onRowDrag.call(void 0, { ...e, target: this });
|
|
57
|
-
}, this.onRowDrop = (e) => {
|
|
58
|
-
this.props.onRowDrop && this.props.onRowDrop.call(void 0, { ...e, target: this });
|
|
59
|
-
}, this.columnReorder = (e, t, o) => {
|
|
60
|
-
const s = this.extendedColumn[e].depth, l = (d) => {
|
|
160
|
+
};
|
|
161
|
+
b.current = new sn(e);
|
|
162
|
+
const n = (a, l, u) => {
|
|
163
|
+
const o = w.current, d = o[a].depth, h = (i) => {
|
|
61
164
|
do
|
|
62
|
-
|
|
63
|
-
while (
|
|
64
|
-
return
|
|
65
|
-
},
|
|
66
|
-
if (
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
165
|
+
i++;
|
|
166
|
+
while (i < o.length && o[i].depth > d);
|
|
167
|
+
return i;
|
|
168
|
+
}, p = o.splice(a, h(a) - a);
|
|
169
|
+
if (o.splice(a < l ? h(l - p.length) : l, 0, ...p), o.filter((i) => i.declarationIndex >= 0).forEach((i, f) => i.orderIndex = f), s.current.onColumnReorder) {
|
|
170
|
+
const i = o.filter(
|
|
171
|
+
(m) => m.declarationIndex >= 0 && m.parentIndex === -1
|
|
172
|
+
), f = (m) => (m.sort((N, F) => N.declarationIndex - F.declarationIndex), m.map((N) => {
|
|
173
|
+
const {
|
|
174
|
+
declarationIndex: F,
|
|
175
|
+
parentIndex: W,
|
|
176
|
+
depth: Ze,
|
|
177
|
+
colSpan: S,
|
|
178
|
+
rowSpan: re,
|
|
179
|
+
index: Ee,
|
|
180
|
+
kFirst: Zt,
|
|
181
|
+
groupable: en,
|
|
182
|
+
children: we,
|
|
183
|
+
...ye
|
|
184
|
+
} = N;
|
|
185
|
+
return we.length ? { children: f(we), ...ye } : ye;
|
|
186
|
+
})), v = {
|
|
187
|
+
target: g.current,
|
|
188
|
+
columns: f(i),
|
|
189
|
+
nativeEvent: u
|
|
71
190
|
};
|
|
72
|
-
|
|
191
|
+
s.current.onColumnReorder(v);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
R.current = new un(n, rt, rt);
|
|
195
|
+
const r = b.current.dragHandler.bind(b.current);
|
|
196
|
+
b.current.dragHandler = (a, l, u, o) => {
|
|
197
|
+
Ht(), r(a, l, u, o);
|
|
198
|
+
}, K.onConstructor({
|
|
199
|
+
navigatable: !!s.current.navigatable,
|
|
200
|
+
contextStateRef: y.current,
|
|
201
|
+
navigationStateRef: x.current
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
const pe = t.useCallback((e) => {
|
|
205
|
+
var u;
|
|
206
|
+
if (!e || s.current.scrollable === "none")
|
|
207
|
+
return;
|
|
208
|
+
if (E.current) {
|
|
209
|
+
const o = E.current.querySelector("table");
|
|
210
|
+
o != null && o.tBodies[0] && (ee.current = o.tBodies[0].offsetTop);
|
|
211
|
+
const d = (u = Y.current) == null ? void 0 : u.parentElement;
|
|
212
|
+
if (d) {
|
|
213
|
+
const h = E.current.offsetWidth - E.current.clientWidth;
|
|
214
|
+
d.style.paddingInlineEnd = h + "px";
|
|
215
|
+
}
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const n = Array.from(e.childNodes), r = n.find((o) => o.nodeName === "TABLE"), a = s.current.toolbar && n.find(
|
|
219
|
+
(o) => o.nodeType === 1 && o.classList.contains("k-grid-toolbar")
|
|
220
|
+
);
|
|
221
|
+
let l = 0;
|
|
222
|
+
if (a) {
|
|
223
|
+
const o = a.style.boxSizing;
|
|
224
|
+
a.style.boxSizing = "border-box", l = parseFloat(String(window.getComputedStyle(a).height)) || a.offsetHeight, a.style.boxSizing = o, a.getAttribute("style") || a.removeAttribute("style");
|
|
225
|
+
}
|
|
226
|
+
ee.current = r.tBodies[0].offsetTop, pn(r, l);
|
|
227
|
+
}, []), Ht = () => {
|
|
228
|
+
var p, i;
|
|
229
|
+
const e = (p = b.current) == null ? void 0 : p.colGroupMain;
|
|
230
|
+
if (!e || !M.current)
|
|
231
|
+
return;
|
|
232
|
+
const n = e.children, r = w.current.filter((f) => f.children.length === 0), a = (i = b.current) == null ? void 0 : i.colGroupHeader, l = M.current.offsetWidth;
|
|
233
|
+
let u = 0, o = !0;
|
|
234
|
+
for (let f = 0; f < r.length; f++)
|
|
235
|
+
if (r[f].width !== void 0)
|
|
236
|
+
u += parseFloat(String(r[f].width));
|
|
237
|
+
else {
|
|
238
|
+
o = !1;
|
|
239
|
+
break;
|
|
73
240
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
241
|
+
if (!o || !l || !u || Math.abs(l - u) <= 1)
|
|
242
|
+
return;
|
|
243
|
+
Te.current = !0;
|
|
244
|
+
const d = l / u;
|
|
245
|
+
let h = 0;
|
|
246
|
+
for (let f = 0; f < r.length; f++) {
|
|
247
|
+
const v = parseFloat(String(r[f].width));
|
|
248
|
+
let m;
|
|
249
|
+
f === r.length - 1 ? m = l - h : m = Math.round(v * d), h += m, r[f].width = m, n[f] && (n[f].style.width = m + "px"), a != null && a.children[f] && (a.children[f].style.width = m + "px");
|
|
250
|
+
}
|
|
251
|
+
M.current && (M.current.style.width = l + "px"), j.current && (j.current.style.width = l + "px");
|
|
252
|
+
}, te = () => _.current.map((e) => e.dataItem), L = t.useCallback(
|
|
253
|
+
(e, n, r) => {
|
|
254
|
+
const a = s.current;
|
|
255
|
+
if (e)
|
|
256
|
+
e({
|
|
257
|
+
nativeEvent: r == null ? void 0 : r.nativeEvent,
|
|
258
|
+
syntheticEvent: r,
|
|
259
|
+
target: g.current,
|
|
260
|
+
...n
|
|
261
|
+
});
|
|
262
|
+
else if (a.onDataStateChange) {
|
|
263
|
+
const l = {
|
|
264
|
+
nativeEvent: r == null ? void 0 : r.nativeEvent,
|
|
265
|
+
syntheticEvent: r,
|
|
266
|
+
target: g.current,
|
|
267
|
+
dataState: {
|
|
268
|
+
filter: a.filter,
|
|
269
|
+
sort: a.sort,
|
|
270
|
+
...n
|
|
271
|
+
}
|
|
85
272
|
};
|
|
86
|
-
|
|
273
|
+
a.onDataStateChange(l);
|
|
87
274
|
}
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
275
|
+
},
|
|
276
|
+
[]
|
|
277
|
+
), Mt = t.useCallback(
|
|
278
|
+
(e, n, r) => {
|
|
279
|
+
L(s.current.onSortChange, { sort: n, field: r }, e);
|
|
280
|
+
},
|
|
281
|
+
[L]
|
|
282
|
+
), Nt = t.useCallback(
|
|
283
|
+
(e, n, r) => {
|
|
284
|
+
L(s.current.onFilterChange, { filter: n, field: r }, e);
|
|
285
|
+
},
|
|
286
|
+
[L]
|
|
287
|
+
), Tt = t.useCallback(
|
|
288
|
+
(e) => {
|
|
289
|
+
L(
|
|
290
|
+
s.current.onFilterChange,
|
|
291
|
+
{ filter: e.filter, field: e.field },
|
|
292
|
+
e.syntheticEvent
|
|
97
293
|
);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}, this.itemChange = (e) => {
|
|
105
|
-
const t = this.props.onItemChange;
|
|
106
|
-
if (e.field === this.props.expandField) {
|
|
107
|
-
const o = this.props.onExpandChange;
|
|
108
|
-
if (o) {
|
|
109
|
-
const s = {
|
|
110
|
-
...this.getArguments(e.syntheticEvent),
|
|
111
|
-
dataItem: e.dataItem,
|
|
112
|
-
level: e.level,
|
|
113
|
-
value: e.value
|
|
114
|
-
};
|
|
115
|
-
o.call(void 0, s);
|
|
116
|
-
}
|
|
294
|
+
},
|
|
295
|
+
[L]
|
|
296
|
+
), Lt = t.useCallback(
|
|
297
|
+
(e, n, r) => {
|
|
298
|
+
const a = s.current;
|
|
299
|
+
if (!a.onColumnMenuFilterChange)
|
|
117
300
|
return;
|
|
301
|
+
const l = {
|
|
302
|
+
syntheticEvent: e,
|
|
303
|
+
filter: n,
|
|
304
|
+
field: r,
|
|
305
|
+
target: g.current,
|
|
306
|
+
nativeEvent: e.nativeEvent
|
|
307
|
+
};
|
|
308
|
+
a.onColumnMenuFilterChange(l);
|
|
309
|
+
},
|
|
310
|
+
[]
|
|
311
|
+
), Pt = t.useCallback(
|
|
312
|
+
(e, n, r) => {
|
|
313
|
+
const a = s.current;
|
|
314
|
+
if (a.expandField && a.onExpandChange) {
|
|
315
|
+
const l = {
|
|
316
|
+
nativeEvent: e == null ? void 0 : e.nativeEvent,
|
|
317
|
+
syntheticEvent: e,
|
|
318
|
+
target: g.current,
|
|
319
|
+
dataItem: n,
|
|
320
|
+
level: r,
|
|
321
|
+
value: !!D(a.expandField, n)
|
|
322
|
+
};
|
|
323
|
+
a.onExpandChange(l);
|
|
118
324
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
325
|
+
},
|
|
326
|
+
[]
|
|
327
|
+
), Be = t.useCallback((e) => {
|
|
328
|
+
var r, a;
|
|
329
|
+
const n = s.current;
|
|
330
|
+
if (e.field === n.expandField) {
|
|
331
|
+
if (n.onExpandChange) {
|
|
332
|
+
const l = {
|
|
333
|
+
nativeEvent: (r = e.syntheticEvent) == null ? void 0 : r.nativeEvent,
|
|
334
|
+
syntheticEvent: e.syntheticEvent,
|
|
335
|
+
target: g.current,
|
|
122
336
|
dataItem: e.dataItem,
|
|
123
337
|
level: e.level,
|
|
124
|
-
field: e.field,
|
|
125
338
|
value: e.value
|
|
126
339
|
};
|
|
127
|
-
|
|
340
|
+
n.onExpandChange(l);
|
|
128
341
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
if (n.onItemChange) {
|
|
345
|
+
const l = {
|
|
346
|
+
nativeEvent: (a = e.syntheticEvent) == null ? void 0 : a.nativeEvent,
|
|
347
|
+
syntheticEvent: e.syntheticEvent,
|
|
348
|
+
target: g.current,
|
|
349
|
+
dataItem: e.dataItem,
|
|
350
|
+
level: e.level,
|
|
351
|
+
field: e.field,
|
|
352
|
+
value: e.value
|
|
353
|
+
};
|
|
354
|
+
n.onItemChange(l);
|
|
355
|
+
}
|
|
356
|
+
}, []), zt = t.useCallback(
|
|
357
|
+
(e) => {
|
|
358
|
+
var r;
|
|
359
|
+
const n = s.current;
|
|
360
|
+
if (n.onSelectionChange) {
|
|
361
|
+
const { event: a, item: l, dataIndex: u, columnIndex: o } = e, { mode: d, cell: h } = ot(n.selectable), p = {
|
|
362
|
+
nativeEvent: (r = a.syntheticEvent) == null ? void 0 : r.nativeEvent,
|
|
363
|
+
syntheticEvent: a.syntheticEvent,
|
|
364
|
+
target: g.current,
|
|
365
|
+
dataItem: l.dataItem,
|
|
366
|
+
level: l.level,
|
|
367
|
+
startColIndex: o,
|
|
368
|
+
endColIndex: o,
|
|
369
|
+
startRowIndex: u,
|
|
370
|
+
endRowIndex: u,
|
|
371
|
+
dataItems: te(),
|
|
372
|
+
altKey: !1,
|
|
373
|
+
ctrlKey: !1,
|
|
374
|
+
shiftKey: !1,
|
|
375
|
+
metaKey: !1,
|
|
376
|
+
mode: d,
|
|
377
|
+
cell: h,
|
|
378
|
+
isDrag: !1,
|
|
379
|
+
componentId: T,
|
|
380
|
+
selectedField: n.selectedField || ""
|
|
137
381
|
};
|
|
138
|
-
|
|
382
|
+
n.onSelectionChange(p);
|
|
139
383
|
}
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
|
|
384
|
+
},
|
|
385
|
+
[T]
|
|
386
|
+
), Wt = t.useCallback((e) => {
|
|
387
|
+
var r;
|
|
388
|
+
const n = s.current;
|
|
389
|
+
if (n.onHeaderSelectionChange) {
|
|
390
|
+
const a = {
|
|
391
|
+
field: e.field,
|
|
392
|
+
nativeEvent: (r = e.syntheticEvent) == null ? void 0 : r.nativeEvent,
|
|
393
|
+
syntheticEvent: e.syntheticEvent,
|
|
394
|
+
target: g.current,
|
|
395
|
+
dataItems: te()
|
|
396
|
+
};
|
|
397
|
+
n.onHeaderSelectionChange(a);
|
|
398
|
+
}
|
|
399
|
+
}, []), Oe = t.useCallback(
|
|
400
|
+
(e) => {
|
|
401
|
+
const n = s.current;
|
|
402
|
+
if (n.onSelectionChange) {
|
|
403
|
+
const r = {
|
|
143
404
|
syntheticEvent: void 0,
|
|
144
|
-
target:
|
|
145
|
-
selectedField:
|
|
146
|
-
componentId:
|
|
147
|
-
dataItems:
|
|
405
|
+
target: g.current,
|
|
406
|
+
selectedField: n.selectedField || "",
|
|
407
|
+
componentId: T,
|
|
408
|
+
dataItems: te(),
|
|
148
409
|
dataItem: null,
|
|
149
410
|
level: [],
|
|
150
411
|
...e
|
|
151
412
|
};
|
|
152
|
-
|
|
413
|
+
n.onSelectionChange(r);
|
|
153
414
|
}
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const { onColumnMenuFilterChange: s } = this.props;
|
|
163
|
-
if (!s || !o)
|
|
164
|
-
return;
|
|
165
|
-
const l = {
|
|
415
|
+
},
|
|
416
|
+
[T]
|
|
417
|
+
), Kt = t.useCallback((e, n) => {
|
|
418
|
+
if (s.current.onRowClick && e.target.nodeName === "TD") {
|
|
419
|
+
const r = {
|
|
420
|
+
dataItem: n.dataItem,
|
|
421
|
+
level: n.level,
|
|
422
|
+
nativeEvent: e == null ? void 0 : e.nativeEvent,
|
|
166
423
|
syntheticEvent: e,
|
|
167
|
-
|
|
168
|
-
field: o,
|
|
169
|
-
target: this,
|
|
170
|
-
nativeEvent: e.nativeEvent
|
|
424
|
+
target: g.current
|
|
171
425
|
};
|
|
172
|
-
s.
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const o = {
|
|
205
|
-
dataItem: t.dataItem,
|
|
206
|
-
level: t.level,
|
|
207
|
-
...this.getArguments(e)
|
|
208
|
-
};
|
|
209
|
-
this.props.onRowContextMenu.call(void 0, o);
|
|
210
|
-
}
|
|
211
|
-
}, this.onPageChange = (e) => {
|
|
212
|
-
if (this.props.onPageChange) {
|
|
213
|
-
const t = {
|
|
214
|
-
...this.getArguments(e.syntheticEvent),
|
|
426
|
+
s.current.onRowClick(r);
|
|
427
|
+
}
|
|
428
|
+
}, []), Bt = t.useCallback((e, n) => {
|
|
429
|
+
if (s.current.onRowDoubleClick && e.target.nodeName === "TD") {
|
|
430
|
+
const r = {
|
|
431
|
+
dataItem: n.dataItem,
|
|
432
|
+
level: n.level,
|
|
433
|
+
nativeEvent: e == null ? void 0 : e.nativeEvent,
|
|
434
|
+
syntheticEvent: e,
|
|
435
|
+
target: g.current
|
|
436
|
+
};
|
|
437
|
+
s.current.onRowDoubleClick(r);
|
|
438
|
+
}
|
|
439
|
+
}, []), Ot = t.useCallback((e, n) => {
|
|
440
|
+
if (s.current.onRowContextMenu && e.target.nodeName === "TD") {
|
|
441
|
+
const r = {
|
|
442
|
+
dataItem: n.dataItem,
|
|
443
|
+
level: n.level,
|
|
444
|
+
nativeEvent: e == null ? void 0 : e.nativeEvent,
|
|
445
|
+
syntheticEvent: e,
|
|
446
|
+
target: g.current
|
|
447
|
+
};
|
|
448
|
+
s.current.onRowContextMenu(r);
|
|
449
|
+
}
|
|
450
|
+
}, []), Ve = t.useCallback(
|
|
451
|
+
(e) => {
|
|
452
|
+
var n;
|
|
453
|
+
if (s.current.onPageChange) {
|
|
454
|
+
const r = {
|
|
455
|
+
nativeEvent: (n = e.syntheticEvent) == null ? void 0 : n.nativeEvent,
|
|
456
|
+
syntheticEvent: e.syntheticEvent,
|
|
457
|
+
target: g.current,
|
|
215
458
|
skip: e.skip,
|
|
216
459
|
take: e.take
|
|
217
460
|
};
|
|
218
|
-
|
|
461
|
+
s.current.onPageChange(r);
|
|
219
462
|
}
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* @hidden
|
|
258
|
-
*/
|
|
259
|
-
componentDidUpdate(h) {
|
|
260
|
-
h.columns !== this.props.columns && this.calculateSizes(this.element), S.onComponentDidUpdate({
|
|
261
|
-
scope: this.element || void 0,
|
|
262
|
-
contextStateRef: this.contextStateRef,
|
|
263
|
-
navigationStateRef: this.navigationStateRef
|
|
463
|
+
},
|
|
464
|
+
[]
|
|
465
|
+
), Vt = t.useCallback(
|
|
466
|
+
(e) => {
|
|
467
|
+
s.current.onRowDrag && s.current.onRowDrag({ ...e, target: g.current });
|
|
468
|
+
},
|
|
469
|
+
[]
|
|
470
|
+
), Gt = t.useCallback(
|
|
471
|
+
(e) => {
|
|
472
|
+
s.current.onRowDrop && s.current.onRowDrop({ ...e, target: g.current });
|
|
473
|
+
},
|
|
474
|
+
[]
|
|
475
|
+
), Ge = t.useCallback(
|
|
476
|
+
(e) => {
|
|
477
|
+
if (K.onKeyDown(e, {
|
|
478
|
+
navigatable: !!s.current.navigatable,
|
|
479
|
+
contextStateRef: y.current,
|
|
480
|
+
navigationStateRef: x.current
|
|
481
|
+
}), s.current.onKeyDown) {
|
|
482
|
+
const { mode: n, cell: r } = ot(s.current.selectable), a = {
|
|
483
|
+
dataItems: te(),
|
|
484
|
+
mode: n,
|
|
485
|
+
cell: r,
|
|
486
|
+
componentId: T,
|
|
487
|
+
selectedField: s.current.selectedField,
|
|
488
|
+
nativeEvent: e == null ? void 0 : e.nativeEvent,
|
|
489
|
+
syntheticEvent: e,
|
|
490
|
+
target: g.current
|
|
491
|
+
};
|
|
492
|
+
s.current.onKeyDown(a);
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
[T]
|
|
496
|
+
), Ae = t.useCallback((e) => {
|
|
497
|
+
K.onFocus(e, {
|
|
498
|
+
contextStateRef: y.current
|
|
264
499
|
});
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
* @hidden
|
|
274
|
-
*/
|
|
275
|
-
render() {
|
|
276
|
-
const {
|
|
277
|
-
columns: h = [],
|
|
278
|
-
filterRow: e,
|
|
279
|
-
scrollable: t = "scrollable",
|
|
280
|
-
resizable: o = !1,
|
|
281
|
-
reorderable: s = !1,
|
|
282
|
-
skip: l,
|
|
283
|
-
take: i
|
|
284
|
-
} = this.props, d = h.some((a) => !!a.filter || !!a.filterCell) || e !== void 0, g = e || ce, u = V.getIdPrefix(this.navigationStateRef), L = this.getExtendedColumn(h, u), T = L.length !== this.extendedColumn.length;
|
|
285
|
-
this.extendedColumn = L, this.columnsMap = this.getColumnsMap(this.extendedColumn, T);
|
|
286
|
-
const m = this.extendedColumn.filter((a) => a.children.length === 0);
|
|
287
|
-
this.columnResize.columns = this.extendedColumn, this.columnResize.resizable = o, this.dragLogic.columns = this.extendedColumn, this.dragLogic.reorderable = s, this.dragLogic.groupable = !1;
|
|
288
|
-
const I = /* @__PURE__ */ r.createElement(
|
|
289
|
-
de,
|
|
290
|
-
{
|
|
291
|
-
headerRow: /* @__PURE__ */ r.createElement(
|
|
292
|
-
pe,
|
|
293
|
-
{
|
|
294
|
-
sort: this.props.sort,
|
|
295
|
-
sortable: this.props.sortable,
|
|
296
|
-
sortChange: this.sortChange,
|
|
297
|
-
selectionChange: this.onHeaderSelectionChange,
|
|
298
|
-
columns: this.extendedColumn,
|
|
299
|
-
columnsMap: this.columnsMap,
|
|
300
|
-
cellRender: this.props.headerCellRender,
|
|
301
|
-
columnResize: this.columnResize,
|
|
302
|
-
columnMenu: this.props.columnMenu,
|
|
303
|
-
columnMenuFilter: this.props.columnMenuFilter,
|
|
304
|
-
columnMenuFilterChange: this.columnMenuFilterChange,
|
|
305
|
-
pressHandler: this.dragLogic.pressHandler,
|
|
306
|
-
dragHandler: this.dragLogic.dragHandler,
|
|
307
|
-
releaseHandler: this.dragLogic.releaseHandler,
|
|
308
|
-
filterChange: this.headerFilterChange
|
|
309
|
-
}
|
|
310
|
-
),
|
|
311
|
-
reorderable: this.props.reorderable,
|
|
312
|
-
filterRow: d && /* @__PURE__ */ r.createElement(
|
|
313
|
-
g,
|
|
314
|
-
{
|
|
315
|
-
columns: m,
|
|
316
|
-
filter: this.props.filter,
|
|
317
|
-
filterChange: this.filterChange,
|
|
318
|
-
sort: this.props.sort,
|
|
319
|
-
ariaRowIndex: this.columnsMap.length + 1
|
|
320
|
-
}
|
|
321
|
-
) || void 0,
|
|
322
|
-
columnResize: this.columnResize
|
|
500
|
+
}, []), At = t.useCallback((e) => {
|
|
501
|
+
var h;
|
|
502
|
+
const n = e.currentTarget.scrollLeft, r = e.currentTarget.scrollTop, a = s.current, u = a.rowHeight || 0, o = 0;
|
|
503
|
+
let d = !1;
|
|
504
|
+
if (a.columnVirtualization && Math.abs(de.current - n) > o && (de.current = n, d = !0), a.scrollable === "virtual" && Math.abs(fe.current - r) > u && (fe.current = r, d = !0), d) {
|
|
505
|
+
if (y.current.current && x.current.current) {
|
|
506
|
+
const p = (h = ze()) == null ? void 0 : h.activeElement, i = p && Se.getNavigatableId(p);
|
|
507
|
+
i && i === y.current.current.activeId && (x.current.current.activeElementIsFocused = !0);
|
|
323
508
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
expanded: D,
|
|
347
|
-
hasChildren: this.hasChildren(a.dataItem),
|
|
348
|
-
onExpandChange: this.expandChange,
|
|
349
|
-
colIndex: p,
|
|
350
|
-
ariaColumnIndex: c.ariaColumnIndex,
|
|
351
|
-
style: c.left !== void 0 && {
|
|
352
|
-
left: c.left,
|
|
353
|
-
right: c.right,
|
|
354
|
-
borderRightWidth: c.rightBorder ? "1px" : ""
|
|
355
|
-
} || {},
|
|
356
|
-
isSelected: Array.isArray(w) && w.indexOf(p) > -1
|
|
357
|
-
};
|
|
358
|
-
return v && c.editCell ? /* @__PURE__ */ r.createElement(c.editCell, { key: C, ...R, onChange: this.itemChange }) : c.cell ? /* @__PURE__ */ r.createElement(c.cell, { key: C, ...R }) : /* @__PURE__ */ r.createElement(Re, { key: C, ...R });
|
|
509
|
+
Z.current = !0, It();
|
|
510
|
+
}
|
|
511
|
+
Y.current && !ue.current && (ie.current = !0, Y.current.scrollLeft = n), ue.current = !1;
|
|
512
|
+
}, []), Ut = t.useCallback((e) => {
|
|
513
|
+
if (ie.current) {
|
|
514
|
+
ie.current = !1;
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
const n = e.currentTarget.scrollLeft;
|
|
518
|
+
E.current && E.current.scrollLeft !== n && (ue.current = !0, E.current.scrollLeft = n);
|
|
519
|
+
}, []), be = t.useRef(!1);
|
|
520
|
+
t.useLayoutEffect(() => (pe(C.current), K.onComponentDidMount({
|
|
521
|
+
scope: se.current || C.current || void 0,
|
|
522
|
+
contextStateRef: y.current,
|
|
523
|
+
navigationStateRef: x.current
|
|
524
|
+
}), () => {
|
|
525
|
+
be.current = !1, q.current = [], ge.current = [], _.current = [], Z.current = !1, he.clear(), me.clear();
|
|
526
|
+
}), [pe, he, me]), t.useLayoutEffect(() => {
|
|
527
|
+
K.onGetSnapshotBeforeUpdate({
|
|
528
|
+
document: ze(),
|
|
529
|
+
contextStateRef: y.current,
|
|
530
|
+
navigationStateRef: x.current
|
|
359
531
|
});
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
532
|
+
});
|
|
533
|
+
const Ue = t.useRef(B);
|
|
534
|
+
t.useLayoutEffect(() => {
|
|
535
|
+
if (!be.current) {
|
|
536
|
+
be.current = !0;
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
Ue.current !== B && pe(C.current), Ue.current = B, K.onComponentDidUpdate({
|
|
540
|
+
scope: se.current || C.current || void 0,
|
|
541
|
+
contextStateRef: y.current,
|
|
542
|
+
navigationStateRef: x.current
|
|
543
|
+
});
|
|
544
|
+
});
|
|
545
|
+
const $e = B.some((e) => !!e.filter || !!e.filterCell) || xe !== void 0, $t = xe || gn, je = Se.getIdPrefix(x.current), _e = he(B, je), jt = _e.length !== w.current.length;
|
|
546
|
+
w.current = _e, q.current = me(w.current, jt);
|
|
547
|
+
const k = w.current.filter((e) => e.children.length === 0);
|
|
548
|
+
b.current.columns = w.current, b.current.resizable = Ie, R.current.columns = w.current, R.current.reorderable = V, R.current.groupable = !1;
|
|
549
|
+
let I = (() => {
|
|
550
|
+
let e = 0;
|
|
551
|
+
const n = (a) => {
|
|
552
|
+
const l = { height: Fe || 0, offsetTop: e };
|
|
553
|
+
return e += l.height, l;
|
|
554
|
+
}, r = Z.current && ge.current === ae && ee.current > 0 && _.current.length ? _.current : mn(ae, Ft, n);
|
|
555
|
+
return ge.current = ae, _.current = r, r;
|
|
556
|
+
})();
|
|
557
|
+
const ne = I.length;
|
|
558
|
+
G !== void 0 && J !== void 0 && (I = I.slice(G, G + J));
|
|
559
|
+
const ve = ce || {};
|
|
560
|
+
O === "virtual" && (I = bn({
|
|
561
|
+
rows: I,
|
|
562
|
+
tableViewPortHeight: parseFloat((ve.height || ve.maxHeight || "").toString()),
|
|
563
|
+
scrollTop: fe.current
|
|
564
|
+
}), Z.current = !1);
|
|
565
|
+
const { colSpans: _t, hiddenColumns: qt } = dn({
|
|
566
|
+
enabled: mt,
|
|
567
|
+
columns: k,
|
|
568
|
+
scrollLeft: de.current,
|
|
569
|
+
tableViewPortWidth: parseFloat((ve.width || "").toString())
|
|
570
|
+
}), Jt = I.map((e) => e.level), Qt = q.current.length + ($e ? 1 : 0) + 1, qe = /* @__PURE__ */ t.createElement(
|
|
571
|
+
fn,
|
|
572
|
+
{
|
|
573
|
+
headerRow: /* @__PURE__ */ t.createElement(
|
|
574
|
+
hn,
|
|
575
|
+
{
|
|
576
|
+
sort: $,
|
|
577
|
+
sortable: Ct,
|
|
578
|
+
sortChange: Mt,
|
|
579
|
+
selectionChange: Wt,
|
|
580
|
+
columns: w.current,
|
|
581
|
+
columnsMap: q.current,
|
|
582
|
+
cellRender: xt,
|
|
583
|
+
columnResize: b.current,
|
|
584
|
+
columnMenu: Et,
|
|
585
|
+
columnMenuFilter: wt,
|
|
586
|
+
columnMenuFilterChange: Lt,
|
|
587
|
+
pressHandler: R.current.pressHandler,
|
|
588
|
+
dragHandler: R.current.dragHandler,
|
|
589
|
+
releaseHandler: R.current.releaseHandler,
|
|
590
|
+
filterChange: Nt
|
|
395
591
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
592
|
+
),
|
|
593
|
+
reorderable: V,
|
|
594
|
+
className: O !== "none" ? "k-table-thead" : void 0,
|
|
595
|
+
role: O !== "none" ? "rowgroup" : void 0,
|
|
596
|
+
filterRow: $e && /* @__PURE__ */ t.createElement(
|
|
597
|
+
$t,
|
|
399
598
|
{
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
599
|
+
columns: k,
|
|
600
|
+
filter: Rt,
|
|
601
|
+
filterChange: Tt,
|
|
602
|
+
sort: $,
|
|
603
|
+
ariaRowIndex: q.current.length + 1
|
|
403
604
|
}
|
|
404
|
-
)
|
|
405
|
-
|
|
406
|
-
|
|
605
|
+
) || void 0,
|
|
606
|
+
columnResize: b.current
|
|
607
|
+
}
|
|
608
|
+
), Xt = (e, n, r, a, l, u) => k.map((o, d) => {
|
|
609
|
+
if (qt[d])
|
|
610
|
+
return null;
|
|
611
|
+
const h = o.id ? o.id : d, p = `${o.className ? o.className + " " : ""}${o.locked ? "k-grid-content-sticky" : ""}`, i = {
|
|
612
|
+
id: Se.generateNavigatableId(`${r}-${String(d)}`, je),
|
|
613
|
+
colSpan: _t[d],
|
|
614
|
+
dataItem: e.dataItem,
|
|
615
|
+
field: o.field,
|
|
616
|
+
format: o.format,
|
|
617
|
+
className: p || void 0,
|
|
618
|
+
render: St,
|
|
619
|
+
onChange: Be,
|
|
620
|
+
selectionChange: H.onSelectionChange ? (f) => {
|
|
621
|
+
zt({ event: f, item: e, columnIndex: d, dataIndex: l });
|
|
622
|
+
} : void 0,
|
|
623
|
+
level: e.level,
|
|
624
|
+
expandable: o.expandable,
|
|
625
|
+
expanded: a,
|
|
626
|
+
hasChildren: !!D(U, e.dataItem),
|
|
627
|
+
onExpandChange: Pt,
|
|
628
|
+
colIndex: d,
|
|
629
|
+
ariaColumnIndex: o.ariaColumnIndex,
|
|
630
|
+
style: o.left !== void 0 && {
|
|
631
|
+
left: o.left,
|
|
632
|
+
right: o.right,
|
|
633
|
+
borderRightWidth: o.rightBorder ? "1px" : ""
|
|
634
|
+
} || {},
|
|
635
|
+
isSelected: Array.isArray(u) && u.indexOf(d) > -1
|
|
636
|
+
};
|
|
637
|
+
return n && o.editCell ? /* @__PURE__ */ t.createElement(o.editCell, { key: h, ...i, onChange: Be }) : o.cell ? /* @__PURE__ */ t.createElement(o.cell, { key: h, ...i }) : /* @__PURE__ */ t.createElement(vn, { key: h, ...i });
|
|
638
|
+
}), Je = I.length > 0 && I.map((e, n) => {
|
|
639
|
+
const r = D(pt, e.dataItem), a = De && an(De)(e.dataItem), l = String(a || e.level.join(".")), u = !!D(le, e.dataItem), o = oe ? D(oe, e.dataItem) : void 0, d = {
|
|
640
|
+
key: l,
|
|
641
|
+
level: e.level,
|
|
642
|
+
levels: Jt,
|
|
643
|
+
dataItem: e.dataItem,
|
|
644
|
+
selectedField: oe,
|
|
645
|
+
rowHeight: O === "virtual" ? e.height : Fe,
|
|
646
|
+
render: kt,
|
|
647
|
+
onDrop: Gt,
|
|
648
|
+
onDrag: Vt,
|
|
649
|
+
onClick: (i) => Kt(i, e),
|
|
650
|
+
onDoubleClick: (i) => Bt(i, e),
|
|
651
|
+
onContextMenu: (i) => Ot(i, e),
|
|
652
|
+
isAltRow: n % 2 !== 0,
|
|
653
|
+
expanded: u,
|
|
654
|
+
rowIndex: n,
|
|
655
|
+
ariaRowIndex: Qt + n,
|
|
656
|
+
ariaSetSize: e.levelCount,
|
|
657
|
+
ariaPosInSet: e.level[e.level.length - 1] + 1,
|
|
658
|
+
isSelected: typeof o == "boolean" && o
|
|
659
|
+
}, h = yt || Rn, p = Xt(e, r, l, u, n, o);
|
|
660
|
+
return r && Ne ? /* @__PURE__ */ t.createElement(Ne, { ...d, key: d.key }, p) : /* @__PURE__ */ t.createElement(h, { ...d, key: d.key }, p);
|
|
661
|
+
}) || /* @__PURE__ */ t.createElement("tr", { className: "k-table-row k-grid-norecords" }, /* @__PURE__ */ t.createElement("td", { colSpan: k.length }, bt || /* @__PURE__ */ t.createElement(Cn, null))), Yt = (e) => $ == null ? void 0 : $.some((n) => n.field === e), Ce = k.map((e) => /* @__PURE__ */ t.createElement(
|
|
662
|
+
"col",
|
|
663
|
+
{
|
|
664
|
+
key: e.declarationIndex,
|
|
665
|
+
className: Yt(e.field) ? "k-sorted" : void 0,
|
|
666
|
+
style: e.width !== void 0 ? { width: e.width } : void 0
|
|
667
|
+
}
|
|
668
|
+
)), Qe = A != null && A.drag ? "none" : void 0, P = vt || {}, Xe = O !== "none";
|
|
669
|
+
let z = 0;
|
|
670
|
+
if (Xe && Ie && Te.current) {
|
|
671
|
+
let e = !0;
|
|
672
|
+
for (let n = 0; n < k.length; n++)
|
|
673
|
+
if (k[n].width !== void 0)
|
|
674
|
+
z += parseFloat(String(k[n].width));
|
|
675
|
+
else {
|
|
676
|
+
e = !1;
|
|
677
|
+
break;
|
|
678
|
+
}
|
|
679
|
+
e || (z = 0);
|
|
680
|
+
}
|
|
681
|
+
let Re;
|
|
682
|
+
return z ? Re = { width: z } : (Ye = P.style) != null && Ye.width && (Re = { width: P.style.width }), Xe ? /* @__PURE__ */ t.createElement(lt.Provider, { value: y.current.current }, /* @__PURE__ */ t.createElement(
|
|
683
|
+
"div",
|
|
684
|
+
{
|
|
685
|
+
id: Q,
|
|
686
|
+
style: ce,
|
|
687
|
+
className: ke("k-grid", "k-treelist", "k-treelist-scrollable", He),
|
|
688
|
+
ref: (e) => {
|
|
689
|
+
C.current = e;
|
|
690
|
+
},
|
|
691
|
+
onKeyDown: Ge,
|
|
692
|
+
onFocus: Ae
|
|
693
|
+
},
|
|
694
|
+
Me,
|
|
695
|
+
/* @__PURE__ */ t.createElement(
|
|
407
696
|
"div",
|
|
408
697
|
{
|
|
409
|
-
|
|
410
|
-
style: this.props.style,
|
|
411
|
-
className: ne("k-grid", "k-treelist", this.props.className, {
|
|
412
|
-
"k-treelist-scrollable": t !== "none"
|
|
413
|
-
}),
|
|
414
|
-
ref: (a) => {
|
|
415
|
-
this.element = a;
|
|
416
|
-
},
|
|
417
|
-
onScroll: X ? this.handleOnScroll : void 0,
|
|
418
|
-
onKeyDown: this.onKeyDown,
|
|
419
|
-
onFocus: this.onFocus,
|
|
420
|
-
"aria-rowcount": N,
|
|
421
|
-
"aria-colcount": m.length,
|
|
698
|
+
className: "k-grid-aria-root k-treelist",
|
|
422
699
|
role: "treegrid",
|
|
423
|
-
|
|
700
|
+
"aria-rowcount": ne,
|
|
701
|
+
"aria-colcount": k.length,
|
|
702
|
+
ref: (e) => {
|
|
703
|
+
se.current = e;
|
|
704
|
+
},
|
|
705
|
+
...ct
|
|
424
706
|
},
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
"table",
|
|
707
|
+
/* @__PURE__ */ t.createElement("div", { className: ke("k-grid-header", { "k-grid-draggable-header": V }) }, /* @__PURE__ */ t.createElement(
|
|
708
|
+
"div",
|
|
428
709
|
{
|
|
429
|
-
className: "k-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
710
|
+
className: "k-grid-header-wrap",
|
|
711
|
+
ref: (e) => {
|
|
712
|
+
Y.current = e;
|
|
713
|
+
},
|
|
714
|
+
onScroll: Ut
|
|
433
715
|
},
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
/* @__PURE__ */ r.createElement(
|
|
437
|
-
"tbody",
|
|
716
|
+
/* @__PURE__ */ t.createElement(
|
|
717
|
+
"table",
|
|
438
718
|
{
|
|
439
|
-
className: "k-table-
|
|
440
|
-
|
|
441
|
-
|
|
719
|
+
className: "k-table k-grid-header-table",
|
|
720
|
+
role: "presentation",
|
|
721
|
+
style: Re,
|
|
722
|
+
ref: (e) => {
|
|
723
|
+
M.current = e;
|
|
724
|
+
}
|
|
442
725
|
},
|
|
443
|
-
|
|
726
|
+
/* @__PURE__ */ t.createElement(
|
|
727
|
+
"colgroup",
|
|
728
|
+
{
|
|
729
|
+
ref: (e) => {
|
|
730
|
+
b.current.colGroupHeader = e;
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
Ce
|
|
734
|
+
),
|
|
735
|
+
qe
|
|
444
736
|
)
|
|
445
737
|
)),
|
|
446
|
-
|
|
447
|
-
|
|
738
|
+
/* @__PURE__ */ t.createElement("div", { className: "k-grid-container" }, /* @__PURE__ */ t.createElement(
|
|
739
|
+
"div",
|
|
448
740
|
{
|
|
449
|
-
className: "k-grid-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
741
|
+
className: "k-grid-content",
|
|
742
|
+
ref: (e) => {
|
|
743
|
+
E.current = e;
|
|
744
|
+
},
|
|
745
|
+
onScroll: At
|
|
746
|
+
},
|
|
747
|
+
/* @__PURE__ */ t.createElement(st, { selectable: A, onRelease: Oe }, /* @__PURE__ */ t.createElement(
|
|
748
|
+
"table",
|
|
749
|
+
{
|
|
750
|
+
className: "k-table k-grid-table",
|
|
751
|
+
...P,
|
|
752
|
+
style: {
|
|
753
|
+
...P.style || {},
|
|
754
|
+
userSelect: Qe,
|
|
755
|
+
...z ? { width: z } : {}
|
|
756
|
+
},
|
|
757
|
+
role: "presentation",
|
|
758
|
+
ref: (e) => {
|
|
759
|
+
j.current = e;
|
|
760
|
+
}
|
|
761
|
+
},
|
|
762
|
+
/* @__PURE__ */ t.createElement(
|
|
763
|
+
"colgroup",
|
|
764
|
+
{
|
|
765
|
+
ref: (e) => {
|
|
766
|
+
b.current.colGroupMain = e;
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
Ce
|
|
770
|
+
),
|
|
771
|
+
/* @__PURE__ */ t.createElement(
|
|
772
|
+
"tbody",
|
|
773
|
+
{
|
|
774
|
+
className: "k-table-tbody",
|
|
775
|
+
...it,
|
|
776
|
+
role: "rowgroup"
|
|
777
|
+
},
|
|
778
|
+
Je
|
|
779
|
+
)
|
|
780
|
+
))
|
|
781
|
+
))
|
|
782
|
+
),
|
|
783
|
+
X && /* @__PURE__ */ t.createElement(
|
|
784
|
+
X,
|
|
785
|
+
{
|
|
786
|
+
className: "k-grid-pager",
|
|
787
|
+
total: ne,
|
|
788
|
+
skip: G,
|
|
789
|
+
take: J,
|
|
790
|
+
onPageChange: Ve
|
|
791
|
+
}
|
|
792
|
+
),
|
|
793
|
+
V && /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(ut, { ref: R.current.refDropElementClue }), /* @__PURE__ */ t.createElement(dt, { ref: R.current.refDragElementClue })),
|
|
794
|
+
Le && /* @__PURE__ */ t.createElement(at, { message: Pe })
|
|
795
|
+
)) : /* @__PURE__ */ t.createElement(lt.Provider, { value: y.current.current }, /* @__PURE__ */ t.createElement(
|
|
796
|
+
"div",
|
|
797
|
+
{
|
|
798
|
+
id: Q,
|
|
799
|
+
style: ce,
|
|
800
|
+
className: ke("k-grid", "k-treelist", He),
|
|
801
|
+
ref: (e) => {
|
|
802
|
+
C.current = e;
|
|
803
|
+
},
|
|
804
|
+
onKeyDown: Ge,
|
|
805
|
+
onFocus: Ae,
|
|
806
|
+
"aria-rowcount": ne,
|
|
807
|
+
"aria-colcount": k.length,
|
|
808
|
+
role: "treegrid",
|
|
809
|
+
...ct
|
|
810
|
+
},
|
|
811
|
+
Me,
|
|
812
|
+
/* @__PURE__ */ t.createElement(st, { selectable: A, onRelease: Oe }, /* @__PURE__ */ t.createElement(
|
|
813
|
+
"table",
|
|
814
|
+
{
|
|
815
|
+
className: "k-table k-grid-table",
|
|
816
|
+
...P,
|
|
817
|
+
style: { ...P.style || {}, userSelect: Qe },
|
|
818
|
+
role: "presentation"
|
|
819
|
+
},
|
|
820
|
+
/* @__PURE__ */ t.createElement(
|
|
821
|
+
"colgroup",
|
|
822
|
+
{
|
|
823
|
+
ref: (e) => {
|
|
824
|
+
b.current.colGroupMain = e;
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
Ce
|
|
455
828
|
),
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
})
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
selectionChange(h) {
|
|
491
|
-
if (this.props.onSelectionChange) {
|
|
492
|
-
const { event: e, item: t, dataIndex: o, columnIndex: s } = h, { mode: l, cell: i } = O(this.props.selectable), d = {
|
|
493
|
-
...this.getArguments(e.syntheticEvent),
|
|
494
|
-
dataItem: t.dataItem,
|
|
495
|
-
level: t.level,
|
|
496
|
-
startColIndex: s,
|
|
497
|
-
endColIndex: s,
|
|
498
|
-
startRowIndex: o,
|
|
499
|
-
endRowIndex: o,
|
|
500
|
-
dataItems: this.getLeafDataItems(),
|
|
501
|
-
altKey: !1,
|
|
502
|
-
ctrlKey: !1,
|
|
503
|
-
shiftKey: !1,
|
|
504
|
-
metaKey: !1,
|
|
505
|
-
mode: l,
|
|
506
|
-
cell: i,
|
|
507
|
-
isDrag: !1,
|
|
508
|
-
componentId: this._treeListId,
|
|
509
|
-
selectedField: this.props.selectedField || ""
|
|
510
|
-
};
|
|
511
|
-
this.props.onSelectionChange.call(void 0, d);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
raiseDataEvent(h, e, t) {
|
|
515
|
-
const o = this.props.onDataStateChange;
|
|
516
|
-
if (h)
|
|
517
|
-
h.call(void 0, { ...this.getArguments(t), ...e });
|
|
518
|
-
else if (o) {
|
|
519
|
-
const s = {
|
|
520
|
-
...this.getArguments(t),
|
|
521
|
-
dataState: { ...this.getDataState(), ...e }
|
|
522
|
-
};
|
|
523
|
-
o.call(void 0, s);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
getDataState() {
|
|
527
|
-
return {
|
|
528
|
-
filter: this.props.filter,
|
|
529
|
-
sort: this.props.sort
|
|
530
|
-
};
|
|
531
|
-
}
|
|
532
|
-
getArguments(h) {
|
|
533
|
-
return {
|
|
534
|
-
nativeEvent: h && h.nativeEvent,
|
|
535
|
-
syntheticEvent: h,
|
|
536
|
-
target: this
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
M.propTypes = {
|
|
541
|
-
data: n.array,
|
|
542
|
-
resizable: n.bool,
|
|
543
|
-
reorderable: n.bool,
|
|
544
|
-
sortable: n.oneOfType([
|
|
545
|
-
n.bool,
|
|
546
|
-
n.shape({
|
|
547
|
-
mode: n.oneOf(["single", "multiple"]),
|
|
548
|
-
allowUnsort: n.bool
|
|
829
|
+
qe,
|
|
830
|
+
/* @__PURE__ */ t.createElement(
|
|
831
|
+
"tbody",
|
|
832
|
+
{
|
|
833
|
+
className: "k-table-tbody",
|
|
834
|
+
...it,
|
|
835
|
+
role: "presentation"
|
|
836
|
+
},
|
|
837
|
+
Je
|
|
838
|
+
)
|
|
839
|
+
)),
|
|
840
|
+
X && /* @__PURE__ */ t.createElement(
|
|
841
|
+
X,
|
|
842
|
+
{
|
|
843
|
+
className: "k-grid-pager",
|
|
844
|
+
total: ne,
|
|
845
|
+
skip: G,
|
|
846
|
+
take: J,
|
|
847
|
+
onPageChange: Ve
|
|
848
|
+
}
|
|
849
|
+
),
|
|
850
|
+
V && /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(ut, { ref: R.current.refDropElementClue }), /* @__PURE__ */ t.createElement(dt, { ref: R.current.refDragElementClue })),
|
|
851
|
+
Le && /* @__PURE__ */ t.createElement(at, { message: Pe })
|
|
852
|
+
));
|
|
853
|
+
});
|
|
854
|
+
gt.propTypes = {
|
|
855
|
+
data: c.array,
|
|
856
|
+
resizable: c.bool,
|
|
857
|
+
reorderable: c.bool,
|
|
858
|
+
sortable: c.oneOfType([
|
|
859
|
+
c.bool,
|
|
860
|
+
c.shape({
|
|
861
|
+
mode: c.oneOf(["single", "multiple"]),
|
|
862
|
+
allowUnsort: c.bool
|
|
549
863
|
})
|
|
550
864
|
]),
|
|
551
|
-
onSortChange:
|
|
552
|
-
sort:
|
|
553
|
-
columns:
|
|
554
|
-
columnVirtualization:
|
|
555
|
-
filter:
|
|
556
|
-
onFilterChange:
|
|
557
|
-
filterRow:
|
|
558
|
-
toolbar:
|
|
559
|
-
noRecords:
|
|
560
|
-
onExpandChange:
|
|
561
|
-
expandField:
|
|
562
|
-
subItemsField:
|
|
563
|
-
selectedField:
|
|
564
|
-
onSelectionChange:
|
|
565
|
-
onHeaderSelectionChange:
|
|
566
|
-
onRowClick:
|
|
567
|
-
onItemChange:
|
|
568
|
-
editField:
|
|
569
|
-
scrollable:
|
|
570
|
-
rowHeight:
|
|
571
|
-
style:
|
|
572
|
-
tableProps:
|
|
573
|
-
pager:
|
|
574
|
-
skip:
|
|
575
|
-
take:
|
|
576
|
-
onPageChange:
|
|
577
|
-
onDataStateChange:
|
|
578
|
-
onColumnResize:
|
|
579
|
-
onColumnReorder:
|
|
580
|
-
dataItemKey:
|
|
581
|
-
navigatable:
|
|
582
|
-
}
|
|
583
|
-
|
|
865
|
+
onSortChange: c.func,
|
|
866
|
+
sort: c.array,
|
|
867
|
+
columns: c.arrayOf(c.object),
|
|
868
|
+
columnVirtualization: c.bool,
|
|
869
|
+
filter: c.array,
|
|
870
|
+
onFilterChange: c.func,
|
|
871
|
+
filterRow: c.any,
|
|
872
|
+
toolbar: c.any,
|
|
873
|
+
noRecords: c.any,
|
|
874
|
+
onExpandChange: c.func,
|
|
875
|
+
expandField: c.string,
|
|
876
|
+
subItemsField: c.string,
|
|
877
|
+
selectedField: c.string,
|
|
878
|
+
onSelectionChange: c.func,
|
|
879
|
+
onHeaderSelectionChange: c.func,
|
|
880
|
+
onRowClick: c.func,
|
|
881
|
+
onItemChange: c.func,
|
|
882
|
+
editField: c.string,
|
|
883
|
+
scrollable: c.oneOf(["none", "scrollable", "virtual"]),
|
|
884
|
+
rowHeight: c.number,
|
|
885
|
+
style: c.object,
|
|
886
|
+
tableProps: c.object,
|
|
887
|
+
pager: c.any,
|
|
888
|
+
skip: c.number,
|
|
889
|
+
take: c.number,
|
|
890
|
+
onPageChange: c.func,
|
|
891
|
+
onDataStateChange: c.func,
|
|
892
|
+
onColumnResize: c.func,
|
|
893
|
+
onColumnReorder: c.func,
|
|
894
|
+
dataItemKey: c.string,
|
|
895
|
+
navigatable: c.bool
|
|
896
|
+
};
|
|
897
|
+
gt.displayName = "KendoReactTreeList";
|
|
584
898
|
export {
|
|
585
|
-
|
|
899
|
+
gt as TreeList
|
|
586
900
|
};
|