@progress/kendo-react-grid 13.3.0-develop.1 → 13.3.0-develop.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,13 +6,13 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as a from "react";
10
- import { useAdaptiveModeContext as Wt, canUseDOM as Q, getActiveElement as jt, useDir as qt, setScrollbarWidth as Ve, cloneArray as _t, getter as Z, RowHeightService as $t } from "@progress/kendo-react-common";
9
+ import * as d from "react";
10
+ import { useAdaptiveModeContext as Vt, canUseDOM as Q, getActiveElement as jt, useDir as qt, setScrollbarWidth as Ue, cloneArray as _t, getter as Z, RowHeightService as $t } from "@progress/kendo-react-common";
11
11
  import { filterBy as Jt } from "@progress/kendo-data-query";
12
- import { getSelectionOptions as se, populateClipboardData as Xt, ClipboardActionType as ke, getEditableOptions as Yt, tableKeyboardNavigation as U, ClipboardService as Qt, TableKeyboardNavigationContext as Zt, closestTagName as ue, editReducer as pt, EDIT_ACTION as en, getDetailExpandableOptions as tn, detailExpandReducer as nn, getGroupExpandableOptions as rn, groupExpandReducer as on, getSelectedState as We, getSelectedStateFromKeyDown as an, getColumnIndex as dn, getRowIndex as ln, updateLeft as cn, updateRight as sn } from "@progress/kendo-react-data-tools";
12
+ import { getSelectionOptions as se, populateClipboardData as Xt, ClipboardActionType as ke, getEditableOptions as Yt, tableKeyboardNavigation as _, ClipboardService as Qt, TableKeyboardNavigationContext as Zt, closestTagName as ue, editReducer as pt, EDIT_ACTION as en, getDetailExpandableOptions as tn, detailExpandReducer as nn, getGroupExpandableOptions as rn, groupExpandReducer as on, getSelectedState as Ve, getSelectedStateFromKeyDown as an, getColumnIndex as dn, getRowIndex as cn, updateLeft as ln, updateRight as sn } from "@progress/kendo-react-data-tools";
13
13
  import { ColumnResize as un } from "./drag/ColumnResize.mjs";
14
14
  import { CommonDragLogic as gn } from "./drag/CommonDragLogic.mjs";
15
- import { getDefaultHeadContextMenuItems as fn, getDefaultBodyContextMenuItems as mn, isRowReorderEnabled as Pn, sanitizeColumns as hn, getDataAsArray as Rn, getFlatColumnsState as bn, calcRowHeight as vn } from "./utils/index.mjs";
15
+ import { getDefaultHeadContextMenuItems as fn, getDefaultBodyContextMenuItems as mn, isRowReorderEnabled as hn, sanitizeColumns as Pn, getDataAsArray as Rn, getFlatColumnsState as bn, calcRowHeight as vn } from "./utils/index.mjs";
16
16
  import { VirtualScroll as In } from "./VirtualScroll.mjs";
17
17
  import { GridContextMenu as Cn } from "./contextMenu/GridContextMenu.mjs";
18
18
  import { GridContextMenuAnchorPart as je } from "./contextMenu/enums.mjs";
@@ -20,16 +20,16 @@ import { normalizeSortable as En, firstLevelSortSeqMap as wn } from "./sortCommo
20
20
  import { BasePDFExport as yn } from "./BasePDFExport.mjs";
21
21
  import { GridContext as xn } from "./utils/GridContext.mjs";
22
22
  import { operators as Sn } from "./filterCommon.mjs";
