@progress/kendo-react-grid 14.2.2-develop.1 → 14.3.0-develop.10

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 (101) hide show
  1. package/GridClientContextReader.js +1 -1
  2. package/GridClientContextReader.mjs +10 -9
  3. package/GridClientWrapper.js +1 -1
  4. package/GridClientWrapper.mjs +651 -494
  5. package/GridComponent.js +1 -1
  6. package/GridComponent.mjs +418 -379
  7. package/GridState.d.ts +2 -0
  8. package/GridState.js +1 -1
  9. package/GridState.mjs +98 -90
  10. package/{toolbar-tools/smartbox/SegmentedControl.d.ts → cells/pincell/GridPinCell.d.ts} +4 -2
  11. package/cells/pincell/GridPinCell.js +9 -0
  12. package/cells/pincell/GridPinCell.mjs +19 -0
  13. package/cells/pincell/GridPinCellServer.d.ts +15 -0
  14. package/cells/pincell/GridPinCellServer.js +8 -0
  15. package/cells/pincell/GridPinCellServer.mjs +32 -0
  16. package/cells/pincell/GridPinCellServerContainer.d.ts +11 -0
  17. package/cells/pincell/GridPinCellServerContainer.js +9 -0
  18. package/cells/pincell/GridPinCellServerContainer.mjs +26 -0
  19. package/cells/pincell/GridPinDropdownButton.d.ts +21 -0
  20. package/cells/pincell/GridPinDropdownButton.js +9 -0
  21. package/cells/pincell/GridPinDropdownButton.mjs +58 -0
  22. package/cells/pincell/useGridPinCellClientTdProps.d.ts +24 -0
  23. package/cells/pincell/useGridPinCellClientTdProps.js +9 -0
  24. package/cells/pincell/useGridPinCellClientTdProps.mjs +21 -0
  25. package/cells/pincell/utils.d.ts +20 -0
  26. package/cells/pincell/utils.js +8 -0
  27. package/cells/pincell/utils.mjs +47 -0
  28. package/components/PinnedRowsTable.d.ts +48 -0
  29. package/components/PinnedRowsTable.js +9 -0
  30. package/components/PinnedRowsTable.mjs +133 -0
  31. package/components/StickyGroupTable.d.ts +42 -0
  32. package/components/StickyGroupTable.js +9 -0
  33. package/components/StickyGroupTable.mjs +82 -0
  34. package/components/colGroup/GridColGroup.js +1 -1
  35. package/components/colGroup/GridColGroup.mjs +9 -9
  36. package/contextMenu/GridContextMenu.d.ts +42 -0
  37. package/contextMenu/GridContextMenu.js +1 -1
  38. package/contextMenu/GridContextMenu.mjs +101 -51
  39. package/contextMenu/enums.d.ts +5 -1
  40. package/contextMenu/enums.js +1 -1
  41. package/contextMenu/enums.mjs +2 -2
  42. package/dist/cdn/js/kendo-react-grid.js +1 -1
  43. package/drag/ColumnResize.d.ts +17 -0
  44. package/drag/ColumnResize.js +1 -1
  45. package/drag/ColumnResize.mjs +107 -100
  46. package/getRowContents.d.ts +58 -0
  47. package/getRowContents.js +8 -0
  48. package/getRowContents.mjs +99 -0
  49. package/header/GridHeaderGroupSpacerCell.d.ts +13 -0
  50. package/header/GridHeaderGroupSpacerCell.js +9 -0
  51. package/header/GridHeaderGroupSpacerCell.mjs +23 -0
  52. package/header/client/GridHeaderPinCell.d.ts +12 -0
  53. package/header/client/GridHeaderPinCell.js +9 -0
  54. package/header/client/GridHeaderPinCell.mjs +14 -0
  55. package/hooks/useStickyGroups.d.ts +71 -0
  56. package/hooks/useStickyGroups.js +9 -0
  57. package/hooks/useStickyGroups.mjs +350 -0
  58. package/index.d.mts +5 -2
  59. package/index.d.ts +5 -2
  60. package/index.js +1 -1
  61. package/index.mjs +97 -95
  62. package/interfaces/ColumnType.d.ts +1 -1
  63. package/interfaces/GridCellsSettings.d.ts +23 -0
  64. package/interfaces/GridGroupableSettings.d.ts +23 -0
  65. package/interfaces/GridProps.d.ts +70 -1
  66. package/interfaces/GridRowProps.d.ts +4 -0
  67. package/interfaces/GridRowsSettings.d.ts +11 -0
  68. package/interfaces/events.d.ts +17 -0
  69. package/messages/index.d.ts +25 -0
  70. package/messages/index.js +2 -2
  71. package/messages/index.mjs +122 -112
  72. package/package-metadata.js +1 -1
  73. package/package-metadata.mjs +2 -2
  74. package/package.json +17 -17
  75. package/rows/GridRow.js +1 -1
  76. package/rows/GridRow.mjs +25 -24
  77. package/rows/GridRowRenderer.d.ts +1 -0
  78. package/rows/GridRowRenderer.js +1 -1
  79. package/rows/GridRowRenderer.mjs +39 -36
  80. package/stacked/GridStackedRow.d.ts +5 -0
  81. package/stacked/GridStackedRow.js +1 -1
  82. package/stacked/GridStackedRow.mjs +118 -116
  83. package/stacked/StackedModeComponents.d.ts +1 -0
  84. package/stacked/StackedModeComponents.js +1 -1
  85. package/stacked/StackedModeComponents.mjs +14 -14
  86. package/stacked/StackedModeRow.d.ts +1 -0
  87. package/stacked/StackedModeRow.js +1 -1
  88. package/stacked/StackedModeRow.mjs +13 -11
  89. package/toolbar-tools/smartbox/SmartBox.js +1 -1
  90. package/toolbar-tools/smartbox/SmartBox.mjs +102 -94
  91. package/toolbar-tools/smartbox/hooks/useSmartBoxSegmentedControl.d.ts +12 -3
  92. package/toolbar-tools/smartbox/hooks/useSmartBoxSegmentedControl.js +1 -1
  93. package/toolbar-tools/smartbox/hooks/useSmartBoxSegmentedControl.mjs +42 -41
  94. package/toolbar-tools/smartbox/index.d.ts +0 -1
  95. package/toolbar-tools/smartbox/interfaces/index.d.ts +0 -1
  96. package/utils/index.d.ts +1 -0
  97. package/utils/index.js +1 -1
  98. package/utils/index.mjs +44 -44
  99. package/toolbar-tools/smartbox/SegmentedControl.js +0 -8
  100. package/toolbar-tools/smartbox/SegmentedControl.mjs +0 -109
  101. package/toolbar-tools/smartbox/interfaces/SegmentedControlTypes.d.ts +0 -66
@@ -7,30 +7,32 @@
7
7
  */
8
8
  "use client";
9
9
  import * as d from "react";
