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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/utils/index.mjs CHANGED
@@ -5,149 +5,158 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as w from "react";
8
+ import * as S from "react";
9
9
  import { gridDefaultProps as v } from "../GridColumn.mjs";
10
- import { getter as y } from "@progress/kendo-data-query";
10
+ import { getter as w } from "@progress/kendo-data-query";
11
11
  import { findGroupExpand as F, updateLeft as D, updateRight as E, tableKeyboardNavigationTools as p } from "@progress/kendo-react-data-tools";
12
12
  import { ServerFragment as M } from "./_serverModule.mjs";
13
13
  import { ClientFragment as b } from "./_clientModule.mjs";
14
- import { GridContextMenuItemNames as c } from "../contextMenu/enums.mjs";
14
+ import { GridContextMenuItemNames as s } from "../contextMenu/enums.mjs";
15
15
  import { canUseDOM as A } from "@progress/kendo-react-common";
16
- function J(e, t) {
17
- const n = (e != null ? e : "").split(".");
16
+ function K(e, t) {
17
+ const r = (e != null ? e : "").split(".");
18
18
  let i = t;
19
- return n.forEach((d) => {
20
- i = i ? i[d] : void 0;
19
+ return r.forEach((a) => {
20
+ i = i ? i[a] : void 0;
21
21
  }), i;
22
22
  }
23
- function R(e, t, n, i, d, o, r, a, l, f = 0, h) {
23
+ function R(e, t, r, i, a, d, f, n, l, c = 0, o) {
24
24
  var x;
25
- let g = f;
26
- for (let s = 0; s < t.length; s++) {
25
+ let g = c;
26
+ for (let h = 0; h < t.length; h++) {
27
27
  let I;
28
- if (!d || t[s].value === void 0 || t[s].items === void 0) {
28
+ if (!a || t[h].value === void 0 || t[h].items === void 0) {
29
29
  e[e.length] = {
30
30
  dataIndex: i.index,
31
- dataItem: t[s],
31
+ dataItem: t[h],
32
32
  rowType: "data",
33
- level: f,
34
- group: h,
33
+ level: c,
34
+ group: o,
35
35
  // This is related to detail-row expansion
36
- expanded: (x = l ? !!(o != null && o[y(l)(t[s])]) : !1) != null ? x : !1
36
+ expanded: (x = l ? !!(d != null && d[w(l)(t[h])]) : !1) != null ? x : !1
37
37
  }, i.index++;
38
38
  continue;
39
39
  } else {
40
- let S;
41
- h != null && h.parents ? S = [{ field: h.field, value: h.value }, ...h.parents] : h ? S = [h] : S = [], I = {
42
- field: t[s].field,
43
- value: t[s].value,
44
- parents: S
40
+ let y;
41
+ o != null && o.parents ? y = [{ field: o.field, value: o.value }, ...o.parents] : o ? y = [o] : y = [], I = {
42
+ field: t[h].field,
43
+ value: t[h].value,
44
+ parents: y
45
45
  };
46
46
  }
47
- g = Math.max(g, f + 1);
47
+ g = Math.max(g, c + 1);
48
48
  let C = !1;
49
- const u = F(r || [], I);
50
- u ? C = u.expanded !== !1 : C = a !== !1, e[e.length] = {
49
+ const u = F(f || [], I);
50
+ u ? C = u.expanded !== !1 : C = n !== !1, e[e.length] = {
51
51
  dataIndex: -1,
52
- dataItem: t[s],
53
- level: f,
52
+ dataItem: t[h],
53
+ level: c,
54
54
  group: I,
55
55
  rowType: "groupHeader",
56
56
  expanded: C
57
57
  }, C && (I.expanded = C, g = Math.max(
58
58
  R(
59
59
  e,
60
- t[s].items,
61
- n,
62
- i,
63
- d,
64
- o,
60
+ t[h].items,
65
61
  r,
62
+ i,
66
63
  a,
64
+ d,
65
+ f,
66
+ n,
67
67
  l,
68
- f + 1,
68
+ c + 1,
69
69
  I
70
70
  ),
71
71
  g
72
- )), (n === "always" || C && n === "visible") && (e[e.length] = {
72
+ )), (r === "always" || C && r === "visible") && (e[e.length] = {
73
73
  dataIndex: -1,
74
- dataItem: t[s],
74
+ dataItem: t[h],
75
75
  rowType: "groupFooter",
76
- level: f,
76
+ level: c,
77
77
  expanded: C
78
78
  });
79
79
  }
80
80
  return g;
81
81
  }
82
- const K = (e, t) => typeof e.colSpan == "function" ? e.colSpan({ dataItem: t, column: e }) : e.colSpan || 1;
83
- function Q(e, t) {
84
- const n = [[]];
85
- let i = 0;
86
- for (let r = e.length - 1; r >= 0; r--)
87
- i = Math.max(i, e[r].depth), e[r].headerColSpan = e[r].headerColSpan || 1, e[r].children.length > 0 && (e[r].headerColSpan = e[r].children.reduce(
88
- (a, l) => l.hidden ? a : a + l.headerColSpan,
82
+ function H(e, t) {
83
+ for (let r = 0; r < e.length; r++) {
84
+ const i = e[r];
85
+ if (!i.locked) {
86
+ const a = t[i.index];
87
+ a && (i.locked = a.locked);
88
+ }
89
+ }
90
+ }
91
+ const Q = (e, t) => typeof e.colSpan == "function" ? e.colSpan({ dataItem: t, column: e }) : e.colSpan || 1;
92
+ function X(e, t, r) {
93
+ const i = [[]];
94
+ let a = 0;
95
+ for (let n = e.length - 1; n >= 0; n--)
96
+ a = Math.max(a, e[n].depth), e[n].headerColSpan = e[n].headerColSpan || 1, e[n].children.length > 0 && (e[n].headerColSpan = e[n].children.reduce(
97
+ (l, c) => c.hidden ? l : l + c.headerColSpan,
89
98
  0
90
99
  ));
91
100
  const d = [];
92
- let o = 1;
93
- return e.forEach((r, a) => {
94
- n[r.depth] = n[r.depth] || [];
95
- let l = !1;
96
- n[r.depth].length === 0 && (o <= 1 ? o = 1 + (r.children.length > 0 ? 0 : i - r.depth) : (o--, l = !0)), r.rowSpan = 1 + (r.children.length > 0 ? 0 : i - r.depth), r.kFirst = l, r.index = n[r.depth].length, n[r.depth].push(a), r.ariaColumnIndex = d[r.depth] ? d[r.depth] + 1 : 1;
97
- for (let f = r.depth; f < r.depth + r.rowSpan; f++)
98
- d[f] = (d[f] || 0) + r.headerColSpan;
99
- }), D(n, e, t), E(n, e, t), n;
101
+ let f = 1;
102
+ return e.forEach((n, l) => {
103
+ i[n.depth] = i[n.depth] || [];
104
+ let c = !1;
105
+ i[n.depth].length === 0 && (f <= 1 ? f = 1 + (n.children.length > 0 ? 0 : a - n.depth) : (f--, c = !0)), n.rowSpan = 1 + (n.children.length > 0 ? 0 : a - n.depth), n.kFirst = c, n.index = i[n.depth].length, i[n.depth].push(l), n.ariaColumnIndex = d[n.depth] ? d[n.depth] + 1 : 1;
106
+ for (let o = n.depth; o < n.depth + n.rowSpan; o++)
107
+ d[o] = (d[o] || 0) + n.headerColSpan;
108
+ }), H(e, t), D(i, e, r), E(i, e, r), i;
100
109
  }
101
- function H(e, t, n, i = 0, d = !1) {
102
- const o = [];
110
+ function T(e, t, r, i = 0, a = !1) {
111
+ const d = [];
103
112
  if (!e)
104
113
  return [];
105
- e && e.length === void 0 && (e = [e]), e.forEach((a, l) => {
106
- a = a.props ? a.props : a;
107
- const f = a.id ? a.id : p.generateNavigatableId(`${n.prevId++}`, n.idPrefix, "column"), h = A && a.media && window.matchMedia ? !window.matchMedia(a.media).matches : !1, g = d || h || a.hidden, x = t == null ? void 0 : t.find((I) => I.id === f), s = H(a.children, (x == null ? void 0 : x.children) || [], n, i + 1, g);
108
- o.push(
114
+ e && e.length === void 0 && (e = [e]), e.forEach((n, l) => {
115
+ n = n.props ? n.props : n;
116
+ const c = n.id ? n.id : p.generateNavigatableId(`${r.prevId++}`, r.idPrefix, "column"), o = A && n.media && window.matchMedia ? !window.matchMedia(n.media).matches : !1, g = a || o || n.hidden, x = t == null ? void 0 : t.find((I) => I.id === c), h = T(n.children, (x == null ? void 0 : x.children) || [], r, i + 1, g);
117
+ d.push(
109
118
  Object.assign(
110
119
  { depth: i },
111
120
  v,
112
- s.length ? { cell: () => null, filterCell: () => null } : {},
113
- a,
121
+ h.length ? { cell: () => null, filterCell: () => null } : {},
122
+ n,
114
123
  {
115
- id: f,
116
- declarationIndex: o.length,
117
- children: s,
124
+ id: c,
125
+ declarationIndex: d.length,
126
+ children: h,
118
127
  headerColSpan: 0,
119
128
  rowSpan: 0,
120
- columnType: a.columnType || "data",
121
- colSpan: a.colSpan || 1,
129
+ columnType: n.columnType || "data",
130
+ colSpan: n.colSpan || 1,
122
131
  isAccessible: !0,
123
132
  hidden: g,
124
133
  left: null,
125
134
  right: null,
126
- rowSpannable: a.rowSpannable
135
+ rowSpannable: n.rowSpannable
127
136
  },
128
137
  x ? { width: x.width, orderIndex: x.orderIndex } : {}
129
138
  )
130
139
  );
131
140
  });
132
- const r = (a, l) => a.orderIndex === l.orderIndex ? a.declarationIndex - l.declarationIndex : (a.orderIndex || 0) - (l.orderIndex || 0);
133
- if (o.sort(r), i === 0) {
134
- const a = [], l = (f, h) => f.forEach((g) => {
135
- g.parentIndex = h, l(g.children, a.push(g) - 1);
141
+ const f = (n, l) => n.orderIndex === l.orderIndex ? n.declarationIndex - l.declarationIndex : (n.orderIndex || 0) - (l.orderIndex || 0);
142
+ if (d.sort(f), i === 0) {
143
+ const n = [], l = (c, o) => c.forEach((g) => {
144
+ g.parentIndex = o, l(g.children, n.push(g) - 1);
136
145
  });
137
- return l(o, -1), a;
146
+ return l(d, -1), n;
138
147
  }
139
- return o;
148
+ return d;
140
149
  }
141
- const T = (e) => Array.isArray(e) ? e : e ? e.data : [];
142
- function X(e, t, n, i) {
143
- const d = T(e), o = [];
144
- if (d.length > 0) {
145
- let r = d[0];
150
+ const k = (e) => Array.isArray(e) ? e : e ? e.data : [];
151
+ function Y(e, t, r, i) {
152
+ const a = k(e), d = [];
153
+ if (a.length > 0) {
154
+ let f = a[0];
146
155
  if (t)
147
156
  for (let l = 0; l < t.length; l++)
148
- r = r.items && r.items[0];
149
- Object.getOwnPropertyNames(r).forEach((l) => {
150
- l !== n.column && o.push(
157
+ f = f.items && f.items[0];
158
+ Object.getOwnPropertyNames(f).forEach((l) => {
159
+ l !== r.column && d.push(
151
160
  Object.assign(
152
161
  {
153
162
  id: p.generateNavigatableId(`${i.prevId++}`, i.idPrefix, "column"),
@@ -172,32 +181,32 @@ function X(e, t, n, i) {
172
181
  );
173
182
  });
174
183
  }
175
- return o;
184
+ return d;
176
185
  }
177
186
  const m = (e, t) => {
178
187
  var i;
179
- let n = e[t.parentIndex];
180
- for (; n; ) {
181
- if ((i = n.cells) != null && i.footerCell)
188
+ let r = e[t.parentIndex];
189
+ for (; r; ) {
190
+ if ((i = r.cells) != null && i.footerCell)
182
191
  return !0;
183
- n = e[n.parentIndex];
192
+ r = e[r.parentIndex];
184
193
  }
185
194
  return !1;
186
- }, Y = (e) => e.filter((t) => {
187
- var n;
188
- return m(e, t) ? !1 : !!((n = t.cells) != null && n.footerCell) || !(t.children && t.children.length > 0);
189
- }), Z = (e) => e.width !== void 0 ? Math.floor(parseFloat(e.width.toString())) + "px" : void 0, _ = (e, t) => t && t.filter((n) => n.field === e).length > 0, j = (e) => (e.sort((t, n) => t.declarationIndex - n.declarationIndex), e.map((t) => {
190
- const { declarationIndex: n, parentIndex: i, depth: d, headerColSpan: o, rowSpan: r, index: a, kFirst: l, children: f, ...h } = t;
191
- return f.length ? {
192
- children: j(f),
193
- ...h
194
- } : h;
195
+ }, Z = (e) => e.filter((t) => {
196
+ var r;
197
+ return m(e, t) ? !1 : !!((r = t.cells) != null && r.footerCell) || !(t.children && t.children.length > 0);
198
+ }), _ = (e) => e.width !== void 0 ? Math.floor(parseFloat(e.width.toString())) + "px" : void 0, P = (e, t) => t && t.filter((r) => r.field === e).length > 0, j = (e) => (e.sort((t, r) => t.declarationIndex - r.declarationIndex), e.map((t) => {
199
+ const { declarationIndex: r, parentIndex: i, depth: a, headerColSpan: d, rowSpan: f, index: n, kFirst: l, children: c, ...o } = t;
200
+ return c.length ? {
201
+ children: j(c),
202
+ ...o
203
+ } : o;
195
204
  })), B = (e) => {
196
- const { cells: t, rowSpannable: n, defaultCell: i, ...d } = e;
205
+ const { cells: t, rowSpannable: r, defaultCell: i, ...a } = e;
197
206
  return e.children.length ? {
198
- ...d,
207
+ ...a,
199
208
  children: e.children.map(B)
200
- } : d;
209
+ } : a;
201
210
  }, O = (e) => ({
202
211
  id: e.id,
203
212
  field: e.field,
@@ -206,26 +215,26 @@ const m = (e, t) => {
206
215
  orderIndex: e.orderIndex,
207
216
  hidden: !1,
208
217
  children: e.children ? N(e.children) : null
209
- }), N = (e) => e.map(O), P = (e) => {
210
- const t = [], n = (i) => i == null ? void 0 : i.forEach((d) => {
211
- t.push(d), n(d.children);
218
+ }), N = (e) => e.map(O), G = (e) => {
219
+ const t = [], r = (i) => i == null ? void 0 : i.forEach((a) => {
220
+ t.push(a), r(a.children);
212
221
  });
213
- return n(e), t;
214
- }, G = typeof window != "undefined" && /Firefox/.test(window.navigator.userAgent), ee = 17895697, te = (e) => {
222
+ return r(e), t;
223
+ }, ee = typeof window != "undefined" && /Firefox/.test(window.navigator.userAgent), te = 17895697, ne = (e) => {
215
224
  let t = [];
216
- return e.sortable && (t = t.concat([c.sortAsc, c.sortDesc])), e.pdf && (t.length && (t = t.concat([c.separator])), t = t.concat([c.exportPDF])), t;
217
- }, ne = (e) => {
225
+ return e.sortable && (t = t.concat([s.sortAsc, s.sortDesc])), e.pdf && (t.length && (t = t.concat([s.separator])), t = t.concat([s.exportPDF])), t;
226
+ }, re = (e) => {
218
227
  let t = [];
219
228
  return e.clipboard && (t = t.concat([
220
- c.copySelection,
221
- c.copySelectionNoHeaders,
222
- c.paste
223
- ])), e.editable && (t.length && (t = t.concat([c.separator])), t = t.concat([
224
- c.create,
225
- c.edit,
226
- c.delete
227
- ])), e.selectable && (t.length && (t = t.concat([c.separator])), t = t.concat([c.select])), e.rowReorderable && (t.length && (t = t.concat([c.separator])), t = t.concat([c.reorderRow])), e.pdf && (t.length && (t = t.concat([c.separator])), t = t.concat([c.exportPDF])), t;
228
- }, re = (e, t) => {
229
+ s.copySelection,
230
+ s.copySelectionNoHeaders,
231
+ s.paste
232
+ ])), e.editable && (t.length && (t = t.concat([s.separator])), t = t.concat([
233
+ s.create,
234
+ s.edit,
235
+ s.delete
236
+ ])), e.selectable && (t.length && (t = t.concat([s.separator])), t = t.concat([s.select])), e.rowReorderable && (t.length && (t = t.concat([s.separator])), t = t.concat([s.reorderRow])), e.pdf && (t.length && (t = t.concat([s.separator])), t = t.concat([s.exportPDF])), t;
237
+ }, ie = (e, t) => {
229
238
  if (!(!e && !t))
230
239
  return t ? e ? {
231
240
  ...e,
@@ -247,10 +256,10 @@ const m = (e, t) => {
247
256
  ...t.edit || {}
248
257
  }
249
258
  } : t : e;
250
- }, ie = (e) => {
251
- var n;
252
- return typeof e == "object" ? (n = e.enabled) != null ? n : !0 : e != null ? e : !1;
253
- }, ae = () => M === b, de = (e) => !!(e && e.$$typeof === Symbol.for("react.client.reference")), le = (e) => ({
259
+ }, ae = (e) => {
260
+ var r;
261
+ return typeof e == "object" ? (r = e.enabled) != null ? r : !0 : e != null ? e : !1;
262
+ }, de = () => M === b, le = (e) => !!(e && e.$$typeof === Symbol.for("react.client.reference")), oe = (e) => ({
254
263
  id: e.id,
255
264
  ariaColumnIndex: e.ariaColumnIndex,
256
265
  isSelected: e.isSelected,
@@ -276,51 +285,52 @@ const m = (e, t) => {
276
285
  rowDataIndex: e.rowDataIndex,
277
286
  columnPosition: e.columnPosition,
278
287
  group: e.group
279
- }), oe = (e) => {
280
- var i, d;
281
- const t = typeof e == "object" ? (i = e.enabled) != null ? i : !0 : e != null ? e : !1, n = typeof e == "object" ? (d = e.valueGetter) != null ? d : (o, r) => y(r)(o) : (o, r) => y(r)(o);
282
- return { enabled: t, valueGetter: n };
283
- }, k = (e) => {
288
+ }), ce = (e) => {
289
+ var i, a;
290
+ const t = typeof e == "object" ? (i = e.enabled) != null ? i : !0 : e != null ? e : !1, r = typeof e == "object" ? (a = e.valueGetter) != null ? a : (d, f) => w(f)(d) : (d, f) => w(f)(d);
291
+ return { enabled: t, valueGetter: r };
292
+ }, $ = (e) => {
284
293
  var t;
285
- return w.isValidElement(e) ? e : (t = w.Children.toArray(e)) == null ? void 0 : t[0];
294
+ return S.isValidElement(e) ? e : (t = S.Children.toArray(e)) == null ? void 0 : t[0];
286
295
  }, fe = (e, t) => {
287
- const n = k(e);
288
- return n ? w.cloneElement(n, t) : null;
289
- }, ce = (e) => {
296
+ const r = $(e);
297
+ return r ? S.cloneElement(r, t) : null;
298
+ }, se = (e) => {
290
299
  let t = 0;
291
300
  if (e) {
292
- const n = e.insertRow(0), i = n.insertCell(0);
293
- i.textContent = "&nbsp;", t = n.getBoundingClientRect().height, e.deleteRow(0);
301
+ const r = e.insertRow(0), i = r.insertCell(0);
302
+ i.textContent = "&nbsp;", t = r.getBoundingClientRect().height, e.deleteRow(0);
294
303
  }
295
304
  return t;
296
305
  };
297
306
  export {
298
- X as autoGenerateColumns,
299
- ce as calcRowHeight,
307
+ Y as autoGenerateColumns,
308
+ se as calcRowHeight,
300
309
  B as clientColumn,
301
310
  fe as cloneReactElement,
302
- G as firefox,
303
- ee as firefoxMaxHeight,
311
+ ee as firefox,
312
+ te as firefoxMaxHeight,
304
313
  R as flatData,
305
- Y as footerColumns,
306
- le as getClientCellProps,
307
- K as getColSpan,
314
+ Z as footerColumns,
315
+ oe as getClientCellProps,
316
+ Q as getColSpan,
308
317
  O as getColumnState,
309
- Z as getColumnWidth,
318
+ _ as getColumnWidth,
310
319
  N as getColumnsState,
311
- T as getDataAsArray,
312
- ne as getDefaultBodyContextMenuItems,
313
- te as getDefaultHeadContextMenuItems,
314
- P as getFlatColumnsState,
315
- J as getNestedValue,
316
- k as getReactElement,
317
- oe as getRowSpanOptions,
318
- ae as isClient,
319
- de as isClientReference,
320
- ie as isRowReorderEnabled,
321
- _ as isSorted,
322
- Q as mapColumns,
323
- H as readColumns,
324
- re as resolveCells,
325
- j as sanitizeColumns
320
+ k as getDataAsArray,
321
+ re as getDefaultBodyContextMenuItems,
322
+ ne as getDefaultHeadContextMenuItems,
323
+ G as getFlatColumnsState,
324
+ K as getNestedValue,
325
+ $ as getReactElement,
326
+ ce as getRowSpanOptions,
327
+ de as isClient,
328
+ le as isClientReference,
329
+ ae as isRowReorderEnabled,
330
+ P as isSorted,
331
+ X as mapColumns,
332
+ T as readColumns,
333
+ ie as resolveCells,
334
+ j as sanitizeColumns,
335
+ H as syncLockedColumns
326
336
  };