@progress/kendo-react-grid 15.0.1-develop.9 → 15.1.0-develop.2

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