@progress/kendo-react-grid 13.4.0-develop.5 → 14.0.0-develop.1

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