@progress/kendo-react-grid 13.2.0-develop.7 → 13.2.0-develop.8
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 +89 -86
- package/GridComponent.js +1 -1
- package/GridComponent.mjs +2 -2
- package/columnMenu/GridColumnMenuColumnsChooser.js +1 -1
- package/columnMenu/GridColumnMenuColumnsChooser.mjs +15 -15
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/drag/ColumnResize.js +1 -1
- package/drag/ColumnResize.mjs +46 -47
- package/header/HeaderRow.js +1 -1
- package/header/HeaderRow.mjs +1 -2
- package/index.d.mts +183 -1
- package/index.d.ts +183 -1
- package/index.js +1 -1
- package/index.mjs +62 -59
- package/interfaces/GridAICommands.js +8 -0
- package/interfaces/GridAICommands.mjs +11 -0
- 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 +145 -284
- package/utils/handleAIResponse.js +8 -0
- package/utils/handleAIResponse.mjs +165 -0
package/GridClientWrapper.mjs
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import * as a from "react";
|
|
10
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 De, 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";
|
|
@@ -41,7 +41,7 @@ const Dn = (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]), Ke = 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,
|
|
@@ -49,7 +49,7 @@ const Dn = (t, I, h, S) => {
|
|
|
49
49
|
selectable: se(t.gridProps.selectable).enabled,
|
|
50
50
|
clipboard: !!t.gridProps.clipboard
|
|
51
51
|
});
|
|
52
|
-
}, [v, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]),
|
|
52
|
+
}, [v, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), Me = a.useMemo(() => {
|
|
53
53
|
const e = t.gridProps.sortable && (v == null ? void 0 : v.sortable);
|
|
54
54
|
return Pn({
|
|
55
55
|
pdf: !!t.gridProps.pdf,
|
|
@@ -61,20 +61,20 @@ const Dn = (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 ? _e.body : _e.head, r = n[o], i = h.dataItem ?
|
|
64
|
+
const o = h.dataItem ? _e.body : _e.head, r = n[o], i = h.dataItem ? Me : Ke;
|
|
65
65
|
return r === !1 ? void 0 : r === !0 || r === void 0 ? i : r;
|
|
66
66
|
}
|
|
67
|
-
}, [t.gridProps.contextMenu, h,
|
|
68
|
-
var l, s, u, m, f,
|
|
67
|
+
}, [t.gridProps.contextMenu, h, Me, Ke, v]), $e = (e) => {
|
|
68
|
+
var l, s, u, m, f, w, P, X, J;
|
|
69
69
|
const n = e.event.item, o = {
|
|
70
|
-
target:
|
|
70
|
+
target: E.current,
|
|
71
71
|
syntheticEvent: e.event.syntheticEvent,
|
|
72
72
|
nativeEvent: e.event.nativeEvent,
|
|
73
73
|
menuItem: n,
|
|
74
74
|
...e
|
|
75
75
|
};
|
|
76
76
|
t.gridProps.onContextMenuItemClick && c(t.gridProps.onContextMenuItemClick, o);
|
|
77
|
-
const r =
|
|
77
|
+
const r = C(), i = {
|
|
78
78
|
selectedField: "",
|
|
79
79
|
componentId: t.id,
|
|
80
80
|
dataItems: r,
|
|
@@ -95,7 +95,7 @@ const Dn = (t, I, h, S) => {
|
|
|
95
95
|
case "SortCommand":
|
|
96
96
|
if (v) {
|
|
97
97
|
const Y = (s = n.name) == null ? void 0 : s.toLowerCase().includes("asc"), Bt = ((u = n.name) == null ? void 0 : u.toLowerCase().includes("desc")) ? "desc" : void 0, Ut = Y ? "asc" : Bt, Vt = n.name ? Ut : void 0;
|
|
98
|
-
|
|
98
|
+
Te(e.event.syntheticEvent, v, Vt);
|
|
99
99
|
}
|
|
100
100
|
break;
|
|
101
101
|
case "SelectRowCommand":
|
|
@@ -105,17 +105,17 @@ const Dn = (t, I, h, S) => {
|
|
|
105
105
|
ut(i);
|
|
106
106
|
break;
|
|
107
107
|
case "ExportPDFCommand":
|
|
108
|
-
|
|
108
|
+
fe();
|
|
109
109
|
break;
|
|
110
110
|
case "ClearSelectionCommand":
|
|
111
111
|
mt(i);
|
|
112
112
|
break;
|
|
113
113
|
case "ReorderRowCommand":
|
|
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"), (
|
|
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"), (w = n.name) != null && w.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
|
+
De.copy,
|
|
119
119
|
e.event.nativeEvent,
|
|
120
120
|
{
|
|
121
121
|
copyHeaders: !((X = n.name) != null && X.toLowerCase().includes("noheaders"))
|
|
@@ -126,7 +126,7 @@ const Dn = (t, I, h, S) => {
|
|
|
126
126
|
break;
|
|
127
127
|
case "PasteCommand":
|
|
128
128
|
oe(
|
|
129
|
-
|
|
129
|
+
De.paste,
|
|
130
130
|
e.event.nativeEvent,
|
|
131
131
|
{
|
|
132
132
|
copyHeaders: !((J = n.name) != null && J.toLowerCase().includes("noheaders"))
|
|
@@ -143,7 +143,7 @@ const Dn = (t, I, h, S) => {
|
|
|
143
143
|
}, Xe = (e, n, o) => {
|
|
144
144
|
if (t.gridProps.onContextMenu && I) {
|
|
145
145
|
const r = {
|
|
146
|
-
target:
|
|
146
|
+
target: E.current,
|
|
147
147
|
syntheticEvent: e,
|
|
148
148
|
nativeEvent: e.nativeEvent,
|
|
149
149
|
dataItem: n,
|
|
@@ -159,13 +159,13 @@ const Dn = (t, I, h, S) => {
|
|
|
159
159
|
}, Je = (e) => {
|
|
160
160
|
if (e.target !== e.currentTarget)
|
|
161
161
|
return;
|
|
162
|
-
clearTimeout(
|
|
162
|
+
clearTimeout(ye.current), b.current && (b.current.table = H.current);
|
|
163
163
|
const n = e.currentTarget.scrollLeft, o = e.currentTarget.scrollTop;
|
|
164
|
-
t.gridProps.columnVirtualization && (!y || o ===
|
|
164
|
+
t.gridProps.columnVirtualization && (!y || o === we.current) && (ye.current = window.setTimeout(() => {
|
|
165
165
|
O();
|
|
166
|
-
}, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = n), q.current && q.current.setScrollLeft(n), _.current && _.current.setScrollLeft(n), b.current && o !==
|
|
166
|
+
}, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = n), q.current && q.current.setScrollLeft(n), _.current && _.current.setScrollLeft(n), b.current && o !== we.current && b.current.scrollHandler(e), t.gridProps.onScroll && I && c(t.gridProps.onScroll, {
|
|
167
167
|
...R(e)
|
|
168
|
-
}),
|
|
168
|
+
}), we.current = o;
|
|
169
169
|
}, Ye = (e) => {
|
|
170
170
|
V.onKeyDown(e, {
|
|
171
171
|
navigatable: t.gridProps.navigatable || !1,
|
|
@@ -179,7 +179,7 @@ const Dn = (t, I, h, S) => {
|
|
|
179
179
|
navigationStateRef: N
|
|
180
180
|
});
|
|
181
181
|
const n = {
|
|
182
|
-
dataItems:
|
|
182
|
+
dataItems: C(),
|
|
183
183
|
mode: g.mode,
|
|
184
184
|
cell: g.cell,
|
|
185
185
|
componentId: t.id,
|
|
@@ -270,7 +270,7 @@ const Dn = (t, I, h, S) => {
|
|
|
270
270
|
groupExpand: i
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
|
-
},
|
|
273
|
+
}, Te = (e, n, o) => {
|
|
274
274
|
const { allowUnsort: r, mode: i } = wn(
|
|
275
275
|
t.gridProps.sortable || !1,
|
|
276
276
|
n.sortable || !1
|
|
@@ -294,7 +294,7 @@ const Dn = (t, I, h, S) => {
|
|
|
294
294
|
endColIndex: d,
|
|
295
295
|
startRowIndex: i,
|
|
296
296
|
endRowIndex: i,
|
|
297
|
-
dataItems:
|
|
297
|
+
dataItems: C(),
|
|
298
298
|
altKey: !1,
|
|
299
299
|
ctrlKey: !1,
|
|
300
300
|
shiftKey: !1,
|
|
@@ -319,7 +319,7 @@ const Dn = (t, I, h, S) => {
|
|
|
319
319
|
if (!g.enabled || !t.gridProps.dataItemKey)
|
|
320
320
|
return;
|
|
321
321
|
const n = {
|
|
322
|
-
dataItems:
|
|
322
|
+
dataItems: C(),
|
|
323
323
|
mode: g.mode,
|
|
324
324
|
cell: g.cell,
|
|
325
325
|
componentId: t.id,
|
|
@@ -354,13 +354,13 @@ const Dn = (t, I, h, S) => {
|
|
|
354
354
|
}
|
|
355
355
|
}, ct = (e) => {
|
|
356
356
|
if (t.gridProps.onHeaderSelectionChange && g.enabled) {
|
|
357
|
-
const n =
|
|
357
|
+
const n = C();
|
|
358
358
|
c(t.gridProps.onHeaderSelectionChange, {
|
|
359
359
|
select: e.syntheticEvent.target.checked ? n.reduce((o, r) => (t.gridProps.dataItemKey && Z(t.gridProps.dataItemKey)(r) !== void 0 && (o[Z(t.gridProps.dataItemKey)(r)] = !0), o), {}) : {},
|
|
360
360
|
field: e.field,
|
|
361
361
|
nativeEvent: e.syntheticEvent && e.syntheticEvent.nativeEvent,
|
|
362
362
|
syntheticEvent: e.syntheticEvent,
|
|
363
|
-
target:
|
|
363
|
+
target: E.current,
|
|
364
364
|
dataItems: n
|
|
365
365
|
});
|
|
366
366
|
}
|
|
@@ -372,12 +372,12 @@ const Dn = (t, I, h, S) => {
|
|
|
372
372
|
}, st = (e) => {
|
|
373
373
|
var n;
|
|
374
374
|
if (t.gridProps.onSelectionChange && g.enabled) {
|
|
375
|
-
const o =
|
|
375
|
+
const o = C()[e.startRowIndex], r = C()[e.endRowIndex], i = {
|
|
376
376
|
syntheticEvent: void 0,
|
|
377
|
-
target:
|
|
377
|
+
target: E.current,
|
|
378
378
|
selectedField: "",
|
|
379
379
|
componentId: t.id,
|
|
380
|
-
dataItems:
|
|
380
|
+
dataItems: C(),
|
|
381
381
|
dataItem: null,
|
|
382
382
|
startDataItem: o,
|
|
383
383
|
endDataItem: r,
|
|
@@ -425,10 +425,10 @@ const Dn = (t, I, h, S) => {
|
|
|
425
425
|
}, ft = (e) => {
|
|
426
426
|
if (!g.enabled)
|
|
427
427
|
return;
|
|
428
|
-
const n =
|
|
428
|
+
const n = C(), o = {
|
|
429
429
|
syntheticEvent: void 0,
|
|
430
430
|
nativeEvent: void 0,
|
|
431
|
-
target:
|
|
431
|
+
target: E.current,
|
|
432
432
|
selectedField: "",
|
|
433
433
|
componentId: t.id,
|
|
434
434
|
dataItems: n,
|
|
@@ -466,9 +466,9 @@ const Dn = (t, I, h, S) => {
|
|
|
466
466
|
let d = -1, l = -1, s = n[0] || null, u = n[n.length - 1] || null;
|
|
467
467
|
if (t.gridProps.dataItemKey) {
|
|
468
468
|
const f = Z(t.gridProps.dataItemKey);
|
|
469
|
-
for (let
|
|
470
|
-
const P = f(n[
|
|
471
|
-
P !== void 0 && r[P] && (d === -1 && (d =
|
|
469
|
+
for (let w = 0; w < n.length; w++) {
|
|
470
|
+
const P = f(n[w]);
|
|
471
|
+
P !== void 0 && r[P] && (d === -1 && (d = w, s = n[w]), l = w, u = n[w]);
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
const m = {
|
|
@@ -509,14 +509,14 @@ const Dn = (t, I, h, S) => {
|
|
|
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
|
+
}, ge = () => {
|
|
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 = ge();
|
|
520
520
|
o < r && te({ skip: o, take: n }, e);
|
|
521
521
|
}, bt = (e) => {
|
|
522
522
|
var r, i;
|
|
@@ -578,25 +578,25 @@ const Dn = (t, I, h, S) => {
|
|
|
578
578
|
{ skip: 0 },
|
|
579
579
|
e.syntheticEvent
|
|
580
580
|
);
|
|
581
|
-
},
|
|
581
|
+
}, fe = () => {
|
|
582
582
|
var e;
|
|
583
583
|
(e = G.current) == null || e.save();
|
|
584
584
|
}, wt = async (e) => {
|
|
585
585
|
var n, o;
|
|
586
586
|
(n = t.gridProps) != null && n.onPdfExport && await ((o = t.gridProps) == null ? void 0 : o.onPdfExport(e));
|
|
587
|
-
},
|
|
587
|
+
}, me = (e, n) => {
|
|
588
588
|
const o = n.nativeEvent ? n : { nativeEvent: n.nativeEvent || n.originalEvent };
|
|
589
589
|
let r = {};
|
|
590
|
-
t.isVirtualScroll && e.length && !t.gridProps.pageable && (r = { take: void 0 }), e.length === 0 && t.gridProps.navigatable && (
|
|
590
|
+
t.isVirtualScroll && e.length && !t.gridProps.pageable && (r = { take: void 0 }), e.length === 0 && t.gridProps.navigatable && (Ie.current = !0), F(
|
|
591
591
|
t.gridProps.onGroupChange,
|
|
592
592
|
{ group: e },
|
|
593
593
|
{ group: e, skip: 0, ...r },
|
|
594
594
|
o
|
|
595
595
|
);
|
|
596
|
-
},
|
|
596
|
+
}, Pe = (e) => {
|
|
597
597
|
if (t.gridProps.onColumnsStateChange) {
|
|
598
598
|
const n = {
|
|
599
|
-
target:
|
|
599
|
+
target: E.current,
|
|
600
600
|
columnsState: e
|
|
601
601
|
};
|
|
602
602
|
c(t.gridProps.onColumnsStateChange, n);
|
|
@@ -614,18 +614,18 @@ const Dn = (t, I, h, S) => {
|
|
|
614
614
|
J && (J.orderIndex = X);
|
|
615
615
|
});
|
|
616
616
|
const f = r[e].locked && r[n].locked;
|
|
617
|
-
cn(t.columnsMapRef, r, f || le.current), sn(t.columnsMapRef, r, f || le.current),
|
|
618
|
-
const
|
|
617
|
+
cn(t.columnsMapRef, r, f || le.current), sn(t.columnsMapRef, r, f || le.current), ve.current && (le.current = !1, ve.current = !1);
|
|
618
|
+
const w = ee();
|
|
619
619
|
if (O(), t.gridProps.onColumnReorder) {
|
|
620
620
|
const P = {
|
|
621
|
-
target:
|
|
622
|
-
columns:
|
|
621
|
+
target: E.current,
|
|
622
|
+
columns: w,
|
|
623
623
|
columnId: d.id,
|
|
624
624
|
nativeEvent: o
|
|
625
625
|
};
|
|
626
626
|
c(t.gridProps.onColumnReorder, P);
|
|
627
627
|
}
|
|
628
|
-
|
|
628
|
+
Pe(i);
|
|
629
629
|
}, j = (e, n, o) => {
|
|
630
630
|
const r = typeof t.gridProps.rowReorderable == "object" ? t.gridProps.rowReorderable.enabled : t.gridProps.rowReorderable;
|
|
631
631
|
if (o === "forbidden" || !r || !$.current)
|
|
@@ -637,23 +637,23 @@ const Dn = (t, I, h, S) => {
|
|
|
637
637
|
dropPosition: o,
|
|
638
638
|
nativeEvent: e.originalEvent,
|
|
639
639
|
dragEvent: e,
|
|
640
|
-
target:
|
|
640
|
+
target: E.current
|
|
641
641
|
}), $.current = null;
|
|
642
642
|
}, yt = (e, n, o) => {
|
|
643
643
|
if (t.gridProps.group === void 0)
|
|
644
644
|
return;
|
|
645
645
|
const r = t.gridProps.group.slice();
|
|
646
|
-
r.splice(n, 0, ...r.splice(e, 1)),
|
|
646
|
+
r.splice(n, 0, ...r.splice(e, 1)), me(r, o);
|
|
647
647
|
}, Ge = (e, n, o) => {
|
|
648
648
|
const r = t.columnsRef[e].field;
|
|
649
649
|
if (!r)
|
|
650
650
|
return;
|
|
651
651
|
const i = (t.gridProps.group || []).slice();
|
|
652
|
-
i.splice(n, 0, { field: r }),
|
|
652
|
+
i.splice(n, 0, { field: r }), me(i, o);
|
|
653
653
|
}, xt = (e, n) => {
|
|
654
654
|
const o = K.current.getCurrentGroupsLength;
|
|
655
655
|
Ge(e, o, n);
|
|
656
|
-
},
|
|
656
|
+
}, he = () => {
|
|
657
657
|
let e = 0;
|
|
658
658
|
if (!D.current.colGroupMain)
|
|
659
659
|
return;
|
|
@@ -693,13 +693,13 @@ const Dn = (t, I, h, S) => {
|
|
|
693
693
|
field: i,
|
|
694
694
|
...typeof t.gridProps.clipboard != "boolean" ? t.gridProps.clipboard : {},
|
|
695
695
|
...o
|
|
696
|
-
}, l =
|
|
696
|
+
}, l = C(), s = Jt({
|
|
697
697
|
event: d,
|
|
698
698
|
data: l,
|
|
699
699
|
selectedState: (u = t.gridProps.select) != null ? u : {},
|
|
700
700
|
previousCopiedItems: Be.current
|
|
701
701
|
});
|
|
702
|
-
e !==
|
|
702
|
+
e !== De.paste && (Be.current = s.copiedItems), t.gridProps.onClipboard && I && c(t.gridProps.onClipboard, {
|
|
703
703
|
...d,
|
|
704
704
|
...s
|
|
705
705
|
});
|
|
@@ -718,7 +718,7 @@ const Dn = (t, I, h, S) => {
|
|
|
718
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
|
+
he(), le.current = !0, ve.current = !0, t.gridProps.onColumnResize && I && c(t.gridProps.onColumnResize, {
|
|
722
722
|
columns: ee(),
|
|
723
723
|
nativeEvent: r,
|
|
724
724
|
targetColumnId: l,
|
|
@@ -726,8 +726,8 @@ const Dn = (t, I, h, S) => {
|
|
|
726
726
|
newWidth: n,
|
|
727
727
|
oldWidth: o,
|
|
728
728
|
end: i,
|
|
729
|
-
target:
|
|
730
|
-
}), i &&
|
|
729
|
+
target: E.current
|
|
730
|
+
}), i && Pe(d);
|
|
731
731
|
}, Dt = () => {
|
|
732
732
|
var e;
|
|
733
733
|
return {
|
|
@@ -740,7 +740,7 @@ const Dn = (t, I, h, S) => {
|
|
|
740
740
|
}, R = (e) => ({
|
|
741
741
|
nativeEvent: e && e.nativeEvent,
|
|
742
742
|
syntheticEvent: e,
|
|
743
|
-
target:
|
|
743
|
+
target: E.current
|
|
744
744
|
}), Kt = (e) => ({
|
|
745
745
|
...e,
|
|
746
746
|
nativeEvent: void 0,
|
|
@@ -757,17 +757,17 @@ const Dn = (t, I, h, S) => {
|
|
|
757
757
|
}, Mt = () => {
|
|
758
758
|
var e, n, o;
|
|
759
759
|
if (U.current && ((e = U.current) == null ? void 0 : e.getElementsByClassName("k-grid-edit-row").length) > 0) {
|
|
760
|
-
|
|
760
|
+
Ee.current = !1, (n = document.activeElement) != null && n.closest(".k-grid-edit-row") ? Ce.current = document.activeElement : Ce.current = void 0;
|
|
761
761
|
const r = Array.from((o = U.current) == null ? void 0 : o.getElementsByClassName("k-grid-edit-row"));
|
|
762
|
-
r.length >
|
|
763
|
-
(i) => !
|
|
764
|
-
)[0] : r.length === 1 && (de.current = r[0],
|
|
762
|
+
r.length > Se.current.length ? de.current = r.filter(
|
|
763
|
+
(i) => !Se.current.includes(i)
|
|
764
|
+
)[0] : r.length === 1 && (de.current = r[0], Ee.current = !0), Se.current = r;
|
|
765
765
|
}
|
|
766
|
-
},
|
|
766
|
+
}, C = () => 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;
|
|
770
|
-
}, ie = () => A.current,
|
|
770
|
+
}, ie = () => A.current, Re = a.useCallback(
|
|
771
771
|
(e) => {
|
|
772
772
|
var r, i;
|
|
773
773
|
if (!b.current || !((r = b.current) != null && r.container) || t.gridProps.scrollable === "none")
|
|
@@ -791,15 +791,15 @@ const Dn = (t, I, h, S) => {
|
|
|
791
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
792
|
}, Oe = a.useCallback(
|
|
793
793
|
(e) => {
|
|
794
|
-
const n = { rowIndex:
|
|
794
|
+
const n = { rowIndex: xe.current };
|
|
795
795
|
e.forEach((o) => {
|
|
796
|
-
o.boundingClientRect.height !== o.intersectionRect.height &&
|
|
796
|
+
o.boundingClientRect.height !== o.intersectionRect.height && Re(n);
|
|
797
797
|
});
|
|
798
798
|
},
|
|
799
|
-
[
|
|
799
|
+
[Re]
|
|
800
800
|
), O = () => {
|
|
801
801
|
t.gridProps.forceUpdate && t.gridProps.forceUpdate();
|
|
802
|
-
}, Gt = (e) => e.left !== void 0 ?
|
|
802
|
+
}, Gt = (e) => e.left !== void 0 ? ke !== "rtl" ? { left: e.left, right: e.right } : { left: e.right, right: e.left } : {}, E = 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), be = a.useRef(null), A = a.useRef(null), Ne = a.useRef(null), _ = a.useRef(null), q = a.useRef(null), ve = a.useRef(!1), Ie = a.useRef(!1), de = a.useRef(void 0), Ce = a.useRef(void 0), Ee = a.useRef(!1), le = a.useRef(!0), we = a.useRef(0), ye = a.useRef(void 0), xe = a.useRef(void 0), Se = a.useRef([]), Be = a.useRef([]), ce = a.useRef(0), $ = a.useRef(null), zt = a.useRef(null), Ft = a.useRef(null), ke = _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,
|
|
@@ -820,24 +820,24 @@ const Dn = (t, I, h, S) => {
|
|
|
820
820
|
t.gridProps.rowHeight
|
|
821
821
|
]), a.useEffect(() => (t.gridProps.clipboard && (ae.current = new Qt(oe), ae.current.addEventListeners(k())), () => {
|
|
822
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) && (
|
|
823
|
+
}), [t.gridProps.onClipboard, t.gridProps.clipboard, oe, k]), a.useEffect(() => (t.gridProps.columnVirtualization && !window.navigator.userAgent.match(fn) && (be.current && (be.current.style.display = "block"), H.current && (H.current.style.display = "block")), Le(), he(), We(), V.onComponentDidMount({
|
|
824
824
|
scope: A.current || void 0,
|
|
825
825
|
contextStateRef: M,
|
|
826
826
|
navigationStateRef: N
|
|
827
827
|
}), () => {
|
|
828
|
-
clearTimeout(
|
|
828
|
+
clearTimeout(ye.current);
|
|
829
829
|
}), []), a.useEffect(() => {
|
|
830
830
|
var e;
|
|
831
|
-
Le(),
|
|
831
|
+
Le(), he(), 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,
|
|
835
|
-
focusFirst:
|
|
835
|
+
focusFirst: Ie.current,
|
|
836
836
|
newEditableRow: de.current,
|
|
837
|
-
singleEditRow:
|
|
838
|
-
lastActiveElement:
|
|
837
|
+
singleEditRow: Ee.current,
|
|
838
|
+
lastActiveElement: Ce.current,
|
|
839
839
|
navigatable: t.gridProps.navigatable
|
|
840
|
-
}),
|
|
840
|
+
}), Ie.current = !1, de.current = void 0;
|
|
841
841
|
}), a.useEffect(() => {
|
|
842
842
|
if (Q) {
|
|
843
843
|
const e = {
|
|
@@ -868,7 +868,7 @@ const Dn = (t, I, h, S) => {
|
|
|
868
868
|
n.disconnect();
|
|
869
869
|
};
|
|
870
870
|
}, [y, re]), a.useImperativeHandle(
|
|
871
|
-
|
|
871
|
+
E,
|
|
872
872
|
() => ({
|
|
873
873
|
get element() {
|
|
874
874
|
return ie();
|
|
@@ -882,20 +882,22 @@ const Dn = (t, I, h, S) => {
|
|
|
882
882
|
if (!((r = b.current) != null && r.container) || t.gridProps.scrollable === "none")
|
|
883
883
|
return;
|
|
884
884
|
const { rowIndex: n } = e;
|
|
885
|
-
|
|
885
|
+
xe.current = n;
|
|
886
886
|
const o = ie();
|
|
887
887
|
if (B.current && o) {
|
|
888
888
|
B.current.disconnect();
|
|
889
|
-
const i = o.querySelector(`[absolute-row-index="${
|
|
890
|
-
i ? B.current.observe(i) :
|
|
889
|
+
const i = o.querySelector(`[absolute-row-index="${xe.current}"]`);
|
|
890
|
+
i ? B.current.observe(i) : Re(e);
|
|
891
891
|
}
|
|
892
892
|
},
|
|
893
893
|
fitColumns: (e) => {
|
|
894
894
|
D.current.dblClickHandler(null, e);
|
|
895
895
|
},
|
|
896
|
-
exportAsPdf:
|
|
896
|
+
exportAsPdf: fe,
|
|
897
|
+
getTotal: ge,
|
|
898
|
+
getLeafDataItems: C
|
|
897
899
|
})
|
|
898
|
-
), a.useImperativeHandle(t.gridRef, () =>
|
|
900
|
+
), a.useImperativeHandle(t.gridRef, () => E.current), a.useMemo(() => {
|
|
899
901
|
D.current = new un(ze);
|
|
900
902
|
}, [t.gridProps.onColumnResize, t.columnsRef]), a.useMemo(() => {
|
|
901
903
|
K.current = new gn(ne, yt, Ge);
|
|
@@ -905,7 +907,7 @@ const Dn = (t, I, h, S) => {
|
|
|
905
907
|
t.gridProps.group,
|
|
906
908
|
t.columnsRef,
|
|
907
909
|
t.gridProps.groupable
|
|
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 =
|
|
910
|
+
]), 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 = ke, At(), /* @__PURE__ */ a.createElement(
|
|
909
911
|
Sn.Provider,
|
|
910
912
|
{
|
|
911
913
|
value: {
|
|
@@ -914,31 +916,31 @@ const Dn = (t, I, h, S) => {
|
|
|
914
916
|
activeDragRowDataItemRef: $,
|
|
915
917
|
reorderRowDragTargetRef: zt,
|
|
916
918
|
reorderRowDropTargetRef: Ft,
|
|
917
|
-
dir:
|
|
919
|
+
dir: ke,
|
|
918
920
|
getCellPositionStyle: Gt,
|
|
919
921
|
dataItemKey: t.gridProps.dataItemKey,
|
|
920
922
|
columnsState: t.columnsState,
|
|
921
923
|
columnsRef: t.columnsRef,
|
|
922
924
|
hiddenColumnsRef: t.hiddenColumnsRef,
|
|
923
|
-
onColumnsStateChange:
|
|
925
|
+
onColumnsStateChange: Pe,
|
|
924
926
|
groupable: t.gridProps.groupable,
|
|
925
927
|
group: t.gridProps.group,
|
|
926
928
|
reorderable: t.gridProps.reorderable,
|
|
927
929
|
defaultGroup: t.gridProps.defaultGroup,
|
|
928
|
-
groupChange:
|
|
930
|
+
groupChange: me,
|
|
929
931
|
selectionRelease: st,
|
|
930
932
|
pagerPageChange: vt,
|
|
931
933
|
onContextMenu: Xe,
|
|
932
934
|
rowClick: pe,
|
|
933
935
|
rowDblClick: et,
|
|
934
936
|
cellClick: rt,
|
|
935
|
-
headerCellClick:
|
|
937
|
+
headerCellClick: Te,
|
|
936
938
|
itemChange: at,
|
|
937
939
|
onDialogEditCancel: nt,
|
|
938
940
|
onDialogEditSubmit: tt,
|
|
939
941
|
columnReorder: ne,
|
|
940
942
|
onResize: ze,
|
|
941
|
-
getTotal:
|
|
943
|
+
getTotal: ge,
|
|
942
944
|
sortable: t.gridProps.sortable,
|
|
943
945
|
pageable: t.gridProps.pageable,
|
|
944
946
|
pageSize: t.gridProps.pageSize,
|
|
@@ -951,13 +953,14 @@ const Dn = (t, I, h, S) => {
|
|
|
951
953
|
filter: t.gridProps.filter,
|
|
952
954
|
defaultFilter: t.gridProps.defaultFilter,
|
|
953
955
|
filterOperators: t.gridProps.filterOperators || kn,
|
|
954
|
-
getLeafDataItems:
|
|
956
|
+
getLeafDataItems: C,
|
|
955
957
|
filterChange: It,
|
|
956
958
|
applyHighlightDescriptor: Ct,
|
|
957
959
|
applySelectionDescriptor: ft,
|
|
958
960
|
highlight: t.gridProps.highlight,
|
|
961
|
+
select: t.gridProps.select,
|
|
959
962
|
searchChange: Et,
|
|
960
|
-
exportAsPdf:
|
|
963
|
+
exportAsPdf: fe,
|
|
961
964
|
onHeaderSelectionChange: ct,
|
|
962
965
|
columnGroupChange: xt,
|
|
963
966
|
onKeyDown: Ye,
|
|
@@ -977,7 +980,7 @@ const Dn = (t, I, h, S) => {
|
|
|
977
980
|
tableBodyElementRef: U,
|
|
978
981
|
headerElementRef: Lt,
|
|
979
982
|
containerElementRef: T,
|
|
980
|
-
headTableElementRef:
|
|
983
|
+
headTableElementRef: be,
|
|
981
984
|
elementRef: A,
|
|
982
985
|
virtualScrollHeightContainerRef: Ne,
|
|
983
986
|
footerRef: _,
|
package/GridComponent.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ht=require("react"),c=require("@progress/kendo-react-common"),Pt=require("@progress/kendo-data-query"),b=require("@progress/kendo-react-data-tools"),Kt=require("./cells/hierarchycell/GridHierarchyCell.js"),At=require("./cells/editcell/GridEditCell.js"),Wt=require("./header/Header.js"),Mt=require("./header/HeaderRow.js"),Ot=require("./header/FilterRow.js"),Lt=require("./header/GroupPanel.js"),zt=require("./footer/Footer.js"),u=require("./utils/index.js"),Bt=require("./cells/datacell/GridCell.js"),Ye=require("./cells/groupcell/GridGroupCell.js"),Ft=require("./rows/GridRow.js"),_t=require("./header/GridHeaderSelectionCell.js"),Ze=require("./components/noRecords/GridNoRecords.js"),pe=require("./filterCommon.js"),Vt=require("./footer/FooterRow.js"),jt=require("./paging/GridPagerSettings.js"),ie=require("./package-metadata.js"),$t=require("./cells/detailcell/GridDetailCell.js"),Qt=require("./cells/GridDetailHierarchyCell.js"),et=require("./components/noRecords/GridNoRecordsContainer.js"),tt=require("./GridClientWrapper.js"),Ut=require("./components/colGroup/GridColGroup.js"),Jt=require("./components/table/GridTable.js"),at=require("./components/GridDropClue.js"),lt=require("./components/GridDragClue.js"),rt=require("./components/table/GridTableBody.js"),Xt=require("./components/PagerContainer.js"),Yt=require("./components/table/GridTableScrollable.js"),nt=require("./components/GridElementContainer.js"),Zt=require("./components/GridContainerElementContainer.js"),pt=require("./components/VirtualScrollHeightContainer.js"),de=require("./messages/index.js"),ea=require("./components/GridDraggableRowsContainer.js"),ta=require("./cells/rowreordercell/GridRowReorderCell.js"),aa=require("./header/client/GridHeaderRowReorderCell.js"),it=require("./components/GridLoader.js"),la=require("./utils/premium.js"),dt=require("@progress/kendo-react-intl"),ra=require("./utils/virtualColumns.js"),na=require("./components/GridEditDialog.js"),ia=require("./cells/datacell/GridCellServer.js"),da=require("./cells/editcell/GridEditCellServer.js"),oa=require("./cells/selectioncell/GridSelectionCellServer.js"),sa=require("./cells/selectioncell/GridSelectionCell.js"),ca=require("./cells/hierarchycell/GridHierarchyCellServer.js"),ua=require("./cells/rowreordercell/GridRowReorderCellServer.js"),ma=require("./cells/detailcell/GridDetailCellServer.js"),ga=require("./cells/groupcell/GridGroupCellServer.js");function fa(e){const A=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const w in e)if(w!=="default"){const v=Object.getOwnPropertyDescriptor(e,w);Object.defineProperty(A,w,v.get?v:{enumerable:!0,get:()=>e[w]})}}return A.default=e,Object.freeze(A)}const r=fa(Ht),ot=r.forwardRef((e,A)=>{var Pe,Ke,Ae,We,Me,Oe,Le,ze,Be,Fe,_e,Ve;const w=e.id+"-role-element-id",v=e.navigatable?w:"";let G=e.columnsState||[];const st=(t,d,i,o,a,l,s)=>{const g=[],y=u.flatData(g,t,d,{index:i},o!==void 0,a,l,Et.defaultExpand,s);return{flattedData:g,resolvedGroupsCount:y}},ct=t=>{const d=t.filter(i=>i&&i.type&&i.type.displayName==="KendoReactGridColumn");return u.readColumns(d,G,{prevId:0,idPrefix:v})},ut=()=>{const t=[],d=(i,o)=>i==null?void 0:i.forEach(a=>{const l=a.hidden||o;t.push({...a,hidden:l}),d(a.children,l)});return d(G,!1),t},mt=t=>{const d=ut();return[t.filter(i=>{var o;return!i.hidden&&!((o=d.find(a=>a.id===i.id))!=null&&o.hidden)}),t.filter(i=>{var o;return i.hidden||((o=d.find(a=>a.id===i.id))==null?void 0:o.hidden)})]},gt=(t,d)=>{m=ct(t),m.filter(a=>!a.hidden).length===0&&(m=u.autoGenerateColumns(E,e.group,{column:M.column},{prevId:0,idPrefix:v})),bt(m,d);const[i,o]=mt(m);m=i,ce=o,W=u.mapColumns(m,G,!0),ue=m.map(u.clientColumn)},ft=(t,d)=>{const i=o=>{var l;const a=d.find(s=>s.id===o.id);if(a){const s={...a};return s.children=(l=o.children)==null?void 0:l.map(i),s}return u.getColumnState(o)};G=t.filter(o=>o.parentIndex===-1).map(i)},bt=(t,d)=>{t.filter(l=>l.columnType==="checkbox").forEach(l=>{l.width=l.width||"50px",l.defaultCell=e.isClient?sa.GridSelectionCell:oa.GridSelectionCellServer,l.defaultHeaderCell=_t.GridHeaderSelectionCell,l._type="edit"}),H!==void 0&&t.filter(l=>l.columnType==="reorder").forEach(l=>{l.width=l.width||"50px",l.defaultCell=e.isClient?ta.GridRowReorderCell:ua.GridRowReorderCellServer,l.defaultHeaderCell=aa.GridHeaderRowReorderCell,l.sortable=!1,l.filterable=!1,l.editable=!1});const i=u.getFlatColumnsState(G);ft(t,i);const o={id:"",resizable:!0,width:"32px",title:" ",declarationIndex:-1,orderIndex:-1,children:[],parentIndex:-1,depth:0,colSpan:0,headerColSpan:0,rowSpan:0,left:0,right:0,index:0,rightBorder:!1,ariaColumnIndex:0,isAccessible:!0};let a=0;if(M.enabled&&e.detail){const l={...o,_type:"expand",id:b.tableKeyboardNavigationTools.generateNavigatableId(`${a++}`,"expand","column"),defaultCell:e.isClient?Kt.GridHierarchyCell:ca.GridHierarchyCellServer,field:M.column,headerClassName:c.classNames(f.hierarchyCell({}))};t.unshift(l),G.unshift(i.find(s=>s.id===l.id)||u.getColumnState(l))}for(let l=0;l<d;l++){const s={...o,isAccessible:!1,defaultCell:e.isClient?Ye.GridGroupCell:ga.GridGroupCellServer,id:b.tableKeyboardNavigationTools.generateNavigatableId(`${a++}`,"group","column"),field:"value",locked:e.lockGroups};t.unshift(s),G.unshift(i.find(g=>g.id===s.id)||u.getColumnState(s))}t.slice(a).forEach(l=>{l.parentIndex>=0&&(l.parentIndex+=a),l.rowSpannable=l.rowSpannable!==void 0?u.getRowSpanOptions(l.rowSpannable):he})},oe=()=>e.isClient?m:ue,se=t=>{const d=[];let i=null,o=0;if(C.forEach((a,l)=>{let s=parseFloat((a.width||"").toString())||10;if(typeof(a==null?void 0:a.width)=="number"&&(a!=null&&a.minResizableWidth)&&(a==null?void 0:a.width)<(a==null?void 0:a.minResizableWidth)&&(s=a==null?void 0:a.minResizableWidth),typeof(a==null?void 0:a.width)=="number"&&(a!=null&&a.minWidth)&&(a==null?void 0:a.width)<(a==null?void 0:a.minWidth)?s=a==null?void 0:a.minWidth:typeof(a==null?void 0:a.width)=="number"&&(a!=null&&a.maxWidth)&&(a==null?void 0:a.width)>(a==null?void 0:a.maxWidth)&&(s=a==null?void 0:a.maxWidth),o){o--,i&&(i.width+=s);return}const g=Math.min(u.getColSpan(a,t),C.length-l);o=g-1,i={width:s,colSpan:g,columnIndex:l},d.push(i)}),e.columnVirtualization){const a=Ct.current||0,l=yt.current||parseFloat(((e.style||{}).width||"").toString());return ra.getVirtualCellsToRender({cellModels:d,columns:C,tableViewPortWidth:l,scrollLeft:a})}return d},ht=()=>{const{pageable:t,take:d,pageSize:i}=e;if(!R)return 0;if(!t){if(d)return d;if(i)return i}const o=e.rowHeight||Gt.current,a=wt.current;return a&&o?Math.ceil(a/o*1.5):0};let h=[],$,m=[],ce=[],ue=[],W=[[]];const Ct=e.scrollLeftRef||{current:0},yt=e.widthRef||{current:0},wt=e.containerHeightRef||{current:0},Gt=e.minRowHeightRef||{current:0},z=e.localization||new dt.LocalizationService(e.language),St=e.intl||new dt.IntlService((Pe=e.locale)!=null?Pe:"en"),T=e.unstyled,f=T&&T.uGrid?T.uGrid:c.uGrid,H=u.isRowReorderEnabled(e.rowReorderable),R=e.scrollable==="virtual"||e.scrollable===void 0&&e.isClient&&c.hasValidLicense(ie.packageMetadata)||!1,me=c.getLicenseMessage(ie.packageMetadata),P=e.autoProcessData===!0?{group:!0,sort:!0,filter:!0,search:!0,page:!0}:e.autoProcessData;let E,q;if(Array.isArray(e.data)?(E=e.data,q=(Ke=e.total)!=null?Ke:E.length):(E=((Ae=e.data)==null?void 0:Ae.data)||[],q=(Oe=(Me=e.total)!=null?Me:(We=e.data)==null?void 0:We.total)!=null?Oe:E.length),P){const t=P.page&&!(R&&!e.pageable),{data:d,total:i}=Pt.process(E,{group:P.group?e.group:void 0,sort:P.sort?e.sort:void 0,filter:b.combineFilters(P.filter?e.filter:void 0,P.search?e.search:void 0),...t?{take:e.pageable?e.take||10:e.take,skip:e.skip||0}:{}});E=d,q=(Le=e.total)!=null?Le:i}const B=E.length===q,{size:I="medium"}=e,vt=typeof e.groupable=="object"&&e.groupable.footer||"none",F=e.groupable===!0||typeof e.groupable=="object"&&e.groupable.enabled!==!1,M=b.getDetailExpandableOptions(!!e.detail),Et=b.getGroupExpandableOptions(typeof e.groupable=="object"&&e.groupable.enabled!==!1?e.groupable.expandable:e.groupable),ge=!!((ze=e.group)!=null&&ze.length),{resolvedGroupsCount:Rt,flattedData:It}=st(E,vt,B?0:e.skip||0,e.group,e.detailExpand,e.groupExpand,e.dataItemKey);h=It;const Q=ht(),U=((Be=e.virtualSkipRef)==null?void 0:Be.current)||0;let fe=q;if(R){let t=e.skip||0;if((ge||e.pageable)&&(t=U,fe=h.length),B||ge||e.pageable)if(Q===0){const d=Math.min(e.take||e.pageSize||20,h.length);$=h.slice(t,t+d)}else $=h.slice(t,t+Q)}const be=b.getSelectionOptions(e.selectable),he=u.getRowSpanOptions(e.rowSpannable),Nt=be&&be.drag?"none":void 0,_=r.useMemo(()=>r.Children.toArray(e.children),[e.children]);gt(_,Rt);const J=r.useMemo(()=>{const t=la.gridPremiumFeatures(e,m);return{premium:t.length>0,features:t}},[e,m]),Ce=r.useMemo(()=>J.premium?!c.validatePackage(ie.packageMetadata,{component:"Grid",features:J.features}):!1,[J.premium]),ye=_.map(t=>t&&t.type&&t.type.displayName==="KendoReactGridToolbar"?r.cloneElement(t,{...t.props,_ariaControls:w,ariaLabel:"Top toolbar"}):null),V=_.filter(t=>t&&t.type&&t.type.displayName==="KendoReactGridNoRecords"),we=_.filter(t=>t&&t.type&&t.type.displayName==="KendoReactGridStatusBar"),C=m.filter(t=>t.children.length===0),Ge=F&&r.createElement(Lt.GroupPanel,{columns:oe(),group:e.group||[],ariaControls:w}),Se=r.createElement(Wt.Header,{size:I,staticHeaders:e.scrollable!=="none",draggable:e.reorderable||F,headerRow:r.createElement(Mt.HeaderRow,{cells:e.cells,sort:e.sort,sortable:e.sortable,group:e.group||[],groupable:F,filter:e.filter,filterable:e.filterable,filterOperators:e.filterOperators||pe.operators,columnMenu:e.columnMenu,columnMenuIcon:e.columnMenuIcon,columns:m,columnsMap:W,navigatable:!!e.navigatable,localization:z,unstyled:T,columnsState:G,headerSelectionValue:!!(e.select&&h.filter(t=>t.rowType==="data").every(t=>e.select&&e.dataItemKey&&c.getter(e.dataItemKey)(t.dataItem)!==void 0?e.select[c.getter(e.dataItemKey)(t.dataItem)]:void 0))}),filterRow:e.filterable&&r.createElement(Ot.FilterRow,{cells:e.cells,size:I,columns:m,filter:e.filter,filterOperators:e.filterOperators||pe.operators,sort:e.sort,navigatable:!!e.navigatable,ariaRowIndex:W.length+1,localization:z})||void 0,cols:C.map((t,d)=>r.createElement("col",{key:d.toString(),width:u.getColumnWidth(t)}))}),ve=C.findIndex(t=>typeof t.colSpan=="function")>-1;let X;ve||(X=se(null));const Y=((Fe=e.editable)==null?void 0:Fe.mode)==="dialog",kt=(_e=e.editable)==null?void 0:_e.enabled,qt=(t,d,i,o,a)=>{let l=!1;const s=e.select&&e.dataItemKey&&c.getter(e.dataItemKey)(t.dataItem)!==void 0?e.select[c.getter(e.dataItemKey)(t.dataItem)]:void 0,g=e.highlight&&e.dataItemKey&&c.getter(e.dataItemKey)(t.dataItem)!==void 0?e.highlight[c.getter(e.dataItemKey)(t.dataItem)]:void 0;return ve&&(X=se(t.dataItem)),{row:X.map(({columnIndex:y,colSpan:K})=>{var je,$e,Qe,Ue,Je,Xe;const n=C[y],x=G[y],S=($e=(je=n.locked)!=null?je:x==null?void 0:x.locked)!=null?$e:!1;let N;if((Qe=n.rowSpannable)!=null&&Qe.enabled&&t.rowType==="data"&&n.field&&a){const k=n.field?(Je=(Ue=n.rowSpannable).valueGetter)==null?void 0:Je.call(Ue,t.dataItem,n.field):null;N={value:k,count:1},a[n.field]&&((Xe=a[n.field])==null?void 0:Xe.value)===k&&a[n.field]!==null?(a[n.field].count++,N.count=null):a[n.field]=N}const te=n.id?n.id:y,ae=c.classNames(f.contentSticky({locked:S}),n.className),le=n.left!==void 0?{left:n.left,right:n.right}:{};let D=!1;if(n.editable&&e.editable){const k=e.edit&&e.dataItemKey?e.edit[c.getter(e.dataItemKey)(t.dataItem)]:void 0,ne=typeof k=="boolean"?k:Array.isArray(k)?n.field&&k.indexOf(n.field)>-1:n.field!==void 0&&k===n.field;ne&&n.columnType==="data"&&(ne===!0||ne===n.field)&&(l=!0,Y||(D=!0))}const L=n._type==="expand",re={locked:e.lockGroups,id:b.tableKeyboardNavigationTools.generateNavigatableId(`${d}-${String(y)}`,v,L||t.rowType==="groupHeader"||t.rowType==="groupFooter"||n.field==="value"?"nodata":"cell"),colSpan:K,dataItem:t.dataItem,field:n.field,editor:n.editor,format:n.format,columnType:n.columnType,rowReorderable:H,className:ae,cells:u.resolveCells(e.cells,n.cells),columnIndex:y,columnsCount:C.length,rowType:t.rowType,level:t.level,expanded:t.expanded,dataIndex:t.dataIndex,rowDataIndex:i,columnPosition:le,style:{},ariaColumnIndex:n.ariaColumnIndex,isSelected:!!((n==null?void 0:n._type)==="edit"?s:Array.isArray(s)&&s.indexOf(y)>-1),isHighlighted:!!((n==null?void 0:n._type)==="edit"?g:Array.isArray(g)&&g.indexOf(y)>-1),isSorted:!!u.isSorted(n.field,e.sort),isInEdit:D,isAlt:o,unstyled:T,group:t.group,localization:z,intl:St,_rowSpan:N},j=n.defaultCell||D&&(e.isClient?At.GridEditCell:da.GridEditCellServer)||(e.isClient?Bt.GridCell:ia.GridCellServer);return r.createElement(j,{key:te,cellProps:re})}),isInEdit:l,isSelected:typeof s=="boolean"&&s,isHighlighted:typeof g=="boolean"&&g}};let xt=0,Z=null;const Ee=t=>t>=h.length-xt,p=[],Re=!h.length;let O=0;if(h.length){const t=W.length+(e.filterable?1:0)+1;let d=e.skip||0,i=-1,o=0;const a=he.enabled?{}:void 0;if(R){if(U>0){const l=h.slice(0,U).filter(s=>s.rowType==="data").length;i+=l,d+=l}!e.pageable&&B&&(i+=e.skip||0)}($||h).forEach((l,s)=>{var N;l.rowType==="data"&&i++;const g=l.dataIndex%2!==0,y=e.dataItemKey&&c.getter(e.dataItemKey)(l.dataItem),K=s+d,n=y||"ai"+K,x=n+"_1",S=qt(l,n,i,g,a);if(O=K+t+o,Y&&kt&&S.isInEdit&&(Z=l.dataItem),p.push(r.createElement(Ft.GridRow,{key:n,dataItem:l.dataItem,isAltRow:g,isInEdit:S.isInEdit&&!Y,rowType:l.rowType,isRowReorderable:H,isHidden:Ee(s),onClick:null,onDoubleClick:null,rowHeight:e.rowHeight,ariaRowIndex:O,absoluteRowIndex:K,dataIndex:i,isSelected:S.isSelected,isHighlighted:S.isHighlighted,rows:e.rows},S.row)),e.detail&&l.rowType==="data"&&l.expanded){const te=C.length-(M.enabled?1:0)-(e.group?e.group.length:0)||1;o++,O=K+t+o;const ae=e.isClient?$t.GridDetailCell:ma.GridDetailCellServer;p.push(r.createElement("tr",{key:x,className:c.classNames(f.detailTr({isAlt:g})),style:{visibility:Ee(s)?"hidden":"",height:e.detailRowHeight},role:"row","aria-rowindex":O},(N=e==null?void 0:e.group)==null?void 0:N.map((le,D)=>{var j;const L=(j=S==null?void 0:S.row[D])==null?void 0:j.props.style,re=L?{left:L.left,right:L.right}:{};return r.createElement(Ye.GridGroupCell,{key:D,cellProps:{id:"",dataItem:l.dataItem,field:le.field,dataIndex:l.dataIndex,columnPosition:re,style:{},ariaColumnIndex:1+D,isSelected:!1,locked:e.lockGroups,cells:e.cells,group:l.group}})}),M.enabled&&r.createElement(Qt.GridDetailHierarchyCell,{unstyled:T,id:b.tableKeyboardNavigationTools.generateNavigatableId(`${x}-dhcell`,v)}),r.createElement(ae,{dataItem:l.dataItem,dataIndex:l.dataIndex,colSpan:te,ariaColIndex:2+(e.group?e.group.length:0),detail:e.detail,id:b.tableKeyboardNavigationTools.generateNavigatableId(`${x}-dcell`,v)})))}})}const Ie={size:I,total:q,skip:e.skip||0,take:(e.take!==void 0?e.take:e.pageSize)||10,...jt.normalize(e.pageable||{})},Ne=r.createElement(Xt.PagerContainer,null,e.pager?r.createElement(e.pager,{...Ie}):r.createElement(b.Pager,{className:c.classNames(f.pager({})),...Ie})),Dt=(t,d)=>r.createElement("col",{key:d.toString(),width:u.getColumnWidth(t)}),ke=(Ve=e.cells)!=null&&Ve.footerCell||m.some(t=>{var d;return!!((d=t.cells)!=null&&d.footerCell)})?r.createElement(zt.Footer,{size:I,staticHeaders:e.scrollable!=="none",row:r.createElement(Vt.FooterRow,{cells:e.cells,idPrefix:v,columns:m,ariaRowIndex:O+1}),cols:C.map(Dt)}):null,qe=r.createElement(Ut.GridColGroup,null,C.map((t,d)=>r.createElement("col",{key:d.toString(),className:u.isSorted(t.field,e.sort)?c.classNames(f.sorted({})):void 0,width:u.getColumnWidth(t)}))),xe=e.reorderable||F,{detail:ba,cells:ha,rows:Ca,...Tt}=e,De=r.createElement("tbody",{role:"rowgroup",className:c.classNames(f.tbody({})),...b.tableKeyboardNavigationBodyAttributes},p),Te=Z?r.createElement(na.GridEditDialog,{columns:C,customEditDialog:e.editDialog,dataItem:Z}):null;let ee=De;H&&(ee=r.createElement(ea.GridReorderableRowsContainer,{unstyled:f,columns:m,rowReorderSettings:e.rowReorderable},De));const He={gridRef:A,innerGrid:e.innerGrid,gridProps:Tt,columnsRef:oe(),hiddenColumnsRef:ce,columnsMapRef:W,columnsState:G,dataRef:h,id:w,virtualTotal:fe,isAllData:B,virtualPageSize:Q,isVirtualScroll:R,detailExpandable:!!e.detail};return e.scrollable==="none"?r.createElement(tt.GridClientWrapper,{...He},r.createElement(nt.GridElementContainer,null,r.createElement("div",{id:e.id,style:e.style,className:c.classNames(f.wrapper({size:I}),e.className),...b.tableKeyboardNavigationScopeAttributes},ye,Ge,r.createElement(Jt.GridTable,{selectable:e.selectable,className:c.classNames(f.table({size:I}))},qe,Se,r.createElement(rt.GridTableBody,{rowReorderable:H},ee),ke),Re&&r.createElement(et.GridNoRecordsContainer,null,V.length?V:r.createElement(Ze.GridNoRecords,null)),xe&&r.createElement(r.Fragment,null,r.createElement(at.GridDropClue,null),r.createElement(lt.GridDragClue,null)))),we,e.pageable&&Ne,r.createElement(it.GridLoader,{loader:e.loader,showLoader:e.showLoader}),Te,Ce&&r.createElement(c.WatermarkOverlay,{message:me})):r.createElement(tt.GridClientWrapper,{...He},r.createElement(nt.GridElementContainer,null,r.createElement("div",{id:e.id,style:e.style,className:c.classNames(f.wrapper({size:I,virtual:R}),e.className),...b.tableKeyboardNavigationScopeAttributes},ye,Ge,r.createElement("div",{className:c.classNames(f.ariaRoot({})),role:"grid","aria-colcount":C.length,"aria-rowcount":q,id:w,"aria-label":z.toLanguageString(de.gridAriaLabel,de.messages[de.gridAriaLabel])},Se,r.createElement("div",{className:c.classNames(f.container({})),role:"presentation"},r.createElement(Zt.GridContainerElementContainer,null,r.createElement("div",{className:c.classNames(f.content({})),role:"presentation"},r.createElement("div",{className:c.classNames(f.tableWrap({})),role:"presentation"},r.createElement(Yt.GridTableScrollable,{selectable:e.selectable,tableClassName:c.classNames(f.table({size:I})),tableStyle:{userSelect:Nt}},qe,r.createElement(rt.GridTableBody,{rowReorderable:H},ee)),Re&&r.createElement(et.GridNoRecordsContainer,null,V.length?V:r.createElement(Ze.GridNoRecords,null))),R&&r.createElement("div",{className:c.classNames(f.heightContainer({})),role:"presentation"},r.createElement(pt.VirtualScrollHeightContainer,{isVirtualScroll:R}))))),ke,xe&&r.createElement(r.Fragment,null,r.createElement(at.GridDropClue,null),r.createElement(lt.GridDragClue,null)),Ce&&r.createElement(c.WatermarkOverlay,{message:me})),we,e.pageable&&Ne,r.createElement(it.GridLoader,{loader:e.loader,showLoader:e.showLoader}),Te)))});ot.displayName="KendoReactGridComponent";exports.GridComponent=ot;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ht=require("react"),c=require("@progress/kendo-react-common"),Pt=require("@progress/kendo-data-query"),b=require("@progress/kendo-react-data-tools"),Kt=require("./cells/hierarchycell/GridHierarchyCell.js"),At=require("./cells/editcell/GridEditCell.js"),Wt=require("./header/Header.js"),Mt=require("./header/HeaderRow.js"),Ot=require("./header/FilterRow.js"),Lt=require("./header/GroupPanel.js"),zt=require("./footer/Footer.js"),u=require("./utils/index.js"),Bt=require("./cells/datacell/GridCell.js"),Ye=require("./cells/groupcell/GridGroupCell.js"),Ft=require("./rows/GridRow.js"),_t=require("./header/GridHeaderSelectionCell.js"),Ze=require("./components/noRecords/GridNoRecords.js"),pe=require("./filterCommon.js"),Vt=require("./footer/FooterRow.js"),jt=require("./paging/GridPagerSettings.js"),ie=require("./package-metadata.js"),$t=require("./cells/detailcell/GridDetailCell.js"),Qt=require("./cells/GridDetailHierarchyCell.js"),et=require("./components/noRecords/GridNoRecordsContainer.js"),tt=require("./GridClientWrapper.js"),Ut=require("./components/colGroup/GridColGroup.js"),Jt=require("./components/table/GridTable.js"),at=require("./components/GridDropClue.js"),lt=require("./components/GridDragClue.js"),rt=require("./components/table/GridTableBody.js"),Xt=require("./components/PagerContainer.js"),Yt=require("./components/table/GridTableScrollable.js"),nt=require("./components/GridElementContainer.js"),Zt=require("./components/GridContainerElementContainer.js"),pt=require("./components/VirtualScrollHeightContainer.js"),de=require("./messages/index.js"),ea=require("./components/GridDraggableRowsContainer.js"),ta=require("./cells/rowreordercell/GridRowReorderCell.js"),aa=require("./header/client/GridHeaderRowReorderCell.js"),it=require("./components/GridLoader.js"),la=require("./utils/premium.js"),dt=require("@progress/kendo-react-intl"),ra=require("./utils/virtualColumns.js"),na=require("./components/GridEditDialog.js"),ia=require("./cells/datacell/GridCellServer.js"),da=require("./cells/editcell/GridEditCellServer.js"),oa=require("./cells/selectioncell/GridSelectionCellServer.js"),sa=require("./cells/selectioncell/GridSelectionCell.js"),ca=require("./cells/hierarchycell/GridHierarchyCellServer.js"),ua=require("./cells/rowreordercell/GridRowReorderCellServer.js"),ma=require("./cells/detailcell/GridDetailCellServer.js"),ga=require("./cells/groupcell/GridGroupCellServer.js");function fa(e){const A=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const w in e)if(w!=="default"){const v=Object.getOwnPropertyDescriptor(e,w);Object.defineProperty(A,w,v.get?v:{enumerable:!0,get:()=>e[w]})}}return A.default=e,Object.freeze(A)}const r=fa(Ht),ot=r.forwardRef((e,A)=>{var Pe,Ke,Ae,We,Me,Oe,Le,ze,Be,Fe,_e,Ve;const w=e.id+"-role-element-id",v=e.navigatable?w:"";let G=e.columnsState||[];const st=(t,d,i,o,a,l,s)=>{const g=[],y=u.flatData(g,t,d,{index:i},o!==void 0,a,l,Et.defaultExpand,s);return{flattedData:g,resolvedGroupsCount:y}},ct=t=>{const d=t.filter(i=>i&&i.type&&i.type.displayName==="KendoReactGridColumn");return u.readColumns(d,G,{prevId:0,idPrefix:v})},ut=()=>{const t=[],d=(i,o)=>i==null?void 0:i.forEach(a=>{const l=a.hidden||o;t.push({...a,hidden:l}),d(a.children,l)});return d(G,!1),t},mt=t=>{const d=ut();return[t.filter(i=>{var o;return!i.hidden&&!((o=d.find(a=>a.id===i.id))!=null&&o.hidden)}),t.filter(i=>{var o;return i.hidden||((o=d.find(a=>a.id===i.id))==null?void 0:o.hidden)})]},gt=(t,d)=>{m=ct(t),m.filter(a=>!a.hidden).length===0&&(m=u.autoGenerateColumns(E,e.group,{column:M.column},{prevId:0,idPrefix:v})),bt(m,d);const[i,o]=mt(m);m=i,ce=o,W=u.mapColumns(m,G,!0),ue=m.map(u.clientColumn)},ft=(t,d)=>{const i=o=>{var l;const a=d.find(s=>s.id===o.id);if(a){const s={...a};return s.children=(l=o.children)==null?void 0:l.map(i),s}return u.getColumnState(o)};G=t.filter(o=>o.parentIndex===-1).map(i)},bt=(t,d)=>{t.filter(l=>l.columnType==="checkbox").forEach(l=>{l.width=l.width||"50px",l.defaultCell=e.isClient?sa.GridSelectionCell:oa.GridSelectionCellServer,l.defaultHeaderCell=_t.GridHeaderSelectionCell,l._type="edit"}),H!==void 0&&t.filter(l=>l.columnType==="reorder").forEach(l=>{l.width=l.width||"50px",l.defaultCell=e.isClient?ta.GridRowReorderCell:ua.GridRowReorderCellServer,l.defaultHeaderCell=aa.GridHeaderRowReorderCell,l.sortable=!1,l.filterable=!1,l.editable=!1});const i=u.getFlatColumnsState(G);ft(t,i);const o={id:"",resizable:!0,width:"32px",title:" ",declarationIndex:-1,orderIndex:-1,children:[],parentIndex:-1,depth:0,colSpan:0,headerColSpan:0,rowSpan:0,left:0,right:0,index:0,rightBorder:!1,ariaColumnIndex:0,isAccessible:!0};let a=0;if(M.enabled&&e.detail){const l={...o,_type:"expand",id:b.tableKeyboardNavigationTools.generateNavigatableId(`${a++}`,"expand","column"),defaultCell:e.isClient?Kt.GridHierarchyCell:ca.GridHierarchyCellServer,field:M.column,headerClassName:c.classNames(f.hierarchyCell({}))};t.unshift(l),G.unshift(i.find(s=>s.id===l.id)||u.getColumnState(l))}for(let l=0;l<d;l++){const s={...o,isAccessible:!1,defaultCell:e.isClient?Ye.GridGroupCell:ga.GridGroupCellServer,id:b.tableKeyboardNavigationTools.generateNavigatableId(`${a++}`,"group","column"),field:"value",locked:e.lockGroups};t.unshift(s),G.unshift(i.find(g=>g.id===s.id)||u.getColumnState(s))}t.slice(a).forEach(l=>{l.parentIndex>=0&&(l.parentIndex+=a),l.rowSpannable=l.rowSpannable!==void 0?u.getRowSpanOptions(l.rowSpannable):he})},oe=()=>e.isClient?m:ue,se=t=>{const d=[];let i=null,o=0;if(C.forEach((a,l)=>{let s=parseFloat((a.width||"").toString())||10;if(typeof(a==null?void 0:a.width)=="number"&&(a!=null&&a.minResizableWidth)&&(a==null?void 0:a.width)<(a==null?void 0:a.minResizableWidth)&&(s=a==null?void 0:a.minResizableWidth),typeof(a==null?void 0:a.width)=="number"&&(a!=null&&a.minWidth)&&(a==null?void 0:a.width)<(a==null?void 0:a.minWidth)?s=a==null?void 0:a.minWidth:typeof(a==null?void 0:a.width)=="number"&&(a!=null&&a.maxWidth)&&(a==null?void 0:a.width)>(a==null?void 0:a.maxWidth)&&(s=a==null?void 0:a.maxWidth),o){o--,i&&(i.width+=s);return}const g=Math.min(u.getColSpan(a,t),C.length-l);o=g-1,i={width:s,colSpan:g,columnIndex:l},d.push(i)}),e.columnVirtualization){const a=Ct.current||0,l=yt.current||parseFloat(((e.style||{}).width||"").toString());return ra.getVirtualCellsToRender({cellModels:d,columns:C,tableViewPortWidth:l,scrollLeft:a})}return d},ht=()=>{const{pageable:t,take:d,pageSize:i}=e;if(!R)return 0;if(!t){if(d)return d;if(i)return i}const o=e.rowHeight||Gt.current,a=wt.current;return a&&o?Math.ceil(a/o*1.5):0};let h=[],$,m=[],ce=[],ue=[],W=[[]];const Ct=e.scrollLeftRef||{current:0},yt=e.widthRef||{current:0},wt=e.containerHeightRef||{current:0},Gt=e.minRowHeightRef||{current:0},z=e.localization||new dt.LocalizationService(e.language),St=e.intl||new dt.IntlService((Pe=e.locale)!=null?Pe:"en"),T=e.unstyled,f=T&&T.uGrid?T.uGrid:c.uGrid,H=u.isRowReorderEnabled(e.rowReorderable),R=e.scrollable==="virtual"||e.scrollable===void 0&&e.isClient&&c.hasValidLicense(ie.packageMetadata)||!1,me=c.getLicenseMessage(ie.packageMetadata),P=e.autoProcessData===!0?{group:!0,sort:!0,filter:!0,search:!0,page:!0}:e.autoProcessData;let E,q;if(Array.isArray(e.data)?(E=e.data,q=(Ke=e.total)!=null?Ke:E.length):(E=((Ae=e.data)==null?void 0:Ae.data)||[],q=(Oe=(Me=e.total)!=null?Me:(We=e.data)==null?void 0:We.total)!=null?Oe:E.length),P){const t=P.page&&!(R&&!e.pageable),{data:d,total:i}=Pt.process(E,{group:P.group?e.group:void 0,sort:P.sort?e.sort:void 0,filter:b.combineFilters(P.filter?e.filter:void 0,P.search?e.search:void 0),...t?{take:e.pageable?e.take||10:e.take,skip:e.skip||0}:{}});E=d,q=(Le=e.total)!=null?Le:i}const B=E.length===q,{size:I="medium"}=e,vt=typeof e.groupable=="object"&&e.groupable.footer||"none",F=e.groupable===!0||typeof e.groupable=="object"&&e.groupable.enabled!==!1,M=b.getDetailExpandableOptions(!!e.detail),Et=b.getGroupExpandableOptions(typeof e.groupable=="object"&&e.groupable.enabled!==!1?e.groupable.expandable:e.groupable),ge=!!((ze=e.group)!=null&&ze.length),{resolvedGroupsCount:Rt,flattedData:It}=st(E,vt,B?0:e.skip||0,e.group,e.detailExpand,e.groupExpand,e.dataItemKey);h=It;const Q=ht(),U=((Be=e.virtualSkipRef)==null?void 0:Be.current)||0;let fe=q;if(R){let t=e.skip||0;if((ge||e.pageable)&&(t=U,fe=h.length),B||ge||e.pageable)if(Q===0){const d=Math.min(e.take||e.pageSize||20,h.length);$=h.slice(t,t+d)}else $=h.slice(t,t+Q)}const be=b.getSelectionOptions(e.selectable),he=u.getRowSpanOptions(e.rowSpannable),Nt=be&&be.drag?"none":void 0,_=r.useMemo(()=>r.Children.toArray(e.children),[e.children]);gt(_,Rt);const J=r.useMemo(()=>{const t=la.gridPremiumFeatures(e,m);return{premium:t.length>0,features:t}},[e,m]),Ce=r.useMemo(()=>J.premium?!c.validatePackage(ie.packageMetadata,{component:"Grid",features:J.features}):!1,[J.premium]),ye=_.map(t=>t&&t.type&&t.type.displayName==="KendoReactGridToolbar"?r.cloneElement(t,{...t.props,_ariaControls:w,ariaLabel:"Top toolbar"}):null),V=_.filter(t=>t&&t.type&&t.type.displayName==="KendoReactGridNoRecords"),we=_.filter(t=>t&&t.type&&t.type.displayName==="KendoReactGridStatusBar"),C=m.filter(t=>t.children.length===0),Ge=F&&r.createElement(Lt.GroupPanel,{columns:oe(),group:e.group||[],ariaControls:w}),Se=r.createElement(Wt.Header,{size:I,staticHeaders:e.scrollable!=="none",draggable:e.reorderable||F,headerRow:r.createElement(Mt.HeaderRow,{cells:e.cells,sort:e.sort,sortable:e.sortable,group:e.group||[],groupable:F,filter:e.filter,filterable:e.filterable,filterOperators:e.filterOperators||pe.operators,columnMenu:e.columnMenu,columnMenuIcon:e.columnMenuIcon,columns:m,columnsMap:W,navigatable:!!e.navigatable,localization:z,unstyled:T,columnsState:G,headerSelectionValue:!!(e.select&&h.filter(t=>t.rowType==="data").every(t=>e.select&&e.dataItemKey&&c.getter(e.dataItemKey)(t.dataItem)!==void 0?e.select[c.getter(e.dataItemKey)(t.dataItem)]:void 0))}),filterRow:e.filterable&&r.createElement(Ot.FilterRow,{cells:e.cells,size:I,columns:m,filter:e.filter,filterOperators:e.filterOperators||pe.operators,sort:e.sort,navigatable:!!e.navigatable,ariaRowIndex:W.length+1,localization:z})||void 0,cols:C.map((t,d)=>r.createElement("col",{key:d.toString(),width:u.getColumnWidth(t)}))}),ve=C.findIndex(t=>typeof t.colSpan=="function")>-1;let X;ve||(X=se(null));const Y=((Fe=e.editable)==null?void 0:Fe.mode)==="dialog",kt=(_e=e.editable)==null?void 0:_e.enabled,qt=(t,d,i,o,a)=>{let l=!1;const s=e.select&&e.dataItemKey&&c.getter(e.dataItemKey)(t.dataItem)!==void 0?e.select[c.getter(e.dataItemKey)(t.dataItem)]:void 0,g=e.highlight&&e.dataItemKey&&c.getter(e.dataItemKey)(t.dataItem)!==void 0?e.highlight[c.getter(e.dataItemKey)(t.dataItem)]:void 0;return ve&&(X=se(t.dataItem)),{row:X.map(({columnIndex:y,colSpan:K})=>{var je,$e,Qe,Ue,Je,Xe;const n=C[y],x=G[y],S=($e=(je=n.locked)!=null?je:x==null?void 0:x.locked)!=null?$e:!1;let N;if((Qe=n.rowSpannable)!=null&&Qe.enabled&&t.rowType==="data"&&n.field&&a){const k=n.field?(Je=(Ue=n.rowSpannable).valueGetter)==null?void 0:Je.call(Ue,t.dataItem,n.field):null;N={value:k,count:1},a[n.field]&&((Xe=a[n.field])==null?void 0:Xe.value)===k&&a[n.field]!==null?(a[n.field].count++,N.count=null):a[n.field]=N}const te=n.id?n.id:y,ae=c.classNames(f.contentSticky({locked:S}),n.className),le=n.left!==void 0?{left:n.left,right:n.right}:{};let D=!1;if(n.editable&&e.editable){const k=e.edit&&e.dataItemKey?e.edit[c.getter(e.dataItemKey)(t.dataItem)]:void 0,ne=typeof k=="boolean"?k:Array.isArray(k)?n.field&&k.indexOf(n.field)>-1:n.field!==void 0&&k===n.field;ne&&n.columnType==="data"&&(ne===!0||ne===n.field)&&(l=!0,Y||(D=!0))}const L=n._type==="expand",re={locked:e.lockGroups,id:b.tableKeyboardNavigationTools.generateNavigatableId(`${d}-${String(y)}`,v,L||t.rowType==="groupHeader"||t.rowType==="groupFooter"||n.field==="value"?"nodata":"cell"),colSpan:K,dataItem:t.dataItem,field:n.field,editor:n.editor,format:n.format,columnType:n.columnType,rowReorderable:H,className:ae,cells:u.resolveCells(e.cells,n.cells),columnIndex:y,columnsCount:C.length,rowType:t.rowType,level:t.level,expanded:t.expanded,dataIndex:t.dataIndex,rowDataIndex:i,columnPosition:le,style:{},ariaColumnIndex:n.ariaColumnIndex,isSelected:!!((n==null?void 0:n._type)==="edit"?s:Array.isArray(s)&&s.indexOf(y)>-1),isHighlighted:!!((n==null?void 0:n._type)==="edit"?g:Array.isArray(g)&&g.indexOf(y)>-1),isSorted:!!u.isSorted(n.field,e.sort),isInEdit:D,isAlt:o,unstyled:T,group:t.group,localization:z,intl:St,_rowSpan:N},j=n.defaultCell||D&&(e.isClient?At.GridEditCell:da.GridEditCellServer)||(e.isClient?Bt.GridCell:ia.GridCellServer);return r.createElement(j,{key:te,cellProps:re})}),isInEdit:l,isSelected:typeof s=="boolean"&&s,isHighlighted:typeof g=="boolean"&&g}},xt=0;let Z=null;const Ee=t=>t>=h.length-xt,p=[],Re=!h.length;let O=0;if(h.length){const t=W.length+(e.filterable?1:0)+1;let d=e.skip||0,i=-1,o=0;const a=he.enabled?{}:void 0;if(R){if(U>0){const l=h.slice(0,U).filter(s=>s.rowType==="data").length;i+=l,d+=l}!e.pageable&&B&&(i+=e.skip||0)}($||h).forEach((l,s)=>{var N;l.rowType==="data"&&i++;const g=l.dataIndex%2!==0,y=e.dataItemKey&&c.getter(e.dataItemKey)(l.dataItem),K=s+d,n=y||"ai"+K,x=n+"_1",S=qt(l,n,i,g,a);if(O=K+t+o,Y&&kt&&S.isInEdit&&(Z=l.dataItem),p.push(r.createElement(Ft.GridRow,{key:n,dataItem:l.dataItem,isAltRow:g,isInEdit:S.isInEdit&&!Y,rowType:l.rowType,isRowReorderable:H,isHidden:Ee(s),onClick:null,onDoubleClick:null,rowHeight:e.rowHeight,ariaRowIndex:O,absoluteRowIndex:K,dataIndex:i,isSelected:S.isSelected,isHighlighted:S.isHighlighted,rows:e.rows},S.row)),e.detail&&l.rowType==="data"&&l.expanded){const te=C.length-(M.enabled?1:0)-(e.group?e.group.length:0)||1;o++,O=K+t+o;const ae=e.isClient?$t.GridDetailCell:ma.GridDetailCellServer;p.push(r.createElement("tr",{key:x,className:c.classNames(f.detailTr({isAlt:g})),style:{visibility:Ee(s)?"hidden":"",height:e.detailRowHeight},role:"row","aria-rowindex":O},(N=e==null?void 0:e.group)==null?void 0:N.map((le,D)=>{var j;const L=(j=S==null?void 0:S.row[D])==null?void 0:j.props.style,re=L?{left:L.left,right:L.right}:{};return r.createElement(Ye.GridGroupCell,{key:D,cellProps:{id:"",dataItem:l.dataItem,field:le.field,dataIndex:l.dataIndex,columnPosition:re,style:{},ariaColumnIndex:1+D,isSelected:!1,locked:e.lockGroups,cells:e.cells,group:l.group}})}),M.enabled&&r.createElement(Qt.GridDetailHierarchyCell,{unstyled:T,id:b.tableKeyboardNavigationTools.generateNavigatableId(`${x}-dhcell`,v)}),r.createElement(ae,{dataItem:l.dataItem,dataIndex:l.dataIndex,colSpan:te,ariaColIndex:2+(e.group?e.group.length:0),detail:e.detail,id:b.tableKeyboardNavigationTools.generateNavigatableId(`${x}-dcell`,v)})))}})}const Ie={size:I,total:q,skip:e.skip||0,take:(e.take!==void 0?e.take:e.pageSize)||10,...jt.normalize(e.pageable||{})},Ne=r.createElement(Xt.PagerContainer,null,e.pager?r.createElement(e.pager,{...Ie}):r.createElement(b.Pager,{className:c.classNames(f.pager({})),...Ie})),Dt=(t,d)=>r.createElement("col",{key:d.toString(),width:u.getColumnWidth(t)}),ke=(Ve=e.cells)!=null&&Ve.footerCell||m.some(t=>{var d;return!!((d=t.cells)!=null&&d.footerCell)})?r.createElement(zt.Footer,{size:I,staticHeaders:e.scrollable!=="none",row:r.createElement(Vt.FooterRow,{cells:e.cells,idPrefix:v,columns:m,ariaRowIndex:O+1}),cols:C.map(Dt)}):null,qe=r.createElement(Ut.GridColGroup,null,C.map((t,d)=>r.createElement("col",{key:d.toString(),className:u.isSorted(t.field,e.sort)?c.classNames(f.sorted({})):void 0,width:u.getColumnWidth(t)}))),xe=e.reorderable||F,{detail:ba,cells:ha,rows:Ca,...Tt}=e,De=r.createElement("tbody",{role:"rowgroup",className:c.classNames(f.tbody({})),...b.tableKeyboardNavigationBodyAttributes},p),Te=Z?r.createElement(na.GridEditDialog,{columns:C,customEditDialog:e.editDialog,dataItem:Z}):null;let ee=De;H&&(ee=r.createElement(ea.GridReorderableRowsContainer,{unstyled:f,columns:m,rowReorderSettings:e.rowReorderable},De));const He={gridRef:A,innerGrid:e.innerGrid,gridProps:Tt,columnsRef:oe(),hiddenColumnsRef:ce,columnsMapRef:W,columnsState:G,dataRef:h,id:w,virtualTotal:fe,isAllData:B,virtualPageSize:Q,isVirtualScroll:R,detailExpandable:!!e.detail};return e.scrollable==="none"?r.createElement(tt.GridClientWrapper,{...He},r.createElement(nt.GridElementContainer,null,r.createElement("div",{id:e.id,style:e.style,className:c.classNames(f.wrapper({size:I}),e.className),...b.tableKeyboardNavigationScopeAttributes},ye,Ge,r.createElement(Jt.GridTable,{selectable:e.selectable,className:c.classNames(f.table({size:I}))},qe,Se,r.createElement(rt.GridTableBody,{rowReorderable:H},ee),ke),Re&&r.createElement(et.GridNoRecordsContainer,null,V.length?V:r.createElement(Ze.GridNoRecords,null)),xe&&r.createElement(r.Fragment,null,r.createElement(at.GridDropClue,null),r.createElement(lt.GridDragClue,null)))),we,e.pageable&&Ne,r.createElement(it.GridLoader,{loader:e.loader,showLoader:e.showLoader}),Te,Ce&&r.createElement(c.WatermarkOverlay,{message:me})):r.createElement(tt.GridClientWrapper,{...He},r.createElement(nt.GridElementContainer,null,r.createElement("div",{id:e.id,style:e.style,className:c.classNames(f.wrapper({size:I,virtual:R}),e.className),...b.tableKeyboardNavigationScopeAttributes},ye,Ge,r.createElement("div",{className:c.classNames(f.ariaRoot({})),role:"grid","aria-colcount":C.length,"aria-rowcount":q,id:w,"aria-label":z.toLanguageString(de.gridAriaLabel,de.messages[de.gridAriaLabel])},Se,r.createElement("div",{className:c.classNames(f.container({})),role:"presentation"},r.createElement(Zt.GridContainerElementContainer,null,r.createElement("div",{className:c.classNames(f.content({})),role:"presentation"},r.createElement("div",{className:c.classNames(f.tableWrap({})),role:"presentation"},r.createElement(Yt.GridTableScrollable,{selectable:e.selectable,tableClassName:c.classNames(f.table({size:I})),tableStyle:{userSelect:Nt}},qe,r.createElement(rt.GridTableBody,{rowReorderable:H},ee)),Re&&r.createElement(et.GridNoRecordsContainer,null,V.length?V:r.createElement(Ze.GridNoRecords,null))),R&&r.createElement("div",{className:c.classNames(f.heightContainer({})),role:"presentation"},r.createElement(pt.VirtualScrollHeightContainer,{isVirtualScroll:R}))))),ke,xe&&r.createElement(r.Fragment,null,r.createElement(at.GridDropClue,null),r.createElement(lt.GridDragClue,null)),Ce&&r.createElement(c.WatermarkOverlay,{message:me})),we,e.pageable&&Ne,r.createElement(it.GridLoader,{loader:e.loader,showLoader:e.showLoader}),Te)))});ot.displayName="KendoReactGridComponent";exports.GridComponent=ot;
|
package/GridComponent.mjs
CHANGED
|
@@ -384,8 +384,8 @@ const Ba = i.forwardRef((e, ut) => {
|
|
|
384
384
|
isSelected: typeof m == "boolean" && m,
|
|
385
385
|
isHighlighted: typeof c == "boolean" && c
|
|
386
386
|
};
|
|
387
|
-
};
|
|
388
|
-
let
|
|
387
|
+
}, Kt = 0;
|
|
388
|
+
let Y = null;
|
|
389
389
|
const ve = (t) => t >= g.length - Kt, Z = [], Re = !g.length;
|
|
390
390
|
let z = 0;
|
|
391
391
|
if (g.length) {
|