@progress/kendo-react-grid 10.2.0-develop.1 → 10.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/GridClientWrapper.js +1 -1
- package/GridClientWrapper.mjs +249 -251
- package/cells/GridFilterCell.js +1 -1
- package/cells/GridFilterCell.mjs +4 -2
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/index.d.mts +25 -25
- package/index.d.ts +25 -25
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +13 -13
package/GridClientWrapper.mjs
CHANGED
|
@@ -7,22 +7,22 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as i from "react";
|
|
10
|
-
import { canUseDOM as
|
|
11
|
-
import { getSelectionOptions as
|
|
10
|
+
import { canUseDOM as p, getActiveElement as At, useDir as Ht, setScrollbarWidth as Ae, cloneArray as Ft, getter as ee, RowHeightService as He } from "@progress/kendo-react-common";
|
|
11
|
+
import { getSelectionOptions as te, populateClipboardData as Lt, ClipboardActionType as Ie, getEditableOptions as Gt, tableKeyboardNavigation as T, ClipboardService as zt, TableKeyboardNavigationContext as Nt, editReducer as Ot, EDIT_ACTION as Bt, getDetailExpandableOptions as Ut, detailExpandReducer as Fe, getGroupExpandableOptions as Vt, groupExpandReducer as _t, DETAIL_EXPAND_ACTION as Wt, getSelectedState as Le, getSelectedStateFromKeyDown as jt, closestTagName as Ge, getColumnIndex as qt, getRowIndex as Xt, updateLeft as $t, updateRight as Jt } from "@progress/kendo-react-data-tools";
|
|
12
12
|
import { ColumnResize as Yt } from "./drag/ColumnResize.mjs";
|
|
13
13
|
import { CommonDragLogic as Qt } from "./drag/CommonDragLogic.mjs";
|
|
14
14
|
import { SAFARI_REGEX as Zt } from "./constants/index.mjs";
|
|
15
|
-
import { getDefaultHeadContextMenuItems as pt, getDefaultBodyContextMenuItems as en, isRowReorderEnabled as tn, sanitizeColumns as nn, getDataAsArray as rn, getFlatColumnsState as
|
|
15
|
+
import { getDefaultHeadContextMenuItems as pt, getDefaultBodyContextMenuItems as en, isRowReorderEnabled as tn, sanitizeColumns as nn, getDataAsArray as rn, getFlatColumnsState as on, firefox as ze, firefoxMaxHeight as Ne } from "./utils/index.mjs";
|
|
16
16
|
import { VirtualScrollFixed as Oe } from "./VirtualScrollFixed.mjs";
|
|
17
|
-
import { VirtualScroll as
|
|
17
|
+
import { VirtualScroll as an } from "./VirtualScroll.mjs";
|
|
18
18
|
import { GridContextMenu as dn } from "./contextMenu/GridContextMenu.mjs";
|
|
19
19
|
import { GridContextMenuAnchorPart as Be } from "./contextMenu/enums.mjs";
|
|
20
20
|
import { normalizeSortable as cn, firstLevelSortSeqMap as ln } from "./sortCommon.mjs";
|
|
21
21
|
const sn = i.createContext(void 0), wn = (t) => {
|
|
22
22
|
var Te, Me;
|
|
23
|
-
const w = t.gridProps.isClient, [
|
|
23
|
+
const w = t.gridProps.isClient, [b, be] = i.useState({}), Ue = (e) => {
|
|
24
24
|
e.event.preventDefault(), be({
|
|
25
|
-
...
|
|
25
|
+
...b,
|
|
26
26
|
show: !0,
|
|
27
27
|
offset: {
|
|
28
28
|
left: e.event.pageX,
|
|
@@ -31,43 +31,43 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
31
31
|
dataItem: e.dataItem,
|
|
32
32
|
field: e.field
|
|
33
33
|
});
|
|
34
|
-
},
|
|
34
|
+
}, Re = () => {
|
|
35
35
|
be({});
|
|
36
|
-
}, m = i.useMemo(() => t.columnsRef.find((e) => e.field ===
|
|
36
|
+
}, m = i.useMemo(() => t.columnsRef.find((e) => e.field === b.field), [t.columnsRef, b]), Ce = i.useMemo(() => {
|
|
37
37
|
const e = t.gridProps.sortable && (m == null ? void 0 : m.sortable);
|
|
38
38
|
return pt({
|
|
39
39
|
sortable: !!e,
|
|
40
|
-
selectable:
|
|
40
|
+
selectable: te(t.gridProps.selectable).enabled,
|
|
41
41
|
clipboard: !!t.gridProps.clipboard
|
|
42
42
|
});
|
|
43
|
-
}, [m, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]),
|
|
43
|
+
}, [m, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), ve = i.useMemo(() => {
|
|
44
44
|
const e = t.gridProps.sortable && (m == null ? void 0 : m.sortable);
|
|
45
45
|
return en({
|
|
46
46
|
sortable: !!e,
|
|
47
|
-
selectable:
|
|
47
|
+
selectable: te(t.gridProps.selectable).enabled,
|
|
48
48
|
clipboard: !!t.gridProps.clipboard,
|
|
49
49
|
rowReorderable: tn(t.gridProps.rowReorderable)
|
|
50
50
|
});
|
|
51
51
|
}, [m, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), Ve = i.useMemo(() => {
|
|
52
|
-
const e = (m == null ? void 0 : m.contextMenu) || t.gridProps.contextMenu, n = typeof e == "function" ? e(
|
|
53
|
-
if (n &&
|
|
54
|
-
const
|
|
55
|
-
return
|
|
52
|
+
const e = (m == null ? void 0 : m.contextMenu) || t.gridProps.contextMenu, n = typeof e == "function" ? e(b) : e;
|
|
53
|
+
if (n && b.offset) {
|
|
54
|
+
const o = b.dataItem ? Be.body : Be.head, r = n[o], a = b.dataItem ? ve : Ce;
|
|
55
|
+
return r === !1 ? void 0 : r === !0 || r === void 0 ? a : r;
|
|
56
56
|
}
|
|
57
|
-
}, [t.gridProps.contextMenu,
|
|
58
|
-
var l, u, g, f, C,
|
|
59
|
-
const n = e.event.item,
|
|
57
|
+
}, [t.gridProps.contextMenu, b, ve, Ce, m]), _e = (e) => {
|
|
58
|
+
var l, u, g, f, C, Z, I, N, O;
|
|
59
|
+
const n = e.event.item, o = {
|
|
60
60
|
target: R.current,
|
|
61
61
|
syntheticEvent: e.event.syntheticEvent,
|
|
62
62
|
nativeEvent: e.event.nativeEvent,
|
|
63
63
|
menuItem: n,
|
|
64
64
|
...e
|
|
65
65
|
};
|
|
66
|
-
t.gridProps.onContextMenuItemClick && s(t.gridProps.onContextMenuItemClick,
|
|
67
|
-
const
|
|
66
|
+
t.gridProps.onContextMenuItemClick && s(t.gridProps.onContextMenuItemClick, o);
|
|
67
|
+
const r = j(), a = {
|
|
68
68
|
selectedField: t.gridProps.selectedField || "",
|
|
69
69
|
componentId: t.id,
|
|
70
|
-
dataItems:
|
|
70
|
+
dataItems: r,
|
|
71
71
|
dataItem: e.dataItem,
|
|
72
72
|
startRowIndex: -1,
|
|
73
73
|
endRowIndex: -1,
|
|
@@ -78,31 +78,31 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
78
78
|
metaKey: !1,
|
|
79
79
|
shiftKey: !1,
|
|
80
80
|
isDrag: !1,
|
|
81
|
-
...
|
|
82
|
-
...
|
|
83
|
-
}, d =
|
|
81
|
+
...te(t.gridProps.selectable),
|
|
82
|
+
...o
|
|
83
|
+
}, d = r.findIndex((B) => B === e.dataItem);
|
|
84
84
|
switch ((l = n.data) == null ? void 0 : l.action) {
|
|
85
85
|
case "SortCommand":
|
|
86
86
|
if (m) {
|
|
87
87
|
const B = (u = n.name) == null ? void 0 : u.toLowerCase().includes("asc"), Kt = ((g = n.name) == null ? void 0 : g.toLowerCase().includes("desc")) ? "desc" : void 0, Tt = B ? "asc" : Kt, Mt = n.name ? Tt : void 0;
|
|
88
|
-
|
|
88
|
+
Ee(e.event.syntheticEvent, m, Mt);
|
|
89
89
|
}
|
|
90
90
|
break;
|
|
91
91
|
case "SelectRowCommand":
|
|
92
|
-
it(
|
|
92
|
+
it(a);
|
|
93
93
|
break;
|
|
94
94
|
case "SelectAllRowsCommand":
|
|
95
|
-
|
|
95
|
+
at(a);
|
|
96
96
|
break;
|
|
97
97
|
case "ClearSelectionCommand":
|
|
98
|
-
dt(
|
|
98
|
+
dt(a);
|
|
99
99
|
break;
|
|
100
100
|
case "ReorderRowCommand":
|
|
101
|
-
z.current = e.dataItem, (f = n.name) != null && f.toLowerCase().includes("rowup") && d > 0 && A(e.event.syntheticEvent, d - 1, "before"), (C = n.name) != null && C.toLowerCase().includes("rowdown") && d <
|
|
101
|
+
z.current = e.dataItem, (f = n.name) != null && f.toLowerCase().includes("rowup") && d > 0 && A(e.event.syntheticEvent, d - 1, "before"), (C = n.name) != null && C.toLowerCase().includes("rowdown") && d < r.length - 1 && A(e.event.syntheticEvent, d + 1, "after"), (Z = n.name) != null && Z.toLowerCase().includes("rowtop") && A(e.event.syntheticEvent, 0, "before"), (I = n.name) != null && I.toLowerCase().includes("rowbottom") && A(e.event.syntheticEvent, r.length - 1, "after");
|
|
102
102
|
break;
|
|
103
103
|
case "CopySelectionCommand":
|
|
104
104
|
W(
|
|
105
|
-
|
|
105
|
+
Ie.copy,
|
|
106
106
|
e.event.nativeEvent,
|
|
107
107
|
{
|
|
108
108
|
copyHeaders: !((N = n.name) != null && N.toLowerCase().includes("noheaders"))
|
|
@@ -113,7 +113,7 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
113
113
|
break;
|
|
114
114
|
case "PasteCommand":
|
|
115
115
|
W(
|
|
116
|
-
|
|
116
|
+
Ie.paste,
|
|
117
117
|
e.event.nativeEvent,
|
|
118
118
|
{
|
|
119
119
|
copyHeaders: !((O = n.name) != null && O.toLowerCase().includes("noheaders"))
|
|
@@ -123,36 +123,36 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
123
123
|
);
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
Re();
|
|
127
127
|
}, U = () => {
|
|
128
128
|
const e = t.columnsRef.filter((n) => n.declarationIndex >= 0 && n.parentIndex === -1);
|
|
129
129
|
return nn(e);
|
|
130
|
-
}, We = (e, n,
|
|
130
|
+
}, We = (e, n, o) => {
|
|
131
131
|
if (t.gridProps.onContextMenu && w) {
|
|
132
|
-
const
|
|
132
|
+
const r = {
|
|
133
133
|
target: R.current,
|
|
134
134
|
syntheticEvent: e,
|
|
135
135
|
nativeEvent: e.nativeEvent,
|
|
136
136
|
dataItem: n,
|
|
137
|
-
field:
|
|
137
|
+
field: o
|
|
138
138
|
};
|
|
139
|
-
s(t.gridProps.onContextMenu,
|
|
139
|
+
s(t.gridProps.onContextMenu, r);
|
|
140
140
|
}
|
|
141
141
|
t.gridProps.contextMenu && Ue({
|
|
142
142
|
event: e,
|
|
143
143
|
dataItem: n,
|
|
144
|
-
field:
|
|
144
|
+
field: o
|
|
145
145
|
});
|
|
146
146
|
}, je = (e) => {
|
|
147
147
|
if (e.target !== e.currentTarget)
|
|
148
148
|
return;
|
|
149
|
-
clearTimeout(
|
|
150
|
-
const n = e.currentTarget.scrollLeft,
|
|
151
|
-
t.gridProps.columnVirtualization && (!
|
|
152
|
-
|
|
153
|
-
}, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = n), G.current && G.current.setScrollLeft(n), L.current && L.current.setScrollLeft(n), c.current &&
|
|
149
|
+
clearTimeout(me.current), c.current && (c.current.table = x.current);
|
|
150
|
+
const n = e.currentTarget.scrollLeft, o = e.currentTarget.scrollTop, r = t.gridProps.scrollable === "virtual";
|
|
151
|
+
t.gridProps.columnVirtualization && (!r || o === fe.current) && (me.current = window.setTimeout(() => {
|
|
152
|
+
de();
|
|
153
|
+
}, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = n), G.current && G.current.setScrollLeft(n), L.current && L.current.setScrollLeft(n), c.current && o !== fe.current && c.current.scrollHandler(e), t.gridProps.onScroll && w && s(t.gridProps.onScroll, {
|
|
154
154
|
...P(e)
|
|
155
|
-
}),
|
|
155
|
+
}), fe.current = o;
|
|
156
156
|
}, qe = (e) => {
|
|
157
157
|
T.onKeyDown(e, {
|
|
158
158
|
navigatable: t.gridProps.navigatable || !1,
|
|
@@ -182,11 +182,11 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
182
182
|
}, $e = (e) => {
|
|
183
183
|
if (e.action === "moveToNextPage" && lt(e.event), e.action === "moveToPrevPage" && st(e.event), e.focusElement && e.action === "reorderToRight") {
|
|
184
184
|
const n = parseInt(e.focusElement.ariaColIndex, 10) - 1;
|
|
185
|
-
n < t.columnsRef.length - 1 &&
|
|
185
|
+
n < t.columnsRef.length - 1 && oe(n, n + 1, e.event);
|
|
186
186
|
}
|
|
187
187
|
if (e.focusElement && e.action === "reorderToLeft") {
|
|
188
188
|
const n = parseInt(e.focusElement.ariaColIndex, 10) - 1;
|
|
189
|
-
n > 0 &&
|
|
189
|
+
n > 0 && oe(n, n - 1, e.event);
|
|
190
190
|
}
|
|
191
191
|
if (e.action === "select" && nt(e.event), t.gridProps.onNavigationAction && w) {
|
|
192
192
|
const n = {
|
|
@@ -205,56 +205,56 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
205
205
|
dataItem: n,
|
|
206
206
|
...P(e)
|
|
207
207
|
});
|
|
208
|
-
}, Qe = (e, n,
|
|
209
|
-
if (
|
|
210
|
-
const
|
|
208
|
+
}, Qe = (e, n, o) => {
|
|
209
|
+
if (Ke.enabled && Ke.mode === "incell" && t.gridProps.dataItemKey) {
|
|
210
|
+
const r = Ot(t.gridProps.edit, {
|
|
211
211
|
type: Bt.ENTER_FIELD_EDIT,
|
|
212
|
-
payload: { id: n[t.gridProps.dataItemKey], field:
|
|
212
|
+
payload: { id: n[t.gridProps.dataItemKey], field: o }
|
|
213
213
|
});
|
|
214
214
|
t.gridProps.onEditChange && s(t.gridProps.onEditChange, {
|
|
215
|
-
edit:
|
|
215
|
+
edit: r,
|
|
216
216
|
...P(e)
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
219
|
}, Ze = (e, n) => {
|
|
220
|
-
var
|
|
220
|
+
var r;
|
|
221
221
|
if (Ut(t.detailExpandable).enabled) {
|
|
222
|
-
const
|
|
222
|
+
const a = Fe((r = t.gridProps.detailExpand) != null ? r : {}, e);
|
|
223
223
|
t.gridProps.onDetailExpandChange && s(t.gridProps.onDetailExpandChange, {
|
|
224
224
|
...P(n),
|
|
225
|
-
detailExpand:
|
|
225
|
+
detailExpand: a
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
228
|
}, pe = (e, n) => {
|
|
229
|
-
var
|
|
230
|
-
const
|
|
229
|
+
var r;
|
|
230
|
+
const o = Vt(
|
|
231
231
|
typeof t.gridProps.groupable == "object" ? t.gridProps.groupable.expandable !== !1 : t.gridProps.groupable
|
|
232
232
|
);
|
|
233
|
-
if (
|
|
234
|
-
const
|
|
233
|
+
if (o.enabled) {
|
|
234
|
+
const a = _t((r = t.gridProps.groupExpand) != null ? r : [], e, o);
|
|
235
235
|
t.gridProps.onGroupExpandChange && s(t.gridProps.onGroupExpandChange, {
|
|
236
236
|
...P(n),
|
|
237
|
-
groupExpand:
|
|
237
|
+
groupExpand: a
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
|
-
},
|
|
241
|
-
const { allowUnsort:
|
|
240
|
+
}, Ee = (e, n, o) => {
|
|
241
|
+
const { allowUnsort: r, mode: a } = cn(
|
|
242
242
|
t.gridProps.sortable || !1,
|
|
243
243
|
n.sortable || !1
|
|
244
|
-
), d = (t.gridProps.sort || []).filter((g) => g.field === n.field)[0], l =
|
|
245
|
-
l !== "" && n.field && u.push({ field: n.field, dir: l }),
|
|
244
|
+
), d = (t.gridProps.sort || []).filter((g) => g.field === n.field)[0], l = o || ln[r][d && d.dir || ""], u = a === "single" ? [] : (t.gridProps.sort || []).filter((g) => g.field !== n.field);
|
|
245
|
+
l !== "" && n.field && u.push({ field: n.field, dir: l }), we(u, e);
|
|
246
246
|
}, et = (e) => {
|
|
247
247
|
var n;
|
|
248
248
|
if (e.field === t.gridProps.expandField || e._expand || t.gridProps.group && e.field === void 0) {
|
|
249
249
|
if (t.gridProps.onExpandChange) {
|
|
250
|
-
const
|
|
250
|
+
const o = t.gridProps.dataItemKey ? Fe((n = t.gridProps.detailExpand) != null ? n : {}, {
|
|
251
251
|
type: Wt.SET,
|
|
252
252
|
id: e.dataItem[t.gridProps.dataItemKey],
|
|
253
253
|
payload: e.value
|
|
254
254
|
}) : t.gridProps.detailExpand;
|
|
255
255
|
s(t.gridProps.onExpandChange, {
|
|
256
256
|
...P(e.syntheticEvent),
|
|
257
|
-
expand:
|
|
257
|
+
expand: o,
|
|
258
258
|
dataItem: e.dataItem,
|
|
259
259
|
dataIndex: e.dataIndex,
|
|
260
260
|
value: e.value
|
|
@@ -272,13 +272,13 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
272
272
|
}, tt = (e) => {
|
|
273
273
|
var n;
|
|
274
274
|
if (t.gridProps.onSelectionChange && h.enabled) {
|
|
275
|
-
const { event:
|
|
276
|
-
...P(
|
|
277
|
-
dataItem:
|
|
275
|
+
const { event: o, dataItem: r, dataIndex: a, columnIndex: d } = e, l = {
|
|
276
|
+
...P(o.syntheticEvent),
|
|
277
|
+
dataItem: r,
|
|
278
278
|
startColIndex: d,
|
|
279
279
|
endColIndex: d,
|
|
280
|
-
startRowIndex:
|
|
281
|
-
endRowIndex:
|
|
280
|
+
startRowIndex: a,
|
|
281
|
+
endRowIndex: a,
|
|
282
282
|
dataItems: H(),
|
|
283
283
|
altKey: !1,
|
|
284
284
|
ctrlKey: !1,
|
|
@@ -310,19 +310,19 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
310
310
|
componentId: t.id,
|
|
311
311
|
selectedField: t.gridProps.selectedField,
|
|
312
312
|
...P(e)
|
|
313
|
-
},
|
|
313
|
+
}, o = jt({
|
|
314
314
|
event: n,
|
|
315
315
|
selectedState: (g = t.gridProps.select) != null ? g : {},
|
|
316
316
|
dataItemKey: t.gridProps.dataItemKey
|
|
317
317
|
});
|
|
318
|
-
if (
|
|
318
|
+
if (o === t.gridProps.select)
|
|
319
319
|
return;
|
|
320
|
-
const
|
|
320
|
+
const r = e.target, a = Ge(r, "TD"), d = Ge(r, "TR"), l = qt(a), u = Xt(d);
|
|
321
321
|
if (l !== void 0 && u !== void 0) {
|
|
322
322
|
const C = (f = rn(t.gridProps.data)) == null ? void 0 : f[u];
|
|
323
323
|
t.gridProps.onSelectionChange && s(t.gridProps.onSelectionChange, {
|
|
324
324
|
...n,
|
|
325
|
-
select:
|
|
325
|
+
select: o,
|
|
326
326
|
dataItem: C,
|
|
327
327
|
startRowIndex: u,
|
|
328
328
|
startColIndex: l,
|
|
@@ -340,14 +340,14 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
340
340
|
}, rt = (e) => {
|
|
341
341
|
var n;
|
|
342
342
|
if (t.gridProps.onHeaderSelectionChange && h.enabled) {
|
|
343
|
-
const
|
|
343
|
+
const o = H();
|
|
344
344
|
s(t.gridProps.onHeaderSelectionChange, {
|
|
345
|
-
select: e.syntheticEvent.target.checked ?
|
|
345
|
+
select: e.syntheticEvent.target.checked ? o.reduce((r, a) => (t.gridProps.dataItemKey && ee(t.gridProps.dataItemKey)(a) !== void 0 && (r[ee(t.gridProps.dataItemKey)(a)] = !0), r), {}) : {},
|
|
346
346
|
field: e.field,
|
|
347
347
|
nativeEvent: e.syntheticEvent && e.syntheticEvent.nativeEvent,
|
|
348
348
|
syntheticEvent: e.syntheticEvent,
|
|
349
349
|
target: R.current,
|
|
350
|
-
dataItems:
|
|
350
|
+
dataItems: o,
|
|
351
351
|
selectedField: (n = t.gridProps.selectedField) != null ? n : ""
|
|
352
352
|
});
|
|
353
353
|
}
|
|
@@ -356,47 +356,47 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
356
356
|
...e,
|
|
357
357
|
select: n
|
|
358
358
|
});
|
|
359
|
-
},
|
|
359
|
+
}, ot = (e) => {
|
|
360
360
|
var n;
|
|
361
361
|
if (t.gridProps.onSelectionChange && h.enabled) {
|
|
362
|
-
const
|
|
362
|
+
const o = j()[e.startRowIndex], r = j()[e.endRowIndex], a = {
|
|
363
363
|
syntheticEvent: void 0,
|
|
364
364
|
target: R.current,
|
|
365
365
|
selectedField: t.gridProps.selectedField || "",
|
|
366
366
|
componentId: t.id,
|
|
367
367
|
dataItems: H(),
|
|
368
368
|
dataItem: null,
|
|
369
|
-
startDataItem:
|
|
370
|
-
endDataItem:
|
|
369
|
+
startDataItem: o,
|
|
370
|
+
endDataItem: r,
|
|
371
371
|
...e
|
|
372
372
|
}, d = Le({
|
|
373
|
-
event:
|
|
373
|
+
event: a,
|
|
374
374
|
selectedState: (n = t.gridProps.select) != null ? n : {},
|
|
375
375
|
// Thats kinda strange, even through the `dataItemKey` is required by the `getSelectedState`
|
|
376
376
|
// it does work correctly even without it
|
|
377
377
|
dataItemKey: t.gridProps.dataItemKey
|
|
378
378
|
});
|
|
379
|
-
V(
|
|
379
|
+
V(a, d);
|
|
380
380
|
}
|
|
381
|
-
},
|
|
381
|
+
}, at = (e) => {
|
|
382
382
|
if (t.gridProps.onSelectionChange && h.enabled) {
|
|
383
|
-
const n = e.dataItems[0],
|
|
383
|
+
const n = e.dataItems[0], o = e.dataItems[e.dataItems.length - 1], r = {}, a = {
|
|
384
384
|
...e,
|
|
385
385
|
startDataItem: n,
|
|
386
|
-
endDataItem:
|
|
386
|
+
endDataItem: o,
|
|
387
387
|
startRowIndex: 0,
|
|
388
388
|
endRowIndex: e.dataItems.length - 1,
|
|
389
389
|
startColIndex: 0,
|
|
390
390
|
endColIndex: t.columnsRef.length - 1
|
|
391
391
|
};
|
|
392
392
|
e.dataItems.forEach((d) => {
|
|
393
|
-
const u =
|
|
394
|
-
|
|
395
|
-
}), V(
|
|
393
|
+
const u = ee(t.gridProps.dataItemKey)(d);
|
|
394
|
+
r[u] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0;
|
|
395
|
+
}), V(a, r);
|
|
396
396
|
}
|
|
397
397
|
}, it = (e) => {
|
|
398
398
|
if (t.gridProps.onSelectionChange && h.enabled) {
|
|
399
|
-
const
|
|
399
|
+
const o = ee(t.gridProps.dataItemKey)(e.dataItem), r = 0, a = t.columnsRef.length - 1, d = e.dataItems.findIndex(
|
|
400
400
|
(C) => C[t.gridProps.dataItemKey] === e.dataItem[t.gridProps.dataItemKey]
|
|
401
401
|
), g = {
|
|
402
402
|
...e,
|
|
@@ -404,48 +404,48 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
404
404
|
endDataItem: d,
|
|
405
405
|
startRowIndex: d,
|
|
406
406
|
endRowIndex: d,
|
|
407
|
-
startColIndex:
|
|
408
|
-
endColIndex:
|
|
407
|
+
startColIndex: r,
|
|
408
|
+
endColIndex: a
|
|
409
409
|
}, f = e.mode === "multiple" ? t.gridProps.select || {} : {};
|
|
410
|
-
f[
|
|
410
|
+
f[o] === !0 || Array.isArray(f[o]) && f[o].length === t.columnsRef.length ? delete f[o] : f[o] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0, V(g, f);
|
|
411
411
|
}
|
|
412
412
|
}, dt = (e) => {
|
|
413
413
|
t.gridProps.onSelectionChange && h.enabled && V(e, {});
|
|
414
|
-
}, M = (e, n, r, a
|
|
414
|
+
}, M = (e, n, o, r, a) => {
|
|
415
415
|
const d = t.gridProps.onDataStateChange;
|
|
416
416
|
if (e) {
|
|
417
|
-
const l = { ...P(
|
|
417
|
+
const l = { ...P(r), ...n, targetEvent: a };
|
|
418
418
|
s(e, l);
|
|
419
419
|
} else d && s(d, {
|
|
420
|
-
...P(
|
|
421
|
-
targetEvent:
|
|
420
|
+
...P(r),
|
|
421
|
+
targetEvent: a || {},
|
|
422
422
|
dataState: {
|
|
423
|
-
...
|
|
424
|
-
...
|
|
423
|
+
...bt(),
|
|
424
|
+
...o
|
|
425
425
|
}
|
|
426
426
|
});
|
|
427
|
-
}, _ = (e, n,
|
|
427
|
+
}, _ = (e, n, o) => {
|
|
428
428
|
M(
|
|
429
429
|
t.gridProps.onPageChange,
|
|
430
430
|
{ page: e },
|
|
431
431
|
{ skip: e.skip, take: e.take },
|
|
432
432
|
n,
|
|
433
|
-
|
|
433
|
+
o
|
|
434
434
|
);
|
|
435
435
|
}, ct = () => {
|
|
436
436
|
let e = t.gridProps.total || 0;
|
|
437
437
|
return Array.isArray(t.gridProps.data) ? e = e || t.gridProps.data.length : t.gridProps.data && (e = e || t.gridProps.data.total), e;
|
|
438
438
|
}, lt = (e) => {
|
|
439
|
-
var
|
|
440
|
-
const n = (d = (
|
|
441
|
-
|
|
439
|
+
var a, d;
|
|
440
|
+
const n = (d = (a = t.gridProps.take) != null ? a : t.gridProps.pageSize) != null ? d : 0, o = (t.gridProps.skip || 0) + n, r = ct();
|
|
441
|
+
o < r && _({ skip: o, take: n }, e);
|
|
442
442
|
}, st = (e) => {
|
|
443
|
-
var
|
|
444
|
-
const n = (
|
|
445
|
-
|
|
443
|
+
var r, a;
|
|
444
|
+
const n = (a = (r = t.gridProps.take) != null ? r : t.gridProps.pageSize) != null ? a : 0, o = (t.gridProps.skip || 0) - n;
|
|
445
|
+
o >= 0 && _({ skip: o, take: n }, e);
|
|
446
446
|
}, ut = (e) => {
|
|
447
447
|
_({ skip: e.skip, take: e.take }, e.syntheticEvent, e.targetEvent);
|
|
448
|
-
},
|
|
448
|
+
}, we = (e, n) => {
|
|
449
449
|
M(
|
|
450
450
|
t.gridProps.onSortChange,
|
|
451
451
|
{ sort: e },
|
|
@@ -460,35 +460,35 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
460
460
|
n
|
|
461
461
|
);
|
|
462
462
|
}, ft = (e) => {
|
|
463
|
-
const n = t.gridProps.searchFields || t.columnsRef.map((
|
|
463
|
+
const n = t.gridProps.searchFields || t.columnsRef.map((a) => a.field) || [], o = e.nativeEvent.target.value, r = {
|
|
464
464
|
logic: "or",
|
|
465
|
-
filters: n.filter((
|
|
465
|
+
filters: n.filter((a) => a !== void 0).map((a) => {
|
|
466
466
|
var d;
|
|
467
|
-
return typeof
|
|
468
|
-
value:
|
|
469
|
-
operator: (d =
|
|
470
|
-
field:
|
|
471
|
-
ignoreCase:
|
|
467
|
+
return typeof a == "string" ? { field: a, value: o, operator: "contains" } : {
|
|
468
|
+
value: o,
|
|
469
|
+
operator: (d = a.operator) != null ? d : "contains",
|
|
470
|
+
field: a.field,
|
|
471
|
+
ignoreCase: a.ignoreCase
|
|
472
472
|
};
|
|
473
473
|
})
|
|
474
474
|
};
|
|
475
475
|
M(
|
|
476
476
|
t.gridProps.onSearchChange,
|
|
477
477
|
{
|
|
478
|
-
search:
|
|
478
|
+
search: r
|
|
479
479
|
},
|
|
480
480
|
{},
|
|
481
481
|
e.syntheticEvent
|
|
482
482
|
);
|
|
483
|
-
},
|
|
484
|
-
const
|
|
485
|
-
e.length === 0 && t.gridProps.navigatable && (
|
|
483
|
+
}, ne = (e, n) => {
|
|
484
|
+
const o = n.nativeEvent ? n : { nativeEvent: n.nativeEvent || n.originalEvent };
|
|
485
|
+
e.length === 0 && t.gridProps.navigatable && (se.current = !0), M(
|
|
486
486
|
t.gridProps.onGroupChange,
|
|
487
487
|
{ group: e },
|
|
488
488
|
{ group: e, skip: 0 },
|
|
489
|
-
|
|
489
|
+
o
|
|
490
490
|
);
|
|
491
|
-
},
|
|
491
|
+
}, re = (e) => {
|
|
492
492
|
if (t.gridProps.onColumnsStateChange) {
|
|
493
493
|
const n = {
|
|
494
494
|
target: R.current,
|
|
@@ -496,93 +496,93 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
496
496
|
};
|
|
497
497
|
s(t.gridProps.onColumnsStateChange, n);
|
|
498
498
|
}
|
|
499
|
-
},
|
|
500
|
-
const { columnsRef:
|
|
499
|
+
}, oe = (e, n, o) => {
|
|
500
|
+
const { columnsRef: r, columnsState: a } = t, d = r[e], l = on(a), u = d.depth, g = (I) => {
|
|
501
501
|
do
|
|
502
|
-
|
|
503
|
-
while (
|
|
504
|
-
return
|
|
505
|
-
}, f =
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
const O = l.find((B) => B.id ===
|
|
502
|
+
I++;
|
|
503
|
+
while (I < r.length && r[I].depth > u);
|
|
504
|
+
return I;
|
|
505
|
+
}, f = r.splice(e, g(e) - e);
|
|
506
|
+
r.splice(e < n ? g(n - f.length) : n, 0, ...f), r.filter((I) => I.declarationIndex >= 0).forEach((I, N) => {
|
|
507
|
+
I.orderIndex = N;
|
|
508
|
+
const O = l.find((B) => B.id === I.id);
|
|
509
509
|
O && (O.orderIndex = N);
|
|
510
510
|
});
|
|
511
|
-
const C =
|
|
512
|
-
$t(t.columnsMapRef,
|
|
513
|
-
const
|
|
514
|
-
if (
|
|
515
|
-
const
|
|
511
|
+
const C = r[e].locked && r[n].locked;
|
|
512
|
+
$t(t.columnsMapRef, r, C || Y.current), Jt(t.columnsMapRef, r, C || Y.current), le.current && (Y.current = !1, le.current = !1);
|
|
513
|
+
const Z = U();
|
|
514
|
+
if (de(), t.gridProps.onColumnReorder) {
|
|
515
|
+
const I = {
|
|
516
516
|
target: R.current,
|
|
517
|
-
columns:
|
|
517
|
+
columns: Z,
|
|
518
518
|
columnId: d.id,
|
|
519
|
-
nativeEvent:
|
|
519
|
+
nativeEvent: o
|
|
520
520
|
};
|
|
521
|
-
s(t.gridProps.onColumnReorder,
|
|
521
|
+
s(t.gridProps.onColumnReorder, I);
|
|
522
522
|
}
|
|
523
|
-
|
|
524
|
-
}, A = (e, n,
|
|
525
|
-
const
|
|
526
|
-
if (
|
|
523
|
+
re(a);
|
|
524
|
+
}, A = (e, n, o) => {
|
|
525
|
+
const r = typeof t.gridProps.rowReorderable == "object" ? t.gridProps.rowReorderable.enabled : t.gridProps.rowReorderable;
|
|
526
|
+
if (o === "forbidden" || !r || !z.current)
|
|
527
527
|
return;
|
|
528
|
-
const { slicedData:
|
|
528
|
+
const { slicedData: a, dataRef: d } = t, l = (a || d)[n];
|
|
529
529
|
t.gridProps.onRowReorder && s(t.gridProps.onRowReorder, {
|
|
530
530
|
draggedDataItems: [z.current],
|
|
531
531
|
droppedDataItem: l == null ? void 0 : l.dataItem,
|
|
532
|
-
dropPosition:
|
|
532
|
+
dropPosition: o,
|
|
533
533
|
nativeEvent: e.originalEvent,
|
|
534
534
|
dragEvent: e,
|
|
535
535
|
target: R.current
|
|
536
536
|
}), z.current = null;
|
|
537
|
-
}, mt = (e, n,
|
|
537
|
+
}, mt = (e, n, o) => {
|
|
538
538
|
if (t.gridProps.group === void 0)
|
|
539
539
|
return;
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
},
|
|
543
|
-
const
|
|
544
|
-
if (!
|
|
540
|
+
const r = t.gridProps.group.slice();
|
|
541
|
+
r.splice(n, 0, ...r.splice(e, 1)), ne(r, o);
|
|
542
|
+
}, ye = (e, n, o) => {
|
|
543
|
+
const r = t.columnsRef[e].field;
|
|
544
|
+
if (!r)
|
|
545
545
|
return;
|
|
546
|
-
const
|
|
547
|
-
|
|
546
|
+
const a = (t.gridProps.group || []).slice();
|
|
547
|
+
a.splice(n, 0, { field: r }), ne(a, o);
|
|
548
548
|
}, Pt = (e, n) => {
|
|
549
|
-
const
|
|
550
|
-
|
|
549
|
+
const o = S.current.getCurrentGroupsLength;
|
|
550
|
+
ye(e, o, n);
|
|
551
551
|
}, ae = () => {
|
|
552
552
|
let e = 0;
|
|
553
553
|
if (!E.current.colGroupMain)
|
|
554
554
|
return;
|
|
555
555
|
const n = E.current.colGroupMain.children;
|
|
556
|
-
for (let
|
|
557
|
-
const
|
|
558
|
-
if (!
|
|
556
|
+
for (let o = 0; o < n.length; o++) {
|
|
557
|
+
const r = n[o].width;
|
|
558
|
+
if (!r) {
|
|
559
559
|
e = 0;
|
|
560
560
|
break;
|
|
561
561
|
}
|
|
562
|
-
e += parseFloat(
|
|
562
|
+
e += parseFloat(r.toString());
|
|
563
563
|
}
|
|
564
564
|
e = Math.round(e), G.current && G.current.setWidth(e), L.current && L.current.setWidth(e), x.current && (x.current.style.width = e ? e + "px" : "");
|
|
565
565
|
}, W = i.useCallback(
|
|
566
|
-
(e, n, r, a
|
|
566
|
+
(e, n, o, r, a) => {
|
|
567
567
|
var g;
|
|
568
|
-
if (!ht() && !
|
|
568
|
+
if (!ht() && !o || !e)
|
|
569
569
|
return;
|
|
570
570
|
const d = {
|
|
571
571
|
type: e,
|
|
572
572
|
nativeEvent: n,
|
|
573
573
|
columns: t.columnsRef,
|
|
574
574
|
dataItemKey: t.gridProps.dataItemKey || "",
|
|
575
|
-
dataItem:
|
|
576
|
-
field:
|
|
575
|
+
dataItem: r,
|
|
576
|
+
field: a,
|
|
577
577
|
...typeof t.gridProps.clipboard != "boolean" ? t.gridProps.clipboard : {},
|
|
578
|
-
...
|
|
578
|
+
...o
|
|
579
579
|
}, l = j(), u = Lt({
|
|
580
580
|
event: d,
|
|
581
581
|
data: l,
|
|
582
582
|
selectedState: (g = t.gridProps.select) != null ? g : {},
|
|
583
|
-
previousCopiedItems:
|
|
583
|
+
previousCopiedItems: ke.current
|
|
584
584
|
});
|
|
585
|
-
e !==
|
|
585
|
+
e !== Ie.paste && (ke.current = u.copiedItems), t.gridProps.onClipboard && w && s(t.gridProps.onClipboard, {
|
|
586
586
|
...d,
|
|
587
587
|
...u
|
|
588
588
|
});
|
|
@@ -595,23 +595,23 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
595
595
|
t.gridProps.onClipboard
|
|
596
596
|
]
|
|
597
597
|
), ht = () => {
|
|
598
|
-
var
|
|
599
|
-
if (!
|
|
598
|
+
var a, d, l;
|
|
599
|
+
if (!p)
|
|
600
600
|
return !1;
|
|
601
|
-
const e = At(v()), n = e ? e.matches(".k-table-td") ? e : (
|
|
602
|
-
return !!(n &&
|
|
603
|
-
},
|
|
604
|
-
ae(), Y.current = !0,
|
|
601
|
+
const e = At(v()), n = e ? e.matches(".k-table-td") ? e : (a = v()) == null ? void 0 : a.body : (d = v()) == null ? void 0 : d.body, o = n.closest(".k-grid-container"), r = n && ((l = K.current) == null ? void 0 : l.contains(n));
|
|
602
|
+
return !!(n && r && o);
|
|
603
|
+
}, It = (e, n, o, r, a, d, l) => {
|
|
604
|
+
ae(), Y.current = !0, le.current = !0, t.gridProps.onColumnResize && w && s(t.gridProps.onColumnResize, {
|
|
605
605
|
columns: U(),
|
|
606
|
-
nativeEvent:
|
|
606
|
+
nativeEvent: r,
|
|
607
607
|
targetColumnId: l,
|
|
608
608
|
index: e,
|
|
609
609
|
newWidth: n,
|
|
610
|
-
oldWidth:
|
|
611
|
-
end:
|
|
610
|
+
oldWidth: o,
|
|
611
|
+
end: a,
|
|
612
612
|
target: R.current
|
|
613
|
-
}),
|
|
614
|
-
},
|
|
613
|
+
}), a && re(d);
|
|
614
|
+
}, bt = () => {
|
|
615
615
|
var e;
|
|
616
616
|
return {
|
|
617
617
|
filter: t.gridProps.filter,
|
|
@@ -638,71 +638,71 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
638
638
|
}
|
|
639
639
|
e(Rt(n));
|
|
640
640
|
}, Ct = () => {
|
|
641
|
-
var e, n,
|
|
641
|
+
var e, n, o;
|
|
642
642
|
if (F.current && ((e = F.current) == null ? void 0 : e.getElementsByClassName("k-grid-edit-row").length) > 0) {
|
|
643
|
-
|
|
644
|
-
const
|
|
645
|
-
|
|
646
|
-
(
|
|
647
|
-
)[0] :
|
|
643
|
+
ge.current = !1, (n = document.activeElement) != null && n.closest(".k-grid-edit-row") ? ue.current = document.activeElement : ue.current = void 0;
|
|
644
|
+
const r = Array.from((o = F.current) == null ? void 0 : o.getElementsByClassName("k-grid-edit-row"));
|
|
645
|
+
r.length > he.current.length ? J.current = r.filter(
|
|
646
|
+
(a) => !he.current.includes(a)
|
|
647
|
+
)[0] : r.length === 1 && (J.current = r[0], ge.current = !0), he.current = r;
|
|
648
648
|
}
|
|
649
649
|
}, H = () => t.dataRef.filter((e) => e.rowType === "data").map((e) => e.dataItem), j = () => (t.slicedData || t.dataRef).filter((e) => e.rowType === "data").map((e) => e.dataItem), v = () => {
|
|
650
650
|
var e;
|
|
651
|
-
if (
|
|
651
|
+
if (p)
|
|
652
652
|
return ((e = q()) == null ? void 0 : e.ownerDocument) || document;
|
|
653
|
-
}, q = () => K.current,
|
|
653
|
+
}, q = () => K.current, ie = i.useCallback(
|
|
654
654
|
(e) => {
|
|
655
|
-
var
|
|
656
|
-
if (!c.current || !((
|
|
655
|
+
var r;
|
|
656
|
+
if (!c.current || !((r = c.current) != null && r.container) || t.gridProps.scrollable === "none")
|
|
657
657
|
return;
|
|
658
658
|
D.current && D.current.disconnect();
|
|
659
|
-
const { rowIndex: n } = e,
|
|
659
|
+
const { rowIndex: n } = e, o = q();
|
|
660
660
|
if (t.gridProps.scrollable === "virtual")
|
|
661
661
|
c.current.askedSkip = n, c.current.container.scroll(
|
|
662
662
|
0,
|
|
663
663
|
Math.round(c.current.askedSkip / c.current.total * c.current.container.scrollHeight)
|
|
664
664
|
);
|
|
665
|
-
else if (
|
|
666
|
-
const
|
|
667
|
-
|
|
665
|
+
else if (o) {
|
|
666
|
+
const a = n < 1 ? o.querySelector("tbody > tr:nth-child(1)") : o.querySelector(`tbody > tr:nth-child(${n + 1})`);
|
|
667
|
+
a && $.current && ($.current.scrollTop = a.offsetTop);
|
|
668
668
|
}
|
|
669
669
|
},
|
|
670
670
|
[t.gridProps.scrollable]
|
|
671
|
-
),
|
|
672
|
-
vt() ||
|
|
673
|
-
}, wt = (e
|
|
674
|
-
var
|
|
671
|
+
), xe = (e) => JSON.stringify(e.map((n) => ({ id: n.id, field: n.field, title: n.title, children: n.children }))), vt = () => xe(Dt) === xe(t.columnsRef), Et = () => {
|
|
672
|
+
vt() || de();
|
|
673
|
+
}, wt = (e) => {
|
|
674
|
+
var n, o;
|
|
675
675
|
if (c.current) {
|
|
676
|
-
if (c.current.fixedScroll = t.gridProps.fixedScroll || !1, c.current.PageChange = _, c.current.realSkip = t.gridProps.skip || 0, c.current.pageSize = (
|
|
677
|
-
const
|
|
678
|
-
c.current.containerHeight = ze ? Math.min(Ne,
|
|
676
|
+
if (c.current.fixedScroll = t.gridProps.fixedScroll || !1, c.current.PageChange = _, c.current.realSkip = t.gridProps.skip || 0, c.current.pageSize = (o = (n = t.gridProps.take) != null ? n : t.gridProps.pageSize) != null ? o : 0, c.current.scrollableVirtual = t.gridProps.scrollable === "virtual", c.current.total = e, c.current.propsSkip = (t.gridProps.skip || 0) + (t.gridProps.scrollable === "virtual" ? c.current.topCacheCount + (c.current.attendedSkip - (t.gridProps.skip || 0)) : 0), t.gridProps.rowHeight !== void 0 && t.gridProps.rowHeight > 0 && !Q) {
|
|
677
|
+
const r = t.gridProps.rowHeight * e;
|
|
678
|
+
c.current.containerHeight = ze ? Math.min(Ne, r) : r;
|
|
679
679
|
} else
|
|
680
680
|
c.current.containerHeight = 1533915;
|
|
681
681
|
if (c.current.containerRef = $, c.current.tableBodyRef = F, c.current.table = x.current, c.current instanceof Oe) {
|
|
682
|
-
const { rowHeight:
|
|
683
|
-
let { detailRowHeight:
|
|
684
|
-
|
|
682
|
+
const { rowHeight: r = 0, detail: a, expandField: d } = t.gridProps;
|
|
683
|
+
let { detailRowHeight: l = 0 } = t.gridProps;
|
|
684
|
+
l = a && d ? l : r, t.isAllData ? (c.current.total = t.dataRef.length, c.current.rowHeightService = new He(
|
|
685
685
|
t.dataRef.length,
|
|
686
|
-
|
|
687
|
-
|
|
686
|
+
r,
|
|
687
|
+
l,
|
|
688
688
|
t.dataRef
|
|
689
|
-
)) : c.current.rowHeightService = new He(e,
|
|
690
|
-
const
|
|
691
|
-
c.current.containerHeight = ze ? Math.min(Ne,
|
|
689
|
+
)) : c.current.rowHeightService = new He(e, r, l);
|
|
690
|
+
const u = c.current.rowHeightService.totalHeight();
|
|
691
|
+
c.current.containerHeight = ze ? Math.min(Ne, u) : u;
|
|
692
692
|
}
|
|
693
693
|
}
|
|
694
|
-
},
|
|
694
|
+
}, Se = i.useCallback(
|
|
695
695
|
(e) => {
|
|
696
|
-
const n = { rowIndex:
|
|
697
|
-
e.forEach((
|
|
698
|
-
|
|
696
|
+
const n = { rowIndex: Pe.current };
|
|
697
|
+
e.forEach((o) => {
|
|
698
|
+
o.isIntersecting || ie(n);
|
|
699
699
|
});
|
|
700
700
|
},
|
|
701
|
-
[
|
|
702
|
-
),
|
|
701
|
+
[ie]
|
|
702
|
+
), de = () => {
|
|
703
703
|
t.gridProps.forceUpdate && t.gridProps.forceUpdate();
|
|
704
|
-
}, yt = (e) => e.left !== void 0 ?
|
|
705
|
-
i.useMemo(() => {
|
|
704
|
+
}, yt = (e) => e.left !== void 0 ? De !== "rtl" ? { left: e.left, right: e.right } : { left: e.right, right: e.left } : {}, R = i.useRef(null), c = i.useRef(void 0), E = i.useRef(void 0), S = i.useRef(void 0), y = i.useRef(void 0), k = i.useRef(void 0), X = i.useRef(void 0), D = i.useRef(null), F = i.useRef(null), xt = i.useRef(null), $ = i.useRef(null), x = i.useRef(null), ce = i.useRef(null), K = i.useRef(null), L = i.useRef(null), G = i.useRef(null), le = i.useRef(!1), se = i.useRef(!1), J = i.useRef(void 0), ue = i.useRef(void 0), ge = i.useRef(!1), Y = i.useRef(!0), fe = i.useRef(0), me = i.useRef(void 0), Pe = i.useRef(void 0), he = i.useRef([]), ke = i.useRef([]), z = i.useRef(null), St = i.useRef(null), kt = i.useRef(null), De = Ht(K), Dt = i.useMemo(() => i.Children.toArray(t.gridProps.children), [t.gridProps.children]), Q = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, h = te((Te = t.gridProps.selectable) != null ? Te : !!t.gridProps.selectedField), Ke = Gt((Me = t.gridProps.editable) != null ? Me : !!t.gridProps.editField);
|
|
705
|
+
return i.useMemo(() => {
|
|
706
706
|
T.onConstructor({
|
|
707
707
|
navigatable: !!t.gridProps.navigatable,
|
|
708
708
|
contextStateRef: y,
|
|
@@ -710,50 +710,50 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
710
710
|
idPrefix: t.id
|
|
711
711
|
});
|
|
712
712
|
}, []), i.useMemo(() => {
|
|
713
|
-
var
|
|
714
|
-
(
|
|
715
|
-
const e = t.
|
|
716
|
-
c.current = new
|
|
713
|
+
var n;
|
|
714
|
+
(n = c.current) == null || n.reset();
|
|
715
|
+
const e = t.isFixedVirtualScroll ? Oe : an;
|
|
716
|
+
c.current = new e(Q || t.gridProps.rowHeight === void 0 || t.gridProps.rowHeight === 0);
|
|
717
717
|
}, [
|
|
718
718
|
t.gridProps.scrollable,
|
|
719
719
|
t.gridProps.total,
|
|
720
720
|
t.gridProps.filter,
|
|
721
721
|
t.gridProps.group,
|
|
722
|
-
|
|
722
|
+
Q,
|
|
723
723
|
t.gridProps.sort,
|
|
724
724
|
t.gridProps.rowHeight
|
|
725
725
|
]), i.useEffect(() => (t.gridProps.clipboard && (X.current = new zt(W), X.current.addEventListeners(v())), () => {
|
|
726
726
|
X.current && X.current.removeEventListeners(v());
|
|
727
|
-
}), [t.gridProps.onClipboard, t.gridProps.clipboard, W, v]), i.useEffect(() => (t.gridProps.columnVirtualization && !window.navigator.userAgent.match(Zt) && (
|
|
727
|
+
}), [t.gridProps.onClipboard, t.gridProps.clipboard, W, v]), i.useEffect(() => (t.gridProps.columnVirtualization && !window.navigator.userAgent.match(Zt) && (ce.current && (ce.current.style.display = "block"), x.current && (x.current.style.display = "block")), ae(), Ae(), T.onComponentDidMount({
|
|
728
728
|
scope: K.current || void 0,
|
|
729
729
|
contextStateRef: y,
|
|
730
730
|
navigationStateRef: k
|
|
731
731
|
}), () => {
|
|
732
|
-
clearTimeout(
|
|
732
|
+
clearTimeout(me.current);
|
|
733
733
|
}), []), i.useEffect(() => {
|
|
734
734
|
var e;
|
|
735
735
|
ae(), Ae(), (e = c.current) != null && e.tableTransform && c.current.table && (c.current.table.style.transform = c.current.tableTransform, c.current.tableTransform = ""), Ct(), T.onComponentDidUpdate({
|
|
736
736
|
scope: K.current || void 0,
|
|
737
737
|
contextStateRef: y,
|
|
738
738
|
navigationStateRef: k,
|
|
739
|
-
focusFirst:
|
|
739
|
+
focusFirst: se.current,
|
|
740
740
|
newEditableRow: J.current,
|
|
741
|
-
singleEditRow:
|
|
742
|
-
lastActiveElement:
|
|
741
|
+
singleEditRow: ge.current,
|
|
742
|
+
lastActiveElement: ue.current,
|
|
743
743
|
navigatable: t.gridProps.navigatable
|
|
744
|
-
}),
|
|
744
|
+
}), se.current = !1, J.current = void 0;
|
|
745
745
|
}), i.useEffect(() => {
|
|
746
|
-
if (
|
|
746
|
+
if (p) {
|
|
747
747
|
const e = {
|
|
748
748
|
rootMargin: "0px",
|
|
749
749
|
threshold: 0.9
|
|
750
750
|
};
|
|
751
|
-
D.current = window.IntersectionObserver && new window.IntersectionObserver(
|
|
751
|
+
D.current = window.IntersectionObserver && new window.IntersectionObserver(Se, e) || null;
|
|
752
752
|
}
|
|
753
|
-
}, [
|
|
753
|
+
}, [Se]), i.useEffect(() => {
|
|
754
754
|
var n;
|
|
755
755
|
let e;
|
|
756
|
-
return
|
|
756
|
+
return p && window.ResizeObserver && (e = new window.ResizeObserver(Et), e.observe((n = v()) == null ? void 0 : n.body)), () => {
|
|
757
757
|
e == null || e.disconnect();
|
|
758
758
|
};
|
|
759
759
|
}, []), i.useImperativeHandle(
|
|
@@ -767,16 +767,16 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
767
767
|
return U();
|
|
768
768
|
},
|
|
769
769
|
scrollIntoView: (e) => {
|
|
770
|
-
var
|
|
771
|
-
if (!((
|
|
770
|
+
var r;
|
|
771
|
+
if (!((r = c.current) != null && r.container) || t.gridProps.scrollable === "none")
|
|
772
772
|
return;
|
|
773
773
|
const { rowIndex: n } = e;
|
|
774
|
-
|
|
775
|
-
const
|
|
776
|
-
if (D.current &&
|
|
774
|
+
Pe.current = n;
|
|
775
|
+
const o = q();
|
|
776
|
+
if (D.current && o) {
|
|
777
777
|
D.current.disconnect();
|
|
778
|
-
const
|
|
779
|
-
|
|
778
|
+
const a = o.querySelector(`[absolute-row-index="${Pe.current}"]`);
|
|
779
|
+
a ? D.current.observe(a) : ie(e);
|
|
780
780
|
}
|
|
781
781
|
},
|
|
782
782
|
fitColumns: (e) => {
|
|
@@ -784,18 +784,16 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
784
784
|
}
|
|
785
785
|
})
|
|
786
786
|
), i.useImperativeHandle(t.gridRef, () => R.current), i.useMemo(() => {
|
|
787
|
-
E.current = new Yt(
|
|
787
|
+
E.current = new Yt(It);
|
|
788
788
|
}, [t.gridProps.onColumnResize, t.columnsRef]), i.useMemo(() => {
|
|
789
|
-
S.current = new Qt(
|
|
789
|
+
S.current = new Qt(oe, mt, ye);
|
|
790
790
|
}, [
|
|
791
791
|
t.gridProps.onColumnReorder,
|
|
792
792
|
t.gridProps.onGroupChange,
|
|
793
793
|
t.gridProps.group,
|
|
794
794
|
t.columnsRef,
|
|
795
795
|
t.gridProps.groupable
|
|
796
|
-
]), E.current.resizable = t.gridProps.resizable || !1, E.current.columns = t.columnsRef, E.current.columnsState = Ft(t.columnsState)
|
|
797
|
-
const Ke = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1;
|
|
798
|
-
return S.current.reorderable = t.gridProps.reorderable || !1, S.current.groupable = Ke, S.current.columns = t.columnsRef, wt(t.total, Ke), /* @__PURE__ */ i.createElement(
|
|
796
|
+
]), E.current.resizable = t.gridProps.resizable || !1, E.current.columns = t.columnsRef, E.current.columnsState = Ft(t.columnsState), S.current.reorderable = t.gridProps.reorderable || !1, S.current.groupable = Q, S.current.columns = t.columnsRef, wt(t.total), /* @__PURE__ */ i.createElement(
|
|
799
797
|
sn.Provider,
|
|
800
798
|
{
|
|
801
799
|
value: {
|
|
@@ -804,21 +802,21 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
804
802
|
activeDragRowDataItemRef: z,
|
|
805
803
|
reorderRowDragTargetRef: St,
|
|
806
804
|
reorderRowDropTargetRef: kt,
|
|
807
|
-
dir:
|
|
805
|
+
dir: De,
|
|
808
806
|
getCellPositionStyle: yt,
|
|
809
807
|
dataItemKey: t.gridProps.dataItemKey,
|
|
810
808
|
columnsState: t.columnsState,
|
|
811
|
-
onColumnsStateChange:
|
|
812
|
-
groupChange:
|
|
813
|
-
selectionRelease:
|
|
809
|
+
onColumnsStateChange: re,
|
|
810
|
+
groupChange: ne,
|
|
811
|
+
selectionRelease: ot,
|
|
814
812
|
pagerPageChange: ut,
|
|
815
813
|
onContextMenu: We,
|
|
816
814
|
rowClick: Je,
|
|
817
815
|
rowDblClick: Ye,
|
|
818
816
|
cellClick: Qe,
|
|
819
|
-
headerCellClick:
|
|
817
|
+
headerCellClick: Ee,
|
|
820
818
|
itemChange: et,
|
|
821
|
-
sortChange:
|
|
819
|
+
sortChange: we,
|
|
822
820
|
filterChange: gt,
|
|
823
821
|
searchChange: ft,
|
|
824
822
|
onHeaderSelectionChange: rt,
|
|
@@ -836,7 +834,7 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
836
834
|
tableBodyElementRef: F,
|
|
837
835
|
headerElementRef: xt,
|
|
838
836
|
containerElementRef: $,
|
|
839
|
-
headTableElementRef:
|
|
837
|
+
headTableElementRef: ce,
|
|
840
838
|
elementRef: K,
|
|
841
839
|
footerRef: L,
|
|
842
840
|
headerRef: G,
|
|
@@ -847,12 +845,12 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
847
845
|
/* @__PURE__ */ i.createElement(
|
|
848
846
|
dn,
|
|
849
847
|
{
|
|
850
|
-
show:
|
|
851
|
-
dataItem:
|
|
852
|
-
field:
|
|
848
|
+
show: b.show,
|
|
849
|
+
dataItem: b.dataItem,
|
|
850
|
+
field: b.field,
|
|
853
851
|
items: Ve,
|
|
854
|
-
offset:
|
|
855
|
-
onClose:
|
|
852
|
+
offset: b.offset,
|
|
853
|
+
onClose: Re,
|
|
856
854
|
onSelect: _e
|
|
857
855
|
}
|
|
858
856
|
)
|