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