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

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,20 +7,20 @@
7
7
  */
8
8
  "use client";
9
9
  import * as i from "react";
10
- import { useDir as St, setScrollbarWidth as ke, canUseDOM as q, getter as X, getActiveElement as kt, getScrollbarWidth as Dt, RowHeightService as De } from "@progress/kendo-react-common";
11
- import { getSelectionOptions as $, getEditableOptions as Kt, tableKeyboardNavigation as M, ClipboardService as Mt, TableKeyboardNavigationContext as Tt, getSelectedStateFromKeyDown as At, closestTagName as Ke, getColumnIndex as Ht, getRowIndex as Ft, editReducer as Gt, EDIT_ACTION as zt, getDetailExpandableOptions as Lt, detailExpandReducer as Me, getGroupExpandableOptions as Nt, groupExpandReducer as Ot, DETAIL_EXPAND_ACTION as Bt, getSelectedState as Te, updateLeft as Ut, updateRight as Vt } from "@progress/kendo-react-data-tools";
12
- import { ColumnResize as Wt } from "./drag/ColumnResize.mjs";
13
- import { CommonDragLogic as _t } from "./drag/CommonDragLogic.mjs";
14
- import { SAFARI_REGEX as jt } from "./constants/index.mjs";
15
- import { getDefaultHeadContextMenuItems as qt, getDefaultBodyContextMenuItems as Xt, sanitizeColumns as $t, firefox as Ae, firefoxMaxHeight as He } from "./utils/index.mjs";
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
16
  import { VirtualScrollFixed as Fe } from "./VirtualScrollFixed.mjs";
17
- import { VirtualScroll as Jt } from "./VirtualScroll.mjs";
18
- import { GridContextMenu as Yt } from "./contextMenu/GridContextMenu.mjs";
17
+ import { VirtualScroll as Zt } from "./VirtualScroll.mjs";
18
+ import { GridContextMenu as pt } from "./contextMenu/GridContextMenu.mjs";
19
19
  import { GridContextMenuAnchorPart as Ge } from "./contextMenu/enums.mjs";
