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