@progress/kendo-react-grid 11.0.0-develop.11 → 11.0.0-develop.12

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