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