@progress/kendo-vue-grid 7.0.3-develop.1 → 7.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/main.mjs CHANGED
@@ -5,66 +5,93 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { tableKeyboardNavigationTools as x } from "@progress/kendo-vue-data-tools";
9
- import { canUseDOM as C } from "@progress/kendo-vue-common";
10
- const c = "string";
11
- function g(e, t) {
8
+ import { findGroupExpand as T, updateLeft as b, updateRight as A, tableKeyboardNavigationTools as E } from "@progress/kendo-vue-data-tools";
9
+ import { getter as I, canUseDOM as m } from "@progress/kendo-vue-common";
10
+ import { gridDefaultProps as v } from "../GridColumn.mjs";
11
+ const w = "string";
12
+ function u(e, t) {
12
13
  const n = e.split(".");
13
- let a = t;
14
- return n.forEach((o) => {
15
- a = a ? a[o] : void 0;
16
- }), a;
14
+ let r = t;
15
+ return n.forEach((a) => {
16
+ r = r ? r[a] : void 0;
17
+ }), r;
17
18
  }
18
- function b(e, t, n, a, o, h, l = 0) {
19
- let r = l;
20
- for (let i = 0; i < t.length; i++) {
21
- if (!o || t[i].value === void 0 || t[i].items === void 0) {
19
+ function L(e, t, n, r, a, l, i, d, o, s, c = 0, f) {
20
+ let g = c;
21
+ for (let h = 0; h < t.length; h++) {
22
+ let x;
23
+ if (!a || t[h].value === void 0 || t[h].items === void 0) {
24
+ const p = o ? !!(l != null && l[I(o)(t[h])]) : !1;
22
25
  e[e.length] = {
23
- dataIndex: ++a.index,
24
- dataItem: t[i],
26
+ dataIndex: r.index,
27
+ dataItem: t[h],
25
28
  rowType: "data",
26
- level: l,
27
- expanded: h === void 0 || g(h, t[i])
28
- };
29
+ level: c,
30
+ group: f,
31
+ // This is related to detail-row expansion
32
+ expanded: s !== void 0 ? u(s, t[h]) : p != null ? p : !1
33
+ }, r.index++;
29
34
  continue;
35
+ } else {
36
+ let p;
37
+ f != null && f.parents ? p = [{ field: f.field, value: f.value }, ...f.parents] : f ? p = [f] : p = [], x = {
38
+ field: t[h].field,
39
+ value: t[h].value,
40
+ parents: p
41
+ };
30
42
  }
31
- r = Math.max(r, l + 1);
32
- const d = h === void 0 || g(h, t[i]) === void 0 || g(h, t[i]);
33
- e[e.length] = {
43
+ g = Math.max(g, c + 1);
44
+ let C = !1;
45
+ const y = T(i || [], x);
46
+ s ? C = s === void 0 || u(s, t[h]) === void 0 || u(s, t[h]) : C = y ? y.expanded !== !1 : d !== !1, e[e.length] = {
34
47
  dataIndex: -1,
35
- dataItem: t[i],
36
- level: l,
48
+ dataItem: t[h],
49
+ level: c,
50
+ group: x,
37
51
  rowType: "groupHeader",
38
- expanded: d
39
- }, d && (r = Math.max(
40
- b(e, t[i].items, n, a, o, h, l + 1),
41
- r
42
- )), (n === "always" || d && n === "visible") && (e[e.length] = {
52
+ expanded: C
53
+ }, C && (x.expanded = C, g = Math.max(
54
+ L(
55
+ e,
56
+ t[h].items,
57
+ n,
58
+ r,
59
+ a,
60
+ l,
61
+ i,
62
+ d,
63
+ o,
64
+ s,
65
+ c + 1,
66
+ x
67
+ ),
68
+ g
69
+ )), (n === "always" || C && n === "visible") && (e[e.length] = {
43
70
  dataIndex: -1,
44
- dataItem: t[i],
71
+ dataItem: t[h],
45
72
  rowType: "groupFooter",
46
- level: l,
47
- expanded: d
73
+ level: c,
74
+ expanded: C
48
75
  });
49
76
  }
50
- return r;
77
+ return g;
51
78
  }
52
- function L(e) {
79
+ function j(e) {
53
80
  return e && getComputedStyle(e).direction === "rtl" || !1;
54
81
  }
55
- function M(e, t) {
56
- if (!t || !e || !e.originalEvent || !C)
82
+ function K(e, t) {
83
+ if (!t || !e || !e.originalEvent || !m)
57
84
  return -1;
58
85
  let n = document.elementFromPoint(e.clientX, e.originalEvent.clientY);
59
86
  for (; n && n.parentElement !== t; )
60
87
  n = n.parentElement;
61
- const a = t.children;
62
- for (let o = 0; o < a.length; o++)
63
- if (a[o] === n)
64
- return o;
88
+ const r = t.children;
89
+ for (let a = 0; a < r.length; a++)
90
+ if (r[a] === n)
91
+ return a;
65
92
  return -1;
66
93
  }
67
- const p = [
94
+ const S = [
68
95
  "sortChange",
69
96
  "filterChange",
70
97
  "groupChange",
@@ -77,140 +104,107 @@ const p = [
77
104
  "dataStateChange",
78
105
  "columnResize",
79
106
  "columnReorder"
80
- ], u = {
81
- filterable: !0,
82
- editable: !0,
83
- sortable: !0,
84
- resizable: !0,
85
- reorderable: !0,
86
- groupable: !0
87
- }, S = (e, t) => `The ${e} event handler property is deprecated, use https://www.telerik.com/kendo-vue-ui/components/grid/api/GridProps/#toc-${t} instead`;
88
- function N(e) {
89
- for (let t = 0; t < p.length; t++) {
90
- const n = p[t];
107
+ ], N = (e, t) => `The ${e} event handler property is deprecated, use https://www.telerik.com/kendo-vue-ui/components/grid/api/GridProps/#toc-${t} instead`;
108
+ function z(e) {
109
+ for (let t = 0; t < S.length; t++) {
110
+ const n = S[t];
91
111
  if (e[n] !== void 0) {
92
- const a = "on" + n.charAt(0).toUpperCase() + n.slice(1);
93
- console.warn(S(n, a));
112
+ const r = "on" + n.charAt(0).toUpperCase() + n.slice(1);
113
+ console.warn(N(n, r));
94
114
  }
95
115
  }
96
116
  }
97
- function E(e, t) {
98
- const n = e[t].depth;
99
- let a = null;
100
- for (let o = t + 1; o < e.length; o++)
101
- if (e[o].depth === n) {
102
- a = e[o];
103
- break;
104
- }
105
- return a;
106
- }
107
- function D(e) {
108
- const t = [[]];
109
- let n = 0;
110
- for (let r = e.length - 1; r >= 0; r--)
111
- n = Math.max(n, e[r].depth), e[r].colSpan = e[r].colSpan || 1, e[r].children.length > 0 && (e[r].colSpan = e[r].children.reduce(
112
- (i, d) => d.hidden ? i : i + d.colSpan,
117
+ function U(e, t) {
118
+ const n = [[]];
119
+ let r = 0;
120
+ for (let i = e.length - 1; i >= 0; i--)
121
+ r = Math.max(r, e[i].depth), e[i].headerColSpan = e[i].headerColSpan || 1, e[i].children.length > 0 && (e[i].headerColSpan = e[i].children.reduce(
122
+ (d, o) => o.hidden ? d : d + o.headerColSpan,
113
123
  0
114
124
  ));
115
- let a = 1;
116
- e.forEach((r, i) => {
117
- t[r.depth] = t[r.depth] || [];
118
- let d = !1;
119
- t[r.depth].length === 0 && (a <= 1 ? a = 1 + (r.children.length > 0 ? 0 : n - r.depth) : (a--, d = !0)), r.rowSpan = 1 + (r.children.length > 0 ? 0 : n - r.depth), r.kFirst = d, r.index = t[r.depth].length, t[r.depth].push(i);
120
- });
121
- const o = new Array(t.length).fill(0);
122
- let h = 0;
123
- e.forEach((r) => {
124
- if (r.locked)
125
- if (r.left = o[r.depth], h = r.width ? parseFloat(r.width.toString()) : 0, r.children.length === 0)
126
- for (let i = r.depth; i < o.length; i++)
127
- o[i] += h;
128
- else
129
- o[r.depth] += h;
130
- });
131
- const l = new Array(t.length).fill(0);
132
- for (let r = e.length - 1; r >= 0; r--) {
133
- const i = e[r];
134
- if (i.locked) {
135
- if (i.right = l[i.depth], h = i.width ? parseFloat(i.width.toString()) : 0, i.children.length === 0)
136
- for (let s = i.depth; s < l.length; s++)
137
- l[s] += h;
138
- else
139
- l[i.depth] += h;
140
- const d = E(e, r);
141
- i.rightBorder = !(d && d.locked);
142
- }
143
- }
144
- return t;
125
+ const a = [];
126
+ let l = 1;
127
+ return e.forEach((i, d) => {
128
+ n[i.depth] = n[i.depth] || [];
129
+ let o = !1;
130
+ n[i.depth].length === 0 && (l <= 1 ? l = 1 + (i.children.length > 0 ? 0 : r - i.depth) : (l--, o = !0)), i.rowSpan = 1 + (i.children.length > 0 ? 0 : r - i.depth), i.kFirst = o, i.index = n[i.depth].length, n[i.depth].push(d), i.ariaColumnIndex = a[i.depth] ? a[i.depth] + 1 : 1;
131
+ for (let s = i.depth; s < i.depth + i.rowSpan; s++)
132
+ a[s] = (a[s] || 0) + i.headerColSpan;
133
+ }), b(n, e, t), A(n, e, t), n;
145
134
  }
146
- function m(e, t, n, a = 0) {
147
- const o = [], h = e && e.length ? e.length === t.length : !1;
135
+ function k(e, t, n, r = 0, a = !1) {
136
+ const l = [];
148
137
  if (!e)
149
138
  return [];
150
- e && e.length === void 0 && (e = [e]), e.forEach((r, i) => {
151
- r = r;
152
- const d = h && t[i] || null, s = r.children ? r.children.filter((y) => !y.hidden) : r.children, f = m(s, d && d.children || [], n, a + 1);
153
- o.push(
154
- Object.assign(
155
- { depth: a },
156
- u,
157
- f.length ? { cell: () => null, filterCell: () => null } : {},
158
- d ? { width: d.width, orderIndex: d.orderIndex } : {},
159
- r,
160
- {
161
- id: x.generateNavigatableId(`${n.prevId++}`, n.idPrefix, "column"),
162
- declarationIndex: o.length,
163
- children: f,
164
- rowSpan: 0,
165
- colSpan: 0,
166
- isAccessible: !0
167
- }
168
- )
139
+ e && e.length === void 0 && (e = [e]), e.forEach((d, o) => {
140
+ d = d;
141
+ const s = d.id ? d.id : E.generateNavigatableId(`${n.prevId++}`, n.idPrefix, "column"), c = m && d.media && window.matchMedia ? !window.matchMedia(d.media).matches : !1, f = a || c || d.hidden, g = t == null ? void 0 : t.find((x) => x.id === s), h = k(d.children, (g == null ? void 0 : g.children) || [], n, r + 1, f);
142
+ l.push(
143
+ {
144
+ depth: r,
145
+ ...v,
146
+ ...h.length ? { cell: () => null, filterCell: () => null } : {},
147
+ ...d,
148
+ id: s,
149
+ declarationIndex: l.length,
150
+ children: h,
151
+ headerColSpan: 0,
152
+ rowSpan: 0,
153
+ columnType: d.columnType || "data",
154
+ colSpan: d.colSpan || 1,
155
+ isAccessible: !0,
156
+ hidden: f,
157
+ left: null,
158
+ right: null,
159
+ rowSpannable: d.rowSpannable,
160
+ ...g ? { width: g.width, orderIndex: g.orderIndex } : {}
161
+ }
169
162
  );
170
163
  });
171
- const l = (r, i) => r.orderIndex === i.orderIndex ? r.declarationIndex - i.declarationIndex : (r.orderIndex || 0) - (i.orderIndex || 0);
172
- if (o.sort(l), a === 0) {
173
- const r = [], i = (d, s) => d.forEach((f) => {
174
- f.parentIndex = s, i(f.children, r.push(f) - 1);
164
+ const i = (d, o) => d.orderIndex === o.orderIndex ? d.declarationIndex - o.declarationIndex : (d.orderIndex || 0) - (o.orderIndex || 0);
165
+ if (l.sort(i), r === 0) {
166
+ const d = [], o = (s, c) => s.forEach((f) => {
167
+ f.parentIndex = c, o(f.children, d.push(f) - 1);
175
168
  });
176
- return i(o, -1), r;
169
+ return o(l, -1), d;
177
170
  }
178
- return o;
171
+ return l;
179
172
  }
180
- function G(e, t, n, a) {
181
- let o = [];
182
- Array.isArray(e) ? o = e : e && (o = e.data), o.length || console.warn("Kendo Grid autogeneration of columns is only possible if some items are defined when the component is created.");
183
- const h = [];
184
- if (o.length > 0) {
185
- let l = o[0];
173
+ const D = (e) => Array.isArray(e) ? e : e ? e.data : [];
174
+ function V(e, t, n, r) {
175
+ const a = D(e), l = [];
176
+ if (a.length > 0) {
177
+ let i = a[0];
186
178
  if (t)
187
- for (let i = 0; i < t.length; i++)
188
- l = l.items && l.items[0];
189
- Object.getOwnPropertyNames(l).forEach((i) => {
190
- i !== n && i !== "__ob__" && h.push(Object.assign(
179
+ for (let o = 0; o < t.length; o++)
180
+ i = i.items && i.items[0];
181
+ Object.getOwnPropertyNames(i).forEach((o) => {
182
+ o !== n.column && l.push(
191
183
  {
192
- id: x.generateNavigatableId(`${a.prevId++}`, a.idPrefix, "column"),
184
+ id: E.generateNavigatableId(`${r.prevId++}`, r.idPrefix, "column"),
193
185
  declarationIndex: -1,
194
186
  parentIndex: -1,
195
187
  depth: 0,
196
188
  colSpan: 0,
189
+ headerColSpan: 0,
197
190
  rowSpan: 0,
198
191
  index: 0,
192
+ columnType: "data",
199
193
  left: 0,
200
194
  right: 0,
201
- children: [],
202
195
  rightBorder: !1,
203
- ariaColumnIndex: 1,
204
- isAccessible: !0
205
- },
206
- u,
207
- { field: i }
208
- ));
196
+ children: [],
197
+ ariaColumnIndex: 0,
198
+ isAccessible: !0,
199
+ ...v,
200
+ field: o
201
+ }
202
+ );
209
203
  });
210
204
  }
211
- return h;
205
+ return l;
212
206
  }
213
- const k = (e, t) => {
207
+ const R = (e, t) => {
214
208
  let n = e[t.parentIndex];
215
209
  for (; n; ) {
216
210
  if (n.footerCell)
@@ -218,53 +212,75 @@ const k = (e, t) => {
218
212
  n = e[n.parentIndex];
219
213
  }
220
214
  return !1;
221
- }, K = (e) => e.filter((t) => k(e, t) ? !1 : !!t.footerCell || !(t.children && t.children.length > 0)), T = {
215
+ }, W = (e) => e.filter((t) => R(e, t) ? !1 : !!t.footerCell || !(t.children && t.children.length > 0)), X = {
222
216
  number: function(e, t, n) {
223
- return typeof e === c && e.toLowerCase() === "null" ? null : t.parseNumber(e, n);
217
+ return typeof e === w && e.toLowerCase() === "null" ? null : t.parseNumber(e, n);
224
218
  },
225
219
  date: function(e, t, n) {
226
- return typeof e === c && e.toLowerCase() === "null" ? null : t.parseDate(e, n);
220
+ return typeof e === w && e.toLowerCase() === "null" ? null : t.parseDate(e, n);
227
221
  },
228
222
  boolean: function(e) {
229
- return typeof e === c ? e.toLowerCase() === "null" ? null : e.toLowerCase() === "true" : e != null ? !!e : e;
223
+ return typeof e === w ? e.toLowerCase() === "null" ? null : e.toLowerCase() === "true" : e != null ? !!e : e;
230
224
  },
231
225
  string: function(e) {
232
- return typeof e === c && e.toLowerCase() === "null" ? null : e != null ? e + "" : e;
226
+ return typeof e === w && e.toLowerCase() === "null" ? null : e != null ? e + "" : e;
233
227
  },
234
228
  default: function(e) {
235
229
  return e;
236
230
  }
237
231
  };
238
- function w(e, t, n, a) {
239
- return e.forEach((o) => {
240
- o.expanded = t[a] && !t[a].includes(I(o, n)), o.items && o.items.length && (o.items = w(o.items, t, n, a + 1));
232
+ function M(e, t, n, r) {
233
+ return e.forEach((a) => {
234
+ a.expanded = t[r] && !t[r].includes(F(a, n)), a.items && a.items.length && (a.items = M(a.items, t, n, r + 1));
241
235
  }), e;
242
236
  }
243
- function O(e, t, n) {
244
- return t && t.length && e.data.forEach((a) => {
245
- a.expanded = a.expanded !== void 0 ? a.expanded : t[0] && !t[0].includes(I(a, n)), a.items && a.items.length && (a.items = w(a.items, t, n, 1));
237
+ function Y(e, t, n) {
238
+ return t && t.length && e.data.forEach((r) => {
239
+ r.expanded = r.expanded !== void 0 ? r.expanded : t[0] && !t[0].includes(F(r, n)), r.items && r.items.length && (r.items = M(r.items, t, n, 1));
246
240
  }), e;
247
241
  }
248
- function I(e, t) {
242
+ function F(e, t) {
249
243
  let n = e;
250
244
  for (; n.items && n.items.length; )
251
245
  n = n.items[0];
252
246
  return t ? n[t] : e.value;
253
247
  }
254
- const R = typeof window != "undefined" && /Firefox/.test(window.navigator.userAgent), j = 17895697;
248
+ const J = (e) => {
249
+ const t = [], n = (r) => r == null ? void 0 : r.forEach((a) => {
250
+ t.push(a), n(a.children);
251
+ });
252
+ return n(e), t;
253
+ }, Q = typeof window != "undefined" && /Firefox/.test(window.navigator.userAgent), Z = 17895697, _ = (e) => e.width !== void 0 ? Math.floor(parseFloat(e.width.toString())) + "px" : void 0, q = (e, t) => t && t.filter((n) => n.field === e).length > 0, H = (e) => (e.sort((t, n) => t.declarationIndex - n.declarationIndex), e.map((t) => {
254
+ const { declarationIndex: n, parentIndex: r, depth: a, headerColSpan: l, rowSpan: i, index: d, kFirst: o, children: s, ...c } = t;
255
+ return s.length ? {
256
+ children: H(s),
257
+ ...c
258
+ } : c;
259
+ })), P = (e, t) => typeof e.colSpan == "function" ? e.colSpan({ dataItem: t, column: e }) : e.colSpan || 1, G = (e) => {
260
+ var r, a;
261
+ const t = typeof e == "object" ? (r = e.enabled) != null ? r : !0 : e != null ? e : !1, n = typeof e == "object" ? (a = e.valueGetter) != null ? a : (l, i) => I(i)(l) : (l, i) => I(i)(l);
262
+ return { enabled: t, valueGetter: n };
263
+ };
255
264
  export {
256
- O as applyExpandedState,
257
- G as autoGenerateColumns,
258
- N as checkPropCompatibility,
259
- R as firefox,
260
- j as firefoxMaxHeight,
261
- b as flatData,
262
- K as footerColumns,
263
- M as getIndex,
264
- g as getNestedValue,
265
- I as groupedFirstItemValue,
266
- L as isRtl,
267
- D as mapColumns,
268
- T as parsers,
269
- m as readColumns
265
+ Y as applyExpandedState,
266
+ V as autoGenerateColumns,
267
+ z as checkPropCompatibility,
268
+ Q as firefox,
269
+ Z as firefoxMaxHeight,
270
+ L as flatData,
271
+ W as footerColumns,
272
+ P as getColSpan,
273
+ _ as getColumnWidth,
274
+ D as getDataAsArray,
275
+ J as getFlatColumnsState,
276
+ K as getIndex,
277
+ u as getNestedValue,
278
+ G as getRowSpanOptions,
279
+ F as groupedFirstItemValue,
280
+ j as isRtl,
281
+ q as isSorted,
282
+ U as mapColumns,
283
+ X as parsers,
284
+ k as readColumns,
285
+ H as sanitizeColumns
270
286
  };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function g(u){const{cellModels:l,columns:o=[],tableViewPortWidth:f,scrollLeft:c}=u;let n=0,t=l.length-1,i=0,d=0;for(let e=0;e<l.length;e++)if(!o[l[e].columnIndex].locked&&(i=d,d+=l[e].width||10,d>=c)){n=e;break}for(let e=n;e<l.length;e++)if(!o[l[e].columnIndex].locked)if(i<f+c)i+=l[e].width||10,t=e;else break;n>0&&n--,t<l.length-1&&t++;let r=0,s=0;for(let e=0;e<n;e++)o[l[e].columnIndex].locked||(r+=l[e].colSpan);for(let e=t+1;e<l.length;e++)o[l[e].columnIndex].locked||(s+=l[e].colSpan);l[n].colSpan+=r,l[t].colSpan+=s;const a=l.slice(0,n).filter(e=>o[e.columnIndex].locked),h=l.slice(t+1).filter(e=>o[e.columnIndex].locked);return[...a,...l.slice(n,t+1),...h]}exports.getVirtualCellsToRender=g;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2025 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ function k(s) {
9
+ const { cellModels: l, columns: o = [], tableViewPortWidth: u, scrollLeft: c } = s;
10
+ let n = 0, t = l.length - 1, i = 0, d = 0;
11
+ for (let e = 0; e < l.length; e++)
12
+ if (!o[l[e].columnIndex].locked && (i = d, d += l[e].width || 10, d >= c)) {
13
+ n = e;
14
+ break;
15
+ }
16
+ for (let e = n; e < l.length; e++)
17
+ if (!o[l[e].columnIndex].locked)
18
+ if (i < u + c)
19
+ i += l[e].width || 10, t = e;
20
+ else
21
+ break;
22
+ n > 0 && n--, t < l.length - 1 && t++;
23
+ let r = 0, f = 0;
24
+ for (let e = 0; e < n; e++)
25
+ o[l[e].columnIndex].locked || (r += l[e].colSpan);
26
+ for (let e = t + 1; e < l.length; e++)
27
+ o[l[e].columnIndex].locked || (f += l[e].colSpan);
28
+ l[n].colSpan += r, l[t].colSpan += f;
29
+ const a = l.slice(0, n).filter((e) => o[e.columnIndex].locked), h = l.slice(t + 1).filter((e) => o[e.columnIndex].locked);
30
+ return [
31
+ ...a,
32
+ ...l.slice(n, t + 1),
33
+ ...h
34
+ ];
35
+ }
36
+ export {
37
+ k as getVirtualCellsToRender
38
+ };