10
- import { useAdaptiveModeContext as $t, canUseDOM as Q, getActiveElement as Jt, useDir as Xt, setScrollbarWidth as qe, cloneArray as Yt, RowHeightService as Qt, getter as Z } from "@progress/kendo-react-common";
11
- import { filterBy as Zt } from "@progress/kendo-data-query";
12
- import { getSelectionOptions as se, populateClipboardData as pt, ClipboardActionType as ke, getEditableOptions as en, tableKeyboardNavigation as q, ClipboardService as tn, TableKeyboardNavigationContext as nn, updateLeft as rn, updateRight as on, getGroupExpandableOptions as an, groupExpandReducer as dn, getDetailExpandableOptions as cn, detailExpandReducer as ln, getSelectedState as _e, editReducer as sn, EDIT_ACTION as un, closestTagName as ue, getSelectedStateFromKeyDown as gn, getColumnIndex as fn, getRowIndex as mn } from "@progress/kendo-react-data-tools";
13
- import { ColumnResize as Pn } from "./drag/ColumnResize.mjs";
14
- import { CommonDragLogic as hn } from "./drag/CommonDragLogic.mjs";
15
- import { getDefaultHeadContextMenuItems as Rn, getDefaultBodyContextMenuItems as vn, isRowReorderEnabled as bn, calcRowHeight as Cn, sanitizeColumns as In, getFlatColumnsState as En, getDataAsArray as wn } from "./utils/index.mjs";
16
- import { VirtualScroll as xn } from "./VirtualScroll.mjs";
17
- import { GridContextMenu as yn } from "./contextMenu/GridContextMenu.mjs";
18
- import { GridContextMenuAnchorPart as $e } from "./contextMenu/enums.mjs";
19
- import { normalizeSortable as Sn, firstLevelSortSeqMap as kn } from "./sortCommon.mjs";
20
- import { BasePDFExport as Dn } from "./BasePDFExport.mjs";
21
- import { BaseCSVExport as Kn } from "./BaseCSVExport.mjs";
22
- import { GridContext as Mn } from "./utils/GridContext.mjs";
23
- import { operators as Hn } from "./filterCommon.mjs";
24
- const Tn = (t, E, h, D) => {
25
- const _ = Object.keys(E.cells).map((y) => h.findIndex(($) => $.field === y)), O = Object.keys(E.cells).length > 0 ? _ : !0;
26
- return t.reduce((y, $) => (y[$[D != null ? D : "id"]] = O, y), {});
27
- }, Je = (t, E, h, D) => E.reduce((O, y) => ({
28
- ...O,
29
- ...Tn(Zt(t, y), y, h, D)
30
- }), {}), Jn = (t) => {
31
- const E = t.gridProps.isClient, [h, D] = d.useState({}), _ = $t(), O = d.useRef(null), y = d.useRef(null), $ = (e) => {
32
- e.event.preventDefault(), D({
33
- ...h,
10
+ import { useAdaptiveModeContext as In, canUseDOM as ae, getActiveElement as wn, useDir as yn, setScrollbarWidth as at, cloneArray as En, RowHeightService as xn, getter as ee } from "@progress/kendo-react-common";
11
+ import { filterBy as Sn } from "@progress/kendo-data-query";
12
+ import { getSelectionOptions as we, populateClipboardData as kn, ClipboardActionType as ze, getEditableOptions as Dn, tableKeyboardNavigation as te, ClipboardService as Kn, TableKeyboardNavigationContext as Gn, updateLeft as Tn, updateRight as Hn, getGroupExpandableOptions as Mn, groupExpandReducer as An, getDetailExpandableOptions as Fn, detailExpandReducer as Ln, getSelectedState as dt, editReducer as Bn, EDIT_ACTION as Wn, closestTagName as ye, getSelectedStateFromKeyDown as zn, getColumnIndex as On, getRowIndex as pn } from "@progress/kendo-react-data-tools";
13
+ import { ColumnResize as Nn } from "./drag/ColumnResize.mjs";
14
+ import { CommonDragLogic as Un } from "./drag/CommonDragLogic.mjs";
15
+ import { useStickyGroups as Vn } from "./hooks/useStickyGroups.mjs";
16
+ import { getDefaultHeadContextMenuItems as jn, getDefaultBodyContextMenuItems as qn, isRowReorderEnabled as $n, calcRowHeight as _n, sanitizeColumns as Zn, getFlatColumnsState as Jn, getDataAsArray as Xn } from "./utils/index.mjs";
17
+ import { VirtualScroll as Yn } from "./VirtualScroll.mjs";
18
+ import { GridContextMenu as Qn, contextMenuItemsMap as er } from "./contextMenu/GridContextMenu.mjs";
19
+ import { GridContextMenuAnchorPart as ct, GridContextMenuItemNames as Ee } from "./contextMenu/enums.mjs";
20
+ import { normalizeSortable as tr, firstLevelSortSeqMap as nr } from "./sortCommon.mjs";
21
+ import { BasePDFExport as rr } from "./BasePDFExport.mjs";
22
+ import { BaseCSVExport as or } from "./BaseCSVExport.mjs";
23
+ import { GridContext as ir } from "./utils/GridContext.mjs";
24
+ import { operators as ar } from "./filterCommon.mjs";
25
+ const dr = (t, x, b, W) => {
26
+ const ne = Object.keys(x.cells).map((k) => b.findIndex((re) => re.field === k)), $ = Object.keys(x.cells).length > 0 ? ne : !0;
27
+ return t.reduce((k, re) => (k[re[W != null ? W : "id"]] = $, k), {});
28
+ }, lt = (t, x, b, W) => x.reduce(($, k) => ({
29
+ ...$,
30
+ ...dr(Sn(t, k), k, b, W)
31
+ }), {}), yr = (t) => {
32
+ var it;
33
+ const x = t.gridProps.isClient, [b, W] = d.useState({}), ne = In(), $ = d.useRef(null), k = d.useRef(null), re = (e) => {
34
+ e.event.preventDefault(), W({
35
+ ...b,
34
36
  show: !0,
35
37
  offset: {
36
38
  left: e.event.pageX,
@@ -39,38 +41,64 @@ const Tn = (t, E, h, D) => {
39
41
  dataItem: e.dataItem,
40
42
  field: e.field
41
43
  });
42
- }, De = () => {
43
- D({});
44
- }, C = d.useMemo(() => t.columnsRef.find((e) => e.field === h.field), [t.columnsRef, h]), Ke = d.useMemo(() => {
45
- const e = t.gridProps.sortable && (C == null ? void 0 : C.sortable);
46
- return Rn({
44
+ }, Oe = () => {
45
+ W({});
46
+ }, st = (e) => {
47
+ const n = t.gridProps.dataItemKey || "", o = b.dataItem, r = t.gridProps.pinnedTopRows || [], i = t.gridProps.pinnedBottomRows || [], a = n ? o[n] : void 0, c = a !== void 0 && r.some((l) => l[n] === a), s = a !== void 0 && i.some((l) => l[n] === a);
48
+ return e.map((l) => {
49
+ const u = typeof l == "string" ? er[l] : l;
50
+ return (u == null ? void 0 : u.name) === Ee.pinRow && u.items ? {
51
+ ...u,
52
+ items: u.items.filter((m) => m.name === Ee.pinTop ? !c : m.name === Ee.pinBottom ? !s : m.name === Ee.unpin ? c || s : !0)
53
+ } : l;
54
+ });
55
+ }, y = d.useMemo(() => t.columnsRef.find((e) => e.field === b.field), [t.columnsRef, b]), pe = d.useMemo(() => {
56
+ const e = t.gridProps.sortable && (y == null ? void 0 : y.sortable);
57
+ return jn({
47
58
  pdf: !!t.gridProps.pdf,
48
59
  sortable: !!e,
49
- selectable: se(t.gridProps.selectable).enabled,
60
+ selectable: we(t.gridProps.selectable).enabled,
50
61
  clipboard: !!t.gridProps.clipboard
51
62
  });
52
- }, [C, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), Me = d.useMemo(() => (t.gridProps.sortable && (C == null || C.sortable), vn({
63
+ }, [y, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), Ne = d.useMemo(() => (t.gridProps.sortable && (y == null || y.sortable), qn({
53
64
  pdf: !!t.gridProps.pdf,
54
- selectable: se(t.gridProps.selectable).enabled,
65
+ selectable: we(t.gridProps.selectable).enabled,
55
66
  clipboard: !!t.gridProps.clipboard,
56
- rowReorderable: bn(t.gridProps.rowReorderable)
57
- })), [C, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), p = d.useMemo(() => {
58
- const e = (C == null ? void 0 : C.contextMenu) || t.gridProps.contextMenu, n = typeof e == "function" ? e(h) : e;
59
- if (n && h.offset) {
60
- const o = h.dataItem ? $e.body : $e.head, r = n[o], i = h.dataItem ? Me : Ke;
61
- return r === !1 ? void 0 : r === !0 || r === void 0 ? i : r;
67
+ rowReorderable: $n(t.gridProps.rowReorderable),
68
+ pinnable: !!t.gridProps.pinnable
69
+ })), [
70
+ y,
71
+ t.gridProps.sortable,
72
+ t.gridProps.selectable,
73
+ t.gridProps.clipboard,
74
+ t.gridProps.pinnable,
75
+ t.gridProps.rowReorderable,
76
+ t.gridProps.pdf
77
+ ]), de = d.useMemo(() => {
78
+ const e = (y == null ? void 0 : y.contextMenu) || t.gridProps.contextMenu, n = typeof e == "function" ? e(b) : e;
79
+ if (n && b.offset) {
80
+ const o = b.dataItem ? ct.body : ct.head, r = n[o], i = b.dataItem ? Ne : pe;
81
+ let a;
82
+ return r === !0 || r === void 0 ? a = i : r !== !1 && (a = r), t.gridProps.pinnable && a && b.dataItem ? st(a) : a;
62
83
  }
63
- }, [t.gridProps.contextMenu, h, Me, Ke, C]), Xe = (e) => {
64
- var c, f, l, u, s, b, m, k, z;
84
+ }, [
85
+ t.gridProps.contextMenu,
86
+ t.gridProps.pinnable,
87
+ b,
88
+ Ne,
89
+ pe,
90
+ y
91
+ ]), ut = (e) => {
92
+ var c, s, l, u, m, w, h, O, g;
65
93
  const n = e.event.item, o = {
66
- target: x.current,
94
+ target: S.current,
67
95
  syntheticEvent: e.event.syntheticEvent,
68
96
  nativeEvent: e.event.nativeEvent,
69
97
  menuItem: n,
70
98
  ...e
71
99
  };
72
- t.gridProps.onContextMenuItemClick && g(t.gridProps.onContextMenuItemClick, o);
73
- const r = w(), i = {
100
+ t.gridProps.onContextMenuItemClick && f(t.gridProps.onContextMenuItemClick, o);
101
+ const r = D(), i = {
74
102
  selectedField: "",
75
103
  componentId: t.id,
76
104
  dataItems: r,
@@ -84,262 +112,342 @@ const Tn = (t, E, h, D) => {
84
112
  metaKey: !1,
85
113
  shiftKey: !1,
86
114
  isDrag: !1,
87
- ...se(t.gridProps.selectable),
115
+ ...we(t.gridProps.selectable),
88
116
  ...o
89
- }, a = r.findIndex((Y) => Y === e.dataItem);
117
+ }, a = r.findIndex((E) => E === e.dataItem);
90
118
  switch ((c = n.data) == null ? void 0 : c.action) {
91
119
  case "SortCommand":
92
- if (C) {
93
- const Y = (f = n.name) == null ? void 0 : f.toLowerCase().includes("asc"), jt = ((l = n.name) == null ? void 0 : l.toLowerCase().includes("desc")) ? "desc" : void 0, qt = Y ? "asc" : jt, _t = n.name ? qt : void 0;
94
- He(e.event.syntheticEvent, C, _t);
120
+ if (y) {
121
+ const E = (s = n.name) == null ? void 0 : s.toLowerCase().includes("asc"), q = ((l = n.name) == null ? void 0 : l.toLowerCase().includes("desc")) ? "desc" : void 0, B = E ? "asc" : q, Q = n.name ? B : void 0;
122
+ Ue(e.event.syntheticEvent, y, Q);
95
123
  }
96
124
  break;
97
125
  case "SelectRowCommand":
98
- mt(i);
126
+ Mt(i);
99
127
  break;
100
128
  case "SelectAllRowsCommand":
101
- ft(i);
129
+ Ht(i);
102
130
  break;
103
131
  case "ExportPDFCommand":
104
- fe();
132
+ Se();
105
133
  break;
106
134
  case "ClearSelectionCommand":
107
- ht(i);
135
+ Ft(i);
108
136
  break;
109
137
  case "ReorderRowCommand":
110
- X.current = e.dataItem, (u = n.name) != null && u.toLowerCase().includes("rowup") && a > 0 && J(e.event.syntheticEvent, a - 1, "before"), (s = n.name) != null && s.toLowerCase().includes("rowdown") && a < r.length - 1 && J(e.event.syntheticEvent, a + 1, "after"), (b = n.name) != null && b.toLowerCase().includes("rowtop") && J(e.event.syntheticEvent, 0, "before"), (m = n.name) != null && m.toLowerCase().includes("rowbottom") && J(e.event.syntheticEvent, r.length - 1, "after");
138
+ ie.current = e.dataItem, (u = n.name) != null && u.toLowerCase().includes("rowup") && a > 0 && oe(e.event.syntheticEvent, a - 1, "before"), (m = n.name) != null && m.toLowerCase().includes("rowdown") && a < r.length - 1 && oe(e.event.syntheticEvent, a + 1, "after"), (w = n.name) != null && w.toLowerCase().includes("rowtop") && oe(e.event.syntheticEvent, 0, "before"), (h = n.name) != null && h.toLowerCase().includes("rowbottom") && oe(e.event.syntheticEvent, r.length - 1, "after");
111
139
  break;
112
140
  case "CopySelectionCommand":
113
- oe(
114
- ke.copy,
141
+ fe(
142
+ ze.copy,
115
143
  e.event.nativeEvent,
116
144
  {
117
- copyHeaders: !((k = n.name) != null && k.toLowerCase().includes("noheaders"))
145
+ copyHeaders: !((O = n.name) != null && O.toLowerCase().includes("noheaders"))
118
146
  },
119
147
  e.dataItem,
120
148
  e.field
121
149
  );
122
150
  break;
123
151
  case "PasteCommand":
124
- oe(
125
- ke.paste,
152
+ fe(
153
+ ze.paste,
126
154
  e.event.nativeEvent,
127
155
  {
128
- copyHeaders: !((z = n.name) != null && z.toLowerCase().includes("noheaders"))
156
+ copyHeaders: !((g = n.name) != null && g.toLowerCase().includes("noheaders"))
129
157
  },
130
158
  e.dataItem,
131
159
  e.field
132
160
  );
133
161
  break;
162
+ case "PinTopCommand":
163
+ le("pinTop", e.dataItem);
164
+ break;
165
+ case "PinBottomCommand":
166
+ le("pinBottom", e.dataItem);
167
+ break;
168
+ case "UnpinCommand":
169
+ le("unpin", e.dataItem);
170
+ break;
134
171
  }
135
- De();
136
- }, ee = () => {
172
+ Oe();
173
+ }, ce = () => {
137
174
  const e = t.columnsRef.filter((n) => n.declarationIndex >= 0 && n.parentIndex === -1);
138
- return In(e);
139
- }, Ye = (e, n, o) => {
140
- if (t.gridProps.onContextMenu && E) {
175
+ return Zn(e);
176
+ }, gt = (e, n, o) => {
177
+ if (t.gridProps.onContextMenu && x) {
141
178
  const r = {
142
- target: x.current,
179
+ target: S.current,
143
180
  syntheticEvent: e,
144
181
  nativeEvent: e.nativeEvent,
145
182
  dataItem: n,
146
183
  field: o
147
184
  };
148
- g(t.gridProps.onContextMenu, r);
185
+ f(t.gridProps.onContextMenu, r);
149
186
  }
150
- t.gridProps.contextMenu && $({
187
+ t.gridProps.contextMenu && re({
151
188
  event: e,
152
189
  dataItem: n,
153
190
  field: o
154
191
  });
155
- }, Qe = (e) => {
192
+ }, ft = (e) => {
193
+ var a, c;
156
194
  if (e.target !== e.currentTarget)
157
195
  return;
158
- clearTimeout(we.current), v.current && (v.current.table = A.current);
196
+ clearTimeout(Fe.current), C.current && (C.current.table = U.current);
159
197
  const n = e.currentTarget.scrollLeft, o = e.currentTarget.scrollTop;
160
- t.gridProps.columnVirtualization && (!S || o === Ee.current) && (we.current = window.setTimeout(() => {
161
- N();
162
- }, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = n), F.current && F.current.setScrollLeft(n), L.current && L.current.setScrollLeft(n), v.current && o !== Ee.current && v.current.scrollHandler(e), t.gridProps.onScroll && E && g(t.gridProps.onScroll, {
163
- ...R(e)
164
- }), Ee.current = o;
165
- }, Ze = (e) => {
166
- q.onKeyDown(e, {
198
+ t.gridProps.columnVirtualization && (!K || o === Ae.current) && (Fe.current = window.setTimeout(() => {
199
+ J();
200
+ }, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = n), j.current && j.current.setScrollLeft(n), V.current && V.current.setScrollLeft(n), M != null && M.current && M.current.setScrollLeft(n), A != null && A.current && A.current.setScrollLeft(n), F != null && F.current && F.current.setScrollLeft(n), L != null && L.current && L.current.setScrollLeft(n);
201
+ const r = (a = t.gridProps.virtualSkipRef) == null ? void 0 : a.current;
202
+ C.current && o !== Ae.current && C.current.scrollHandler(e);
203
+ const i = K && ((c = t.gridProps.virtualSkipRef) == null ? void 0 : c.current) !== r;
204
+ t.gridProps.onScroll && x && f(t.gridProps.onScroll, {
205
+ ...I(e)
206
+ }), Ae.current = o, i || nt();
207
+ }, mt = (e) => {
208
+ var o, r;
209
+ const n = e.target;
210
+ if ((e.keyCode === 38 || e.keyCode === 40) && n.closest(".k-grid-sticky-container")) {
211
+ const i = parseInt(((o = n.closest("tr")) == null ? void 0 : o.getAttribute("absolute-row-index")) || "", 10), a = n.getAttribute("data-keyboardnavid");
212
+ if (!isNaN(i) && a && !((r = G.current) == null ? void 0 : r.querySelector(`tr[absolute-row-index="${i}"]`)))
213
+ return Ce.current = {
214
+ navId: a,
215
+ key: e.key,
216
+ code: e.code,
217
+ keyCode: e.keyCode
218
+ }, e.preventDefault(), e.stopPropagation(), Pe({ rowIndex: i }), !0;
219
+ }
220
+ return !1;
221
+ }, Pt = () => {
222
+ var a;
223
+ if (!Ce.current || !H.current)
224
+ return;
225
+ const { navId: e, key: n, code: o, keyCode: r } = Ce.current, i = (a = G.current) == null ? void 0 : a.querySelector(
226
+ `[data-keyboardnavid="${e}"]`
227
+ );
228
+ i && i.dispatchEvent(
229
+ new KeyboardEvent("keydown", {
230
+ key: n,
231
+ code: o,
232
+ keyCode: r,
233
+ bubbles: !0,
234
+ cancelable: !0
235
+ })
236
+ );
237
+ }, ht = (e) => {
238
+ if (mt(e))
239
+ return;
240
+ te.onKeyDown(e, {
167
241
  navigatable: t.gridProps.navigatable || !1,
168
- contextStateRef: T,
169
- navigationStateRef: V,
170
- onNavigationAction: et,
171
- columns: ee()
172
- }), q.onGetSnapshotBeforeUpdate({
173
- document: K(),
174
- contextStateRef: T,
175
- navigationStateRef: V
242
+ contextStateRef: N,
243
+ navigationStateRef: X,
244
+ onNavigationAction: bt,
245
+ columns: ce()
246
+ }), te.onGetSnapshotBeforeUpdate({
247
+ document: z(),
248
+ contextStateRef: N,
249
+ navigationStateRef: X
176
250
  });
177
251
  const n = {
178
- dataItems: w(),
179
- mode: P.mode,
180
- cell: P.cell,
252
+ dataItems: D(),
253
+ mode: v.mode,
254
+ cell: v.cell,
181
255
  componentId: t.id,
182
256
  selectedField: "",
183
- ...R(e)
257
+ ...I(e)
184
258
  };
185
- t.gridProps.onKeyDown && E && g(t.gridProps.onKeyDown, n);
186
- }, pe = (e) => {
187
- q.onFocus(e, {
259
+ t.gridProps.onKeyDown && x && f(t.gridProps.onKeyDown, n);
260
+ }, Rt = (e) => {
261
+ te.onFocus(e, {
188
262
  navigatable: !!t.gridProps.navigatable,
189
- contextStateRef: T
263
+ contextStateRef: N
190
264
  });
191
- }, et = (e) => {
265
+ }, bt = (e) => {
192
266
  const { columnsRef: n } = t;
193
- if (e.action === "moveToNextPage" && bt(e.event), e.action === "moveToPrevPage" && Ct(e.event), e.focusElement && (e.action === "reorderToRight" || e.action === "reorderToLeft")) {
267
+ if (e.action === "moveToNextPage" && Wt(e.event), e.action === "moveToPrevPage" && zt(e.event), e.focusElement && (e.action === "reorderToRight" || e.action === "reorderToLeft")) {
194
268
  const o = parseInt(e.focusElement.ariaColIndex, 10) - 1;
195
269
  if (!n[o].reorderable)
196
270
  return;
197
271
  if (e.action === "reorderToRight" && o < t.columnsRef.length - 1) {
198
272
  if (n[o + 1].disableReorder)
199
273
  return;
200
- ne(o, o + 1, e.event);
274
+ ue(o, o + 1, e.event);
201
275
  }
202
276
  if (e.action === "reorderToLeft" && o > 0) {
203
277
  if (n[o - 1].disableReorder)
204
278
  return;
205
- ne(o, o - 1, e.event);
279
+ ue(o, o - 1, e.event);
206
280
  }
207
281
  }
208
- if (e.action === "select" && st(e.event), t.gridProps.onNavigationAction && E) {
282
+ if (e.action === "select" && Kt(e.event), t.gridProps.onNavigationAction && x) {
209
283
  const o = {
210
284
  focusElement: e.focusElement,
211
- ...R(e.event)
285
+ ...I(e.event)
212
286
  };
213
- g(t.gridProps.onNavigationAction, o);
287
+ f(t.gridProps.onNavigationAction, o);
214
288
  }
215
- }, tt = (e, n) => {
216
- t.gridProps.onRowClick && ue(e.target, "TD") && g(t.gridProps.onRowClick, {
289
+ }, vt = (e, n) => {
290
+ t.gridProps.onRowClick && ye(e.target, "TD") && f(t.gridProps.onRowClick, {
217
291
  dataItem: n,
218
- ...R(e)
292
+ ...I(e)
219
293
  });
220
- }, nt = (e, n) => {
221
- t.gridProps.onRowDoubleClick && ue(e.target, "TD") && g(t.gridProps.onRowDoubleClick, {
294
+ }, Ct = (e, n) => {
295
+ t.gridProps.onRowDoubleClick && ye(e.target, "TD") && f(t.gridProps.onRowDoubleClick, {
222
296
  dataItem: n,
223
- ...R(e)
297
+ ...I(e)
224
298
  });
225
- }, rt = (e) => {
226
- t.gridProps.onItemChange && g(t.gridProps.onItemChange, {
227
- ...R(e.syntheticEvent),
299
+ }, It = (e) => {
300
+ t.gridProps.onItemChange && f(t.gridProps.onItemChange, {
301
+ ...I(e.syntheticEvent),
228
302
  dataItem: e.dataItem,
229
303
  field: void 0,
230
304
  value: void 0
231
305
  });
232
- }, ot = (e) => {
233
- t.gridProps.onItemChange && t.gridProps.onEditChange && g(t.gridProps.onEditChange, {
306
+ }, wt = (e) => {
307
+ t.gridProps.onItemChange && t.gridProps.onEditChange && f(t.gridProps.onEditChange, {
234
308
  edit: {},
235
- ...R(e.syntheticEvent)
309
+ ...I(e.syntheticEvent)
236
310
  });
237
- }, it = (e, n, o) => {
238
- if (je.enabled && je.mode === "incell" && t.gridProps.dataItemKey) {
239
- const r = sn(t.gridProps.edit, {
240
- type: un.ENTER_FIELD_EDIT,
311
+ }, yt = (e, n, o) => {
312
+ var r, i;
313
+ if (ot.enabled && ot.mode === "incell" && t.gridProps.dataItemKey) {
314
+ if (t.gridProps.pinnable && t.gridProps.editZoneRef) {
315
+ const c = !!((i = (r = e.target).closest) != null && i.call(r, ".k-grid-pinned-container"));
316
+ t.gridProps.editZoneRef.current = c ? "pinned" : "body";
317
+ }
318
+ const a = Bn(t.gridProps.edit, {
319
+ type: Wn.ENTER_FIELD_EDIT,
241
320
  payload: { id: n[t.gridProps.dataItemKey], field: o }
242
321
  });
243
- t.gridProps.onEditChange && g(t.gridProps.onEditChange, {
244
- edit: r,
245
- ...R(e)
322
+ t.gridProps.onEditChange && f(t.gridProps.onEditChange, {
323
+ edit: a,
324
+ ...I(e)
246
325
  });
247
326
  }
248
- }, at = (e, n) => {
327
+ }, Et = (e, n) => {
249
328
  var r;
250
- if (cn(t.detailExpandable).enabled) {
251
- const i = ln((r = t.gridProps.detailExpand) != null ? r : {}, e);
252
- t.gridProps.onDetailExpandChange && g(t.gridProps.onDetailExpandChange, {
253
- ...R(n),
329
+ if (Fn(t.detailExpandable).enabled) {
330
+ const i = Ln((r = t.gridProps.detailExpand) != null ? r : {}, e);
331
+ t.gridProps.onDetailExpandChange && f(t.gridProps.onDetailExpandChange, {
332
+ ...I(n),
254
333
  detailExpand: i
255
334
  });
256
335
  }
257
- }, dt = (e, n) => {
336
+ }, xt = (e, n) => {
258
337
  var r;
259
- const o = an(
338
+ const o = Mn(
260
339
  typeof t.gridProps.groupable == "object" ? t.gridProps.groupable.expandable !== !1 : t.gridProps.groupable
261
340
  );
262
341
  if (o.enabled) {
263
- const i = dn((r = t.gridProps.groupExpand) != null ? r : [], e, o);
264
- t.gridProps.onGroupExpandChange && g(t.gridProps.onGroupExpandChange, {
265
- ...R(n),
342
+ const i = An((r = t.gridProps.groupExpand) != null ? r : [], e, o);
343
+ t.gridProps.onGroupExpandChange && f(t.gridProps.onGroupExpandChange, {
344
+ ...I(n),
266
345
  groupExpand: i
267
346
  });
268
347
  }
269
- }, He = (e, n, o) => {
270
- const { allowUnsort: r, mode: i } = Sn(
348
+ Pn(e.group);
349
+ }, St = d.useCallback(
350
+ (e) => {
351
+ const { dataItemKey: n = "", pinnedTopRows: o = [], pinnedBottomRows: r = [] } = t.gridProps;
352
+ if (!n || !e)
353
+ return "none";
354
+ const i = e[n];
355
+ return o != null && o.some((a) => a[n] === i) ? "top" : r != null && r.some((a) => a[n] === i) ? "bottom" : "none";
356
+ },
357
+ [t.gridProps.pinnedTopRows, t.gridProps.pinnedBottomRows, t.gridProps.dataItemKey]
358
+ ), le = (e, n) => {
359
+ if (!t.gridProps.pinnable)
360
+ return;
361
+ const { dataItemKey: o = "", pinnedTopRows: r = [], pinnedBottomRows: i = [] } = t.gridProps, a = n[o], c = r.filter((u) => u[o] !== a), s = i.filter((u) => u[o] !== a);
362
+ let l;
363
+ switch (e) {
364
+ case "pinTop":
365
+ l = { pinnedTopRows: [...c, n], pinnedBottomRows: s, dataItem: n };
366
+ break;
367
+ case "pinBottom":
368
+ l = { pinnedTopRows: c, pinnedBottomRows: [...s, n], dataItem: n };
369
+ break;
370
+ case "unpin":
371
+ l = { pinnedTopRows: c, pinnedBottomRows: s, dataItem: n };
372
+ break;
373
+ default:
374
+ return;
375
+ }
376
+ t.gridProps.onRowPinChange && f(t.gridProps.onRowPinChange, l);
377
+ }, Ue = (e, n, o) => {
378
+ const { allowUnsort: r, mode: i } = tr(
271
379
  t.gridProps.sortable || !1,
272
380
  n.sortable || !1
273
- ), a = (t.gridProps.sort || []).filter((l) => l.field === n.field)[0], c = o || kn[r][a && a.dir || ""], f = i === "single" ? [] : (t.gridProps.sort || []).filter((l) => l.field !== n.field);
274
- c !== "" && n.field && f.push({ field: n.field, dir: c }), Te(f, e);
275
- }, ct = (e) => {
276
- t.gridProps.onItemChange && g(t.gridProps.onItemChange, {
277
- ...R(e.syntheticEvent),
381
+ ), a = (t.gridProps.sort || []).filter((l) => l.field === n.field)[0], c = o || nr[r][a && a.dir || ""], s = i === "single" ? [] : (t.gridProps.sort || []).filter((l) => l.field !== n.field);
382
+ c !== "" && n.field && s.push({ field: n.field, dir: c }), je(s, e);
383
+ }, kt = (e) => {
384
+ t.gridProps.onItemChange && f(t.gridProps.onItemChange, {
385
+ ...I(e.syntheticEvent),
278
386
  dataItem: e.dataItem,
279
387
  dataIndex: e.dataIndex,
280
388
  field: e.field,
281
389
  value: e.value
282
390
  });
283
- }, lt = (e) => {
391
+ }, Dt = (e) => {
284
392
  var n;
285
- if (t.gridProps.onSelectionChange && P.enabled) {
393
+ if (t.gridProps.onSelectionChange && v.enabled) {
286
394
  const { event: o, dataItem: r, dataIndex: i, columnIndex: a } = e, c = {
287
- ...R(o),
395
+ ...I(o),
288
396
  dataItem: r,
289
397
  startColIndex: a,
290
398
  endColIndex: a,
291
399
  startRowIndex: i,
292
400
  endRowIndex: i,
293
- dataItems: w(),
401
+ dataItems: D(),
294
402
  altKey: !1,
295
403
  ctrlKey: !1,
296
404
  shiftKey: !1,
297
405
  metaKey: !1,
298
- mode: P.mode,
299
- cell: P.cell,
406
+ mode: v.mode,
407
+ cell: v.cell,
300
408
  isDrag: !1,
301
409
  componentId: t.id,
302
410
  selectedField: ""
303
411
  };
304
- g(t.gridProps.onSelectionChange, {
412
+ f(t.gridProps.onSelectionChange, {
305
413
  ...c,
306
- select: t.gridProps.dataItemKey ? _e({
414
+ select: t.gridProps.dataItemKey ? dt({
307
415
  event: c,
308
416
  selectedState: (n = t.gridProps.select) != null ? n : {},
309
417
  dataItemKey: t.gridProps.dataItemKey
310
418
  }) : {}
311
419
  });
312
420
  }
313
- }, st = (e) => {
421
+ }, Kt = (e) => {
314
422
  var l, u;
315
- if (!P.enabled || !t.gridProps.dataItemKey)
423
+ if (!v.enabled || !t.gridProps.dataItemKey)
316
424
  return;
317
425
  const n = {
318
- dataItems: w(),
319
- mode: P.mode,
320
- cell: P.cell,
426
+ dataItems: D(),
427
+ mode: v.mode,
428
+ cell: v.cell,
321
429
  componentId: t.id,
322
430
  selectedField: "",
323
- ...R(e)
324
- }, o = gn({
431
+ ...I(e)
432
+ }, o = zn({
325
433
  event: n,
326
434
  selectedState: (l = t.gridProps.select) != null ? l : {},
327
435
  dataItemKey: t.gridProps.dataItemKey
328
436
  });
329
437
  if (o === t.gridProps.select)
330
438
  return;
331
- const r = e.target, i = ue(r, "TD"), a = ue(r, "TR"), c = fn(i), f = mn(a);
332
- if (c !== void 0 && f !== void 0) {
333
- const s = (u = wn(t.gridProps.data)) == null ? void 0 : u[f];
334
- t.gridProps.onSelectionChange && g(t.gridProps.onSelectionChange, {
439
+ const r = e.target, i = ye(r, "TD"), a = ye(r, "TR"), c = On(i), s = pn(a);
440
+ if (c !== void 0 && s !== void 0) {
441
+ const m = (u = Xn(t.gridProps.data)) == null ? void 0 : u[s];
442
+ t.gridProps.onSelectionChange && f(t.gridProps.onSelectionChange, {
335
443
  ...n,
336
444
  select: o,
337
- dataItem: s,
338
- startRowIndex: f,
445
+ dataItem: m,
446
+ startRowIndex: s,
339
447
  startColIndex: c,
340
- startDataItem: s,
341
- endDataItem: s,
342
- endRowIndex: f,
448
+ startDataItem: m,
449
+ endDataItem: m,
450
+ endRowIndex: s,
343
451
  endColIndex: c,
344
452
  ctrlKey: e.ctrlKey,
345
453
  altKey: e.altKey,
@@ -348,47 +456,55 @@ const Tn = (t, E, h, D) => {
348
456
  isDrag: !1
349
457
  });
350
458
  }
351
- }, ut = (e) => {
352
- if (t.gridProps.onHeaderSelectionChange && P.enabled) {
353
- const n = w();
354
- g(t.gridProps.onHeaderSelectionChange, {
355
- select: e.syntheticEvent.target.checked ? n.reduce((o, r) => (t.gridProps.dataItemKey && Z(t.gridProps.dataItemKey)(r) !== void 0 && (o[Z(t.gridProps.dataItemKey)(r)] = !0), o), {}) : {},
459
+ }, Gt = (e) => {
460
+ if (t.gridProps.onHeaderSelectionChange && v.enabled) {
461
+ const n = D();
462
+ f(t.gridProps.onHeaderSelectionChange, {
463
+ select: e.syntheticEvent.target.checked ? n.reduce((o, r) => (t.gridProps.dataItemKey && ee(t.gridProps.dataItemKey)(r) !== void 0 && (o[ee(t.gridProps.dataItemKey)(r)] = !0), o), {}) : {},
356
464
  field: e.field,
357
465
  nativeEvent: e.syntheticEvent && e.syntheticEvent.nativeEvent,
358
466
  syntheticEvent: e.syntheticEvent,
359
- target: x.current,
467
+ target: S.current,
360
468
  dataItems: n
361
469
  });
362
470
  }
363
- }, W = (e, n) => {
364
- t.gridProps.onSelectionChange && P.enabled && g(t.gridProps.onSelectionChange, {
471
+ }, _ = (e, n) => {
472
+ t.gridProps.onSelectionChange && v.enabled && f(t.gridProps.onSelectionChange, {
365
473
  ...e,
366
474
  select: n
367
475
  });
368
- }, gt = (e) => {
476
+ }, Tt = (e, n) => {
477
+ const o = t.gridProps.dataItemKey;
478
+ if (!o || !n)
479
+ return;
480
+ const r = ee(o), i = D().findIndex((a) => r(a) === r(n));
481
+ i !== -1 && Ve({
482
+ ...e,
483
+ startRowIndex: i,
484
+ endRowIndex: i
485
+ });
486
+ }, Ve = (e) => {
369
487
  var n;
370
- if (t.gridProps.onSelectionChange && P.enabled) {
371
- const o = w()[e.startRowIndex], r = w()[e.endRowIndex], i = {
488
+ if (t.gridProps.onSelectionChange && v.enabled) {
489
+ const o = D(), r = o[e.startRowIndex], i = o[e.endRowIndex], a = {
372
490
  syntheticEvent: void 0,
373
- target: x.current,
491
+ target: S.current,
374
492
  selectedField: "",
375
493
  componentId: t.id,
376
- dataItems: w(),
494
+ dataItems: o,
377
495
  dataItem: null,
378
- startDataItem: o,
379
- endDataItem: r,
496
+ startDataItem: r,
497
+ endDataItem: i,
380
498
  ...e
381
- }, a = _e({
382
- event: i,
499
+ }, c = dt({
500
+ event: a,
383
501
  selectedState: (n = t.gridProps.select) != null ? n : {},
384
- // Thats kinda strange, even through the `dataItemKey` is required by the `getSelectedState`
385
- // it does work correctly even without it
386
502
  dataItemKey: t.gridProps.dataItemKey
387
503
  });
388
- W(i, a);
504
+ _(a, c);
389
505
  }
390
- }, ft = (e) => {
391
- if (t.gridProps.onSelectionChange && P.enabled) {
506
+ }, Ht = (e) => {
507
+ if (t.gridProps.onSelectionChange && v.enabled) {
392
508
  const n = e.dataItems[0], o = e.dataItems[e.dataItems.length - 1], r = {}, i = {
393
509
  ...e,
394
510
  startDataItem: n,
@@ -399,14 +515,14 @@ const Tn = (t, E, h, D) => {
399
515
  endColIndex: t.columnsRef.length - 1
400
516
  };
401
517
  e.dataItems.forEach((a) => {
402
- const f = Z(t.gridProps.dataItemKey)(a);
403
- r[f] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0;
404
- }), W(i, r);
518
+ const s = ee(t.gridProps.dataItemKey)(a);
519
+ r[s] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0;
520
+ }), _(i, r);
405
521
  }
406
- }, mt = (e) => {
407
- if (t.gridProps.onSelectionChange && P.enabled) {
408
- const o = Z(t.gridProps.dataItemKey)(e.dataItem), r = 0, i = t.columnsRef.length - 1, a = e.dataItems.findIndex(
409
- (s) => s[t.gridProps.dataItemKey] === e.dataItem[t.gridProps.dataItemKey]
522
+ }, Mt = (e) => {
523
+ if (t.gridProps.onSelectionChange && v.enabled) {
524
+ const o = ee(t.gridProps.dataItemKey)(e.dataItem), r = 0, i = t.columnsRef.length - 1, a = e.dataItems.findIndex(
525
+ (m) => m[t.gridProps.dataItemKey] === e.dataItem[t.gridProps.dataItemKey]
410
526
  ), l = {
411
527
  ...e,
412
528
  startDataItem: a,
@@ -416,15 +532,15 @@ const Tn = (t, E, h, D) => {
416
532
  startColIndex: r,
417
533
  endColIndex: i
418
534
  }, u = e.mode === "multiple" ? t.gridProps.select || {} : {};
419
- u[o] === !0 || Array.isArray(u[o]) && u[o].length === t.columnsRef.length ? delete u[o] : u[o] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0, W(l, u);
535
+ u[o] === !0 || Array.isArray(u[o]) && u[o].length === t.columnsRef.length ? delete u[o] : u[o] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0, _(l, u);
420
536
  }
421
- }, Pt = (e) => {
422
- if (!P.enabled)
537
+ }, At = (e) => {
538
+ if (!v.enabled)
423
539
  return;
424
- const n = w(), o = {
540
+ const n = D(), o = {
425
541
  syntheticEvent: void 0,
426
542
  nativeEvent: void 0,
427
- target: x.current,
543
+ target: S.current,
428
544
  selectedField: "",
429
545
  componentId: t.id,
430
546
  dataItems: n,
@@ -436,35 +552,35 @@ const Tn = (t, E, h, D) => {
436
552
  metaKey: !1,
437
553
  shiftKey: !1,
438
554
  isDrag: !1,
439
- mode: P.mode,
440
- cell: P.cell
555
+ mode: v.mode,
556
+ cell: v.cell
441
557
  };
442
558
  if (!e || e.length === 0) {
443
- const s = {
559
+ const m = {
444
560
  ...o,
445
561
  startRowIndex: -1,
446
562
  endRowIndex: -1,
447
563
  startColIndex: -1,
448
564
  endColIndex: -1
449
565
  };
450
- W(s, {});
566
+ _(m, {});
451
567
  return;
452
568
  }
453
- const r = Je(
569
+ const r = lt(
454
570
  t.gridProps.data,
455
571
  e,
456
572
  t.columnsRef,
457
573
  t.gridProps.dataItemKey
458
574
  ), i = {};
459
- Object.keys(r).forEach((s) => {
460
- r[s] && (i[s] = P.cell ? [...Array(t.columnsRef.length).keys()] : !0);
575
+ Object.keys(r).forEach((m) => {
576
+ r[m] && (i[m] = v.cell ? [...Array(t.columnsRef.length).keys()] : !0);
461
577
  });
462
- let a = -1, c = -1, f = n[0] || null, l = n[n.length - 1] || null;
578
+ let a = -1, c = -1, s = n[0] || null, l = n[n.length - 1] || null;
463
579
  if (t.gridProps.dataItemKey) {
464
- const s = Z(t.gridProps.dataItemKey);
465
- for (let b = 0; b < n.length; b++) {
466
- const m = s(n[b]);
467
- m !== void 0 && r[m] && (a === -1 && (a = b, f = n[b]), c = b, l = n[b]);
580
+ const m = ee(t.gridProps.dataItemKey);
581
+ for (let w = 0; w < n.length; w++) {
582
+ const h = m(n[w]);
583
+ h !== void 0 && r[h] && (a === -1 && (a = w, s = n[w]), c = w, l = n[w]);
468
584
  }
469
585
  }
470
586
  const u = {
@@ -473,87 +589,87 @@ const Tn = (t, E, h, D) => {
473
589
  endRowIndex: c,
474
590
  startColIndex: 0,
475
591
  endColIndex: t.columnsRef.length - 1,
476
- startDataItem: f,
592
+ startDataItem: s,
477
593
  endDataItem: l
478
594
  };
479
- W(u, i);
480
- }, ht = (e) => {
481
- t.gridProps.onSelectionChange && P.enabled && W(e, {});
482
- }, B = (e, n, o, r, i) => {
483
- vt();
595
+ _(u, i);
596
+ }, Ft = (e) => {
597
+ t.gridProps.onSelectionChange && v.enabled && _(e, {});
598
+ }, Z = (e, n, o, r, i) => {
599
+ Bt();
484
600
  const a = t.gridProps.onDataStateChange;
485
601
  if (e) {
486
- const c = { ...R(r), ...n, targetEvent: i };
487
- g(e, c);
488
- } else a && g(a, {
489
- ...R(r),
602
+ const c = { ...I(r), ...n, targetEvent: i };
603
+ f(e, c);
604
+ } else a && f(a, {
605
+ ...I(r),
490
606
  targetEvent: i || {},
491
607
  dataState: {
492
- ...Ht(),
608
+ ...Xt(),
493
609
  ...o
494
610
  }
495
611
  });
496
- }, te = (e, n, o) => {
612
+ }, se = (e, n, o) => {
497
613
  var r;
498
- S && t.gridProps.pageable && ((r = v.current) == null || r.reset()), B(
614
+ K && t.gridProps.pageable && ((r = C.current) == null || r.reset()), Z(
499
615
  t.gridProps.onPageChange,
500
616
  { page: e },
501
617
  { skip: e.skip, take: e.take },
502
618
  n,
503
619
  o
504
620
  );
505
- }, Rt = (e, n, o) => {
621
+ }, Lt = (e, n, o) => {
506
622
  var r;
507
- t.gridProps.pageable || (r = t.gridProps.group) != null && r.length ? t.gridProps.virtualSkipRef && (t.gridProps.virtualSkipRef.current = e.skip, N()) : te(e, n, o);
508
- }, ge = () => {
623
+ t.gridProps.pageable || (r = t.gridProps.group) != null && r.length ? t.gridProps.virtualSkipRef && (t.gridProps.virtualSkipRef.current = e.skip, J()) : se(e, n, o);
624
+ }, xe = () => {
509
625
  let e = t.gridProps.total || 0;
510
626
  return Array.isArray(t.gridProps.data) ? e = e || t.gridProps.data.length : t.gridProps.data && (e = e || t.gridProps.data.total), e;
511
- }, vt = () => {
512
- S && t.gridProps.virtualSkipRef && (t.gridProps.virtualSkipRef.current = 0);
513
- }, bt = (e) => {
627
+ }, Bt = () => {
628
+ K && t.gridProps.virtualSkipRef && (t.gridProps.virtualSkipRef.current = 0);
629
+ }, Wt = (e) => {
514
630
  var i, a;
515
- const n = (a = (i = t.gridProps.take) != null ? i : t.gridProps.pageSize) != null ? a : 0, o = (t.gridProps.skip || 0) + n, r = ge();
516
- o < r && te({ skip: o, take: n }, e);
517
- }, Ct = (e) => {
631
+ const n = (a = (i = t.gridProps.take) != null ? i : t.gridProps.pageSize) != null ? a : 0, o = (t.gridProps.skip || 0) + n, r = xe();
632
+ o < r && se({ skip: o, take: n }, e);
633
+ }, zt = (e) => {
518
634
  var r, i;
519
635
  const n = (i = (r = t.gridProps.take) != null ? r : t.gridProps.pageSize) != null ? i : 0, o = (t.gridProps.skip || 0) - n;
520
- o >= 0 && te({ skip: o, take: n }, e);
521
- }, It = (e) => {
522
- te({ skip: e.skip, take: e.take }, e.syntheticEvent, e.targetEvent);
523
- }, Te = (e, n) => {
524
- B(
636
+ o >= 0 && se({ skip: o, take: n }, e);
637
+ }, Ot = (e) => {
638
+ se({ skip: e.skip, take: e.take }, e.syntheticEvent, e.targetEvent);
639
+ }, je = (e, n) => {
640
+ Z(
525
641
  t.gridProps.onSortChange,
526
642
  { sort: e },
527
- { sort: e, ...S && !t.gridProps.pageable ? { skip: 0 } : {} },
643
+ { sort: e, ...K && !t.gridProps.pageable ? { skip: 0 } : {} },
528
644
  n
529
645
  );
530
- }, Et = (e, n) => {
531
- B(
646
+ }, pt = (e, n) => {
647
+ Z(
532
648
  t.gridProps.onFilterChange,
533
649
  { filter: e },
534
650
  { filter: e, skip: 0 },
535
651
  n
536
652
  );
537
- }, wt = (e) => {
653
+ }, Nt = (e) => {
538
654
  if (!e || e.length === 0) {
539
- Ge({});
655
+ qe({});
540
656
  return;
541
657
  }
542
- const n = Je(
658
+ const n = lt(
543
659
  t.gridProps.data,
544
660
  e,
545
661
  t.columnsRef,
546
662
  t.gridProps.dataItemKey
547
663
  );
548
- Ge({ ...n });
549
- }, Ge = (e) => {
550
- B(
664
+ qe({ ...n });
665
+ }, qe = (e) => {
666
+ Z(
551
667
  t.gridProps.onHighlightChange,
552
668
  { highlight: e },
553
669
  {},
554
670
  {}
555
671
  );
556
- }, xt = (e) => {
672
+ }, Ut = (e) => {
557
673
  const n = t.gridProps.searchFields || t.columnsRef.map((i) => i.field) || [], o = e.nativeEvent.target.value, r = {
558
674
  logic: "or",
559
675
  filters: n.filter((i) => i !== void 0).map((i) => {
@@ -566,7 +682,7 @@ const Tn = (t, E, h, D) => {
566
682
  };
567
683
  })
568
684
  };
569
- B(
685
+ Z(
570
686
  t.gridProps.onSearchChange,
571
687
  {
572
688
  search: r
@@ -574,138 +690,142 @@ const Tn = (t, E, h, D) => {
574
690
  { skip: 0 },
575
691
  e.syntheticEvent
576
692
  );
577
- }, fe = () => {
693
+ }, Se = () => {
578
694
  var e;
579
- (e = O.current) == null || e.save();
580
- }, Ae = async () => {
695
+ (e = $.current) == null || e.save();
696
+ }, $e = async () => {
581
697
  var e;
582
- await ((e = y.current) == null ? void 0 : e.save());
583
- }, Le = () => {
698
+ await ((e = k.current) == null ? void 0 : e.save());
699
+ }, _e = () => {
584
700
  var e;
585
- return ((e = y.current) == null ? void 0 : e.getBlob()) || null;
586
- }, yt = async (e) => {
701
+ return ((e = k.current) == null ? void 0 : e.getBlob()) || null;
702
+ }, Vt = async (e) => {
587
703
  var n, o;
588
704
  (n = t.gridProps) != null && n.onPdfExport && await ((o = t.gridProps) == null ? void 0 : o.onPdfExport(e));
589
- }, St = (e) => {
705
+ }, jt = (e) => {
590
706
  var n, o;
591
707
  return (n = t.gridProps) != null && n.onCsvExport ? (o = t.gridProps) == null ? void 0 : o.onCsvExport(e) : e;
592
- }, me = (e, n) => {
708
+ }, ke = (e, n) => {
593
709
  const o = n.nativeEvent ? n : { nativeEvent: n.nativeEvent || n.originalEvent };
594
710
  let r = {};
595
- t.isVirtualScroll && e.length && !t.gridProps.pageable && (r = { take: void 0 }), e.length === 0 && t.gridProps.navigatable && (be.current = !0), B(
711
+ t.isVirtualScroll && e.length && !t.gridProps.pageable && (r = { take: void 0 }), e.length === 0 && t.gridProps.navigatable && (Te.current = !0), Z(
596
712
  t.gridProps.onGroupChange,
597
713
  { group: e },
598
714
  { group: e, skip: 0, ...r },
599
715
  o
600
716
  );
601
- }, Pe = (e) => {
717
+ }, De = (e) => {
602
718
  if (t.gridProps.onColumnsStateChange) {
603
719
  const n = {
604
- target: x.current,
720
+ target: S.current,
605
721
  columnsState: e
606
722
  };
607
- g(t.gridProps.onColumnsStateChange, n);
723
+ f(t.gridProps.onColumnsStateChange, n);
608
724
  }
609
- }, ne = (e, n, o) => {
610
- const { columnsRef: r, columnsState: i } = t, a = r[e], c = En(i), f = a.depth, l = (m) => {
725
+ }, ue = (e, n, o) => {
726
+ const { columnsRef: r, columnsState: i } = t, a = r[e], c = Jn(i), s = a.depth, l = (h) => {
611
727
  do
612
- m++;
613
- while (m < r.length && r[m].depth > f);
614
- return m;
728
+ h++;
729
+ while (h < r.length && r[h].depth > s);
730
+ return h;
615
731
  }, u = r.splice(e, l(e) - e);
616
- r.splice(e < n ? l(n - u.length) : n, 0, ...u), r.filter((m) => m.declarationIndex >= 0).forEach((m, k) => {
617
- m.orderIndex = k;
618
- const z = c.find((Y) => Y.id === m.id);
619
- z && (z.orderIndex = k);
732
+ r.splice(e < n ? l(n - u.length) : n, 0, ...u), r.filter((h) => h.declarationIndex >= 0).forEach((h, O) => {
733
+ h.orderIndex = O;
734
+ const g = c.find((E) => E.id === h.id);
735
+ g && (g.orderIndex = O);
620
736
  });
621
- const s = r[e].locked && r[n].locked;
622
- rn(t.columnsMapRef, r, s || ce.current), on(t.columnsMapRef, r, s || ce.current), ve.current && (ce.current = !1, ve.current = !1);
623
- const b = ee();
624
- if (N(), t.gridProps.onColumnReorder) {
625
- const m = {
626
- target: x.current,
627
- columns: b,
737
+ const m = r[e].locked && r[n].locked;
738
+ Tn(t.columnsMapRef, r, m || be.current), Hn(t.columnsMapRef, r, m || be.current), Ge.current && (be.current = !1, Ge.current = !1);
739
+ const w = ce();
740
+ if (J(), t.gridProps.onColumnReorder) {
741
+ const h = {
742
+ target: S.current,
743
+ columns: w,
628
744
  columnId: a.id,
629
745
  nativeEvent: o
630
746
  };
631
- g(t.gridProps.onColumnReorder, m);
747
+ f(t.gridProps.onColumnReorder, h);
632
748
  }
633
- Pe(i);
634
- }, J = (e, n, o) => {
749
+ De(i);
750
+ }, oe = (e, n, o) => {
635
751
  const r = typeof t.gridProps.rowReorderable == "object" ? t.gridProps.rowReorderable.enabled : t.gridProps.rowReorderable;
636
- if (o === "forbidden" || !r || !X.current)
752
+ if (o === "forbidden" || !r || !ie.current)
637
753
  return;
638
754
  const i = t.dataRef[n];
639
- t.gridProps.onRowReorder && g(t.gridProps.onRowReorder, {
640
- draggedDataItems: [X.current],
755
+ t.gridProps.onRowReorder && f(t.gridProps.onRowReorder, {
756
+ draggedDataItems: [ie.current],
641
757
  droppedDataItem: i == null ? void 0 : i.dataItem,
642
758
  dropPosition: o,
643
759
  nativeEvent: e.originalEvent,
644
760
  dragEvent: e,
645
- target: x.current
646
- }), X.current = null;
647
- }, kt = (e, n, o) => {
761
+ target: S.current
762
+ }), ie.current = null;
763
+ }, qt = (e, n, o) => {
648
764
  if (t.gridProps.group === void 0)
649
765
  return;
650
766
  const r = t.gridProps.group.slice();
651
- r.splice(n, 0, ...r.splice(e, 1)), me(r, o);
652
- }, Fe = (e, n, o) => {
767
+ r.splice(n, 0, ...r.splice(e, 1)), ke(r, o);
768
+ }, Ze = (e, n, o) => {
653
769
  const r = t.columnsRef[e].field;
654
770
  if (!r)
655
771
  return;
656
772
  const i = (t.gridProps.group || []).slice();
657
- i.splice(n, 0, { field: r }), me(i, o);
658
- }, Dt = (e, n) => {
659
- const o = H.current.getCurrentGroupsLength;
660
- Fe(e, o, n);
661
- }, he = () => {
662
- var o, r, i, a, c, f;
773
+ i.splice(n, 0, { field: r }), ke(i, o);
774
+ }, $t = (e, n) => {
775
+ const o = p.current.getCurrentGroupsLength;
776
+ Ze(e, o, n);
777
+ }, Ke = () => {
778
+ var e, n, o, r, i, a, c, s, l, u, m, w, h, O;
663
779
  if (t.gridProps.dataLayoutMode === "stacked") {
664
- const l = ((o = M.current) == null ? void 0 : o.offsetWidth) || 0;
665
- if ((r = I.current) != null && r.colGroupMain && l) {
666
- const u = I.current.colGroupMain.children, s = u.length - 1;
667
- if (s >= 0) {
668
- let b = 0;
669
- for (let k = 0; k < s; k++) {
670
- const z = parseFloat((u[k].width || 0).toString()) || u[k].clientWidth;
671
- b += z;
780
+ const g = ((e = H.current) == null ? void 0 : e.offsetWidth) || 0;
781
+ if ((n = P.current) != null && n.colGroupMain && g) {
782
+ const E = P.current.colGroupMain.children, R = E.length - 1;
783
+ if (R >= 0) {
784
+ let q = 0;
785
+ for (let Q = 0; Q < R; Q++) {
786
+ const Cn = parseFloat((E[Q].width || 0).toString()) || E[Q].clientWidth;
787
+ q += Cn;
672
788
  }
673
- const m = Math.max(0, l - b);
674
- u[s].width = m + "px", (a = (i = I.current.colGroupHeader) == null ? void 0 : i.children) != null && a[s] && (I.current.colGroupHeader.children[s].width = m + "px"), (f = (c = I.current.colGroupFooter) == null ? void 0 : c.children) != null && f[s] && (I.current.colGroupFooter.children[s].width = m + "px");
789
+ const B = Math.max(0, g - q);
790
+ E[R].width = B + "px", (r = (o = P.current.colGroupHeader) == null ? void 0 : o.children) != null && r[R] && (P.current.colGroupHeader.children[R].width = B + "px"), (a = (i = P.current.colGroupFooter) == null ? void 0 : i.children) != null && a[R] && (P.current.colGroupFooter.children[R].width = B + "px"), (s = (c = P.current.colGroupStickyHeader) == null ? void 0 : c.children) != null && s[R] && (P.current.colGroupStickyHeader.children[R].width = B + "px"), (u = (l = P.current.colGroupStickyFooter) == null ? void 0 : l.children) != null && u[R] && (P.current.colGroupStickyFooter.children[R].width = B + "px"), (w = (m = P.current.colGroupPinnedTop) == null ? void 0 : m.children) != null && w[R] && (P.current.colGroupPinnedTop.children[R].width = B + "px"), (O = (h = P.current.colGroupPinnedBottom) == null ? void 0 : h.children) != null && O[R] && (P.current.colGroupPinnedBottom.children[R].width = B + "px");
675
791
  }
676
792
  }
677
- F.current && F.current.setWidth(l), L.current && L.current.setWidth(l), A.current && (A.current.style.width = l ? l + "px" : "");
678
- return;
679
- }
680
- let e = 0;
681
- if (!I.current.colGroupMain)
682
- return;
683
- const n = I.current.colGroupMain.children;
684
- for (let l = 0; l < n.length; l++) {
685
- const u = n[l].width;
686
- if (!u) {
687
- e = 0;
688
- break;
793
+ j.current && j.current.setWidth(g), V.current && V.current.setWidth(g), M.current && M.current.setWidth(g), A.current && A.current.setWidth(g), F.current && F.current.setWidth(g), L.current && L.current.setWidth(g), U.current && (U.current.style.width = g ? g + "px" : "");
794
+ } else {
795
+ let g = 0;
796
+ if (!P.current.colGroupMain)
797
+ return;
798
+ const E = P.current.colGroupMain.children;
799
+ for (let R = 0; R < E.length; R++) {
800
+ const q = E[R].width;
801
+ if (!q) {
802
+ g = 0;
803
+ break;
804
+ }
805
+ g += parseFloat(q.toString());
689
806
  }
690
- e += parseFloat(u.toString());
807
+ g = Math.round(g), j.current && j.current.setWidth(g), V.current && V.current.setWidth(g), M.current && M.current.setWidth(g), A.current && A.current.setWidth(g), F.current && F.current.setWidth(g), L.current && L.current.setWidth(g), U.current && (U.current.style.width = g ? g + "px" : "");
691
808
  }
692
- e = Math.round(e), F.current && F.current.setWidth(e), L.current && L.current.setWidth(e), A.current && (A.current.style.width = e ? e + "px" : "");
693
- }, ze = () => {
809
+ Ie.current && _t();
810
+ }, _t = () => {
811
+ const e = T.current, n = e ? e.scrollWidth > e.clientWidth : !1;
812
+ Ie.current && (Ie.current.style.marginBlockEnd = n ? "var(--kendo-scrollbar-width, 0px)" : "");
813
+ }, Je = () => {
694
814
  var e;
695
- t.gridProps.widthRef && (t.gridProps.widthRef.current = ((e = M.current) == null ? void 0 : e.offsetWidth) || 0);
696
- }, re = () => {
815
+ t.gridProps.widthRef && (t.gridProps.widthRef.current = ((e = H.current) == null ? void 0 : e.offsetWidth) || 0);
816
+ }, ge = () => {
697
817
  var e;
698
- t.gridProps.containerHeightRef && (t.gridProps.containerHeightRef.current = ((e = G.current) == null ? void 0 : e.offsetHeight) || 0);
699
- }, Kt = () => {
818
+ t.gridProps.containerHeightRef && (t.gridProps.containerHeightRef.current = ((e = T.current) == null ? void 0 : e.offsetHeight) || 0);
819
+ }, Zt = () => {
700
820
  const e = t.gridProps.minRowHeightRef;
701
821
  if (e && !e.current && !t.gridProps.rowHeight) {
702
- const n = Cn(j.current);
703
- n && (e.current = n, N());
822
+ const n = _n(G.current);
823
+ n && (e.current = n, J());
704
824
  }
705
- }, oe = d.useCallback(
825
+ }, fe = d.useCallback(
706
826
  (e, n, o, r, i) => {
707
827
  var l;
708
- if (!Mt() && !o || !e)
828
+ if (!Jt() && !o || !e)
709
829
  return;
710
830
  const a = {
711
831
  type: e,
@@ -716,15 +836,15 @@ const Tn = (t, E, h, D) => {
716
836
  field: i,
717
837
  ...typeof t.gridProps.clipboard != "boolean" ? t.gridProps.clipboard : {},
718
838
  ...o
719
- }, c = w(), f = pt({
839
+ }, c = D(), s = kn({
720
840
  event: a,
721
841
  data: c,
722
842
  selectedState: (l = t.gridProps.select) != null ? l : {},
723
- previousCopiedItems: Ve.current
843
+ previousCopiedItems: tt.current
724
844
  });
725
- e !== ke.paste && (Ve.current = f.copiedItems), t.gridProps.onClipboard && E && g(t.gridProps.onClipboard, {
845
+ e !== ze.paste && (tt.current = s.copiedItems), t.gridProps.onClipboard && x && f(t.gridProps.onClipboard, {
726
846
  ...a,
727
- ...f
847
+ ...s
728
848
  });
729
849
  },
730
850
  [
@@ -734,24 +854,24 @@ const Tn = (t, E, h, D) => {
734
854
  t.gridProps.clipboard,
735
855
  t.gridProps.onClipboard
736
856
  ]
737
- ), Mt = () => {
857
+ ), Jt = () => {
738
858
  var i, a, c;
739
- if (!Q)
859
+ if (!ae)
740
860
  return !1;
741
- const e = Jt(K()), n = e ? e.matches(".k-table-td") ? e : (i = K()) == null ? void 0 : i.body : (a = K()) == null ? void 0 : a.body, o = n.closest(".k-grid-container"), r = n && ((c = M.current) == null ? void 0 : c.contains(n));
861
+ const e = wn(z()), n = e ? e.matches(".k-table-td") ? e : (i = z()) == null ? void 0 : i.body : (a = z()) == null ? void 0 : a.body, o = n.closest(".k-grid-container"), r = n && ((c = H.current) == null ? void 0 : c.contains(n));
742
862
  return !!(n && r && o);
743
- }, Oe = (e, n, o, r, i, a, c) => {
744
- he(), ce.current = !0, ve.current = !0, t.gridProps.onColumnResize && E && g(t.gridProps.onColumnResize, {
745
- columns: ee(),
863
+ }, Xe = (e, n, o, r, i, a, c) => {
864
+ Ke(), be.current = !0, Ge.current = !0, t.gridProps.onColumnResize && x && f(t.gridProps.onColumnResize, {
865
+ columns: ce(),
746
866
  nativeEvent: r,
747
867
  targetColumnId: c,
748
868
  index: e,
749
869
  newWidth: n,
750
870
  oldWidth: o,
751
871
  end: i,
752
- target: x.current
753
- }), i && Pe(a);
754
- }, Ht = () => {
872
+ target: S.current
873
+ }), i && De(a);
874
+ }, Xt = () => {
755
875
  var e;
756
876
  return {
757
877
  filter: t.gridProps.filter,
@@ -760,212 +880,237 @@ const Tn = (t, E, h, D) => {
760
880
  take: (e = t.gridProps.take) != null ? e : t.gridProps.pageSize,
761
881
  group: t.gridProps.group
762
882
  };
763
- }, R = (e) => ({
883
+ }, I = (e) => ({
764
884
  nativeEvent: e && e.nativeEvent,
765
885
  syntheticEvent: e,
766
- target: x.current
767
- }), Tt = (e) => ({
886
+ target: S.current
887
+ }), Yt = (e) => ({
768
888
  ...e,
769
889
  nativeEvent: void 0,
770
890
  syntheticEvent: void 0,
771
891
  target: void 0,
772
892
  targetEvent: void 0,
773
893
  focusElement: void 0
774
- }), g = (e, n) => {
894
+ }), f = (e, n) => {
775
895
  if (t.gridProps.isClient) {
776
896
  e(n);
777
897
  return;
778
898
  }
779
- e(Tt(n));
780
- }, Gt = () => {
899
+ e(Yt(n));
900
+ }, Qt = () => {
781
901
  var e, n, o;
782
- if (j.current && ((e = j.current) == null ? void 0 : e.getElementsByClassName("k-grid-edit-row").length) > 0) {
783
- Ie.current = !1, (n = document.activeElement) != null && n.closest(".k-grid-edit-row") ? Ce.current = document.activeElement : Ce.current = void 0;
784
- const r = Array.from((o = j.current) == null ? void 0 : o.getElementsByClassName("k-grid-edit-row"));
785
- r.length > ye.current.length ? de.current = r.filter(
786
- (i) => !ye.current.includes(i)
787
- )[0] : r.length === 1 && (de.current = r[0], Ie.current = !0), ye.current = r;
902
+ if (G.current && ((e = G.current) == null ? void 0 : e.getElementsByClassName("k-grid-edit-row").length) > 0) {
903
+ Me.current = !1, (n = document.activeElement) != null && n.closest(".k-grid-edit-row") ? He.current = document.activeElement : He.current = void 0;
904
+ const r = Array.from((o = G.current) == null ? void 0 : o.getElementsByClassName("k-grid-edit-row"));
905
+ r.length > Be.current.length ? Re.current = r.filter(
906
+ (i) => !Be.current.includes(i)
907
+ )[0] : r.length === 1 && (Re.current = r[0], Me.current = !0), Be.current = r;
788
908
  }
789
- }, w = () => t.dataRef.filter((e) => e.rowType === "data").map((e) => e.dataItem), K = () => {
909
+ }, D = () => t.dataRef.filter((e) => e.rowType === "data").map((e) => e.dataItem), z = () => {
790
910
  var e;
791
- if (Q)
792
- return ((e = ie()) == null ? void 0 : e.ownerDocument) || document;
793
- }, ie = () => M.current, Re = d.useCallback(
911
+ if (ae)
912
+ return ((e = me()) == null ? void 0 : e.ownerDocument) || document;
913
+ }, me = () => H.current, Pe = d.useCallback(
794
914
  (e) => {
795
915
  var r, i;
796
- if (!v.current || !((r = v.current) != null && r.container) || t.gridProps.scrollable === "none")
916
+ if (!C.current || !((r = C.current) != null && r.container) || t.gridProps.scrollable === "none")
797
917
  return;
798
- U.current && U.current.disconnect();
799
- const { rowIndex: n } = e, o = ie();
800
- if (S) {
801
- const a = ((i = v.current.rowHeightService) == null ? void 0 : i.offset(n)) || 0;
802
- v.current.container.scroll(0, a);
918
+ Y.current && Y.current.disconnect();
919
+ const { rowIndex: n } = e, o = me();
920
+ if (K) {
921
+ const a = ((i = C.current.rowHeightService) == null ? void 0 : i.offset(n)) || 0;
922
+ C.current.container.scroll(0, a);
803
923
  } else if (o) {
804
924
  const a = n < 1 ? o.querySelector("tbody > tr:nth-child(1)") : o.querySelector(`tbody > tr:nth-child(${n + 1})`);
805
- a && G.current && (G.current.scrollTop = a.offsetTop);
925
+ a && T.current && (T.current.scrollTop = a.offsetTop);
806
926
  }
807
927
  },
808
928
  [t.gridProps.scrollable]
809
- ), We = (e) => JSON.stringify(e.map((n) => ({ id: n.id, field: n.field, title: n.title, children: n.children }))), At = () => We(Vt) === We(t.columnsRef), Lt = () => {
810
- le.current = window.innerWidth, At() || N();
811
- }, Ft = () => {
929
+ ), Ye = (e) => JSON.stringify(e.map((n) => ({ id: n.id, field: n.field, title: n.title, children: n.children }))), en = () => Ye(bn) === Ye(t.columnsRef), tn = () => {
930
+ ve.current = window.innerWidth, en() || J();
931
+ }, nn = () => {
812
932
  var a;
813
- const { virtualTotal: e, virtualPageSize: n, gridProps: o } = t, r = v.current, i = t.gridProps.rowHeight || ((a = o.minRowHeightRef) == null ? void 0 : a.current) || 0;
814
- r && (r.fixedScroll = o.fixedScroll || !1, r.PageChange = Rt, r.pageSize = n, r.scrollableVirtual = S, r.container = G.current, r.tableBody = j.current, r.scrollHeightContainer = Ne.current, r.table = A.current, (!r.rowHeightService || r.total !== e) && i && (r.total = e, r.rowHeightService = new Qt(e, i)));
815
- }, Be = d.useCallback(
933
+ const { virtualTotal: e, virtualPageSize: n, gridProps: o } = t, r = C.current, i = t.gridProps.rowHeight || ((a = o.minRowHeightRef) == null ? void 0 : a.current) || 0;
934
+ r && (r.fixedScroll = o.fixedScroll || !1, r.PageChange = Lt, r.pageSize = n, r.scrollableVirtual = K, r.container = T.current, r.tableBody = G.current, r.scrollHeightContainer = et.current, r.table = U.current, (!r.rowHeightService || r.total !== e) && i && (r.total = e, r.rowHeightService = new xn(e, i)));
935
+ }, Qe = d.useCallback(
816
936
  (e) => {
817
- const n = { rowIndex: xe.current };
937
+ const n = { rowIndex: Le.current };
818
938
  e.forEach((o) => {
819
- o.boundingClientRect.height !== o.intersectionRect.height && Re(n);
939
+ o.boundingClientRect.height !== o.intersectionRect.height && Pe(n);
820
940
  });
821
941
  },
822
- [Re]
823
- ), N = () => {
942
+ [Pe]
943
+ ), J = () => {
824
944
  t.gridProps.forceUpdate && t.gridProps.forceUpdate();
825
- }, zt = (e) => e.left !== void 0 ? Se !== "rtl" ? { left: e.left, right: e.right } : { left: e.right, right: e.left } : {}, x = d.useRef(null), v = d.useRef(void 0), I = d.useRef(void 0), H = d.useRef(void 0), T = d.useRef(void 0), V = d.useRef(void 0), ae = d.useRef(void 0), U = d.useRef(null), j = d.useRef(null), Ot = d.useRef(null), G = d.useRef(null), A = d.useRef(null), Wt = d.useRef(null), M = d.useRef(null), Ne = d.useRef(null), L = d.useRef(null), F = d.useRef(null), ve = d.useRef(!1), be = d.useRef(!1), de = d.useRef(void 0), Ce = d.useRef(void 0), Ie = d.useRef(!1), ce = d.useRef(!0), Ee = d.useRef(0), we = d.useRef(void 0), xe = d.useRef(void 0), ye = d.useRef([]), Ve = d.useRef([]), le = d.useRef(0), X = d.useRef(null), Bt = d.useRef(null), Nt = d.useRef(null), Se = Xt(M), S = t.isVirtualScroll, Vt = d.useMemo(() => d.Children.toArray(t.gridProps.children), [t.gridProps.children]), Ue = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, P = se(t.gridProps.selectable), je = en(t.gridProps.editable), Ut = le.current && _ && le.current <= _.medium && t.gridProps.adaptive;
945
+ }, rn = (e) => e.left !== void 0 ? We !== "rtl" ? { left: e.left, right: e.right } : { left: e.right, right: e.left } : {}, S = d.useRef(null), C = d.useRef(void 0), P = d.useRef(void 0), p = d.useRef(void 0), N = d.useRef(void 0), X = d.useRef(void 0), he = d.useRef(void 0), Y = d.useRef(null), G = d.useRef(null), on = d.useRef(null), T = d.useRef(null), U = d.useRef(null), an = d.useRef(null), H = d.useRef(null), et = d.useRef(null), V = d.useRef(null), j = d.useRef(null), M = d.useRef(null), A = d.useRef(null), F = d.useRef(null), L = d.useRef(null), dn = d.useRef(null), cn = d.useRef(null), Ge = d.useRef(!1), Te = d.useRef(!1), Re = d.useRef(void 0), He = d.useRef(void 0), Me = d.useRef(!1), be = d.useRef(!0), Ae = d.useRef(0), Fe = d.useRef(void 0), Le = d.useRef(void 0), Be = d.useRef([]), tt = d.useRef([]), ve = d.useRef(0), Ce = d.useRef(
946
+ null
947
+ ), ln = typeof t.gridProps.groupable == "object" && !!t.gridProps.groupable.stickyHeaders, sn = typeof t.gridProps.groupable == "object" && !!t.gridProps.groupable.stickyFooters, un = !!((it = t.gridProps.group) != null && it.length), {
948
+ stickyHeaderItems: gn,
949
+ stickyHeaderRef: fn,
950
+ stickyFooterItems: mn,
951
+ stickyFooterRef: Ie,
952
+ scrollToStickyGroup: Pn,
953
+ update: nt
954
+ } = Vn({
955
+ enabled: ln,
956
+ enabledFooters: sn,
957
+ flatData: t.dataRef,
958
+ containerRef: T,
959
+ tableBodyRef: G,
960
+ rowHeight: t.gridProps.rowHeight,
961
+ isGrouped: un,
962
+ virtualSkipRef: t.gridProps.virtualSkipRef,
963
+ rowHeightServiceRef: {
964
+ get current() {
965
+ var e;
966
+ return (e = C.current) == null ? void 0 : e.rowHeightService;
967
+ }
968
+ }
969
+ }), ie = d.useRef(null), hn = d.useRef(null), Rn = d.useRef(null), We = yn(H), K = t.isVirtualScroll, bn = d.useMemo(() => d.Children.toArray(t.gridProps.children), [t.gridProps.children]), rt = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, v = we(t.gridProps.selectable), ot = Dn(t.gridProps.editable), vn = ve.current && ne && ve.current <= ne.medium && t.gridProps.adaptive;
826
970
  return d.useMemo(() => {
827
- q.onConstructor({
971
+ te.onConstructor({
828
972
  navigatable: !!t.gridProps.navigatable,
829
- contextStateRef: T,
830
- navigationStateRef: V,
973
+ contextStateRef: N,
974
+ navigationStateRef: X,
831
975
  idPrefix: t.id
832
- }), v.current = new xn();
976
+ }), C.current = new Yn();
833
977
  }, []), d.useMemo(() => {
834
978
  var e;
835
- (e = v.current) == null || e.reset();
979
+ (e = C.current) == null || e.reset();
836
980
  }, [
837
981
  t.gridProps.scrollable,
838
982
  t.gridProps.total,
839
983
  t.gridProps.filter,
840
984
  t.gridProps.group,
841
- Ue,
985
+ rt,
842
986
  t.gridProps.sort,
843
987
  t.gridProps.rowHeight
844
- ]), d.useEffect(() => (t.gridProps.clipboard && (ae.current = new tn(oe), ae.current.addEventListeners(K())), () => {
845
- ae.current && ae.current.removeEventListeners(K());
846
- }), [t.gridProps.onClipboard, t.gridProps.clipboard, oe, K]), d.useEffect(() => (ze(), he(), qe(), q.onComponentDidMount({
847
- scope: M.current || void 0,
848
- contextStateRef: T,
849
- navigationStateRef: V
988
+ ]), d.useEffect(() => (t.gridProps.clipboard && (he.current = new Kn(fe), he.current.addEventListeners(z())), () => {
989
+ he.current && he.current.removeEventListeners(z());
990
+ }), [t.gridProps.onClipboard, t.gridProps.clipboard, fe, z]), d.useEffect(() => (Je(), Ke(), at(), te.onComponentDidMount({
991
+ scope: H.current || void 0,
992
+ contextStateRef: N,
993
+ navigationStateRef: X
850
994
  }), () => {
851
- clearTimeout(we.current);
995
+ clearTimeout(Fe.current);
852
996
  }), []), d.useEffect(() => {
853
997
  var e;
854
- ze(), he(), qe(), S && (re(), Kt(), (e = v.current) == null || e.update()), Gt(), q.onComponentDidUpdate({
855
- scope: M.current || void 0,
856
- contextStateRef: T,
857
- navigationStateRef: V,
858
- focusFirst: be.current,
859
- newEditableRow: de.current,
860
- singleEditRow: Ie.current,
861
- lastActiveElement: Ce.current,
998
+ Je(), Ke(), at(), K && (ge(), Zt(), (e = C.current) == null || e.update()), nt(), Qt(), te.onComponentDidUpdate({
999
+ scope: H.current || void 0,
1000
+ contextStateRef: N,
1001
+ navigationStateRef: X,
1002
+ focusFirst: Te.current,
1003
+ newEditableRow: Re.current,
1004
+ singleEditRow: Me.current,
1005
+ lastActiveElement: He.current,
862
1006
  navigatable: t.gridProps.navigatable
863
- }), be.current = !1, de.current = void 0;
1007
+ }), Pt(), Te.current = !1, Re.current = void 0, Ce.current = void 0;
864
1008
  }), d.useEffect(() => {
865
- if (Q) {
1009
+ if (ae) {
866
1010
  const e = {
867
1011
  rootMargin: "0px",
868
1012
  threshold: 0.9
869
1013
  };
870
- U.current = window.IntersectionObserver && new window.IntersectionObserver(Be, e) || null;
1014
+ Y.current = window.IntersectionObserver && new window.IntersectionObserver(Qe, e) || null;
871
1015
  }
872
- }, [Be]), d.useEffect(() => {
1016
+ }, [Qe]), d.useEffect(() => {
873
1017
  var n;
874
1018
  let e;
875
- return Q && window.ResizeObserver && (e = new window.ResizeObserver(() => {
876
- Lt(), S && re();
877
- }), e.observe((n = K()) == null ? void 0 : n.body)), () => {
1019
+ return ae && window.ResizeObserver && (e = new window.ResizeObserver(() => {
1020
+ tn(), K && ge();
1021
+ }), e.observe((n = z()) == null ? void 0 : n.body)), () => {
878
1022
  e == null || e.disconnect();
879
1023
  };
880
1024
  }, []), d.useEffect(() => {
881
- if (!Q || !window.ResizeObserver || !S || !G.current)
1025
+ if (!ae || !window.ResizeObserver || !K || !T.current)
882
1026
  return;
883
1027
  const e = () => {
884
1028
  var i, a;
885
1029
  const o = ((i = t.gridProps.containerHeightRef) == null ? void 0 : i.current) || 0;
886
- re();
1030
+ ge();
887
1031
  const r = ((a = t.gridProps.containerHeightRef) == null ? void 0 : a.current) || 0;
888
- (o === 0 && r > 0 || Math.abs(r - o) > 10) && N();
1032
+ (o === 0 && r > 0 || Math.abs(r - o) > 10) && J();
889
1033
  }, n = new window.ResizeObserver(e);
890
- return n.observe(G.current), () => {
1034
+ return n.observe(T.current), () => {
891
1035
  n.disconnect();
892
1036
  };
893
- }, [S, re]), d.useImperativeHandle(
894
- x,
1037
+ }, [K, ge]), d.useImperativeHandle(
1038
+ S,
895
1039
  () => ({
896
1040
  get element() {
897
- return ie();
1041
+ return me();
898
1042
  },
899
1043
  props: t.gridProps,
900
1044
  get columns() {
901
- return ee();
1045
+ return ce();
902
1046
  },
903
1047
  scrollIntoView: (e) => {
904
1048
  var r;
905
- if (!((r = v.current) != null && r.container) || t.gridProps.scrollable === "none")
1049
+ if (!((r = C.current) != null && r.container) || t.gridProps.scrollable === "none")
906
1050
  return;
907
1051
  const { rowIndex: n } = e;
908
- xe.current = n;
909
- const o = ie();
910
- if (U.current && o) {
911
- U.current.disconnect();
912
- const i = o.querySelector(`[absolute-row-index="${xe.current}"]`);
913
- i ? U.current.observe(i) : Re(e);
1052
+ Le.current = n;
1053
+ const o = me();
1054
+ if (Y.current && o) {
1055
+ Y.current.disconnect();
1056
+ const i = o.querySelector(`[absolute-row-index="${Le.current}"]`);
1057
+ i ? Y.current.observe(i) : Pe(e);
914
1058
  }
915
1059
  },
916
1060
  fitColumns: (e) => {
917
- I.current.dblClickHandler(null, e);
1061
+ P.current.dblClickHandler(null, e);
918
1062
  },
919
- exportAsPdf: fe,
920
- saveAsCsv: Ae,
921
- getCsvBlob: Le,
922
- getTotal: ge,
923
- getLeafDataItems: w
1063
+ exportAsPdf: Se,
1064
+ saveAsCsv: $e,
1065
+ getCsvBlob: _e,
1066
+ getTotal: xe,
1067
+ getLeafDataItems: D
924
1068
  })
925
- ), d.useImperativeHandle(t.gridRef, () => x.current), d.useMemo(() => {
926
- I.current = new Pn(Oe);
1069
+ ), d.useImperativeHandle(t.gridRef, () => S.current), d.useMemo(() => {
1070
+ P.current = new Nn(Xe);
927
1071
  }, [t.gridProps.onColumnResize, t.columnsRef]), d.useMemo(() => {
928
- H.current = new hn(ne, kt, Fe);
1072
+ p.current = new Un(ue, qt, Ze);
929
1073
  }, [
930
1074
  t.gridProps.onColumnReorder,
931
1075
  t.gridProps.onGroupChange,
932
1076
  t.gridProps.group,
933
1077
  t.columnsRef,
934
1078
  t.gridProps.groupable
935
- ]), I.current.resizable = t.gridProps.resizable || !1, I.current.columns = t.columnsRef, I.current.columnsState = Yt(t.columnsState), H.current.reorderable = t.gridProps.reorderable || !1, H.current.groupable = Ue, H.current.columns = t.columnsRef, H.current.dir = Se, Ft(), /* @__PURE__ */ d.createElement(
936
- Mn.Provider,
1079
+ ]), P.current.resizable = t.gridProps.resizable || !1, P.current.columns = t.columnsRef, P.current.columnsState = En(t.columnsState), p.current.reorderable = t.gridProps.reorderable || !1, p.current.groupable = rt, p.current.columns = t.columnsRef, p.current.dir = We, nn(), /* @__PURE__ */ d.createElement(
1080
+ ir.Provider,
937
1081
  {
938
1082
  value: {
939
- isClient: E,
940
- rowReorder: J,
941
- activeDragRowDataItemRef: X,
942
- reorderRowDragTargetRef: Bt,
943
- reorderRowDropTargetRef: Nt,
944
- dir: Se,
945
- getCellPositionStyle: zt,
1083
+ isClient: x,
1084
+ rowReorder: oe,
1085
+ activeDragRowDataItemRef: ie,
1086
+ reorderRowDragTargetRef: hn,
1087
+ reorderRowDropTargetRef: Rn,
1088
+ dir: We,
1089
+ getCellPositionStyle: rn,
946
1090
  dataItemKey: t.gridProps.dataItemKey,
947
1091
  columnsState: t.columnsState,
948
1092
  columnsRef: t.columnsRef,
949
1093
  hiddenColumnsRef: t.hiddenColumnsRef,
950
- onColumnsStateChange: Pe,
1094
+ onColumnsStateChange: De,
951
1095
  groupable: t.gridProps.groupable,
952
1096
  group: t.gridProps.group,
953
1097
  reorderable: t.gridProps.reorderable,
954
1098
  defaultGroup: t.gridProps.defaultGroup,
955
- groupChange: me,
956
- selectionRelease: gt,
957
- pagerPageChange: It,
958
- onContextMenu: Ye,
959
- rowClick: tt,
960
- rowDblClick: nt,
961
- cellClick: it,
962
- headerCellClick: He,
963
- itemChange: ct,
964
- onDialogEditCancel: ot,
965
- onDialogEditSubmit: rt,
966
- columnReorder: ne,
967
- onResize: Oe,
968
- getTotal: ge,
1099
+ groupChange: ke,
1100
+ selectionRelease: Ve,
1101
+ pinnedSelectionRelease: Tt,
1102
+ pagerPageChange: Ot,
1103
+ onContextMenu: gt,
1104
+ rowClick: vt,
1105
+ rowDblClick: Ct,
1106
+ cellClick: yt,
1107
+ headerCellClick: Ue,
1108
+ itemChange: kt,
1109
+ onDialogEditCancel: wt,
1110
+ onDialogEditSubmit: It,
1111
+ columnReorder: ue,
1112
+ onResize: Xe,
1113
+ getTotal: xe,
969
1114
  sortable: t.gridProps.sortable,
970
1115
  pageable: t.gridProps.pageable,
971
1116
  pageSize: t.gridProps.pageSize,
@@ -973,83 +1118,95 @@ const Tn = (t, E, h, D) => {
973
1118
  skip: t.gridProps.skip,
974
1119
  take: t.gridProps.take,
975
1120
  defaultSort: t.gridProps.defaultSort,
976
- sortChange: Te,
1121
+ sortChange: je,
977
1122
  filterable: t.gridProps.filterable,
978
1123
  filter: t.gridProps.filter,
979
1124
  defaultFilter: t.gridProps.defaultFilter,
980
- filterOperators: t.gridProps.filterOperators || Hn,
981
- getLeafDataItems: w,
982
- filterChange: Et,
983
- applyHighlightDescriptor: wt,
984
- applySelectionDescriptor: Pt,
1125
+ filterOperators: t.gridProps.filterOperators || ar,
1126
+ getLeafDataItems: D,
1127
+ filterChange: pt,
1128
+ applyHighlightDescriptor: Nt,
1129
+ applySelectionDescriptor: At,
985
1130
  highlight: t.gridProps.highlight,
986
1131
  select: t.gridProps.select,
987
- searchChange: xt,
988
- exportAsPdf: fe,
989
- exportAsCsv: Ae,
990
- getCsvBlob: Le,
991
- onHeaderSelectionChange: ut,
992
- columnGroupChange: Dt,
993
- onKeyDown: Ze,
994
- onFocus: pe,
995
- scrollHandler: Qe,
996
- selectionChange: lt,
997
- mobileMode: Ut,
998
- adaptiveColumnMenuRef: le.current,
1132
+ searchChange: Ut,
1133
+ exportAsPdf: Se,
1134
+ exportAsCsv: $e,
1135
+ getCsvBlob: _e,
1136
+ onHeaderSelectionChange: Gt,
1137
+ columnGroupChange: $t,
1138
+ onKeyDown: ht,
1139
+ onFocus: Rt,
1140
+ scrollHandler: ft,
1141
+ selectionChange: Dt,
1142
+ mobileMode: vn,
1143
+ adaptiveColumnMenuRef: ve.current,
999
1144
  adpativeTitle: t.gridProps.adaptiveTitle,
1000
1145
  adaptive: t.gridProps.adaptive,
1001
- dispatchDetailExpand: at,
1002
- dispatchGroupExpand: dt,
1003
- columnResizeRef: I,
1004
- dragLogicRef: H,
1005
- navigationStateRef: V,
1006
- tableElementRef: A,
1007
- tableBodyElementRef: j,
1008
- headerElementRef: Ot,
1009
- containerElementRef: G,
1010
- headTableElementRef: Wt,
1011
- elementRef: M,
1012
- virtualScrollHeightContainerRef: Ne,
1013
- footerRef: L,
1014
- headerRef: F,
1015
- vsRef: v
1146
+ dispatchDetailExpand: Et,
1147
+ dispatchGroupExpand: xt,
1148
+ columnResizeRef: P,
1149
+ dragLogicRef: p,
1150
+ navigationStateRef: X,
1151
+ tableElementRef: U,
1152
+ tableBodyElementRef: G,
1153
+ headerElementRef: on,
1154
+ containerElementRef: T,
1155
+ headTableElementRef: an,
1156
+ elementRef: H,
1157
+ virtualScrollHeightContainerRef: et,
1158
+ footerRef: V,
1159
+ headerRef: j,
1160
+ vsRef: C,
1161
+ stickyHeaderItems: gn,
1162
+ stickyHeaderRef: fn,
1163
+ stickyFooterItems: mn,
1164
+ stickyFooterRef: Ie,
1165
+ stickyHeaderTableRef: M,
1166
+ stickyFooterTableRef: A,
1167
+ pinnedTopTableRef: F,
1168
+ pinnedBottomTableRef: L,
1169
+ pinnedTopRef: dn,
1170
+ pinnedBottomRef: cn,
1171
+ onRowPin: le,
1172
+ getRowPinPosition: St
1016
1173
  }
1017
1174
  },
1018
- /* @__PURE__ */ d.createElement(nn.Provider, { value: T.current }, t.children),
1175
+ /* @__PURE__ */ d.createElement(Gn.Provider, { value: N.current }, t.children),
1019
1176
  /* @__PURE__ */ d.createElement(
1020
- yn,
1177
+ Qn,
1021
1178
  {
1022
- show: h.show && (p == null ? void 0 : p.length),
1023
- dataItem: h.dataItem,
1024
- field: h.field,
1025
- items: p,
1026
- offset: h.offset,
1027
- onClose: De,
1028
- onSelect: Xe
1179
+ show: b.show && (de == null ? void 0 : de.length),
1180
+ dataItem: b.dataItem,
1181
+ field: b.field,
1182
+ items: de,
1183
+ offset: b.offset,
1184
+ onClose: Oe,
1185
+ onSelect: ut
1029
1186
  }
1030
1187
  ),
1031
1188
  t.gridProps.pdf && /* @__PURE__ */ d.createElement(
1032
- Dn,
1189
+ rr,
1033
1190
  {
1034
1191
  gridProps: t.gridProps,
1035
1192
  innerGrid: t.innerGrid,
1036
1193
  pdf: typeof t.gridProps.pdf == "object" ? t.gridProps.pdf : {},
1037
- onPdfExport: yt,
1038
- ref: (e) => O.current = e
1194
+ onPdfExport: Vt,
1195
+ ref: (e) => $.current = e
1039
1196
  }
1040
1197
  ),
1041
1198
  t.gridProps.csv && /* @__PURE__ */ d.createElement(
1042
- Kn,
1199
+ or,
1043
1200
  {
1044
1201
  gridProps: t.gridProps,
1045
1202
  csv: typeof t.gridProps.csv == "object" ? t.gridProps.csv : {},
1046
- onCsvExport: St,
1203
+ onCsvExport: jt,
1047
1204
  columnsState: t.columnsState,
1048
- ref: (e) => y.current = e
1205
+ ref: (e) => k.current = e
1049
1206
  }
1050
1207
  )
1051
1208
  );
1052
1209
  };
1053
1210
  export {
1054
- Jn as GridClientWrapper
1211
+ yr as GridClientWrapper
1055
1212
  };