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