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