@progress/kendo-react-grid 13.1.0 → 13.2.0-develop.1
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 +110 -104
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/index.d.mts +15 -1
- package/index.d.ts +15 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +17 -17
- package/toolbar-tools/GridToolbarAIAssistant.js +2 -2
- package/toolbar-tools/GridToolbarAIAssistant.mjs +175 -148
package/GridClientWrapper.mjs
CHANGED
|
@@ -7,26 +7,26 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as a from "react";
|
|
10
|
-
import { useAdaptiveModeContext as Wt, canUseDOM as Q, getActiveElement as jt, useDir as _t, setScrollbarWidth as
|
|
10
|
+
import { useAdaptiveModeContext as Wt, canUseDOM as Q, getActiveElement as jt, useDir as _t, setScrollbarWidth as We, cloneArray as qt, getter as Z, RowHeightService as $t } from "@progress/kendo-react-common";
|
|
11
11
|
import { filterBy as Xt } from "@progress/kendo-data-query";
|
|
12
|
-
import { getSelectionOptions as se, populateClipboardData as Jt, ClipboardActionType as
|
|
12
|
+
import { getSelectionOptions as se, populateClipboardData as Jt, ClipboardActionType as ke, getEditableOptions as Yt, tableKeyboardNavigation as V, ClipboardService as Qt, TableKeyboardNavigationContext as Zt, closestTagName as ue, editReducer as pt, EDIT_ACTION as en, getDetailExpandableOptions as tn, detailExpandReducer as nn, getGroupExpandableOptions as rn, groupExpandReducer as on, getSelectedState as je, getSelectedStateFromKeyDown as an, getColumnIndex as dn, getRowIndex as ln, updateLeft as cn, updateRight as sn } from "@progress/kendo-react-data-tools";
|
|
13
13
|
import { ColumnResize as un } from "./drag/ColumnResize.mjs";
|
|
14
14
|
import { CommonDragLogic as gn } from "./drag/CommonDragLogic.mjs";
|
|
15
15
|
import { SAFARI_REGEX as fn } from "./constants/index.mjs";
|
|
16
16
|
import { getDefaultHeadContextMenuItems as mn, getDefaultBodyContextMenuItems as Pn, isRowReorderEnabled as hn, sanitizeColumns as Rn, getDataAsArray as bn, getFlatColumnsState as vn, calcRowHeight as In } from "./utils/index.mjs";
|
|
17
17
|
import { VirtualScroll as Cn } from "./VirtualScroll.mjs";
|
|
18
18
|
import { GridContextMenu as En } from "./contextMenu/GridContextMenu.mjs";
|
|
19
|
-
import { GridContextMenuAnchorPart as
|
|
19
|
+
import { GridContextMenuAnchorPart as _e } from "./contextMenu/enums.mjs";
|
|
20
20
|
import { normalizeSortable as wn, firstLevelSortSeqMap as yn } from "./sortCommon.mjs";
|
|
21
21
|
import { BasePDFExport as xn } from "./BasePDFExport.mjs";
|
|
22
22
|
import { GridContext as Sn } from "./utils/GridContext.mjs";
|
|
23
|
-
import { operators as
|
|
24
|
-
const
|
|
23
|
+
import { operators as kn } from "./filterCommon.mjs";
|
|
24
|
+
const Dn = (t, I, h, S) => {
|
|
25
25
|
const W = Object.keys(I.cells).map((x) => h.findIndex((L) => L.field === x)), G = Object.keys(I.cells).length > 0 ? W : !0;
|
|
26
26
|
return t.reduce((x, L) => (x[L[S != null ? S : "id"]] = G, x), {});
|
|
27
|
-
},
|
|
27
|
+
}, qe = (t, I, h, S) => I.reduce((G, x) => ({
|
|
28
28
|
...G,
|
|
29
|
-
...
|
|
29
|
+
...Dn(Xt(t, x), x, h, S)
|
|
30
30
|
}), {}), jn = (t) => {
|
|
31
31
|
const I = t.gridProps.isClient, [h, S] = a.useState({}), W = Wt(), G = a.useRef(null), x = (e) => {
|
|
32
32
|
e.event.preventDefault(), S({
|
|
@@ -41,7 +41,7 @@ const kn = (t, I, h, S) => {
|
|
|
41
41
|
});
|
|
42
42
|
}, L = () => {
|
|
43
43
|
S({});
|
|
44
|
-
}, v = a.useMemo(() => t.columnsRef.find((e) => e.field === h.field), [t.columnsRef, h]),
|
|
44
|
+
}, v = a.useMemo(() => t.columnsRef.find((e) => e.field === h.field), [t.columnsRef, h]), De = a.useMemo(() => {
|
|
45
45
|
const e = t.gridProps.sortable && (v == null ? void 0 : v.sortable);
|
|
46
46
|
return mn({
|
|
47
47
|
pdf: !!t.gridProps.pdf,
|
|
@@ -61,10 +61,10 @@ const kn = (t, I, h, S) => {
|
|
|
61
61
|
}, [v, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), p = a.useMemo(() => {
|
|
62
62
|
const e = (v == null ? void 0 : v.contextMenu) || t.gridProps.contextMenu, n = typeof e == "function" ? e(h) : e;
|
|
63
63
|
if (n && h.offset) {
|
|
64
|
-
const o = h.dataItem ?
|
|
64
|
+
const o = h.dataItem ? _e.body : _e.head, r = n[o], i = h.dataItem ? Ke : De;
|
|
65
65
|
return r === !1 ? void 0 : r === !0 || r === void 0 ? i : r;
|
|
66
66
|
}
|
|
67
|
-
}, [t.gridProps.contextMenu, h, Ke,
|
|
67
|
+
}, [t.gridProps.contextMenu, h, Ke, De, v]), $e = (e) => {
|
|
68
68
|
var l, s, u, m, f, E, P, X, J;
|
|
69
69
|
const n = e.event.item, o = {
|
|
70
70
|
target: C.current,
|
|
@@ -99,23 +99,23 @@ const kn = (t, I, h, S) => {
|
|
|
99
99
|
}
|
|
100
100
|
break;
|
|
101
101
|
case "SelectRowCommand":
|
|
102
|
-
|
|
102
|
+
gt(i);
|
|
103
103
|
break;
|
|
104
104
|
case "SelectAllRowsCommand":
|
|
105
|
-
|
|
105
|
+
ut(i);
|
|
106
106
|
break;
|
|
107
107
|
case "ExportPDFCommand":
|
|
108
108
|
ge();
|
|
109
109
|
break;
|
|
110
110
|
case "ClearSelectionCommand":
|
|
111
|
-
|
|
111
|
+
mt(i);
|
|
112
112
|
break;
|
|
113
113
|
case "ReorderRowCommand":
|
|
114
114
|
$.current = e.dataItem, (m = n.name) != null && m.toLowerCase().includes("rowup") && d > 0 && j(e.event.syntheticEvent, d - 1, "before"), (f = n.name) != null && f.toLowerCase().includes("rowdown") && d < r.length - 1 && j(e.event.syntheticEvent, d + 1, "after"), (E = n.name) != null && E.toLowerCase().includes("rowtop") && j(e.event.syntheticEvent, 0, "before"), (P = n.name) != null && P.toLowerCase().includes("rowbottom") && j(e.event.syntheticEvent, r.length - 1, "after");
|
|
115
115
|
break;
|
|
116
116
|
case "CopySelectionCommand":
|
|
117
117
|
oe(
|
|
118
|
-
|
|
118
|
+
ke.copy,
|
|
119
119
|
e.event.nativeEvent,
|
|
120
120
|
{
|
|
121
121
|
copyHeaders: !((X = n.name) != null && X.toLowerCase().includes("noheaders"))
|
|
@@ -126,7 +126,7 @@ const kn = (t, I, h, S) => {
|
|
|
126
126
|
break;
|
|
127
127
|
case "PasteCommand":
|
|
128
128
|
oe(
|
|
129
|
-
|
|
129
|
+
ke.paste,
|
|
130
130
|
e.event.nativeEvent,
|
|
131
131
|
{
|
|
132
132
|
copyHeaders: !((J = n.name) != null && J.toLowerCase().includes("noheaders"))
|
|
@@ -140,7 +140,7 @@ const kn = (t, I, h, S) => {
|
|
|
140
140
|
}, ee = () => {
|
|
141
141
|
const e = t.columnsRef.filter((n) => n.declarationIndex >= 0 && n.parentIndex === -1);
|
|
142
142
|
return Rn(e);
|
|
143
|
-
},
|
|
143
|
+
}, Xe = (e, n, o) => {
|
|
144
144
|
if (t.gridProps.onContextMenu && I) {
|
|
145
145
|
const r = {
|
|
146
146
|
target: C.current,
|
|
@@ -156,7 +156,7 @@ const kn = (t, I, h, S) => {
|
|
|
156
156
|
dataItem: n,
|
|
157
157
|
field: o
|
|
158
158
|
});
|
|
159
|
-
},
|
|
159
|
+
}, Je = (e) => {
|
|
160
160
|
if (e.target !== e.currentTarget)
|
|
161
161
|
return;
|
|
162
162
|
clearTimeout(we.current), b.current && (b.current.table = H.current);
|
|
@@ -166,15 +166,15 @@ const kn = (t, I, h, S) => {
|
|
|
166
166
|
}, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = n), q.current && q.current.setScrollLeft(n), _.current && _.current.setScrollLeft(n), b.current && o !== Ee.current && b.current.scrollHandler(e), t.gridProps.onScroll && I && c(t.gridProps.onScroll, {
|
|
167
167
|
...R(e)
|
|
168
168
|
}), Ee.current = o;
|
|
169
|
-
},
|
|
169
|
+
}, Ye = (e) => {
|
|
170
170
|
V.onKeyDown(e, {
|
|
171
171
|
navigatable: t.gridProps.navigatable || !1,
|
|
172
172
|
contextStateRef: M,
|
|
173
173
|
navigationStateRef: N,
|
|
174
|
-
onNavigationAction:
|
|
174
|
+
onNavigationAction: Ze,
|
|
175
175
|
columns: ee()
|
|
176
176
|
}), V.onGetSnapshotBeforeUpdate({
|
|
177
|
-
document:
|
|
177
|
+
document: k(),
|
|
178
178
|
contextStateRef: M,
|
|
179
179
|
navigationStateRef: N
|
|
180
180
|
});
|
|
@@ -187,12 +187,12 @@ const kn = (t, I, h, S) => {
|
|
|
187
187
|
...R(e)
|
|
188
188
|
};
|
|
189
189
|
t.gridProps.onKeyDown && I && c(t.gridProps.onKeyDown, n);
|
|
190
|
-
},
|
|
190
|
+
}, Qe = (e) => {
|
|
191
191
|
V.onFocus(e, {
|
|
192
192
|
navigatable: !!t.gridProps.navigatable,
|
|
193
193
|
contextStateRef: M
|
|
194
194
|
});
|
|
195
|
-
},
|
|
195
|
+
}, Ze = (e) => {
|
|
196
196
|
const { columnsRef: n } = t;
|
|
197
197
|
if (e.action === "moveToNextPage" && Rt(e.event), e.action === "moveToPrevPage" && bt(e.event), e.focusElement && (e.action === "reorderToRight" || e.action === "reorderToLeft")) {
|
|
198
198
|
const o = parseInt(e.focusElement.ariaColIndex, 10) - 1;
|
|
@@ -209,37 +209,37 @@ const kn = (t, I, h, S) => {
|
|
|
209
209
|
ne(o, o - 1, e.event);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
if (e.action === "select" &&
|
|
212
|
+
if (e.action === "select" && lt(e.event), t.gridProps.onNavigationAction && I) {
|
|
213
213
|
const o = {
|
|
214
214
|
focusElement: e.focusElement,
|
|
215
215
|
...R(e.event)
|
|
216
216
|
};
|
|
217
217
|
c(t.gridProps.onNavigationAction, o);
|
|
218
218
|
}
|
|
219
|
-
},
|
|
219
|
+
}, pe = (e, n) => {
|
|
220
220
|
t.gridProps.onRowClick && ue(e.target, "TD") && c(t.gridProps.onRowClick, {
|
|
221
221
|
dataItem: n,
|
|
222
222
|
...R(e)
|
|
223
223
|
});
|
|
224
|
-
},
|
|
224
|
+
}, et = (e, n) => {
|
|
225
225
|
t.gridProps.onRowDoubleClick && ue(e.target, "TD") && c(t.gridProps.onRowDoubleClick, {
|
|
226
226
|
dataItem: n,
|
|
227
227
|
...R(e)
|
|
228
228
|
});
|
|
229
|
-
},
|
|
229
|
+
}, tt = (e) => {
|
|
230
230
|
t.gridProps.onItemChange && c(t.gridProps.onItemChange, {
|
|
231
231
|
...R(e.syntheticEvent),
|
|
232
232
|
dataItem: e.dataItem,
|
|
233
233
|
field: void 0,
|
|
234
234
|
value: void 0
|
|
235
235
|
});
|
|
236
|
-
},
|
|
236
|
+
}, nt = (e) => {
|
|
237
237
|
t.gridProps.onItemChange && t.gridProps.onEditChange && c(t.gridProps.onEditChange, {
|
|
238
238
|
edit: {},
|
|
239
239
|
...R(e.syntheticEvent)
|
|
240
240
|
});
|
|
241
|
-
},
|
|
242
|
-
if (
|
|
241
|
+
}, rt = (e, n, o) => {
|
|
242
|
+
if (Ve.enabled && Ve.mode === "incell" && t.gridProps.dataItemKey) {
|
|
243
243
|
const r = pt(t.gridProps.edit, {
|
|
244
244
|
type: en.ENTER_FIELD_EDIT,
|
|
245
245
|
payload: { id: n[t.gridProps.dataItemKey], field: o }
|
|
@@ -249,7 +249,7 @@ const kn = (t, I, h, S) => {
|
|
|
249
249
|
...R(e)
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
|
-
},
|
|
252
|
+
}, ot = (e, n) => {
|
|
253
253
|
var r;
|
|
254
254
|
if (tn(t.detailExpandable).enabled) {
|
|
255
255
|
const i = nn((r = t.gridProps.detailExpand) != null ? r : {}, e);
|
|
@@ -258,7 +258,7 @@ const kn = (t, I, h, S) => {
|
|
|
258
258
|
detailExpand: i
|
|
259
259
|
});
|
|
260
260
|
}
|
|
261
|
-
},
|
|
261
|
+
}, it = (e, n) => {
|
|
262
262
|
var r;
|
|
263
263
|
const o = rn(
|
|
264
264
|
typeof t.gridProps.groupable == "object" ? t.gridProps.groupable.expandable !== !1 : t.gridProps.groupable
|
|
@@ -275,8 +275,8 @@ const kn = (t, I, h, S) => {
|
|
|
275
275
|
t.gridProps.sortable || !1,
|
|
276
276
|
n.sortable || !1
|
|
277
277
|
), d = (t.gridProps.sort || []).filter((u) => u.field === n.field)[0], l = o || yn[r][d && d.dir || ""], s = i === "single" ? [] : (t.gridProps.sort || []).filter((u) => u.field !== n.field);
|
|
278
|
-
l !== "" && n.field && s.push({ field: n.field, dir: l }),
|
|
279
|
-
},
|
|
278
|
+
l !== "" && n.field && s.push({ field: n.field, dir: l }), He(s, e);
|
|
279
|
+
}, at = (e) => {
|
|
280
280
|
t.gridProps.onItemChange && c(t.gridProps.onItemChange, {
|
|
281
281
|
...R(e.syntheticEvent),
|
|
282
282
|
dataItem: e.dataItem,
|
|
@@ -284,7 +284,7 @@ const kn = (t, I, h, S) => {
|
|
|
284
284
|
field: e.field,
|
|
285
285
|
value: e.value
|
|
286
286
|
});
|
|
287
|
-
},
|
|
287
|
+
}, dt = (e) => {
|
|
288
288
|
var n;
|
|
289
289
|
if (t.gridProps.onSelectionChange && g.enabled) {
|
|
290
290
|
const { event: o, dataItem: r, dataIndex: i, columnIndex: d } = e, l = {
|
|
@@ -307,14 +307,14 @@ const kn = (t, I, h, S) => {
|
|
|
307
307
|
};
|
|
308
308
|
c(t.gridProps.onSelectionChange, {
|
|
309
309
|
...l,
|
|
310
|
-
select: t.gridProps.dataItemKey ?
|
|
310
|
+
select: t.gridProps.dataItemKey ? je({
|
|
311
311
|
event: l,
|
|
312
312
|
selectedState: (n = t.gridProps.select) != null ? n : {},
|
|
313
313
|
dataItemKey: t.gridProps.dataItemKey
|
|
314
314
|
}) : {}
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
|
-
},
|
|
317
|
+
}, lt = (e) => {
|
|
318
318
|
var u, m;
|
|
319
319
|
if (!g.enabled || !t.gridProps.dataItemKey)
|
|
320
320
|
return;
|
|
@@ -352,7 +352,7 @@ const kn = (t, I, h, S) => {
|
|
|
352
352
|
isDrag: !1
|
|
353
353
|
});
|
|
354
354
|
}
|
|
355
|
-
},
|
|
355
|
+
}, ct = (e) => {
|
|
356
356
|
if (t.gridProps.onHeaderSelectionChange && g.enabled) {
|
|
357
357
|
const n = w();
|
|
358
358
|
c(t.gridProps.onHeaderSelectionChange, {
|
|
@@ -369,7 +369,7 @@ const kn = (t, I, h, S) => {
|
|
|
369
369
|
...e,
|
|
370
370
|
select: n
|
|
371
371
|
});
|
|
372
|
-
},
|
|
372
|
+
}, st = (e) => {
|
|
373
373
|
var n;
|
|
374
374
|
if (t.gridProps.onSelectionChange && g.enabled) {
|
|
375
375
|
const o = w()[e.startRowIndex], r = w()[e.endRowIndex], i = {
|
|
@@ -382,7 +382,7 @@ const kn = (t, I, h, S) => {
|
|
|
382
382
|
startDataItem: o,
|
|
383
383
|
endDataItem: r,
|
|
384
384
|
...e
|
|
385
|
-
}, d =
|
|
385
|
+
}, d = je({
|
|
386
386
|
event: i,
|
|
387
387
|
selectedState: (n = t.gridProps.select) != null ? n : {},
|
|
388
388
|
// Thats kinda strange, even through the `dataItemKey` is required by the `getSelectedState`
|
|
@@ -391,7 +391,7 @@ const kn = (t, I, h, S) => {
|
|
|
391
391
|
});
|
|
392
392
|
z(i, d);
|
|
393
393
|
}
|
|
394
|
-
},
|
|
394
|
+
}, ut = (e) => {
|
|
395
395
|
if (t.gridProps.onSelectionChange && g.enabled) {
|
|
396
396
|
const n = e.dataItems[0], o = e.dataItems[e.dataItems.length - 1], r = {}, i = {
|
|
397
397
|
...e,
|
|
@@ -407,7 +407,7 @@ const kn = (t, I, h, S) => {
|
|
|
407
407
|
r[s] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0;
|
|
408
408
|
}), z(i, r);
|
|
409
409
|
}
|
|
410
|
-
},
|
|
410
|
+
}, gt = (e) => {
|
|
411
411
|
if (t.gridProps.onSelectionChange && g.enabled) {
|
|
412
412
|
const o = Z(t.gridProps.dataItemKey)(e.dataItem), r = 0, i = t.columnsRef.length - 1, d = e.dataItems.findIndex(
|
|
413
413
|
(f) => f[t.gridProps.dataItemKey] === e.dataItem[t.gridProps.dataItemKey]
|
|
@@ -422,7 +422,7 @@ const kn = (t, I, h, S) => {
|
|
|
422
422
|
}, m = e.mode === "multiple" ? t.gridProps.select || {} : {};
|
|
423
423
|
m[o] === !0 || Array.isArray(m[o]) && m[o].length === t.columnsRef.length ? delete m[o] : m[o] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0, z(u, m);
|
|
424
424
|
}
|
|
425
|
-
},
|
|
425
|
+
}, ft = (e) => {
|
|
426
426
|
if (!g.enabled)
|
|
427
427
|
return;
|
|
428
428
|
const n = w(), o = {
|
|
@@ -454,7 +454,7 @@ const kn = (t, I, h, S) => {
|
|
|
454
454
|
z(f, {});
|
|
455
455
|
return;
|
|
456
456
|
}
|
|
457
|
-
const r =
|
|
457
|
+
const r = qe(
|
|
458
458
|
t.gridProps.data,
|
|
459
459
|
e,
|
|
460
460
|
t.columnsRef,
|
|
@@ -481,7 +481,7 @@ const kn = (t, I, h, S) => {
|
|
|
481
481
|
endDataItem: u
|
|
482
482
|
};
|
|
483
483
|
z(m, i);
|
|
484
|
-
},
|
|
484
|
+
}, mt = (e) => {
|
|
485
485
|
t.gridProps.onSelectionChange && g.enabled && z(e, {});
|
|
486
486
|
}, F = (e, n, o, r, i) => {
|
|
487
487
|
ht();
|
|
@@ -493,7 +493,7 @@ const kn = (t, I, h, S) => {
|
|
|
493
493
|
...R(r),
|
|
494
494
|
targetEvent: i || {},
|
|
495
495
|
dataState: {
|
|
496
|
-
...
|
|
496
|
+
...Dt(),
|
|
497
497
|
...o
|
|
498
498
|
}
|
|
499
499
|
});
|
|
@@ -506,17 +506,17 @@ const kn = (t, I, h, S) => {
|
|
|
506
506
|
n,
|
|
507
507
|
o
|
|
508
508
|
);
|
|
509
|
-
},
|
|
509
|
+
}, Pt = (e, n, o) => {
|
|
510
510
|
var r;
|
|
511
511
|
t.gridProps.pageable || (r = t.gridProps.group) != null && r.length ? t.gridProps.virtualSkipRef && (t.gridProps.virtualSkipRef.current = e.skip, O()) : te(e, n, o);
|
|
512
|
-
},
|
|
512
|
+
}, Te = () => {
|
|
513
513
|
let e = t.gridProps.total || 0;
|
|
514
514
|
return Array.isArray(t.gridProps.data) ? e = e || t.gridProps.data.length : t.gridProps.data && (e = e || t.gridProps.data.total), e;
|
|
515
515
|
}, ht = () => {
|
|
516
516
|
y && t.gridProps.virtualSkipRef && (t.gridProps.virtualSkipRef.current = 0);
|
|
517
517
|
}, Rt = (e) => {
|
|
518
518
|
var i, d;
|
|
519
|
-
const n = (d = (i = t.gridProps.take) != null ? i : t.gridProps.pageSize) != null ? d : 0, o = (t.gridProps.skip || 0) + n, r =
|
|
519
|
+
const n = (d = (i = t.gridProps.take) != null ? i : t.gridProps.pageSize) != null ? d : 0, o = (t.gridProps.skip || 0) + n, r = Te();
|
|
520
520
|
o < r && te({ skip: o, take: n }, e);
|
|
521
521
|
}, bt = (e) => {
|
|
522
522
|
var r, i;
|
|
@@ -524,7 +524,7 @@ const kn = (t, I, h, S) => {
|
|
|
524
524
|
o >= 0 && te({ skip: o, take: n }, e);
|
|
525
525
|
}, vt = (e) => {
|
|
526
526
|
te({ skip: e.skip, take: e.take }, e.syntheticEvent, e.targetEvent);
|
|
527
|
-
},
|
|
527
|
+
}, He = (e, n) => {
|
|
528
528
|
F(
|
|
529
529
|
t.gridProps.onSortChange,
|
|
530
530
|
{ sort: e },
|
|
@@ -540,17 +540,17 @@ const kn = (t, I, h, S) => {
|
|
|
540
540
|
);
|
|
541
541
|
}, Ct = (e) => {
|
|
542
542
|
if (!e || e.length === 0) {
|
|
543
|
-
|
|
543
|
+
Ae({});
|
|
544
544
|
return;
|
|
545
545
|
}
|
|
546
|
-
const n =
|
|
546
|
+
const n = qe(
|
|
547
547
|
t.gridProps.data,
|
|
548
548
|
e,
|
|
549
549
|
t.columnsRef,
|
|
550
550
|
t.gridProps.dataItemKey
|
|
551
551
|
);
|
|
552
|
-
|
|
553
|
-
},
|
|
552
|
+
Ae({ ...n });
|
|
553
|
+
}, Ae = (e) => {
|
|
554
554
|
F(
|
|
555
555
|
t.gridProps.onHighlightChange,
|
|
556
556
|
{ highlight: e },
|
|
@@ -644,7 +644,7 @@ const kn = (t, I, h, S) => {
|
|
|
644
644
|
return;
|
|
645
645
|
const r = t.gridProps.group.slice();
|
|
646
646
|
r.splice(n, 0, ...r.splice(e, 1)), fe(r, o);
|
|
647
|
-
},
|
|
647
|
+
}, Ge = (e, n, o) => {
|
|
648
648
|
const r = t.columnsRef[e].field;
|
|
649
649
|
if (!r)
|
|
650
650
|
return;
|
|
@@ -652,12 +652,12 @@ const kn = (t, I, h, S) => {
|
|
|
652
652
|
i.splice(n, 0, { field: r }), fe(i, o);
|
|
653
653
|
}, xt = (e, n) => {
|
|
654
654
|
const o = K.current.getCurrentGroupsLength;
|
|
655
|
-
|
|
655
|
+
Ge(e, o, n);
|
|
656
656
|
}, Pe = () => {
|
|
657
657
|
let e = 0;
|
|
658
|
-
if (!
|
|
658
|
+
if (!D.current.colGroupMain)
|
|
659
659
|
return;
|
|
660
|
-
const n =
|
|
660
|
+
const n = D.current.colGroupMain.children;
|
|
661
661
|
for (let o = 0; o < n.length; o++) {
|
|
662
662
|
const r = n[o].width;
|
|
663
663
|
if (!r) {
|
|
@@ -667,7 +667,7 @@ const kn = (t, I, h, S) => {
|
|
|
667
667
|
e += parseFloat(r.toString());
|
|
668
668
|
}
|
|
669
669
|
e = Math.round(e), q.current && q.current.setWidth(e), _.current && _.current.setWidth(e), H.current && (H.current.style.width = e ? e + "px" : "");
|
|
670
|
-
},
|
|
670
|
+
}, Le = () => {
|
|
671
671
|
var e;
|
|
672
672
|
t.gridProps.widthRef && (t.gridProps.widthRef.current = ((e = A.current) == null ? void 0 : e.offsetWidth) || 0);
|
|
673
673
|
}, re = () => {
|
|
@@ -682,7 +682,7 @@ const kn = (t, I, h, S) => {
|
|
|
682
682
|
}, oe = a.useCallback(
|
|
683
683
|
(e, n, o, r, i) => {
|
|
684
684
|
var u;
|
|
685
|
-
if (!
|
|
685
|
+
if (!kt() && !o || !e)
|
|
686
686
|
return;
|
|
687
687
|
const d = {
|
|
688
688
|
type: e,
|
|
@@ -697,9 +697,9 @@ const kn = (t, I, h, S) => {
|
|
|
697
697
|
event: d,
|
|
698
698
|
data: l,
|
|
699
699
|
selectedState: (u = t.gridProps.select) != null ? u : {},
|
|
700
|
-
previousCopiedItems:
|
|
700
|
+
previousCopiedItems: Be.current
|
|
701
701
|
});
|
|
702
|
-
e !==
|
|
702
|
+
e !== ke.paste && (Be.current = s.copiedItems), t.gridProps.onClipboard && I && c(t.gridProps.onClipboard, {
|
|
703
703
|
...d,
|
|
704
704
|
...s
|
|
705
705
|
});
|
|
@@ -711,13 +711,13 @@ const kn = (t, I, h, S) => {
|
|
|
711
711
|
t.gridProps.clipboard,
|
|
712
712
|
t.gridProps.onClipboard
|
|
713
713
|
]
|
|
714
|
-
),
|
|
714
|
+
), kt = () => {
|
|
715
715
|
var i, d, l;
|
|
716
716
|
if (!Q)
|
|
717
717
|
return !1;
|
|
718
|
-
const e = jt(
|
|
718
|
+
const e = jt(k()), n = e ? e.matches(".k-table-td") ? e : (i = k()) == null ? void 0 : i.body : (d = k()) == null ? void 0 : d.body, o = n.closest(".k-grid-container"), r = n && ((l = A.current) == null ? void 0 : l.contains(n));
|
|
719
719
|
return !!(n && r && o);
|
|
720
|
-
},
|
|
720
|
+
}, ze = (e, n, o, r, i, d, l) => {
|
|
721
721
|
Pe(), le.current = !0, be.current = !0, t.gridProps.onColumnResize && I && c(t.gridProps.onColumnResize, {
|
|
722
722
|
columns: ee(),
|
|
723
723
|
nativeEvent: r,
|
|
@@ -728,7 +728,7 @@ const kn = (t, I, h, S) => {
|
|
|
728
728
|
end: i,
|
|
729
729
|
target: C.current
|
|
730
730
|
}), i && me(d);
|
|
731
|
-
},
|
|
731
|
+
}, Dt = () => {
|
|
732
732
|
var e;
|
|
733
733
|
return {
|
|
734
734
|
filter: t.gridProps.filter,
|
|
@@ -763,7 +763,7 @@ const kn = (t, I, h, S) => {
|
|
|
763
763
|
(i) => !xe.current.includes(i)
|
|
764
764
|
)[0] : r.length === 1 && (de.current = r[0], Ce.current = !0), xe.current = r;
|
|
765
765
|
}
|
|
766
|
-
}, w = () => t.dataRef.filter((e) => e.rowType === "data").map((e) => e.dataItem),
|
|
766
|
+
}, w = () => t.dataRef.filter((e) => e.rowType === "data").map((e) => e.dataItem), k = () => {
|
|
767
767
|
var e;
|
|
768
768
|
if (Q)
|
|
769
769
|
return ((e = ie()) == null ? void 0 : e.ownerDocument) || document;
|
|
@@ -783,13 +783,13 @@ const kn = (t, I, h, S) => {
|
|
|
783
783
|
}
|
|
784
784
|
},
|
|
785
785
|
[t.gridProps.scrollable]
|
|
786
|
-
),
|
|
786
|
+
), Fe = (e) => JSON.stringify(e.map((n) => ({ id: n.id, field: n.field, title: n.title, children: n.children }))), Tt = () => Fe(Ot) === Fe(t.columnsRef), Ht = () => {
|
|
787
787
|
ce.current = window.innerWidth, Tt() || O();
|
|
788
788
|
}, At = () => {
|
|
789
789
|
var d;
|
|
790
790
|
const { virtualTotal: e, virtualPageSize: n, gridProps: o } = t, r = b.current, i = t.gridProps.rowHeight || ((d = o.minRowHeightRef) == null ? void 0 : d.current) || 0;
|
|
791
|
-
r && (r.fixedScroll = o.fixedScroll || !1, r.PageChange =
|
|
792
|
-
},
|
|
791
|
+
r && (r.fixedScroll = o.fixedScroll || !1, r.PageChange = Pt, r.pageSize = n, r.scrollableVirtual = y, r.container = T.current, r.tableBody = U.current, r.scrollHeightContainer = Ne.current, r.table = H.current, (!r.rowHeightService || r.total !== e) && i && (r.total = e, r.rowHeightService = new $t(e, i)));
|
|
792
|
+
}, Oe = a.useCallback(
|
|
793
793
|
(e) => {
|
|
794
794
|
const n = { rowIndex: ye.current };
|
|
795
795
|
e.forEach((o) => {
|
|
@@ -799,7 +799,7 @@ const kn = (t, I, h, S) => {
|
|
|
799
799
|
[he]
|
|
800
800
|
), O = () => {
|
|
801
801
|
t.gridProps.forceUpdate && t.gridProps.forceUpdate();
|
|
802
|
-
}, Gt = (e) => e.left !== void 0 ? Se !== "rtl" ? { left: e.left, right: e.right } : { left: e.right, right: e.left } : {}, C = a.useRef(null), b = a.useRef(void 0),
|
|
802
|
+
}, Gt = (e) => e.left !== void 0 ? Se !== "rtl" ? { left: e.left, right: e.right } : { left: e.right, right: e.left } : {}, C = a.useRef(null), b = a.useRef(void 0), D = a.useRef(void 0), K = a.useRef(void 0), M = a.useRef(void 0), N = a.useRef(void 0), ae = a.useRef(void 0), B = a.useRef(null), U = a.useRef(null), Lt = a.useRef(null), T = a.useRef(null), H = a.useRef(null), Re = a.useRef(null), A = a.useRef(null), Ne = a.useRef(null), _ = a.useRef(null), q = a.useRef(null), be = a.useRef(!1), ve = a.useRef(!1), de = a.useRef(void 0), Ie = a.useRef(void 0), Ce = a.useRef(!1), le = a.useRef(!0), Ee = a.useRef(0), we = a.useRef(void 0), ye = a.useRef(void 0), xe = a.useRef([]), Be = a.useRef([]), ce = a.useRef(0), $ = a.useRef(null), zt = a.useRef(null), Ft = a.useRef(null), Se = _t(A), y = t.isVirtualScroll, Ot = a.useMemo(() => a.Children.toArray(t.gridProps.children), [t.gridProps.children]), Ue = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, g = se(t.gridProps.selectable), Ve = Yt(t.gridProps.editable), Nt = ce.current && W && ce.current <= W.medium && t.gridProps.adaptive;
|
|
803
803
|
return a.useMemo(() => {
|
|
804
804
|
V.onConstructor({
|
|
805
805
|
navigatable: !!t.gridProps.navigatable,
|
|
@@ -815,12 +815,12 @@ const kn = (t, I, h, S) => {
|
|
|
815
815
|
t.gridProps.total,
|
|
816
816
|
t.gridProps.filter,
|
|
817
817
|
t.gridProps.group,
|
|
818
|
-
|
|
818
|
+
Ue,
|
|
819
819
|
t.gridProps.sort,
|
|
820
820
|
t.gridProps.rowHeight
|
|
821
|
-
]), a.useEffect(() => (t.gridProps.clipboard && (ae.current = new Qt(oe), ae.current.addEventListeners(
|
|
822
|
-
ae.current && ae.current.removeEventListeners(
|
|
823
|
-
}), [t.gridProps.onClipboard, t.gridProps.clipboard, oe,
|
|
821
|
+
]), a.useEffect(() => (t.gridProps.clipboard && (ae.current = new Qt(oe), ae.current.addEventListeners(k())), () => {
|
|
822
|
+
ae.current && ae.current.removeEventListeners(k());
|
|
823
|
+
}), [t.gridProps.onClipboard, t.gridProps.clipboard, oe, k]), a.useEffect(() => (t.gridProps.columnVirtualization && !window.navigator.userAgent.match(fn) && (Re.current && (Re.current.style.display = "block"), H.current && (H.current.style.display = "block")), Le(), Pe(), We(), V.onComponentDidMount({
|
|
824
824
|
scope: A.current || void 0,
|
|
825
825
|
contextStateRef: M,
|
|
826
826
|
navigationStateRef: N
|
|
@@ -828,7 +828,7 @@ const kn = (t, I, h, S) => {
|
|
|
828
828
|
clearTimeout(we.current);
|
|
829
829
|
}), []), a.useEffect(() => {
|
|
830
830
|
var e;
|
|
831
|
-
|
|
831
|
+
Le(), Pe(), We(), y && (re(), St(), (e = b.current) == null || e.update()), Mt(), V.onComponentDidUpdate({
|
|
832
832
|
scope: A.current || void 0,
|
|
833
833
|
contextStateRef: M,
|
|
834
834
|
navigationStateRef: N,
|
|
@@ -844,14 +844,14 @@ const kn = (t, I, h, S) => {
|
|
|
844
844
|
rootMargin: "0px",
|
|
845
845
|
threshold: 0.9
|
|
846
846
|
};
|
|
847
|
-
B.current = window.IntersectionObserver && new window.IntersectionObserver(
|
|
847
|
+
B.current = window.IntersectionObserver && new window.IntersectionObserver(Oe, e) || null;
|
|
848
848
|
}
|
|
849
|
-
}, [
|
|
849
|
+
}, [Oe]), a.useEffect(() => {
|
|
850
850
|
var n;
|
|
851
851
|
let e;
|
|
852
852
|
return Q && window.ResizeObserver && (e = new window.ResizeObserver(() => {
|
|
853
853
|
Ht(), y && re();
|
|
854
|
-
}), e.observe((n =
|
|
854
|
+
}), e.observe((n = k()) == null ? void 0 : n.body)), () => {
|
|
855
855
|
e == null || e.disconnect();
|
|
856
856
|
};
|
|
857
857
|
}, []), a.useEffect(() => {
|
|
@@ -891,21 +891,21 @@ const kn = (t, I, h, S) => {
|
|
|
891
891
|
}
|
|
892
892
|
},
|
|
893
893
|
fitColumns: (e) => {
|
|
894
|
-
|
|
894
|
+
D.current.dblClickHandler(null, e);
|
|
895
895
|
},
|
|
896
896
|
exportAsPdf: ge
|
|
897
897
|
})
|
|
898
898
|
), a.useImperativeHandle(t.gridRef, () => C.current), a.useMemo(() => {
|
|
899
|
-
|
|
899
|
+
D.current = new un(ze);
|
|
900
900
|
}, [t.gridProps.onColumnResize, t.columnsRef]), a.useMemo(() => {
|
|
901
|
-
K.current = new gn(ne, yt,
|
|
901
|
+
K.current = new gn(ne, yt, Ge);
|
|
902
902
|
}, [
|
|
903
903
|
t.gridProps.onColumnReorder,
|
|
904
904
|
t.gridProps.onGroupChange,
|
|
905
905
|
t.gridProps.group,
|
|
906
906
|
t.columnsRef,
|
|
907
907
|
t.gridProps.groupable
|
|
908
|
-
]),
|
|
908
|
+
]), D.current.resizable = t.gridProps.resizable || !1, D.current.columns = t.columnsRef, D.current.columnsState = qt(t.columnsState), K.current.reorderable = t.gridProps.reorderable || !1, K.current.groupable = Ue, K.current.columns = t.columnsRef, K.current.dir = Se, At(), /* @__PURE__ */ a.createElement(
|
|
909
909
|
Sn.Provider,
|
|
910
910
|
{
|
|
911
911
|
value: {
|
|
@@ -926,45 +926,51 @@ const kn = (t, I, h, S) => {
|
|
|
926
926
|
reorderable: t.gridProps.reorderable,
|
|
927
927
|
defaultGroup: t.gridProps.defaultGroup,
|
|
928
928
|
groupChange: fe,
|
|
929
|
-
selectionRelease:
|
|
929
|
+
selectionRelease: st,
|
|
930
930
|
pagerPageChange: vt,
|
|
931
|
-
onContextMenu:
|
|
932
|
-
rowClick:
|
|
933
|
-
rowDblClick:
|
|
934
|
-
cellClick:
|
|
931
|
+
onContextMenu: Xe,
|
|
932
|
+
rowClick: pe,
|
|
933
|
+
rowDblClick: et,
|
|
934
|
+
cellClick: rt,
|
|
935
935
|
headerCellClick: Me,
|
|
936
|
-
itemChange:
|
|
937
|
-
onDialogEditCancel:
|
|
938
|
-
onDialogEditSubmit:
|
|
936
|
+
itemChange: at,
|
|
937
|
+
onDialogEditCancel: nt,
|
|
938
|
+
onDialogEditSubmit: tt,
|
|
939
939
|
columnReorder: ne,
|
|
940
|
-
onResize:
|
|
940
|
+
onResize: ze,
|
|
941
|
+
getTotal: Te,
|
|
941
942
|
sortable: t.gridProps.sortable,
|
|
943
|
+
pageable: t.gridProps.pageable,
|
|
944
|
+
pageSize: t.gridProps.pageSize,
|
|
942
945
|
sort: t.gridProps.sort,
|
|
946
|
+
skip: t.gridProps.skip,
|
|
947
|
+
take: t.gridProps.take,
|
|
943
948
|
defaultSort: t.gridProps.defaultSort,
|
|
944
|
-
sortChange:
|
|
949
|
+
sortChange: He,
|
|
945
950
|
filterable: t.gridProps.filterable,
|
|
946
951
|
filter: t.gridProps.filter,
|
|
947
952
|
defaultFilter: t.gridProps.defaultFilter,
|
|
948
|
-
filterOperators: t.gridProps.filterOperators ||
|
|
953
|
+
filterOperators: t.gridProps.filterOperators || kn,
|
|
954
|
+
getLeafDataItems: w,
|
|
949
955
|
filterChange: It,
|
|
950
956
|
applyHighlightDescriptor: Ct,
|
|
951
|
-
applySelectionDescriptor:
|
|
957
|
+
applySelectionDescriptor: ft,
|
|
952
958
|
highlight: t.gridProps.highlight,
|
|
953
959
|
searchChange: Et,
|
|
954
960
|
exportAsPdf: ge,
|
|
955
|
-
onHeaderSelectionChange:
|
|
961
|
+
onHeaderSelectionChange: ct,
|
|
956
962
|
columnGroupChange: xt,
|
|
957
|
-
onKeyDown:
|
|
958
|
-
onFocus:
|
|
959
|
-
scrollHandler:
|
|
960
|
-
selectionChange:
|
|
963
|
+
onKeyDown: Ye,
|
|
964
|
+
onFocus: Qe,
|
|
965
|
+
scrollHandler: Je,
|
|
966
|
+
selectionChange: dt,
|
|
961
967
|
mobileMode: Nt,
|
|
962
968
|
adaptiveColumnMenuRef: ce.current,
|
|
963
969
|
adpativeTitle: t.gridProps.adaptiveTitle,
|
|
964
970
|
adaptive: t.gridProps.adaptive,
|
|
965
|
-
dispatchDetailExpand:
|
|
966
|
-
dispatchGroupExpand:
|
|
967
|
-
columnResizeRef:
|
|
971
|
+
dispatchDetailExpand: ot,
|
|
972
|
+
dispatchGroupExpand: it,
|
|
973
|
+
columnResizeRef: D,
|
|
968
974
|
dragLogicRef: K,
|
|
969
975
|
navigationStateRef: N,
|
|
970
976
|
tableElementRef: H,
|
|
@@ -973,7 +979,7 @@ const kn = (t, I, h, S) => {
|
|
|
973
979
|
containerElementRef: T,
|
|
974
980
|
headTableElementRef: Re,
|
|
975
981
|
elementRef: A,
|
|
976
|
-
virtualScrollHeightContainerRef:
|
|
982
|
+
virtualScrollHeightContainerRef: Ne,
|
|
977
983
|
footerRef: _,
|
|
978
984
|
headerRef: q,
|
|
979
985
|
vsRef: b
|
|
@@ -989,7 +995,7 @@ const kn = (t, I, h, S) => {
|
|
|
989
995
|
items: p,
|
|
990
996
|
offset: h.offset,
|
|
991
997
|
onClose: L,
|
|
992
|
-
onSelect:
|
|
998
|
+
onSelect: $e
|
|
993
999
|
}
|
|
994
1000
|
),
|
|
995
1001
|
t.gridProps.pdf && /* @__PURE__ */ a.createElement(
|