@progress/kendo-react-grid 9.4.0-develop.3 → 9.4.0-develop.5

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.
@@ -6,9 +6,9 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as a from "react";
9
+ import * as i from "react";
10
10
  import { useDir as yt, setScrollbarWidth as ke, canUseDOM as q, getter as X, getActiveElement as St, getScrollbarWidth as kt, RowHeightService as De } from "@progress/kendo-react-common";
11
- import { getSelectionOptions as $, getEditableOptions as Dt, tableKeyboardNavigation as M, ClipboardService as Kt, TableKeyboardNavigationContext as Mt, getSelectedStateFromKeyDown as Tt, closestTagName as Ke, getColumnIndex as At, getRowIndex as Ht, editReducer as Ft, EDIT_ACTION as Gt, getDetailExpandableOptions as Lt, detailExpandReducer as Me, getGroupExpandableOptions as zt, groupExpandReducer as Nt, DETAIL_EXPAND_ACTION as Ot, getSelectedState as Te, updateLeft as Bt, updateRight as Ut } from "@progress/kendo-react-data-tools";
11
+ import { getSelectionOptions as $, getEditableOptions as Dt, tableKeyboardNavigation as M, ClipboardService as Kt, TableKeyboardNavigationContext as Mt, getSelectedStateFromKeyDown as Tt, closestTagName as Ke, getColumnIndex as At, getRowIndex as Ht, editReducer as Ft, EDIT_ACTION as Gt, getDetailExpandableOptions as zt, detailExpandReducer as Me, getGroupExpandableOptions as Lt, groupExpandReducer as Nt, DETAIL_EXPAND_ACTION as Ot, getSelectedState as Te, updateLeft as Bt, updateRight as Ut } from "@progress/kendo-react-data-tools";
12
12
  import { ColumnResize as Vt } from "./drag/ColumnResize.mjs";
13
13
  import { CommonDragLogic as Wt } from "./drag/CommonDragLogic.mjs";
14
14
  import { SAFARI_REGEX as _t } from "./constants/index.mjs";
@@ -18,11 +18,11 @@ import { VirtualScroll as $t } from "./VirtualScroll.mjs";
18
18
  import { GridContextMenu as Jt } from "./contextMenu/GridContextMenu.mjs";
19
19
  import { GridContextMenuAnchorPart as Ge } from "./contextMenu/enums.mjs";
20
20
  import { normalize as Yt, firstLevelSortSeqMap as Qt } from "./interfaces/GridSortSettings.mjs";
