@progress/kendo-react-grid 11.4.0-develop.1 → 11.4.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 +285 -282
- package/GridComponent.js +1 -1
- package/GridComponent.mjs +105 -105
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/index.d.mts +57 -23
- package/index.d.ts +57 -23
- package/index.js +1 -1
- package/index.mjs +7 -7
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +17 -17
- package/toolbar-tools/GridToolbarAIAssistant.js +9 -0
- package/toolbar-tools/GridToolbarAIAssistant.mjs +188 -0
- package/toolbar-tools/GridToolbarAI.js +0 -9
- package/toolbar-tools/GridToolbarAI.mjs +0 -187
package/GridClientWrapper.mjs
CHANGED
|
@@ -7,30 +7,30 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as a from "react";
|
|
10
|
-
import { useAdaptiveModeContext as
|
|
11
|
-
import { filterBy as
|
|
12
|
-
import { getSelectionOptions as
|
|
13
|
-
import { ColumnResize as
|
|
14
|
-
import { CommonDragLogic as
|
|
15
|
-
import { SAFARI_REGEX as
|
|
16
|
-
import { getDefaultHeadContextMenuItems as
|
|
17
|
-
import { VirtualScroll as
|
|
18
|
-
import { GridContextMenu as
|
|
19
|
-
import { GridContextMenuAnchorPart as
|
|
20
|
-
import { normalizeSortable as
|
|
21
|
-
import { BasePDFExport as
|
|
22
|
-
import { GridContext as
|
|
23
|
-
import { operators as
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
return t.reduce((
|
|
27
|
-
},
|
|
28
|
-
...
|
|
29
|
-
...
|
|
30
|
-
}), {}),
|
|
31
|
-
const v = t.gridProps.isClient, [
|
|
32
|
-
e.event.preventDefault(),
|
|
33
|
-
...
|
|
10
|
+
import { useAdaptiveModeContext as Ut, canUseDOM as ae, getActiveElement as Vt, useDir as Wt, setScrollbarWidth as Ne, cloneArray as jt, getter as de, RowHeightService as _t } from "@progress/kendo-react-common";
|
|
11
|
+
import { filterBy as qt } from "@progress/kendo-data-query";
|
|
12
|
+
import { getSelectionOptions as ce, populateClipboardData as $t, ClipboardActionType as Se, getEditableOptions as Xt, tableKeyboardNavigation as O, ClipboardService as Jt, TableKeyboardNavigationContext as Yt, editReducer as Qt, EDIT_ACTION as Zt, getDetailExpandableOptions as pt, detailExpandReducer as en, getGroupExpandableOptions as tn, groupExpandReducer as nn, getSelectedState as Be, getSelectedStateFromKeyDown as rn, closestTagName as Ue, getColumnIndex as on, getRowIndex as an, updateLeft as dn, updateRight as cn } from "@progress/kendo-react-data-tools";
|
|
13
|
+
import { ColumnResize as ln } from "./drag/ColumnResize.mjs";
|
|
14
|
+
import { CommonDragLogic as sn } from "./drag/CommonDragLogic.mjs";
|
|
15
|
+
import { SAFARI_REGEX as gn } from "./constants/index.mjs";
|
|
16
|
+
import { getDefaultHeadContextMenuItems as un, getDefaultBodyContextMenuItems as fn, isRowReorderEnabled as mn, sanitizeColumns as Pn, getDataAsArray as hn, getFlatColumnsState as Rn, calcRowHeight as bn } from "./utils/index.mjs";
|
|
17
|
+
import { VirtualScroll as vn } from "./VirtualScroll.mjs";
|
|
18
|
+
import { GridContextMenu as Cn } from "./contextMenu/GridContextMenu.mjs";
|
|
19
|
+
import { GridContextMenuAnchorPart as Ve } from "./contextMenu/enums.mjs";
|
|
20
|
+
import { normalizeSortable as In, firstLevelSortSeqMap as En } from "./sortCommon.mjs";
|
|
21
|
+
import { BasePDFExport as wn } from "./BasePDFExport.mjs";
|
|
22
|
+
import { GridContext as yn } from "./utils/GridContext.mjs";
|
|
23
|
+
import { operators as Sn } from "./filterCommon.mjs";
|
|
24
|
+
const xn = (t, v, u, y) => {
|
|
25
|
+
const N = Object.keys(v.cells).map((E) => u.findIndex((H) => H.field === E)), A = Object.keys(v.cells).length > 0 ? N : !0;
|
|
26
|
+
return t.reduce((E, H) => (E[H[y != null ? y : "id"]] = A, E), {});
|
|
27
|
+
}, Dn = (t, v, u, y) => v.reduce((A, E) => ({
|
|
28
|
+
...A,
|
|
29
|
+
...xn(qt(t, E), E, u, y)
|
|
30
|
+
}), {}), Wn = (t) => {
|
|
31
|
+
const v = t.gridProps.isClient, [u, y] = a.useState({}), N = Ut(), A = a.useRef(null), E = (e) => {
|
|
32
|
+
e.event.preventDefault(), y({
|
|
33
|
+
...u,
|
|
34
34
|
show: !0,
|
|
35
35
|
offset: {
|
|
36
36
|
left: e.event.pageX,
|
|
@@ -39,33 +39,33 @@ const Sn = (t, v, s) => {
|
|
|
39
39
|
dataItem: e.dataItem,
|
|
40
40
|
field: e.field
|
|
41
41
|
});
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
}, h = a.useMemo(() => t.columnsRef.find((e) => e.field ===
|
|
42
|
+
}, H = () => {
|
|
43
|
+
y({});
|
|
44
|
+
}, h = a.useMemo(() => t.columnsRef.find((e) => e.field === u.field), [t.columnsRef, u]), xe = a.useMemo(() => {
|
|
45
45
|
const e = t.gridProps.sortable && (h == null ? void 0 : h.sortable);
|
|
46
|
-
return
|
|
46
|
+
return un({
|
|
47
47
|
pdf: !!t.gridProps.pdf,
|
|
48
48
|
sortable: !!e,
|
|
49
|
-
selectable:
|
|
49
|
+
selectable: ce(t.gridProps.selectable).enabled,
|
|
50
50
|
clipboard: !!t.gridProps.clipboard
|
|
51
51
|
});
|
|
52
|
-
}, [h, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]),
|
|
52
|
+
}, [h, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), De = a.useMemo(() => {
|
|
53
53
|
const e = t.gridProps.sortable && (h == null ? void 0 : h.sortable);
|
|
54
|
-
return
|
|
54
|
+
return fn({
|
|
55
55
|
pdf: !!t.gridProps.pdf,
|
|
56
56
|
sortable: !!e,
|
|
57
|
-
selectable:
|
|
57
|
+
selectable: ce(t.gridProps.selectable).enabled,
|
|
58
58
|
clipboard: !!t.gridProps.clipboard,
|
|
59
|
-
rowReorderable:
|
|
59
|
+
rowReorderable: mn(t.gridProps.rowReorderable)
|
|
60
60
|
});
|
|
61
|
-
}, [h, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]),
|
|
62
|
-
const e = (h == null ? void 0 : h.contextMenu) || t.gridProps.contextMenu, n = typeof e == "function" ? e(
|
|
63
|
-
if (n &&
|
|
64
|
-
const o =
|
|
61
|
+
}, [h, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), J = a.useMemo(() => {
|
|
62
|
+
const e = (h == null ? void 0 : h.contextMenu) || t.gridProps.contextMenu, n = typeof e == "function" ? e(u) : e;
|
|
63
|
+
if (n && u.offset) {
|
|
64
|
+
const o = u.dataItem ? Ve.body : Ve.head, r = n[o], i = u.dataItem ? De : xe;
|
|
65
65
|
return r === !1 ? void 0 : r === !0 || r === void 0 ? i : r;
|
|
66
66
|
}
|
|
67
|
-
}, [t.gridProps.contextMenu,
|
|
68
|
-
var c,
|
|
67
|
+
}, [t.gridProps.contextMenu, u, De, xe, h]), We = (e) => {
|
|
68
|
+
var c, s, g, P, I, ie, b, q, $;
|
|
69
69
|
const n = e.event.item, o = {
|
|
70
70
|
target: C.current,
|
|
71
71
|
syntheticEvent: e.event.syntheticEvent,
|
|
@@ -74,7 +74,7 @@ const Sn = (t, v, s) => {
|
|
|
74
74
|
...e
|
|
75
75
|
};
|
|
76
76
|
t.gridProps.onContextMenuItemClick && l(t.gridProps.onContextMenuItemClick, o);
|
|
77
|
-
const r =
|
|
77
|
+
const r = w(), i = {
|
|
78
78
|
selectedField: "",
|
|
79
79
|
componentId: t.id,
|
|
80
80
|
dataItems: r,
|
|
@@ -88,14 +88,14 @@ const Sn = (t, v, s) => {
|
|
|
88
88
|
metaKey: !1,
|
|
89
89
|
shiftKey: !1,
|
|
90
90
|
isDrag: !1,
|
|
91
|
-
...
|
|
91
|
+
...ce(t.gridProps.selectable),
|
|
92
92
|
...o
|
|
93
|
-
}, d = r.findIndex((
|
|
93
|
+
}, d = r.findIndex((X) => X === e.dataItem);
|
|
94
94
|
switch ((c = n.data) == null ? void 0 : c.action) {
|
|
95
95
|
case "SortCommand":
|
|
96
96
|
if (h) {
|
|
97
|
-
const
|
|
98
|
-
|
|
97
|
+
const X = (s = n.name) == null ? void 0 : s.toLowerCase().includes("asc"), Ot = ((g = n.name) == null ? void 0 : g.toLowerCase().includes("desc")) ? "desc" : void 0, Nt = X ? "asc" : Ot, Bt = n.name ? Nt : void 0;
|
|
98
|
+
ke(e.event.syntheticEvent, h, Bt);
|
|
99
99
|
}
|
|
100
100
|
break;
|
|
101
101
|
case "SelectRowCommand":
|
|
@@ -105,41 +105,41 @@ const Sn = (t, v, s) => {
|
|
|
105
105
|
dt(i);
|
|
106
106
|
break;
|
|
107
107
|
case "ExportPDFCommand":
|
|
108
|
-
|
|
108
|
+
le();
|
|
109
109
|
break;
|
|
110
110
|
case "ClearSelectionCommand":
|
|
111
111
|
lt(i);
|
|
112
112
|
break;
|
|
113
113
|
case "ReorderRowCommand":
|
|
114
|
-
|
|
114
|
+
_.current = e.dataItem, (P = n.name) != null && P.toLowerCase().includes("rowup") && d > 0 && B(e.event.syntheticEvent, d - 1, "before"), (I = n.name) != null && I.toLowerCase().includes("rowdown") && d < r.length - 1 && B(e.event.syntheticEvent, d + 1, "after"), (ie = n.name) != null && ie.toLowerCase().includes("rowtop") && B(e.event.syntheticEvent, 0, "before"), (b = n.name) != null && b.toLowerCase().includes("rowbottom") && B(e.event.syntheticEvent, r.length - 1, "after");
|
|
115
115
|
break;
|
|
116
116
|
case "CopySelectionCommand":
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
p(
|
|
118
|
+
Se.copy,
|
|
119
119
|
e.event.nativeEvent,
|
|
120
120
|
{
|
|
121
|
-
copyHeaders: !((
|
|
121
|
+
copyHeaders: !((q = n.name) != null && q.toLowerCase().includes("noheaders"))
|
|
122
122
|
},
|
|
123
123
|
e.dataItem,
|
|
124
124
|
e.field
|
|
125
125
|
);
|
|
126
126
|
break;
|
|
127
127
|
case "PasteCommand":
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
p(
|
|
129
|
+
Se.paste,
|
|
130
130
|
e.event.nativeEvent,
|
|
131
131
|
{
|
|
132
|
-
copyHeaders: !((
|
|
132
|
+
copyHeaders: !(($ = n.name) != null && $.toLowerCase().includes("noheaders"))
|
|
133
133
|
},
|
|
134
134
|
e.dataItem,
|
|
135
135
|
e.field
|
|
136
136
|
);
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
139
|
-
|
|
140
|
-
},
|
|
139
|
+
H();
|
|
140
|
+
}, Y = () => {
|
|
141
141
|
const e = t.columnsRef.filter((n) => n.declarationIndex >= 0 && n.parentIndex === -1);
|
|
142
|
-
return
|
|
142
|
+
return Pn(e);
|
|
143
143
|
}, je = (e, n, o) => {
|
|
144
144
|
if (t.gridProps.onContextMenu && v) {
|
|
145
145
|
const r = {
|
|
@@ -151,7 +151,7 @@ const Sn = (t, v, s) => {
|
|
|
151
151
|
};
|
|
152
152
|
l(t.gridProps.onContextMenu, r);
|
|
153
153
|
}
|
|
154
|
-
t.gridProps.contextMenu &&
|
|
154
|
+
t.gridProps.contextMenu && E({
|
|
155
155
|
event: e,
|
|
156
156
|
dataItem: n,
|
|
157
157
|
field: o
|
|
@@ -159,27 +159,27 @@ const Sn = (t, v, s) => {
|
|
|
159
159
|
}, _e = (e) => {
|
|
160
160
|
if (e.target !== e.currentTarget)
|
|
161
161
|
return;
|
|
162
|
-
clearTimeout(
|
|
162
|
+
clearTimeout(Ie.current), m.current && (m.current.table = M.current);
|
|
163
163
|
const n = e.currentTarget.scrollLeft, o = e.currentTarget.scrollTop;
|
|
164
|
-
t.gridProps.columnVirtualization && (!
|
|
165
|
-
|
|
166
|
-
}, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = n),
|
|
164
|
+
t.gridProps.columnVirtualization && (!D || o === Ce.current) && (Ie.current = window.setTimeout(() => {
|
|
165
|
+
U();
|
|
166
|
+
}, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = n), j.current && j.current.setScrollLeft(n), W.current && W.current.setScrollLeft(n), m.current && o !== Ce.current && m.current.scrollHandler(e), t.gridProps.onScroll && v && l(t.gridProps.onScroll, {
|
|
167
167
|
...f(e)
|
|
168
|
-
}),
|
|
168
|
+
}), Ce.current = o;
|
|
169
169
|
}, qe = (e) => {
|
|
170
|
-
|
|
170
|
+
O.onKeyDown(e, {
|
|
171
171
|
navigatable: t.gridProps.navigatable || !1,
|
|
172
172
|
contextStateRef: K,
|
|
173
|
-
navigationStateRef:
|
|
173
|
+
navigationStateRef: L,
|
|
174
174
|
onNavigationAction: Xe,
|
|
175
|
-
columns:
|
|
176
|
-
}),
|
|
177
|
-
document:
|
|
175
|
+
columns: Y()
|
|
176
|
+
}), O.onGetSnapshotBeforeUpdate({
|
|
177
|
+
document: S(),
|
|
178
178
|
contextStateRef: K,
|
|
179
|
-
navigationStateRef:
|
|
179
|
+
navigationStateRef: L
|
|
180
180
|
});
|
|
181
181
|
const n = {
|
|
182
|
-
dataItems:
|
|
182
|
+
dataItems: w(),
|
|
183
183
|
mode: R.mode,
|
|
184
184
|
cell: R.cell,
|
|
185
185
|
componentId: t.id,
|
|
@@ -188,18 +188,18 @@ const Sn = (t, v, s) => {
|
|
|
188
188
|
};
|
|
189
189
|
t.gridProps.onKeyDown && v && l(t.gridProps.onKeyDown, n);
|
|
190
190
|
}, $e = (e) => {
|
|
191
|
-
|
|
191
|
+
O.onFocus(e, {
|
|
192
192
|
navigatable: !!t.gridProps.navigatable,
|
|
193
193
|
contextStateRef: K
|
|
194
194
|
});
|
|
195
195
|
}, Xe = (e) => {
|
|
196
196
|
if (e.action === "moveToNextPage" && ft(e.event), e.action === "moveToPrevPage" && mt(e.event), e.focusElement && e.action === "reorderToRight") {
|
|
197
197
|
const n = parseInt(e.focusElement.ariaColIndex, 10) - 1;
|
|
198
|
-
n < t.columnsRef.length - 1 &&
|
|
198
|
+
n < t.columnsRef.length - 1 && ue(n, n + 1, e.event);
|
|
199
199
|
}
|
|
200
200
|
if (e.focusElement && e.action === "reorderToLeft") {
|
|
201
201
|
const n = parseInt(e.focusElement.ariaColIndex, 10) - 1;
|
|
202
|
-
n > 0 &&
|
|
202
|
+
n > 0 && ue(n, n - 1, e.event);
|
|
203
203
|
}
|
|
204
204
|
if (e.action === "select" && ot(e.event), t.gridProps.onNavigationAction && v) {
|
|
205
205
|
const n = {
|
|
@@ -231,9 +231,9 @@ const Sn = (t, v, s) => {
|
|
|
231
231
|
...f(e.syntheticEvent)
|
|
232
232
|
});
|
|
233
233
|
}, pe = (e, n, o) => {
|
|
234
|
-
if (
|
|
235
|
-
const r =
|
|
236
|
-
type:
|
|
234
|
+
if (Oe.enabled && Oe.mode === "incell" && t.gridProps.dataItemKey) {
|
|
235
|
+
const r = Qt(t.gridProps.edit, {
|
|
236
|
+
type: Zt.ENTER_FIELD_EDIT,
|
|
237
237
|
payload: { id: n[t.gridProps.dataItemKey], field: o }
|
|
238
238
|
});
|
|
239
239
|
t.gridProps.onEditChange && l(t.gridProps.onEditChange, {
|
|
@@ -243,8 +243,8 @@ const Sn = (t, v, s) => {
|
|
|
243
243
|
}
|
|
244
244
|
}, et = (e, n) => {
|
|
245
245
|
var r;
|
|
246
|
-
if (
|
|
247
|
-
const i =
|
|
246
|
+
if (pt(t.detailExpandable).enabled) {
|
|
247
|
+
const i = en((r = t.gridProps.detailExpand) != null ? r : {}, e);
|
|
248
248
|
t.gridProps.onDetailExpandChange && l(t.gridProps.onDetailExpandChange, {
|
|
249
249
|
...f(n),
|
|
250
250
|
detailExpand: i
|
|
@@ -252,22 +252,22 @@ const Sn = (t, v, s) => {
|
|
|
252
252
|
}
|
|
253
253
|
}, tt = (e, n) => {
|
|
254
254
|
var r;
|
|
255
|
-
const o =
|
|
255
|
+
const o = tn(
|
|
256
256
|
typeof t.gridProps.groupable == "object" ? t.gridProps.groupable.expandable !== !1 : t.gridProps.groupable
|
|
257
257
|
);
|
|
258
258
|
if (o.enabled) {
|
|
259
|
-
const i =
|
|
259
|
+
const i = nn((r = t.gridProps.groupExpand) != null ? r : [], e, o);
|
|
260
260
|
t.gridProps.onGroupExpandChange && l(t.gridProps.onGroupExpandChange, {
|
|
261
261
|
...f(n),
|
|
262
262
|
groupExpand: i
|
|
263
263
|
});
|
|
264
264
|
}
|
|
265
|
-
},
|
|
266
|
-
const { allowUnsort: r, mode: i } =
|
|
265
|
+
}, ke = (e, n, o) => {
|
|
266
|
+
const { allowUnsort: r, mode: i } = In(
|
|
267
267
|
t.gridProps.sortable || !1,
|
|
268
268
|
n.sortable || !1
|
|
269
|
-
), d = (t.gridProps.sort || []).filter((
|
|
270
|
-
c !== "" && n.field &&
|
|
269
|
+
), d = (t.gridProps.sort || []).filter((g) => g.field === n.field)[0], c = o || En[r][d && d.dir || ""], s = i === "single" ? [] : (t.gridProps.sort || []).filter((g) => g.field !== n.field);
|
|
270
|
+
c !== "" && n.field && s.push({ field: n.field, dir: c }), Ke(s, e);
|
|
271
271
|
}, nt = (e) => {
|
|
272
272
|
t.gridProps.onItemChange && l(t.gridProps.onItemChange, {
|
|
273
273
|
...f(e.syntheticEvent),
|
|
@@ -286,7 +286,7 @@ const Sn = (t, v, s) => {
|
|
|
286
286
|
endColIndex: d,
|
|
287
287
|
startRowIndex: i,
|
|
288
288
|
endRowIndex: i,
|
|
289
|
-
dataItems:
|
|
289
|
+
dataItems: w(),
|
|
290
290
|
altKey: !1,
|
|
291
291
|
ctrlKey: !1,
|
|
292
292
|
shiftKey: !1,
|
|
@@ -299,7 +299,7 @@ const Sn = (t, v, s) => {
|
|
|
299
299
|
};
|
|
300
300
|
l(t.gridProps.onSelectionChange, {
|
|
301
301
|
...c,
|
|
302
|
-
select: t.gridProps.dataItemKey ?
|
|
302
|
+
select: t.gridProps.dataItemKey ? Be({
|
|
303
303
|
event: c,
|
|
304
304
|
selectedState: (n = t.gridProps.select) != null ? n : {},
|
|
305
305
|
dataItemKey: t.gridProps.dataItemKey
|
|
@@ -307,35 +307,35 @@ const Sn = (t, v, s) => {
|
|
|
307
307
|
});
|
|
308
308
|
}
|
|
309
309
|
}, ot = (e) => {
|
|
310
|
-
var
|
|
310
|
+
var g, P;
|
|
311
311
|
if (!R.enabled || !t.gridProps.dataItemKey)
|
|
312
312
|
return;
|
|
313
313
|
const n = {
|
|
314
|
-
dataItems:
|
|
314
|
+
dataItems: w(),
|
|
315
315
|
mode: R.mode,
|
|
316
316
|
cell: R.cell,
|
|
317
317
|
componentId: t.id,
|
|
318
318
|
selectedField: "",
|
|
319
319
|
...f(e)
|
|
320
|
-
}, o =
|
|
320
|
+
}, o = rn({
|
|
321
321
|
event: n,
|
|
322
|
-
selectedState: (
|
|
322
|
+
selectedState: (g = t.gridProps.select) != null ? g : {},
|
|
323
323
|
dataItemKey: t.gridProps.dataItemKey
|
|
324
324
|
});
|
|
325
325
|
if (o === t.gridProps.select)
|
|
326
326
|
return;
|
|
327
|
-
const r = e.target, i =
|
|
328
|
-
if (c !== void 0 &&
|
|
329
|
-
const I = (P =
|
|
327
|
+
const r = e.target, i = Ue(r, "TD"), d = Ue(r, "TR"), c = on(i), s = an(d);
|
|
328
|
+
if (c !== void 0 && s !== void 0) {
|
|
329
|
+
const I = (P = hn(t.gridProps.data)) == null ? void 0 : P[s];
|
|
330
330
|
t.gridProps.onSelectionChange && l(t.gridProps.onSelectionChange, {
|
|
331
331
|
...n,
|
|
332
332
|
select: o,
|
|
333
333
|
dataItem: I,
|
|
334
|
-
startRowIndex:
|
|
334
|
+
startRowIndex: s,
|
|
335
335
|
startColIndex: c,
|
|
336
336
|
startDataItem: I,
|
|
337
337
|
endDataItem: I,
|
|
338
|
-
endRowIndex:
|
|
338
|
+
endRowIndex: s,
|
|
339
339
|
endColIndex: c,
|
|
340
340
|
ctrlKey: e.ctrlKey,
|
|
341
341
|
altKey: e.altKey,
|
|
@@ -346,9 +346,9 @@ const Sn = (t, v, s) => {
|
|
|
346
346
|
}
|
|
347
347
|
}, it = (e) => {
|
|
348
348
|
if (t.gridProps.onHeaderSelectionChange && R.enabled) {
|
|
349
|
-
const n =
|
|
349
|
+
const n = w();
|
|
350
350
|
l(t.gridProps.onHeaderSelectionChange, {
|
|
351
|
-
select: e.syntheticEvent.target.checked ? n.reduce((o, r) => (t.gridProps.dataItemKey &&
|
|
351
|
+
select: e.syntheticEvent.target.checked ? n.reduce((o, r) => (t.gridProps.dataItemKey && de(t.gridProps.dataItemKey)(r) !== void 0 && (o[de(t.gridProps.dataItemKey)(r)] = !0), o), {}) : {},
|
|
352
352
|
field: e.field,
|
|
353
353
|
nativeEvent: e.syntheticEvent && e.syntheticEvent.nativeEvent,
|
|
354
354
|
syntheticEvent: e.syntheticEvent,
|
|
@@ -356,7 +356,7 @@ const Sn = (t, v, s) => {
|
|
|
356
356
|
dataItems: n
|
|
357
357
|
});
|
|
358
358
|
}
|
|
359
|
-
},
|
|
359
|
+
}, Q = (e, n) => {
|
|
360
360
|
t.gridProps.onSelectionChange && R.enabled && l(t.gridProps.onSelectionChange, {
|
|
361
361
|
...e,
|
|
362
362
|
select: n
|
|
@@ -364,24 +364,24 @@ const Sn = (t, v, s) => {
|
|
|
364
364
|
}, at = (e) => {
|
|
365
365
|
var n;
|
|
366
366
|
if (t.gridProps.onSelectionChange && R.enabled) {
|
|
367
|
-
const o =
|
|
367
|
+
const o = w()[e.startRowIndex], r = w()[e.endRowIndex], i = {
|
|
368
368
|
syntheticEvent: void 0,
|
|
369
369
|
target: C.current,
|
|
370
370
|
selectedField: "",
|
|
371
371
|
componentId: t.id,
|
|
372
|
-
dataItems:
|
|
372
|
+
dataItems: w(),
|
|
373
373
|
dataItem: null,
|
|
374
374
|
startDataItem: o,
|
|
375
375
|
endDataItem: r,
|
|
376
376
|
...e
|
|
377
|
-
}, d =
|
|
377
|
+
}, d = Be({
|
|
378
378
|
event: i,
|
|
379
379
|
selectedState: (n = t.gridProps.select) != null ? n : {},
|
|
380
380
|
// Thats kinda strange, even through the `dataItemKey` is required by the `getSelectedState`
|
|
381
381
|
// it does work correctly even without it
|
|
382
382
|
dataItemKey: t.gridProps.dataItemKey
|
|
383
383
|
});
|
|
384
|
-
|
|
384
|
+
Q(i, d);
|
|
385
385
|
}
|
|
386
386
|
}, dt = (e) => {
|
|
387
387
|
if (t.gridProps.onSelectionChange && R.enabled) {
|
|
@@ -395,15 +395,15 @@ const Sn = (t, v, s) => {
|
|
|
395
395
|
endColIndex: t.columnsRef.length - 1
|
|
396
396
|
};
|
|
397
397
|
e.dataItems.forEach((d) => {
|
|
398
|
-
const
|
|
399
|
-
r[
|
|
400
|
-
}),
|
|
398
|
+
const s = de(t.gridProps.dataItemKey)(d);
|
|
399
|
+
r[s] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0;
|
|
400
|
+
}), Q(i, r);
|
|
401
401
|
}
|
|
402
402
|
}, ct = (e) => {
|
|
403
403
|
if (t.gridProps.onSelectionChange && R.enabled) {
|
|
404
|
-
const o =
|
|
404
|
+
const o = de(t.gridProps.dataItemKey)(e.dataItem), r = 0, i = t.columnsRef.length - 1, d = e.dataItems.findIndex(
|
|
405
405
|
(I) => I[t.gridProps.dataItemKey] === e.dataItem[t.gridProps.dataItemKey]
|
|
406
|
-
),
|
|
406
|
+
), g = {
|
|
407
407
|
...e,
|
|
408
408
|
startDataItem: d,
|
|
409
409
|
endDataItem: d,
|
|
@@ -412,11 +412,11 @@ const Sn = (t, v, s) => {
|
|
|
412
412
|
startColIndex: r,
|
|
413
413
|
endColIndex: i
|
|
414
414
|
}, P = e.mode === "multiple" ? t.gridProps.select || {} : {};
|
|
415
|
-
P[o] === !0 || Array.isArray(P[o]) && P[o].length === t.columnsRef.length ? delete P[o] : P[o] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0,
|
|
415
|
+
P[o] === !0 || Array.isArray(P[o]) && P[o].length === t.columnsRef.length ? delete P[o] : P[o] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0, Q(g, P);
|
|
416
416
|
}
|
|
417
417
|
}, lt = (e) => {
|
|
418
|
-
t.gridProps.onSelectionChange && R.enabled &&
|
|
419
|
-
},
|
|
418
|
+
t.gridProps.onSelectionChange && R.enabled && Q(e, {});
|
|
419
|
+
}, G = (e, n, o, r, i) => {
|
|
420
420
|
ut();
|
|
421
421
|
const d = t.gridProps.onDataStateChange;
|
|
422
422
|
if (e) {
|
|
@@ -426,13 +426,13 @@ const Sn = (t, v, s) => {
|
|
|
426
426
|
...f(r),
|
|
427
427
|
targetEvent: i || {},
|
|
428
428
|
dataState: {
|
|
429
|
-
...
|
|
429
|
+
...xt(),
|
|
430
430
|
...o
|
|
431
431
|
}
|
|
432
432
|
});
|
|
433
|
-
},
|
|
433
|
+
}, Z = (e, n, o) => {
|
|
434
434
|
var r;
|
|
435
|
-
|
|
435
|
+
D && t.gridProps.pageable && ((r = m.current) == null || r.reset()), G(
|
|
436
436
|
t.gridProps.onPageChange,
|
|
437
437
|
{ page: e },
|
|
438
438
|
{ skip: e.skip, take: e.take },
|
|
@@ -441,44 +441,47 @@ const Sn = (t, v, s) => {
|
|
|
441
441
|
);
|
|
442
442
|
}, st = (e, n, o) => {
|
|
443
443
|
var r;
|
|
444
|
-
t.gridProps.pageable || (r = t.gridProps.group) != null && r.length ? t.gridProps.virtualSkipRef && (t.gridProps.virtualSkipRef.current = e.skip,
|
|
444
|
+
t.gridProps.pageable || (r = t.gridProps.group) != null && r.length ? t.gridProps.virtualSkipRef && (t.gridProps.virtualSkipRef.current = e.skip, U()) : Z(e, n, o);
|
|
445
445
|
}, gt = () => {
|
|
446
446
|
let e = t.gridProps.total || 0;
|
|
447
447
|
return Array.isArray(t.gridProps.data) ? e = e || t.gridProps.data.length : t.gridProps.data && (e = e || t.gridProps.data.total), e;
|
|
448
448
|
}, ut = () => {
|
|
449
|
-
|
|
449
|
+
D && t.gridProps.virtualSkipRef && (t.gridProps.virtualSkipRef.current = 0);
|
|
450
450
|
}, ft = (e) => {
|
|
451
451
|
var i, d;
|
|
452
452
|
const n = (d = (i = t.gridProps.take) != null ? i : t.gridProps.pageSize) != null ? d : 0, o = (t.gridProps.skip || 0) + n, r = gt();
|
|
453
|
-
o < r &&
|
|
453
|
+
o < r && Z({ skip: o, take: n }, e);
|
|
454
454
|
}, mt = (e) => {
|
|
455
455
|
var r, i;
|
|
456
456
|
const n = (i = (r = t.gridProps.take) != null ? r : t.gridProps.pageSize) != null ? i : 0, o = (t.gridProps.skip || 0) - n;
|
|
457
|
-
o >= 0 &&
|
|
457
|
+
o >= 0 && Z({ skip: o, take: n }, e);
|
|
458
458
|
}, Pt = (e) => {
|
|
459
|
-
|
|
460
|
-
},
|
|
461
|
-
|
|
459
|
+
Z({ skip: e.skip, take: e.take }, e.syntheticEvent, e.targetEvent);
|
|
460
|
+
}, Ke = (e, n) => {
|
|
461
|
+
G(
|
|
462
462
|
t.gridProps.onSortChange,
|
|
463
463
|
{ sort: e },
|
|
464
|
-
{ sort: e, ...
|
|
464
|
+
{ sort: e, ...D && !t.gridProps.pageable ? { skip: 0 } : {} },
|
|
465
465
|
n
|
|
466
466
|
);
|
|
467
467
|
}, ht = (e, n) => {
|
|
468
|
-
|
|
468
|
+
G(
|
|
469
469
|
t.gridProps.onFilterChange,
|
|
470
470
|
{ filter: e },
|
|
471
471
|
{ filter: e, skip: 0 },
|
|
472
472
|
n
|
|
473
473
|
);
|
|
474
474
|
}, Rt = (e) => {
|
|
475
|
-
|
|
476
|
-
t.gridProps.
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
475
|
+
const n = Dn(
|
|
476
|
+
t.gridProps.data,
|
|
477
|
+
e,
|
|
478
|
+
t.columnsRef,
|
|
479
|
+
t.gridProps.dataItemKey
|
|
480
480
|
);
|
|
481
|
+
bt(n);
|
|
481
482
|
}, bt = (e) => {
|
|
483
|
+
G(t.gridProps.onHighlightChange, { highlight: e }, {}, {});
|
|
484
|
+
}, vt = (e) => {
|
|
482
485
|
const n = t.gridProps.searchFields || t.columnsRef.map((i) => i.field) || [], o = e.nativeEvent.target.value, r = {
|
|
483
486
|
logic: "or",
|
|
484
487
|
filters: n.filter((i) => i !== void 0).map((i) => {
|
|
@@ -491,7 +494,7 @@ const Sn = (t, v, s) => {
|
|
|
491
494
|
};
|
|
492
495
|
})
|
|
493
496
|
};
|
|
494
|
-
|
|
497
|
+
G(
|
|
495
498
|
t.gridProps.onSearchChange,
|
|
496
499
|
{
|
|
497
500
|
search: r
|
|
@@ -499,22 +502,22 @@ const Sn = (t, v, s) => {
|
|
|
499
502
|
{},
|
|
500
503
|
e.syntheticEvent
|
|
501
504
|
);
|
|
502
|
-
},
|
|
505
|
+
}, le = () => {
|
|
503
506
|
var e;
|
|
504
|
-
(e =
|
|
505
|
-
},
|
|
507
|
+
(e = A.current) == null || e.save();
|
|
508
|
+
}, Ct = async (e) => {
|
|
506
509
|
var n, o;
|
|
507
510
|
(n = t.gridProps) != null && n.onPdfExport && await ((o = t.gridProps) == null ? void 0 : o.onPdfExport(e));
|
|
508
|
-
},
|
|
511
|
+
}, se = (e, n) => {
|
|
509
512
|
const o = n.nativeEvent ? n : { nativeEvent: n.nativeEvent || n.originalEvent };
|
|
510
513
|
let r = {};
|
|
511
|
-
t.isVirtualScroll && e.length && !t.gridProps.pageable && (r = { take: void 0 }), e.length === 0 && t.gridProps.navigatable && (
|
|
514
|
+
t.isVirtualScroll && e.length && !t.gridProps.pageable && (r = { take: void 0 }), e.length === 0 && t.gridProps.navigatable && (Re.current = !0), G(
|
|
512
515
|
t.gridProps.onGroupChange,
|
|
513
516
|
{ group: e },
|
|
514
517
|
{ group: e, skip: 0, ...r },
|
|
515
518
|
o
|
|
516
519
|
);
|
|
517
|
-
},
|
|
520
|
+
}, ge = (e) => {
|
|
518
521
|
if (t.gridProps.onColumnsStateChange) {
|
|
519
522
|
const n = {
|
|
520
523
|
target: C.current,
|
|
@@ -522,63 +525,63 @@ const Sn = (t, v, s) => {
|
|
|
522
525
|
};
|
|
523
526
|
l(t.gridProps.onColumnsStateChange, n);
|
|
524
527
|
}
|
|
525
|
-
},
|
|
526
|
-
const { columnsRef: r, columnsState: i } = t, d = r[e], c =
|
|
528
|
+
}, ue = (e, n, o) => {
|
|
529
|
+
const { columnsRef: r, columnsState: i } = t, d = r[e], c = Rn(i), s = d.depth, g = (b) => {
|
|
527
530
|
do
|
|
528
531
|
b++;
|
|
529
|
-
while (b < r.length && r[b].depth >
|
|
532
|
+
while (b < r.length && r[b].depth > s);
|
|
530
533
|
return b;
|
|
531
|
-
}, P = r.splice(e,
|
|
532
|
-
r.splice(e < n ?
|
|
533
|
-
b.orderIndex =
|
|
534
|
-
const
|
|
535
|
-
|
|
534
|
+
}, P = r.splice(e, g(e) - e);
|
|
535
|
+
r.splice(e < n ? g(n - P.length) : n, 0, ...P), r.filter((b) => b.declarationIndex >= 0).forEach((b, q) => {
|
|
536
|
+
b.orderIndex = q;
|
|
537
|
+
const $ = c.find((X) => X.id === b.id);
|
|
538
|
+
$ && ($.orderIndex = q);
|
|
536
539
|
});
|
|
537
540
|
const I = r[e].locked && r[n].locked;
|
|
538
|
-
|
|
539
|
-
const
|
|
540
|
-
if (
|
|
541
|
+
dn(t.columnsMapRef, r, I || re.current), cn(t.columnsMapRef, r, I || re.current), he.current && (re.current = !1, he.current = !1);
|
|
542
|
+
const ie = Y();
|
|
543
|
+
if (U(), t.gridProps.onColumnReorder) {
|
|
541
544
|
const b = {
|
|
542
545
|
target: C.current,
|
|
543
|
-
columns:
|
|
546
|
+
columns: ie,
|
|
544
547
|
columnId: d.id,
|
|
545
548
|
nativeEvent: o
|
|
546
549
|
};
|
|
547
550
|
l(t.gridProps.onColumnReorder, b);
|
|
548
551
|
}
|
|
549
|
-
|
|
550
|
-
},
|
|
552
|
+
ge(i);
|
|
553
|
+
}, B = (e, n, o) => {
|
|
551
554
|
const r = typeof t.gridProps.rowReorderable == "object" ? t.gridProps.rowReorderable.enabled : t.gridProps.rowReorderable;
|
|
552
|
-
if (o === "forbidden" || !r || !
|
|
555
|
+
if (o === "forbidden" || !r || !_.current)
|
|
553
556
|
return;
|
|
554
557
|
const i = t.dataRef[n];
|
|
555
558
|
t.gridProps.onRowReorder && l(t.gridProps.onRowReorder, {
|
|
556
|
-
draggedDataItems: [
|
|
559
|
+
draggedDataItems: [_.current],
|
|
557
560
|
droppedDataItem: i == null ? void 0 : i.dataItem,
|
|
558
561
|
dropPosition: o,
|
|
559
562
|
nativeEvent: e.originalEvent,
|
|
560
563
|
dragEvent: e,
|
|
561
564
|
target: C.current
|
|
562
|
-
}),
|
|
563
|
-
},
|
|
565
|
+
}), _.current = null;
|
|
566
|
+
}, It = (e, n, o) => {
|
|
564
567
|
if (t.gridProps.group === void 0)
|
|
565
568
|
return;
|
|
566
569
|
const r = t.gridProps.group.slice();
|
|
567
|
-
r.splice(n, 0, ...r.splice(e, 1)),
|
|
568
|
-
},
|
|
570
|
+
r.splice(n, 0, ...r.splice(e, 1)), se(r, o);
|
|
571
|
+
}, Me = (e, n, o) => {
|
|
569
572
|
const r = t.columnsRef[e].field;
|
|
570
573
|
if (!r)
|
|
571
574
|
return;
|
|
572
575
|
const i = (t.gridProps.group || []).slice();
|
|
573
|
-
i.splice(n, 0, { field: r }),
|
|
574
|
-
},
|
|
576
|
+
i.splice(n, 0, { field: r }), se(i, o);
|
|
577
|
+
}, Et = (e, n) => {
|
|
575
578
|
const o = k.current.getCurrentGroupsLength;
|
|
576
|
-
|
|
577
|
-
},
|
|
579
|
+
Me(e, o, n);
|
|
580
|
+
}, fe = () => {
|
|
578
581
|
let e = 0;
|
|
579
|
-
if (!
|
|
582
|
+
if (!x.current.colGroupMain)
|
|
580
583
|
return;
|
|
581
|
-
const n =
|
|
584
|
+
const n = x.current.colGroupMain.children;
|
|
582
585
|
for (let o = 0; o < n.length; o++) {
|
|
583
586
|
const r = n[o].width;
|
|
584
587
|
if (!r) {
|
|
@@ -587,23 +590,23 @@ const Sn = (t, v, s) => {
|
|
|
587
590
|
}
|
|
588
591
|
e += parseFloat(r.toString());
|
|
589
592
|
}
|
|
590
|
-
e = Math.round(e),
|
|
591
|
-
},
|
|
593
|
+
e = Math.round(e), j.current && j.current.setWidth(e), W.current && W.current.setWidth(e), M.current && (M.current.style.width = e ? e + "px" : "");
|
|
594
|
+
}, Te = () => {
|
|
592
595
|
var e;
|
|
593
596
|
t.gridProps.widthRef && (t.gridProps.widthRef.current = ((e = T.current) == null ? void 0 : e.offsetWidth) || 0);
|
|
594
|
-
},
|
|
597
|
+
}, Ae = () => {
|
|
595
598
|
var e;
|
|
596
|
-
t.gridProps.containerHeightRef && (t.gridProps.containerHeightRef.current = ((e =
|
|
597
|
-
},
|
|
599
|
+
t.gridProps.containerHeightRef && (t.gridProps.containerHeightRef.current = ((e = V.current) == null ? void 0 : e.offsetHeight) || 0);
|
|
600
|
+
}, wt = () => {
|
|
598
601
|
const e = t.gridProps.minRowHeightRef;
|
|
599
602
|
if (e && !e.current && !t.gridProps.rowHeight) {
|
|
600
|
-
const n =
|
|
601
|
-
n && (e.current = n,
|
|
603
|
+
const n = bn(z.current);
|
|
604
|
+
n && (e.current = n, U());
|
|
602
605
|
}
|
|
603
|
-
},
|
|
606
|
+
}, p = a.useCallback(
|
|
604
607
|
(e, n, o, r, i) => {
|
|
605
|
-
var
|
|
606
|
-
if (!
|
|
608
|
+
var g;
|
|
609
|
+
if (!yt() && !o || !e)
|
|
607
610
|
return;
|
|
608
611
|
const d = {
|
|
609
612
|
type: e,
|
|
@@ -614,15 +617,15 @@ const Sn = (t, v, s) => {
|
|
|
614
617
|
field: i,
|
|
615
618
|
...typeof t.gridProps.clipboard != "boolean" ? t.gridProps.clipboard : {},
|
|
616
619
|
...o
|
|
617
|
-
}, c =
|
|
620
|
+
}, c = w(), s = $t({
|
|
618
621
|
event: d,
|
|
619
622
|
data: c,
|
|
620
|
-
selectedState: (
|
|
621
|
-
previousCopiedItems:
|
|
623
|
+
selectedState: (g = t.gridProps.select) != null ? g : {},
|
|
624
|
+
previousCopiedItems: Fe.current
|
|
622
625
|
});
|
|
623
|
-
e !==
|
|
626
|
+
e !== Se.paste && (Fe.current = s.copiedItems), t.gridProps.onClipboard && v && l(t.gridProps.onClipboard, {
|
|
624
627
|
...d,
|
|
625
|
-
...
|
|
628
|
+
...s
|
|
626
629
|
});
|
|
627
630
|
},
|
|
628
631
|
[
|
|
@@ -632,15 +635,15 @@ const Sn = (t, v, s) => {
|
|
|
632
635
|
t.gridProps.clipboard,
|
|
633
636
|
t.gridProps.onClipboard
|
|
634
637
|
]
|
|
635
|
-
),
|
|
638
|
+
), yt = () => {
|
|
636
639
|
var i, d, c;
|
|
637
|
-
if (!
|
|
640
|
+
if (!ae)
|
|
638
641
|
return !1;
|
|
639
|
-
const e =
|
|
642
|
+
const e = Vt(S()), n = e ? e.matches(".k-table-td") ? e : (i = S()) == null ? void 0 : i.body : (d = S()) == null ? void 0 : d.body, o = n.closest(".k-grid-container"), r = n && ((c = T.current) == null ? void 0 : c.contains(n));
|
|
640
643
|
return !!(n && r && o);
|
|
641
|
-
},
|
|
642
|
-
|
|
643
|
-
columns:
|
|
644
|
+
}, St = (e, n, o, r, i, d, c) => {
|
|
645
|
+
fe(), re.current = !0, he.current = !0, t.gridProps.onColumnResize && v && l(t.gridProps.onColumnResize, {
|
|
646
|
+
columns: Y(),
|
|
644
647
|
nativeEvent: r,
|
|
645
648
|
targetColumnId: c,
|
|
646
649
|
index: e,
|
|
@@ -648,8 +651,8 @@ const Sn = (t, v, s) => {
|
|
|
648
651
|
oldWidth: o,
|
|
649
652
|
end: i,
|
|
650
653
|
target: C.current
|
|
651
|
-
}), i &&
|
|
652
|
-
},
|
|
654
|
+
}), i && ge(d);
|
|
655
|
+
}, xt = () => {
|
|
653
656
|
var e;
|
|
654
657
|
return {
|
|
655
658
|
filter: t.gridProps.filter,
|
|
@@ -662,7 +665,7 @@ const Sn = (t, v, s) => {
|
|
|
662
665
|
nativeEvent: e && e.nativeEvent,
|
|
663
666
|
syntheticEvent: e,
|
|
664
667
|
target: C.current
|
|
665
|
-
}),
|
|
668
|
+
}), Dt = (e) => ({
|
|
666
669
|
...e,
|
|
667
670
|
nativeEvent: void 0,
|
|
668
671
|
syntheticEvent: void 0,
|
|
@@ -674,60 +677,60 @@ const Sn = (t, v, s) => {
|
|
|
674
677
|
e(n);
|
|
675
678
|
return;
|
|
676
679
|
}
|
|
677
|
-
e(
|
|
678
|
-
},
|
|
680
|
+
e(Dt(n));
|
|
681
|
+
}, kt = () => {
|
|
679
682
|
var e, n, o;
|
|
680
|
-
if (
|
|
681
|
-
|
|
682
|
-
const r = Array.from((o =
|
|
683
|
-
r.length >
|
|
684
|
-
(i) => !
|
|
685
|
-
)[0] : r.length === 1 && (
|
|
683
|
+
if (z.current && ((e = z.current) == null ? void 0 : e.getElementsByClassName("k-grid-edit-row").length) > 0) {
|
|
684
|
+
ve.current = !1, (n = document.activeElement) != null && n.closest(".k-grid-edit-row") ? be.current = document.activeElement : be.current = void 0;
|
|
685
|
+
const r = Array.from((o = z.current) == null ? void 0 : o.getElementsByClassName("k-grid-edit-row"));
|
|
686
|
+
r.length > we.current.length ? ne.current = r.filter(
|
|
687
|
+
(i) => !we.current.includes(i)
|
|
688
|
+
)[0] : r.length === 1 && (ne.current = r[0], ve.current = !0), we.current = r;
|
|
686
689
|
}
|
|
687
|
-
},
|
|
690
|
+
}, w = () => t.dataRef.filter((e) => e.rowType === "data").map((e) => e.dataItem), S = () => {
|
|
688
691
|
var e;
|
|
689
|
-
if (
|
|
690
|
-
return ((e =
|
|
691
|
-
},
|
|
692
|
+
if (ae)
|
|
693
|
+
return ((e = ee()) == null ? void 0 : e.ownerDocument) || document;
|
|
694
|
+
}, ee = () => T.current, me = a.useCallback(
|
|
692
695
|
(e) => {
|
|
693
696
|
var r, i;
|
|
694
697
|
if (!m.current || !((r = m.current) != null && r.container) || t.gridProps.scrollable === "none")
|
|
695
698
|
return;
|
|
696
|
-
|
|
697
|
-
const { rowIndex: n } = e, o =
|
|
698
|
-
if (
|
|
699
|
+
F.current && F.current.disconnect();
|
|
700
|
+
const { rowIndex: n } = e, o = ee();
|
|
701
|
+
if (D) {
|
|
699
702
|
const d = ((i = m.current.rowHeightService) == null ? void 0 : i.offset(n)) || 0;
|
|
700
703
|
m.current.container.scroll(0, d);
|
|
701
704
|
} else if (o) {
|
|
702
705
|
const d = n < 1 ? o.querySelector("tbody > tr:nth-child(1)") : o.querySelector(`tbody > tr:nth-child(${n + 1})`);
|
|
703
|
-
d &&
|
|
706
|
+
d && V.current && (V.current.scrollTop = d.offsetTop);
|
|
704
707
|
}
|
|
705
708
|
},
|
|
706
709
|
[t.gridProps.scrollable]
|
|
707
|
-
),
|
|
708
|
-
|
|
709
|
-
},
|
|
710
|
+
), He = (e) => JSON.stringify(e.map((n) => ({ id: n.id, field: n.field, title: n.title, children: n.children }))), Kt = () => He(Ft) === He(t.columnsRef), Mt = () => {
|
|
711
|
+
oe.current = window.innerWidth, Kt() || U();
|
|
712
|
+
}, Tt = () => {
|
|
710
713
|
var d;
|
|
711
714
|
const { virtualTotal: e, virtualPageSize: n, gridProps: o } = t, r = m.current, i = t.gridProps.rowHeight || ((d = o.minRowHeightRef) == null ? void 0 : d.current) || 0;
|
|
712
|
-
r && (r.fixedScroll = o.fixedScroll || !1, r.PageChange = st, r.pageSize = n, r.scrollableVirtual =
|
|
713
|
-
},
|
|
715
|
+
r && (r.fixedScroll = o.fixedScroll || !1, r.PageChange = st, r.pageSize = n, r.scrollableVirtual = D, r.container = V.current, r.tableBody = z.current, r.scrollHeightContainer = Le.current, r.table = M.current, (!r.rowHeightService || r.total !== e) && i && (r.total = e, r.rowHeightService = new _t(e, i)));
|
|
716
|
+
}, Ge = a.useCallback(
|
|
714
717
|
(e) => {
|
|
715
|
-
const n = { rowIndex:
|
|
718
|
+
const n = { rowIndex: Ee.current };
|
|
716
719
|
e.forEach((o) => {
|
|
717
|
-
o.boundingClientRect.height !== o.intersectionRect.height &&
|
|
720
|
+
o.boundingClientRect.height !== o.intersectionRect.height && me(n);
|
|
718
721
|
});
|
|
719
722
|
},
|
|
720
|
-
[
|
|
721
|
-
),
|
|
723
|
+
[me]
|
|
724
|
+
), U = () => {
|
|
722
725
|
t.gridProps.forceUpdate && t.gridProps.forceUpdate();
|
|
723
|
-
},
|
|
726
|
+
}, At = (e) => e.left !== void 0 ? ye !== "rtl" ? { left: e.left, right: e.right } : { left: e.right, right: e.left } : {}, C = a.useRef(null), m = a.useRef(void 0), x = a.useRef(void 0), k = a.useRef(void 0), K = a.useRef(void 0), L = a.useRef(void 0), te = a.useRef(void 0), F = a.useRef(null), z = a.useRef(null), Ht = a.useRef(null), V = a.useRef(null), M = a.useRef(null), Pe = a.useRef(null), T = a.useRef(null), Le = a.useRef(null), W = a.useRef(null), j = a.useRef(null), he = a.useRef(!1), Re = a.useRef(!1), ne = a.useRef(void 0), be = a.useRef(void 0), ve = a.useRef(!1), re = a.useRef(!0), Ce = a.useRef(0), Ie = a.useRef(void 0), Ee = a.useRef(void 0), we = a.useRef([]), Fe = a.useRef([]), oe = a.useRef(0), _ = a.useRef(null), Gt = a.useRef(null), Lt = a.useRef(null), ye = Wt(T), D = t.isVirtualScroll, Ft = a.useMemo(() => a.Children.toArray(t.gridProps.children), [t.gridProps.children]), ze = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, R = ce(t.gridProps.selectable), Oe = Xt(t.gridProps.editable), zt = oe.current && N && oe.current <= N.medium && t.gridProps.adaptive;
|
|
724
727
|
return a.useMemo(() => {
|
|
725
|
-
|
|
728
|
+
O.onConstructor({
|
|
726
729
|
navigatable: !!t.gridProps.navigatable,
|
|
727
730
|
contextStateRef: K,
|
|
728
|
-
navigationStateRef:
|
|
731
|
+
navigationStateRef: L,
|
|
729
732
|
idPrefix: t.id
|
|
730
|
-
}), m.current = new
|
|
733
|
+
}), m.current = new vn();
|
|
731
734
|
}, []), a.useMemo(() => {
|
|
732
735
|
var e;
|
|
733
736
|
(e = m.current) == null || e.reset();
|
|
@@ -736,177 +739,177 @@ const Sn = (t, v, s) => {
|
|
|
736
739
|
t.gridProps.total,
|
|
737
740
|
t.gridProps.filter,
|
|
738
741
|
t.gridProps.group,
|
|
739
|
-
|
|
742
|
+
ze,
|
|
740
743
|
t.gridProps.sort,
|
|
741
744
|
t.gridProps.rowHeight
|
|
742
|
-
]), a.useEffect(() => (t.gridProps.clipboard && (
|
|
743
|
-
|
|
744
|
-
}), [t.gridProps.onClipboard, t.gridProps.clipboard,
|
|
745
|
+
]), a.useEffect(() => (t.gridProps.clipboard && (te.current = new Jt(p), te.current.addEventListeners(S())), () => {
|
|
746
|
+
te.current && te.current.removeEventListeners(S());
|
|
747
|
+
}), [t.gridProps.onClipboard, t.gridProps.clipboard, p, S]), a.useEffect(() => (t.gridProps.columnVirtualization && !window.navigator.userAgent.match(gn) && (Pe.current && (Pe.current.style.display = "block"), M.current && (M.current.style.display = "block")), Te(), fe(), Ne(), O.onComponentDidMount({
|
|
745
748
|
scope: T.current || void 0,
|
|
746
749
|
contextStateRef: K,
|
|
747
|
-
navigationStateRef:
|
|
750
|
+
navigationStateRef: L
|
|
748
751
|
}), () => {
|
|
749
|
-
clearTimeout(
|
|
752
|
+
clearTimeout(Ie.current);
|
|
750
753
|
}), []), a.useEffect(() => {
|
|
751
754
|
var e;
|
|
752
|
-
|
|
755
|
+
Te(), fe(), Ne(), D && (Ae(), wt(), (e = m.current) == null || e.update()), kt(), O.onComponentDidUpdate({
|
|
753
756
|
scope: T.current || void 0,
|
|
754
757
|
contextStateRef: K,
|
|
755
|
-
navigationStateRef:
|
|
756
|
-
focusFirst:
|
|
757
|
-
newEditableRow:
|
|
758
|
-
singleEditRow:
|
|
759
|
-
lastActiveElement:
|
|
758
|
+
navigationStateRef: L,
|
|
759
|
+
focusFirst: Re.current,
|
|
760
|
+
newEditableRow: ne.current,
|
|
761
|
+
singleEditRow: ve.current,
|
|
762
|
+
lastActiveElement: be.current,
|
|
760
763
|
navigatable: t.gridProps.navigatable
|
|
761
|
-
}),
|
|
764
|
+
}), Re.current = !1, ne.current = void 0;
|
|
762
765
|
}), a.useEffect(() => {
|
|
763
|
-
if (
|
|
766
|
+
if (ae) {
|
|
764
767
|
const e = {
|
|
765
768
|
rootMargin: "0px",
|
|
766
769
|
threshold: 0.9
|
|
767
770
|
};
|
|
768
|
-
|
|
771
|
+
F.current = window.IntersectionObserver && new window.IntersectionObserver(Ge, e) || null;
|
|
769
772
|
}
|
|
770
|
-
}, [
|
|
773
|
+
}, [Ge]), a.useEffect(() => {
|
|
771
774
|
var n;
|
|
772
775
|
let e;
|
|
773
|
-
return
|
|
774
|
-
|
|
775
|
-
}), e.observe((n =
|
|
776
|
+
return ae && window.ResizeObserver && (e = new window.ResizeObserver(() => {
|
|
777
|
+
Mt(), D && Ae();
|
|
778
|
+
}), e.observe((n = S()) == null ? void 0 : n.body)), () => {
|
|
776
779
|
e == null || e.disconnect();
|
|
777
780
|
};
|
|
778
781
|
}, []), a.useImperativeHandle(
|
|
779
782
|
C,
|
|
780
783
|
() => ({
|
|
781
784
|
get element() {
|
|
782
|
-
return
|
|
785
|
+
return ee();
|
|
783
786
|
},
|
|
784
787
|
props: t.gridProps,
|
|
785
788
|
get columns() {
|
|
786
|
-
return
|
|
789
|
+
return Y();
|
|
787
790
|
},
|
|
788
791
|
scrollIntoView: (e) => {
|
|
789
792
|
var r;
|
|
790
793
|
if (!((r = m.current) != null && r.container) || t.gridProps.scrollable === "none")
|
|
791
794
|
return;
|
|
792
795
|
const { rowIndex: n } = e;
|
|
793
|
-
|
|
794
|
-
const o =
|
|
795
|
-
if (
|
|
796
|
-
|
|
797
|
-
const i = o.querySelector(`[absolute-row-index="${
|
|
798
|
-
i ?
|
|
796
|
+
Ee.current = n;
|
|
797
|
+
const o = ee();
|
|
798
|
+
if (F.current && o) {
|
|
799
|
+
F.current.disconnect();
|
|
800
|
+
const i = o.querySelector(`[absolute-row-index="${Ee.current}"]`);
|
|
801
|
+
i ? F.current.observe(i) : me(e);
|
|
799
802
|
}
|
|
800
803
|
},
|
|
801
804
|
fitColumns: (e) => {
|
|
802
|
-
|
|
805
|
+
x.current.dblClickHandler(null, e);
|
|
803
806
|
},
|
|
804
|
-
exportAsPdf:
|
|
807
|
+
exportAsPdf: le
|
|
805
808
|
})
|
|
806
809
|
), a.useImperativeHandle(t.gridRef, () => C.current), a.useMemo(() => {
|
|
807
|
-
|
|
810
|
+
x.current = new ln(St);
|
|
808
811
|
}, [t.gridProps.onColumnResize, t.columnsRef]), a.useMemo(() => {
|
|
809
|
-
k.current = new
|
|
812
|
+
k.current = new sn(ue, It, Me);
|
|
810
813
|
}, [
|
|
811
814
|
t.gridProps.onColumnReorder,
|
|
812
815
|
t.gridProps.onGroupChange,
|
|
813
816
|
t.gridProps.group,
|
|
814
817
|
t.columnsRef,
|
|
815
818
|
t.gridProps.groupable
|
|
816
|
-
]),
|
|
817
|
-
|
|
819
|
+
]), x.current.resizable = t.gridProps.resizable || !1, x.current.columns = t.columnsRef, x.current.columnsState = jt(t.columnsState), k.current.reorderable = t.gridProps.reorderable || !1, k.current.groupable = ze, k.current.columns = t.columnsRef, k.current.dir = ye, Tt(), /* @__PURE__ */ a.createElement(
|
|
820
|
+
yn.Provider,
|
|
818
821
|
{
|
|
819
822
|
value: {
|
|
820
823
|
isClient: v,
|
|
821
|
-
rowReorder:
|
|
822
|
-
activeDragRowDataItemRef:
|
|
823
|
-
reorderRowDragTargetRef:
|
|
824
|
-
reorderRowDropTargetRef:
|
|
825
|
-
dir:
|
|
826
|
-
getCellPositionStyle:
|
|
824
|
+
rowReorder: B,
|
|
825
|
+
activeDragRowDataItemRef: _,
|
|
826
|
+
reorderRowDragTargetRef: Gt,
|
|
827
|
+
reorderRowDropTargetRef: Lt,
|
|
828
|
+
dir: ye,
|
|
829
|
+
getCellPositionStyle: At,
|
|
827
830
|
dataItemKey: t.gridProps.dataItemKey,
|
|
828
831
|
columnsState: t.columnsState,
|
|
829
832
|
columnsRef: t.columnsRef,
|
|
830
|
-
onColumnsStateChange:
|
|
833
|
+
onColumnsStateChange: ge,
|
|
831
834
|
groupable: t.gridProps.groupable,
|
|
832
835
|
group: t.gridProps.group,
|
|
833
836
|
defaultGroup: t.gridProps.defaultGroup,
|
|
834
|
-
groupChange:
|
|
837
|
+
groupChange: se,
|
|
835
838
|
selectionRelease: at,
|
|
836
839
|
pagerPageChange: Pt,
|
|
837
840
|
onContextMenu: je,
|
|
838
841
|
rowClick: Je,
|
|
839
842
|
rowDblClick: Ye,
|
|
840
843
|
cellClick: pe,
|
|
841
|
-
headerCellClick:
|
|
844
|
+
headerCellClick: ke,
|
|
842
845
|
itemChange: nt,
|
|
843
846
|
onDialogEditCancel: Ze,
|
|
844
847
|
onDialogEditSubmit: Qe,
|
|
845
848
|
sortable: t.gridProps.sortable,
|
|
846
849
|
sort: t.gridProps.sort,
|
|
847
850
|
defaultSort: t.gridProps.defaultSort,
|
|
848
|
-
sortChange:
|
|
851
|
+
sortChange: Ke,
|
|
849
852
|
filterable: t.gridProps.filterable,
|
|
850
853
|
filter: t.gridProps.filter,
|
|
851
854
|
defaultFilter: t.gridProps.defaultFilter,
|
|
852
|
-
filterOperators: t.gridProps.filterOperators ||
|
|
855
|
+
filterOperators: t.gridProps.filterOperators || Sn,
|
|
853
856
|
filterChange: ht,
|
|
854
|
-
|
|
857
|
+
applyHighlightDescriptor: Rt,
|
|
855
858
|
highlight: t.gridProps.highlight,
|
|
856
|
-
searchChange:
|
|
857
|
-
exportAsPdf:
|
|
859
|
+
searchChange: vt,
|
|
860
|
+
exportAsPdf: le,
|
|
858
861
|
onHeaderSelectionChange: it,
|
|
859
|
-
columnGroupChange:
|
|
862
|
+
columnGroupChange: Et,
|
|
860
863
|
onKeyDown: qe,
|
|
861
864
|
onFocus: $e,
|
|
862
865
|
scrollHandler: _e,
|
|
863
866
|
selectionChange: rt,
|
|
864
|
-
mobileMode:
|
|
865
|
-
adaptiveColumnMenuRef:
|
|
867
|
+
mobileMode: zt,
|
|
868
|
+
adaptiveColumnMenuRef: oe.current,
|
|
866
869
|
adpativeTitle: t.gridProps.adaptiveTitle,
|
|
867
870
|
adaptive: t.gridProps.adaptive,
|
|
868
871
|
dispatchDetailExpand: et,
|
|
869
872
|
dispatchGroupExpand: tt,
|
|
870
|
-
columnResizeRef:
|
|
873
|
+
columnResizeRef: x,
|
|
871
874
|
dragLogicRef: k,
|
|
872
|
-
navigationStateRef:
|
|
875
|
+
navigationStateRef: L,
|
|
873
876
|
tableElementRef: M,
|
|
874
|
-
tableBodyElementRef:
|
|
875
|
-
headerElementRef:
|
|
876
|
-
containerElementRef:
|
|
877
|
-
headTableElementRef:
|
|
877
|
+
tableBodyElementRef: z,
|
|
878
|
+
headerElementRef: Ht,
|
|
879
|
+
containerElementRef: V,
|
|
880
|
+
headTableElementRef: Pe,
|
|
878
881
|
elementRef: T,
|
|
879
|
-
virtualScrollHeightContainerRef:
|
|
880
|
-
footerRef:
|
|
881
|
-
headerRef:
|
|
882
|
+
virtualScrollHeightContainerRef: Le,
|
|
883
|
+
footerRef: W,
|
|
884
|
+
headerRef: j,
|
|
882
885
|
vsRef: m
|
|
883
886
|
}
|
|
884
887
|
},
|
|
885
|
-
/* @__PURE__ */ a.createElement(
|
|
888
|
+
/* @__PURE__ */ a.createElement(Yt.Provider, { value: K.current }, t.children),
|
|
886
889
|
/* @__PURE__ */ a.createElement(
|
|
887
|
-
|
|
890
|
+
Cn,
|
|
888
891
|
{
|
|
889
|
-
show:
|
|
890
|
-
dataItem:
|
|
891
|
-
field:
|
|
892
|
-
items:
|
|
893
|
-
offset:
|
|
894
|
-
onClose:
|
|
892
|
+
show: u.show && (J == null ? void 0 : J.length),
|
|
893
|
+
dataItem: u.dataItem,
|
|
894
|
+
field: u.field,
|
|
895
|
+
items: J,
|
|
896
|
+
offset: u.offset,
|
|
897
|
+
onClose: H,
|
|
895
898
|
onSelect: We
|
|
896
899
|
}
|
|
897
900
|
),
|
|
898
901
|
t.gridProps.pdf && /* @__PURE__ */ a.createElement(
|
|
899
|
-
|
|
902
|
+
wn,
|
|
900
903
|
{
|
|
901
904
|
gridProps: t.gridProps,
|
|
902
905
|
innerGrid: t.innerGrid,
|
|
903
906
|
pdf: typeof t.gridProps.pdf == "object" ? t.gridProps.pdf : {},
|
|
904
|
-
onPdfExport:
|
|
905
|
-
ref: (e) =>
|
|
907
|
+
onPdfExport: Ct,
|
|
908
|
+
ref: (e) => A.current = e
|
|
906
909
|
}
|
|
907
910
|
)
|
|
908
911
|
);
|
|
909
912
|
};
|
|
910
913
|
export {
|
|
911
|
-
|
|
914
|
+
Wn as GridClientWrapper
|
|
912
915
|
};
|