@progress/kendo-react-grid 10.1.1-develop.1 → 10.2.0-develop.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,22 +7,22 @@
7
7
  */
8
8
  "use client";
9
9
  import * as i from "react";
10
- import { canUseDOM as Z, getActiveElement as At, useDir as Ht, setScrollbarWidth as Ae, cloneArray as Ft, getter as p, RowHeightService as He } from "@progress/kendo-react-common";
11
- import { getSelectionOptions as ee, populateClipboardData as Lt, ClipboardActionType as he, 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 an, firefox as ze, firefoxMaxHeight as Ne } from "./utils/index.mjs";
16
- import { VirtualScrollFixed as Oe } from "./VirtualScrollFixed.mjs";
17
- import { VirtualScroll as on } 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, [I, be] = i.useState({}), Ue = (e) => {
24
- e.event.preventDefault(), be({
25
- ...I,
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 be, 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, Re] = i.useState({}), Ve = (e) => {
24
+ e.event.preventDefault(), Re({
25
+ ...b,
26
26
  show: !0,
27
27
  offset: {
28
28
  left: e.event.pageX,
@@ -31,43 +31,43 @@ const sn = i.createContext(void 0), wn = (t) => {
31
31
  dataItem: e.dataItem,
32
32
  field: e.field
33
33
  });
34
- }, Ie = () => {
35
- be({});
36
- }, m = i.useMemo(() => t.columnsRef.find((e) => e.field === I.field), [t.columnsRef, I]), Re = i.useMemo(() => {
34
+ }, Ce = () => {
35
+ Re({});
36
+ }, m = i.useMemo(() => t.columnsRef.find((e) => e.field === b.field), [t.columnsRef, b]), ve = 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
- selectable: ee(t.gridProps.selectable).enabled,
40
+ selectable: te(t.gridProps.selectable).enabled,
41
41
  clipboard: !!t.gridProps.clipboard
42
42
  });
43
- }, [m, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), Ce = i.useMemo(() => {
43
+ }, [m, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), Ee = 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
- selectable: ee(t.gridProps.selectable).enabled,
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(() => {
52
- const e = (m == null ? void 0 : m.contextMenu) || t.gridProps.contextMenu, n = typeof e == "function" ? e(I) : e;
53
- if (n && I.offset) {
54
- const r = I.dataItem ? Be.body : Be.head, a = n[r], o = I.dataItem ? Ce : Re;
55
- return a === !1 ? void 0 : a === !0 || a === void 0 ? o : a;
51
+ }, [m, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), We = i.useMemo(() => {
52
+ const e = (m == null ? void 0 : m.contextMenu) || t.gridProps.contextMenu, n = typeof e == "function" ? e(b) : e;
53
+ if (n && b.offset) {
54
+ const o = b.dataItem ? Ue.body : Ue.head, r = n[o], a = b.dataItem ? Ee : ve;
55
+ return r === !1 ? void 0 : r === !0 || r === void 0 ? a : r;
56
56
  }
57
- }, [t.gridProps.contextMenu, I, Ce, Re, m]), _e = (e) => {
58
- var l, u, g, f, C, Q, b, N, O;
59
- const n = e.event.item, r = {
57
+ }, [t.gridProps.contextMenu, b, Ee, ve, m]), _e = (e) => {
58
+ var l, u, g, f, C, Z, I, N, O;
59
+ const n = e.event.item, o = {
60
60
  target: R.current,
61
61
  syntheticEvent: e.event.syntheticEvent,
62
62
  nativeEvent: e.event.nativeEvent,
63
63
  menuItem: n,
64
64
  ...e
65
65
  };
66
- t.gridProps.onContextMenuItemClick && s(t.gridProps.onContextMenuItemClick, r);
67
- const a = j(), o = {
66
+ t.gridProps.onContextMenuItemClick && s(t.gridProps.onContextMenuItemClick, o);
67
+ const r = j(), a = {
68
68
  selectedField: t.gridProps.selectedField || "",
69
69
  componentId: t.id,
70
- dataItems: a,
70
+ dataItems: r,
71
71
  dataItem: e.dataItem,
72
72
  startRowIndex: -1,
73
73
  endRowIndex: -1,
@@ -78,31 +78,31 @@ const sn = i.createContext(void 0), wn = (t) => {
78
78
  metaKey: !1,
79
79
  shiftKey: !1,
80
80
  isDrag: !1,
81
- ...ee(t.gridProps.selectable),
82
- ...r
83
- }, d = a.findIndex((B) => B === e.dataItem);
81
+ ...te(t.gridProps.selectable),
82
+ ...o
83
+ }, d = r.findIndex((B) => B === e.dataItem);
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
- ve(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
+ we(e.event.syntheticEvent, m, At);
89
89
  }
90
90
  break;
91
91
  case "SelectRowCommand":
92
- it(o);
92
+ dt(a);
93
93
  break;
94
94
  case "SelectAllRowsCommand":
95
- ot(o);
95
+ it(a);
96
96
  break;
97
97
  case "ClearSelectionCommand":
98
- dt(o);
98
+ ct(a);
99
99
  break;
100
100
  case "ReorderRowCommand":
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 < a.length - 1 && A(e.event.syntheticEvent, d + 1, "after"), (Q = n.name) != null && Q.toLowerCase().includes("rowtop") && A(e.event.syntheticEvent, 0, "before"), (b = n.name) != null && b.toLowerCase().includes("rowbottom") && A(e.event.syntheticEvent, a.length - 1, "after");
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(
105
- he.copy,
104
+ _(
105
+ be.copy,
106
106
  e.event.nativeEvent,
107
107
  {
108
108
  copyHeaders: !((N = n.name) != null && N.toLowerCase().includes("noheaders"))
@@ -112,8 +112,8 @@ const sn = i.createContext(void 0), wn = (t) => {
112
112
  );
113
113
  break;
114
114
  case "PasteCommand":
115
- W(
116
- he.paste,
115
+ _(
116
+ be.paste,
117
117
  e.event.nativeEvent,
118
118
  {
119
119
  copyHeaders: !((O = n.name) != null && O.toLowerCase().includes("noheaders"))
@@ -123,47 +123,47 @@ const sn = i.createContext(void 0), wn = (t) => {
123
123
  );
124
124
  break;
125
125
  }
126
- Ie();
126
+ Ce();
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, r) => {
129
+ return rn(e);
130
+ }, je = (e, n, o) => {
131
131
  if (t.gridProps.onContextMenu && w) {
132
- const a = {
132
+ const r = {
133
133
  target: R.current,
134
134
  syntheticEvent: e,
135
135
  nativeEvent: e.nativeEvent,
136
136
  dataItem: n,
137
- field: r
137
+ field: o
138
138
  };
139
- s(t.gridProps.onContextMenu, a);
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
- field: r
144
+ field: o
145
145
  });
146
- }, je = (e) => {
146
+ }, qe = (e) => {
147
147
  if (e.target !== e.currentTarget)
148
148
  return;
149
- clearTimeout(fe.current), c.current && (c.current.table = x.current);
150
- const n = e.currentTarget.scrollLeft, r = e.currentTarget.scrollTop, a = t.gridProps.scrollable === "virtual";
151
- t.gridProps.columnVirtualization && (!a || r === ge.current) && (fe.current = window.setTimeout(() => {
152
- ie();
153
- }, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = n), G.current && G.current.setScrollLeft(n), L.current && L.current.setScrollLeft(n), c.current && r !== ge.current && c.current.scrollHandler(e), t.gridProps.onScroll && w && s(t.gridProps.onScroll, {
149
+ clearTimeout(me.current), c.current && (c.current.table = S.current);
150
+ const n = e.currentTarget.scrollLeft, o = e.currentTarget.scrollTop, r = t.gridProps.scrollable === "virtual";
151
+ t.gridProps.columnVirtualization && (!r || o === fe.current) && (me.current = window.setTimeout(() => {
152
+ de();
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
- }), ge.current = r;
156
- }, qe = (e) => {
155
+ }), fe.current = o;
156
+ }, Xe = (e) => {
157
157
  T.onKeyDown(e, {
158
158
  navigatable: t.gridProps.navigatable || !1,
159
- contextStateRef: y,
160
- navigationStateRef: k,
161
- onNavigationAction: $e,
159
+ contextStateRef: x,
160
+ navigationStateRef: D,
161
+ onNavigationAction: Je,
162
162
  columns: U()
163
163
  }), T.onGetSnapshotBeforeUpdate({
164
164
  document: v(),
165
- contextStateRef: y,
166
- navigationStateRef: k
165
+ contextStateRef: x,
166
+ navigationStateRef: D
167
167
  });
168
168
  const n = {
169
169
  dataItems: H(),
@@ -174,87 +174,87 @@ 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
- contextStateRef: y
180
+ contextStateRef: x
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
- n < t.columnsRef.length - 1 && re(n, n + 1, e.event);
185
+ n < t.columnsRef.length - 1 && oe(n, n + 1, e.event);
186
186
  }
187
187
  if (e.focusElement && e.action === "reorderToLeft") {
188
188
  const n = parseInt(e.focusElement.ariaColIndex, 10) - 1;
189
- n > 0 && re(n, n - 1, e.event);
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, r) => {
209
- if (De.enabled && De.mode === "incell" && t.gridProps.dataItemKey) {
210
- const a = Ot(t.gridProps.edit, {
211
- type: Bt.ENTER_FIELD_EDIT,
212
- payload: { id: n[t.gridProps.dataItemKey], field: r }
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
+ payload: { id: n[t.gridProps.dataItemKey], field: o }
213
213
  });
214
214
  t.gridProps.onEditChange && s(t.gridProps.onEditChange, {
215
- edit: a,
215
+ edit: r,
216
216
  ...P(e)
217
217
  });
218
218
  }
219
- }, Ze = (e, n) => {
220
- var a;
221
- if (Ut(t.detailExpandable).enabled) {
222
- const o = Fe((a = t.gridProps.detailExpand) != null ? a : {}, e);
219
+ }, pe = (e, n) => {
220
+ var r;
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
- detailExpand: o
225
+ detailExpand: a
226
226
  });
227
227
  }
228
- }, pe = (e, n) => {
229
- var a;
230
- const r = Vt(
228
+ }, et = (e, n) => {
229
+ var r;
230
+ const o = Wt(
231
231
  typeof t.gridProps.groupable == "object" ? t.gridProps.groupable.expandable !== !1 : t.gridProps.groupable
232
232
  );
233
- if (r.enabled) {
234
- const o = _t((a = t.gridProps.groupExpand) != null ? a : [], e, r);
233
+ if (o.enabled) {
234
+ const a = _t((r = t.gridProps.groupExpand) != null ? r : [], e, o);
235
235
  t.gridProps.onGroupExpandChange && s(t.gridProps.onGroupExpandChange, {
236
236
  ...P(n),
237
- groupExpand: o
237
+ groupExpand: a
238
238
  });
239
239
  }
240
- }, ve = (e, n, r) => {
241
- const { allowUnsort: a, mode: o } = cn(
240
+ }, we = (e, n, o) => {
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 = r || ln[a][d && d.dir || ""], u = o === "single" ? [] : (t.gridProps.sort || []).filter((g) => g.field !== n.field);
245
- l !== "" && n.field && u.push({ field: n.field, dir: l }), Ee(u, e);
246
- }, et = (e) => {
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
+ l !== "" && n.field && u.push({ field: n.field, dir: l }), ye(u, 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 r = 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;
255
255
  s(t.gridProps.onExpandChange, {
256
256
  ...P(e.syntheticEvent),
257
- expand: r,
257
+ expand: o,
258
258
  dataItem: e.dataItem,
259
259
  dataIndex: e.dataIndex,
260
260
  value: e.value
@@ -269,16 +269,16 @@ 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
- const { event: r, dataItem: a, dataIndex: o, columnIndex: d } = e, l = {
276
- ...P(r.syntheticEvent),
277
- dataItem: a,
275
+ const { event: o, dataItem: r, dataIndex: a, columnIndex: d } = e, l = {
276
+ ...P(o.syntheticEvent),
277
+ dataItem: r,
278
278
  startColIndex: d,
279
279
  endColIndex: d,
280
- startRowIndex: o,
281
- endRowIndex: o,
280
+ startRowIndex: a,
281
+ endRowIndex: a,
282
282
  dataItems: H(),
283
283
  altKey: !1,
284
284
  ctrlKey: !1,
@@ -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,19 +310,19 @@ const sn = i.createContext(void 0), wn = (t) => {
310
310
  componentId: t.id,
311
311
  selectedField: t.gridProps.selectedField,
312
312
  ...P(e)
313
- }, r = 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
- if (r === t.gridProps.select)
318
+ if (o === t.gridProps.select)
319
319
  return;
320
- const a = e.target, o = Ge(a, "TD"), d = Ge(a, "TR"), l = qt(o), 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
- select: r,
325
+ select: o,
326
326
  dataItem: C,
327
327
  startRowIndex: u,
328
328
  startColIndex: l,
@@ -337,17 +337,17 @@ 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
- const r = H();
343
+ const o = H();
344
344
  s(t.gridProps.onHeaderSelectionChange, {
345
- select: e.syntheticEvent.target.checked ? r.reduce((a, o) => (t.gridProps.dataItemKey && p(t.gridProps.dataItemKey)(o) !== void 0 && (a[p(t.gridProps.dataItemKey)(o)] = !0), a), {}) : {},
345
+ select: e.syntheticEvent.target.checked ? o.reduce((r, a) => (t.gridProps.dataItemKey && ee(t.gridProps.dataItemKey)(a) !== void 0 && (r[ee(t.gridProps.dataItemKey)(a)] = !0), r), {}) : {},
346
346
  field: e.field,
347
347
  nativeEvent: e.syntheticEvent && e.syntheticEvent.nativeEvent,
348
348
  syntheticEvent: e.syntheticEvent,
349
349
  target: R.current,
350
- dataItems: r,
350
+ dataItems: o,
351
351
  selectedField: (n = t.gridProps.selectedField) != null ? n : ""
352
352
  });
353
353
  }
@@ -359,44 +359,44 @@ const sn = i.createContext(void 0), wn = (t) => {
359
359
  }, at = (e) => {
360
360
  var n;
361
361
  if (t.gridProps.onSelectionChange && h.enabled) {
362
- const r = j()[e.startRowIndex], a = j()[e.endRowIndex], o = {
362
+ const o = j()[e.startRowIndex], r = j()[e.endRowIndex], a = {
363
363
  syntheticEvent: void 0,
364
364
  target: R.current,
365
365
  selectedField: t.gridProps.selectedField || "",
366
366
  componentId: t.id,
367
367
  dataItems: H(),
368
368
  dataItem: null,
369
- startDataItem: r,
370
- endDataItem: a,
369
+ startDataItem: o,
370
+ endDataItem: r,
371
371
  ...e
372
- }, d = Le({
373
- event: o,
372
+ }, d = Ge({
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`
376
376
  // it does work correctly even without it
377
377
  dataItemKey: t.gridProps.dataItemKey
378
378
  });
379
- V(o, d);
379
+ V(a, d);
380
380
  }
381
- }, ot = (e) => {
381
+ }, it = (e) => {
382
382
  if (t.gridProps.onSelectionChange && h.enabled) {
383
- const n = e.dataItems[0], r = e.dataItems[e.dataItems.length - 1], a = {}, o = {
383
+ const n = e.dataItems[0], o = e.dataItems[e.dataItems.length - 1], r = {}, a = {
384
384
  ...e,
385
385
  startDataItem: n,
386
- endDataItem: r,
386
+ endDataItem: o,
387
387
  startRowIndex: 0,
388
388
  endRowIndex: e.dataItems.length - 1,
389
389
  startColIndex: 0,
390
390
  endColIndex: t.columnsRef.length - 1
391
391
  };
392
392
  e.dataItems.forEach((d) => {
393
- const u = p(t.gridProps.dataItemKey)(d);
394
- a[u] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0;
395
- }), V(o, a);
393
+ const u = ee(t.gridProps.dataItemKey)(d);
394
+ r[u] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0;
395
+ }), V(a, r);
396
396
  }
397
- }, it = (e) => {
397
+ }, dt = (e) => {
398
398
  if (t.gridProps.onSelectionChange && h.enabled) {
399
- const r = p(t.gridProps.dataItemKey)(e.dataItem), a = 0, o = t.columnsRef.length - 1, d = e.dataItems.findIndex(
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]
401
401
  ), g = {
402
402
  ...e,
@@ -404,91 +404,91 @@ const sn = i.createContext(void 0), wn = (t) => {
404
404
  endDataItem: d,
405
405
  startRowIndex: d,
406
406
  endRowIndex: d,
407
- startColIndex: a,
408
- endColIndex: o
407
+ startColIndex: r,
408
+ endColIndex: a
409
409
  }, f = e.mode === "multiple" ? t.gridProps.select || {} : {};
410
- f[r] === !0 || Array.isArray(f[r]) && f[r].length === t.columnsRef.length ? delete f[r] : f[r] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0, V(g, f);
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
- }, M = (e, n, r, a, o) => {
414
+ }, M = (e, n, o, r, a) => {
415
415
  const d = t.gridProps.onDataStateChange;
416
416
  if (e) {
417
- const l = { ...P(a), ...n, targetEvent: o };
417
+ const l = { ...P(r), ...n, targetEvent: a };
418
418
  s(e, l);
419
419
  } else d && s(d, {
420
- ...P(a),
421
- targetEvent: o || {},
420
+ ...P(r),
421
+ targetEvent: a || {},
422
422
  dataState: {
423
- ...It(),
424
- ...r
423
+ ...Rt(),
424
+ ...o
425
425
  }
426
426
  });
427
- }, _ = (e, n, r) => {
427
+ }, W = (e, n, o) => {
428
428
  M(
429
429
  t.gridProps.onPageChange,
430
430
  { page: e },
431
431
  { skip: e.skip, take: e.take },
432
432
  n,
433
- r
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 o, d;
440
- const n = (d = (o = t.gridProps.take) != null ? o : t.gridProps.pageSize) != null ? d : 0, r = (t.gridProps.skip || 0) + n, a = ct();
441
- r < a && _({ skip: r, take: n }, e);
442
438
  }, st = (e) => {
443
- var a, o;
444
- const n = (o = (a = t.gridProps.take) != null ? a : t.gridProps.pageSize) != null ? o : 0, r = (t.gridProps.skip || 0) - n;
445
- r >= 0 && _({ skip: r, take: n }, 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);
446
442
  }, ut = (e) => {
447
- _({ skip: e.skip, take: e.take }, e.syntheticEvent, e.targetEvent);
448
- }, Ee = (e, n) => {
443
+ var r, a;
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 && W({ skip: o, take: n }, e);
446
+ }, gt = (e) => {
447
+ W({ skip: e.skip, take: e.take }, e.syntheticEvent, e.targetEvent);
448
+ }, ye = (e, n) => {
449
449
  M(
450
450
  t.gridProps.onSortChange,
451
451
  { sort: e },
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) => {
463
- const n = t.gridProps.searchFields || t.columnsRef.map((o) => o.field) || [], r = e.nativeEvent.target.value, a = {
462
+ }, mt = (e) => {
463
+ const n = t.gridProps.searchFields || t.columnsRef.map((a) => a.field) || [], o = e.nativeEvent.target.value, r = {
464
464
  logic: "or",
465
- filters: n.filter((o) => o !== void 0).map((o) => {
465
+ filters: n.filter((a) => a !== void 0).map((a) => {
466
466
  var d;
467
- return typeof o == "string" ? { field: o, value: r, operator: "contains" } : {
468
- value: r,
469
- operator: (d = o.operator) != null ? d : "contains",
470
- field: o.field,
471
- ignoreCase: o.ignoreCase
467
+ return typeof a == "string" ? { field: a, value: o, operator: "contains" } : {
468
+ value: o,
469
+ operator: (d = a.operator) != null ? d : "contains",
470
+ field: a.field,
471
+ ignoreCase: a.ignoreCase
472
472
  };
473
473
  })
474
474
  };
475
475
  M(
476
476
  t.gridProps.onSearchChange,
477
477
  {
478
- search: a
478
+ search: r
479
479
  },
480
480
  {},
481
481
  e.syntheticEvent
482
482
  );
483
- }, te = (e, n) => {
484
- const r = n.nativeEvent ? n : { nativeEvent: n.nativeEvent || n.originalEvent };
485
- e.length === 0 && t.gridProps.navigatable && (le.current = !0), M(
483
+ }, ne = (e, n) => {
484
+ const o = n.nativeEvent ? n : { nativeEvent: n.nativeEvent || n.originalEvent };
485
+ e.length === 0 && t.gridProps.navigatable && (se.current = !0), M(
486
486
  t.gridProps.onGroupChange,
487
487
  { group: e },
488
488
  { group: e, skip: 0 },
489
- r
489
+ o
490
490
  );
491
- }, ne = (e) => {
491
+ }, re = (e) => {
492
492
  if (t.gridProps.onColumnsStateChange) {
493
493
  const n = {
494
494
  target: R.current,
@@ -496,93 +496,96 @@ const sn = i.createContext(void 0), wn = (t) => {
496
496
  };
497
497
  s(t.gridProps.onColumnsStateChange, n);
498
498
  }
499
- }, re = (e, n, r) => {
500
- const { columnsRef: a, columnsState: o } = t, d = a[e], l = an(o), u = d.depth, g = (b) => {
499
+ }, oe = (e, n, o) => {
500
+ const { columnsRef: r, columnsState: a } = t, d = r[e], l = an(a), u = d.depth, g = (I) => {
501
501
  do
502
- b++;
503
- while (b < a.length && a[b].depth > u);
504
- return b;
505
- }, f = a.splice(e, g(e) - e);
506
- a.splice(e < n ? g(n - f.length) : n, 0, ...f), a.filter((b) => b.declarationIndex >= 0).forEach((b, N) => {
507
- b.orderIndex = N;
508
- const O = l.find((B) => B.id === b.id);
502
+ I++;
503
+ while (I < r.length && r[I].depth > u);
504
+ return I;
505
+ }, f = r.splice(e, g(e) - e);
506
+ r.splice(e < n ? g(n - f.length) : n, 0, ...f), r.filter((I) => I.declarationIndex >= 0).forEach((I, N) => {
507
+ I.orderIndex = N;
508
+ const O = l.find((B) => B.id === I.id);
509
509
  O && (O.orderIndex = N);
510
510
  });
511
- const C = a[e].locked && a[n].locked;
512
- $t(t.columnsMapRef, a, C || Y.current), Jt(t.columnsMapRef, a, C || Y.current), ce.current && (Y.current = !1, ce.current = !1);
513
- const Q = U();
514
- if (ie(), t.gridProps.onColumnReorder) {
515
- const b = {
511
+ const C = r[e].locked && r[n].locked;
512
+ Jt(t.columnsMapRef, r, C || Y.current), Yt(t.columnsMapRef, r, C || Y.current), le.current && (Y.current = !1, le.current = !1);
513
+ const Z = U();
514
+ if (de(), t.gridProps.onColumnReorder) {
515
+ const I = {
516
516
  target: R.current,
517
- columns: Q,
517
+ columns: Z,
518
518
  columnId: d.id,
519
- nativeEvent: r
519
+ nativeEvent: o
520
520
  };
521
- s(t.gridProps.onColumnReorder, b);
521
+ s(t.gridProps.onColumnReorder, I);
522
522
  }
523
- ne(o);
524
- }, A = (e, n, r) => {
525
- const a = typeof t.gridProps.rowReorderable == "object" ? t.gridProps.rowReorderable.enabled : t.gridProps.rowReorderable;
526
- if (r === "forbidden" || !a || !z.current)
523
+ re(a);
524
+ }, A = (e, n, o) => {
525
+ const r = typeof t.gridProps.rowReorderable == "object" ? t.gridProps.rowReorderable.enabled : t.gridProps.rowReorderable;
526
+ if (o === "forbidden" || !r || !z.current)
527
527
  return;
528
- const { slicedData: o, dataRef: d } = t, l = (o || d)[n];
528
+ const { slicedData: a, dataRef: d } = t, l = (a || d)[n];
529
529
  t.gridProps.onRowReorder && s(t.gridProps.onRowReorder, {
530
530
  draggedDataItems: [z.current],
531
531
  droppedDataItem: l == null ? void 0 : l.dataItem,
532
- dropPosition: r,
532
+ dropPosition: o,
533
533
  nativeEvent: e.originalEvent,
534
534
  dragEvent: e,
535
535
  target: R.current
536
536
  }), z.current = null;
537
- }, mt = (e, n, r) => {
537
+ }, Pt = (e, n, o) => {
538
538
  if (t.gridProps.group === void 0)
539
539
  return;
540
- const a = t.gridProps.group.slice();
541
- a.splice(n, 0, ...a.splice(e, 1)), te(a, r);
542
- }, we = (e, n, r) => {
543
- const a = t.columnsRef[e].field;
544
- if (!a)
540
+ const r = t.gridProps.group.slice();
541
+ r.splice(n, 0, ...r.splice(e, 1)), ne(r, o);
542
+ }, xe = (e, n, o) => {
543
+ const r = t.columnsRef[e].field;
544
+ if (!r)
545
545
  return;
546
- const o = (t.gridProps.group || []).slice();
547
- o.splice(n, 0, { field: a }), te(o, r);
548
- }, Pt = (e, n) => {
549
- const r = S.current.getCurrentGroupsLength;
550
- we(e, r, n);
546
+ const a = (t.gridProps.group || []).slice();
547
+ a.splice(n, 0, { field: r }), ne(a, o);
548
+ }, ht = (e, n) => {
549
+ const o = y.current.getCurrentGroupsLength;
550
+ xe(e, o, n);
551
551
  }, ae = () => {
552
552
  let e = 0;
553
553
  if (!E.current.colGroupMain)
554
554
  return;
555
555
  const n = E.current.colGroupMain.children;
556
- for (let r = 0; r < n.length; r++) {
557
- const a = n[r].width;
558
- if (!a) {
556
+ for (let o = 0; o < n.length; o++) {
557
+ const r = n[o].width;
558
+ if (!r) {
559
559
  e = 0;
560
560
  break;
561
561
  }
562
- e += parseFloat(a.toString());
562
+ e += parseFloat(r.toString());
563
563
  }
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(
566
- (e, n, r, a, o) => {
564
+ e = Math.round(e), G.current && G.current.setWidth(e), L.current && L.current.setWidth(e), S.current && (S.current.style.width = e ? e + "px" : "");
565
+ }, Se = () => {
566
+ var e;
567
+ t.gridProps.widthRef && (t.gridProps.widthRef.current = ((e = k.current) == null ? void 0 : e.offsetWidth) || 0);
568
+ }, _ = i.useCallback(
569
+ (e, n, o, r, a) => {
567
570
  var g;
568
- if (!ht() && !r || !e)
571
+ if (!It() && !o || !e)
569
572
  return;
570
573
  const d = {
571
574
  type: e,
572
575
  nativeEvent: n,
573
576
  columns: t.columnsRef,
574
577
  dataItemKey: t.gridProps.dataItemKey || "",
575
- dataItem: a,
576
- field: o,
578
+ dataItem: r,
579
+ field: a,
577
580
  ...typeof t.gridProps.clipboard != "boolean" ? t.gridProps.clipboard : {},
578
- ...r
579
- }, l = j(), u = Lt({
581
+ ...o
582
+ }, l = j(), u = Gt({
580
583
  event: d,
581
584
  data: l,
582
585
  selectedState: (g = t.gridProps.select) != null ? g : {},
583
- previousCopiedItems: Se.current
586
+ previousCopiedItems: Ke.current
584
587
  });
585
- e !== he.paste && (Se.current = u.copiedItems), t.gridProps.onClipboard && w && s(t.gridProps.onClipboard, {
588
+ e !== be.paste && (Ke.current = u.copiedItems), t.gridProps.onClipboard && w && s(t.gridProps.onClipboard, {
586
589
  ...d,
587
590
  ...u
588
591
  });
@@ -594,24 +597,24 @@ const sn = i.createContext(void 0), wn = (t) => {
594
597
  t.gridProps.clipboard,
595
598
  t.gridProps.onClipboard
596
599
  ]
597
- ), ht = () => {
598
- var o, d, l;
599
- if (!Z)
600
+ ), It = () => {
601
+ var a, d, l;
602
+ if (!p)
600
603
  return !1;
601
- const e = At(v()), n = e ? e.matches(".k-table-td") ? e : (o = v()) == null ? void 0 : o.body : (d = v()) == null ? void 0 : d.body, r = n.closest(".k-grid-container"), a = n && ((l = K.current) == null ? void 0 : l.contains(n));
602
- return !!(n && a && r);
603
- }, bt = (e, n, r, a, o, d, l) => {
604
- ae(), Y.current = !0, ce.current = !0, t.gridProps.onColumnResize && w && s(t.gridProps.onColumnResize, {
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 = k.current) == null ? void 0 : l.contains(n));
605
+ return !!(n && r && o);
606
+ }, bt = (e, n, o, r, a, d, l) => {
607
+ ae(), Y.current = !0, le.current = !0, t.gridProps.onColumnResize && w && s(t.gridProps.onColumnResize, {
605
608
  columns: U(),
606
- nativeEvent: a,
609
+ nativeEvent: r,
607
610
  targetColumnId: l,
608
611
  index: e,
609
612
  newWidth: n,
610
- oldWidth: r,
611
- end: o,
613
+ oldWidth: o,
614
+ end: a,
612
615
  target: R.current
613
- }), o && ne(d);
614
- }, It = () => {
616
+ }), a && re(d);
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,124 +639,124 @@ const sn = i.createContext(void 0), wn = (t) => {
636
639
  e(n);
637
640
  return;
638
641
  }
639
- e(Rt(n));
640
- }, Ct = () => {
641
- var e, n, r;
642
+ e(Ct(n));
643
+ }, vt = () => {
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
- ue.current = !1, (n = document.activeElement) != null && n.closest(".k-grid-edit-row") ? se.current = document.activeElement : se.current = void 0;
644
- const a = Array.from((r = F.current) == null ? void 0 : r.getElementsByClassName("k-grid-edit-row"));
645
- a.length > Pe.current.length ? J.current = a.filter(
646
- (o) => !Pe.current.includes(o)
647
- )[0] : a.length === 1 && (J.current = a[0], ue.current = !0), Pe.current = a;
646
+ ge.current = !1, (n = document.activeElement) != null && n.closest(".k-grid-edit-row") ? ue.current = document.activeElement : ue.current = void 0;
647
+ const r = Array.from((o = F.current) == null ? void 0 : o.getElementsByClassName("k-grid-edit-row"));
648
+ r.length > he.current.length ? J.current = r.filter(
649
+ (a) => !he.current.includes(a)
650
+ )[0] : r.length === 1 && (J.current = r[0], ge.current = !0), he.current = r;
648
651
  }
649
652
  }, H = () => t.dataRef.filter((e) => e.rowType === "data").map((e) => e.dataItem), j = () => (t.slicedData || t.dataRef).filter((e) => e.rowType === "data").map((e) => e.dataItem), v = () => {
650
653
  var e;
651
- if (Z)
654
+ if (p)
652
655
  return ((e = q()) == null ? void 0 : e.ownerDocument) || document;
653
- }, q = () => K.current, oe = i.useCallback(
656
+ }, q = () => k.current, ie = i.useCallback(
654
657
  (e) => {
655
- var a;
656
- if (!c.current || !((a = c.current) != null && a.container) || t.gridProps.scrollable === "none")
658
+ var r;
659
+ if (!c.current || !((r = c.current) != null && r.container) || t.gridProps.scrollable === "none")
657
660
  return;
658
- D.current && D.current.disconnect();
659
- const { rowIndex: n } = e, r = q();
661
+ K.current && K.current.disconnect();
662
+ const { rowIndex: n } = e, o = q();
660
663
  if (t.gridProps.scrollable === "virtual")
661
664
  c.current.askedSkip = n, c.current.container.scroll(
662
665
  0,
663
666
  Math.round(c.current.askedSkip / c.current.total * c.current.container.scrollHeight)
664
667
  );
665
- else if (r) {
666
- const o = n < 1 ? r.querySelector("tbody > tr:nth-child(1)") : r.querySelector(`tbody > tr:nth-child(${n + 1})`);
667
- o && $.current && ($.current.scrollTop = o.offsetTop);
668
+ else if (o) {
669
+ const a = n < 1 ? o.querySelector("tbody > tr:nth-child(1)") : o.querySelector(`tbody > tr:nth-child(${n + 1})`);
670
+ a && $.current && ($.current.scrollTop = a.offsetTop);
668
671
  }
669
672
  },
670
673
  [t.gridProps.scrollable]
671
- ), ye = (e) => JSON.stringify(e.map((n) => ({ id: n.id, field: n.field, title: n.title, children: n.children }))), vt = () => ye(Dt) === ye(t.columnsRef), Et = () => {
672
- vt() || ie();
673
- }, wt = (e, n) => {
674
- var r, a;
674
+ ), ke = (e) => JSON.stringify(e.map((n) => ({ id: n.id, field: n.field, title: n.title, children: n.children }))), Et = () => ke(Kt) === ke(t.columnsRef), wt = () => {
675
+ Et() || de();
676
+ }, yt = (e) => {
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 = (a = (r = t.gridProps.take) != null ? r : t.gridProps.pageSize) != null ? a : 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 && !n) {
677
- const o = t.gridProps.rowHeight * e;
678
- c.current.containerHeight = ze ? Math.min(Ne, o) : o;
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) {
680
+ const r = t.gridProps.rowHeight * e;
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) {
682
- const { rowHeight: o = 0, detail: d, expandField: l } = t.gridProps;
683
- let { detailRowHeight: u = 0 } = t.gridProps;
684
- u = d && l ? u : o, t.isAllData ? (c.current.total = t.dataRef.length, c.current.rowHeightService = new He(
684
+ if (c.current.containerRef = $, c.current.tableBodyRef = F, c.current.table = S.current, c.current instanceof Be) {
685
+ const { rowHeight: r = 0, detail: a, expandField: d } = t.gridProps;
686
+ let { detailRowHeight: l = 0 } = t.gridProps;
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
- o,
687
- u,
689
+ r,
690
+ l,
688
691
  t.dataRef
689
- )) : c.current.rowHeightService = new He(e, o, u);
690
- const g = c.current.rowHeightService.totalHeight();
691
- c.current.containerHeight = ze ? Math.min(Ne, g) : g;
692
+ )) : c.current.rowHeightService = new Fe(e, r, l);
693
+ const u = c.current.rowHeightService.totalHeight();
694
+ c.current.containerHeight = Ne ? Math.min(Oe, u) : u;
692
695
  }
693
696
  }
694
- }, xe = i.useCallback(
697
+ }, De = i.useCallback(
695
698
  (e) => {
696
- const n = { rowIndex: me.current };
697
- e.forEach((r) => {
698
- r.isIntersecting || oe(n);
699
+ const n = { rowIndex: Pe.current };
700
+ e.forEach((o) => {
701
+ o.isIntersecting || ie(n);
699
702
  });
700
703
  },
701
- [oe]
702
- ), ie = () => {
704
+ [ie]
705
+ ), de = () => {
703
706
  t.gridProps.forceUpdate && t.gridProps.forceUpdate();
704
- }, yt = (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(), E = i.useRef(), S = i.useRef(), y = i.useRef(), k = i.useRef(), X = i.useRef(), D = i.useRef(null), F = i.useRef(null), xt = i.useRef(null), $ = i.useRef(null), x = i.useRef(null), de = i.useRef(null), K = i.useRef(null), L = i.useRef(null), G = i.useRef(null), ce = i.useRef(!1), le = i.useRef(!1), J = i.useRef(), se = i.useRef(), ue = i.useRef(!1), Y = i.useRef(!0), ge = i.useRef(0), fe = i.useRef(), me = i.useRef(), Pe = i.useRef([]), Se = i.useRef([]), z = i.useRef(null), St = i.useRef(null), kt = i.useRef(null), ke = Ht(K), Dt = i.useMemo(() => i.Children.toArray(t.gridProps.children), [t.gridProps.children]), h = ee((Te = t.gridProps.selectable) != null ? Te : !!t.gridProps.selectedField), De = Gt((Me = t.gridProps.editable) != null ? Me : !!t.gridProps.editField);
705
- i.useMemo(() => {
707
+ }, xt = (e) => e.left !== void 0 ? Ie !== "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), y = i.useRef(void 0), x = 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), S = 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), kt = i.useRef(null), Dt = i.useRef(null), Ie = Ft(k), 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);
708
+ return i.useMemo(() => {
706
709
  T.onConstructor({
707
710
  navigatable: !!t.gridProps.navigatable,
708
- contextStateRef: y,
709
- navigationStateRef: k,
711
+ contextStateRef: x,
712
+ navigationStateRef: D,
710
713
  idPrefix: t.id
711
714
  });
712
715
  }, []), i.useMemo(() => {
713
- var r;
714
- (r = c.current) == null || r.reset();
715
- const e = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, n = t.isFixedVirtualScroll ? Oe : on;
716
- c.current = new n(e || t.gridProps.rowHeight === void 0 || t.gridProps.rowHeight === 0);
716
+ var n;
717
+ (n = c.current) == null || n.reset();
718
+ const e = t.isFixedVirtualScroll ? Be : dn;
719
+ c.current = new e(Q || t.gridProps.rowHeight === void 0 || t.gridProps.rowHeight === 0);
717
720
  }, [
718
721
  t.gridProps.scrollable,
719
722
  t.gridProps.total,
720
723
  t.gridProps.filter,
721
724
  t.gridProps.group,
722
- t.gridProps.groupable,
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) && (de.current && (de.current.style.display = "block"), x.current && (x.current.style.display = "block")), ae(), Ae(), T.onComponentDidMount({
728
- scope: K.current || void 0,
729
- contextStateRef: y,
730
- navigationStateRef: k
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"), S.current && (S.current.style.display = "block")), Se(), ae(), He(), T.onComponentDidMount({
731
+ scope: k.current || void 0,
732
+ contextStateRef: x,
733
+ navigationStateRef: D
731
734
  }), () => {
732
- clearTimeout(fe.current);
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,
737
- contextStateRef: y,
738
- navigationStateRef: k,
739
- focusFirst: le.current,
738
+ Se(), 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: k.current || void 0,
740
+ contextStateRef: x,
741
+ navigationStateRef: D,
742
+ focusFirst: se.current,
740
743
  newEditableRow: J.current,
741
- singleEditRow: ue.current,
742
- lastActiveElement: se.current,
744
+ singleEditRow: ge.current,
745
+ lastActiveElement: ue.current,
743
746
  navigatable: t.gridProps.navigatable
744
- }), le.current = !1, J.current = void 0;
747
+ }), se.current = !1, J.current = void 0;
745
748
  }), i.useEffect(() => {
746
- if (Z) {
749
+ if (p) {
747
750
  const e = {
748
751
  rootMargin: "0px",
749
752
  threshold: 0.9
750
753
  };
751
- D.current = window.IntersectionObserver && new window.IntersectionObserver(xe, e) || null;
754
+ K.current = window.IntersectionObserver && new window.IntersectionObserver(De, e) || null;
752
755
  }
753
- }, [xe]), i.useEffect(() => {
756
+ }, [De]), i.useEffect(() => {
754
757
  var n;
755
758
  let e;
756
- return Z && 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(
@@ -767,16 +770,16 @@ const sn = i.createContext(void 0), wn = (t) => {
767
770
  return U();
768
771
  },
769
772
  scrollIntoView: (e) => {
770
- var a;
771
- if (!((a = c.current) != null && a.container) || t.gridProps.scrollable === "none")
773
+ var r;
774
+ if (!((r = c.current) != null && r.container) || t.gridProps.scrollable === "none")
772
775
  return;
773
776
  const { rowIndex: n } = e;
774
- me.current = n;
775
- const r = q();
776
- if (D.current && r) {
777
- D.current.disconnect();
778
- const o = r.querySelector(`[absolute-row-index="${me.current}"]`);
779
- o ? D.current.observe(o) : oe(e);
777
+ Pe.current = n;
778
+ const o = q();
779
+ if (K.current && o) {
780
+ K.current.disconnect();
781
+ const a = o.querySelector(`[absolute-row-index="${Pe.current}"]`);
782
+ a ? K.current.observe(a) : ie(e);
780
783
  }
781
784
  },
782
785
  fitColumns: (e) => {
@@ -784,81 +787,79 @@ 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(bt);
790
+ E.current = new Qt(bt);
788
791
  }, [t.gridProps.onColumnResize, t.columnsRef]), i.useMemo(() => {
789
- S.current = new Qt(re, mt, we);
792
+ y.current = new Zt(oe, Pt, xe);
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);
797
- const Ke = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1;
798
- return S.current.reorderable = t.gridProps.reorderable || !1, S.current.groupable = Ke, S.current.columns = t.columnsRef, wt(t.total, Ke), /* @__PURE__ */ i.createElement(
799
- sn.Provider,
799
+ ]), E.current.resizable = t.gridProps.resizable || !1, E.current.columns = t.columnsRef, E.current.columnsState = Lt(t.columnsState), y.current.reorderable = t.gridProps.reorderable || !1, y.current.groupable = Q, y.current.columns = t.columnsRef, y.current.dir = Ie, yt(t.total), /* @__PURE__ */ i.createElement(
800
+ un.Provider,
800
801
  {
801
802
  value: {
802
803
  isClient: w,
803
804
  rowReorder: A,
804
805
  activeDragRowDataItemRef: z,
805
- reorderRowDragTargetRef: St,
806
- reorderRowDropTargetRef: kt,
807
- dir: ke,
808
- getCellPositionStyle: yt,
806
+ reorderRowDragTargetRef: kt,
807
+ reorderRowDropTargetRef: Dt,
808
+ dir: Ie,
809
+ getCellPositionStyle: xt,
809
810
  dataItemKey: t.gridProps.dataItemKey,
810
811
  columnsState: t.columnsState,
811
- onColumnsStateChange: ne,
812
- groupChange: te,
812
+ onColumnsStateChange: re,
813
+ groupChange: ne,
813
814
  selectionRelease: at,
814
- pagerPageChange: ut,
815
- onContextMenu: We,
816
- rowClick: Je,
817
- rowDblClick: Ye,
818
- cellClick: Qe,
819
- headerCellClick: ve,
820
- itemChange: et,
821
- sortChange: Ee,
822
- filterChange: gt,
823
- searchChange: ft,
824
- onHeaderSelectionChange: rt,
825
- columnGroupChange: Pt,
826
- onKeyDown: qe,
827
- onFocus: Xe,
828
- scrollHandler: je,
829
- selectionChange: tt,
830
- dispatchDetailExpand: Ze,
831
- dispatchGroupExpand: pe,
815
+ pagerPageChange: gt,
816
+ onContextMenu: je,
817
+ rowClick: Ye,
818
+ rowDblClick: Qe,
819
+ cellClick: Ze,
820
+ headerCellClick: we,
821
+ itemChange: tt,
822
+ sortChange: ye,
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,
832
833
  columnResizeRef: E,
833
- dragLogicRef: S,
834
- navigationStateRef: k,
835
- tableElementRef: x,
834
+ dragLogicRef: y,
835
+ navigationStateRef: D,
836
+ tableElementRef: S,
836
837
  tableBodyElementRef: F,
837
- headerElementRef: xt,
838
+ headerElementRef: St,
838
839
  containerElementRef: $,
839
- headTableElementRef: de,
840
- elementRef: K,
840
+ headTableElementRef: ce,
841
+ elementRef: k,
841
842
  footerRef: L,
842
843
  headerRef: G,
843
844
  vsRef: c
844
845
  }
845
846
  },
846
- /* @__PURE__ */ i.createElement(Nt.Provider, { value: y.current }, t.children),
847
+ /* @__PURE__ */ i.createElement(Ot.Provider, { value: x.current }, t.children),
847
848
  /* @__PURE__ */ i.createElement(
848
- dn,
849
+ cn,
849
850
  {
850
- show: I.show,
851
- dataItem: I.dataItem,
852
- field: I.field,
853
- items: Ve,
854
- offset: I.offset,
855
- onClose: Ie,
851
+ show: b.show,
852
+ dataItem: b.dataItem,
853
+ field: b.field,
854
+ items: We,
855
+ offset: b.offset,
856
+ onClose: Ce,
856
857
  onSelect: _e
857
858
  }
858
859
  )
859
860
  );
860
861
  };
861
862
  export {
862
- wn as GridClientWrapper,
863
- sn as GridContext
863
+ yn as GridClientWrapper,
864
+ un as GridContext
864
865
  };