@progress/kendo-react-grid 10.2.0-develop.6 → 10.2.0-develop.8

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 { canUseDOM as p, getActiveElement as At, useDir as Ht, setScrollbarWidth as Ae, cloneArray as Ft, getter as ee, RowHeightService as He } from "@progress/kendo-react-common";
11
- import { getSelectionOptions as te, populateClipboardData as Lt, ClipboardActionType as Ie, getEditableOptions as Gt, tableKeyboardNavigation as T, ClipboardService as zt, TableKeyboardNavigationContext as Nt, editReducer as Ot, EDIT_ACTION as Bt, getDetailExpandableOptions as Ut, detailExpandReducer as Fe, getGroupExpandableOptions as Vt, groupExpandReducer as _t, DETAIL_EXPAND_ACTION as Wt, getSelectedState as Le, getSelectedStateFromKeyDown as jt, closestTagName as Ge, getColumnIndex as qt, getRowIndex as Xt, updateLeft as $t, updateRight as Jt } from "@progress/kendo-react-data-tools";
12
- import { ColumnResize as Yt } from "./drag/ColumnResize.mjs";
13
- import { CommonDragLogic as Qt } from "./drag/CommonDragLogic.mjs";
14
- import { SAFARI_REGEX as Zt } from "./constants/index.mjs";
15
- import { getDefaultHeadContextMenuItems as pt, getDefaultBodyContextMenuItems as en, isRowReorderEnabled as tn, sanitizeColumns as nn, getDataAsArray as rn, getFlatColumnsState as on, firefox as ze, firefoxMaxHeight as Ne } from "./utils/index.mjs";
16
- import { VirtualScrollFixed as Oe } from "./VirtualScrollFixed.mjs";
17
- import { VirtualScroll as an } from "./VirtualScroll.mjs";
18
- import { GridContextMenu as dn } from "./contextMenu/GridContextMenu.mjs";
19
- import { GridContextMenuAnchorPart as Be } from "./contextMenu/enums.mjs";
20
- import { normalizeSortable as cn, firstLevelSortSeqMap as ln } from "./sortCommon.mjs";
21
- const sn = i.createContext(void 0), wn = (t) => {
22
- var Te, Me;
23
- const w = t.gridProps.isClient, [b, be] = i.useState({}), Ue = (e) => {
10
+ import { canUseDOM as p, getActiveElement as Ht, useDir as Ft, setScrollbarWidth as He, cloneArray as Lt, getter as ee, RowHeightService as Fe } from "@progress/kendo-react-common";
11
+ import { getSelectionOptions as te, populateClipboardData as Gt, ClipboardActionType as Ie, getEditableOptions as zt, tableKeyboardNavigation as T, ClipboardService as Nt, TableKeyboardNavigationContext as Ot, editReducer as Bt, EDIT_ACTION as Ut, getDetailExpandableOptions as Vt, detailExpandReducer as Le, getGroupExpandableOptions as Wt, groupExpandReducer as _t, DETAIL_EXPAND_ACTION as jt, getSelectedState as Ge, getSelectedStateFromKeyDown as qt, closestTagName as ze, getColumnIndex as Xt, getRowIndex as $t, updateLeft as Jt, updateRight as Yt } from "@progress/kendo-react-data-tools";
12
+ import { ColumnResize as Qt } from "./drag/ColumnResize.mjs";
13
+ import { CommonDragLogic as Zt } from "./drag/CommonDragLogic.mjs";
14
+ import { SAFARI_REGEX as pt } from "./constants/index.mjs";
15
+ import { getDefaultHeadContextMenuItems as en, getDefaultBodyContextMenuItems as tn, isRowReorderEnabled as nn, sanitizeColumns as rn, getDataAsArray as on, getFlatColumnsState as an, firefox as Ne, firefoxMaxHeight as Oe } from "./utils/index.mjs";
16
+ import { VirtualScrollFixed as Be } from "./VirtualScrollFixed.mjs";
17
+ import { VirtualScroll as dn } from "./VirtualScroll.mjs";
18
+ import { GridContextMenu as cn } from "./contextMenu/GridContextMenu.mjs";
19
+ import { GridContextMenuAnchorPart as Ue } from "./contextMenu/enums.mjs";
20
+ import { normalizeSortable as ln, firstLevelSortSeqMap as sn } from "./sortCommon.mjs";
21
+ const un = i.createContext(void 0), yn = (t) => {
22
+ var Me, Ae;
23
+ const w = t.gridProps.isClient, [b, be] = i.useState({}), Ve = (e) => {
24
24
  e.event.preventDefault(), be({
25
25
  ...b,
26
26
  show: !0,
@@ -35,23 +35,23 @@ const sn = i.createContext(void 0), wn = (t) => {
35
35
  be({});
36
36
  }, m = i.useMemo(() => t.columnsRef.find((e) => e.field === b.field), [t.columnsRef, b]), Ce = i.useMemo(() => {
37
37
  const e = t.gridProps.sortable && (m == null ? void 0 : m.sortable);
38
- return pt({
38
+ return en({
39
39
  sortable: !!e,
40
40
  selectable: te(t.gridProps.selectable).enabled,
41
41
  clipboard: !!t.gridProps.clipboard
42
42
  });
43
43
  }, [m, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), ve = i.useMemo(() => {
44
44
  const e = t.gridProps.sortable && (m == null ? void 0 : m.sortable);
45
- return en({
45
+ return tn({
46
46
  sortable: !!e,
47
47
  selectable: te(t.gridProps.selectable).enabled,
48
48
  clipboard: !!t.gridProps.clipboard,
49
- rowReorderable: tn(t.gridProps.rowReorderable)
49
+ rowReorderable: nn(t.gridProps.rowReorderable)
50
50
  });
51
- }, [m, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), Ve = i.useMemo(() => {
51
+ }, [m, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), We = i.useMemo(() => {
52
52
  const e = (m == null ? void 0 : m.contextMenu) || t.gridProps.contextMenu, n = typeof e == "function" ? e(b) : e;
53
53
  if (n && b.offset) {
54
- const o = b.dataItem ? Be.body : Be.head, r = n[o], a = b.dataItem ? ve : Ce;
54
+ const o = b.dataItem ? Ue.body : Ue.head, r = n[o], a = b.dataItem ? ve : Ce;
55
55
  return r === !1 ? void 0 : r === !0 || r === void 0 ? a : r;
56
56
  }
57
57
  }, [t.gridProps.contextMenu, b, ve, Ce, m]), _e = (e) => {
@@ -84,24 +84,24 @@ const sn = i.createContext(void 0), wn = (t) => {
84
84
  switch ((l = n.data) == null ? void 0 : l.action) {
85
85
  case "SortCommand":
86
86
  if (m) {
87
- const B = (u = n.name) == null ? void 0 : u.toLowerCase().includes("asc"), Kt = ((g = n.name) == null ? void 0 : g.toLowerCase().includes("desc")) ? "desc" : void 0, Tt = B ? "asc" : Kt, Mt = n.name ? Tt : void 0;
88
- Ee(e.event.syntheticEvent, m, Mt);
87
+ const B = (u = n.name) == null ? void 0 : u.toLowerCase().includes("asc"), Tt = ((g = n.name) == null ? void 0 : g.toLowerCase().includes("desc")) ? "desc" : void 0, Mt = B ? "asc" : Tt, At = n.name ? Mt : void 0;
88
+ Ee(e.event.syntheticEvent, m, At);
89
89
  }
90
90
  break;
91
91
  case "SelectRowCommand":
92
- it(a);
92
+ dt(a);
93
93
  break;
94
94
  case "SelectAllRowsCommand":
95
- at(a);
95
+ it(a);
96
96
  break;
97
97
  case "ClearSelectionCommand":
98
- dt(a);
98
+ ct(a);
99
99
  break;
100
100
  case "ReorderRowCommand":
101
101
  z.current = e.dataItem, (f = n.name) != null && f.toLowerCase().includes("rowup") && d > 0 && A(e.event.syntheticEvent, d - 1, "before"), (C = n.name) != null && C.toLowerCase().includes("rowdown") && d < r.length - 1 && A(e.event.syntheticEvent, d + 1, "after"), (Z = n.name) != null && Z.toLowerCase().includes("rowtop") && A(e.event.syntheticEvent, 0, "before"), (I = n.name) != null && I.toLowerCase().includes("rowbottom") && A(e.event.syntheticEvent, r.length - 1, "after");
102
102
  break;
103
103
  case "CopySelectionCommand":
104
- W(
104
+ _(
105
105
  Ie.copy,
106
106
  e.event.nativeEvent,
107
107
  {
@@ -112,7 +112,7 @@ const sn = i.createContext(void 0), wn = (t) => {
112
112
  );
113
113
  break;
114
114
  case "PasteCommand":
115
- W(
115
+ _(
116
116
  Ie.paste,
117
117
  e.event.nativeEvent,
118
118
  {
@@ -126,8 +126,8 @@ const sn = i.createContext(void 0), wn = (t) => {
126
126
  Re();
127
127
  }, U = () => {
128
128
  const e = t.columnsRef.filter((n) => n.declarationIndex >= 0 && n.parentIndex === -1);
129
- return nn(e);
130
- }, We = (e, n, o) => {
129
+ return rn(e);
130
+ }, je = (e, n, o) => {
131
131
  if (t.gridProps.onContextMenu && w) {
132
132
  const r = {
133
133
  target: R.current,
@@ -138,12 +138,12 @@ const sn = i.createContext(void 0), wn = (t) => {
138
138
  };
139
139
  s(t.gridProps.onContextMenu, r);
140
140
  }
141
- t.gridProps.contextMenu && Ue({
141
+ t.gridProps.contextMenu && Ve({
142
142
  event: e,
143
143
  dataItem: n,
144
144
  field: o
145
145
  });
146
- }, je = (e) => {
146
+ }, qe = (e) => {
147
147
  if (e.target !== e.currentTarget)
148
148
  return;
149
149
  clearTimeout(me.current), c.current && (c.current.table = x.current);
@@ -153,17 +153,17 @@ const sn = i.createContext(void 0), wn = (t) => {
153
153
  }, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = n), G.current && G.current.setScrollLeft(n), L.current && L.current.setScrollLeft(n), c.current && o !== fe.current && c.current.scrollHandler(e), t.gridProps.onScroll && w && s(t.gridProps.onScroll, {
154
154
  ...P(e)
155
155
  }), fe.current = o;
156
- }, qe = (e) => {
156
+ }, Xe = (e) => {
157
157
  T.onKeyDown(e, {
158
158
  navigatable: t.gridProps.navigatable || !1,
159
159
  contextStateRef: y,
160
- navigationStateRef: k,
161
- onNavigationAction: $e,
160
+ navigationStateRef: D,
161
+ onNavigationAction: Je,
162
162
  columns: U()
163
163
  }), T.onGetSnapshotBeforeUpdate({
164
164
  document: v(),
165
165
  contextStateRef: y,
166
- navigationStateRef: k
166
+ navigationStateRef: D
167
167
  });
168
168
  const n = {
169
169
  dataItems: H(),
@@ -174,13 +174,13 @@ const sn = i.createContext(void 0), wn = (t) => {
174
174
  ...P(e)
175
175
  };
176
176
  t.gridProps.onKeyDown && w && s(t.gridProps.onKeyDown, n);
177
- }, Xe = (e) => {
177
+ }, $e = (e) => {
178
178
  T.onFocus(e, {
179
179
  navigatable: !!t.gridProps.navigatable,
180
180
  contextStateRef: y
181
181
  });
182
- }, $e = (e) => {
183
- if (e.action === "moveToNextPage" && lt(e.event), e.action === "moveToPrevPage" && st(e.event), e.focusElement && e.action === "reorderToRight") {
182
+ }, Je = (e) => {
183
+ if (e.action === "moveToNextPage" && st(e.event), e.action === "moveToPrevPage" && ut(e.event), e.focusElement && e.action === "reorderToRight") {
184
184
  const n = parseInt(e.focusElement.ariaColIndex, 10) - 1;
185
185
  n < t.columnsRef.length - 1 && oe(n, n + 1, e.event);
186
186
  }
@@ -188,27 +188,27 @@ const sn = i.createContext(void 0), wn = (t) => {
188
188
  const n = parseInt(e.focusElement.ariaColIndex, 10) - 1;
189
189
  n > 0 && oe(n, n - 1, e.event);
190
190
  }
191
- if (e.action === "select" && nt(e.event), t.gridProps.onNavigationAction && w) {
191
+ if (e.action === "select" && rt(e.event), t.gridProps.onNavigationAction && w) {
192
192
  const n = {
193
193
  focusElement: e.focusElement,
194
194
  ...P(e.event)
195
195
  };
196
196
  s(t.gridProps.onNavigationAction, n);
197
197
  }
198
- }, Je = (e, n) => {
198
+ }, Ye = (e, n) => {
199
199
  t.gridProps.onRowClick && e.target.nodeName === "TD" && s(t.gridProps.onRowClick, {
200
200
  dataItem: n,
201
201
  ...P(e)
202
202
  });
203
- }, Ye = (e, n) => {
203
+ }, Qe = (e, n) => {
204
204
  t.gridProps.onRowDoubleClick && e.target.nodeName === "TD" && s(t.gridProps.onRowDoubleClick, {
205
205
  dataItem: n,
206
206
  ...P(e)
207
207
  });
208
- }, Qe = (e, n, o) => {
209
- if (Ke.enabled && Ke.mode === "incell" && t.gridProps.dataItemKey) {
210
- const r = Ot(t.gridProps.edit, {
211
- type: Bt.ENTER_FIELD_EDIT,
208
+ }, Ze = (e, n, o) => {
209
+ if (Te.enabled && Te.mode === "incell" && t.gridProps.dataItemKey) {
210
+ const r = Bt(t.gridProps.edit, {
211
+ type: Ut.ENTER_FIELD_EDIT,
212
212
  payload: { id: n[t.gridProps.dataItemKey], field: o }
213
213
  });
214
214
  t.gridProps.onEditChange && s(t.gridProps.onEditChange, {
@@ -216,18 +216,18 @@ const sn = i.createContext(void 0), wn = (t) => {
216
216
  ...P(e)
217
217
  });
218
218
  }
219
- }, Ze = (e, n) => {
219
+ }, pe = (e, n) => {
220
220
  var r;
221
- if (Ut(t.detailExpandable).enabled) {
222
- const a = Fe((r = t.gridProps.detailExpand) != null ? r : {}, e);
221
+ if (Vt(t.detailExpandable).enabled) {
222
+ const a = Le((r = t.gridProps.detailExpand) != null ? r : {}, e);
223
223
  t.gridProps.onDetailExpandChange && s(t.gridProps.onDetailExpandChange, {
224
224
  ...P(n),
225
225
  detailExpand: a
226
226
  });
227
227
  }
228
- }, pe = (e, n) => {
228
+ }, et = (e, n) => {
229
229
  var r;
230
- const o = Vt(
230
+ const o = Wt(
231
231
  typeof t.gridProps.groupable == "object" ? t.gridProps.groupable.expandable !== !1 : t.gridProps.groupable
232
232
  );
233
233
  if (o.enabled) {
@@ -238,17 +238,17 @@ const sn = i.createContext(void 0), wn = (t) => {
238
238
  });
239
239
  }
240
240
  }, Ee = (e, n, o) => {
241
- const { allowUnsort: r, mode: a } = cn(
241
+ const { allowUnsort: r, mode: a } = ln(
242
242
  t.gridProps.sortable || !1,
243
243
  n.sortable || !1
244
- ), d = (t.gridProps.sort || []).filter((g) => g.field === n.field)[0], l = o || ln[r][d && d.dir || ""], u = a === "single" ? [] : (t.gridProps.sort || []).filter((g) => g.field !== n.field);
244
+ ), d = (t.gridProps.sort || []).filter((g) => g.field === n.field)[0], l = o || sn[r][d && d.dir || ""], u = a === "single" ? [] : (t.gridProps.sort || []).filter((g) => g.field !== n.field);
245
245
  l !== "" && n.field && u.push({ field: n.field, dir: l }), we(u, e);
246
- }, et = (e) => {
246
+ }, tt = (e) => {
247
247
  var n;
248
248
  if (e.field === t.gridProps.expandField || e._expand || t.gridProps.group && e.field === void 0) {
249
249
  if (t.gridProps.onExpandChange) {
250
- const o = t.gridProps.dataItemKey ? Fe((n = t.gridProps.detailExpand) != null ? n : {}, {
251
- type: Wt.SET,
250
+ const o = t.gridProps.dataItemKey ? Le((n = t.gridProps.detailExpand) != null ? n : {}, {
251
+ type: jt.SET,
252
252
  id: e.dataItem[t.gridProps.dataItemKey],
253
253
  payload: e.value
254
254
  }) : t.gridProps.detailExpand;
@@ -269,7 +269,7 @@ const sn = i.createContext(void 0), wn = (t) => {
269
269
  field: e.field,
270
270
  value: e.value
271
271
  });
272
- }, tt = (e) => {
272
+ }, nt = (e) => {
273
273
  var n;
274
274
  if (t.gridProps.onSelectionChange && h.enabled) {
275
275
  const { event: o, dataItem: r, dataIndex: a, columnIndex: d } = e, l = {
@@ -292,14 +292,14 @@ const sn = i.createContext(void 0), wn = (t) => {
292
292
  };
293
293
  s(t.gridProps.onSelectionChange, {
294
294
  ...l,
295
- select: t.gridProps.dataItemKey ? Le({
295
+ select: t.gridProps.dataItemKey ? Ge({
296
296
  event: l,
297
297
  selectedState: (n = t.gridProps.select) != null ? n : {},
298
298
  dataItemKey: t.gridProps.dataItemKey
299
299
  }) : {}
300
300
  });
301
301
  }
302
- }, nt = (e) => {
302
+ }, rt = (e) => {
303
303
  var g, f;
304
304
  if (t.gridProps.selectedField || !h.enabled || !t.gridProps.dataItemKey)
305
305
  return;
@@ -310,16 +310,16 @@ const sn = i.createContext(void 0), wn = (t) => {
310
310
  componentId: t.id,
311
311
  selectedField: t.gridProps.selectedField,
312
312
  ...P(e)
313
- }, o = jt({
313
+ }, o = qt({
314
314
  event: n,
315
315
  selectedState: (g = t.gridProps.select) != null ? g : {},
316
316
  dataItemKey: t.gridProps.dataItemKey
317
317
  });
318
318
  if (o === t.gridProps.select)
319
319
  return;
320
- const r = e.target, a = Ge(r, "TD"), d = Ge(r, "TR"), l = qt(a), u = Xt(d);
320
+ const r = e.target, a = ze(r, "TD"), d = ze(r, "TR"), l = Xt(a), u = $t(d);
321
321
  if (l !== void 0 && u !== void 0) {
322
- const C = (f = rn(t.gridProps.data)) == null ? void 0 : f[u];
322
+ const C = (f = on(t.gridProps.data)) == null ? void 0 : f[u];
323
323
  t.gridProps.onSelectionChange && s(t.gridProps.onSelectionChange, {
324
324
  ...n,
325
325
  select: o,
@@ -337,7 +337,7 @@ const sn = i.createContext(void 0), wn = (t) => {
337
337
  isDrag: !1
338
338
  });
339
339
  }
340
- }, rt = (e) => {
340
+ }, ot = (e) => {
341
341
  var n;
342
342
  if (t.gridProps.onHeaderSelectionChange && h.enabled) {
343
343
  const o = H();
@@ -356,7 +356,7 @@ const sn = i.createContext(void 0), wn = (t) => {
356
356
  ...e,
357
357
  select: n
358
358
  });
359
- }, ot = (e) => {
359
+ }, at = (e) => {
360
360
  var n;
361
361
  if (t.gridProps.onSelectionChange && h.enabled) {
362
362
  const o = j()[e.startRowIndex], r = j()[e.endRowIndex], a = {
@@ -369,7 +369,7 @@ const sn = i.createContext(void 0), wn = (t) => {
369
369
  startDataItem: o,
370
370
  endDataItem: r,
371
371
  ...e
372
- }, d = Le({
372
+ }, d = Ge({
373
373
  event: a,
374
374
  selectedState: (n = t.gridProps.select) != null ? n : {},
375
375
  // Thats kinda strange, even through the `dataItemKey` is required by the `getSelectedState`
@@ -378,7 +378,7 @@ const sn = i.createContext(void 0), wn = (t) => {
378
378
  });
379
379
  V(a, d);
380
380
  }
381
- }, at = (e) => {
381
+ }, it = (e) => {
382
382
  if (t.gridProps.onSelectionChange && h.enabled) {
383
383
  const n = e.dataItems[0], o = e.dataItems[e.dataItems.length - 1], r = {}, a = {
384
384
  ...e,
@@ -394,7 +394,7 @@ const sn = i.createContext(void 0), wn = (t) => {
394
394
  r[u] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0;
395
395
  }), V(a, r);
396
396
  }
397
- }, it = (e) => {
397
+ }, dt = (e) => {
398
398
  if (t.gridProps.onSelectionChange && h.enabled) {
399
399
  const o = ee(t.gridProps.dataItemKey)(e.dataItem), r = 0, a = t.columnsRef.length - 1, d = e.dataItems.findIndex(
400
400
  (C) => C[t.gridProps.dataItemKey] === e.dataItem[t.gridProps.dataItemKey]
@@ -409,7 +409,7 @@ const sn = i.createContext(void 0), wn = (t) => {
409
409
  }, f = e.mode === "multiple" ? t.gridProps.select || {} : {};
410
410
  f[o] === !0 || Array.isArray(f[o]) && f[o].length === t.columnsRef.length ? delete f[o] : f[o] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0, V(g, f);
411
411
  }
412
- }, dt = (e) => {
412
+ }, ct = (e) => {
413
413
  t.gridProps.onSelectionChange && h.enabled && V(e, {});
414
414
  }, M = (e, n, o, r, a) => {
415
415
  const d = t.gridProps.onDataStateChange;
@@ -420,11 +420,11 @@ const sn = i.createContext(void 0), wn = (t) => {
420
420
  ...P(r),
421
421
  targetEvent: a || {},
422
422
  dataState: {
423
- ...bt(),
423
+ ...Rt(),
424
424
  ...o
425
425
  }
426
426
  });
427
- }, _ = (e, n, o) => {
427
+ }, W = (e, n, o) => {
428
428
  M(
429
429
  t.gridProps.onPageChange,
430
430
  { page: e },
@@ -432,19 +432,19 @@ const sn = i.createContext(void 0), wn = (t) => {
432
432
  n,
433
433
  o
434
434
  );
435
- }, ct = () => {
435
+ }, lt = () => {
436
436
  let e = t.gridProps.total || 0;
437
437
  return Array.isArray(t.gridProps.data) ? e = e || t.gridProps.data.length : t.gridProps.data && (e = e || t.gridProps.data.total), e;
438
- }, lt = (e) => {
439
- var a, d;
440
- const n = (d = (a = t.gridProps.take) != null ? a : t.gridProps.pageSize) != null ? d : 0, o = (t.gridProps.skip || 0) + n, r = ct();
441
- o < r && _({ skip: o, take: n }, e);
442
438
  }, st = (e) => {
439
+ var a, d;
440
+ const n = (d = (a = t.gridProps.take) != null ? a : t.gridProps.pageSize) != null ? d : 0, o = (t.gridProps.skip || 0) + n, r = lt();
441
+ o < r && W({ skip: o, take: n }, e);
442
+ }, ut = (e) => {
443
443
  var r, a;
444
444
  const n = (a = (r = t.gridProps.take) != null ? r : t.gridProps.pageSize) != null ? a : 0, o = (t.gridProps.skip || 0) - n;
445
- o >= 0 && _({ skip: o, take: n }, e);
446
- }, ut = (e) => {
447
- _({ skip: e.skip, take: e.take }, e.syntheticEvent, e.targetEvent);
445
+ o >= 0 && W({ skip: o, take: n }, e);
446
+ }, gt = (e) => {
447
+ W({ skip: e.skip, take: e.take }, e.syntheticEvent, e.targetEvent);
448
448
  }, we = (e, n) => {
449
449
  M(
450
450
  t.gridProps.onSortChange,
@@ -452,14 +452,14 @@ const sn = i.createContext(void 0), wn = (t) => {
452
452
  { sort: e, ...t.gridProps.scrollable === "virtual" ? { skip: 0 } : {} },
453
453
  n
454
454
  );
455
- }, gt = (e, n) => {
455
+ }, ft = (e, n) => {
456
456
  M(
457
457
  t.gridProps.onFilterChange,
458
458
  { filter: e },
459
459
  { filter: e || void 0, skip: 0 },
460
460
  n
461
461
  );
462
- }, ft = (e) => {
462
+ }, mt = (e) => {
463
463
  const n = t.gridProps.searchFields || t.columnsRef.map((a) => a.field) || [], o = e.nativeEvent.target.value, r = {
464
464
  logic: "or",
465
465
  filters: n.filter((a) => a !== void 0).map((a) => {
@@ -497,7 +497,7 @@ const sn = i.createContext(void 0), wn = (t) => {
497
497
  s(t.gridProps.onColumnsStateChange, n);
498
498
  }
499
499
  }, oe = (e, n, o) => {
500
- const { columnsRef: r, columnsState: a } = t, d = r[e], l = on(a), u = d.depth, g = (I) => {
500
+ const { columnsRef: r, columnsState: a } = t, d = r[e], l = an(a), u = d.depth, g = (I) => {
501
501
  do
502
502
  I++;
503
503
  while (I < r.length && r[I].depth > u);
@@ -509,7 +509,7 @@ const sn = i.createContext(void 0), wn = (t) => {
509
509
  O && (O.orderIndex = N);
510
510
  });
511
511
  const C = r[e].locked && r[n].locked;
512
- $t(t.columnsMapRef, r, C || Y.current), Jt(t.columnsMapRef, r, C || Y.current), le.current && (Y.current = !1, le.current = !1);
512
+ Jt(t.columnsMapRef, r, C || Y.current), Yt(t.columnsMapRef, r, C || Y.current), le.current && (Y.current = !1, le.current = !1);
513
513
  const Z = U();
514
514
  if (de(), t.gridProps.onColumnReorder) {
515
515
  const I = {
@@ -534,7 +534,7 @@ const sn = i.createContext(void 0), wn = (t) => {
534
534
  dragEvent: e,
535
535
  target: R.current
536
536
  }), z.current = null;
537
- }, mt = (e, n, o) => {
537
+ }, Pt = (e, n, o) => {
538
538
  if (t.gridProps.group === void 0)
539
539
  return;
540
540
  const r = t.gridProps.group.slice();
@@ -545,8 +545,8 @@ const sn = i.createContext(void 0), wn = (t) => {
545
545
  return;
546
546
  const a = (t.gridProps.group || []).slice();
547
547
  a.splice(n, 0, { field: r }), ne(a, o);
548
- }, Pt = (e, n) => {
549
- const o = S.current.getCurrentGroupsLength;
548
+ }, ht = (e, n) => {
549
+ const o = k.current.getCurrentGroupsLength;
550
550
  ye(e, o, n);
551
551
  }, ae = () => {
552
552
  let e = 0;
@@ -562,10 +562,13 @@ const sn = i.createContext(void 0), wn = (t) => {
562
562
  e += parseFloat(r.toString());
563
563
  }
564
564
  e = Math.round(e), G.current && G.current.setWidth(e), L.current && L.current.setWidth(e), x.current && (x.current.style.width = e ? e + "px" : "");
565
- }, W = i.useCallback(
565
+ }, xe = () => {
566
+ var e;
567
+ t.gridProps.widthRef && (t.gridProps.widthRef.current = ((e = S.current) == null ? void 0 : e.offsetWidth) || 0);
568
+ }, _ = i.useCallback(
566
569
  (e, n, o, r, a) => {
567
570
  var g;
568
- if (!ht() && !o || !e)
571
+ if (!It() && !o || !e)
569
572
  return;
570
573
  const d = {
571
574
  type: e,
@@ -576,13 +579,13 @@ const sn = i.createContext(void 0), wn = (t) => {
576
579
  field: a,
577
580
  ...typeof t.gridProps.clipboard != "boolean" ? t.gridProps.clipboard : {},
578
581
  ...o
579
- }, l = j(), u = Lt({
582
+ }, l = j(), u = Gt({
580
583
  event: d,
581
584
  data: l,
582
585
  selectedState: (g = t.gridProps.select) != null ? g : {},
583
- previousCopiedItems: ke.current
586
+ previousCopiedItems: De.current
584
587
  });
585
- e !== Ie.paste && (ke.current = u.copiedItems), t.gridProps.onClipboard && w && s(t.gridProps.onClipboard, {
588
+ e !== Ie.paste && (De.current = u.copiedItems), t.gridProps.onClipboard && w && s(t.gridProps.onClipboard, {
586
589
  ...d,
587
590
  ...u
588
591
  });
@@ -594,13 +597,13 @@ const sn = i.createContext(void 0), wn = (t) => {
594
597
  t.gridProps.clipboard,
595
598
  t.gridProps.onClipboard
596
599
  ]
597
- ), ht = () => {
600
+ ), It = () => {
598
601
  var a, d, l;
599
602
  if (!p)
600
603
  return !1;
601
- const e = At(v()), n = e ? e.matches(".k-table-td") ? e : (a = v()) == null ? void 0 : a.body : (d = v()) == null ? void 0 : d.body, o = n.closest(".k-grid-container"), r = n && ((l = K.current) == null ? void 0 : l.contains(n));
604
+ const e = Ht(v()), n = e ? e.matches(".k-table-td") ? e : (a = v()) == null ? void 0 : a.body : (d = v()) == null ? void 0 : d.body, o = n.closest(".k-grid-container"), r = n && ((l = S.current) == null ? void 0 : l.contains(n));
602
605
  return !!(n && r && o);
603
- }, It = (e, n, o, r, a, d, l) => {
606
+ }, bt = (e, n, o, r, a, d, l) => {
604
607
  ae(), Y.current = !0, le.current = !0, t.gridProps.onColumnResize && w && s(t.gridProps.onColumnResize, {
605
608
  columns: U(),
606
609
  nativeEvent: r,
@@ -611,7 +614,7 @@ const sn = i.createContext(void 0), wn = (t) => {
611
614
  end: a,
612
615
  target: R.current
613
616
  }), a && re(d);
614
- }, bt = () => {
617
+ }, Rt = () => {
615
618
  var e;
616
619
  return {
617
620
  filter: t.gridProps.filter,
@@ -624,7 +627,7 @@ const sn = i.createContext(void 0), wn = (t) => {
624
627
  nativeEvent: e && e.nativeEvent,
625
628
  syntheticEvent: e,
626
629
  target: R.current
627
- }), Rt = (e) => ({
630
+ }), Ct = (e) => ({
628
631
  ...e,
629
632
  nativeEvent: void 0,
630
633
  syntheticEvent: void 0,
@@ -636,8 +639,8 @@ const sn = i.createContext(void 0), wn = (t) => {
636
639
  e(n);
637
640
  return;
638
641
  }
639
- e(Rt(n));
640
- }, Ct = () => {
642
+ e(Ct(n));
643
+ }, vt = () => {
641
644
  var e, n, o;
642
645
  if (F.current && ((e = F.current) == null ? void 0 : e.getElementsByClassName("k-grid-edit-row").length) > 0) {
643
646
  ge.current = !1, (n = document.activeElement) != null && n.closest(".k-grid-edit-row") ? ue.current = document.activeElement : ue.current = void 0;
@@ -650,12 +653,12 @@ const sn = i.createContext(void 0), wn = (t) => {
650
653
  var e;
651
654
  if (p)
652
655
  return ((e = q()) == null ? void 0 : e.ownerDocument) || document;
653
- }, q = () => K.current, ie = i.useCallback(
656
+ }, q = () => S.current, ie = i.useCallback(
654
657
  (e) => {
655
658
  var r;
656
659
  if (!c.current || !((r = c.current) != null && r.container) || t.gridProps.scrollable === "none")
657
660
  return;
658
- D.current && D.current.disconnect();
661
+ K.current && K.current.disconnect();
659
662
  const { rowIndex: n } = e, o = q();
660
663
  if (t.gridProps.scrollable === "virtual")
661
664
  c.current.askedSkip = n, c.current.container.scroll(
@@ -668,30 +671,30 @@ const sn = i.createContext(void 0), wn = (t) => {
668
671
  }
669
672
  },
670
673
  [t.gridProps.scrollable]
671
- ), xe = (e) => JSON.stringify(e.map((n) => ({ id: n.id, field: n.field, title: n.title, children: n.children }))), vt = () => xe(Dt) === xe(t.columnsRef), Et = () => {
672
- vt() || de();
673
- }, wt = (e) => {
674
+ ), Se = (e) => JSON.stringify(e.map((n) => ({ id: n.id, field: n.field, title: n.title, children: n.children }))), Et = () => Se(Kt) === Se(t.columnsRef), wt = () => {
675
+ Et() || de();
676
+ }, yt = (e) => {
674
677
  var n, o;
675
678
  if (c.current) {
676
- if (c.current.fixedScroll = t.gridProps.fixedScroll || !1, c.current.PageChange = _, 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 && !Q) {
679
+ if (c.current.fixedScroll = t.gridProps.fixedScroll || !1, c.current.PageChange = W, 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 && !Q) {
677
680
  const r = t.gridProps.rowHeight * e;
678
- c.current.containerHeight = ze ? Math.min(Ne, r) : r;
681
+ c.current.containerHeight = Ne ? Math.min(Oe, r) : r;
679
682
  } else
680
683
  c.current.containerHeight = 1533915;
681
- if (c.current.containerRef = $, c.current.tableBodyRef = F, c.current.table = x.current, c.current instanceof Oe) {
684
+ if (c.current.containerRef = $, c.current.tableBodyRef = F, c.current.table = x.current, c.current instanceof Be) {
682
685
  const { rowHeight: r = 0, detail: a, expandField: d } = t.gridProps;
683
686
  let { detailRowHeight: l = 0 } = t.gridProps;
684
- l = a && d ? l : r, t.isAllData ? (c.current.total = t.dataRef.length, c.current.rowHeightService = new He(
687
+ l = a && d ? l : r, t.isAllData ? (c.current.total = t.dataRef.length, c.current.rowHeightService = new Fe(
685
688
  t.dataRef.length,
686
689
  r,
687
690
  l,
688
691
  t.dataRef
689
- )) : c.current.rowHeightService = new He(e, r, l);
692
+ )) : c.current.rowHeightService = new Fe(e, r, l);
690
693
  const u = c.current.rowHeightService.totalHeight();
691
- c.current.containerHeight = ze ? Math.min(Ne, u) : u;
694
+ c.current.containerHeight = Ne ? Math.min(Oe, u) : u;
692
695
  }
693
696
  }
694
- }, Se = i.useCallback(
697
+ }, ke = i.useCallback(
695
698
  (e) => {
696
699
  const n = { rowIndex: Pe.current };
697
700
  e.forEach((o) => {
@@ -701,18 +704,18 @@ const sn = i.createContext(void 0), wn = (t) => {
701
704
  [ie]
702
705
  ), de = () => {
703
706
  t.gridProps.forceUpdate && t.gridProps.forceUpdate();
704
- }, yt = (e) => e.left !== void 0 ? De !== "rtl" ? { left: e.left, right: e.right } : { left: e.right, right: e.left } : {}, R = i.useRef(null), c = i.useRef(void 0), E = i.useRef(void 0), S = i.useRef(void 0), y = i.useRef(void 0), k = i.useRef(void 0), X = i.useRef(void 0), D = i.useRef(null), F = i.useRef(null), xt = i.useRef(null), $ = i.useRef(null), x = i.useRef(null), ce = i.useRef(null), K = i.useRef(null), L = i.useRef(null), G = i.useRef(null), le = i.useRef(!1), se = i.useRef(!1), J = i.useRef(void 0), ue = i.useRef(void 0), ge = i.useRef(!1), Y = i.useRef(!0), fe = i.useRef(0), me = i.useRef(void 0), Pe = i.useRef(void 0), he = i.useRef([]), ke = i.useRef([]), z = i.useRef(null), St = i.useRef(null), kt = i.useRef(null), De = Ht(K), Dt = i.useMemo(() => i.Children.toArray(t.gridProps.children), [t.gridProps.children]), Q = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, h = te((Te = t.gridProps.selectable) != null ? Te : !!t.gridProps.selectedField), Ke = Gt((Me = t.gridProps.editable) != null ? Me : !!t.gridProps.editField);
707
+ }, xt = (e) => e.left !== void 0 ? Ke !== "rtl" ? { left: e.left, right: e.right } : { left: e.right, right: e.left } : {}, R = i.useRef(null), c = i.useRef(void 0), E = i.useRef(void 0), k = i.useRef(void 0), y = i.useRef(void 0), D = i.useRef(void 0), X = i.useRef(void 0), K = i.useRef(null), F = i.useRef(null), St = i.useRef(null), $ = i.useRef(null), x = i.useRef(null), ce = i.useRef(null), S = i.useRef(null), L = i.useRef(null), G = i.useRef(null), le = i.useRef(!1), se = i.useRef(!1), J = i.useRef(void 0), ue = i.useRef(void 0), ge = i.useRef(!1), Y = i.useRef(!0), fe = i.useRef(0), me = i.useRef(void 0), Pe = i.useRef(void 0), he = i.useRef([]), De = i.useRef([]), z = i.useRef(null), kt = i.useRef(null), Dt = i.useRef(null), Ke = Ft(S), Kt = i.useMemo(() => i.Children.toArray(t.gridProps.children), [t.gridProps.children]), Q = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, h = te((Me = t.gridProps.selectable) != null ? Me : !!t.gridProps.selectedField), Te = zt((Ae = t.gridProps.editable) != null ? Ae : !!t.gridProps.editField);
705
708
  return i.useMemo(() => {
706
709
  T.onConstructor({
707
710
  navigatable: !!t.gridProps.navigatable,
708
711
  contextStateRef: y,
709
- navigationStateRef: k,
712
+ navigationStateRef: D,
710
713
  idPrefix: t.id
711
714
  });
712
715
  }, []), i.useMemo(() => {
713
716
  var n;
714
717
  (n = c.current) == null || n.reset();
715
- const e = t.isFixedVirtualScroll ? Oe : an;
718
+ const e = t.isFixedVirtualScroll ? Be : dn;
716
719
  c.current = new e(Q || t.gridProps.rowHeight === void 0 || t.gridProps.rowHeight === 0);
717
720
  }, [
718
721
  t.gridProps.scrollable,
@@ -722,20 +725,20 @@ const sn = i.createContext(void 0), wn = (t) => {
722
725
  Q,
723
726
  t.gridProps.sort,
724
727
  t.gridProps.rowHeight
725
- ]), i.useEffect(() => (t.gridProps.clipboard && (X.current = new zt(W), X.current.addEventListeners(v())), () => {
728
+ ]), i.useEffect(() => (t.gridProps.clipboard && (X.current = new Nt(_), X.current.addEventListeners(v())), () => {
726
729
  X.current && X.current.removeEventListeners(v());
727
- }), [t.gridProps.onClipboard, t.gridProps.clipboard, W, v]), i.useEffect(() => (t.gridProps.columnVirtualization && !window.navigator.userAgent.match(Zt) && (ce.current && (ce.current.style.display = "block"), x.current && (x.current.style.display = "block")), ae(), Ae(), T.onComponentDidMount({
728
- scope: K.current || void 0,
730
+ }), [t.gridProps.onClipboard, t.gridProps.clipboard, _, v]), i.useEffect(() => (t.gridProps.columnVirtualization && !window.navigator.userAgent.match(pt) && (ce.current && (ce.current.style.display = "block"), x.current && (x.current.style.display = "block")), xe(), ae(), He(), T.onComponentDidMount({
731
+ scope: S.current || void 0,
729
732
  contextStateRef: y,
730
- navigationStateRef: k
733
+ navigationStateRef: D
731
734
  }), () => {
732
735
  clearTimeout(me.current);
733
736
  }), []), i.useEffect(() => {
734
737
  var e;
735
- ae(), Ae(), (e = c.current) != null && e.tableTransform && c.current.table && (c.current.table.style.transform = c.current.tableTransform, c.current.tableTransform = ""), Ct(), T.onComponentDidUpdate({
736
- scope: K.current || void 0,
738
+ xe(), ae(), He(), (e = c.current) != null && e.tableTransform && c.current.table && (c.current.table.style.transform = c.current.tableTransform, c.current.tableTransform = ""), vt(), T.onComponentDidUpdate({
739
+ scope: S.current || void 0,
737
740
  contextStateRef: y,
738
- navigationStateRef: k,
741
+ navigationStateRef: D,
739
742
  focusFirst: se.current,
740
743
  newEditableRow: J.current,
741
744
  singleEditRow: ge.current,
@@ -748,12 +751,12 @@ const sn = i.createContext(void 0), wn = (t) => {
748
751
  rootMargin: "0px",
749
752
  threshold: 0.9
750
753
  };
751
- D.current = window.IntersectionObserver && new window.IntersectionObserver(Se, e) || null;
754
+ K.current = window.IntersectionObserver && new window.IntersectionObserver(ke, e) || null;
752
755
  }
753
- }, [Se]), i.useEffect(() => {
756
+ }, [ke]), i.useEffect(() => {
754
757
  var n;
755
758
  let e;
756
- return p && window.ResizeObserver && (e = new window.ResizeObserver(Et), e.observe((n = v()) == null ? void 0 : n.body)), () => {
759
+ return p && window.ResizeObserver && (e = new window.ResizeObserver(wt), e.observe((n = v()) == null ? void 0 : n.body)), () => {
757
760
  e == null || e.disconnect();
758
761
  };
759
762
  }, []), i.useImperativeHandle(
@@ -773,10 +776,10 @@ const sn = i.createContext(void 0), wn = (t) => {
773
776
  const { rowIndex: n } = e;
774
777
  Pe.current = n;
775
778
  const o = q();
776
- if (D.current && o) {
777
- D.current.disconnect();
779
+ if (K.current && o) {
780
+ K.current.disconnect();
778
781
  const a = o.querySelector(`[absolute-row-index="${Pe.current}"]`);
779
- a ? D.current.observe(a) : ie(e);
782
+ a ? K.current.observe(a) : ie(e);
780
783
  }
781
784
  },
782
785
  fitColumns: (e) => {
@@ -784,71 +787,71 @@ const sn = i.createContext(void 0), wn = (t) => {
784
787
  }
785
788
  })
786
789
  ), i.useImperativeHandle(t.gridRef, () => R.current), i.useMemo(() => {
787
- E.current = new Yt(It);
790
+ E.current = new Qt(bt);
788
791
  }, [t.gridProps.onColumnResize, t.columnsRef]), i.useMemo(() => {
789
- S.current = new Qt(oe, mt, ye);
792
+ k.current = new Zt(oe, Pt, ye);
790
793
  }, [
791
794
  t.gridProps.onColumnReorder,
792
795
  t.gridProps.onGroupChange,
793
796
  t.gridProps.group,
794
797
  t.columnsRef,
795
798
  t.gridProps.groupable
796
- ]), E.current.resizable = t.gridProps.resizable || !1, E.current.columns = t.columnsRef, E.current.columnsState = Ft(t.columnsState), S.current.reorderable = t.gridProps.reorderable || !1, S.current.groupable = Q, S.current.columns = t.columnsRef, wt(t.total), /* @__PURE__ */ i.createElement(
797
- sn.Provider,
799
+ ]), E.current.resizable = t.gridProps.resizable || !1, E.current.columns = t.columnsRef, E.current.columnsState = Lt(t.columnsState), k.current.reorderable = t.gridProps.reorderable || !1, k.current.groupable = Q, k.current.columns = t.columnsRef, yt(t.total), /* @__PURE__ */ i.createElement(
800
+ un.Provider,
798
801
  {
799
802
  value: {
800
803
  isClient: w,
801
804
  rowReorder: A,
802
805
  activeDragRowDataItemRef: z,
803
- reorderRowDragTargetRef: St,
804
- reorderRowDropTargetRef: kt,
805
- dir: De,
806
- getCellPositionStyle: yt,
806
+ reorderRowDragTargetRef: kt,
807
+ reorderRowDropTargetRef: Dt,
808
+ dir: Ke,
809
+ getCellPositionStyle: xt,
807
810
  dataItemKey: t.gridProps.dataItemKey,
808
811
  columnsState: t.columnsState,
809
812
  onColumnsStateChange: re,
810
813
  groupChange: ne,
811
- selectionRelease: ot,
812
- pagerPageChange: ut,
813
- onContextMenu: We,
814
- rowClick: Je,
815
- rowDblClick: Ye,
816
- cellClick: Qe,
814
+ selectionRelease: at,
815
+ pagerPageChange: gt,
816
+ onContextMenu: je,
817
+ rowClick: Ye,
818
+ rowDblClick: Qe,
819
+ cellClick: Ze,
817
820
  headerCellClick: Ee,
818
- itemChange: et,
821
+ itemChange: tt,
819
822
  sortChange: we,
820
- filterChange: gt,
821
- searchChange: ft,
822
- onHeaderSelectionChange: rt,
823
- columnGroupChange: Pt,
824
- onKeyDown: qe,
825
- onFocus: Xe,
826
- scrollHandler: je,
827
- selectionChange: tt,
828
- dispatchDetailExpand: Ze,
829
- dispatchGroupExpand: pe,
823
+ filterChange: ft,
824
+ searchChange: mt,
825
+ onHeaderSelectionChange: ot,
826
+ columnGroupChange: ht,
827
+ onKeyDown: Xe,
828
+ onFocus: $e,
829
+ scrollHandler: qe,
830
+ selectionChange: nt,
831
+ dispatchDetailExpand: pe,
832
+ dispatchGroupExpand: et,
830
833
  columnResizeRef: E,
831
- dragLogicRef: S,
832
- navigationStateRef: k,
834
+ dragLogicRef: k,
835
+ navigationStateRef: D,
833
836
  tableElementRef: x,
834
837
  tableBodyElementRef: F,
835
- headerElementRef: xt,
838
+ headerElementRef: St,
836
839
  containerElementRef: $,
837
840
  headTableElementRef: ce,
838
- elementRef: K,
841
+ elementRef: S,
839
842
  footerRef: L,
840
843
  headerRef: G,
841
844
  vsRef: c
842
845
  }
843
846
  },
844
- /* @__PURE__ */ i.createElement(Nt.Provider, { value: y.current }, t.children),
847
+ /* @__PURE__ */ i.createElement(Ot.Provider, { value: y.current }, t.children),
845
848
  /* @__PURE__ */ i.createElement(
846
- dn,
849
+ cn,
847
850
  {
848
851
  show: b.show,
849
852
  dataItem: b.dataItem,
850
853
  field: b.field,
851
- items: Ve,
854
+ items: We,
852
855
  offset: b.offset,
853
856
  onClose: Re,
854
857
  onSelect: _e
@@ -857,6 +860,6 @@ const sn = i.createContext(void 0), wn = (t) => {
857
860
  );
858
861
  };
859
862
  export {
860
- wn as GridClientWrapper,
861
- sn as GridContext
863
+ yn as GridClientWrapper,
864
+ un as GridContext
862
865
  };