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