@progress/kendo-react-grid 13.2.0-develop.5 → 13.2.0-develop.6

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