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