@progress/kendo-react-grid 10.2.0-develop.2 → 10.2.0-develop.4
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 +130 -130
- package/cells/GridFilterCell.js +1 -1
- package/cells/GridFilterCell.mjs +4 -2
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/index.d.mts +25 -25
- package/index.d.ts +25 -25
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +13 -13
package/GridClientWrapper.mjs
CHANGED
|
@@ -12,9 +12,9 @@ import { getSelectionOptions as te, populateClipboardData as Lt, ClipboardAction
|
|
|
12
12
|
import { ColumnResize as Yt } from "./drag/ColumnResize.mjs";
|
|
13
13
|
import { CommonDragLogic as Qt } from "./drag/CommonDragLogic.mjs";
|
|
14
14
|
import { SAFARI_REGEX as Zt } from "./constants/index.mjs";
|
|
15
|
-
import { getDefaultHeadContextMenuItems as pt, getDefaultBodyContextMenuItems as en, isRowReorderEnabled as tn, sanitizeColumns as nn, getDataAsArray as rn, getFlatColumnsState as
|
|
15
|
+
import { getDefaultHeadContextMenuItems as pt, getDefaultBodyContextMenuItems as en, isRowReorderEnabled as tn, sanitizeColumns as nn, getDataAsArray as rn, getFlatColumnsState as on, firefox as ze, firefoxMaxHeight as Ne } from "./utils/index.mjs";
|
|
16
16
|
import { VirtualScrollFixed as Oe } from "./VirtualScrollFixed.mjs";
|
|
17
|
-
import { VirtualScroll as
|
|
17
|
+
import { VirtualScroll as an } from "./VirtualScroll.mjs";
|
|
18
18
|
import { GridContextMenu as dn } from "./contextMenu/GridContextMenu.mjs";
|
|
19
19
|
import { GridContextMenuAnchorPart as Be } from "./contextMenu/enums.mjs";
|
|
20
20
|
import { normalizeSortable as cn, firstLevelSortSeqMap as ln } from "./sortCommon.mjs";
|
|
@@ -51,20 +51,20 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
51
51
|
}, [m, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), Ve = i.useMemo(() => {
|
|
52
52
|
const e = (m == null ? void 0 : m.contextMenu) || t.gridProps.contextMenu, n = typeof e == "function" ? e(b) : e;
|
|
53
53
|
if (n && b.offset) {
|
|
54
|
-
const
|
|
55
|
-
return r === !1 ? void 0 : r === !0 || r === void 0 ?
|
|
54
|
+
const o = b.dataItem ? Be.body : Be.head, r = n[o], a = b.dataItem ? ve : Ce;
|
|
55
|
+
return r === !1 ? void 0 : r === !0 || r === void 0 ? a : r;
|
|
56
56
|
}
|
|
57
57
|
}, [t.gridProps.contextMenu, b, ve, Ce, m]), _e = (e) => {
|
|
58
58
|
var l, u, g, f, C, Z, I, N, O;
|
|
59
|
-
const n = e.event.item,
|
|
59
|
+
const n = e.event.item, o = {
|
|
60
60
|
target: R.current,
|
|
61
61
|
syntheticEvent: e.event.syntheticEvent,
|
|
62
62
|
nativeEvent: e.event.nativeEvent,
|
|
63
63
|
menuItem: n,
|
|
64
64
|
...e
|
|
65
65
|
};
|
|
66
|
-
t.gridProps.onContextMenuItemClick && s(t.gridProps.onContextMenuItemClick,
|
|
67
|
-
const r = j(),
|
|
66
|
+
t.gridProps.onContextMenuItemClick && s(t.gridProps.onContextMenuItemClick, o);
|
|
67
|
+
const r = j(), a = {
|
|
68
68
|
selectedField: t.gridProps.selectedField || "",
|
|
69
69
|
componentId: t.id,
|
|
70
70
|
dataItems: r,
|
|
@@ -79,7 +79,7 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
79
79
|
shiftKey: !1,
|
|
80
80
|
isDrag: !1,
|
|
81
81
|
...te(t.gridProps.selectable),
|
|
82
|
-
...
|
|
82
|
+
...o
|
|
83
83
|
}, d = r.findIndex((B) => B === e.dataItem);
|
|
84
84
|
switch ((l = n.data) == null ? void 0 : l.action) {
|
|
85
85
|
case "SortCommand":
|
|
@@ -89,13 +89,13 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
89
89
|
}
|
|
90
90
|
break;
|
|
91
91
|
case "SelectRowCommand":
|
|
92
|
-
it(
|
|
92
|
+
it(a);
|
|
93
93
|
break;
|
|
94
94
|
case "SelectAllRowsCommand":
|
|
95
|
-
|
|
95
|
+
at(a);
|
|
96
96
|
break;
|
|
97
97
|
case "ClearSelectionCommand":
|
|
98
|
-
dt(
|
|
98
|
+
dt(a);
|
|
99
99
|
break;
|
|
100
100
|
case "ReorderRowCommand":
|
|
101
101
|
z.current = e.dataItem, (f = n.name) != null && f.toLowerCase().includes("rowup") && d > 0 && A(e.event.syntheticEvent, d - 1, "before"), (C = n.name) != null && C.toLowerCase().includes("rowdown") && d < r.length - 1 && A(e.event.syntheticEvent, d + 1, "after"), (Z = n.name) != null && Z.toLowerCase().includes("rowtop") && A(e.event.syntheticEvent, 0, "before"), (I = n.name) != null && I.toLowerCase().includes("rowbottom") && A(e.event.syntheticEvent, r.length - 1, "after");
|
|
@@ -127,32 +127,32 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
127
127
|
}, U = () => {
|
|
128
128
|
const e = t.columnsRef.filter((n) => n.declarationIndex >= 0 && n.parentIndex === -1);
|
|
129
129
|
return nn(e);
|
|
130
|
-
}, We = (e, n,
|
|
130
|
+
}, We = (e, n, o) => {
|
|
131
131
|
if (t.gridProps.onContextMenu && w) {
|
|
132
132
|
const r = {
|
|
133
133
|
target: R.current,
|
|
134
134
|
syntheticEvent: e,
|
|
135
135
|
nativeEvent: e.nativeEvent,
|
|
136
136
|
dataItem: n,
|
|
137
|
-
field:
|
|
137
|
+
field: o
|
|
138
138
|
};
|
|
139
139
|
s(t.gridProps.onContextMenu, r);
|
|
140
140
|
}
|
|
141
141
|
t.gridProps.contextMenu && Ue({
|
|
142
142
|
event: e,
|
|
143
143
|
dataItem: n,
|
|
144
|
-
field:
|
|
144
|
+
field: o
|
|
145
145
|
});
|
|
146
146
|
}, je = (e) => {
|
|
147
147
|
if (e.target !== e.currentTarget)
|
|
148
148
|
return;
|
|
149
149
|
clearTimeout(me.current), c.current && (c.current.table = x.current);
|
|
150
|
-
const n = e.currentTarget.scrollLeft,
|
|
151
|
-
t.gridProps.columnVirtualization && (!r ||
|
|
150
|
+
const n = e.currentTarget.scrollLeft, o = e.currentTarget.scrollTop, r = t.gridProps.scrollable === "virtual";
|
|
151
|
+
t.gridProps.columnVirtualization && (!r || o === fe.current) && (me.current = window.setTimeout(() => {
|
|
152
152
|
de();
|
|
153
|
-
}, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = n), G.current && G.current.setScrollLeft(n), L.current && L.current.setScrollLeft(n), c.current &&
|
|
153
|
+
}, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = n), G.current && G.current.setScrollLeft(n), L.current && L.current.setScrollLeft(n), c.current && o !== fe.current && c.current.scrollHandler(e), t.gridProps.onScroll && w && s(t.gridProps.onScroll, {
|
|
154
154
|
...P(e)
|
|
155
|
-
}), fe.current =
|
|
155
|
+
}), fe.current = o;
|
|
156
156
|
}, qe = (e) => {
|
|
157
157
|
T.onKeyDown(e, {
|
|
158
158
|
navigatable: t.gridProps.navigatable || !1,
|
|
@@ -182,11 +182,11 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
182
182
|
}, $e = (e) => {
|
|
183
183
|
if (e.action === "moveToNextPage" && lt(e.event), e.action === "moveToPrevPage" && st(e.event), e.focusElement && e.action === "reorderToRight") {
|
|
184
184
|
const n = parseInt(e.focusElement.ariaColIndex, 10) - 1;
|
|
185
|
-
n < t.columnsRef.length - 1 &&
|
|
185
|
+
n < t.columnsRef.length - 1 && oe(n, n + 1, e.event);
|
|
186
186
|
}
|
|
187
187
|
if (e.focusElement && e.action === "reorderToLeft") {
|
|
188
188
|
const n = parseInt(e.focusElement.ariaColIndex, 10) - 1;
|
|
189
|
-
n > 0 &&
|
|
189
|
+
n > 0 && oe(n, n - 1, e.event);
|
|
190
190
|
}
|
|
191
191
|
if (e.action === "select" && nt(e.event), t.gridProps.onNavigationAction && w) {
|
|
192
192
|
const n = {
|
|
@@ -205,11 +205,11 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
205
205
|
dataItem: n,
|
|
206
206
|
...P(e)
|
|
207
207
|
});
|
|
208
|
-
}, Qe = (e, n,
|
|
208
|
+
}, Qe = (e, n, o) => {
|
|
209
209
|
if (Ke.enabled && Ke.mode === "incell" && t.gridProps.dataItemKey) {
|
|
210
210
|
const r = Ot(t.gridProps.edit, {
|
|
211
211
|
type: Bt.ENTER_FIELD_EDIT,
|
|
212
|
-
payload: { id: n[t.gridProps.dataItemKey], field:
|
|
212
|
+
payload: { id: n[t.gridProps.dataItemKey], field: o }
|
|
213
213
|
});
|
|
214
214
|
t.gridProps.onEditChange && s(t.gridProps.onEditChange, {
|
|
215
215
|
edit: r,
|
|
@@ -219,42 +219,42 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
219
219
|
}, Ze = (e, n) => {
|
|
220
220
|
var r;
|
|
221
221
|
if (Ut(t.detailExpandable).enabled) {
|
|
222
|
-
const
|
|
222
|
+
const a = Fe((r = t.gridProps.detailExpand) != null ? r : {}, e);
|
|
223
223
|
t.gridProps.onDetailExpandChange && s(t.gridProps.onDetailExpandChange, {
|
|
224
224
|
...P(n),
|
|
225
|
-
detailExpand:
|
|
225
|
+
detailExpand: a
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
228
|
}, pe = (e, n) => {
|
|
229
229
|
var r;
|
|
230
|
-
const
|
|
230
|
+
const o = Vt(
|
|
231
231
|
typeof t.gridProps.groupable == "object" ? t.gridProps.groupable.expandable !== !1 : t.gridProps.groupable
|
|
232
232
|
);
|
|
233
|
-
if (
|
|
234
|
-
const
|
|
233
|
+
if (o.enabled) {
|
|
234
|
+
const a = _t((r = t.gridProps.groupExpand) != null ? r : [], e, o);
|
|
235
235
|
t.gridProps.onGroupExpandChange && s(t.gridProps.onGroupExpandChange, {
|
|
236
236
|
...P(n),
|
|
237
|
-
groupExpand:
|
|
237
|
+
groupExpand: a
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
|
-
}, Ee = (e, n,
|
|
241
|
-
const { allowUnsort: r, mode:
|
|
240
|
+
}, Ee = (e, n, o) => {
|
|
241
|
+
const { allowUnsort: r, mode: a } = cn(
|
|
242
242
|
t.gridProps.sortable || !1,
|
|
243
243
|
n.sortable || !1
|
|
244
|
-
), d = (t.gridProps.sort || []).filter((g) => g.field === n.field)[0], l =
|
|
244
|
+
), d = (t.gridProps.sort || []).filter((g) => g.field === n.field)[0], l = o || ln[r][d && d.dir || ""], u = a === "single" ? [] : (t.gridProps.sort || []).filter((g) => g.field !== n.field);
|
|
245
245
|
l !== "" && n.field && u.push({ field: n.field, dir: l }), we(u, e);
|
|
246
246
|
}, et = (e) => {
|
|
247
247
|
var n;
|
|
248
248
|
if (e.field === t.gridProps.expandField || e._expand || t.gridProps.group && e.field === void 0) {
|
|
249
249
|
if (t.gridProps.onExpandChange) {
|
|
250
|
-
const
|
|
250
|
+
const o = t.gridProps.dataItemKey ? Fe((n = t.gridProps.detailExpand) != null ? n : {}, {
|
|
251
251
|
type: Wt.SET,
|
|
252
252
|
id: e.dataItem[t.gridProps.dataItemKey],
|
|
253
253
|
payload: e.value
|
|
254
254
|
}) : t.gridProps.detailExpand;
|
|
255
255
|
s(t.gridProps.onExpandChange, {
|
|
256
256
|
...P(e.syntheticEvent),
|
|
257
|
-
expand:
|
|
257
|
+
expand: o,
|
|
258
258
|
dataItem: e.dataItem,
|
|
259
259
|
dataIndex: e.dataIndex,
|
|
260
260
|
value: e.value
|
|
@@ -272,13 +272,13 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
272
272
|
}, tt = (e) => {
|
|
273
273
|
var n;
|
|
274
274
|
if (t.gridProps.onSelectionChange && h.enabled) {
|
|
275
|
-
const { event:
|
|
276
|
-
...P(
|
|
275
|
+
const { event: o, dataItem: r, dataIndex: a, columnIndex: d } = e, l = {
|
|
276
|
+
...P(o.syntheticEvent),
|
|
277
277
|
dataItem: r,
|
|
278
278
|
startColIndex: d,
|
|
279
279
|
endColIndex: d,
|
|
280
|
-
startRowIndex:
|
|
281
|
-
endRowIndex:
|
|
280
|
+
startRowIndex: a,
|
|
281
|
+
endRowIndex: a,
|
|
282
282
|
dataItems: H(),
|
|
283
283
|
altKey: !1,
|
|
284
284
|
ctrlKey: !1,
|
|
@@ -310,19 +310,19 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
310
310
|
componentId: t.id,
|
|
311
311
|
selectedField: t.gridProps.selectedField,
|
|
312
312
|
...P(e)
|
|
313
|
-
},
|
|
313
|
+
}, o = jt({
|
|
314
314
|
event: n,
|
|
315
315
|
selectedState: (g = t.gridProps.select) != null ? g : {},
|
|
316
316
|
dataItemKey: t.gridProps.dataItemKey
|
|
317
317
|
});
|
|
318
|
-
if (
|
|
318
|
+
if (o === t.gridProps.select)
|
|
319
319
|
return;
|
|
320
|
-
const r = e.target,
|
|
320
|
+
const r = e.target, a = Ge(r, "TD"), d = Ge(r, "TR"), l = qt(a), u = Xt(d);
|
|
321
321
|
if (l !== void 0 && u !== void 0) {
|
|
322
322
|
const C = (f = rn(t.gridProps.data)) == null ? void 0 : f[u];
|
|
323
323
|
t.gridProps.onSelectionChange && s(t.gridProps.onSelectionChange, {
|
|
324
324
|
...n,
|
|
325
|
-
select:
|
|
325
|
+
select: o,
|
|
326
326
|
dataItem: C,
|
|
327
327
|
startRowIndex: u,
|
|
328
328
|
startColIndex: l,
|
|
@@ -340,14 +340,14 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
340
340
|
}, rt = (e) => {
|
|
341
341
|
var n;
|
|
342
342
|
if (t.gridProps.onHeaderSelectionChange && h.enabled) {
|
|
343
|
-
const
|
|
343
|
+
const o = H();
|
|
344
344
|
s(t.gridProps.onHeaderSelectionChange, {
|
|
345
|
-
select: e.syntheticEvent.target.checked ?
|
|
345
|
+
select: e.syntheticEvent.target.checked ? o.reduce((r, a) => (t.gridProps.dataItemKey && ee(t.gridProps.dataItemKey)(a) !== void 0 && (r[ee(t.gridProps.dataItemKey)(a)] = !0), r), {}) : {},
|
|
346
346
|
field: e.field,
|
|
347
347
|
nativeEvent: e.syntheticEvent && e.syntheticEvent.nativeEvent,
|
|
348
348
|
syntheticEvent: e.syntheticEvent,
|
|
349
349
|
target: R.current,
|
|
350
|
-
dataItems:
|
|
350
|
+
dataItems: o,
|
|
351
351
|
selectedField: (n = t.gridProps.selectedField) != null ? n : ""
|
|
352
352
|
});
|
|
353
353
|
}
|
|
@@ -356,34 +356,34 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
356
356
|
...e,
|
|
357
357
|
select: n
|
|
358
358
|
});
|
|
359
|
-
},
|
|
359
|
+
}, ot = (e) => {
|
|
360
360
|
var n;
|
|
361
361
|
if (t.gridProps.onSelectionChange && h.enabled) {
|
|
362
|
-
const
|
|
362
|
+
const o = j()[e.startRowIndex], r = j()[e.endRowIndex], a = {
|
|
363
363
|
syntheticEvent: void 0,
|
|
364
364
|
target: R.current,
|
|
365
365
|
selectedField: t.gridProps.selectedField || "",
|
|
366
366
|
componentId: t.id,
|
|
367
367
|
dataItems: H(),
|
|
368
368
|
dataItem: null,
|
|
369
|
-
startDataItem:
|
|
369
|
+
startDataItem: o,
|
|
370
370
|
endDataItem: r,
|
|
371
371
|
...e
|
|
372
372
|
}, d = Le({
|
|
373
|
-
event:
|
|
373
|
+
event: a,
|
|
374
374
|
selectedState: (n = t.gridProps.select) != null ? n : {},
|
|
375
375
|
// Thats kinda strange, even through the `dataItemKey` is required by the `getSelectedState`
|
|
376
376
|
// it does work correctly even without it
|
|
377
377
|
dataItemKey: t.gridProps.dataItemKey
|
|
378
378
|
});
|
|
379
|
-
V(
|
|
379
|
+
V(a, d);
|
|
380
380
|
}
|
|
381
|
-
},
|
|
381
|
+
}, at = (e) => {
|
|
382
382
|
if (t.gridProps.onSelectionChange && h.enabled) {
|
|
383
|
-
const n = e.dataItems[0],
|
|
383
|
+
const n = e.dataItems[0], o = e.dataItems[e.dataItems.length - 1], r = {}, a = {
|
|
384
384
|
...e,
|
|
385
385
|
startDataItem: n,
|
|
386
|
-
endDataItem:
|
|
386
|
+
endDataItem: o,
|
|
387
387
|
startRowIndex: 0,
|
|
388
388
|
endRowIndex: e.dataItems.length - 1,
|
|
389
389
|
startColIndex: 0,
|
|
@@ -392,11 +392,11 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
392
392
|
e.dataItems.forEach((d) => {
|
|
393
393
|
const u = ee(t.gridProps.dataItemKey)(d);
|
|
394
394
|
r[u] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0;
|
|
395
|
-
}), V(
|
|
395
|
+
}), V(a, r);
|
|
396
396
|
}
|
|
397
397
|
}, it = (e) => {
|
|
398
398
|
if (t.gridProps.onSelectionChange && h.enabled) {
|
|
399
|
-
const
|
|
399
|
+
const o = ee(t.gridProps.dataItemKey)(e.dataItem), r = 0, a = t.columnsRef.length - 1, d = e.dataItems.findIndex(
|
|
400
400
|
(C) => C[t.gridProps.dataItemKey] === e.dataItem[t.gridProps.dataItemKey]
|
|
401
401
|
), g = {
|
|
402
402
|
...e,
|
|
@@ -405,44 +405,44 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
405
405
|
startRowIndex: d,
|
|
406
406
|
endRowIndex: d,
|
|
407
407
|
startColIndex: r,
|
|
408
|
-
endColIndex:
|
|
408
|
+
endColIndex: a
|
|
409
409
|
}, f = e.mode === "multiple" ? t.gridProps.select || {} : {};
|
|
410
|
-
f[
|
|
410
|
+
f[o] === !0 || Array.isArray(f[o]) && f[o].length === t.columnsRef.length ? delete f[o] : f[o] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0, V(g, f);
|
|
411
411
|
}
|
|
412
412
|
}, dt = (e) => {
|
|
413
413
|
t.gridProps.onSelectionChange && h.enabled && V(e, {});
|
|
414
|
-
}, M = (e, n,
|
|
414
|
+
}, M = (e, n, o, r, a) => {
|
|
415
415
|
const d = t.gridProps.onDataStateChange;
|
|
416
416
|
if (e) {
|
|
417
|
-
const l = { ...P(r), ...n, targetEvent:
|
|
417
|
+
const l = { ...P(r), ...n, targetEvent: a };
|
|
418
418
|
s(e, l);
|
|
419
419
|
} else d && s(d, {
|
|
420
420
|
...P(r),
|
|
421
|
-
targetEvent:
|
|
421
|
+
targetEvent: a || {},
|
|
422
422
|
dataState: {
|
|
423
423
|
...bt(),
|
|
424
|
-
...
|
|
424
|
+
...o
|
|
425
425
|
}
|
|
426
426
|
});
|
|
427
|
-
}, _ = (e, n,
|
|
427
|
+
}, _ = (e, n, o) => {
|
|
428
428
|
M(
|
|
429
429
|
t.gridProps.onPageChange,
|
|
430
430
|
{ page: e },
|
|
431
431
|
{ skip: e.skip, take: e.take },
|
|
432
432
|
n,
|
|
433
|
-
|
|
433
|
+
o
|
|
434
434
|
);
|
|
435
435
|
}, ct = () => {
|
|
436
436
|
let e = t.gridProps.total || 0;
|
|
437
437
|
return Array.isArray(t.gridProps.data) ? e = e || t.gridProps.data.length : t.gridProps.data && (e = e || t.gridProps.data.total), e;
|
|
438
438
|
}, lt = (e) => {
|
|
439
|
-
var
|
|
440
|
-
const n = (d = (
|
|
441
|
-
|
|
439
|
+
var a, d;
|
|
440
|
+
const n = (d = (a = t.gridProps.take) != null ? a : t.gridProps.pageSize) != null ? d : 0, o = (t.gridProps.skip || 0) + n, r = ct();
|
|
441
|
+
o < r && _({ skip: o, take: n }, e);
|
|
442
442
|
}, st = (e) => {
|
|
443
|
-
var r,
|
|
444
|
-
const n = (
|
|
445
|
-
|
|
443
|
+
var r, a;
|
|
444
|
+
const n = (a = (r = t.gridProps.take) != null ? r : t.gridProps.pageSize) != null ? a : 0, o = (t.gridProps.skip || 0) - n;
|
|
445
|
+
o >= 0 && _({ skip: o, take: n }, e);
|
|
446
446
|
}, ut = (e) => {
|
|
447
447
|
_({ skip: e.skip, take: e.take }, e.syntheticEvent, e.targetEvent);
|
|
448
448
|
}, we = (e, n) => {
|
|
@@ -460,15 +460,15 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
460
460
|
n
|
|
461
461
|
);
|
|
462
462
|
}, ft = (e) => {
|
|
463
|
-
const n = t.gridProps.searchFields || t.columnsRef.map((
|
|
463
|
+
const n = t.gridProps.searchFields || t.columnsRef.map((a) => a.field) || [], o = e.nativeEvent.target.value, r = {
|
|
464
464
|
logic: "or",
|
|
465
|
-
filters: n.filter((
|
|
465
|
+
filters: n.filter((a) => a !== void 0).map((a) => {
|
|
466
466
|
var d;
|
|
467
|
-
return typeof
|
|
468
|
-
value:
|
|
469
|
-
operator: (d =
|
|
470
|
-
field:
|
|
471
|
-
ignoreCase:
|
|
467
|
+
return typeof a == "string" ? { field: a, value: o, operator: "contains" } : {
|
|
468
|
+
value: o,
|
|
469
|
+
operator: (d = a.operator) != null ? d : "contains",
|
|
470
|
+
field: a.field,
|
|
471
|
+
ignoreCase: a.ignoreCase
|
|
472
472
|
};
|
|
473
473
|
})
|
|
474
474
|
};
|
|
@@ -481,12 +481,12 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
481
481
|
e.syntheticEvent
|
|
482
482
|
);
|
|
483
483
|
}, ne = (e, n) => {
|
|
484
|
-
const
|
|
484
|
+
const o = n.nativeEvent ? n : { nativeEvent: n.nativeEvent || n.originalEvent };
|
|
485
485
|
e.length === 0 && t.gridProps.navigatable && (se.current = !0), M(
|
|
486
486
|
t.gridProps.onGroupChange,
|
|
487
487
|
{ group: e },
|
|
488
488
|
{ group: e, skip: 0 },
|
|
489
|
-
|
|
489
|
+
o
|
|
490
490
|
);
|
|
491
491
|
}, re = (e) => {
|
|
492
492
|
if (t.gridProps.onColumnsStateChange) {
|
|
@@ -496,8 +496,8 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
496
496
|
};
|
|
497
497
|
s(t.gridProps.onColumnsStateChange, n);
|
|
498
498
|
}
|
|
499
|
-
},
|
|
500
|
-
const { columnsRef: r, columnsState:
|
|
499
|
+
}, oe = (e, n, o) => {
|
|
500
|
+
const { columnsRef: r, columnsState: a } = t, d = r[e], l = on(a), u = d.depth, g = (I) => {
|
|
501
501
|
do
|
|
502
502
|
I++;
|
|
503
503
|
while (I < r.length && r[I].depth > u);
|
|
@@ -516,45 +516,45 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
516
516
|
target: R.current,
|
|
517
517
|
columns: Z,
|
|
518
518
|
columnId: d.id,
|
|
519
|
-
nativeEvent:
|
|
519
|
+
nativeEvent: o
|
|
520
520
|
};
|
|
521
521
|
s(t.gridProps.onColumnReorder, I);
|
|
522
522
|
}
|
|
523
|
-
re(
|
|
524
|
-
}, A = (e, n,
|
|
523
|
+
re(a);
|
|
524
|
+
}, A = (e, n, o) => {
|
|
525
525
|
const r = typeof t.gridProps.rowReorderable == "object" ? t.gridProps.rowReorderable.enabled : t.gridProps.rowReorderable;
|
|
526
|
-
if (
|
|
526
|
+
if (o === "forbidden" || !r || !z.current)
|
|
527
527
|
return;
|
|
528
|
-
const { slicedData:
|
|
528
|
+
const { slicedData: a, dataRef: d } = t, l = (a || d)[n];
|
|
529
529
|
t.gridProps.onRowReorder && s(t.gridProps.onRowReorder, {
|
|
530
530
|
draggedDataItems: [z.current],
|
|
531
531
|
droppedDataItem: l == null ? void 0 : l.dataItem,
|
|
532
|
-
dropPosition:
|
|
532
|
+
dropPosition: o,
|
|
533
533
|
nativeEvent: e.originalEvent,
|
|
534
534
|
dragEvent: e,
|
|
535
535
|
target: R.current
|
|
536
536
|
}), z.current = null;
|
|
537
|
-
}, mt = (e, n,
|
|
537
|
+
}, mt = (e, n, o) => {
|
|
538
538
|
if (t.gridProps.group === void 0)
|
|
539
539
|
return;
|
|
540
540
|
const r = t.gridProps.group.slice();
|
|
541
|
-
r.splice(n, 0, ...r.splice(e, 1)), ne(r,
|
|
542
|
-
}, ye = (e, n,
|
|
541
|
+
r.splice(n, 0, ...r.splice(e, 1)), ne(r, o);
|
|
542
|
+
}, ye = (e, n, o) => {
|
|
543
543
|
const r = t.columnsRef[e].field;
|
|
544
544
|
if (!r)
|
|
545
545
|
return;
|
|
546
|
-
const
|
|
547
|
-
|
|
546
|
+
const a = (t.gridProps.group || []).slice();
|
|
547
|
+
a.splice(n, 0, { field: r }), ne(a, o);
|
|
548
548
|
}, Pt = (e, n) => {
|
|
549
|
-
const
|
|
550
|
-
ye(e,
|
|
551
|
-
},
|
|
549
|
+
const o = S.current.getCurrentGroupsLength;
|
|
550
|
+
ye(e, o, n);
|
|
551
|
+
}, ae = () => {
|
|
552
552
|
let e = 0;
|
|
553
553
|
if (!E.current.colGroupMain)
|
|
554
554
|
return;
|
|
555
555
|
const n = E.current.colGroupMain.children;
|
|
556
|
-
for (let
|
|
557
|
-
const r = n[
|
|
556
|
+
for (let o = 0; o < n.length; o++) {
|
|
557
|
+
const r = n[o].width;
|
|
558
558
|
if (!r) {
|
|
559
559
|
e = 0;
|
|
560
560
|
break;
|
|
@@ -563,9 +563,9 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
563
563
|
}
|
|
564
564
|
e = Math.round(e), G.current && G.current.setWidth(e), L.current && L.current.setWidth(e), x.current && (x.current.style.width = e ? e + "px" : "");
|
|
565
565
|
}, W = i.useCallback(
|
|
566
|
-
(e, n,
|
|
566
|
+
(e, n, o, r, a) => {
|
|
567
567
|
var g;
|
|
568
|
-
if (!ht() && !
|
|
568
|
+
if (!ht() && !o || !e)
|
|
569
569
|
return;
|
|
570
570
|
const d = {
|
|
571
571
|
type: e,
|
|
@@ -573,9 +573,9 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
573
573
|
columns: t.columnsRef,
|
|
574
574
|
dataItemKey: t.gridProps.dataItemKey || "",
|
|
575
575
|
dataItem: r,
|
|
576
|
-
field:
|
|
576
|
+
field: a,
|
|
577
577
|
...typeof t.gridProps.clipboard != "boolean" ? t.gridProps.clipboard : {},
|
|
578
|
-
...
|
|
578
|
+
...o
|
|
579
579
|
}, l = j(), u = Lt({
|
|
580
580
|
event: d,
|
|
581
581
|
data: l,
|
|
@@ -595,22 +595,22 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
595
595
|
t.gridProps.onClipboard
|
|
596
596
|
]
|
|
597
597
|
), ht = () => {
|
|
598
|
-
var
|
|
598
|
+
var a, d, l;
|
|
599
599
|
if (!p)
|
|
600
600
|
return !1;
|
|
601
|
-
const e = At(v()), n = e ? e.matches(".k-table-td") ? e : (
|
|
602
|
-
return !!(n && r &&
|
|
603
|
-
}, It = (e, n,
|
|
604
|
-
|
|
601
|
+
const e = At(v()), n = e ? e.matches(".k-table-td") ? e : (a = v()) == null ? void 0 : a.body : (d = v()) == null ? void 0 : d.body, o = n.closest(".k-grid-container"), r = n && ((l = K.current) == null ? void 0 : l.contains(n));
|
|
602
|
+
return !!(n && r && o);
|
|
603
|
+
}, It = (e, n, o, r, a, d, l) => {
|
|
604
|
+
ae(), Y.current = !0, le.current = !0, t.gridProps.onColumnResize && w && s(t.gridProps.onColumnResize, {
|
|
605
605
|
columns: U(),
|
|
606
606
|
nativeEvent: r,
|
|
607
607
|
targetColumnId: l,
|
|
608
608
|
index: e,
|
|
609
609
|
newWidth: n,
|
|
610
|
-
oldWidth:
|
|
611
|
-
end:
|
|
610
|
+
oldWidth: o,
|
|
611
|
+
end: a,
|
|
612
612
|
target: R.current
|
|
613
|
-
}),
|
|
613
|
+
}), a && re(d);
|
|
614
614
|
}, bt = () => {
|
|
615
615
|
var e;
|
|
616
616
|
return {
|
|
@@ -638,12 +638,12 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
638
638
|
}
|
|
639
639
|
e(Rt(n));
|
|
640
640
|
}, Ct = () => {
|
|
641
|
-
var e, n,
|
|
641
|
+
var e, n, o;
|
|
642
642
|
if (F.current && ((e = F.current) == null ? void 0 : e.getElementsByClassName("k-grid-edit-row").length) > 0) {
|
|
643
643
|
ge.current = !1, (n = document.activeElement) != null && n.closest(".k-grid-edit-row") ? ue.current = document.activeElement : ue.current = void 0;
|
|
644
|
-
const r = Array.from((
|
|
644
|
+
const r = Array.from((o = F.current) == null ? void 0 : o.getElementsByClassName("k-grid-edit-row"));
|
|
645
645
|
r.length > he.current.length ? J.current = r.filter(
|
|
646
|
-
(
|
|
646
|
+
(a) => !he.current.includes(a)
|
|
647
647
|
)[0] : r.length === 1 && (J.current = r[0], ge.current = !0), he.current = r;
|
|
648
648
|
}
|
|
649
649
|
}, H = () => t.dataRef.filter((e) => e.rowType === "data").map((e) => e.dataItem), j = () => (t.slicedData || t.dataRef).filter((e) => e.rowType === "data").map((e) => e.dataItem), v = () => {
|
|
@@ -656,32 +656,32 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
656
656
|
if (!c.current || !((r = c.current) != null && r.container) || t.gridProps.scrollable === "none")
|
|
657
657
|
return;
|
|
658
658
|
D.current && D.current.disconnect();
|
|
659
|
-
const { rowIndex: n } = e,
|
|
659
|
+
const { rowIndex: n } = e, o = q();
|
|
660
660
|
if (t.gridProps.scrollable === "virtual")
|
|
661
661
|
c.current.askedSkip = n, c.current.container.scroll(
|
|
662
662
|
0,
|
|
663
663
|
Math.round(c.current.askedSkip / c.current.total * c.current.container.scrollHeight)
|
|
664
664
|
);
|
|
665
|
-
else if (
|
|
666
|
-
const
|
|
667
|
-
|
|
665
|
+
else if (o) {
|
|
666
|
+
const a = n < 1 ? o.querySelector("tbody > tr:nth-child(1)") : o.querySelector(`tbody > tr:nth-child(${n + 1})`);
|
|
667
|
+
a && $.current && ($.current.scrollTop = a.offsetTop);
|
|
668
668
|
}
|
|
669
669
|
},
|
|
670
670
|
[t.gridProps.scrollable]
|
|
671
671
|
), xe = (e) => JSON.stringify(e.map((n) => ({ id: n.id, field: n.field, title: n.title, children: n.children }))), vt = () => xe(Dt) === xe(t.columnsRef), Et = () => {
|
|
672
672
|
vt() || de();
|
|
673
673
|
}, wt = (e) => {
|
|
674
|
-
var n,
|
|
674
|
+
var n, o;
|
|
675
675
|
if (c.current) {
|
|
676
|
-
if (c.current.fixedScroll = t.gridProps.fixedScroll || !1, c.current.PageChange = _, c.current.realSkip = t.gridProps.skip || 0, c.current.pageSize = (
|
|
676
|
+
if (c.current.fixedScroll = t.gridProps.fixedScroll || !1, c.current.PageChange = _, c.current.realSkip = t.gridProps.skip || 0, c.current.pageSize = (o = (n = t.gridProps.take) != null ? n : t.gridProps.pageSize) != null ? o : 0, c.current.scrollableVirtual = t.gridProps.scrollable === "virtual", c.current.total = e, c.current.propsSkip = (t.gridProps.skip || 0) + (t.gridProps.scrollable === "virtual" ? c.current.topCacheCount + (c.current.attendedSkip - (t.gridProps.skip || 0)) : 0), t.gridProps.rowHeight !== void 0 && t.gridProps.rowHeight > 0 && !Q) {
|
|
677
677
|
const r = t.gridProps.rowHeight * e;
|
|
678
678
|
c.current.containerHeight = ze ? Math.min(Ne, r) : r;
|
|
679
679
|
} else
|
|
680
680
|
c.current.containerHeight = 1533915;
|
|
681
681
|
if (c.current.containerRef = $, c.current.tableBodyRef = F, c.current.table = x.current, c.current instanceof Oe) {
|
|
682
|
-
const { rowHeight: r = 0, detail:
|
|
682
|
+
const { rowHeight: r = 0, detail: a, expandField: d } = t.gridProps;
|
|
683
683
|
let { detailRowHeight: l = 0 } = t.gridProps;
|
|
684
|
-
l =
|
|
684
|
+
l = a && d ? l : r, t.isAllData ? (c.current.total = t.dataRef.length, c.current.rowHeightService = new He(
|
|
685
685
|
t.dataRef.length,
|
|
686
686
|
r,
|
|
687
687
|
l,
|
|
@@ -694,14 +694,14 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
694
694
|
}, Se = i.useCallback(
|
|
695
695
|
(e) => {
|
|
696
696
|
const n = { rowIndex: Pe.current };
|
|
697
|
-
e.forEach((
|
|
698
|
-
|
|
697
|
+
e.forEach((o) => {
|
|
698
|
+
o.isIntersecting || ie(n);
|
|
699
699
|
});
|
|
700
700
|
},
|
|
701
701
|
[ie]
|
|
702
702
|
), de = () => {
|
|
703
703
|
t.gridProps.forceUpdate && t.gridProps.forceUpdate();
|
|
704
|
-
}, yt = (e) => e.left !== void 0 ? De !== "rtl" ? { left: e.left, right: e.right } : { left: e.right, right: e.left } : {}, R = i.useRef(null), c = i.useRef(), E = i.useRef(), S = i.useRef(), y = i.useRef(), k = i.useRef(), X = i.useRef(), D = i.useRef(null), F = i.useRef(null), xt = i.useRef(null), $ = i.useRef(null), x = i.useRef(null), ce = i.useRef(null), K = i.useRef(null), L = i.useRef(null), G = i.useRef(null), le = i.useRef(!1), se = i.useRef(!1), J = i.useRef(), ue = i.useRef(), ge = i.useRef(!1), Y = i.useRef(!0), fe = i.useRef(0), me = i.useRef(), Pe = i.useRef(), he = i.useRef([]), ke = i.useRef([]), z = i.useRef(null), St = i.useRef(null), kt = i.useRef(null), De = Ht(K), Dt = i.useMemo(() => i.Children.toArray(t.gridProps.children), [t.gridProps.children]), Q = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, h = te((Te = t.gridProps.selectable) != null ? Te : !!t.gridProps.selectedField), Ke = Gt((Me = t.gridProps.editable) != null ? Me : !!t.gridProps.editField);
|
|
704
|
+
}, yt = (e) => e.left !== void 0 ? De !== "rtl" ? { left: e.left, right: e.right } : { left: e.right, right: e.left } : {}, R = i.useRef(null), c = i.useRef(void 0), E = i.useRef(void 0), S = i.useRef(void 0), y = i.useRef(void 0), k = i.useRef(void 0), X = i.useRef(void 0), D = i.useRef(null), F = i.useRef(null), xt = i.useRef(null), $ = i.useRef(null), x = i.useRef(null), ce = i.useRef(null), K = i.useRef(null), L = i.useRef(null), G = i.useRef(null), le = i.useRef(!1), se = i.useRef(!1), J = i.useRef(void 0), ue = i.useRef(void 0), ge = i.useRef(!1), Y = i.useRef(!0), fe = i.useRef(0), me = i.useRef(void 0), Pe = i.useRef(void 0), he = i.useRef([]), ke = i.useRef([]), z = i.useRef(null), St = i.useRef(null), kt = i.useRef(null), De = Ht(K), Dt = i.useMemo(() => i.Children.toArray(t.gridProps.children), [t.gridProps.children]), Q = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, h = te((Te = t.gridProps.selectable) != null ? Te : !!t.gridProps.selectedField), Ke = Gt((Me = t.gridProps.editable) != null ? Me : !!t.gridProps.editField);
|
|
705
705
|
return i.useMemo(() => {
|
|
706
706
|
T.onConstructor({
|
|
707
707
|
navigatable: !!t.gridProps.navigatable,
|
|
@@ -712,7 +712,7 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
712
712
|
}, []), i.useMemo(() => {
|
|
713
713
|
var n;
|
|
714
714
|
(n = c.current) == null || n.reset();
|
|
715
|
-
const e = t.isFixedVirtualScroll ? Oe :
|
|
715
|
+
const e = t.isFixedVirtualScroll ? Oe : an;
|
|
716
716
|
c.current = new e(Q || t.gridProps.rowHeight === void 0 || t.gridProps.rowHeight === 0);
|
|
717
717
|
}, [
|
|
718
718
|
t.gridProps.scrollable,
|
|
@@ -724,7 +724,7 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
724
724
|
t.gridProps.rowHeight
|
|
725
725
|
]), i.useEffect(() => (t.gridProps.clipboard && (X.current = new zt(W), X.current.addEventListeners(v())), () => {
|
|
726
726
|
X.current && X.current.removeEventListeners(v());
|
|
727
|
-
}), [t.gridProps.onClipboard, t.gridProps.clipboard, W, v]), i.useEffect(() => (t.gridProps.columnVirtualization && !window.navigator.userAgent.match(Zt) && (ce.current && (ce.current.style.display = "block"), x.current && (x.current.style.display = "block")),
|
|
727
|
+
}), [t.gridProps.onClipboard, t.gridProps.clipboard, W, v]), i.useEffect(() => (t.gridProps.columnVirtualization && !window.navigator.userAgent.match(Zt) && (ce.current && (ce.current.style.display = "block"), x.current && (x.current.style.display = "block")), ae(), Ae(), T.onComponentDidMount({
|
|
728
728
|
scope: K.current || void 0,
|
|
729
729
|
contextStateRef: y,
|
|
730
730
|
navigationStateRef: k
|
|
@@ -732,7 +732,7 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
732
732
|
clearTimeout(me.current);
|
|
733
733
|
}), []), i.useEffect(() => {
|
|
734
734
|
var e;
|
|
735
|
-
|
|
735
|
+
ae(), Ae(), (e = c.current) != null && e.tableTransform && c.current.table && (c.current.table.style.transform = c.current.tableTransform, c.current.tableTransform = ""), Ct(), T.onComponentDidUpdate({
|
|
736
736
|
scope: K.current || void 0,
|
|
737
737
|
contextStateRef: y,
|
|
738
738
|
navigationStateRef: k,
|
|
@@ -772,11 +772,11 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
772
772
|
return;
|
|
773
773
|
const { rowIndex: n } = e;
|
|
774
774
|
Pe.current = n;
|
|
775
|
-
const
|
|
776
|
-
if (D.current &&
|
|
775
|
+
const o = q();
|
|
776
|
+
if (D.current && o) {
|
|
777
777
|
D.current.disconnect();
|
|
778
|
-
const
|
|
779
|
-
|
|
778
|
+
const a = o.querySelector(`[absolute-row-index="${Pe.current}"]`);
|
|
779
|
+
a ? D.current.observe(a) : ie(e);
|
|
780
780
|
}
|
|
781
781
|
},
|
|
782
782
|
fitColumns: (e) => {
|
|
@@ -786,7 +786,7 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
786
786
|
), i.useImperativeHandle(t.gridRef, () => R.current), i.useMemo(() => {
|
|
787
787
|
E.current = new Yt(It);
|
|
788
788
|
}, [t.gridProps.onColumnResize, t.columnsRef]), i.useMemo(() => {
|
|
789
|
-
S.current = new Qt(
|
|
789
|
+
S.current = new Qt(oe, mt, ye);
|
|
790
790
|
}, [
|
|
791
791
|
t.gridProps.onColumnReorder,
|
|
792
792
|
t.gridProps.onGroupChange,
|
|
@@ -808,7 +808,7 @@ const sn = i.createContext(void 0), wn = (t) => {
|
|
|
808
808
|
columnsState: t.columnsState,
|
|
809
809
|
onColumnsStateChange: re,
|
|
810
810
|
groupChange: ne,
|
|
811
|
-
selectionRelease:
|
|
811
|
+
selectionRelease: ot,
|
|
812
812
|
pagerPageChange: ut,
|
|
813
813
|
onContextMenu: We,
|
|
814
814
|
rowClick: Je,
|