@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/Grid.js +1 -1
- package/Grid.mjs +235 -234
- package/GridSearchBox.js +1 -1
- package/GridSearchBox.mjs +18 -18
- package/GridState.js +1 -1
- package/GridState.mjs +2 -2
- package/dist/cdn/js/kendo-vue-grid.js +1 -1
- package/footer/FooterRow.js +1 -1
- package/footer/FooterRow.mjs +6 -6
- package/header/FilterRow.js +1 -1
- package/header/FilterRow.mjs +71 -60
- package/header/HeaderRow.js +1 -1
- package/header/HeaderRow.mjs +99 -89
- package/index.d.mts +7 -9
- package/index.d.ts +7 -9
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +12 -12
- package/utils/main.js +1 -1
- package/utils/main.mjs +171 -146
- package/utils/virtualColumns.js +1 -1
- package/utils/virtualColumns.mjs +40 -20
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
|
|
9
|
-
import { getter as
|
|
10
|
-
import { gridDefaultProps as
|
|
11
|
-
const
|
|
12
|
-
function
|
|
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
|
|
15
|
-
return n.forEach((
|
|
16
|
-
|
|
17
|
-
}),
|
|
14
|
+
let i = t;
|
|
15
|
+
return n.forEach((d) => {
|
|
16
|
+
i = i ? i[d] : void 0;
|
|
17
|
+
}), i;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
let
|
|
21
|
-
for (let
|
|
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 (!
|
|
24
|
-
const
|
|
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:
|
|
27
|
-
dataItem: t[
|
|
26
|
+
dataIndex: i.index,
|
|
27
|
+
dataItem: t[a],
|
|
28
28
|
rowType: "data",
|
|
29
29
|
level: c,
|
|
30
|
-
group:
|
|
30
|
+
group: h,
|
|
31
31
|
// This is related to detail-row expansion
|
|
32
|
-
expanded:
|
|
33
|
-
},
|
|
32
|
+
expanded: f !== void 0 ? y(f, t[a]) : C != null ? C : !1
|
|
33
|
+
}, i.index++;
|
|
34
34
|
continue;
|
|
35
35
|
} else {
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
field: t[
|
|
39
|
-
value: t[
|
|
40
|
-
parents:
|
|
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
|
-
|
|
44
|
-
let
|
|
45
|
-
const
|
|
46
|
-
|
|
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[
|
|
48
|
+
dataItem: t[a],
|
|
49
49
|
level: c,
|
|
50
50
|
group: x,
|
|
51
51
|
rowType: "groupHeader",
|
|
52
|
-
expanded:
|
|
53
|
-
},
|
|
54
|
-
|
|
52
|
+
expanded: g
|
|
53
|
+
}, g && (x.expanded = g, p = Math.max(
|
|
54
|
+
N(
|
|
55
55
|
e,
|
|
56
|
-
t[
|
|
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
|
-
|
|
69
|
-
)), (n === "always" ||
|
|
68
|
+
p
|
|
69
|
+
)), (n === "always" || g && n === "visible") && (e[e.length] = {
|
|
70
70
|
dataIndex: -1,
|
|
71
|
-
dataItem: t[
|
|
71
|
+
dataItem: t[a],
|
|
72
72
|
rowType: "groupFooter",
|
|
73
73
|
level: c,
|
|
74
|
-
expanded:
|
|
74
|
+
expanded: g
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
-
return
|
|
77
|
+
return p;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function z(e) {
|
|
80
80
|
return e && getComputedStyle(e).direction === "rtl" || !1;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
if (!t || !e || !e.originalEvent || !
|
|
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
|
|
89
|
-
for (let
|
|
90
|
-
if (
|
|
91
|
-
return
|
|
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
|
|
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
|
-
],
|
|
108
|
-
function
|
|
109
|
-
for (let t = 0; t <
|
|
110
|
-
const n =
|
|
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
|
|
113
|
-
console.warn(
|
|
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
|
|
117
|
+
function W(e, t) {
|
|
118
118
|
const n = [[]];
|
|
119
|
-
let
|
|
120
|
-
for (let
|
|
121
|
-
|
|
122
|
-
(
|
|
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
|
|
125
|
+
const d = [];
|
|
126
126
|
let l = 1;
|
|
127
|
-
return e.forEach((
|
|
128
|
-
n[
|
|
129
|
-
let
|
|
130
|
-
n[
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
|
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((
|
|
140
|
-
|
|
141
|
-
const
|
|
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:
|
|
145
|
-
...
|
|
146
|
-
...
|
|
147
|
-
...
|
|
148
|
-
id:
|
|
169
|
+
depth: i,
|
|
170
|
+
...b,
|
|
171
|
+
...a.length ? { cell: () => null, filterCell: () => null } : {},
|
|
172
|
+
...o,
|
|
173
|
+
id: f,
|
|
149
174
|
declarationIndex: l.length,
|
|
150
|
-
children:
|
|
175
|
+
children: a,
|
|
151
176
|
headerColSpan: 0,
|
|
152
177
|
rowSpan: 0,
|
|
153
|
-
columnType:
|
|
154
|
-
colSpan:
|
|
178
|
+
columnType: o.columnType || "data",
|
|
179
|
+
colSpan: o.colSpan || 1,
|
|
155
180
|
isAccessible: !0,
|
|
156
|
-
hidden:
|
|
181
|
+
hidden: h,
|
|
157
182
|
left: null,
|
|
158
183
|
right: null,
|
|
159
|
-
rowSpannable:
|
|
160
|
-
...
|
|
184
|
+
rowSpannable: o.rowSpannable,
|
|
185
|
+
...p ? { width: p.width, orderIndex: p.orderIndex } : {}
|
|
161
186
|
}
|
|
162
187
|
);
|
|
163
188
|
});
|
|
164
|
-
const
|
|
165
|
-
if (l.sort(
|
|
166
|
-
const
|
|
167
|
-
|
|
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
|
|
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
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
177
|
-
let
|
|
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
|
|
180
|
-
|
|
181
|
-
Object.getOwnPropertyNames(
|
|
182
|
-
|
|
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:
|
|
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
|
-
...
|
|
200
|
-
field:
|
|
224
|
+
...b,
|
|
225
|
+
field: s
|
|
201
226
|
}
|
|
202
227
|
);
|
|
203
228
|
});
|
|
204
229
|
}
|
|
205
230
|
return l;
|
|
206
231
|
}
|
|
207
|
-
const
|
|
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
|
-
},
|
|
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 ===
|
|
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 ===
|
|
245
|
+
return typeof e === u && e.toLowerCase() === "null" ? null : t.parseDate(e, n);
|
|
221
246
|
},
|
|
222
247
|
boolean: function(e) {
|
|
223
|
-
return typeof 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 ===
|
|
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,
|
|
233
|
-
return e.forEach((
|
|
234
|
-
|
|
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
|
|
238
|
-
return t && t.length && e.data.forEach((
|
|
239
|
-
|
|
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
|
|
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
|
|
249
|
-
const t = [], n = (
|
|
250
|
-
t.push(
|
|
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
|
-
},
|
|
254
|
-
const { declarationIndex: n, parentIndex:
|
|
255
|
-
return
|
|
256
|
-
children:
|
|
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
|
-
})),
|
|
260
|
-
var
|
|
261
|
-
const t = typeof e == "object" ? (
|
|
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
|
-
},
|
|
288
|
+
}, ne = (e) => {
|
|
264
289
|
let t = 0;
|
|
265
290
|
if (e) {
|
|
266
|
-
const n = e.insertRow(0),
|
|
267
|
-
|
|
291
|
+
const n = e.insertRow(0), i = n.insertCell(0);
|
|
292
|
+
i.textContent = " ", t = n.getBoundingClientRect().height, e.deleteRow(0);
|
|
268
293
|
}
|
|
269
294
|
return t;
|
|
270
295
|
};
|
|
271
296
|
export {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
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
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
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
|
};
|
package/utils/virtualColumns.js
CHANGED
|
@@ -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
|
|
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;
|
package/utils/virtualColumns.mjs
CHANGED
|
@@ -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
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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 =
|
|
17
|
-
if (!
|
|
18
|
-
if (i <
|
|
19
|
-
i +=
|
|
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
|
-
|
|
23
|
-
let
|
|
24
|
-
for (let e = 0; e <
|
|
25
|
-
|
|
26
|
-
for (let e =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const a =
|
|
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
|
-
...
|
|
51
|
+
...n.slice(t, o + 1),
|
|
33
52
|
...h
|
|
34
53
|
];
|
|
35
54
|
}
|
|
36
55
|
export {
|
|
37
|
-
|
|
56
|
+
p as getVirtualCellsToRender,
|
|
57
|
+
m as getVirtualHeaderCellsToRender
|
|
38
58
|
};
|