21
- const Zt = a.createContext(void 0), sr = (t) => {
21
+ const Zt = i.createContext(void 0), sr = (t) => {
22
22
  var ye, Se;
23
- const E = t.gridProps.isClient, [P, fe] = a.useState({}), Le = (e) => {
23
+ const E = t.gridProps.isClient, [h, fe] = i.useState({}), ze = (e) => {
24
24
  e.event.preventDefault(), fe({
25
- ...P,
25
+ ...h,
26
26
  show: !0,
27
27
  offset: {
28
28
  left: e.event.pageX,
@@ -33,37 +33,37 @@ const Zt = a.createContext(void 0), sr = (t) => {
33
33
  });
34
34
  }, me = () => {
35
35
  fe({});
36
- }, f = a.useMemo(() => t.columnsRef.current.find((e) => e.field === P.field), [t.columnsRef, P]), Pe = a.useMemo(() => {
37
- const e = t.gridProps.sortable && (f == null ? void 0 : f.sortable);
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
38
  return jt({
39
39
  sortable: !!e,
40
40
  selectable: $(t.gridProps.selectable).enabled,
41
41
  clipboard: !!t.gridProps.clipboard
42
42
  });
43
- }, [f, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), he = a.useMemo(() => {
44
- const e = t.gridProps.sortable && (f == null ? void 0 : f.sortable);
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
45
  return qt({
46
46
  sortable: !!e,
47
47
  selectable: $(t.gridProps.selectable).enabled,
48
48
  clipboard: !!t.gridProps.clipboard
49
49
  });
50
- }, [f, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), ze = a.useMemo(() => {
51
- const e = (f == null ? void 0 : f.contextMenu) || t.gridProps.contextMenu, r = typeof e == "function" ? e(P) : e;
52
- if (r && P.offset) {
53
- const n = P.dataItem ? Ge.body : Ge.head, o = r[n];
54
- return o === !1 ? void 0 : o === !0 || o === void 0 ? P.dataItem ? he : Pe : o;
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];
54
+ return o === !1 ? void 0 : o === !0 || o === void 0 ? h.dataItem ? he : Pe : o;
55
55
  }
56
- }, [t.gridProps.contextMenu, P, he, Pe, f]), Ne = (e) => {
56
+ }, [t.gridProps.contextMenu, h, he, Pe, m]), Ne = (e) => {
57
57
  var c;
58
58
  const r = e.event.item, n = {
59
- target: I.current,
59
+ target: R.current,
60
60
  syntheticEvent: e.event.syntheticEvent,
61
61
  nativeEvent: e.event.nativeEvent,
62
62
  menuItem: r,
63
63
  ...e
64
64
  };
65
65
  t.gridProps.onContextMenuItemClick && s(t.gridProps.onContextMenuItemClick, n);
66
- const o = Z(), i = {
66
+ const o = Z(), a = {
67
67
  selectedField: t.gridProps.selectedField || "",
68
68
  componentId: t.id,
69
69
  dataItems: o,
@@ -82,19 +82,19 @@ const Zt = a.createContext(void 0), sr = (t) => {
82
82
  };
83
83
  switch ((c = r.data) == null ? void 0 : c.action) {
84
84
  case "SortCommand":
85
- if (f) {
85
+ if (m) {
86
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, f, l);
87
+ be(e.event.syntheticEvent, m, l);
88
88
  }
89
89
  break;
90
90
  case "SelectRowCommand":
91
- et(i);
91
+ et(a);
92
92
  break;
93
93
  case "SelectAllRowsCommand":
94
- pe(i);
94
+ pe(a);
95
95
  break;
96
96
  case "ClearSelectionCommand":
97
- tt(i);
97
+ tt(a);
98
98
  break;
99
99
  }
100
100
  me();
@@ -104,7 +104,7 @@ const Zt = a.createContext(void 0), sr = (t) => {
104
104
  }, Oe = (e, r, n) => {
105
105
  if (t.gridProps.onContextMenu && E) {
106
106
  const o = {
107
- target: I.current,
107
+ target: R.current,
108
108
  syntheticEvent: e,
109
109
  nativeEvent: e.nativeEvent,
110
110
  dataItem: r,
@@ -112,7 +112,7 @@ const Zt = a.createContext(void 0), sr = (t) => {
112
112
  };
113
113
  s(t.gridProps.onContextMenu, o);
114
114
  }
115
- t.gridProps.contextMenu && Le({
115
+ t.gridProps.contextMenu && ze({
116
116
  event: e,
117
117
  dataItem: r,
118
118
  field: n
@@ -125,10 +125,10 @@ const Zt = a.createContext(void 0), sr = (t) => {
125
125
  t.gridProps.columnVirtualization && (!o || n === ce.current) && (le.current = window.setTimeout(() => {
126
126
  te();
127
127
  }, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = r), H.current && H.current.setScrollLeft(r), A.current && A.current.setScrollLeft(r), d.current && n !== ce.current && d.current.scrollHandler(e), t.gridProps.onScroll && E && s(t.gridProps.onScroll, {
128
- ...m(e)
128
+ ...P(e)
129
129
  }), ce.current = n;
130
130
  }, Ue = (e) => {
131
- var n, o, i, c;
131
+ var n, o, a, c;
132
132
  M.onKeyDown(e, {
133
133
  navigatable: t.gridProps.navigatable || !1,
134
134
  contextStateRef: w,
@@ -142,13 +142,13 @@ const Zt = a.createContext(void 0), sr = (t) => {
142
142
  });
143
143
  const r = {
144
144
  dataItems: O(),
145
- mode: h.mode,
146
- cell: h.cell,
145
+ mode: b.mode,
146
+ cell: b.cell,
147
147
  componentId: t.id,
148
148
  selectedField: t.gridProps.selectedField,
149
- ...m(e)
149
+ ...P(e)
150
150
  };
151
- if (t.gridProps.onKeyDown && E && s(t.gridProps.onKeyDown, r), !t.gridProps.selectedField && h.enabled && t.gridProps.dataItemKey) {
151
+ if (t.gridProps.onKeyDown && E && s(t.gridProps.onKeyDown, r), !t.gridProps.selectedField && b.enabled && t.gridProps.dataItemKey) {
152
152
  const l = Tt({
153
153
  event: r,
154
154
  selectedState: (n = t.gridProps.select) != null ? n : {},
@@ -156,9 +156,9 @@ const Zt = a.createContext(void 0), sr = (t) => {
156
156
  });
157
157
  if (l === t.gridProps.select)
158
158
  return;
159
- const b = e.target, R = Ke(b, "TD"), g = Ke(b, "TR"), y = At(R), F = Ht(g);
159
+ const f = e.target, I = Ke(f, "TD"), g = Ke(f, "TR"), y = At(I), F = Ht(g);
160
160
  if (y !== void 0 && F !== void 0) {
161
- const ge = Array.isArray(t.gridProps.data) ? (o = t.gridProps.data) == null ? void 0 : o[F] : (c = (i = t.gridProps.data) == null ? void 0 : i.data) == null ? void 0 : c[F];
161
+ const ge = Array.isArray(t.gridProps.data) ? (o = t.gridProps.data) == null ? void 0 : o[F] : (c = (a = t.gridProps.data) == null ? void 0 : a.data) == null ? void 0 : c[F];
162
162
  t.gridProps.onSelectionChange && s(t.gridProps.onSelectionChange, {
163
163
  ...r,
164
164
  select: l,
@@ -194,19 +194,19 @@ const Zt = a.createContext(void 0), sr = (t) => {
194
194
  if (t.gridProps.onNavigationAction && E) {
195
195
  const r = {
196
196
  focusElement: e.focusElement,
197
- ...m(e.event)
197
+ ...P(e.event)
198
198
  };
199
199
  s(t.gridProps.onNavigationAction, r);
200
200
  }
201
201
  }, _e = (e, r) => {
202
202
  t.gridProps.onRowClick && e.target.nodeName === "TD" && s(t.gridProps.onRowClick, {
203
203
  dataItem: r,
204
- ...m(e)
204
+ ...P(e)
205
205
  });
206
206
  }, je = (e, r) => {
207
207
  t.gridProps.onRowDoubleClick && e.target.nodeName === "TD" && s(t.gridProps.onRowDoubleClick, {
208
208
  dataItem: r,
209
- ...m(e)
209
+ ...P(e)
210
210
  });
211
211
  }, qe = (e, r, n) => {
212
212
  if (we.enabled && we.mode === "incell" && t.gridProps.dataItemKey) {
@@ -216,33 +216,33 @@ const Zt = a.createContext(void 0), sr = (t) => {
216
216
  });
217
217
  t.gridProps.onEditChange && s(t.gridProps.onEditChange, {
218
218
  edit: o,
219
- ...m(e)
219
+ ...P(e)
220
220
  });
221
221
  }
222
222
  }, Xe = (e, r) => {
223
223
  var o;
224
- if (Lt(t.detailExpandable).enabled) {
225
- const i = Me((o = t.gridProps.detailExpand) != null ? o : {}, e);
224
+ if (zt(t.detailExpandable).enabled) {
225
+ const a = Me((o = t.gridProps.detailExpand) != null ? o : {}, e);
226
226
  t.gridProps.onDetailExpandChange && s(t.gridProps.onDetailExpandChange, {
227
- ...m(r),
228
- detailExpand: i
227
+ ...P(r),
228
+ detailExpand: a
229
229
  });
230
230
  }
231
231
  }, $e = (e, r) => {
232
232
  var o;
233
- const n = zt(
233
+ const n = Lt(
234
234
  typeof t.gridProps.groupable == "object" ? t.gridProps.groupable.expandable !== !1 : t.gridProps.groupable
235
235
  );
236
236
  if (n.enabled) {
237
- const i = Nt((o = t.gridProps.groupExpand) != null ? o : [], e, n);
237
+ const a = Nt((o = t.gridProps.groupExpand) != null ? o : [], e, n);
238
238
  t.gridProps.onGroupExpandChange && s(t.gridProps.onGroupExpandChange, {
239
- ...m(r),
240
- groupExpand: i
239
+ ...P(r),
240
+ groupExpand: a
241
241
  });
242
242
  }
243
243
  }, be = (e, r, n) => {
244
- const { allowUnsort: o, mode: i } = Yt(t.gridProps.sortable || !1, r.sortable || !1), c = (t.gridProps.sort || []).filter((R) => R.field === r.field)[0], l = n || Qt[o][c && c.dir || ""], b = i === "single" ? [] : (t.gridProps.sort || []).filter((R) => R.field !== r.field);
245
- l !== "" && r.field && b.push({ field: r.field, dir: l }), Ie(b, e);
244
+ const { allowUnsort: o, mode: a } = Yt(t.gridProps.sortable || !1, r.sortable || !1), c = (t.gridProps.sort || []).filter((I) => I.field === r.field)[0], l = n || Qt[o][c && c.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
246
  }, Je = (e) => {
247
247
  var r;
248
248
  if (e.field === t.gridProps.expandField || e._expand || t.gridProps.group && e.field === void 0) {
@@ -253,7 +253,7 @@ const Zt = a.createContext(void 0), sr = (t) => {
253
253
  payload: e.value
254
254
  }) : t.gridProps.detailExpand;
255
255
  s(t.gridProps.onExpandChange, {
256
- ...m(e.syntheticEvent),
256
+ ...P(e.syntheticEvent),
257
257
  expand: n,
258
258
  dataItem: e.dataItem,
259
259
  dataIndex: e.dataIndex,
@@ -263,7 +263,7 @@ const Zt = a.createContext(void 0), sr = (t) => {
263
263
  return;
264
264
  }
265
265
  t.gridProps.onItemChange && s(t.gridProps.onItemChange, {
266
- ...m(e.syntheticEvent),
266
+ ...P(e.syntheticEvent),
267
267
  dataItem: e.dataItem,
268
268
  dataIndex: e.dataIndex,
269
269
  field: e.field,
@@ -271,21 +271,21 @@ const Zt = a.createContext(void 0), sr = (t) => {
271
271
  });
272
272
  }, Ye = (e) => {
273
273
  var r;
274
- if (t.gridProps.onSelectionChange && h.enabled) {
275
- const { event: n, dataItem: o, dataIndex: i, columnIndex: c } = e, l = {
276
- ...m(n.syntheticEvent),
274
+ if (t.gridProps.onSelectionChange && b.enabled) {
275
+ const { event: n, dataItem: o, dataIndex: a, columnIndex: c } = e, l = {
276
+ ...P(n.syntheticEvent),
277
277
  dataItem: o,
278
278
  startColIndex: c,
279
279
  endColIndex: c,
280
- startRowIndex: i,
281
- endRowIndex: i,
280
+ startRowIndex: a,
281
+ endRowIndex: a,
282
282
  dataItems: O(),
283
283
  altKey: !1,
284
284
  ctrlKey: !1,
285
285
  shiftKey: !1,
286
286
  metaKey: !1,
287
- mode: h.mode,
288
- cell: h.cell,
287
+ mode: b.mode,
288
+ cell: b.cell,
289
289
  isDrag: !1,
290
290
  componentId: t.id,
291
291
  selectedField: t.gridProps.selectedField || ""
@@ -301,29 +301,29 @@ const Zt = a.createContext(void 0), sr = (t) => {
301
301
  }
302
302
  }, Qe = (e) => {
303
303
  var r;
304
- if (t.gridProps.onHeaderSelectionChange && h.enabled) {
304
+ if (t.gridProps.onHeaderSelectionChange && b.enabled) {
305
305
  const n = O();
306
306
  s(t.gridProps.onHeaderSelectionChange, {
307
- select: e.syntheticEvent.target.checked ? n.reduce((o, i) => (t.gridProps.dataItemKey && X(t.gridProps.dataItemKey)(i) !== void 0 && (o[X(t.gridProps.dataItemKey)(i)] = !0), o), {}) : {},
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), {}) : {},
308
308
  field: e.field,
309
309
  nativeEvent: e.syntheticEvent && e.syntheticEvent.nativeEvent,
310
310
  syntheticEvent: e.syntheticEvent,
311
- target: I.current,
311
+ target: R.current,
312
312
  dataItems: n,
313
313
  selectedField: (r = t.gridProps.selectedField) != null ? r : ""
314
314
  });
315
315
  }
316
- }, L = (e, r) => {
317
- t.gridProps.onSelectionChange && E && h.enabled && s(t.gridProps.onSelectionChange, {
316
+ }, z = (e, r) => {
317
+ t.gridProps.onSelectionChange && E && b.enabled && s(t.gridProps.onSelectionChange, {
318
318
  ...e,
319
319
  select: r
320
320
  });
321
321
  }, Ze = (e) => {
322
322
  var r;
323
- if (t.gridProps.onSelectionChange && h.enabled) {
324
- const n = Z()[e.startRowIndex], o = Z()[e.endRowIndex], i = {
323
+ if (t.gridProps.onSelectionChange && b.enabled) {
324
+ const n = Z()[e.startRowIndex], o = Z()[e.endRowIndex], a = {
325
325
  syntheticEvent: void 0,
326
- target: I.current,
326
+ target: R.current,
327
327
  selectedField: t.gridProps.selectedField || "",
328
328
  componentId: t.id,
329
329
  dataItems: O(),
@@ -332,17 +332,17 @@ const Zt = a.createContext(void 0), sr = (t) => {
332
332
  endDataItem: o,
333
333
  ...e
334
334
  }, c = Te({
335
- event: i,
335
+ event: a,
336
336
  selectedState: (r = t.gridProps.select) != null ? r : {},
337
337
  // Thats kinda strange, even through the `dataItemKey` is required by the `getSelectedState`
338
338
  // it does work correctly even without it
339
339
  dataItemKey: t.gridProps.dataItemKey
340
340
  });
341
- L(i, c);
341
+ z(a, c);
342
342
  }
343
343
  }, pe = (e) => {
344
- if (t.gridProps.onSelectionChange && h.enabled) {
345
- const r = e.dataItems[0], n = e.dataItems[e.dataItems.length - 1], o = {}, i = {
344
+ if (t.gridProps.onSelectionChange && b.enabled) {
345
+ const r = e.dataItems[0], n = e.dataItems[e.dataItems.length - 1], o = {}, a = {
346
346
  ...e,
347
347
  startDataItem: r,
348
348
  endDataItem: n,
@@ -352,43 +352,43 @@ const Zt = a.createContext(void 0), sr = (t) => {
352
352
  endColIndex: u.current.length - 1
353
353
  };
354
354
  e.dataItems.forEach((c) => {
355
- const b = X(t.gridProps.dataItemKey)(c);
356
- o[b] = e.cell ? [...Array(u.current.length).keys()] : !0;
357
- }), L(i, o);
355
+ const f = X(t.gridProps.dataItemKey)(c);
356
+ o[f] = e.cell ? [...Array(u.current.length).keys()] : !0;
357
+ }), z(a, o);
358
358
  }
359
359
  }, et = (e) => {
360
- if (t.gridProps.onSelectionChange && h.enabled) {
361
- const n = X(t.gridProps.dataItemKey)(e.dataItem), o = 0, i = u.current.length - 1, c = e.dataItems.findIndex(
360
+ if (t.gridProps.onSelectionChange && b.enabled) {
361
+ const n = X(t.gridProps.dataItemKey)(e.dataItem), o = 0, a = u.current.length - 1, c = e.dataItems.findIndex(
362
362
  (y) => y[t.gridProps.dataItemKey] === e.dataItem[t.gridProps.dataItemKey]
363
- ), R = {
363
+ ), I = {
364
364
  ...e,
365
365
  startDataItem: c,
366
366
  endDataItem: c,
367
367
  startRowIndex: c,
368
368
  endRowIndex: c,
369
369
  startColIndex: o,
370
- endColIndex: i
370
+ endColIndex: a
371
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(R, g);
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, z(I, g);
373
373
  }
374
374
  }, tt = (e) => {
375
- t.gridProps.onSelectionChange && h.enabled && L(e, {});
376
- }, z = (e, r, n, o, i) => {
375
+ t.gridProps.onSelectionChange && b.enabled && z(e, {});
376
+ }, L = (e, r, n, o, a) => {
377
377
  const c = t.gridProps.onDataStateChange;
378
378
  if (e) {
379
- const l = { ...m(o), ...r, targetEvent: i };
379
+ const l = { ...P(o), ...r, targetEvent: a };
380
380
  s(e, l);
381
381
  } else
382
382
  c && s(c, {
383
- ...m(o),
384
- targetEvent: i || {},
383
+ ...P(o),
384
+ targetEvent: a || {},
385
385
  dataState: {
386
386
  ...ft(),
387
387
  ...n
388
388
  }
389
389
  });
390
390
  }, N = (e, r, n) => {
391
- z(
391
+ L(
392
392
  t.gridProps.onPageChange,
393
393
  { page: e },
394
394
  { skip: e.skip, take: e.take },
@@ -399,22 +399,24 @@ const Zt = a.createContext(void 0), sr = (t) => {
399
399
  let e = t.gridProps.total || 0;
400
400
  return Array.isArray(t.gridProps.data) ? e = e || t.gridProps.data.length : t.gridProps.data && (e = e || t.gridProps.data.total), e;
401
401
  }, nt = (e) => {
402
- const r = t.gridProps.take || 0, n = (t.gridProps.skip || 0) + r, o = rt();
402
+ var a, c;
403
+ const r = (c = (a = t.gridProps.take) != null ? a : t.gridProps.pageSize) != null ? c : 0, n = (t.gridProps.skip || 0) + r, o = rt();
403
404
  n < o && N({ skip: n, take: r }, e);
404
405
  }, ot = (e) => {
405
- const r = t.gridProps.take || 0, n = (t.gridProps.skip || 0) - r;
406
+ var o, a;
407
+ const r = (a = (o = t.gridProps.take) != null ? o : t.gridProps.pageSize) != null ? a : 0, n = (t.gridProps.skip || 0) - r;
406
408
  n >= 0 && N({ skip: n, take: r }, e);
407
409
  }, at = (e) => {
408
410
  N({ skip: e.skip, take: e.take }, e.syntheticEvent, e.targetEvent);
409
411
  }, Ie = (e, r) => {
410
- z(
412
+ L(
411
413
  t.gridProps.onSortChange,
412
414
  { sort: e },
413
415
  { sort: e, ...t.gridProps.scrollable === "virtual" ? { skip: 0 } : {} },
414
416
  r
415
417
  );
416
418
  }, it = (e, r) => {
417
- z(
419
+ L(
418
420
  t.gridProps.onFilterChange,
419
421
  { filter: e },
420
422
  { filter: e || void 0, skip: 0 },
@@ -422,27 +424,27 @@ const Zt = a.createContext(void 0), sr = (t) => {
422
424
  );
423
425
  }, J = (e, r) => {
424
426
  const n = r.nativeEvent ? r : { nativeEvent: r.nativeEvent || r.originalEvent };
425
- e.length === 0 && t.gridProps.navigatable && (ae.current = !0), z(
427
+ e.length === 0 && t.gridProps.navigatable && (ae.current = !0), L(
426
428
  t.gridProps.onGroupChange,
427
429
  { group: e },
428
430
  { group: e, skip: 0 },
429
431
  n
430
432
  );
431
433
  }, Y = (e, r, n) => {
432
- const o = u.current[e], i = o.depth, c = (g) => {
434
+ const o = u.current[e], a = o.depth, c = (g) => {
433
435
  do
434
436
  g++;
435
- while (g < u.current.length && u.current[g].depth > i);
437
+ while (g < u.current.length && u.current[g].depth > a);
436
438
  return g;
437
439
  }, l = u.current.splice(e, c(e) - e);
438
440
  u.current.splice(e < r ? c(r - l.length) : r, 0, ...l), u.current.filter((g) => g.declarationIndex >= 0).forEach((g, y) => g.orderIndex = y);
439
- const b = u.current[e].locked && u.current[r].locked;
440
- Bt(t.columnsMapRef, u.current, b || _.current), Ut(t.columnsMapRef, u.current, b || _.current), oe.current && (_.current = !1, oe.current = !1);
441
- const R = G();
441
+ const f = u.current[e].locked && u.current[r].locked;
442
+ Bt(t.columnsMapRef, u.current, f || _.current), Ut(t.columnsMapRef, u.current, f || _.current), oe.current && (_.current = !1, oe.current = !1);
443
+ const I = G();
442
444
  if (te(), t.gridProps.onColumnReorder) {
443
445
  const g = {
444
- target: I.current,
445
- columns: R,
446
+ target: R.current,
447
+ columns: I,
446
448
  columnId: o.id,
447
449
  nativeEvent: n
448
450
  };
@@ -452,14 +454,14 @@ const Zt = a.createContext(void 0), sr = (t) => {
452
454
  const o = typeof t.gridProps.rowReorderable == "object" ? t.gridProps.rowReorderable.enabled : t.gridProps.rowReorderable;
453
455
  if (n === "forbidden" || !o || !j.current)
454
456
  return;
455
- const { slicedData: i, dataRef: c } = t, l = (i || c)[r];
457
+ const { slicedData: a, dataRef: c } = t, l = (a || c)[r];
456
458
  t.gridProps.onRowReorder && s(t.gridProps.onRowReorder, {
457
459
  draggedDataItems: [j.current],
458
460
  droppedDataItem: l == null ? void 0 : l.dataItem,
459
461
  dropPosition: n,
460
462
  nativeEvent: e.originalEvent,
461
463
  dragEvent: e,
462
- target: I.current
464
+ target: R.current
463
465
  }), j.current = null;
464
466
  }, ct = (e, r, n) => {
465
467
  if (t.gridProps.group === void 0)
@@ -470,8 +472,8 @@ const Zt = a.createContext(void 0), sr = (t) => {
470
472
  const o = u.current[e].field;
471
473
  if (!o)
472
474
  return;
473
- const i = (t.gridProps.group || []).slice();
474
- i.splice(r, 0, { field: o }), J(i, n);
475
+ const a = (t.gridProps.group || []).slice();
476
+ a.splice(r, 0, { field: o }), J(a, n);
475
477
  }, lt = (e, r) => {
476
478
  const n = S.current.getCurrentGroupsLength;
477
479
  Re(e, n, r);
@@ -500,12 +502,12 @@ const Zt = a.createContext(void 0), sr = (t) => {
500
502
  });
501
503
  }
502
504
  }, ut = () => {
503
- var i, c, l;
505
+ var a, c, l;
504
506
  if (!q)
505
507
  return !1;
506
- const e = St(C()), r = e ? e.matches(".k-table-td") ? e : (i = C()) == null ? void 0 : i.body : (c = C()) == null ? void 0 : c.body, n = r.closest(".k-grid-container"), o = r && ((l = K.current) == null ? void 0 : l.contains(r));
508
+ const e = St(C()), r = e ? e.matches(".k-table-td") ? e : (a = C()) == null ? void 0 : a.body : (c = C()) == null ? void 0 : c.body, n = r.closest(".k-grid-container"), o = r && ((l = K.current) == null ? void 0 : l.contains(r));
507
509
  return !!(r && o && n);
508
- }, gt = (e, r, n, o, i, c) => {
510
+ }, gt = (e, r, n, o, a, c) => {
509
511
  Q(), _.current = !0, oe.current = !0, t.gridProps.onColumnResize && E && s(t.gridProps.onColumnResize, {
510
512
  columns: G(),
511
513
  nativeEvent: o,
@@ -513,19 +515,22 @@ const Zt = a.createContext(void 0), sr = (t) => {
513
515
  index: e,
514
516
  newWidth: r,
515
517
  oldWidth: n,
516
- end: i,
517
- target: I.current
518
+ end: a,
519
+ target: R.current
518
520
  });
519
- }, ft = () => ({
520
- filter: t.gridProps.filter,
521
- sort: t.gridProps.sort,
522
- skip: t.gridProps.skip,
523
- take: t.gridProps.take !== void 0 ? t.gridProps.take : t.gridProps.pageSize,
524
- group: t.gridProps.group
525
- }), m = (e) => ({
521
+ }, ft = () => {
522
+ var e;
523
+ return {
524
+ filter: t.gridProps.filter,
525
+ sort: t.gridProps.sort,
526
+ skip: t.gridProps.skip,
527
+ take: (e = t.gridProps.take) != null ? e : t.gridProps.pageSize,
528
+ group: t.gridProps.group
529
+ };
530
+ }, P = (e) => ({
526
531
  nativeEvent: e && e.nativeEvent,
527
532
  syntheticEvent: e,
528
- target: I.current
533
+ target: R.current
529
534
  }), mt = (e) => ({
530
535
  ...e,
531
536
  nativeEvent: void 0,
@@ -545,14 +550,14 @@ const Zt = a.createContext(void 0), sr = (t) => {
545
550
  de.current = !1, (r = document.activeElement) != null && r.closest(".k-grid-edit-row") ? ie.current = document.activeElement : ie.current = void 0;
546
551
  const o = Array.from((n = T.current) == null ? void 0 : n.getElementsByClassName("k-grid-edit-row"));
547
552
  o.length > ue.current.length ? W.current = o.filter(
548
- (i) => !ue.current.includes(i)
553
+ (a) => !ue.current.includes(a)
549
554
  )[0] : o.length === 1 && (W.current = o[0], de.current = !0), ue.current = o;
550
555
  }
551
556
  }, 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 = kt() || void 0), ne.current), C = () => {
552
557
  var e;
553
558
  if (q)
554
559
  return ((e = B()) == null ? void 0 : e.ownerDocument) || document;
555
- }, B = () => K.current, ee = a.useCallback(
560
+ }, B = () => K.current, ee = i.useCallback(
556
561
  (e) => {
557
562
  var o;
558
563
  if (!d.current || !((o = d.current) != null && o.container) || t.gridProps.scrollable === "none")
@@ -565,8 +570,8 @@ const Zt = a.createContext(void 0), sr = (t) => {
565
570
  Math.round(d.current.askedSkip / d.current.total * d.current.container.scrollHeight)
566
571
  );
567
572
  else if (n) {
568
- const i = r < 1 ? n.querySelector("tbody > tr:nth-child(1)") : n.querySelector(`tbody > tr:nth-child(${r + 1})`);
569
- i && V.current && (V.current.scrollTop = i.offsetTop);
573
+ const a = r < 1 ? n.querySelector("tbody > tr:nth-child(1)") : n.querySelector(`tbody > tr:nth-child(${r + 1})`);
574
+ a && V.current && (V.current.scrollTop = a.offsetTop);
570
575
  }
571
576
  },
572
577
  [t.gridProps.scrollable]
@@ -576,26 +581,27 @@ const Zt = a.createContext(void 0), sr = (t) => {
576
581
  const { data: e, total: r } = t.gridProps;
577
582
  return Array.isArray(e) ? e.length === r : e ? r === e.total : !1;
578
583
  }, Rt = (e, r) => {
584
+ var n, o;
579
585
  if (d.current) {
580
- if (d.current.fixedScroll = t.gridProps.fixedScroll || !1, d.current.PageChange = N, d.current.realSkip = t.gridProps.skip || 0, d.current.pageSize = (t.gridProps.take !== void 0 ? t.gridProps.take : t.gridProps.pageSize) || 0, d.current.scrollableVirtual = t.gridProps.scrollable === "virtual", d.current.total = e, d.current.propsSkip = (t.gridProps.skip || 0) + (t.gridProps.scrollable === "virtual" ? d.current.topCacheCount + (d.current.attendedSkip - (t.gridProps.skip || 0)) : 0), t.gridProps.rowHeight !== void 0 && t.gridProps.rowHeight > 0 && !r) {
581
- const n = t.gridProps.rowHeight * e;
582
- d.current.containerHeight = Ae ? Math.min(He, n) : n;
586
+ if (d.current.fixedScroll = t.gridProps.fixedScroll || !1, d.current.PageChange = N, d.current.realSkip = t.gridProps.skip || 0, d.current.pageSize = (o = (n = t.gridProps.take) != null ? n : t.gridProps.pageSize) != null ? o : 0, d.current.scrollableVirtual = t.gridProps.scrollable === "virtual", d.current.total = e, d.current.propsSkip = (t.gridProps.skip || 0) + (t.gridProps.scrollable === "virtual" ? d.current.topCacheCount + (d.current.attendedSkip - (t.gridProps.skip || 0)) : 0), t.gridProps.rowHeight !== void 0 && t.gridProps.rowHeight > 0 && !r) {
587
+ const a = t.gridProps.rowHeight * e;
588
+ d.current.containerHeight = Ae ? Math.min(He, a) : a;
583
589
  } else
584
590
  d.current.containerHeight = 1533915;
585
591
  if (d.current.containerRef = V, d.current.tableBodyRef = T, d.current.table = x.current, d.current instanceof Fe) {
586
- const { rowHeight: n = 0, detail: o, expandField: i } = t.gridProps;
587
- let { detailRowHeight: c = 0 } = t.gridProps;
588
- c = o && i ? c : n, It() ? (d.current.total = t.dataRef.length, d.current.rowHeightService = new De(
592
+ const { rowHeight: a = 0, detail: c, expandField: l } = t.gridProps;
593
+ let { detailRowHeight: f = 0 } = t.gridProps;
594
+ f = c && l ? f : a, It() ? (d.current.total = t.dataRef.length, d.current.rowHeightService = new De(
589
595
  t.dataRef.length,
590
- n,
591
- c,
596
+ a,
597
+ f,
592
598
  t.dataRef
593
- )) : d.current.rowHeightService = new De(e, n, c);
594
- const l = d.current.rowHeightService.totalHeight();
595
- d.current.containerHeight = Ae ? Math.min(He, l) : l;
599
+ )) : d.current.rowHeightService = new De(e, a, f);
600
+ const I = d.current.rowHeightService.totalHeight();
601
+ d.current.containerHeight = Ae ? Math.min(He, I) : I;
596
602
  }
597
603
  }
598
- }, Ce = a.useCallback(
604
+ }, Ce = i.useCallback(
599
605
  (e) => {
600
606
  const r = { rowIndex: se.current };
601
607
  e.forEach((n) => {
@@ -605,15 +611,15 @@ const Zt = a.createContext(void 0), sr = (t) => {
605
611
  [ee]
606
612
  ), te = () => {
607
613
  t.gridProps.forceUpdate && t.gridProps.forceUpdate();
608
- }, Et = (e) => e.left !== void 0 ? ve !== "rtl" ? { left: e.left, right: e.right } : { left: e.right, right: e.left } : {}, I = a.useRef(null), u = t.columnsRef, d = a.useRef(), v = a.useRef(), S = a.useRef(), w = a.useRef(), k = a.useRef(), U = a.useRef(), D = a.useRef(null), T = a.useRef(null), Ct = a.useRef(null), V = a.useRef(null), x = a.useRef(null), re = a.useRef(null), K = a.useRef(null), A = a.useRef(null), H = a.useRef(null), ne = a.useRef(), oe = a.useRef(!1), ae = a.useRef(!1), W = a.useRef(), ie = a.useRef(), de = a.useRef(!1), _ = a.useRef(!0), ce = a.useRef(0), le = a.useRef(), se = a.useRef(), ue = a.useRef([]), j = a.useRef(null), vt = a.useRef(null), wt = a.useRef(null), ve = yt(K), xt = a.useMemo(() => a.Children.toArray(t.gridProps.children), [t.gridProps.children]), h = $((ye = t.gridProps.selectable) != null ? ye : !!t.gridProps.selectedField), we = Dt((Se = t.gridProps.editable) != null ? Se : !!t.gridProps.editField);
609
- a.useMemo(() => {
614
+ }, Et = (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, d = i.useRef(), v = i.useRef(), S = i.useRef(), w = i.useRef(), k = i.useRef(), U = i.useRef(), D = i.useRef(null), T = i.useRef(null), Ct = i.useRef(null), V = i.useRef(null), x = i.useRef(null), re = i.useRef(null), K = i.useRef(null), A = i.useRef(null), H = 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), vt = i.useRef(null), wt = i.useRef(null), ve = yt(K), xt = i.useMemo(() => i.Children.toArray(t.gridProps.children), [t.gridProps.children]), b = $((ye = t.gridProps.selectable) != null ? ye : !!t.gridProps.selectedField), we = Dt((Se = t.gridProps.editable) != null ? Se : !!t.gridProps.editField);
615
+ i.useMemo(() => {
610
616
  M.onConstructor({
611
617
  navigatable: !!t.gridProps.navigatable,
612
618
  contextStateRef: w,
613
619
  navigationStateRef: k,
614
620
  idPrefix: t.id
615
621
  });
616
- }, []), a.useMemo(() => {
622
+ }, []), i.useMemo(() => {
617
623
  var n;
618
624
  (n = d.current) == null || n.reset();
619
625
  const e = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, r = t.isFixedVirtualScroll ? Fe : $t;
@@ -626,15 +632,15 @@ const Zt = a.createContext(void 0), sr = (t) => {
626
632
  t.gridProps.groupable,
627
633
  t.gridProps.sort,
628
634
  t.gridProps.rowHeight
629
- ]), a.useEffect(() => (t.gridProps.clipboard && (U.current = new Kt(st), U.current.addEventListeners(C())), () => {
635
+ ]), i.useEffect(() => (t.gridProps.clipboard && (U.current = new Kt(st), U.current.addEventListeners(C())), () => {
630
636
  U.current && U.current.removeEventListeners(C());
631
- }), [t.gridProps.onClipboard, t.gridProps.clipboard]), a.useEffect(() => (t.gridProps.columnVirtualization && !window.navigator.userAgent.match(_t) && (re.current && (re.current.style.display = "block"), x.current && (x.current.style.display = "block")), Q(), ke(p()), M.onComponentDidMount({
637
+ }), [t.gridProps.onClipboard, t.gridProps.clipboard]), i.useEffect(() => (t.gridProps.columnVirtualization && !window.navigator.userAgent.match(_t) && (re.current && (re.current.style.display = "block"), x.current && (x.current.style.display = "block")), Q(), ke(p()), M.onComponentDidMount({
632
638
  scope: K.current || void 0,
633
639
  contextStateRef: w,
634
640
  navigationStateRef: k
635
641
  }), () => {
636
642
  clearTimeout(le.current);
637
- }), []), a.useEffect(() => {
643
+ }), []), i.useEffect(() => {
638
644
  var e;
639
645
  Q(), ke(p()), (e = d.current) != null && e.tableTransform && d.current.table && (d.current.table.style.transform = d.current.tableTransform, d.current.tableTransform = ""), Pt(), M.onComponentDidUpdate({
640
646
  scope: K.current || void 0,
@@ -646,7 +652,7 @@ const Zt = a.createContext(void 0), sr = (t) => {
646
652
  lastActiveElement: ie.current,
647
653
  navigatable: t.gridProps.navigatable
648
654
  }), ae.current = !1, W.current = void 0;
649
- }), a.useEffect(() => {
655
+ }), i.useEffect(() => {
650
656
  if (q) {
651
657
  const e = {
652
658
  rootMargin: "0px",
@@ -654,14 +660,14 @@ const Zt = a.createContext(void 0), sr = (t) => {
654
660
  };
655
661
  D.current = window.IntersectionObserver && new window.IntersectionObserver(Ce, e) || null;
656
662
  }
657
- }, [Ce]), a.useEffect(() => {
663
+ }, [Ce]), i.useEffect(() => {
658
664
  var r;
659
665
  let e;
660
666
  return q && window.ResizeObserver && (e = new window.ResizeObserver(bt), e.observe((r = C()) == null ? void 0 : r.body)), () => {
661
667
  e == null || e.disconnect();
662
668
  };
663
- }, []), a.useImperativeHandle(
664
- I,
669
+ }, []), i.useImperativeHandle(
670
+ R,
665
671
  () => ({
666
672
  get element() {
667
673
  return B();
@@ -679,17 +685,17 @@ const Zt = a.createContext(void 0), sr = (t) => {
679
685
  const n = B();
680
686
  if (D.current && n) {
681
687
  D.current.disconnect();
682
- const i = n.querySelector(`[absolute-row-index="${se.current}"]`);
683
- i ? D.current.observe(i) : ee(e);
688
+ const a = n.querySelector(`[absolute-row-index="${se.current}"]`);
689
+ a ? D.current.observe(a) : ee(e);
684
690
  }
685
691
  },
686
692
  fitColumns: (e) => {
687
693
  v.current.dblClickHandler(null, e);
688
694
  }
689
695
  })
690
- ), a.useImperativeHandle(t.gridRef, () => I.current), a.useMemo(() => {
696
+ ), i.useImperativeHandle(t.gridRef, () => R.current), i.useMemo(() => {
691
697
  v.current = new Vt(gt);
692
- }, [t.gridProps.onColumnResize]), a.useMemo(() => {
698
+ }, [t.gridProps.onColumnResize]), i.useMemo(() => {
693
699
  S.current = new Wt(Y, ct, Re);
694
700
  }, [
695
701
  t.gridProps.onColumnReorder,
@@ -698,7 +704,7 @@ const Zt = a.createContext(void 0), sr = (t) => {
698
704
  t.gridProps.groupable
699
705
  ]), v.current.resizable = t.gridProps.resizable || !1, v.current.columns = u.current;
700
706
  const xe = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1;
701
- return S.current.reorderable = t.gridProps.reorderable || !1, S.current.groupable = xe, S.current.columns = u.current, Rt(t.total, xe), /* @__PURE__ */ a.createElement(
707
+ return S.current.reorderable = t.gridProps.reorderable || !1, S.current.groupable = xe, S.current.columns = u.current, Rt(t.total, xe), /* @__PURE__ */ i.createElement(
702
708
  Zt.Provider,
703
709
  {
704
710
  value: {
@@ -744,15 +750,15 @@ const Zt = a.createContext(void 0), sr = (t) => {
744
750
  vsRef: d
745
751
  }
746
752
  },
747
- /* @__PURE__ */ a.createElement(Mt.Provider, { value: w.current }, t.children),
748
- /* @__PURE__ */ a.createElement(
753
+ /* @__PURE__ */ i.createElement(Mt.Provider, { value: w.current }, t.children),
754
+ /* @__PURE__ */ i.createElement(
749
755
  Jt,
750
756
  {
751
- show: P.show,
752
- dataItem: P.dataItem,
753
- field: P.field,
754
- items: ze,
755
- offset: P.offset,
757
+ show: h.show,
758
+ dataItem: h.dataItem,
759
+ field: h.field,
760
+ items: Le,
761
+ offset: h.offset,
756
762
  onClose: me,
757
763
  onSelect: Ne
758
764
  }