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