23
- const kn = (t, I, h, S) => {
24
- const V = Object.keys(I.cells).map((x) => h.findIndex((G) => G.field === x)), A = Object.keys(I.cells).length > 0 ? V : !0;
25
- return t.reduce((x, G) => (x[G[S != null ? S : "id"]] = A, x), {});
26
- }, qe = (t, I, h, S) => I.reduce((A, x) => ({
27
- ...A,
28
- ...kn(Jt(t, x), x, h, S)
29
- }), {}), Vn = (t) => {
30
- const I = t.gridProps.isClient, [h, S] = a.useState({}), V = Wt(), A = a.useRef(null), x = (e) => {
31
- e.event.preventDefault(), S({
32
- ...h,
23
+ const kn = (t, E, P, D) => {
24
+ const $ = Object.keys(E.cells).map((k) => P.findIndex((W) => W.field === k)), O = Object.keys(E.cells).length > 0 ? $ : !0;
25
+ return t.reduce((k, W) => (k[W[D != null ? D : "id"]] = O, k), {});
26
+ }, qe = (t, E, P, D) => E.reduce((O, k) => ({
27
+ ...O,
28
+ ...kn(Jt(t, k), k, P, D)
29
+ }), {}), Un = (t) => {
30
+ const E = t.gridProps.isClient, [P, D] = d.useState({}), $ = Vt(), O = d.useRef(null), k = (e) => {
31
+ e.event.preventDefault(), D({
32
+ ...P,
33
33
  show: !0,
34
34
  offset: {
35
35
  left: e.event.pageX,
@@ -38,42 +38,42 @@ const kn = (t, I, h, S) => {
38
38
  dataItem: e.dataItem,
39
39
  field: e.field
40
40
  });
41
- }, G = () => {
42
- S({});
43
- }, v = a.useMemo(() => t.columnsRef.find((e) => e.field === h.field), [t.columnsRef, h]), De = a.useMemo(() => {
44
- const e = t.gridProps.sortable && (v == null ? void 0 : v.sortable);
41
+ }, W = () => {
42
+ D({});
43
+ }, I = d.useMemo(() => t.columnsRef.find((e) => e.field === P.field), [t.columnsRef, P]), De = d.useMemo(() => {
44
+ const e = t.gridProps.sortable && (I == null ? void 0 : I.sortable);
45
45
  return fn({
46
46
  pdf: !!t.gridProps.pdf,
47
47
  sortable: !!e,
48
48
  selectable: se(t.gridProps.selectable).enabled,
49
49
  clipboard: !!t.gridProps.clipboard
50
50
  });
51
- }, [v, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), Ke = a.useMemo(() => {
52
- const e = t.gridProps.sortable && (v == null ? void 0 : v.sortable);
51
+ }, [I, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), Ke = d.useMemo(() => {
52
+ const e = t.gridProps.sortable && (I == null ? void 0 : I.sortable);
53
53
  return mn({
54
54
  pdf: !!t.gridProps.pdf,
55
55
  sortable: !!e,
56
56
  selectable: se(t.gridProps.selectable).enabled,
57
57
  clipboard: !!t.gridProps.clipboard,
58
- rowReorderable: Pn(t.gridProps.rowReorderable)
58
+ rowReorderable: hn(t.gridProps.rowReorderable)
59
59
  });
60
- }, [v, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), p = a.useMemo(() => {
61
- const e = (v == null ? void 0 : v.contextMenu) || t.gridProps.contextMenu, n = typeof e == "function" ? e(h) : e;
62
- if (n && h.offset) {
63
- const o = h.dataItem ? je.body : je.head, r = n[o], i = h.dataItem ? Ke : De;
60
+ }, [I, t.gridProps.sortable, t.gridProps.selectable, t.gridProps.clipboard]), p = d.useMemo(() => {
61
+ const e = (I == null ? void 0 : I.contextMenu) || t.gridProps.contextMenu, n = typeof e == "function" ? e(P) : e;
62
+ if (n && P.offset) {
63
+ const o = P.dataItem ? je.body : je.head, r = n[o], i = P.dataItem ? Ke : De;
64
64
  return r === !1 ? void 0 : r === !0 || r === void 0 ? i : r;
65
65
  }
66
- }, [t.gridProps.contextMenu, h, Ke, De, v]), _e = (e) => {
67
- var l, s, u, m, f, w, P, J, X;
66
+ }, [t.gridProps.contextMenu, P, Ke, De, I]), _e = (e) => {
67
+ var c, f, l, u, s, v, m, S, z;
68
68
  const n = e.event.item, o = {
69
- target: E.current,
69
+ target: y.current,
70
70
  syntheticEvent: e.event.syntheticEvent,
71
71
  nativeEvent: e.event.nativeEvent,
72
72
  menuItem: n,
73
73
  ...e
74
74
  };
75
- t.gridProps.onContextMenuItemClick && c(t.gridProps.onContextMenuItemClick, o);
76
- const r = C(), i = {
75
+ t.gridProps.onContextMenuItemClick && g(t.gridProps.onContextMenuItemClick, o);
76
+ const r = w(), i = {
77
77
  selectedField: "",
78
78
  componentId: t.id,
79
79
  dataItems: r,
@@ -89,12 +89,12 @@ const kn = (t, I, h, S) => {
89
89
  isDrag: !1,
90
90
  ...se(t.gridProps.selectable),
91
91
  ...o
92
- }, d = r.findIndex((Y) => Y === e.dataItem);
93
- switch ((l = n.data) == null ? void 0 : l.action) {
92
+ }, a = r.findIndex((Y) => Y === e.dataItem);
93
+ switch ((c = n.data) == null ? void 0 : c.action) {
94
94
  case "SortCommand":
95
- if (v) {
96
- const Y = (s = n.name) == null ? void 0 : s.toLowerCase().includes("asc"), Bt = ((u = n.name) == null ? void 0 : u.toLowerCase().includes("desc")) ? "desc" : void 0, Ut = Y ? "asc" : Bt, Vt = n.name ? Ut : void 0;
97
- Me(e.event.syntheticEvent, v, Vt);
95
+ if (I) {
96
+ const Y = (f = n.name) == null ? void 0 : f.toLowerCase().includes("asc"), Nt = ((l = n.name) == null ? void 0 : l.toLowerCase().includes("desc")) ? "desc" : void 0, Bt = Y ? "asc" : Nt, Ut = n.name ? Bt : void 0;
97
+ Me(e.event.syntheticEvent, I, Ut);
98
98
  }
99
99
  break;
100
100
  case "SelectRowCommand":
@@ -110,14 +110,14 @@ const kn = (t, I, h, S) => {
110
110
  ft(i);
111
111
  break;
112
112
  case "ReorderRowCommand":
113
- $.current = e.dataItem, (m = n.name) != null && m.toLowerCase().includes("rowup") && d > 0 && W(e.event.syntheticEvent, d - 1, "before"), (f = n.name) != null && f.toLowerCase().includes("rowdown") && d < r.length - 1 && W(e.event.syntheticEvent, d + 1, "after"), (w = n.name) != null && w.toLowerCase().includes("rowtop") && W(e.event.syntheticEvent, 0, "before"), (P = n.name) != null && P.toLowerCase().includes("rowbottom") && W(e.event.syntheticEvent, r.length - 1, "after");
113
+ X.current = e.dataItem, (u = n.name) != null && u.toLowerCase().includes("rowup") && a > 0 && J(e.event.syntheticEvent, a - 1, "before"), (s = n.name) != null && s.toLowerCase().includes("rowdown") && a < r.length - 1 && J(e.event.syntheticEvent, a + 1, "after"), (v = n.name) != null && v.toLowerCase().includes("rowtop") && J(e.event.syntheticEvent, 0, "before"), (m = n.name) != null && m.toLowerCase().includes("rowbottom") && J(e.event.syntheticEvent, r.length - 1, "after");
114
114
  break;
115
115
  case "CopySelectionCommand":
116
116
  oe(
117
117
  ke.copy,
118
118
  e.event.nativeEvent,
119
119
  {
120
- copyHeaders: !((J = n.name) != null && J.toLowerCase().includes("noheaders"))
120
+ copyHeaders: !((S = n.name) != null && S.toLowerCase().includes("noheaders"))
121
121
  },
122
122
  e.dataItem,
123
123
  e.field
@@ -128,29 +128,29 @@ const kn = (t, I, h, S) => {
128
128
  ke.paste,
129
129
  e.event.nativeEvent,
130
130
  {
131
- copyHeaders: !((X = n.name) != null && X.toLowerCase().includes("noheaders"))
131
+ copyHeaders: !((z = n.name) != null && z.toLowerCase().includes("noheaders"))
132
132
  },
133
133
  e.dataItem,
134
134
  e.field
135
135
  );
136
136
  break;
137
137
  }
138
- G();
138
+ W();
139
139
  }, ee = () => {
140
140
  const e = t.columnsRef.filter((n) => n.declarationIndex >= 0 && n.parentIndex === -1);
141
- return hn(e);
141
+ return Pn(e);
142
142
  }, $e = (e, n, o) => {
143
- if (t.gridProps.onContextMenu && I) {
143
+ if (t.gridProps.onContextMenu && E) {
144
144
  const r = {
145
- target: E.current,
145
+ target: y.current,
146
146
  syntheticEvent: e,
147
147
  nativeEvent: e.nativeEvent,
148
148
  dataItem: n,
149
149
  field: o
150
150
  };
151
- c(t.gridProps.onContextMenu, r);
151
+ g(t.gridProps.onContextMenu, r);
152
152
  }
153
- t.gridProps.contextMenu && x({
153
+ t.gridProps.contextMenu && k({
154
154
  event: e,
155
155
  dataItem: n,
156
156
  field: o
@@ -158,42 +158,42 @@ const kn = (t, I, h, S) => {
158
158
  }, Je = (e) => {
159
159
  if (e.target !== e.currentTarget)
160
160
  return;
161
- clearTimeout(we.current), b.current && (b.current.table = j.current);
161
+ clearTimeout(we.current), b.current && (b.current.table = A.current);
162
162
  const n = e.currentTarget.scrollLeft, o = e.currentTarget.scrollTop;
163
- t.gridProps.columnVirtualization && (!y || o === Ee.current) && (we.current = window.setTimeout(() => {
164
- O();
165
- }, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = n), _.current && _.current.setScrollLeft(n), q.current && q.current.setScrollLeft(n), b.current && o !== Ee.current && b.current.scrollHandler(e), t.gridProps.onScroll && I && c(t.gridProps.onScroll, {
163
+ t.gridProps.columnVirtualization && (!x || o === Ee.current) && (we.current = window.setTimeout(() => {
164
+ U();
165
+ }, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = n), F.current && F.current.setScrollLeft(n), L.current && L.current.setScrollLeft(n), b.current && o !== Ee.current && b.current.scrollHandler(e), t.gridProps.onScroll && E && g(t.gridProps.onScroll, {
166
166
  ...R(e)
167
167
  }), Ee.current = o;
168
168
  }, Xe = (e) => {
169
- U.onKeyDown(e, {
169
+ _.onKeyDown(e, {
170
170
  navigatable: t.gridProps.navigatable || !1,
171
- contextStateRef: M,
172
- navigationStateRef: F,
171
+ contextStateRef: T,
172
+ navigationStateRef: V,
173
173
  onNavigationAction: Qe,
174
174
  columns: ee()
175
- }), U.onGetSnapshotBeforeUpdate({
176
- document: k(),
177
- contextStateRef: M,
178
- navigationStateRef: F
175
+ }), _.onGetSnapshotBeforeUpdate({
176
+ document: K(),
177
+ contextStateRef: T,
178
+ navigationStateRef: V
179
179
  });
180
180
  const n = {
181
- dataItems: C(),
182
- mode: g.mode,
183
- cell: g.cell,
181
+ dataItems: w(),
182
+ mode: h.mode,
183
+ cell: h.cell,
184
184
  componentId: t.id,
185
185
  selectedField: "",
186
186
  ...R(e)
187
187
  };
188
- t.gridProps.onKeyDown && I && c(t.gridProps.onKeyDown, n);
188
+ t.gridProps.onKeyDown && E && g(t.gridProps.onKeyDown, n);
189
189
  }, Ye = (e) => {
190
- U.onFocus(e, {
190
+ _.onFocus(e, {
191
191
  navigatable: !!t.gridProps.navigatable,
192
- contextStateRef: M
192
+ contextStateRef: T
193
193
  });
194
194
  }, Qe = (e) => {
195
195
  const { columnsRef: n } = t;
196
- if (e.action === "moveToNextPage" && ht(e.event), e.action === "moveToPrevPage" && Rt(e.event), e.focusElement && (e.action === "reorderToRight" || e.action === "reorderToLeft")) {
196
+ if (e.action === "moveToNextPage" && Pt(e.event), e.action === "moveToPrevPage" && Rt(e.event), e.focusElement && (e.action === "reorderToRight" || e.action === "reorderToLeft")) {
197
197
  const o = parseInt(e.focusElement.ariaColIndex, 10) - 1;
198
198
  if (!n[o].reorderable)
199
199
  return;
@@ -208,42 +208,42 @@ const kn = (t, I, h, S) => {
208
208
  ne(o, o - 1, e.event);
209
209
  }
210
210
  }
211
- if (e.action === "select" && dt(e.event), t.gridProps.onNavigationAction && I) {
211
+ if (e.action === "select" && dt(e.event), t.gridProps.onNavigationAction && E) {
212
212
  const o = {
213
213
  focusElement: e.focusElement,
214
214
  ...R(e.event)
215
215
  };
216
- c(t.gridProps.onNavigationAction, o);
216
+ g(t.gridProps.onNavigationAction, o);
217
217
  }
218
218
  }, Ze = (e, n) => {
219
- t.gridProps.onRowClick && ue(e.target, "TD") && c(t.gridProps.onRowClick, {
219
+ t.gridProps.onRowClick && ue(e.target, "TD") && g(t.gridProps.onRowClick, {
220
220
  dataItem: n,
221
221
  ...R(e)
222
222
  });
223
223
  }, pe = (e, n) => {
224
- t.gridProps.onRowDoubleClick && ue(e.target, "TD") && c(t.gridProps.onRowDoubleClick, {
224
+ t.gridProps.onRowDoubleClick && ue(e.target, "TD") && g(t.gridProps.onRowDoubleClick, {
225
225
  dataItem: n,
226
226
  ...R(e)
227
227
  });
228
228
  }, et = (e) => {
229
- t.gridProps.onItemChange && c(t.gridProps.onItemChange, {
229
+ t.gridProps.onItemChange && g(t.gridProps.onItemChange, {
230
230
  ...R(e.syntheticEvent),
231
231
  dataItem: e.dataItem,
232
232
  field: void 0,
233
233
  value: void 0
234
234
  });
235
235
  }, tt = (e) => {
236
- t.gridProps.onItemChange && t.gridProps.onEditChange && c(t.gridProps.onEditChange, {
236
+ t.gridProps.onItemChange && t.gridProps.onEditChange && g(t.gridProps.onEditChange, {
237
237
  edit: {},
238
238
  ...R(e.syntheticEvent)
239
239
  });
240
240
  }, nt = (e, n, o) => {
241
- if (Ue.enabled && Ue.mode === "incell" && t.gridProps.dataItemKey) {
241
+ if (Be.enabled && Be.mode === "incell" && t.gridProps.dataItemKey) {
242
242
  const r = pt(t.gridProps.edit, {
243
243
  type: en.ENTER_FIELD_EDIT,
244
244
  payload: { id: n[t.gridProps.dataItemKey], field: o }
245
245
  });
246
- t.gridProps.onEditChange && c(t.gridProps.onEditChange, {
246
+ t.gridProps.onEditChange && g(t.gridProps.onEditChange, {
247
247
  edit: r,
248
248
  ...R(e)
249
249
  });
@@ -252,7 +252,7 @@ const kn = (t, I, h, S) => {
252
252
  var r;
253
253
  if (tn(t.detailExpandable).enabled) {
254
254
  const i = nn((r = t.gridProps.detailExpand) != null ? r : {}, e);
255
- t.gridProps.onDetailExpandChange && c(t.gridProps.onDetailExpandChange, {
255
+ t.gridProps.onDetailExpandChange && g(t.gridProps.onDetailExpandChange, {
256
256
  ...R(n),
257
257
  detailExpand: i
258
258
  });
@@ -264,7 +264,7 @@ const kn = (t, I, h, S) => {
264
264
  );
265
265
  if (o.enabled) {
266
266
  const i = on((r = t.gridProps.groupExpand) != null ? r : [], e, o);
267
- t.gridProps.onGroupExpandChange && c(t.gridProps.onGroupExpandChange, {
267
+ t.gridProps.onGroupExpandChange && g(t.gridProps.onGroupExpandChange, {
268
268
  ...R(n),
269
269
  groupExpand: i
270
270
  });
@@ -273,10 +273,10 @@ const kn = (t, I, h, S) => {
273
273
  const { allowUnsort: r, mode: i } = En(
274
274
  t.gridProps.sortable || !1,
275
275
  n.sortable || !1
276
- ), d = (t.gridProps.sort || []).filter((u) => u.field === n.field)[0], l = o || wn[r][d && d.dir || ""], s = i === "single" ? [] : (t.gridProps.sort || []).filter((u) => u.field !== n.field);
277
- l !== "" && n.field && s.push({ field: n.field, dir: l }), Te(s, e);
276
+ ), a = (t.gridProps.sort || []).filter((l) => l.field === n.field)[0], c = o || wn[r][a && a.dir || ""], f = i === "single" ? [] : (t.gridProps.sort || []).filter((l) => l.field !== n.field);
277
+ c !== "" && n.field && f.push({ field: n.field, dir: c }), He(f, e);
278
278
  }, it = (e) => {
279
- t.gridProps.onItemChange && c(t.gridProps.onItemChange, {
279
+ t.gridProps.onItemChange && g(t.gridProps.onItemChange, {
280
280
  ...R(e.syntheticEvent),
281
281
  dataItem: e.dataItem,
282
282
  dataIndex: e.dataIndex,
@@ -285,65 +285,65 @@ const kn = (t, I, h, S) => {
285
285
  });
286
286
  }, at = (e) => {
287
287
  var n;
288
- if (t.gridProps.onSelectionChange && g.enabled) {
289
- const { event: o, dataItem: r, dataIndex: i, columnIndex: d } = e, l = {
288
+ if (t.gridProps.onSelectionChange && h.enabled) {
289
+ const { event: o, dataItem: r, dataIndex: i, columnIndex: a } = e, c = {
290
290
  ...R(o),
291
291
  dataItem: r,
292
- startColIndex: d,
293
- endColIndex: d,
292
+ startColIndex: a,
293
+ endColIndex: a,
294
294
  startRowIndex: i,
295
295
  endRowIndex: i,
296
- dataItems: C(),
296
+ dataItems: w(),
297
297
  altKey: !1,
298
298
  ctrlKey: !1,
299
299
  shiftKey: !1,
300
300
  metaKey: !1,
301
- mode: g.mode,
302
- cell: g.cell,
301
+ mode: h.mode,
302
+ cell: h.cell,
303
303
  isDrag: !1,
304
304
  componentId: t.id,
305
305
  selectedField: ""
306
306
  };
307
- c(t.gridProps.onSelectionChange, {
308
- ...l,
309
- select: t.gridProps.dataItemKey ? We({
310
- event: l,
307
+ g(t.gridProps.onSelectionChange, {
308
+ ...c,
309
+ select: t.gridProps.dataItemKey ? Ve({
310
+ event: c,
311
311
  selectedState: (n = t.gridProps.select) != null ? n : {},
312
312
  dataItemKey: t.gridProps.dataItemKey
313
313
  }) : {}
314
314
  });
315
315
  }
316
316
  }, dt = (e) => {
317
- var u, m;
318
- if (!g.enabled || !t.gridProps.dataItemKey)
317
+ var l, u;
318
+ if (!h.enabled || !t.gridProps.dataItemKey)
319
319
  return;
320
320
  const n = {
321
- dataItems: C(),
322
- mode: g.mode,
323
- cell: g.cell,
321
+ dataItems: w(),
322
+ mode: h.mode,
323
+ cell: h.cell,
324
324
  componentId: t.id,
325
325
  selectedField: "",
326
326
  ...R(e)
327
327
  }, o = an({
328
328
  event: n,
329
- selectedState: (u = t.gridProps.select) != null ? u : {},
329
+ selectedState: (l = t.gridProps.select) != null ? l : {},
330
330
  dataItemKey: t.gridProps.dataItemKey
331
331
  });
332
332
  if (o === t.gridProps.select)
333
333
  return;
334
- const r = e.target, i = ue(r, "TD"), d = ue(r, "TR"), l = dn(i), s = ln(d);
335
- if (l !== void 0 && s !== void 0) {
336
- const f = (m = Rn(t.gridProps.data)) == null ? void 0 : m[s];
337
- t.gridProps.onSelectionChange && c(t.gridProps.onSelectionChange, {
334
+ const r = e.target, i = ue(r, "TD"), a = ue(r, "TR"), c = dn(i), f = cn(a);
335
+ if (c !== void 0 && f !== void 0) {
336
+ const s = (u = Rn(t.gridProps.data)) == null ? void 0 : u[f];
337
+ t.gridProps.onSelectionChange && g(t.gridProps.onSelectionChange, {
338
338
  ...n,
339
339
  select: o,
340
- dataItem: f,
341
- startRowIndex: s,
342
- startColIndex: l,
343
- startDataItem: f,
344
- endDataItem: f,
345
- endRowIndex: s,
346
- endColIndex: l,
340
+ dataItem: s,
341
+ startRowIndex: f,
342
+ startColIndex: c,
343
+ startDataItem: s,
344
+ endDataItem: s,
345
+ endRowIndex: f,
346
+ endColIndex: c,
347
347
  ctrlKey: e.ctrlKey,
348
348
  altKey: e.altKey,
349
349
  metaKey: e.metaKey,
@@ -351,47 +351,47 @@ const kn = (t, I, h, S) => {
351
351
  isDrag: !1
352
352
  });
353
353
  }
354
- }, lt = (e) => {
355
- if (t.gridProps.onHeaderSelectionChange && g.enabled) {
356
- const n = C();
357
- c(t.gridProps.onHeaderSelectionChange, {
354
+ }, ct = (e) => {
355
+ if (t.gridProps.onHeaderSelectionChange && h.enabled) {
356
+ const n = w();
357
+ g(t.gridProps.onHeaderSelectionChange, {
358
358
  select: e.syntheticEvent.target.checked ? n.reduce((o, r) => (t.gridProps.dataItemKey && Z(t.gridProps.dataItemKey)(r) !== void 0 && (o[Z(t.gridProps.dataItemKey)(r)] = !0), o), {}) : {},
359
359
  field: e.field,
360
360
  nativeEvent: e.syntheticEvent && e.syntheticEvent.nativeEvent,
361
361
  syntheticEvent: e.syntheticEvent,
362
- target: E.current,
362
+ target: y.current,
363
363
  dataItems: n
364
364
  });
365
365
  }
366
- }, L = (e, n) => {
367
- t.gridProps.onSelectionChange && g.enabled && c(t.gridProps.onSelectionChange, {
366
+ }, N = (e, n) => {
367
+ t.gridProps.onSelectionChange && h.enabled && g(t.gridProps.onSelectionChange, {
368
368
  ...e,
369
369
  select: n
370
370
  });
371
- }, ct = (e) => {
371
+ }, lt = (e) => {
372
372
  var n;
373
- if (t.gridProps.onSelectionChange && g.enabled) {
374
- const o = C()[e.startRowIndex], r = C()[e.endRowIndex], i = {
373
+ if (t.gridProps.onSelectionChange && h.enabled) {
374
+ const o = w()[e.startRowIndex], r = w()[e.endRowIndex], i = {
375
375
  syntheticEvent: void 0,
376
- target: E.current,
376
+ target: y.current,
377
377
  selectedField: "",
378
378
  componentId: t.id,
379
- dataItems: C(),
379
+ dataItems: w(),
380
380
  dataItem: null,
381
381
  startDataItem: o,
382
382
  endDataItem: r,
383
383
  ...e
384
- }, d = We({
384
+ }, a = Ve({
385
385
  event: i,
386
386
  selectedState: (n = t.gridProps.select) != null ? n : {},
387
387
  // Thats kinda strange, even through the `dataItemKey` is required by the `getSelectedState`
388
388
  // it does work correctly even without it
389
389
  dataItemKey: t.gridProps.dataItemKey
390
390
  });
391
- L(i, d);
391
+ N(i, a);
392
392
  }
393
393
  }, st = (e) => {
394
- if (t.gridProps.onSelectionChange && g.enabled) {
394
+ if (t.gridProps.onSelectionChange && h.enabled) {
395
395
  const n = e.dataItems[0], o = e.dataItems[e.dataItems.length - 1], r = {}, i = {
396
396
  ...e,
397
397
  startDataItem: n,
@@ -401,33 +401,33 @@ const kn = (t, I, h, S) => {
401
401
  startColIndex: 0,
402
402
  endColIndex: t.columnsRef.length - 1
403
403
  };
404
- e.dataItems.forEach((d) => {
405
- const s = Z(t.gridProps.dataItemKey)(d);
406
- r[s] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0;
407
- }), L(i, r);
404
+ e.dataItems.forEach((a) => {
405
+ const f = Z(t.gridProps.dataItemKey)(a);
406
+ r[f] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0;
407
+ }), N(i, r);
408
408
  }
409
409
  }, ut = (e) => {
410
- if (t.gridProps.onSelectionChange && g.enabled) {
411
- const o = Z(t.gridProps.dataItemKey)(e.dataItem), r = 0, i = t.columnsRef.length - 1, d = e.dataItems.findIndex(
412
- (f) => f[t.gridProps.dataItemKey] === e.dataItem[t.gridProps.dataItemKey]
413
- ), u = {
410
+ if (t.gridProps.onSelectionChange && h.enabled) {
411
+ const o = Z(t.gridProps.dataItemKey)(e.dataItem), r = 0, i = t.columnsRef.length - 1, a = e.dataItems.findIndex(
412
+ (s) => s[t.gridProps.dataItemKey] === e.dataItem[t.gridProps.dataItemKey]
413
+ ), l = {
414
414
  ...e,
415
- startDataItem: d,
416
- endDataItem: d,
417
- startRowIndex: d,
418
- endRowIndex: d,
415
+ startDataItem: a,
416
+ endDataItem: a,
417
+ startRowIndex: a,
418
+ endRowIndex: a,
419
419
  startColIndex: r,
420
420
  endColIndex: i
421
- }, m = e.mode === "multiple" ? t.gridProps.select || {} : {};
422
- m[o] === !0 || Array.isArray(m[o]) && m[o].length === t.columnsRef.length ? delete m[o] : m[o] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0, L(u, m);
421
+ }, u = e.mode === "multiple" ? t.gridProps.select || {} : {};
422
+ u[o] === !0 || Array.isArray(u[o]) && u[o].length === t.columnsRef.length ? delete u[o] : u[o] = e.cell ? [...Array(t.columnsRef.length).keys()] : !0, N(l, u);
423
423
  }
424
424
  }, gt = (e) => {
425
- if (!g.enabled)
425
+ if (!h.enabled)
426
426
  return;
427
- const n = C(), o = {
427
+ const n = w(), o = {
428
428
  syntheticEvent: void 0,
429
429
  nativeEvent: void 0,
430
- target: E.current,
430
+ target: y.current,
431
431
  selectedField: "",
432
432
  componentId: t.id,
433
433
  dataItems: n,
@@ -439,18 +439,18 @@ const kn = (t, I, h, S) => {
439
439
  metaKey: !1,
440
440
  shiftKey: !1,
441
441
  isDrag: !1,
442
- mode: g.mode,
443
- cell: g.cell
442
+ mode: h.mode,
443
+ cell: h.cell
444
444
  };
445
445
  if (!e || e.length === 0) {
446
- const f = {
446
+ const s = {
447
447
  ...o,
448
448
  startRowIndex: -1,
449
449
  endRowIndex: -1,
450
450
  startColIndex: -1,
451
451
  endColIndex: -1
452
452
  };
453
- L(f, {});
453
+ N(s, {});
454
454
  return;
455
455
  }
456
456
  const r = qe(
@@ -459,36 +459,36 @@ const kn = (t, I, h, S) => {
459
459
  t.columnsRef,
460
460
  t.gridProps.dataItemKey
461
461
  ), i = {};
462
- Object.keys(r).forEach((f) => {
463
- r[f] && (i[f] = g.cell ? [...Array(t.columnsRef.length).keys()] : !0);
462
+ Object.keys(r).forEach((s) => {
463
+ r[s] && (i[s] = h.cell ? [...Array(t.columnsRef.length).keys()] : !0);
464
464
  });
465
- let d = -1, l = -1, s = n[0] || null, u = n[n.length - 1] || null;
465
+ let a = -1, c = -1, f = n[0] || null, l = n[n.length - 1] || null;
466
466
  if (t.gridProps.dataItemKey) {
467
- const f = Z(t.gridProps.dataItemKey);
468
- for (let w = 0; w < n.length; w++) {
469
- const P = f(n[w]);
470
- P !== void 0 && r[P] && (d === -1 && (d = w, s = n[w]), l = w, u = n[w]);
467
+ const s = Z(t.gridProps.dataItemKey);
468
+ for (let v = 0; v < n.length; v++) {
469
+ const m = s(n[v]);
470
+ m !== void 0 && r[m] && (a === -1 && (a = v, f = n[v]), c = v, l = n[v]);
471
471
  }
472
472
  }
473
- const m = {
473
+ const u = {
474
474
  ...o,
475
- startRowIndex: d,
476
- endRowIndex: l,
475
+ startRowIndex: a,
476
+ endRowIndex: c,
477
477
  startColIndex: 0,
478
478
  endColIndex: t.columnsRef.length - 1,
479
- startDataItem: s,
480
- endDataItem: u
479
+ startDataItem: f,
480
+ endDataItem: l
481
481
  };
482
- L(m, i);
482
+ N(u, i);
483
483
  }, ft = (e) => {
484
- t.gridProps.onSelectionChange && g.enabled && L(e, {});
485
- }, z = (e, n, o, r, i) => {
486
- Pt();
487
- const d = t.gridProps.onDataStateChange;
484
+ t.gridProps.onSelectionChange && h.enabled && N(e, {});
485
+ }, B = (e, n, o, r, i) => {
486
+ ht();
487
+ const a = t.gridProps.onDataStateChange;
488
488
  if (e) {
489
- const l = { ...R(r), ...n, targetEvent: i };
490
- c(e, l);
491
- } else d && c(d, {
489
+ const c = { ...R(r), ...n, targetEvent: i };
490
+ g(e, c);
491
+ } else a && g(a, {
492
492
  ...R(r),
493
493
  targetEvent: i || {},
494
494
  dataState: {
@@ -498,7 +498,7 @@ const kn = (t, I, h, S) => {
498
498
  });
499
499
  }, te = (e, n, o) => {
500
500
  var r;
501
- y && t.gridProps.pageable && ((r = b.current) == null || r.reset()), z(
501
+ x && t.gridProps.pageable && ((r = b.current) == null || r.reset()), B(
502
502
  t.gridProps.onPageChange,
503
503
  { page: e },
504
504
  { skip: e.skip, take: e.take },
@@ -507,15 +507,15 @@ const kn = (t, I, h, S) => {
507
507
  );
508
508
  }, mt = (e, n, o) => {
509
509
  var r;
510
- t.gridProps.pageable || (r = t.gridProps.group) != null && r.length ? t.gridProps.virtualSkipRef && (t.gridProps.virtualSkipRef.current = e.skip, O()) : te(e, n, o);
510
+ t.gridProps.pageable || (r = t.gridProps.group) != null && r.length ? t.gridProps.virtualSkipRef && (t.gridProps.virtualSkipRef.current = e.skip, U()) : te(e, n, o);
511
511
  }, ge = () => {
512
512
  let e = t.gridProps.total || 0;
513
513
  return Array.isArray(t.gridProps.data) ? e = e || t.gridProps.data.length : t.gridProps.data && (e = e || t.gridProps.data.total), e;
514
- }, Pt = () => {
515
- y && t.gridProps.virtualSkipRef && (t.gridProps.virtualSkipRef.current = 0);
516
- }, ht = (e) => {
517
- var i, d;
518
- const n = (d = (i = t.gridProps.take) != null ? i : t.gridProps.pageSize) != null ? d : 0, o = (t.gridProps.skip || 0) + n, r = ge();
514
+ }, ht = () => {
515
+ x && t.gridProps.virtualSkipRef && (t.gridProps.virtualSkipRef.current = 0);
516
+ }, Pt = (e) => {
517
+ var i, a;
518
+ const n = (a = (i = t.gridProps.take) != null ? i : t.gridProps.pageSize) != null ? a : 0, o = (t.gridProps.skip || 0) + n, r = ge();
519
519
  o < r && te({ skip: o, take: n }, e);
520
520
  }, Rt = (e) => {
521
521
  var r, i;
@@ -523,15 +523,15 @@ const kn = (t, I, h, S) => {
523
523
  o >= 0 && te({ skip: o, take: n }, e);
524
524
  }, bt = (e) => {
525
525
  te({ skip: e.skip, take: e.take }, e.syntheticEvent, e.targetEvent);
526
- }, Te = (e, n) => {
527
- z(
526
+ }, He = (e, n) => {
527
+ B(
528
528
  t.gridProps.onSortChange,
529
529
  { sort: e },
530
- { sort: e, ...y && !t.gridProps.pageable ? { skip: 0 } : {} },
530
+ { sort: e, ...x && !t.gridProps.pageable ? { skip: 0 } : {} },
531
531
  n
532
532
  );
533
533
  }, vt = (e, n) => {
534
- z(
534
+ B(
535
535
  t.gridProps.onFilterChange,
536
536
  { filter: e },
537
537
  { filter: e, skip: 0 },
@@ -539,7 +539,7 @@ const kn = (t, I, h, S) => {
539
539
  );
540
540
  }, It = (e) => {
541
541
  if (!e || e.length === 0) {
542
- He({});
542
+ Te({});
543
543
  return;
544
544
  }
545
545
  const n = qe(
@@ -548,9 +548,9 @@ const kn = (t, I, h, S) => {
548
548
  t.columnsRef,
549
549
  t.gridProps.dataItemKey
550
550
  );
551
- He({ ...n });
552
- }, He = (e) => {
553
- z(
551
+ Te({ ...n });
552
+ }, Te = (e) => {
553
+ B(
554
554
  t.gridProps.onHighlightChange,
555
555
  { highlight: e },
556
556
  {},
@@ -560,16 +560,16 @@ const kn = (t, I, h, S) => {
560
560
  const n = t.gridProps.searchFields || t.columnsRef.map((i) => i.field) || [], o = e.nativeEvent.target.value, r = {
561
561
  logic: "or",
562
562
  filters: n.filter((i) => i !== void 0).map((i) => {
563
- var d;
563
+ var a;
564
564
  return typeof i == "string" ? { field: i, value: o, operator: "contains" } : {
565
565
  value: o,
566
- operator: (d = i.operator) != null ? d : "contains",
566
+ operator: (a = i.operator) != null ? a : "contains",
567
567
  field: i.field,
568
568
  ignoreCase: i.ignoreCase
569
569
  };
570
570
  })
571
571
  };
572
- z(
572
+ B(
573
573
  t.gridProps.onSearchChange,
574
574
  {
575
575
  search: r
@@ -579,111 +579,129 @@ const kn = (t, I, h, S) => {
579
579
  );
580
580
  }, fe = () => {
581
581
  var e;
582
- (e = A.current) == null || e.save();
582
+ (e = O.current) == null || e.save();
583
583
  }, Et = async (e) => {
584
584
  var n, o;
585
585
  (n = t.gridProps) != null && n.onPdfExport && await ((o = t.gridProps) == null ? void 0 : o.onPdfExport(e));
586
586
  }, me = (e, n) => {
587
587
  const o = n.nativeEvent ? n : { nativeEvent: n.nativeEvent || n.originalEvent };
588
588
  let r = {};
589
- t.isVirtualScroll && e.length && !t.gridProps.pageable && (r = { take: void 0 }), e.length === 0 && t.gridProps.navigatable && (ve.current = !0), z(
589
+ t.isVirtualScroll && e.length && !t.gridProps.pageable && (r = { take: void 0 }), e.length === 0 && t.gridProps.navigatable && (ve.current = !0), B(
590
590
  t.gridProps.onGroupChange,
591
591
  { group: e },
592
592
  { group: e, skip: 0, ...r },
593
593
  o
594
594
  );
595
- }, Pe = (e) => {
595
+ }, he = (e) => {
596
596
  if (t.gridProps.onColumnsStateChange) {
597
597
  const n = {
598
- target: E.current,
598
+ target: y.current,
599
599
  columnsState: e
600
600
  };
601
- c(t.gridProps.onColumnsStateChange, n);
601
+ g(t.gridProps.onColumnsStateChange, n);
602
602
  }
603
603
  }, ne = (e, n, o) => {
604
- const { columnsRef: r, columnsState: i } = t, d = r[e], l = bn(i), s = d.depth, u = (P) => {
604
+ const { columnsRef: r, columnsState: i } = t, a = r[e], c = bn(i), f = a.depth, l = (m) => {
605
605
  do
606
- P++;
607
- while (P < r.length && r[P].depth > s);
608
- return P;
609
- }, m = r.splice(e, u(e) - e);
610
- r.splice(e < n ? u(n - m.length) : n, 0, ...m), r.filter((P) => P.declarationIndex >= 0).forEach((P, J) => {
611
- P.orderIndex = J;
612
- const X = l.find((Y) => Y.id === P.id);
613
- X && (X.orderIndex = J);
606
+ m++;
607
+ while (m < r.length && r[m].depth > f);
608
+ return m;
609
+ }, u = r.splice(e, l(e) - e);
610
+ r.splice(e < n ? l(n - u.length) : n, 0, ...u), r.filter((m) => m.declarationIndex >= 0).forEach((m, S) => {
611
+ m.orderIndex = S;
612
+ const z = c.find((Y) => Y.id === m.id);
613
+ z && (z.orderIndex = S);
614
614
  });
615
- const f = r[e].locked && r[n].locked;
616
- cn(t.columnsMapRef, r, f || le.current), sn(t.columnsMapRef, r, f || le.current), be.current && (le.current = !1, be.current = !1);
617
- const w = ee();
618
- if (O(), t.gridProps.onColumnReorder) {
619
- const P = {
620
- target: E.current,
621
- columns: w,
622
- columnId: d.id,
615
+ const s = r[e].locked && r[n].locked;
616
+ ln(t.columnsMapRef, r, s || ce.current), sn(t.columnsMapRef, r, s || ce.current), be.current && (ce.current = !1, be.current = !1);
617
+ const v = ee();
618
+ if (U(), t.gridProps.onColumnReorder) {
619
+ const m = {
620
+ target: y.current,
621
+ columns: v,
622
+ columnId: a.id,
623
623
  nativeEvent: o
624
624
  };
625
- c(t.gridProps.onColumnReorder, P);
625
+ g(t.gridProps.onColumnReorder, m);
626
626
  }
627
- Pe(i);
628
- }, W = (e, n, o) => {
627
+ he(i);
628
+ }, J = (e, n, o) => {
629
629
  const r = typeof t.gridProps.rowReorderable == "object" ? t.gridProps.rowReorderable.enabled : t.gridProps.rowReorderable;
630
- if (o === "forbidden" || !r || !$.current)
630
+ if (o === "forbidden" || !r || !X.current)
631
631
  return;
632
632
  const i = t.dataRef[n];
633
- t.gridProps.onRowReorder && c(t.gridProps.onRowReorder, {
634
- draggedDataItems: [$.current],
633
+ t.gridProps.onRowReorder && g(t.gridProps.onRowReorder, {
634
+ draggedDataItems: [X.current],
635
635
  droppedDataItem: i == null ? void 0 : i.dataItem,
636
636
  dropPosition: o,
637
637
  nativeEvent: e.originalEvent,
638
638
  dragEvent: e,
639
- target: E.current
640
- }), $.current = null;
639
+ target: y.current
640
+ }), X.current = null;
641
641
  }, wt = (e, n, o) => {
642
642
  if (t.gridProps.group === void 0)
643
643
  return;
644
644
  const r = t.gridProps.group.slice();
645
645
  r.splice(n, 0, ...r.splice(e, 1)), me(r, o);
646
- }, Ae = (e, n, o) => {
646
+ }, Ge = (e, n, o) => {
647
647
  const r = t.columnsRef[e].field;
648
648
  if (!r)
649
649
  return;
650
650
  const i = (t.gridProps.group || []).slice();
651
651
  i.splice(n, 0, { field: r }), me(i, o);
652
652
  }, yt = (e, n) => {
653
- const o = K.current.getCurrentGroupsLength;
654
- Ae(e, o, n);
655
- }, he = () => {
653
+ const o = H.current.getCurrentGroupsLength;
654
+ Ge(e, o, n);
655
+ }, Pe = () => {
656
+ var o, r, i, a, c, f;
657
+ if (t.gridProps.dataLayoutMode === "stacked") {
658
+ const l = ((o = M.current) == null ? void 0 : o.offsetWidth) || 0;
659
+ if ((r = C.current) != null && r.colGroupMain && l) {
660
+ const u = C.current.colGroupMain.children, s = u.length - 1;
661
+ if (s >= 0) {
662
+ let v = 0;
663
+ for (let S = 0; S < s; S++) {
664
+ const z = parseFloat((u[S].width || 0).toString()) || u[S].clientWidth;
665
+ v += z;
666
+ }
667
+ const m = Math.max(0, l - v);
668
+ u[s].width = m + "px", (a = (i = C.current.colGroupHeader) == null ? void 0 : i.children) != null && a[s] && (C.current.colGroupHeader.children[s].width = m + "px"), (f = (c = C.current.colGroupFooter) == null ? void 0 : c.children) != null && f[s] && (C.current.colGroupFooter.children[s].width = m + "px");
669
+ }
670
+ }
671
+ F.current && F.current.setWidth(l), L.current && L.current.setWidth(l), A.current && (A.current.style.width = l ? l + "px" : "");
672
+ return;
673
+ }
656
674
  let e = 0;
657
- if (!D.current.colGroupMain)
675
+ if (!C.current.colGroupMain)
658
676
  return;
659
- const n = D.current.colGroupMain.children;
660
- for (let o = 0; o < n.length; o++) {
661
- const r = n[o].width;
662
- if (!r) {
677
+ const n = C.current.colGroupMain.children;
678
+ for (let l = 0; l < n.length; l++) {
679
+ const u = n[l].width;
680
+ if (!u) {
663
681
  e = 0;
664
682
  break;
665
683
  }
666
- e += parseFloat(r.toString());
684
+ e += parseFloat(u.toString());
667
685
  }
668
- e = Math.round(e), _.current && _.current.setWidth(e), q.current && q.current.setWidth(e), j.current && (j.current.style.width = e ? e + "px" : "");
669
- }, Ge = () => {
686
+ e = Math.round(e), F.current && F.current.setWidth(e), L.current && L.current.setWidth(e), A.current && (A.current.style.width = e ? e + "px" : "");
687
+ }, Ae = () => {
670
688
  var e;
671
- t.gridProps.widthRef && (t.gridProps.widthRef.current = ((e = H.current) == null ? void 0 : e.offsetWidth) || 0);
689
+ t.gridProps.widthRef && (t.gridProps.widthRef.current = ((e = M.current) == null ? void 0 : e.offsetWidth) || 0);
672
690
  }, re = () => {
673
691
  var e;
674
- t.gridProps.containerHeightRef && (t.gridProps.containerHeightRef.current = ((e = T.current) == null ? void 0 : e.offsetHeight) || 0);
692
+ t.gridProps.containerHeightRef && (t.gridProps.containerHeightRef.current = ((e = G.current) == null ? void 0 : e.offsetHeight) || 0);
675
693
  }, xt = () => {
676
694
  const e = t.gridProps.minRowHeightRef;
677
695
  if (e && !e.current && !t.gridProps.rowHeight) {
678
- const n = vn(B.current);
679
- n && (e.current = n, O());
696
+ const n = vn(q.current);
697
+ n && (e.current = n, U());
680
698
  }
681
- }, oe = a.useCallback(
699
+ }, oe = d.useCallback(
682
700
  (e, n, o, r, i) => {
683
- var u;
701
+ var l;
684
702
  if (!St() && !o || !e)
685
703
  return;
686
- const d = {
704
+ const a = {
687
705
  type: e,
688
706
  nativeEvent: n,
689
707
  columns: t.columnsRef,
@@ -692,15 +710,15 @@ const kn = (t, I, h, S) => {
692
710
  field: i,
693
711
  ...typeof t.gridProps.clipboard != "boolean" ? t.gridProps.clipboard : {},
694
712
  ...o
695
- }, l = C(), s = Xt({
696
- event: d,
697
- data: l,
698
- selectedState: (u = t.gridProps.select) != null ? u : {},
699
- previousCopiedItems: Ne.current
713
+ }, c = w(), f = Xt({
714
+ event: a,
715
+ data: c,
716
+ selectedState: (l = t.gridProps.select) != null ? l : {},
717
+ previousCopiedItems: We.current
700
718
  });
701
- e !== ke.paste && (Ne.current = s.copiedItems), t.gridProps.onClipboard && I && c(t.gridProps.onClipboard, {
702
- ...d,
703
- ...s
719
+ e !== ke.paste && (We.current = f.copiedItems), t.gridProps.onClipboard && E && g(t.gridProps.onClipboard, {
720
+ ...a,
721
+ ...f
704
722
  });
705
723
  },
706
724
  [
@@ -711,22 +729,22 @@ const kn = (t, I, h, S) => {
711
729
  t.gridProps.onClipboard
712
730
  ]
713
731
  ), St = () => {
714
- var i, d, l;
732
+ var i, a, c;
715
733
  if (!Q)
716
734
  return !1;
717
- const e = jt(k()), n = e ? e.matches(".k-table-td") ? e : (i = k()) == null ? void 0 : i.body : (d = k()) == null ? void 0 : d.body, o = n.closest(".k-grid-container"), r = n && ((l = H.current) == null ? void 0 : l.contains(n));
735
+ const e = jt(K()), n = e ? e.matches(".k-table-td") ? e : (i = K()) == null ? void 0 : i.body : (a = K()) == null ? void 0 : a.body, o = n.closest(".k-grid-container"), r = n && ((c = M.current) == null ? void 0 : c.contains(n));
718
736
  return !!(n && r && o);
719
- }, Le = (e, n, o, r, i, d, l) => {
720
- he(), le.current = !0, be.current = !0, t.gridProps.onColumnResize && I && c(t.gridProps.onColumnResize, {
737
+ }, Le = (e, n, o, r, i, a, c) => {
738
+ Pe(), ce.current = !0, be.current = !0, t.gridProps.onColumnResize && E && g(t.gridProps.onColumnResize, {
721
739
  columns: ee(),
722
740
  nativeEvent: r,
723
- targetColumnId: l,
741
+ targetColumnId: c,
724
742
  index: e,
725
743
  newWidth: n,
726
744
  oldWidth: o,
727
745
  end: i,
728
- target: E.current
729
- }), i && Pe(d);
746
+ target: y.current
747
+ }), i && he(a);
730
748
  }, kt = () => {
731
749
  var e;
732
750
  return {
@@ -739,7 +757,7 @@ const kn = (t, I, h, S) => {
739
757
  }, R = (e) => ({
740
758
  nativeEvent: e && e.nativeEvent,
741
759
  syntheticEvent: e,
742
- target: E.current
760
+ target: y.current
743
761
  }), Dt = (e) => ({
744
762
  ...e,
745
763
  nativeEvent: void 0,
@@ -747,7 +765,7 @@ const kn = (t, I, h, S) => {
747
765
  target: void 0,
748
766
  targetEvent: void 0,
749
767
  focusElement: void 0
750
- }), c = (e, n) => {
768
+ }), g = (e, n) => {
751
769
  if (t.gridProps.isClient) {
752
770
  e(n);
753
771
  return;
@@ -755,40 +773,40 @@ const kn = (t, I, h, S) => {
755
773
  e(Dt(n));
756
774
  }, Kt = () => {
757
775
  var e, n, o;
758
- if (B.current && ((e = B.current) == null ? void 0 : e.getElementsByClassName("k-grid-edit-row").length) > 0) {
776
+ if (q.current && ((e = q.current) == null ? void 0 : e.getElementsByClassName("k-grid-edit-row").length) > 0) {
759
777
  Ce.current = !1, (n = document.activeElement) != null && n.closest(".k-grid-edit-row") ? Ie.current = document.activeElement : Ie.current = void 0;
760
- const r = Array.from((o = B.current) == null ? void 0 : o.getElementsByClassName("k-grid-edit-row"));
778
+ const r = Array.from((o = q.current) == null ? void 0 : o.getElementsByClassName("k-grid-edit-row"));
761
779
  r.length > xe.current.length ? de.current = r.filter(
762
780
  (i) => !xe.current.includes(i)
763
781
  )[0] : r.length === 1 && (de.current = r[0], Ce.current = !0), xe.current = r;
764
782
  }
765
- }, C = () => t.dataRef.filter((e) => e.rowType === "data").map((e) => e.dataItem), k = () => {
783
+ }, w = () => t.dataRef.filter((e) => e.rowType === "data").map((e) => e.dataItem), K = () => {
766
784
  var e;
767
785
  if (Q)
768
786
  return ((e = ie()) == null ? void 0 : e.ownerDocument) || document;
769
- }, ie = () => H.current, Re = a.useCallback(
787
+ }, ie = () => M.current, Re = d.useCallback(
770
788
  (e) => {
771
789
  var r, i;
772
790
  if (!b.current || !((r = b.current) != null && r.container) || t.gridProps.scrollable === "none")
773
791
  return;
774
- N.current && N.current.disconnect();
792
+ j.current && j.current.disconnect();
775
793
  const { rowIndex: n } = e, o = ie();
776
- if (y) {
777
- const d = ((i = b.current.rowHeightService) == null ? void 0 : i.offset(n)) || 0;
778
- b.current.container.scroll(0, d);
794
+ if (x) {
795
+ const a = ((i = b.current.rowHeightService) == null ? void 0 : i.offset(n)) || 0;
796
+ b.current.container.scroll(0, a);
779
797
  } else if (o) {
780
- const d = n < 1 ? o.querySelector("tbody > tr:nth-child(1)") : o.querySelector(`tbody > tr:nth-child(${n + 1})`);
781
- d && T.current && (T.current.scrollTop = d.offsetTop);
798
+ const a = n < 1 ? o.querySelector("tbody > tr:nth-child(1)") : o.querySelector(`tbody > tr:nth-child(${n + 1})`);
799
+ a && G.current && (G.current.scrollTop = a.offsetTop);
782
800
  }
783
801
  },
784
802
  [t.gridProps.scrollable]
785
- ), ze = (e) => JSON.stringify(e.map((n) => ({ id: n.id, field: n.field, title: n.title, children: n.children }))), Mt = () => ze(Ft) === ze(t.columnsRef), Tt = () => {
786
- ce.current = window.innerWidth, Mt() || O();
787
- }, Ht = () => {
788
- var d;
789
- const { virtualTotal: e, virtualPageSize: n, gridProps: o } = t, r = b.current, i = t.gridProps.rowHeight || ((d = o.minRowHeightRef) == null ? void 0 : d.current) || 0;
790
- r && (r.fixedScroll = o.fixedScroll || !1, r.PageChange = mt, r.pageSize = n, r.scrollableVirtual = y, r.container = T.current, r.tableBody = B.current, r.scrollHeightContainer = Fe.current, r.table = j.current, (!r.rowHeightService || r.total !== e) && i && (r.total = e, r.rowHeightService = new $t(e, i)));
791
- }, Oe = a.useCallback(
803
+ ), Fe = (e) => JSON.stringify(e.map((n) => ({ id: n.id, field: n.field, title: n.title, children: n.children }))), Mt = () => Fe(Ot) === Fe(t.columnsRef), Ht = () => {
804
+ le.current = window.innerWidth, Mt() || U();
805
+ }, Tt = () => {
806
+ var a;
807
+ const { virtualTotal: e, virtualPageSize: n, gridProps: o } = t, r = b.current, i = t.gridProps.rowHeight || ((a = o.minRowHeightRef) == null ? void 0 : a.current) || 0;
808
+ r && (r.fixedScroll = o.fixedScroll || !1, r.PageChange = mt, r.pageSize = n, r.scrollableVirtual = x, r.container = G.current, r.tableBody = q.current, r.scrollHeightContainer = Oe.current, r.table = A.current, (!r.rowHeightService || r.total !== e) && i && (r.total = e, r.rowHeightService = new $t(e, i)));
809
+ }, ze = d.useCallback(
792
810
  (e) => {
793
811
  const n = { rowIndex: ye.current };
794
812
  e.forEach((o) => {
@@ -796,17 +814,17 @@ const kn = (t, I, h, S) => {
796
814
  });
797
815
  },
798
816
  [Re]
799
- ), O = () => {
817
+ ), U = () => {
800
818
  t.gridProps.forceUpdate && t.gridProps.forceUpdate();
801
- }, At = (e) => e.left !== void 0 ? Se !== "rtl" ? { left: e.left, right: e.right } : { left: e.right, right: e.left } : {}, E = a.useRef(null), b = a.useRef(void 0), D = a.useRef(void 0), K = a.useRef(void 0), M = a.useRef(void 0), F = a.useRef(void 0), ae = a.useRef(void 0), N = a.useRef(null), B = a.useRef(null), Gt = a.useRef(null), T = a.useRef(null), j = a.useRef(null), Lt = a.useRef(null), H = a.useRef(null), Fe = a.useRef(null), q = a.useRef(null), _ = a.useRef(null), be = a.useRef(!1), ve = a.useRef(!1), de = a.useRef(void 0), Ie = a.useRef(void 0), Ce = a.useRef(!1), le = a.useRef(!0), Ee = a.useRef(0), we = a.useRef(void 0), ye = a.useRef(void 0), xe = a.useRef([]), Ne = a.useRef([]), ce = a.useRef(0), $ = a.useRef(null), zt = a.useRef(null), Ot = a.useRef(null), Se = qt(H), y = t.isVirtualScroll, Ft = a.useMemo(() => a.Children.toArray(t.gridProps.children), [t.gridProps.children]), Be = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, g = se(t.gridProps.selectable), Ue = Yt(t.gridProps.editable), Nt = ce.current && V && ce.current <= V.medium && t.gridProps.adaptive;
802
- return a.useMemo(() => {
803
- U.onConstructor({
819
+ }, Gt = (e) => e.left !== void 0 ? Se !== "rtl" ? { left: e.left, right: e.right } : { left: e.right, right: e.left } : {}, y = d.useRef(null), b = d.useRef(void 0), C = d.useRef(void 0), H = d.useRef(void 0), T = d.useRef(void 0), V = d.useRef(void 0), ae = d.useRef(void 0), j = d.useRef(null), q = d.useRef(null), At = d.useRef(null), G = d.useRef(null), A = d.useRef(null), Lt = d.useRef(null), M = d.useRef(null), Oe = d.useRef(null), L = d.useRef(null), F = d.useRef(null), be = d.useRef(!1), ve = d.useRef(!1), de = d.useRef(void 0), Ie = d.useRef(void 0), Ce = d.useRef(!1), ce = d.useRef(!0), Ee = d.useRef(0), we = d.useRef(void 0), ye = d.useRef(void 0), xe = d.useRef([]), We = d.useRef([]), le = d.useRef(0), X = d.useRef(null), Ft = d.useRef(null), zt = d.useRef(null), Se = qt(M), x = t.isVirtualScroll, Ot = d.useMemo(() => d.Children.toArray(t.gridProps.children), [t.gridProps.children]), Ne = t.gridProps.groupable === !0 || typeof t.gridProps.groupable == "object" && t.gridProps.groupable.enabled !== !1, h = se(t.gridProps.selectable), Be = Yt(t.gridProps.editable), Wt = le.current && $ && le.current <= $.medium && t.gridProps.adaptive;
820
+ return d.useMemo(() => {
821
+ _.onConstructor({
804
822
  navigatable: !!t.gridProps.navigatable,
805
- contextStateRef: M,
806
- navigationStateRef: F,
823
+ contextStateRef: T,
824
+ navigationStateRef: V,
807
825
  idPrefix: t.id
808
826
  }), b.current = new In();
809
- }, []), a.useMemo(() => {
827
+ }, []), d.useMemo(() => {
810
828
  var e;
811
829
  (e = b.current) == null || e.reset();
812
830
  }, [
@@ -814,60 +832,60 @@ const kn = (t, I, h, S) => {
814
832
  t.gridProps.total,
815
833
  t.gridProps.filter,
816
834
  t.gridProps.group,
817
- Be,
835
+ Ne,
818
836
  t.gridProps.sort,
819
837
  t.gridProps.rowHeight
820
- ]), a.useEffect(() => (t.gridProps.clipboard && (ae.current = new Qt(oe), ae.current.addEventListeners(k())), () => {
821
- ae.current && ae.current.removeEventListeners(k());
822
- }), [t.gridProps.onClipboard, t.gridProps.clipboard, oe, k]), a.useEffect(() => (Ge(), he(), Ve(), U.onComponentDidMount({
823
- scope: H.current || void 0,
824
- contextStateRef: M,
825
- navigationStateRef: F
838
+ ]), d.useEffect(() => (t.gridProps.clipboard && (ae.current = new Qt(oe), ae.current.addEventListeners(K())), () => {
839
+ ae.current && ae.current.removeEventListeners(K());
840
+ }), [t.gridProps.onClipboard, t.gridProps.clipboard, oe, K]), d.useEffect(() => (Ae(), Pe(), Ue(), _.onComponentDidMount({
841
+ scope: M.current || void 0,
842
+ contextStateRef: T,
843
+ navigationStateRef: V
826
844
  }), () => {
827
845
  clearTimeout(we.current);
828
- }), []), a.useEffect(() => {
846
+ }), []), d.useEffect(() => {
829
847
  var e;
830
- Ge(), he(), Ve(), y && (re(), xt(), (e = b.current) == null || e.update()), Kt(), U.onComponentDidUpdate({
831
- scope: H.current || void 0,
832
- contextStateRef: M,
833
- navigationStateRef: F,
848
+ Ae(), Pe(), Ue(), x && (re(), xt(), (e = b.current) == null || e.update()), Kt(), _.onComponentDidUpdate({
849
+ scope: M.current || void 0,
850
+ contextStateRef: T,
851
+ navigationStateRef: V,
834
852
  focusFirst: ve.current,
835
853
  newEditableRow: de.current,
836
854
  singleEditRow: Ce.current,
837
855
  lastActiveElement: Ie.current,
838
856
  navigatable: t.gridProps.navigatable
839
857
  }), ve.current = !1, de.current = void 0;
840
- }), a.useEffect(() => {
858
+ }), d.useEffect(() => {
841
859
  if (Q) {
842
860
  const e = {
843
861
  rootMargin: "0px",
844
862
  threshold: 0.9
845
863
  };
846
- N.current = window.IntersectionObserver && new window.IntersectionObserver(Oe, e) || null;
864
+ j.current = window.IntersectionObserver && new window.IntersectionObserver(ze, e) || null;
847
865
  }
848
- }, [Oe]), a.useEffect(() => {
866
+ }, [ze]), d.useEffect(() => {
849
867
  var n;
850
868
  let e;
851
869
  return Q && window.ResizeObserver && (e = new window.ResizeObserver(() => {
852
- Tt(), y && re();
853
- }), e.observe((n = k()) == null ? void 0 : n.body)), () => {
870
+ Ht(), x && re();
871
+ }), e.observe((n = K()) == null ? void 0 : n.body)), () => {
854
872
  e == null || e.disconnect();
855
873
  };
856
- }, []), a.useEffect(() => {
857
- if (!Q || !window.ResizeObserver || !y || !T.current)
874
+ }, []), d.useEffect(() => {
875
+ if (!Q || !window.ResizeObserver || !x || !G.current)
858
876
  return;
859
877
  const e = () => {
860
- var i, d;
878
+ var i, a;
861
879
  const o = ((i = t.gridProps.containerHeightRef) == null ? void 0 : i.current) || 0;
862
880
  re();
863
- const r = ((d = t.gridProps.containerHeightRef) == null ? void 0 : d.current) || 0;
864
- (o === 0 && r > 0 || Math.abs(r - o) > 10) && O();
881
+ const r = ((a = t.gridProps.containerHeightRef) == null ? void 0 : a.current) || 0;
882
+ (o === 0 && r > 0 || Math.abs(r - o) > 10) && U();
865
883
  }, n = new window.ResizeObserver(e);
866
- return n.observe(T.current), () => {
884
+ return n.observe(G.current), () => {
867
885
  n.disconnect();
868
886
  };
869
- }, [y, re]), a.useImperativeHandle(
870
- E,
887
+ }, [x, re]), d.useImperativeHandle(
888
+ y,
871
889
  () => ({
872
890
  get element() {
873
891
  return ie();
@@ -883,51 +901,51 @@ const kn = (t, I, h, S) => {
883
901
  const { rowIndex: n } = e;
884
902
  ye.current = n;
885
903
  const o = ie();
886
- if (N.current && o) {
887
- N.current.disconnect();
904
+ if (j.current && o) {
905
+ j.current.disconnect();
888
906
  const i = o.querySelector(`[absolute-row-index="${ye.current}"]`);
889
- i ? N.current.observe(i) : Re(e);
907
+ i ? j.current.observe(i) : Re(e);
890
908
  }
891
909
  },
892
910
  fitColumns: (e) => {
893
- D.current.dblClickHandler(null, e);
911
+ C.current.dblClickHandler(null, e);
894
912
  },
895
913
  exportAsPdf: fe,
896
914
  getTotal: ge,
897
- getLeafDataItems: C
915
+ getLeafDataItems: w
898
916
  })
899
- ), a.useImperativeHandle(t.gridRef, () => E.current), a.useMemo(() => {
900
- D.current = new un(Le);
901
- }, [t.gridProps.onColumnResize, t.columnsRef]), a.useMemo(() => {
902
- K.current = new gn(ne, wt, Ae);
917
+ ), d.useImperativeHandle(t.gridRef, () => y.current), d.useMemo(() => {
918
+ C.current = new un(Le);
919
+ }, [t.gridProps.onColumnResize, t.columnsRef]), d.useMemo(() => {
920
+ H.current = new gn(ne, wt, Ge);
903
921
  }, [
904
922
  t.gridProps.onColumnReorder,
905
923
  t.gridProps.onGroupChange,
906
924
  t.gridProps.group,
907
925
  t.columnsRef,
908
926
  t.gridProps.groupable
909
- ]), D.current.resizable = t.gridProps.resizable || !1, D.current.columns = t.columnsRef, D.current.columnsState = _t(t.columnsState), K.current.reorderable = t.gridProps.reorderable || !1, K.current.groupable = Be, K.current.columns = t.columnsRef, K.current.dir = Se, Ht(), /* @__PURE__ */ a.createElement(
927
+ ]), C.current.resizable = t.gridProps.resizable || !1, C.current.columns = t.columnsRef, C.current.columnsState = _t(t.columnsState), H.current.reorderable = t.gridProps.reorderable || !1, H.current.groupable = Ne, H.current.columns = t.columnsRef, H.current.dir = Se, Tt(), /* @__PURE__ */ d.createElement(
910
928
  xn.Provider,
911
929
  {
912
930
  value: {
913
- isClient: I,
914
- rowReorder: W,
915
- activeDragRowDataItemRef: $,
916
- reorderRowDragTargetRef: zt,
917
- reorderRowDropTargetRef: Ot,
931
+ isClient: E,
932
+ rowReorder: J,
933
+ activeDragRowDataItemRef: X,
934
+ reorderRowDragTargetRef: Ft,
935
+ reorderRowDropTargetRef: zt,
918
936
  dir: Se,
919
- getCellPositionStyle: At,
937
+ getCellPositionStyle: Gt,
920
938
  dataItemKey: t.gridProps.dataItemKey,
921
939
  columnsState: t.columnsState,
922
940
  columnsRef: t.columnsRef,
923
941
  hiddenColumnsRef: t.hiddenColumnsRef,
924
- onColumnsStateChange: Pe,
942
+ onColumnsStateChange: he,
925
943
  groupable: t.gridProps.groupable,
926
944
  group: t.gridProps.group,
927
945
  reorderable: t.gridProps.reorderable,
928
946
  defaultGroup: t.gridProps.defaultGroup,
929
947
  groupChange: me,
930
- selectionRelease: ct,
948
+ selectionRelease: lt,
931
949
  pagerPageChange: bt,
932
950
  onContextMenu: $e,
933
951
  rowClick: Ze,
@@ -947,12 +965,12 @@ const kn = (t, I, h, S) => {
947
965
  skip: t.gridProps.skip,
948
966
  take: t.gridProps.take,
949
967
  defaultSort: t.gridProps.defaultSort,
950
- sortChange: Te,
968
+ sortChange: He,
951
969
  filterable: t.gridProps.filterable,
952
970
  filter: t.gridProps.filter,
953
971
  defaultFilter: t.gridProps.defaultFilter,
954
972
  filterOperators: t.gridProps.filterOperators || Sn,
955
- getLeafDataItems: C,
973
+ getLeafDataItems: w,
956
974
  filterChange: vt,
957
975
  applyHighlightDescriptor: It,
958
976
  applySelectionDescriptor: gt,
@@ -960,58 +978,58 @@ const kn = (t, I, h, S) => {
960
978
  select: t.gridProps.select,
961
979
  searchChange: Ct,
962
980
  exportAsPdf: fe,
963
- onHeaderSelectionChange: lt,
981
+ onHeaderSelectionChange: ct,
964
982
  columnGroupChange: yt,
965
983
  onKeyDown: Xe,
966
984
  onFocus: Ye,
967
985
  scrollHandler: Je,
968
986
  selectionChange: at,
969
- mobileMode: Nt,
970
- adaptiveColumnMenuRef: ce.current,
987
+ mobileMode: Wt,
988
+ adaptiveColumnMenuRef: le.current,
971
989
  adpativeTitle: t.gridProps.adaptiveTitle,
972
990
  adaptive: t.gridProps.adaptive,
973
991
  dispatchDetailExpand: rt,
974
992
  dispatchGroupExpand: ot,
975
- columnResizeRef: D,
976
- dragLogicRef: K,
977
- navigationStateRef: F,
978
- tableElementRef: j,
979
- tableBodyElementRef: B,
980
- headerElementRef: Gt,
981
- containerElementRef: T,
993
+ columnResizeRef: C,
994
+ dragLogicRef: H,
995
+ navigationStateRef: V,
996
+ tableElementRef: A,
997
+ tableBodyElementRef: q,
998
+ headerElementRef: At,
999
+ containerElementRef: G,
982
1000
  headTableElementRef: Lt,
983
- elementRef: H,
984
- virtualScrollHeightContainerRef: Fe,
985
- footerRef: q,
986
- headerRef: _,
1001
+ elementRef: M,
1002
+ virtualScrollHeightContainerRef: Oe,
1003
+ footerRef: L,
1004
+ headerRef: F,
987
1005
  vsRef: b
988
1006
  }
989
1007
  },
990
- /* @__PURE__ */ a.createElement(Zt.Provider, { value: M.current }, t.children),
991
- /* @__PURE__ */ a.createElement(
1008
+ /* @__PURE__ */ d.createElement(Zt.Provider, { value: T.current }, t.children),
1009
+ /* @__PURE__ */ d.createElement(
992
1010
  Cn,
993
1011
  {
994
- show: h.show && (p == null ? void 0 : p.length),
995
- dataItem: h.dataItem,
996
- field: h.field,
1012
+ show: P.show && (p == null ? void 0 : p.length),
1013
+ dataItem: P.dataItem,
1014
+ field: P.field,
997
1015
  items: p,
998
- offset: h.offset,
999
- onClose: G,
1016
+ offset: P.offset,
1017
+ onClose: W,
1000
1018
  onSelect: _e
1001
1019
  }
1002
1020
  ),
1003
- t.gridProps.pdf && /* @__PURE__ */ a.createElement(
1021
+ t.gridProps.pdf && /* @__PURE__ */ d.createElement(
1004
1022
  yn,
1005
1023
  {
1006
1024
  gridProps: t.gridProps,
1007
1025
  innerGrid: t.innerGrid,
1008
1026
  pdf: typeof t.gridProps.pdf == "object" ? t.gridProps.pdf : {},
1009
1027
  onPdfExport: Et,
1010
- ref: (e) => A.current = e
1028
+ ref: (e) => O.current = e
1011
1029
  }
1012
1030
  )
1013
1031
  );
1014
1032
  };
1015
1033
  export {
1016
- Vn as GridClientWrapper
1034
+ Un as GridClientWrapper
1017
1035
  };