@progress/kendo-react-grid 11.4.0-develop.4 → 11.4.0-develop.6
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 +116 -112
- package/README.md +16 -0
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/filterCommon.js +1 -1
- package/filterCommon.mjs +75 -31
- package/index.d.mts +28 -1
- package/index.d.ts +28 -1
- package/index.js +1 -1
- package/index.mjs +38 -36
- 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 +110 -117
- package/toolbar-tools/ai-tool/GridAIPrompt.js +2 -2
- package/toolbar-tools/ai-tool/GridAIPrompt.mjs +45 -42
- package/utils/premium.js +1 -1
- package/utils/premium.mjs +3 -3
package/GridClientWrapper.mjs
CHANGED
|
@@ -7,28 +7,28 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as a from "react";
|
|
10
|
-
import { useAdaptiveModeContext as Ut, canUseDOM as ae, getActiveElement as Vt, useDir as Wt, setScrollbarWidth as
|
|
10
|
+
import { useAdaptiveModeContext as Ut, canUseDOM as ae, getActiveElement as Vt, useDir as Wt, setScrollbarWidth as Be, cloneArray as jt, getter as de, RowHeightService as _t } from "@progress/kendo-react-common";
|
|
11
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
|
|
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 Ue, getSelectedStateFromKeyDown as rn, closestTagName as Ve, getColumnIndex as on, getRowIndex as an, updateLeft as dn, updateRight as cn } from "@progress/kendo-react-data-tools";
|
|
13
13
|
import { ColumnResize as ln } from "./drag/ColumnResize.mjs";
|
|
14
14
|
import { CommonDragLogic as sn } from "./drag/CommonDragLogic.mjs";
|
|
15
15
|
import { SAFARI_REGEX as gn } from "./constants/index.mjs";
|
|
16
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
17
|
import { VirtualScroll as vn } from "./VirtualScroll.mjs";
|
|
18
18
|
import { GridContextMenu as Cn } from "./contextMenu/GridContextMenu.mjs";
|
|
19
|
-
import { GridContextMenuAnchorPart as
|
|
19
|
+
import { GridContextMenuAnchorPart as We } from "./contextMenu/enums.mjs";
|
|
20
20
|
import { normalizeSortable as In, firstLevelSortSeqMap as En } from "./sortCommon.mjs";
|
|
21
21
|
import { BasePDFExport as wn } from "./BasePDFExport.mjs";
|
|
22
22
|
import { GridContext as yn } from "./utils/GridContext.mjs";
|
|
23
23
|
import { operators as Sn } from "./filterCommon.mjs";
|
|
24
24
|
const xn = (t, v, u, y) => {
|
|
25
|
-
const N = Object.keys(v.cells).map((E) => u.findIndex((
|
|
26
|
-
return t.reduce((E,
|
|
27
|
-
},
|
|
28
|
-
...
|
|
25
|
+
const N = Object.keys(v.cells).map((E) => u.findIndex((A) => A.field === E)), H = Object.keys(v.cells).length > 0 ? N : !0;
|
|
26
|
+
return t.reduce((E, A) => (E[A[y != null ? y : "id"]] = H, E), {});
|
|
27
|
+
}, kn = (t, v, u, y) => v.reduce((H, E) => ({
|
|
28
|
+
...H,
|
|
29
29
|
...xn(qt(t, E), E, u, y)
|
|
30
30
|
}), {}), Wn = (t) => {
|
|
31
|
-
const v = t.gridProps.isClient, [u, y] = a.useState({}), N = Ut(),
|
|
31
|
+
const v = t.gridProps.isClient, [u, y] = a.useState({}), N = Ut(), H = a.useRef(null), E = (e) => {
|
|
32
32
|
e.event.preventDefault(), y({
|
|
33
33
|
...u,
|
|
34
34
|
show: !0,
|
|
@@ -39,7 +39,7 @@ const xn = (t, v, u, y) => {
|
|
|
39
39
|
dataItem: e.dataItem,
|
|
40
40
|
field: e.field
|
|
41
41
|
});
|
|
42
|
-
},
|
|
42
|
+
}, A = () => {
|
|
43
43
|
y({});
|
|
44
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);
|
|
@@ -49,7 +49,7 @@ const xn = (t, v, u, y) => {
|
|
|
49
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]), ke = a.useMemo(() => {
|
|
53
53
|
const e = t.gridProps.sortable && (h == null ? void 0 : h.sortable);
|
|
54
54
|
return fn({
|
|
55
55
|
pdf: !!t.gridProps.pdf,
|
|
@@ -61,10 +61,10 @@ const xn = (t, v, u, y) => {
|
|
|
61
61
|
}, [h, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), J = a.useMemo(() => {
|
|
62
62
|
const e = (h == null ? void 0 : h.contextMenu) || t.gridProps.contextMenu, n = typeof e == "function" ? e(u) : e;
|
|
63
63
|
if (n && u.offset) {
|
|
64
|
-
const o = u.dataItem ?
|
|
64
|
+
const o = u.dataItem ? We.body : We.head, r = n[o], i = u.dataItem ? ke : xe;
|
|
65
65
|
return r === !1 ? void 0 : r === !0 || r === void 0 ? i : r;
|
|
66
66
|
}
|
|
67
|
-
}, [t.gridProps.contextMenu, u,
|
|
67
|
+
}, [t.gridProps.contextMenu, u, ke, xe, h]), je = (e) => {
|
|
68
68
|
var c, s, g, P, I, ie, b, q, $;
|
|
69
69
|
const n = e.event.item, o = {
|
|
70
70
|
target: C.current,
|
|
@@ -95,20 +95,20 @@ const xn = (t, v, u, y) => {
|
|
|
95
95
|
case "SortCommand":
|
|
96
96
|
if (h) {
|
|
97
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
|
-
|
|
98
|
+
De(e.event.syntheticEvent, h, Bt);
|
|
99
99
|
}
|
|
100
100
|
break;
|
|
101
101
|
case "SelectRowCommand":
|
|
102
|
-
|
|
102
|
+
lt(i);
|
|
103
103
|
break;
|
|
104
104
|
case "SelectAllRowsCommand":
|
|
105
|
-
|
|
105
|
+
ct(i);
|
|
106
106
|
break;
|
|
107
107
|
case "ExportPDFCommand":
|
|
108
108
|
le();
|
|
109
109
|
break;
|
|
110
110
|
case "ClearSelectionCommand":
|
|
111
|
-
|
|
111
|
+
st(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");
|
|
@@ -136,11 +136,11 @@ const xn = (t, v, u, y) => {
|
|
|
136
136
|
);
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
A();
|
|
140
140
|
}, Y = () => {
|
|
141
141
|
const e = t.columnsRef.filter((n) => n.declarationIndex >= 0 && n.parentIndex === -1);
|
|
142
142
|
return Pn(e);
|
|
143
|
-
},
|
|
143
|
+
}, _e = (e, n, o) => {
|
|
144
144
|
if (t.gridProps.onContextMenu && v) {
|
|
145
145
|
const r = {
|
|
146
146
|
target: C.current,
|
|
@@ -156,22 +156,22 @@ const xn = (t, v, u, y) => {
|
|
|
156
156
|
dataItem: n,
|
|
157
157
|
field: o
|
|
158
158
|
});
|
|
159
|
-
},
|
|
159
|
+
}, qe = (e) => {
|
|
160
160
|
if (e.target !== e.currentTarget)
|
|
161
161
|
return;
|
|
162
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 && (!
|
|
164
|
+
t.gridProps.columnVirtualization && (!k || o === Ce.current) && (Ie.current = window.setTimeout(() => {
|
|
165
165
|
U();
|
|
166
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
|
+
}, $e = (e) => {
|
|
170
170
|
O.onKeyDown(e, {
|
|
171
171
|
navigatable: t.gridProps.navigatable || !1,
|
|
172
172
|
contextStateRef: K,
|
|
173
173
|
navigationStateRef: L,
|
|
174
|
-
onNavigationAction:
|
|
174
|
+
onNavigationAction: Je,
|
|
175
175
|
columns: Y()
|
|
176
176
|
}), O.onGetSnapshotBeforeUpdate({
|
|
177
177
|
document: S(),
|
|
@@ -187,13 +187,13 @@ const xn = (t, v, u, y) => {
|
|
|
187
187
|
...f(e)
|
|
188
188
|
};
|
|
189
189
|
t.gridProps.onKeyDown && v && l(t.gridProps.onKeyDown, n);
|
|
190
|
-
},
|
|
190
|
+
}, Xe = (e) => {
|
|
191
191
|
O.onFocus(e, {
|
|
192
192
|
navigatable: !!t.gridProps.navigatable,
|
|
193
193
|
contextStateRef: K
|
|
194
194
|
});
|
|
195
|
-
},
|
|
196
|
-
if (e.action === "moveToNextPage" &&
|
|
195
|
+
}, Je = (e) => {
|
|
196
|
+
if (e.action === "moveToNextPage" && mt(e.event), e.action === "moveToPrevPage" && Pt(e.event), e.focusElement && e.action === "reorderToRight") {
|
|
197
197
|
const n = parseInt(e.focusElement.ariaColIndex, 10) - 1;
|
|
198
198
|
n < t.columnsRef.length - 1 && ue(n, n + 1, e.event);
|
|
199
199
|
}
|
|
@@ -201,37 +201,37 @@ const xn = (t, v, u, y) => {
|
|
|
201
201
|
const n = parseInt(e.focusElement.ariaColIndex, 10) - 1;
|
|
202
202
|
n > 0 && ue(n, n - 1, e.event);
|
|
203
203
|
}
|
|
204
|
-
if (e.action === "select" &&
|
|
204
|
+
if (e.action === "select" && it(e.event), t.gridProps.onNavigationAction && v) {
|
|
205
205
|
const n = {
|
|
206
206
|
focusElement: e.focusElement,
|
|
207
207
|
...f(e.event)
|
|
208
208
|
};
|
|
209
209
|
l(t.gridProps.onNavigationAction, n);
|
|
210
210
|
}
|
|
211
|
-
},
|
|
211
|
+
}, Ye = (e, n) => {
|
|
212
212
|
t.gridProps.onRowClick && e.target.nodeName === "TD" && l(t.gridProps.onRowClick, {
|
|
213
213
|
dataItem: n,
|
|
214
214
|
...f(e)
|
|
215
215
|
});
|
|
216
|
-
},
|
|
216
|
+
}, Qe = (e, n) => {
|
|
217
217
|
t.gridProps.onRowDoubleClick && e.target.nodeName === "TD" && l(t.gridProps.onRowDoubleClick, {
|
|
218
218
|
dataItem: n,
|
|
219
219
|
...f(e)
|
|
220
220
|
});
|
|
221
|
-
},
|
|
221
|
+
}, Ze = (e) => {
|
|
222
222
|
t.gridProps.onItemChange && l(t.gridProps.onItemChange, {
|
|
223
223
|
...f(e.syntheticEvent),
|
|
224
224
|
dataItem: e.dataItem,
|
|
225
225
|
field: void 0,
|
|
226
226
|
value: void 0
|
|
227
227
|
});
|
|
228
|
-
},
|
|
228
|
+
}, pe = (e) => {
|
|
229
229
|
t.gridProps.onItemChange && t.gridProps.onEditChange && l(t.gridProps.onEditChange, {
|
|
230
230
|
edit: {},
|
|
231
231
|
...f(e.syntheticEvent)
|
|
232
232
|
});
|
|
233
|
-
},
|
|
234
|
-
if (
|
|
233
|
+
}, et = (e, n, o) => {
|
|
234
|
+
if (Ne.enabled && Ne.mode === "incell" && t.gridProps.dataItemKey) {
|
|
235
235
|
const r = Qt(t.gridProps.edit, {
|
|
236
236
|
type: Zt.ENTER_FIELD_EDIT,
|
|
237
237
|
payload: { id: n[t.gridProps.dataItemKey], field: o }
|
|
@@ -241,7 +241,7 @@ const xn = (t, v, u, y) => {
|
|
|
241
241
|
...f(e)
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
|
-
},
|
|
244
|
+
}, tt = (e, n) => {
|
|
245
245
|
var r;
|
|
246
246
|
if (pt(t.detailExpandable).enabled) {
|
|
247
247
|
const i = en((r = t.gridProps.detailExpand) != null ? r : {}, e);
|
|
@@ -250,7 +250,7 @@ const xn = (t, v, u, y) => {
|
|
|
250
250
|
detailExpand: i
|
|
251
251
|
});
|
|
252
252
|
}
|
|
253
|
-
},
|
|
253
|
+
}, nt = (e, n) => {
|
|
254
254
|
var r;
|
|
255
255
|
const o = tn(
|
|
256
256
|
typeof t.gridProps.groupable == "object" ? t.gridProps.groupable.expandable !== !1 : t.gridProps.groupable
|
|
@@ -262,13 +262,13 @@ const xn = (t, v, u, y) => {
|
|
|
262
262
|
groupExpand: i
|
|
263
263
|
});
|
|
264
264
|
}
|
|
265
|
-
},
|
|
265
|
+
}, De = (e, n, o) => {
|
|
266
266
|
const { allowUnsort: r, mode: i } = In(
|
|
267
267
|
t.gridProps.sortable || !1,
|
|
268
268
|
n.sortable || !1
|
|
269
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
270
|
c !== "" && n.field && s.push({ field: n.field, dir: c }), Ke(s, e);
|
|
271
|
-
},
|
|
271
|
+
}, rt = (e) => {
|
|
272
272
|
t.gridProps.onItemChange && l(t.gridProps.onItemChange, {
|
|
273
273
|
...f(e.syntheticEvent),
|
|
274
274
|
dataItem: e.dataItem,
|
|
@@ -276,7 +276,7 @@ const xn = (t, v, u, y) => {
|
|
|
276
276
|
field: e.field,
|
|
277
277
|
value: e.value
|
|
278
278
|
});
|
|
279
|
-
},
|
|
279
|
+
}, ot = (e) => {
|
|
280
280
|
var n;
|
|
281
281
|
if (t.gridProps.onSelectionChange && R.enabled) {
|
|
282
282
|
const { event: o, dataItem: r, dataIndex: i, columnIndex: d } = e, c = {
|
|
@@ -299,14 +299,14 @@ const xn = (t, v, u, y) => {
|
|
|
299
299
|
};
|
|
300
300
|
l(t.gridProps.onSelectionChange, {
|
|
301
301
|
...c,
|
|
302
|
-
select: t.gridProps.dataItemKey ?
|
|
302
|
+
select: t.gridProps.dataItemKey ? Ue({
|
|
303
303
|
event: c,
|
|
304
304
|
selectedState: (n = t.gridProps.select) != null ? n : {},
|
|
305
305
|
dataItemKey: t.gridProps.dataItemKey
|
|
306
306
|
}) : {}
|
|
307
307
|
});
|
|
308
308
|
}
|
|
309
|
-
},
|
|
309
|
+
}, it = (e) => {
|
|
310
310
|
var g, P;
|
|
311
311
|
if (!R.enabled || !t.gridProps.dataItemKey)
|
|
312
312
|
return;
|
|
@@ -324,7 +324,7 @@ const xn = (t, v, u, y) => {
|
|
|
324
324
|
});
|
|
325
325
|
if (o === t.gridProps.select)
|
|
326
326
|
return;
|
|
327
|
-
const r = e.target, i =
|
|
327
|
+
const r = e.target, i = Ve(r, "TD"), d = Ve(r, "TR"), c = on(i), s = an(d);
|
|
328
328
|
if (c !== void 0 && s !== void 0) {
|
|
329
329
|
const I = (P = hn(t.gridProps.data)) == null ? void 0 : P[s];
|
|
330
330
|
t.gridProps.onSelectionChange && l(t.gridProps.onSelectionChange, {
|
|
@@ -344,7 +344,7 @@ const xn = (t, v, u, y) => {
|
|
|
344
344
|
isDrag: !1
|
|
345
345
|
});
|
|
346
346
|
}
|
|
347
|
-
},
|
|
347
|
+
}, at = (e) => {
|
|
348
348
|
if (t.gridProps.onHeaderSelectionChange && R.enabled) {
|
|
349
349
|
const n = w();
|
|
350
350
|
l(t.gridProps.onHeaderSelectionChange, {
|
|
@@ -361,7 +361,7 @@ const xn = (t, v, u, y) => {
|
|
|
361
361
|
...e,
|
|
362
362
|
select: n
|
|
363
363
|
});
|
|
364
|
-
},
|
|
364
|
+
}, dt = (e) => {
|
|
365
365
|
var n;
|
|
366
366
|
if (t.gridProps.onSelectionChange && R.enabled) {
|
|
367
367
|
const o = w()[e.startRowIndex], r = w()[e.endRowIndex], i = {
|
|
@@ -374,7 +374,7 @@ const xn = (t, v, u, y) => {
|
|
|
374
374
|
startDataItem: o,
|
|
375
375
|
endDataItem: r,
|
|
376
376
|
...e
|
|
377
|
-
}, d =
|
|
377
|
+
}, d = Ue({
|
|
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`
|
|
@@ -383,7 +383,7 @@ const xn = (t, v, u, y) => {
|
|
|
383
383
|
});
|
|
384
384
|
Q(i, d);
|
|
385
385
|
}
|
|
386
|
-
},
|
|
386
|
+
}, ct = (e) => {
|
|
387
387
|
if (t.gridProps.onSelectionChange && R.enabled) {
|
|
388
388
|
const n = e.dataItems[0], o = e.dataItems[e.dataItems.length - 1], r = {}, i = {
|
|
389
389
|
...e,
|
|
@@ -399,7 +399,7 @@ const xn = (t, v, u, y) => {
|
|
|
399
399
|
r[s] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0;
|
|
400
400
|
}), Q(i, r);
|
|
401
401
|
}
|
|
402
|
-
},
|
|
402
|
+
}, lt = (e) => {
|
|
403
403
|
if (t.gridProps.onSelectionChange && R.enabled) {
|
|
404
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]
|
|
@@ -414,10 +414,10 @@ const xn = (t, v, u, y) => {
|
|
|
414
414
|
}, P = e.mode === "multiple" ? t.gridProps.select || {} : {};
|
|
415
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
|
+
}, st = (e) => {
|
|
418
418
|
t.gridProps.onSelectionChange && R.enabled && Q(e, {});
|
|
419
419
|
}, G = (e, n, o, r, i) => {
|
|
420
|
-
|
|
420
|
+
ft();
|
|
421
421
|
const d = t.gridProps.onDataStateChange;
|
|
422
422
|
if (e) {
|
|
423
423
|
const c = { ...f(r), ...n, targetEvent: i };
|
|
@@ -432,54 +432,58 @@ const xn = (t, v, u, y) => {
|
|
|
432
432
|
});
|
|
433
433
|
}, Z = (e, n, o) => {
|
|
434
434
|
var r;
|
|
435
|
-
|
|
435
|
+
k && 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 },
|
|
439
439
|
n,
|
|
440
440
|
o
|
|
441
441
|
);
|
|
442
|
-
},
|
|
442
|
+
}, gt = (e, n, o) => {
|
|
443
443
|
var r;
|
|
444
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
|
+
}, ut = () => {
|
|
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
|
-
},
|
|
449
|
-
|
|
450
|
-
},
|
|
448
|
+
}, ft = () => {
|
|
449
|
+
k && t.gridProps.virtualSkipRef && (t.gridProps.virtualSkipRef.current = 0);
|
|
450
|
+
}, mt = (e) => {
|
|
451
451
|
var i, d;
|
|
452
|
-
const n = (d = (i = t.gridProps.take) != null ? i : t.gridProps.pageSize) != null ? d : 0, o = (t.gridProps.skip || 0) + n, r =
|
|
452
|
+
const n = (d = (i = t.gridProps.take) != null ? i : t.gridProps.pageSize) != null ? d : 0, o = (t.gridProps.skip || 0) + n, r = ut();
|
|
453
453
|
o < r && Z({ skip: o, take: n }, e);
|
|
454
|
-
},
|
|
454
|
+
}, Pt = (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
457
|
o >= 0 && Z({ skip: o, take: n }, e);
|
|
458
|
-
},
|
|
458
|
+
}, ht = (e) => {
|
|
459
459
|
Z({ skip: e.skip, take: e.take }, e.syntheticEvent, e.targetEvent);
|
|
460
460
|
}, Ke = (e, n) => {
|
|
461
461
|
G(
|
|
462
462
|
t.gridProps.onSortChange,
|
|
463
463
|
{ sort: e },
|
|
464
|
-
{ sort: e, ...
|
|
464
|
+
{ sort: e, ...k && !t.gridProps.pageable ? { skip: 0 } : {} },
|
|
465
465
|
n
|
|
466
466
|
);
|
|
467
|
-
},
|
|
467
|
+
}, Rt = (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
|
-
},
|
|
475
|
-
|
|
474
|
+
}, bt = (e) => {
|
|
475
|
+
if (!e || e.length === 0) {
|
|
476
|
+
Me({});
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
const n = kn(
|
|
476
480
|
t.gridProps.data,
|
|
477
481
|
e,
|
|
478
482
|
t.columnsRef,
|
|
479
483
|
t.gridProps.dataItemKey
|
|
480
|
-
);
|
|
481
|
-
|
|
482
|
-
},
|
|
484
|
+
), o = t.gridProps.highlight || {};
|
|
485
|
+
Me({ ...o, ...n });
|
|
486
|
+
}, Me = (e) => {
|
|
483
487
|
G(t.gridProps.onHighlightChange, { highlight: e }, {}, {});
|
|
484
488
|
}, vt = (e) => {
|
|
485
489
|
const n = t.gridProps.searchFields || t.columnsRef.map((i) => i.field) || [], o = e.nativeEvent.target.value, r = {
|
|
@@ -504,7 +508,7 @@ const xn = (t, v, u, y) => {
|
|
|
504
508
|
);
|
|
505
509
|
}, le = () => {
|
|
506
510
|
var e;
|
|
507
|
-
(e =
|
|
511
|
+
(e = H.current) == null || e.save();
|
|
508
512
|
}, Ct = async (e) => {
|
|
509
513
|
var n, o;
|
|
510
514
|
(n = t.gridProps) != null && n.onPdfExport && await ((o = t.gridProps) == null ? void 0 : o.onPdfExport(e));
|
|
@@ -568,15 +572,15 @@ const xn = (t, v, u, y) => {
|
|
|
568
572
|
return;
|
|
569
573
|
const r = t.gridProps.group.slice();
|
|
570
574
|
r.splice(n, 0, ...r.splice(e, 1)), se(r, o);
|
|
571
|
-
},
|
|
575
|
+
}, Te = (e, n, o) => {
|
|
572
576
|
const r = t.columnsRef[e].field;
|
|
573
577
|
if (!r)
|
|
574
578
|
return;
|
|
575
579
|
const i = (t.gridProps.group || []).slice();
|
|
576
580
|
i.splice(n, 0, { field: r }), se(i, o);
|
|
577
581
|
}, Et = (e, n) => {
|
|
578
|
-
const o =
|
|
579
|
-
|
|
582
|
+
const o = D.current.getCurrentGroupsLength;
|
|
583
|
+
Te(e, o, n);
|
|
580
584
|
}, fe = () => {
|
|
581
585
|
let e = 0;
|
|
582
586
|
if (!x.current.colGroupMain)
|
|
@@ -591,7 +595,7 @@ const xn = (t, v, u, y) => {
|
|
|
591
595
|
e += parseFloat(r.toString());
|
|
592
596
|
}
|
|
593
597
|
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
|
-
},
|
|
598
|
+
}, He = () => {
|
|
595
599
|
var e;
|
|
596
600
|
t.gridProps.widthRef && (t.gridProps.widthRef.current = ((e = T.current) == null ? void 0 : e.offsetWidth) || 0);
|
|
597
601
|
}, Ae = () => {
|
|
@@ -621,9 +625,9 @@ const xn = (t, v, u, y) => {
|
|
|
621
625
|
event: d,
|
|
622
626
|
data: c,
|
|
623
627
|
selectedState: (g = t.gridProps.select) != null ? g : {},
|
|
624
|
-
previousCopiedItems:
|
|
628
|
+
previousCopiedItems: ze.current
|
|
625
629
|
});
|
|
626
|
-
e !== Se.paste && (
|
|
630
|
+
e !== Se.paste && (ze.current = s.copiedItems), t.gridProps.onClipboard && v && l(t.gridProps.onClipboard, {
|
|
627
631
|
...d,
|
|
628
632
|
...s
|
|
629
633
|
});
|
|
@@ -665,7 +669,7 @@ const xn = (t, v, u, y) => {
|
|
|
665
669
|
nativeEvent: e && e.nativeEvent,
|
|
666
670
|
syntheticEvent: e,
|
|
667
671
|
target: C.current
|
|
668
|
-
}),
|
|
672
|
+
}), kt = (e) => ({
|
|
669
673
|
...e,
|
|
670
674
|
nativeEvent: void 0,
|
|
671
675
|
syntheticEvent: void 0,
|
|
@@ -677,8 +681,8 @@ const xn = (t, v, u, y) => {
|
|
|
677
681
|
e(n);
|
|
678
682
|
return;
|
|
679
683
|
}
|
|
680
|
-
e(
|
|
681
|
-
},
|
|
684
|
+
e(kt(n));
|
|
685
|
+
}, Dt = () => {
|
|
682
686
|
var e, n, o;
|
|
683
687
|
if (z.current && ((e = z.current) == null ? void 0 : e.getElementsByClassName("k-grid-edit-row").length) > 0) {
|
|
684
688
|
ve.current = !1, (n = document.activeElement) != null && n.closest(".k-grid-edit-row") ? be.current = document.activeElement : be.current = void 0;
|
|
@@ -698,7 +702,7 @@ const xn = (t, v, u, y) => {
|
|
|
698
702
|
return;
|
|
699
703
|
F.current && F.current.disconnect();
|
|
700
704
|
const { rowIndex: n } = e, o = ee();
|
|
701
|
-
if (
|
|
705
|
+
if (k) {
|
|
702
706
|
const d = ((i = m.current.rowHeightService) == null ? void 0 : i.offset(n)) || 0;
|
|
703
707
|
m.current.container.scroll(0, d);
|
|
704
708
|
} else if (o) {
|
|
@@ -707,13 +711,13 @@ const xn = (t, v, u, y) => {
|
|
|
707
711
|
}
|
|
708
712
|
},
|
|
709
713
|
[t.gridProps.scrollable]
|
|
710
|
-
),
|
|
714
|
+
), Ge = (e) => JSON.stringify(e.map((n) => ({ id: n.id, field: n.field, title: n.title, children: n.children }))), Kt = () => Ge(Ft) === Ge(t.columnsRef), Mt = () => {
|
|
711
715
|
oe.current = window.innerWidth, Kt() || U();
|
|
712
716
|
}, Tt = () => {
|
|
713
717
|
var d;
|
|
714
718
|
const { virtualTotal: e, virtualPageSize: n, gridProps: o } = t, r = m.current, i = t.gridProps.rowHeight || ((d = o.minRowHeightRef) == null ? void 0 : d.current) || 0;
|
|
715
|
-
r && (r.fixedScroll = o.fixedScroll || !1, r.PageChange =
|
|
716
|
-
},
|
|
719
|
+
r && (r.fixedScroll = o.fixedScroll || !1, r.PageChange = gt, r.pageSize = n, r.scrollableVirtual = k, r.container = V.current, r.tableBody = z.current, r.scrollHeightContainer = Fe.current, r.table = M.current, (!r.rowHeightService || r.total !== e) && i && (r.total = e, r.rowHeightService = new _t(e, i)));
|
|
720
|
+
}, Le = a.useCallback(
|
|
717
721
|
(e) => {
|
|
718
722
|
const n = { rowIndex: Ee.current };
|
|
719
723
|
e.forEach((o) => {
|
|
@@ -723,7 +727,7 @@ const xn = (t, v, u, y) => {
|
|
|
723
727
|
[me]
|
|
724
728
|
), U = () => {
|
|
725
729
|
t.gridProps.forceUpdate && t.gridProps.forceUpdate();
|
|
726
|
-
},
|
|
730
|
+
}, Ht = (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), D = 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), At = a.useRef(null), V = a.useRef(null), M = a.useRef(null), Pe = a.useRef(null), T = a.useRef(null), Fe = 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([]), ze = a.useRef([]), oe = a.useRef(0), _ = a.useRef(null), Gt = a.useRef(null), Lt = a.useRef(null), ye = Wt(T), k = t.isVirtualScroll, Ft = a.useMemo(() => a.Children.toArray(t.gridProps.children), [t.gridProps.children]), Oe = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, R = ce(t.gridProps.selectable), Ne = Xt(t.gridProps.editable), zt = oe.current && N && oe.current <= N.medium && t.gridProps.adaptive;
|
|
727
731
|
return a.useMemo(() => {
|
|
728
732
|
O.onConstructor({
|
|
729
733
|
navigatable: !!t.gridProps.navigatable,
|
|
@@ -739,12 +743,12 @@ const xn = (t, v, u, y) => {
|
|
|
739
743
|
t.gridProps.total,
|
|
740
744
|
t.gridProps.filter,
|
|
741
745
|
t.gridProps.group,
|
|
742
|
-
|
|
746
|
+
Oe,
|
|
743
747
|
t.gridProps.sort,
|
|
744
748
|
t.gridProps.rowHeight
|
|
745
749
|
]), a.useEffect(() => (t.gridProps.clipboard && (te.current = new Jt(p), te.current.addEventListeners(S())), () => {
|
|
746
750
|
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")),
|
|
751
|
+
}), [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")), He(), fe(), Be(), O.onComponentDidMount({
|
|
748
752
|
scope: T.current || void 0,
|
|
749
753
|
contextStateRef: K,
|
|
750
754
|
navigationStateRef: L
|
|
@@ -752,7 +756,7 @@ const xn = (t, v, u, y) => {
|
|
|
752
756
|
clearTimeout(Ie.current);
|
|
753
757
|
}), []), a.useEffect(() => {
|
|
754
758
|
var e;
|
|
755
|
-
|
|
759
|
+
He(), fe(), Be(), k && (Ae(), wt(), (e = m.current) == null || e.update()), Dt(), O.onComponentDidUpdate({
|
|
756
760
|
scope: T.current || void 0,
|
|
757
761
|
contextStateRef: K,
|
|
758
762
|
navigationStateRef: L,
|
|
@@ -768,13 +772,13 @@ const xn = (t, v, u, y) => {
|
|
|
768
772
|
rootMargin: "0px",
|
|
769
773
|
threshold: 0.9
|
|
770
774
|
};
|
|
771
|
-
F.current = window.IntersectionObserver && new window.IntersectionObserver(
|
|
775
|
+
F.current = window.IntersectionObserver && new window.IntersectionObserver(Le, e) || null;
|
|
772
776
|
}
|
|
773
|
-
}, [
|
|
777
|
+
}, [Le]), a.useEffect(() => {
|
|
774
778
|
var n;
|
|
775
779
|
let e;
|
|
776
780
|
return ae && window.ResizeObserver && (e = new window.ResizeObserver(() => {
|
|
777
|
-
Mt(),
|
|
781
|
+
Mt(), k && Ae();
|
|
778
782
|
}), e.observe((n = S()) == null ? void 0 : n.body)), () => {
|
|
779
783
|
e == null || e.disconnect();
|
|
780
784
|
};
|
|
@@ -809,14 +813,14 @@ const xn = (t, v, u, y) => {
|
|
|
809
813
|
), a.useImperativeHandle(t.gridRef, () => C.current), a.useMemo(() => {
|
|
810
814
|
x.current = new ln(St);
|
|
811
815
|
}, [t.gridProps.onColumnResize, t.columnsRef]), a.useMemo(() => {
|
|
812
|
-
|
|
816
|
+
D.current = new sn(ue, It, Te);
|
|
813
817
|
}, [
|
|
814
818
|
t.gridProps.onColumnReorder,
|
|
815
819
|
t.gridProps.onGroupChange,
|
|
816
820
|
t.gridProps.group,
|
|
817
821
|
t.columnsRef,
|
|
818
822
|
t.gridProps.groupable
|
|
819
|
-
]), x.current.resizable = t.gridProps.resizable || !1, x.current.columns = t.columnsRef, x.current.columnsState = jt(t.columnsState),
|
|
823
|
+
]), x.current.resizable = t.gridProps.resizable || !1, x.current.columns = t.columnsRef, x.current.columnsState = jt(t.columnsState), D.current.reorderable = t.gridProps.reorderable || !1, D.current.groupable = Oe, D.current.columns = t.columnsRef, D.current.dir = ye, Tt(), /* @__PURE__ */ a.createElement(
|
|
820
824
|
yn.Provider,
|
|
821
825
|
{
|
|
822
826
|
value: {
|
|
@@ -826,7 +830,7 @@ const xn = (t, v, u, y) => {
|
|
|
826
830
|
reorderRowDragTargetRef: Gt,
|
|
827
831
|
reorderRowDropTargetRef: Lt,
|
|
828
832
|
dir: ye,
|
|
829
|
-
getCellPositionStyle:
|
|
833
|
+
getCellPositionStyle: Ht,
|
|
830
834
|
dataItemKey: t.gridProps.dataItemKey,
|
|
831
835
|
columnsState: t.columnsState,
|
|
832
836
|
columnsRef: t.columnsRef,
|
|
@@ -835,16 +839,16 @@ const xn = (t, v, u, y) => {
|
|
|
835
839
|
group: t.gridProps.group,
|
|
836
840
|
defaultGroup: t.gridProps.defaultGroup,
|
|
837
841
|
groupChange: se,
|
|
838
|
-
selectionRelease:
|
|
839
|
-
pagerPageChange:
|
|
840
|
-
onContextMenu:
|
|
841
|
-
rowClick:
|
|
842
|
-
rowDblClick:
|
|
843
|
-
cellClick:
|
|
844
|
-
headerCellClick:
|
|
845
|
-
itemChange:
|
|
846
|
-
onDialogEditCancel:
|
|
847
|
-
onDialogEditSubmit:
|
|
842
|
+
selectionRelease: dt,
|
|
843
|
+
pagerPageChange: ht,
|
|
844
|
+
onContextMenu: _e,
|
|
845
|
+
rowClick: Ye,
|
|
846
|
+
rowDblClick: Qe,
|
|
847
|
+
cellClick: et,
|
|
848
|
+
headerCellClick: De,
|
|
849
|
+
itemChange: rt,
|
|
850
|
+
onDialogEditCancel: pe,
|
|
851
|
+
onDialogEditSubmit: Ze,
|
|
848
852
|
sortable: t.gridProps.sortable,
|
|
849
853
|
sort: t.gridProps.sort,
|
|
850
854
|
defaultSort: t.gridProps.defaultSort,
|
|
@@ -853,33 +857,33 @@ const xn = (t, v, u, y) => {
|
|
|
853
857
|
filter: t.gridProps.filter,
|
|
854
858
|
defaultFilter: t.gridProps.defaultFilter,
|
|
855
859
|
filterOperators: t.gridProps.filterOperators || Sn,
|
|
856
|
-
filterChange:
|
|
857
|
-
applyHighlightDescriptor:
|
|
860
|
+
filterChange: Rt,
|
|
861
|
+
applyHighlightDescriptor: bt,
|
|
858
862
|
highlight: t.gridProps.highlight,
|
|
859
863
|
searchChange: vt,
|
|
860
864
|
exportAsPdf: le,
|
|
861
|
-
onHeaderSelectionChange:
|
|
865
|
+
onHeaderSelectionChange: at,
|
|
862
866
|
columnGroupChange: Et,
|
|
863
|
-
onKeyDown:
|
|
864
|
-
onFocus:
|
|
865
|
-
scrollHandler:
|
|
866
|
-
selectionChange:
|
|
867
|
+
onKeyDown: $e,
|
|
868
|
+
onFocus: Xe,
|
|
869
|
+
scrollHandler: qe,
|
|
870
|
+
selectionChange: ot,
|
|
867
871
|
mobileMode: zt,
|
|
868
872
|
adaptiveColumnMenuRef: oe.current,
|
|
869
873
|
adpativeTitle: t.gridProps.adaptiveTitle,
|
|
870
874
|
adaptive: t.gridProps.adaptive,
|
|
871
|
-
dispatchDetailExpand:
|
|
872
|
-
dispatchGroupExpand:
|
|
875
|
+
dispatchDetailExpand: tt,
|
|
876
|
+
dispatchGroupExpand: nt,
|
|
873
877
|
columnResizeRef: x,
|
|
874
|
-
dragLogicRef:
|
|
878
|
+
dragLogicRef: D,
|
|
875
879
|
navigationStateRef: L,
|
|
876
880
|
tableElementRef: M,
|
|
877
881
|
tableBodyElementRef: z,
|
|
878
|
-
headerElementRef:
|
|
882
|
+
headerElementRef: At,
|
|
879
883
|
containerElementRef: V,
|
|
880
884
|
headTableElementRef: Pe,
|
|
881
885
|
elementRef: T,
|
|
882
|
-
virtualScrollHeightContainerRef:
|
|
886
|
+
virtualScrollHeightContainerRef: Fe,
|
|
883
887
|
footerRef: W,
|
|
884
888
|
headerRef: j,
|
|
885
889
|
vsRef: m
|
|
@@ -894,8 +898,8 @@ const xn = (t, v, u, y) => {
|
|
|
894
898
|
field: u.field,
|
|
895
899
|
items: J,
|
|
896
900
|
offset: u.offset,
|
|
897
|
-
onClose:
|
|
898
|
-
onSelect:
|
|
901
|
+
onClose: A,
|
|
902
|
+
onSelect: je
|
|
899
903
|
}
|
|
900
904
|
),
|
|
901
905
|
t.gridProps.pdf && /* @__PURE__ */ a.createElement(
|
|
@@ -905,7 +909,7 @@ const xn = (t, v, u, y) => {
|
|
|
905
909
|
innerGrid: t.innerGrid,
|
|
906
910
|
pdf: typeof t.gridProps.pdf == "object" ? t.gridProps.pdf : {},
|
|
907
911
|
onPdfExport: Ct,
|
|
908
|
-
ref: (e) =>
|
|
912
|
+
ref: (e) => H.current = e
|
|
909
913
|
}
|
|
910
914
|
)
|
|
911
915
|
);
|