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