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