20
- import { normalize as Qt, firstLevelSortSeqMap as Zt } from "./sortCommon.mjs";
21
- const pt = i.createContext(void 0), ur = (t) => {
20
+ import { normalize as er, firstLevelSortSeqMap as tr } from "./sortCommon.mjs";
21
+ const rr = i.createContext(void 0), mr = (t) => {
22
22
  var xe, Se;
23
- const E = t.gridProps.isClient, [h, fe] = i.useState({}), ze = (e) => {
23
+ const C = t.gridProps.isClient, [h, fe] = i.useState({}), ze = (e) => {
24
24
  e.event.preventDefault(), fe({
25
25
  ...h,
26
26
  show: !0,
@@ -35,14 +35,14 @@ const pt = i.createContext(void 0), ur = (t) => {
35
35
  fe({});
36
36
  }, m = i.useMemo(() => t.columnsRef.current.find((e) => e.field === h.field), [t.columnsRef, h]), Pe = i.useMemo(() => {
37
37
  const e = t.gridProps.sortable && (m == null ? void 0 : m.sortable);
38
- return qt({
38
+ return Jt({
39
39
  sortable: !!e,
40
40
  selectable: $(t.gridProps.selectable).enabled,
41
41
  clipboard: !!t.gridProps.clipboard
42
42
  });
43
43
  }, [m, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), he = i.useMemo(() => {
44
44
  const e = t.gridProps.sortable && (m == null ? void 0 : m.sortable);
45
- return Xt({
45
+ return Yt({
46
46
  sortable: !!e,
47
47
  selectable: $(t.gridProps.selectable).enabled,
48
48
  clipboard: !!t.gridProps.clipboard
@@ -62,7 +62,7 @@ const pt = i.createContext(void 0), ur = (t) => {
62
62
  menuItem: r,
63
63
  ...e
64
64
  };
65
- t.gridProps.onContextMenuItemClick && u(t.gridProps.onContextMenuItemClick, n);
65
+ t.gridProps.onContextMenuItemClick && s(t.gridProps.onContextMenuItemClick, n);
66
66
  const o = Z(), a = {
67
67
  selectedField: t.gridProps.selectedField || "",
68
68
  componentId: t.id,
@@ -99,10 +99,10 @@ const pt = i.createContext(void 0), ur = (t) => {
99
99
  }
100
100
  me();
101
101
  }, z = () => {
102
- const e = s.current.filter((r) => r.declarationIndex >= 0 && r.parentIndex === -1);
103
- return $t(e);
102
+ const e = u.current.filter((r) => r.declarationIndex >= 0 && r.parentIndex === -1);
103
+ return Qt(e);
104
104
  }, Oe = (e, r, n) => {
105
- if (t.gridProps.onContextMenu && E) {
105
+ if (t.gridProps.onContextMenu && C) {
106
106
  const o = {
107
107
  target: R.current,
108
108
  syntheticEvent: e,
@@ -110,7 +110,7 @@ const pt = i.createContext(void 0), ur = (t) => {
110
110
  dataItem: r,
111
111
  field: n
112
112
  };
113
- u(t.gridProps.onContextMenu, o);
113
+ s(t.gridProps.onContextMenu, o);
114
114
  }
115
115
  t.gridProps.contextMenu && ze({
116
116
  event: e,
@@ -124,7 +124,7 @@ const pt = i.createContext(void 0), ur = (t) => {
124
124
  const r = e.currentTarget.scrollLeft, n = e.currentTarget.scrollTop, o = t.gridProps.scrollable === "virtual";
125
125
  t.gridProps.columnVirtualization && (!o || n === ce.current) && (le.current = window.setTimeout(() => {
126
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 && E && u(t.gridProps.onScroll, {
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
128
  ...P(e)
129
129
  }), ce.current = n;
130
130
  }, Ue = (e) => {
@@ -136,7 +136,7 @@ const pt = i.createContext(void 0), ur = (t) => {
136
136
  onNavigationAction: We,
137
137
  columns: z()
138
138
  }), M.onGetSnapshotBeforeUpdate({
139
- document: C(),
139
+ document: E(),
140
140
  contextStateRef: y,
141
141
  navigationStateRef: k
142
142
  });
@@ -148,18 +148,18 @@ const pt = i.createContext(void 0), ur = (t) => {
148
148
  selectedField: t.gridProps.selectedField,
149
149
  ...P(e)
150
150
  };
151
- if (t.gridProps.onKeyDown && E && u(t.gridProps.onKeyDown, r), !t.gridProps.selectedField && b.enabled && t.gridProps.dataItemKey) {
152
- const l = At({
151
+ if (t.gridProps.onKeyDown && C && s(t.gridProps.onKeyDown, r), !t.gridProps.selectedField && b.enabled && t.gridProps.dataItemKey) {
152
+ const l = Gt({
153
153
  event: r,
154
154
  selectedState: (n = t.gridProps.select) != null ? n : {},
155
155
  dataItemKey: t.gridProps.dataItemKey
156
156
  });
157
157
  if (l === t.gridProps.select)
158
158
  return;
159
- const f = e.target, I = Ke(f, "TD"), g = Ke(f, "TR"), x = Ht(I), G = Ft(g);
159
+ const f = e.target, I = Ke(f, "TD"), g = Ke(f, "TR"), x = zt(I), G = Lt(g);
160
160
  if (x !== void 0 && G !== void 0) {
161
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 && u(t.gridProps.onSelectionChange, {
162
+ t.gridProps.onSelectionChange && s(t.gridProps.onSelectionChange, {
163
163
  ...r,
164
164
  select: l,
165
165
  dataItem: ge,
@@ -185,74 +185,74 @@ const pt = i.createContext(void 0), ur = (t) => {
185
185
  }, We = (e) => {
186
186
  if (e.action === "moveToNextPage" && nt(e.event), e.action === "moveToPrevPage" && ot(e.event), e.focusElement && e.action === "reorderToRight") {
187
187
  const r = parseInt(e.focusElement.ariaColIndex, 10) - 1;
188
- r < s.current.length - 1 && Y(r, r + 1, e.event);
188
+ r < u.current.length - 1 && Y(r, r + 1, e.event);
189
189
  }
190
190
  if (e.focusElement && e.action === "reorderToLeft") {
191
191
  const r = parseInt(e.focusElement.ariaColIndex, 10) - 1;
192
192
  r > 0 && Y(r, r - 1, e.event);
193
193
  }
194
- if (t.gridProps.onNavigationAction && E) {
194
+ if (t.gridProps.onNavigationAction && C) {
195
195
  const r = {
196
196
  focusElement: e.focusElement,
197
197
  ...P(e.event)
198
198
  };
199
- u(t.gridProps.onNavigationAction, r);
199
+ s(t.gridProps.onNavigationAction, r);
200
200
  }
201
201
  }, _e = (e, r) => {
202
- t.gridProps.onRowClick && e.target.nodeName === "TD" && u(t.gridProps.onRowClick, {
202
+ t.gridProps.onRowClick && e.target.nodeName === "TD" && s(t.gridProps.onRowClick, {
203
203
  dataItem: r,
204
204
  ...P(e)
205
205
  });
206
206
  }, je = (e, r) => {
207
- t.gridProps.onRowDoubleClick && e.target.nodeName === "TD" && u(t.gridProps.onRowDoubleClick, {
207
+ t.gridProps.onRowDoubleClick && e.target.nodeName === "TD" && s(t.gridProps.onRowDoubleClick, {
208
208
  dataItem: r,
209
209
  ...P(e)
210
210
  });
211
211
  }, qe = (e, r, n) => {
212
212
  if (ye.enabled && ye.mode === "incell" && t.gridProps.dataItemKey) {
213
- const o = Gt(t.gridProps.edit, {
214
- type: zt.ENTER_FIELD_EDIT,
213
+ const o = Nt(t.gridProps.edit, {
214
+ type: Ot.ENTER_FIELD_EDIT,
215
215
  payload: { id: r[t.gridProps.dataItemKey], field: n }
216
216
  });
217
- t.gridProps.onEditChange && u(t.gridProps.onEditChange, {
217
+ t.gridProps.onEditChange && s(t.gridProps.onEditChange, {
218
218
  edit: o,
219
219
  ...P(e)
220
220
  });
221
221
  }
222
222
  }, Xe = (e, r) => {
223
223
  var o;
224
- if (Lt(t.detailExpandable).enabled) {
224
+ if (Bt(t.detailExpandable).enabled) {
225
225
  const a = Me((o = t.gridProps.detailExpand) != null ? o : {}, e);
226
- t.gridProps.onDetailExpandChange && u(t.gridProps.onDetailExpandChange, {
226
+ t.gridProps.onDetailExpandChange && s(t.gridProps.onDetailExpandChange, {
227
227
  ...P(r),
228
228
  detailExpand: a
229
229
  });
230
230
  }
231
231
  }, $e = (e, r) => {
232
232
  var o;
233
- const n = Nt(
233
+ const n = Ut(
234
234
  typeof t.gridProps.groupable == "object" ? t.gridProps.groupable.expandable !== !1 : t.gridProps.groupable
235
235
  );
236
236
  if (n.enabled) {
237
- const a = Ot((o = t.gridProps.groupExpand) != null ? o : [], e, n);
238
- t.gridProps.onGroupExpandChange && u(t.gridProps.onGroupExpandChange, {
237
+ const a = Vt((o = t.gridProps.groupExpand) != null ? o : [], e, n);
238
+ t.gridProps.onGroupExpandChange && s(t.gridProps.onGroupExpandChange, {
239
239
  ...P(r),
240
240
  groupExpand: a
241
241
  });
242
242
  }
243
243
  }, be = (e, r, n) => {
244
- const { allowUnsort: o, mode: a } = Qt(t.gridProps.sortable || !1, r.sortable || !1), d = (t.gridProps.sort || []).filter((I) => I.field === r.field)[0], l = n || Zt[o][d && d.dir || ""], f = a === "single" ? [] : (t.gridProps.sort || []).filter((I) => I.field !== r.field);
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
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) {
249
249
  if (t.gridProps.onExpandChange) {
250
250
  const n = t.gridProps.dataItemKey ? Me((r = t.gridProps.detailExpand) != null ? r : {}, {
251
- type: Bt.SET,
251
+ type: Wt.SET,
252
252
  id: e.dataItem[t.gridProps.dataItemKey],
253
253
  payload: e.value
254
254
  }) : t.gridProps.detailExpand;
255
- u(t.gridProps.onExpandChange, {
255
+ s(t.gridProps.onExpandChange, {
256
256
  ...P(e.syntheticEvent),
257
257
  expand: n,
258
258
  dataItem: e.dataItem,
@@ -262,7 +262,7 @@ const pt = i.createContext(void 0), ur = (t) => {
262
262
  }
263
263
  return;
264
264
  }
265
- t.gridProps.onItemChange && u(t.gridProps.onItemChange, {
265
+ t.gridProps.onItemChange && s(t.gridProps.onItemChange, {
266
266
  ...P(e.syntheticEvent),
267
267
  dataItem: e.dataItem,
268
268
  dataIndex: e.dataIndex,
@@ -290,7 +290,7 @@ const pt = i.createContext(void 0), ur = (t) => {
290
290
  componentId: t.id,
291
291
  selectedField: t.gridProps.selectedField || ""
292
292
  };
293
- u(t.gridProps.onSelectionChange, {
293
+ s(t.gridProps.onSelectionChange, {
294
294
  ...l,
295
295
  select: t.gridProps.dataItemKey ? Te({
296
296
  event: l,
@@ -303,7 +303,7 @@ const pt = i.createContext(void 0), ur = (t) => {
303
303
  var r;
304
304
  if (t.gridProps.onHeaderSelectionChange && b.enabled) {
305
305
  const n = O();
306
- u(t.gridProps.onHeaderSelectionChange, {
306
+ s(t.gridProps.onHeaderSelectionChange, {
307
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,
@@ -314,7 +314,7 @@ const pt = i.createContext(void 0), ur = (t) => {
314
314
  });
315
315
  }
316
316
  }, L = (e, r) => {
317
- t.gridProps.onSelectionChange && E && b.enabled && u(t.gridProps.onSelectionChange, {
317
+ t.gridProps.onSelectionChange && C && b.enabled && s(t.gridProps.onSelectionChange, {
318
318
  ...e,
319
319
  select: r
320
320
  });
@@ -349,16 +349,16 @@ const pt = i.createContext(void 0), ur = (t) => {
349
349
  startRowIndex: 0,
350
350
  endRowIndex: e.dataItems.length - 1,
351
351
  startColIndex: 0,
352
- endColIndex: s.current.length - 1
352
+ endColIndex: u.current.length - 1
353
353
  };
354
354
  e.dataItems.forEach((d) => {
355
355
  const f = X(t.gridProps.dataItemKey)(d);
356
- o[f] = e.cell ? [...Array(s.current.length).keys()] : !0;
356
+ o[f] = e.cell ? [...Array(u.current.length).keys()] : !0;
357
357
  }), L(a, o);
358
358
  }
359
359
  }, et = (e) => {
360
360
  if (t.gridProps.onSelectionChange && b.enabled) {
361
- const n = X(t.gridProps.dataItemKey)(e.dataItem), o = 0, a = s.current.length - 1, d = e.dataItems.findIndex(
361
+ const n = X(t.gridProps.dataItemKey)(e.dataItem), o = 0, a = u.current.length - 1, d = e.dataItems.findIndex(
362
362
  (x) => x[t.gridProps.dataItemKey] === e.dataItem[t.gridProps.dataItemKey]
363
363
  ), I = {
364
364
  ...e,
@@ -369,7 +369,7 @@ const pt = i.createContext(void 0), ur = (t) => {
369
369
  startColIndex: o,
370
370
  endColIndex: a
371
371
  }, g = e.mode === "multiple" ? t.gridProps.select || {} : {};
372
- g[n] === !0 || Array.isArray(g[n]) && g[n].length === s.current.length ? delete g[n] : g[n] = e.cell ? [...Array(s.current.length).keys()] : !0, L(I, 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, L(I, g);
373
373
  }
374
374
  }, tt = (e) => {
375
375
  t.gridProps.onSelectionChange && b.enabled && L(e, {});
@@ -377,13 +377,13 @@ const pt = i.createContext(void 0), ur = (t) => {
377
377
  const d = t.gridProps.onDataStateChange;
378
378
  if (e) {
379
379
  const l = { ...P(o), ...r, targetEvent: a };
380
- u(e, l);
380
+ s(e, l);
381
381
  } else
382
- d && u(d, {
382
+ d && s(d, {
383
383
  ...P(o),
384
384
  targetEvent: a || {},
385
385
  dataState: {
386
- ...mt(),
386
+ ...Pt(),
387
387
  ...n
388
388
  }
389
389
  });
@@ -423,7 +423,7 @@ const pt = i.createContext(void 0), ur = (t) => {
423
423
  r
424
424
  );
425
425
  }, dt = (e) => {
426
- const r = t.gridProps.searchFields || s.current.map((a) => a.field) || [], n = e.nativeEvent.target.value, o = {
426
+ const r = t.gridProps.searchFields || u.current.map((a) => a.field) || [], n = e.nativeEvent.target.value, o = {
427
427
  logic: "or",
428
428
  filters: r.filter((a) => a !== void 0).map((a) => {
429
429
  var d;
@@ -451,16 +451,24 @@ const pt = i.createContext(void 0), ur = (t) => {
451
451
  { group: e, skip: 0 },
452
452
  n
453
453
  );
454
+ }, ct = (e) => {
455
+ if (t.gridProps.onColumnsStateChange) {
456
+ const r = {
457
+ target: R.current,
458
+ columnsState: e
459
+ };
460
+ s(t.gridProps.onColumnsStateChange, r);
461
+ }
454
462
  }, Y = (e, r, n) => {
455
- const o = s.current[e], a = o.depth, d = (g) => {
463
+ const o = u.current[e], a = o.depth, d = (g) => {
456
464
  do
457
465
  g++;
458
- while (g < s.current.length && s.current[g].depth > a);
466
+ while (g < u.current.length && u.current[g].depth > a);
459
467
  return g;
460
- }, l = s.current.splice(e, d(e) - e);
461
- s.current.splice(e < r ? d(r - l.length) : r, 0, ...l), s.current.filter((g) => g.declarationIndex >= 0).forEach((g, x) => g.orderIndex = x);
462
- const f = s.current[e].locked && s.current[r].locked;
463
- Ut(t.columnsMapRef, s.current, f || _.current), Vt(t.columnsMapRef, s.current, f || _.current), oe.current && (_.current = !1, oe.current = !1);
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);
464
472
  const I = z();
465
473
  if (te(), t.gridProps.onColumnReorder) {
466
474
  const g = {
@@ -469,14 +477,14 @@ const pt = i.createContext(void 0), ur = (t) => {
469
477
  columnId: o.id,
470
478
  nativeEvent: n
471
479
  };
472
- u(t.gridProps.onColumnReorder, g);
480
+ s(t.gridProps.onColumnReorder, g);
473
481
  }
474
- }, ct = (e, r, n) => {
482
+ }, lt = (e, r, n) => {
475
483
  const o = typeof t.gridProps.rowReorderable == "object" ? t.gridProps.rowReorderable.enabled : t.gridProps.rowReorderable;
476
484
  if (n === "forbidden" || !o || !j.current)
477
485
  return;
478
486
  const { slicedData: a, dataRef: d } = t, l = (a || d)[r];
479
- t.gridProps.onRowReorder && u(t.gridProps.onRowReorder, {
487
+ t.gridProps.onRowReorder && s(t.gridProps.onRowReorder, {
480
488
  draggedDataItems: [j.current],
481
489
  droppedDataItem: l == null ? void 0 : l.dataItem,
482
490
  dropPosition: n,
@@ -484,18 +492,18 @@ const pt = i.createContext(void 0), ur = (t) => {
484
492
  dragEvent: e,
485
493
  target: R.current
486
494
  }), j.current = null;
487
- }, lt = (e, r, n) => {
495
+ }, st = (e, r, n) => {
488
496
  if (t.gridProps.group === void 0)
489
497
  return;
490
498
  const o = t.gridProps.group.slice();
491
499
  o.splice(r, 0, ...o.splice(e, 1)), J(o, n);
492
500
  }, Re = (e, r, n) => {
493
- const o = s.current[e].field;
501
+ const o = u.current[e].field;
494
502
  if (!o)
495
503
  return;
496
504
  const a = (t.gridProps.group || []).slice();
497
505
  a.splice(r, 0, { field: o }), J(a, n);
498
- }, st = (e, r) => {
506
+ }, ut = (e, r) => {
499
507
  const n = S.current.getCurrentGroupsLength;
500
508
  Re(e, n, r);
501
509
  }, Q = () => {
@@ -510,26 +518,26 @@ const pt = i.createContext(void 0), ur = (t) => {
510
518
  e += parseFloat(o.toString());
511
519
  }
512
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");
513
- }, ut = (e, r) => {
514
- if (t.gridProps.onClipboard && E) {
515
- if (!gt() || !e)
521
+ }, gt = (e, r) => {
522
+ if (t.gridProps.onClipboard && C) {
523
+ if (!ft() || !e)
516
524
  return;
517
- u(t.gridProps.onClipboard, {
525
+ s(t.gridProps.onClipboard, {
518
526
  type: e,
519
527
  nativeEvent: r,
520
- columns: s.current,
528
+ columns: u.current,
521
529
  dataItemKey: t.gridProps.dataItemKey || "",
522
530
  ...typeof t.gridProps.clipboard != "boolean" ? t.gridProps.clipboard : {}
523
531
  });
524
532
  }
525
- }, gt = () => {
533
+ }, ft = () => {
526
534
  var a, d, l;
527
535
  if (!q)
528
536
  return !1;
529
- const e = kt(C()), r = e ? e.matches(".k-table-td") ? e : (a = C()) == null ? void 0 : a.body : (d = C()) == null ? void 0 : d.body, n = r.closest(".k-grid-container"), o = r && ((l = K.current) == null ? void 0 : l.contains(r));
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));
530
538
  return !!(r && o && n);
531
- }, ft = (e, r, n, o, a, d) => {
532
- Q(), _.current = !0, oe.current = !0, t.gridProps.onColumnResize && E && u(t.gridProps.onColumnResize, {
539
+ }, mt = (e, r, n, o, a, d) => {
540
+ Q(), _.current = !0, oe.current = !0, t.gridProps.onColumnResize && C && s(t.gridProps.onColumnResize, {
533
541
  columns: z(),
534
542
  nativeEvent: o,
535
543
  targetColumnId: d,
@@ -539,7 +547,7 @@ const pt = i.createContext(void 0), ur = (t) => {
539
547
  end: a,
540
548
  target: R.current
541
549
  });
542
- }, mt = () => {
550
+ }, Pt = () => {
543
551
  var e;
544
552
  return {
545
553
  filter: t.gridProps.filter,
@@ -552,20 +560,20 @@ const pt = i.createContext(void 0), ur = (t) => {
552
560
  nativeEvent: e && e.nativeEvent,
553
561
  syntheticEvent: e,
554
562
  target: R.current
555
- }), Pt = (e) => ({
563
+ }), ht = (e) => ({
556
564
  ...e,
557
565
  nativeEvent: void 0,
558
566
  syntheticEvent: void 0,
559
567
  target: void 0,
560
568
  targetEvent: void 0,
561
569
  focusElement: void 0
562
- }), u = (e, r) => {
570
+ }), s = (e, r) => {
563
571
  if (e.name === "proxy") {
564
- e.call(void 0, Pt(r));
572
+ e.call(void 0, ht(r));
565
573
  return;
566
574
  }
567
575
  e.call(void 0, r);
568
- }, ht = () => {
576
+ }, bt = () => {
569
577
  var e, r, n;
570
578
  if (A.current && ((e = A.current) == null ? void 0 : e.getElementsByClassName("k-grid-edit-row").length) > 0) {
571
579
  de.current = !1, (r = document.activeElement) != null && r.closest(".k-grid-edit-row") ? ie.current = document.activeElement : ie.current = void 0;
@@ -574,7 +582,7 @@ const pt = i.createContext(void 0), ur = (t) => {
574
582
  (a) => !ue.current.includes(a)
575
583
  )[0] : o.length === 1 && (W.current = o[0], de.current = !0), ue.current = o;
576
584
  }
577
- }, 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 = Dt() || void 0), ne.current), C = () => {
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 = () => {
578
586
  var e;
579
587
  if (q)
580
588
  return ((e = B()) == null ? void 0 : e.ownerDocument) || document;
@@ -596,9 +604,9 @@ const pt = i.createContext(void 0), ur = (t) => {
596
604
  }
597
605
  },
598
606
  [t.gridProps.scrollable]
599
- ), Ee = (e) => JSON.stringify(e.map((r) => ({ id: r.id, field: r.field, title: r.title, children: r.children }))), bt = () => Ee(xt) === Ee(s.current), It = () => {
600
- bt() || te();
601
- }, Rt = () => {
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 = () => {
602
610
  const { data: e, total: r } = t.gridProps;
603
611
  return Array.isArray(e) ? e.length === r : e ? r === e.total : !1;
604
612
  }, Et = (e, r) => {
@@ -612,7 +620,7 @@ const pt = i.createContext(void 0), ur = (t) => {
612
620
  if (c.current.containerRef = V, c.current.tableBodyRef = A, c.current.table = w.current, c.current instanceof Fe) {
613
621
  const { rowHeight: a = 0, detail: d, expandField: l } = t.gridProps;
614
622
  let { detailRowHeight: f = 0 } = t.gridProps;
615
- f = d && l ? f : a, Rt() ? (c.current.total = t.dataRef.length, c.current.rowHeightService = new De(
623
+ f = d && l ? f : a, Ct() ? (c.current.total = t.dataRef.length, c.current.rowHeightService = new De(
616
624
  t.dataRef.length,
617
625
  a,
618
626
  f,
@@ -622,7 +630,16 @@ const pt = i.createContext(void 0), ur = (t) => {
622
630
  c.current.containerHeight = Ae ? Math.min(He, I) : I;
623
631
  }
624
632
  }
625
- }, Ce = i.useCallback(
633
+ }, vt = () => {
634
+ const e = (n) => n.map((o) => ({
635
+ id: o.id,
636
+ field: o.field,
637
+ title: o.title,
638
+ hidden: !1,
639
+ children: o.children ? e(o.children) : null
640
+ })), r = t.columnsRef.current.filter((n) => n.depth === 0);
641
+ return e(r);
642
+ }, Ee = i.useCallback(
626
643
  (e) => {
627
644
  const r = { rowIndex: se.current };
628
645
  e.forEach((n) => {
@@ -632,7 +649,7 @@ const pt = i.createContext(void 0), ur = (t) => {
632
649
  [ee]
633
650
  ), te = () => {
634
651
  t.gridProps.forceUpdate && t.gridProps.forceUpdate();
635
- }, Ct = (e) => e.left !== void 0 ? ve !== "rtl" ? { left: e.left, right: e.right } : { left: e.right, right: e.left } : {}, R = i.useRef(null), s = 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), vt = 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), yt = i.useRef(null), wt = i.useRef(null), ve = St(K), xt = i.useMemo(() => i.Children.toArray(t.gridProps.children), [t.gridProps.children]), b = $((xe = t.gridProps.selectable) != null ? xe : !!t.gridProps.selectedField), ye = Kt((Se = t.gridProps.editable) != null ? Se : !!t.gridProps.editField);
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);
636
653
  i.useMemo(() => {
637
654
  M.onConstructor({
638
655
  navigatable: !!t.gridProps.navigatable,
@@ -643,7 +660,7 @@ const pt = i.createContext(void 0), ur = (t) => {
643
660
  }, []), i.useMemo(() => {
644
661
  var n;
645
662
  (n = c.current) == null || n.reset();
646
- const e = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, r = t.isFixedVirtualScroll ? Fe : Jt;
663
+ const e = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, r = t.isFixedVirtualScroll ? Fe : Zt;
647
664
  c.current = new r(e || t.gridProps.rowHeight === void 0 || t.gridProps.rowHeight === 0);
648
665
  }, [
649
666
  t.gridProps.scrollable,
@@ -653,9 +670,9 @@ const pt = i.createContext(void 0), ur = (t) => {
653
670
  t.gridProps.groupable,
654
671
  t.gridProps.sort,
655
672
  t.gridProps.rowHeight
656
- ]), i.useEffect(() => (t.gridProps.clipboard && (U.current = new Mt(ut), U.current.addEventListeners(C())), () => {
657
- U.current && U.current.removeEventListeners(C());
658
- }), [t.gridProps.onClipboard, t.gridProps.clipboard]), i.useEffect(() => (t.gridProps.columnVirtualization && !window.navigator.userAgent.match(jt) && (re.current && (re.current.style.display = "block"), w.current && (w.current.style.display = "block")), Q(), ke(p()), M.onComponentDidMount({
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({
659
676
  scope: K.current || void 0,
660
677
  contextStateRef: y,
661
678
  navigationStateRef: k
@@ -663,7 +680,7 @@ const pt = i.createContext(void 0), ur = (t) => {
663
680
  clearTimeout(le.current);
664
681
  }), []), i.useEffect(() => {
665
682
  var e;
666
- Q(), ke(p()), (e = c.current) != null && e.tableTransform && c.current.table && (c.current.table.style.transform = c.current.tableTransform, c.current.tableTransform = ""), ht(), M.onComponentDidUpdate({
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({
667
684
  scope: K.current || void 0,
668
685
  contextStateRef: y,
669
686
  navigationStateRef: k,
@@ -679,12 +696,12 @@ const pt = i.createContext(void 0), ur = (t) => {
679
696
  rootMargin: "0px",
680
697
  threshold: 0.9
681
698
  };
682
- D.current = window.IntersectionObserver && new window.IntersectionObserver(Ce, e) || null;
699
+ D.current = window.IntersectionObserver && new window.IntersectionObserver(Ee, e) || null;
683
700
  }
684
- }, [Ce]), i.useEffect(() => {
701
+ }, [Ee]), i.useEffect(() => {
685
702
  var r;
686
703
  let e;
687
- return q && window.ResizeObserver && (e = new window.ResizeObserver(It), e.observe((r = C()) == null ? void 0 : r.body)), () => {
704
+ return q && window.ResizeObserver && (e = new window.ResizeObserver(Rt), e.observe((r = E()) == null ? void 0 : r.body)), () => {
688
705
  e == null || e.disconnect();
689
706
  };
690
707
  }, []), i.useImperativeHandle(
@@ -715,28 +732,32 @@ const pt = i.createContext(void 0), ur = (t) => {
715
732
  }
716
733
  })
717
734
  ), i.useImperativeHandle(t.gridRef, () => R.current), i.useMemo(() => {
718
- v.current = new Wt(ft);
735
+ v.current = new qt(mt);
719
736
  }, [t.gridProps.onColumnResize]), i.useMemo(() => {
720
- S.current = new _t(Y, lt, Re);
737
+ S.current = new Xt(Y, st, Re);
721
738
  }, [
722
739
  t.gridProps.onColumnReorder,
723
740
  t.gridProps.onGroupChange,
724
741
  t.gridProps.group,
725
742
  t.gridProps.groupable
726
- ]), v.current.resizable = t.gridProps.resizable || !1, v.current.columns = s.current;
743
+ ]), v.current.resizable = t.gridProps.resizable || !1, v.current.columns = u.current;
727
744
  const we = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1;
728
- return S.current.reorderable = t.gridProps.reorderable || !1, S.current.groupable = we, S.current.columns = s.current, Et(t.total, we), /* @__PURE__ */ i.createElement(
729
- pt.Provider,
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();
747
+ return /* @__PURE__ */ i.createElement(
748
+ rr.Provider,
730
749
  {
731
750
  value: {
732
- isClient: E,
733
- rowReorder: ct,
751
+ isClient: C,
752
+ rowReorder: lt,
734
753
  activeDragRowDataItemRef: j,
735
- reorderRowDragTargetRef: yt,
736
- reorderRowDropTargetRef: wt,
754
+ reorderRowDragTargetRef: xt,
755
+ reorderRowDropTargetRef: St,
737
756
  dir: ve,
738
- getCellPositionStyle: Ct,
757
+ getCellPositionStyle: yt,
739
758
  dataItemKey: t.gridProps.dataItemKey,
759
+ columnsState: Dt,
760
+ onColumnsStateChange: ct,
740
761
  groupChange: J,
741
762
  selectionRelease: Ze,
742
763
  pagerPageChange: at,
@@ -750,7 +771,7 @@ const pt = i.createContext(void 0), ur = (t) => {
750
771
  filterChange: it,
751
772
  searchChange: dt,
752
773
  onHeaderSelectionChange: Qe,
753
- columnGroupChange: st,
774
+ columnGroupChange: ut,
754
775
  onKeyDown: Ue,
755
776
  onFocus: Ve,
756
777
  scrollHandler: Be,
@@ -762,7 +783,7 @@ const pt = i.createContext(void 0), ur = (t) => {
762
783
  navigationStateRef: k,
763
784
  tableElementRef: w,
764
785
  tableBodyElementRef: A,
765
- headerElementRef: vt,
786
+ headerElementRef: wt,
766
787
  containerElementRef: V,
767
788
  headTableElementRef: re,
768
789
  elementRef: K,
@@ -772,9 +793,9 @@ const pt = i.createContext(void 0), ur = (t) => {
772
793
  vsRef: c
773
794
  }
774
795
  },
775
- /* @__PURE__ */ i.createElement(Tt.Provider, { value: y.current }, t.children),
796
+ /* @__PURE__ */ i.createElement(Ft.Provider, { value: y.current }, t.children),
776
797
  /* @__PURE__ */ i.createElement(
777
- Yt,
798
+ pt,
778
799
  {
779
800
  show: h.show,
780
801
  dataItem: h.dataItem,
@@ -788,6 +809,6 @@ const pt = i.createContext(void 0), ur = (t) => {
788
809
  );
789
810
  };
790
811
  export {
791
- ur as GridClientWrapper,
792
- pt as GridContext
812
+ mr as GridClientWrapper,
813
+ rr as GridContext
793
814
  };