@progress/kendo-react-grid 9.4.0-develop.20 → 9.4.0-develop.22

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