@glhrmoura/vue-virtualize 0.1.4 → 0.1.5
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/README.md +3 -1
- package/dist/components/VirtualTable.vue.d.ts +3 -3
- package/dist/composables/useVirtualGrid.d.ts +2 -2
- package/dist/composables/useVirtualList.d.ts +3 -3
- package/dist/composables/useVirtualTable.d.ts +1 -1
- package/dist/composables/useVirtualizer.d.ts +1 -1
- package/dist/core/scrolling.d.ts +1 -1
- package/dist/core/virtualizer.d.ts +1 -1
- package/dist/index.d.ts +15 -15
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +345 -331
- package/dist/index.mjs.map +1 -1
- package/dist/utils/layout.d.ts +1 -1
- package/dist/utils/same-items.d.ts +1 -1
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { shallowRef as Me, ref as L, toValue as o, watch as
|
|
1
|
+
import { shallowRef as Me, ref as L, toValue as o, watch as ge, onBeforeUnmount as ve, computed as R, defineComponent as ie, openBlock as T, createBlock as Y, resolveDynamicComponent as q, normalizeStyle as F, withCtx as U, renderSlot as G, createElementBlock as $, Fragment as D, renderList as P, unref as K, mergeProps as ne, createElementVNode as ue, toDisplayString as ce, createTextVNode as Oe } from "vue";
|
|
2
2
|
function ee(e) {
|
|
3
3
|
return !Number.isFinite(e) || e < 0 ? 0 : e;
|
|
4
4
|
}
|
|
5
|
-
class
|
|
5
|
+
class Re {
|
|
6
6
|
sizes = /* @__PURE__ */ new Map();
|
|
7
7
|
divergent = !1;
|
|
8
8
|
get(t) {
|
|
@@ -30,45 +30,45 @@ class Te {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function Se(e, t, i) {
|
|
34
34
|
return Math.min(i, Math.max(t, e));
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
function
|
|
36
|
+
const Te = 16777216;
|
|
37
|
+
function H(e, t, i) {
|
|
38
38
|
const n = Math.max(0, t - Math.max(0, i));
|
|
39
|
-
return
|
|
39
|
+
return Se(Number.isFinite(e) ? e : 0, 0, n);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
const i = Math.max(0, Number.isFinite(e) ? e : 0), n = Math.min(i,
|
|
41
|
+
function N(e, t) {
|
|
42
|
+
const i = Math.max(0, Number.isFinite(e) ? e : 0), n = Math.min(i, Te);
|
|
43
43
|
return t === void 0 || !Number.isFinite(t) || t <= 0 ? n : Math.min(n, t);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function Ee(e, t, i, n) {
|
|
46
46
|
const r = Math.max(0, t - Math.max(0, n)), s = Math.max(0, i - Math.max(0, n));
|
|
47
|
-
return r <= 0 ? 0 : s <= 0 || s >= r ?
|
|
47
|
+
return r <= 0 ? 0 : s <= 0 || s >= r ? H(e, t, n) : Math.max(0, e) / s * r;
|
|
48
48
|
}
|
|
49
49
|
function ke(e, t, i, n) {
|
|
50
50
|
const r = Math.max(0, t - Math.max(0, n)), s = Math.max(0, i - Math.max(0, n));
|
|
51
|
-
return s <= 0 ? 0 : r <= 0 || s >= r ?
|
|
51
|
+
return s <= 0 ? 0 : r <= 0 || s >= r ? H(e, t, n) : H(e, t, n) / r * s;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function Ce(e, t, i) {
|
|
54
54
|
if (e <= 0) return 0;
|
|
55
55
|
let n = 0, r = e - 1, s = e - 1;
|
|
56
56
|
for (; n <= r; ) {
|
|
57
|
-
const
|
|
58
|
-
i(
|
|
57
|
+
const u = n + r >>> 1;
|
|
58
|
+
i(u) > t ? (s = u, r = u - 1) : n = u + 1;
|
|
59
59
|
}
|
|
60
60
|
return s;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function $e(e, t, i) {
|
|
63
63
|
if (e <= 0) return 0;
|
|
64
64
|
let n = 0, r = e - 1, s = 0;
|
|
65
65
|
for (; n <= r; ) {
|
|
66
|
-
const
|
|
67
|
-
i(
|
|
66
|
+
const u = n + r >>> 1;
|
|
67
|
+
i(u) < t ? (s = u, n = u + 1) : r = u - 1;
|
|
68
68
|
}
|
|
69
69
|
return s;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function Ve(e) {
|
|
72
72
|
const t = e.start + e.size;
|
|
73
73
|
let i = e.align;
|
|
74
74
|
if (i === "auto") {
|
|
@@ -78,7 +78,7 @@ function $e(e) {
|
|
|
78
78
|
}
|
|
79
79
|
return i === "center" ? e.start - (e.viewport - e.size) / 2 : i === "end" ? t - e.viewport : e.start;
|
|
80
80
|
}
|
|
81
|
-
class
|
|
81
|
+
class Ae {
|
|
82
82
|
count = 0;
|
|
83
83
|
estimateSize = () => 0;
|
|
84
84
|
overscan = 0;
|
|
@@ -90,14 +90,14 @@ class Fe {
|
|
|
90
90
|
viewportSize = 0;
|
|
91
91
|
scrollOffset = 0;
|
|
92
92
|
getItemKey = (t) => t;
|
|
93
|
-
measurements = new
|
|
93
|
+
measurements = new Re();
|
|
94
94
|
built = 0;
|
|
95
95
|
offsets = [];
|
|
96
96
|
laneCursor = [];
|
|
97
97
|
laneEnd = [];
|
|
98
98
|
setOptions(t) {
|
|
99
|
-
const i = Math.max(1, Math.floor(t.lanes ?? 1)), n = t.gap ?? 0, r = t.paddingStart ?? 0, s = t.paddingEnd ?? 0,
|
|
100
|
-
this.count =
|
|
99
|
+
const i = Math.max(1, Math.floor(t.lanes ?? 1)), n = t.gap ?? 0, r = t.paddingStart ?? 0, s = t.paddingEnd ?? 0, u = Math.max(0, Math.floor(t.count)), p = t.itemSize === void 0 || t.itemSize === null ? null : ee(t.itemSize), x = this.itemSize, I = i !== this.lanes || n !== this.gap || r !== this.paddingStart || s !== this.paddingEnd || t.estimateSize !== this.estimateSize || p !== this.itemSize;
|
|
100
|
+
this.count = u, this.lanes = i, this.gap = n, this.paddingStart = r, this.paddingEnd = s, this.overscan = Math.max(0, Math.floor(t.overscan ?? 0)), this.estimateSize = t.estimateSize, this.itemSize = p, this.getItemKey = t.getItemKey ?? ((w) => w), t.viewportSize !== void 0 && (this.viewportSize = Math.max(0, t.viewportSize)), p !== x && this.measurements.clear(), this.measurements.trim(this.count, this.itemSize), (I || this.built > this.count) && this.resetGeometry();
|
|
101
101
|
}
|
|
102
102
|
setScrollOffset(t) {
|
|
103
103
|
this.scrollOffset = Number.isFinite(t) ? t : 0;
|
|
@@ -137,8 +137,8 @@ class Fe {
|
|
|
137
137
|
let i = this.paddingStart;
|
|
138
138
|
const n = this.itemSize ?? 0;
|
|
139
139
|
for (let r = 0; r < this.lanes && r < this.count; r += 1) {
|
|
140
|
-
const s = this.laneLength(r),
|
|
141
|
-
|
|
140
|
+
const s = this.laneLength(r), u = this.paddingStart + s * n + Math.max(0, s - 1) * this.gap;
|
|
141
|
+
u > i && (i = u);
|
|
142
142
|
}
|
|
143
143
|
return i + this.paddingEnd;
|
|
144
144
|
}
|
|
@@ -152,26 +152,26 @@ class Fe {
|
|
|
152
152
|
}
|
|
153
153
|
getVirtualItems() {
|
|
154
154
|
if (this.count <= 0 || this.viewportSize <= 0) return [];
|
|
155
|
-
const t =
|
|
155
|
+
const t = H(this.scrollOffset, this.getTotalSize(), this.viewportSize), i = t + this.viewportSize, n = [];
|
|
156
156
|
for (let r = 0; r < this.lanes; r += 1) {
|
|
157
157
|
const s = this.laneLength(r);
|
|
158
158
|
if (s <= 0) continue;
|
|
159
|
-
const
|
|
160
|
-
const b = this.ordinalIndex(r,
|
|
159
|
+
const u = Ce(s, t, (w) => {
|
|
160
|
+
const b = this.ordinalIndex(r, w);
|
|
161
161
|
return this.getItemOffset(b) + this.getItemSize(b);
|
|
162
|
-
}), p =
|
|
162
|
+
}), p = $e(
|
|
163
163
|
s,
|
|
164
164
|
i,
|
|
165
|
-
(
|
|
166
|
-
),
|
|
167
|
-
for (let
|
|
168
|
-
const b = this.ordinalIndex(r,
|
|
165
|
+
(w) => this.getItemOffset(this.ordinalIndex(r, w))
|
|
166
|
+
), x = Math.max(0, Math.min(u, p) - this.overscan), I = Math.min(s - 1, Math.max(u, p) + this.overscan);
|
|
167
|
+
for (let w = x; w <= I; w += 1) {
|
|
168
|
+
const b = this.ordinalIndex(r, w), E = this.getItemOffset(b), k = this.getItemSize(b);
|
|
169
169
|
n.push({
|
|
170
170
|
index: b,
|
|
171
171
|
key: this.getItemKey(b),
|
|
172
172
|
start: E,
|
|
173
|
-
size:
|
|
174
|
-
end: E +
|
|
173
|
+
size: k,
|
|
174
|
+
end: E + k,
|
|
175
175
|
lane: r
|
|
176
176
|
});
|
|
177
177
|
}
|
|
@@ -180,14 +180,14 @@ class Fe {
|
|
|
180
180
|
}
|
|
181
181
|
getOffsetForIndex(t, i = "auto") {
|
|
182
182
|
if (this.count <= 0) return 0;
|
|
183
|
-
const n =
|
|
183
|
+
const n = Se(t, 0, this.count - 1), r = this.getItemOffset(n), s = this.getItemSize(n), u = Ve({
|
|
184
184
|
start: r,
|
|
185
185
|
size: s,
|
|
186
186
|
viewport: this.viewportSize,
|
|
187
187
|
current: this.scrollOffset,
|
|
188
188
|
align: i
|
|
189
189
|
});
|
|
190
|
-
return
|
|
190
|
+
return H(u, this.getTotalSize(), this.viewportSize);
|
|
191
191
|
}
|
|
192
192
|
usesFixedPath() {
|
|
193
193
|
return this.itemSize !== null && !this.measurements.hasDivergent;
|
|
@@ -212,13 +212,13 @@ class Fe {
|
|
|
212
212
|
this.built = 0, this.offsets = [], this.laneCursor = Array.from({ length: this.lanes }, () => this.paddingStart), this.laneEnd = Array.from({ length: this.lanes }, () => this.paddingStart);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function Z() {
|
|
216
216
|
return typeof window < "u" && typeof document < "u";
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function ze(e) {
|
|
219
219
|
return typeof Element > "u" ? null : e instanceof Element ? e : null;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function Fe(e, t, i, n) {
|
|
222
222
|
if (n === "smooth" && typeof e.scrollTo == "function") {
|
|
223
223
|
e.scrollTo({
|
|
224
224
|
top: i ? e.scrollTop : t,
|
|
@@ -229,22 +229,22 @@ function Ke(e, t, i, n) {
|
|
|
229
229
|
}
|
|
230
230
|
i ? e.scrollLeft = t : e.scrollTop = t;
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function fe(e, t) {
|
|
233
233
|
return t ? e.scrollLeft : e.scrollTop;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function de(e, t) {
|
|
236
236
|
return t ? e.clientWidth : e.clientHeight;
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function Ke(e, t) {
|
|
239
239
|
return t ? e.scrollWidth : e.scrollHeight;
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function Le(e) {
|
|
242
242
|
return typeof requestAnimationFrame == "function" ? requestAnimationFrame(e) : setTimeout(e, 0);
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function je(e) {
|
|
245
245
|
e && (typeof cancelAnimationFrame == "function" ? cancelAnimationFrame(e) : clearTimeout(e));
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function Ge(e, t) {
|
|
248
248
|
if (e.length !== t.length) return !1;
|
|
249
249
|
for (let i = 0; i < e.length; i += 1) {
|
|
250
250
|
const n = e[i], r = t[i];
|
|
@@ -254,127 +254,130 @@ function je(e, t) {
|
|
|
254
254
|
return !0;
|
|
255
255
|
}
|
|
256
256
|
function te(e) {
|
|
257
|
-
const t = new
|
|
258
|
-
let
|
|
259
|
-
const
|
|
260
|
-
function
|
|
257
|
+
const t = new Ae(), i = Me([]), n = L(0), r = L(0), s = L(0), u = L(!1), p = (a) => e.estimateSize(a);
|
|
258
|
+
let x = null, I = null, w = null, b = 0, E = 0, k = 0, f = o(e.revision);
|
|
259
|
+
const d = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), l = [];
|
|
260
|
+
function z() {
|
|
261
261
|
const a = o(e.container);
|
|
262
262
|
return typeof HTMLElement > "u" ? null : a instanceof HTMLElement ? a : null;
|
|
263
263
|
}
|
|
264
264
|
function m() {
|
|
265
265
|
return o(e.horizontal) ?? !1;
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function j() {
|
|
268
268
|
const a = o(e.initialRect);
|
|
269
269
|
return a ? m() ? a.width : a.height : 0;
|
|
270
270
|
}
|
|
271
|
-
function X(a,
|
|
272
|
-
return a ?
|
|
271
|
+
function X(a, c) {
|
|
272
|
+
return a ? N(c, Ke(a, m())) : N(c);
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
return
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
X(a,
|
|
274
|
+
function _(a, c, g) {
|
|
275
|
+
return Ee(
|
|
276
|
+
fe(a, m()),
|
|
277
|
+
c,
|
|
278
|
+
X(a, c),
|
|
279
279
|
g
|
|
280
280
|
);
|
|
281
281
|
}
|
|
282
|
-
function v(a,
|
|
283
|
-
|
|
282
|
+
function v(a, c, g, M, O) {
|
|
283
|
+
Fe(
|
|
284
284
|
a,
|
|
285
|
-
ke(
|
|
285
|
+
ke(c, g, X(a, g), M),
|
|
286
286
|
m(),
|
|
287
|
-
|
|
287
|
+
O
|
|
288
288
|
);
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function y() {
|
|
291
291
|
const a = o(e.revision);
|
|
292
|
-
Object.is(a,
|
|
293
|
-
const
|
|
292
|
+
Object.is(a, f) || (f = a, t.clearMeasurements());
|
|
293
|
+
const c = z(), g = c ? de(c, m()) : 0, M = o(e.viewportInset) ?? 0, O = Math.max(0, (g > 0 ? g : j()) - M), C = o(e.itemSize);
|
|
294
294
|
t.setOptions({
|
|
295
295
|
count: o(e.count),
|
|
296
296
|
estimateSize: p,
|
|
297
|
-
overscan: o(e.overscan) ??
|
|
297
|
+
overscan: (o(e.overscan) ?? 8) + k,
|
|
298
298
|
gap: o(e.gap) ?? 0,
|
|
299
299
|
paddingStart: o(e.paddingStart) ?? 0,
|
|
300
300
|
paddingEnd: o(e.paddingEnd) ?? 0,
|
|
301
301
|
lanes: o(e.lanes) ?? 1,
|
|
302
|
-
itemSize:
|
|
302
|
+
itemSize: C ?? null,
|
|
303
303
|
getItemKey: e.getItemKey,
|
|
304
|
-
viewportSize:
|
|
304
|
+
viewportSize: O
|
|
305
305
|
});
|
|
306
|
-
const
|
|
307
|
-
t.getScrollOffset() > J && (t.setScrollOffset(J),
|
|
308
|
-
const
|
|
309
|
-
|
|
306
|
+
const A = t.getTotalSize(), J = Math.max(0, A - O);
|
|
307
|
+
t.getScrollOffset() > J && (t.setScrollOffset(J), c && v(c, J, A, O, "auto"));
|
|
308
|
+
const ae = t.getVirtualItems();
|
|
309
|
+
Ge(i.value, ae) || (i.value = ae), n.value !== A && (n.value = A);
|
|
310
310
|
const Q = t.getScrollOffset();
|
|
311
311
|
r.value !== Q && (r.value = Q);
|
|
312
|
-
const
|
|
313
|
-
s.value !==
|
|
312
|
+
const le = c ? Q - fe(c, m()) : 0;
|
|
313
|
+
s.value !== le && (s.value = le);
|
|
314
314
|
}
|
|
315
|
-
function
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}, 150));
|
|
324
|
-
}));
|
|
315
|
+
function S() {
|
|
316
|
+
u.value = !1, k = 0;
|
|
317
|
+
for (const [a, c] of d)
|
|
318
|
+
l.push({ element: a, index: c });
|
|
319
|
+
se(), y();
|
|
320
|
+
}
|
|
321
|
+
function V() {
|
|
322
|
+
u.value = !0, !(typeof window > "u") && (window.clearTimeout(E), E = window.setTimeout(S, 120));
|
|
325
323
|
}
|
|
326
|
-
function
|
|
327
|
-
const a =
|
|
324
|
+
function B() {
|
|
325
|
+
const a = z();
|
|
328
326
|
if (!a) return;
|
|
329
|
-
|
|
330
|
-
t.
|
|
327
|
+
V();
|
|
328
|
+
const c = t.getViewportSize(), g = t.getTotalSize(), M = _(a, g, c), O = t.getScrollOffset(), C = Math.max(1, o(e.itemSize) ?? 48);
|
|
329
|
+
k = Math.min(24, Math.ceil(Math.abs(M - O) / C)), t.setScrollOffset(M), y();
|
|
331
330
|
}
|
|
332
|
-
function
|
|
333
|
-
const a =
|
|
334
|
-
if (a ===
|
|
335
|
-
const
|
|
336
|
-
t.getScrollOffset() > 0 ? v(a, t.getScrollOffset(), g,
|
|
331
|
+
function we() {
|
|
332
|
+
const a = z();
|
|
333
|
+
if (a === x || (x && (x.removeEventListener("scroll", B), I?.disconnect(), I = null), x = a, !a || !Z())) return;
|
|
334
|
+
const c = t.getViewportSize(), g = t.getTotalSize();
|
|
335
|
+
t.getScrollOffset() > 0 ? v(a, t.getScrollOffset(), g, c, "auto") : t.setScrollOffset(_(a, g, c)), a.addEventListener("scroll", B, { passive: !0 }), typeof ResizeObserver < "u" && (I = new ResizeObserver(() => y()), I.observe(a));
|
|
337
336
|
}
|
|
338
337
|
function xe() {
|
|
339
|
-
return !
|
|
340
|
-
const
|
|
338
|
+
return !Z() || typeof ResizeObserver > "u" ? null : (w || (w = new ResizeObserver((a) => {
|
|
339
|
+
const c = m();
|
|
341
340
|
let g = !1;
|
|
342
|
-
|
|
343
|
-
const M
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
341
|
+
if (!u.value) {
|
|
342
|
+
for (const M of a) {
|
|
343
|
+
const O = d.get(M.target);
|
|
344
|
+
if (O === void 0) continue;
|
|
345
|
+
const C = M.borderBoxSize?.[0], A = Math.round(
|
|
346
|
+
c ? C?.inlineSize ?? M.contentRect.width : C?.blockSize ?? M.contentRect.height
|
|
347
|
+
);
|
|
348
|
+
A > 0 && t.measure(O, A) && (g = !0);
|
|
349
|
+
}
|
|
350
|
+
g && y();
|
|
347
351
|
}
|
|
348
|
-
|
|
349
|
-
})), y);
|
|
352
|
+
})), w);
|
|
350
353
|
}
|
|
351
|
-
function
|
|
352
|
-
|
|
353
|
-
const a = l.splice(0, l.length),
|
|
354
|
+
function se() {
|
|
355
|
+
if (b = 0, u.value) return;
|
|
356
|
+
const a = l.splice(0, l.length), c = m();
|
|
354
357
|
let g = !1;
|
|
355
|
-
for (const
|
|
356
|
-
if (!
|
|
357
|
-
const
|
|
358
|
-
|
|
358
|
+
for (const M of a) {
|
|
359
|
+
if (!M.element.isConnected) continue;
|
|
360
|
+
const O = M.element.getBoundingClientRect(), C = Math.round(c ? O.width : O.height);
|
|
361
|
+
C > 0 && t.measure(M.index, C) && (g = !0);
|
|
359
362
|
}
|
|
360
|
-
g &&
|
|
363
|
+
g && y();
|
|
361
364
|
}
|
|
362
|
-
function
|
|
363
|
-
const g =
|
|
364
|
-
|
|
365
|
+
function pe(a, c) {
|
|
366
|
+
const g = ze(a), M = xe(), O = h.get(c);
|
|
367
|
+
O && O !== g && (M?.unobserve(O), d.delete(O), h.delete(c)), g && (h.set(c, g), d.set(g, c), M?.observe(g), l.push({ element: g, index: c }), !(u.value || b) && (b = Le(se)));
|
|
365
368
|
}
|
|
366
|
-
function
|
|
367
|
-
const g =
|
|
368
|
-
t.setScrollOffset(
|
|
369
|
+
function oe(a, c = "auto") {
|
|
370
|
+
const g = z(), M = g ? de(g, m()) : 0, O = M > 0 ? M : t.getViewportSize(), C = t.getTotalSize(), A = H(a, C, O);
|
|
371
|
+
t.setScrollOffset(A), g && v(g, A, C, O, c), y();
|
|
369
372
|
}
|
|
370
|
-
function
|
|
371
|
-
const g = t.getOffsetForIndex(a,
|
|
372
|
-
|
|
373
|
+
function be(a, c) {
|
|
374
|
+
const g = t.getOffsetForIndex(a, c?.align ?? "auto");
|
|
375
|
+
oe(g, c?.behavior ?? "auto");
|
|
373
376
|
}
|
|
374
|
-
function
|
|
375
|
-
t.measure(a,
|
|
377
|
+
function Ie(a, c) {
|
|
378
|
+
t.measure(a, c) && y();
|
|
376
379
|
}
|
|
377
|
-
return
|
|
380
|
+
return y(), ge(
|
|
378
381
|
() => [
|
|
379
382
|
o(e.count),
|
|
380
383
|
o(e.overscan),
|
|
@@ -391,32 +394,32 @@ function te(e) {
|
|
|
391
394
|
o(e.initialRect)?.height
|
|
392
395
|
],
|
|
393
396
|
() => {
|
|
394
|
-
|
|
397
|
+
we(), y();
|
|
395
398
|
},
|
|
396
399
|
{ flush: "post" }
|
|
397
|
-
),
|
|
398
|
-
|
|
400
|
+
), ve(() => {
|
|
401
|
+
x && x.removeEventListener("scroll", B), I?.disconnect(), w?.disconnect(), je(b), typeof window < "u" && window.clearTimeout(E), d.clear(), h.clear(), l.length = 0;
|
|
399
402
|
}), {
|
|
400
|
-
virtualItems:
|
|
401
|
-
totalSize:
|
|
402
|
-
scrollOffset:
|
|
403
|
-
scrollAdjust:
|
|
404
|
-
isScrolling:
|
|
405
|
-
scrollToIndex:
|
|
406
|
-
scrollToOffset:
|
|
407
|
-
measure:
|
|
408
|
-
measureElement:
|
|
403
|
+
virtualItems: R(() => i.value),
|
|
404
|
+
totalSize: R(() => n.value),
|
|
405
|
+
scrollOffset: R(() => r.value),
|
|
406
|
+
scrollAdjust: R(() => s.value),
|
|
407
|
+
isScrolling: R(() => u.value),
|
|
408
|
+
scrollToIndex: be,
|
|
409
|
+
scrollToOffset: oe,
|
|
410
|
+
measure: Ie,
|
|
411
|
+
measureElement: pe
|
|
409
412
|
};
|
|
410
413
|
}
|
|
411
|
-
function
|
|
414
|
+
function Ne(e, t, i) {
|
|
412
415
|
return typeof e == "function" ? e(t, i) : typeof e == "number" ? e : 48;
|
|
413
416
|
}
|
|
414
|
-
function
|
|
417
|
+
function ye(e) {
|
|
415
418
|
const t = te({
|
|
416
419
|
count: () => o(e.items).length,
|
|
417
420
|
estimateSize: (n) => {
|
|
418
421
|
const r = o(e.items);
|
|
419
|
-
return
|
|
422
|
+
return Ne(e.estimateSize, n, r[n]);
|
|
420
423
|
},
|
|
421
424
|
getItemKey: (n) => {
|
|
422
425
|
const s = o(e.items)[n];
|
|
@@ -434,7 +437,7 @@ function we(e) {
|
|
|
434
437
|
revision: e.revision
|
|
435
438
|
});
|
|
436
439
|
return {
|
|
437
|
-
virtualItems:
|
|
440
|
+
virtualItems: R(() => {
|
|
438
441
|
const n = o(e.items);
|
|
439
442
|
return t.virtualItems.value.map((r) => {
|
|
440
443
|
const s = n[r.index];
|
|
@@ -455,16 +458,16 @@ function we(e) {
|
|
|
455
458
|
measureElement: t.measureElement
|
|
456
459
|
};
|
|
457
460
|
}
|
|
458
|
-
function
|
|
461
|
+
function he(e, t, i) {
|
|
459
462
|
return typeof e == "function" ? e(t) : typeof e == "number" ? e : i;
|
|
460
463
|
}
|
|
461
|
-
function
|
|
462
|
-
const t =
|
|
464
|
+
function Be(e) {
|
|
465
|
+
const t = R(() => Math.max(1, Math.floor(o(e.columnCount) || 1))), i = R(() => Math.ceil(o(e.items).length / t.value)), n = /* @__PURE__ */ new Map(), r = te({
|
|
463
466
|
count: () => i.value,
|
|
464
|
-
estimateSize: (
|
|
467
|
+
estimateSize: (f) => he(o(e.estimateRowSize), f, 48),
|
|
465
468
|
itemSize: () => {
|
|
466
|
-
const
|
|
467
|
-
return typeof
|
|
469
|
+
const f = o(e.estimateRowSize);
|
|
470
|
+
return typeof f == "number" ? f : void 0;
|
|
468
471
|
},
|
|
469
472
|
overscan: () => o(e.overscanRows) ?? o(e.overscan) ?? 2,
|
|
470
473
|
gap: () => o(e.rowGap) ?? 0,
|
|
@@ -474,10 +477,10 @@ function Ne(e) {
|
|
|
474
477
|
revision: e.revision
|
|
475
478
|
}), s = te({
|
|
476
479
|
count: () => t.value,
|
|
477
|
-
estimateSize: (
|
|
480
|
+
estimateSize: (f) => he(o(e.estimateColumnSize), f, 160),
|
|
478
481
|
itemSize: () => {
|
|
479
|
-
const
|
|
480
|
-
return typeof
|
|
482
|
+
const f = o(e.estimateColumnSize);
|
|
483
|
+
return typeof f == "number" ? f : void 0;
|
|
481
484
|
},
|
|
482
485
|
overscan: () => o(e.overscanColumns) ?? o(e.overscan) ?? 1,
|
|
483
486
|
gap: () => o(e.columnGap) ?? 0,
|
|
@@ -485,74 +488,74 @@ function Ne(e) {
|
|
|
485
488
|
container: e.container,
|
|
486
489
|
initialRect: e.initialRect,
|
|
487
490
|
revision: e.revision
|
|
488
|
-
}),
|
|
489
|
-
const
|
|
491
|
+
}), u = R(() => {
|
|
492
|
+
const f = o(e.items), d = t.value, h = [];
|
|
490
493
|
for (const l of r.virtualItems.value)
|
|
491
|
-
for (const
|
|
492
|
-
const m = l.index *
|
|
493
|
-
if (m >=
|
|
494
|
-
const
|
|
494
|
+
for (const z of s.virtualItems.value) {
|
|
495
|
+
const m = l.index * d + z.index;
|
|
496
|
+
if (m >= f.length) continue;
|
|
497
|
+
const j = f[m];
|
|
495
498
|
h.push({
|
|
496
499
|
index: m,
|
|
497
|
-
key: e.getItemKey?.(
|
|
498
|
-
item:
|
|
500
|
+
key: e.getItemKey?.(j, m) ?? m,
|
|
501
|
+
item: j,
|
|
499
502
|
row: l,
|
|
500
|
-
column:
|
|
503
|
+
column: z
|
|
501
504
|
});
|
|
502
505
|
}
|
|
503
506
|
return h;
|
|
504
507
|
});
|
|
505
|
-
function p(
|
|
508
|
+
function p(f, d) {
|
|
506
509
|
const h = o(e.items);
|
|
507
510
|
if (!h.length) return;
|
|
508
|
-
const l = Math.min(Math.max(
|
|
509
|
-
r.scrollToIndex(Math.floor(l /
|
|
511
|
+
const l = Math.min(Math.max(f, 0), h.length - 1), z = t.value;
|
|
512
|
+
r.scrollToIndex(Math.floor(l / z), d), s.scrollToIndex(l % z, d);
|
|
510
513
|
}
|
|
511
|
-
function
|
|
512
|
-
|
|
514
|
+
function x(f, d = "auto") {
|
|
515
|
+
f.top !== void 0 && r.scrollToOffset(f.top, d), f.left !== void 0 && s.scrollToOffset(f.left, d);
|
|
513
516
|
}
|
|
514
|
-
function I(
|
|
515
|
-
const h = Math.max(n.get(
|
|
516
|
-
h <= 0 || h === n.get(
|
|
517
|
+
function I(f, d) {
|
|
518
|
+
const h = Math.max(n.get(f) ?? 0, d);
|
|
519
|
+
h <= 0 || h === n.get(f) || (n.set(f, h), r.measure(f, h));
|
|
517
520
|
}
|
|
518
|
-
let
|
|
521
|
+
let w = null;
|
|
519
522
|
const b = /* @__PURE__ */ new Map();
|
|
520
523
|
function E() {
|
|
521
|
-
return !
|
|
522
|
-
for (const
|
|
523
|
-
const h = b.get(
|
|
524
|
+
return !Z() || typeof ResizeObserver > "u" ? null : (w || (w = new ResizeObserver((f) => {
|
|
525
|
+
for (const d of f) {
|
|
526
|
+
const h = b.get(d.target);
|
|
524
527
|
if (h === void 0) continue;
|
|
525
|
-
const
|
|
526
|
-
|
|
528
|
+
const z = d.borderBoxSize?.[0]?.blockSize ?? d.contentRect.height;
|
|
529
|
+
z > 0 && I(h, z);
|
|
527
530
|
}
|
|
528
|
-
})),
|
|
531
|
+
})), w);
|
|
529
532
|
}
|
|
530
|
-
function
|
|
531
|
-
const h =
|
|
533
|
+
function k(f, d) {
|
|
534
|
+
const h = ze(f), l = E();
|
|
532
535
|
if (!h) return;
|
|
533
|
-
b.set(h,
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
+
b.set(h, d), l?.observe(h);
|
|
537
|
+
const z = h.getBoundingClientRect().height;
|
|
538
|
+
z > 0 && I(d, z);
|
|
536
539
|
}
|
|
537
|
-
return
|
|
538
|
-
|
|
540
|
+
return ve(() => {
|
|
541
|
+
w?.disconnect(), b.clear();
|
|
539
542
|
}), {
|
|
540
543
|
virtualRows: r.virtualItems,
|
|
541
544
|
virtualColumns: s.virtualItems,
|
|
542
|
-
virtualCells:
|
|
545
|
+
virtualCells: u,
|
|
543
546
|
totalHeight: r.totalSize,
|
|
544
547
|
totalWidth: s.totalSize,
|
|
545
548
|
scrollAdjustX: s.scrollAdjust,
|
|
546
549
|
scrollAdjustY: r.scrollAdjust,
|
|
547
550
|
scrollToIndex: p,
|
|
548
|
-
scrollToOffset:
|
|
551
|
+
scrollToOffset: x,
|
|
549
552
|
measureRow: I,
|
|
550
|
-
measureRowElement:
|
|
553
|
+
measureRowElement: k,
|
|
551
554
|
measureColumn: s.measure
|
|
552
555
|
};
|
|
553
556
|
}
|
|
554
|
-
function
|
|
555
|
-
const t =
|
|
557
|
+
function He(e) {
|
|
558
|
+
const t = ye({
|
|
556
559
|
items: e.rows,
|
|
557
560
|
estimateSize: e.estimateRowSize,
|
|
558
561
|
container: e.container,
|
|
@@ -562,24 +565,24 @@ function Be(e) {
|
|
|
562
565
|
viewportInset: e.viewportInset,
|
|
563
566
|
revision: e.revision,
|
|
564
567
|
itemSize: e.itemSize
|
|
565
|
-
}), i =
|
|
568
|
+
}), i = R(() => {
|
|
566
569
|
const s = o(e.columns);
|
|
567
|
-
let
|
|
570
|
+
let u = 0;
|
|
568
571
|
return s.map((p) => {
|
|
569
|
-
const
|
|
572
|
+
const x = p.width ?? p.minWidth ?? 160, I = {
|
|
570
573
|
...p,
|
|
571
|
-
start:
|
|
572
|
-
size:
|
|
573
|
-
end:
|
|
574
|
+
start: u,
|
|
575
|
+
size: x,
|
|
576
|
+
end: u + x
|
|
574
577
|
};
|
|
575
|
-
return
|
|
578
|
+
return u += x, I;
|
|
576
579
|
});
|
|
577
|
-
}), n =
|
|
580
|
+
}), n = R(() => {
|
|
578
581
|
const s = i.value;
|
|
579
582
|
return s.length ? s[s.length - 1]?.end ?? 0 : 0;
|
|
580
583
|
});
|
|
581
584
|
return {
|
|
582
|
-
virtualRows:
|
|
585
|
+
virtualRows: R(() => t.virtualItems.value),
|
|
583
586
|
columns: i,
|
|
584
587
|
totalHeight: t.totalSize,
|
|
585
588
|
totalWidth: n,
|
|
@@ -592,11 +595,11 @@ function Be(e) {
|
|
|
592
595
|
measureElement: t.measureElement
|
|
593
596
|
};
|
|
594
597
|
}
|
|
595
|
-
function
|
|
598
|
+
function me(e) {
|
|
596
599
|
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
597
600
|
if (typeof e == "string" && e.trim()) return e;
|
|
598
601
|
}
|
|
599
|
-
function
|
|
602
|
+
function W(e) {
|
|
600
603
|
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
601
604
|
if (typeof e != "string") return 0;
|
|
602
605
|
const t = /^(-?\d+(?:\.\d+)?)px$/.exec(e.trim());
|
|
@@ -608,30 +611,33 @@ function re(e) {
|
|
|
608
611
|
return {
|
|
609
612
|
overflow: "auto",
|
|
610
613
|
position: "relative",
|
|
611
|
-
height:
|
|
612
|
-
width:
|
|
614
|
+
height: me(e.height) ?? (e.horizontal ? "100%" : void 0),
|
|
615
|
+
width: me(e.width) ?? (e.horizontal ? void 0 : "100%"),
|
|
613
616
|
overflowAnchor: "none"
|
|
614
617
|
};
|
|
615
618
|
}
|
|
616
|
-
function
|
|
617
|
-
const i =
|
|
619
|
+
function We(e, t) {
|
|
620
|
+
const i = N(e);
|
|
618
621
|
return {
|
|
619
622
|
position: "relative",
|
|
620
623
|
width: t ? `${i}px` : "100%",
|
|
621
624
|
height: t ? "100%" : `${i}px`
|
|
622
625
|
};
|
|
623
626
|
}
|
|
624
|
-
function
|
|
627
|
+
function _e(e, t, i) {
|
|
625
628
|
return {
|
|
626
629
|
position: "absolute",
|
|
627
630
|
top: 0,
|
|
628
631
|
left: 0,
|
|
629
|
-
width: t ? void 0 : "100%",
|
|
630
|
-
height: t ? "100%" : void 0
|
|
631
|
-
transform: t ? `translateX(${e}px)` : `translateY(${e}px)
|
|
632
|
+
width: t ? i === void 0 ? void 0 : `${i}px` : "100%",
|
|
633
|
+
height: t ? "100%" : i === void 0 ? void 0 : `${i}px`,
|
|
634
|
+
transform: t ? `translateX(${e}px)` : `translateY(${e}px)`,
|
|
635
|
+
contain: "layout style",
|
|
636
|
+
boxSizing: "border-box",
|
|
637
|
+
overflow: "hidden"
|
|
632
638
|
};
|
|
633
639
|
}
|
|
634
|
-
const
|
|
640
|
+
const Ye = /* @__PURE__ */ ie({
|
|
635
641
|
__name: "VirtualList",
|
|
636
642
|
props: {
|
|
637
643
|
items: {},
|
|
@@ -639,7 +645,7 @@ const Xe = /* @__PURE__ */ ie({
|
|
|
639
645
|
height: {},
|
|
640
646
|
width: {},
|
|
641
647
|
horizontal: { type: Boolean, default: !1 },
|
|
642
|
-
overscan: { default:
|
|
648
|
+
overscan: { default: 8 },
|
|
643
649
|
gap: { default: 0 },
|
|
644
650
|
paddingStart: { default: 0 },
|
|
645
651
|
paddingEnd: { default: 0 },
|
|
@@ -650,11 +656,11 @@ const Xe = /* @__PURE__ */ ie({
|
|
|
650
656
|
revision: {}
|
|
651
657
|
},
|
|
652
658
|
setup(e, { expose: t }) {
|
|
653
|
-
const i = e, n = L(null), { virtualItems: r, totalSize: s, scrollAdjust:
|
|
659
|
+
const i = e, n = L(null), { virtualItems: r, totalSize: s, scrollAdjust: u, scrollToIndex: p, scrollToOffset: x, measure: I, measureElement: w } = ye({
|
|
654
660
|
items: () => i.items,
|
|
655
|
-
estimateSize: (
|
|
661
|
+
estimateSize: (d, h) => {
|
|
656
662
|
const l = i.estimateSize;
|
|
657
|
-
return typeof l == "number" ? l : l(
|
|
663
|
+
return typeof l == "number" ? l : l(d, h);
|
|
658
664
|
},
|
|
659
665
|
itemSize: () => typeof i.estimateSize == "number" ? i.estimateSize : void 0,
|
|
660
666
|
container: n,
|
|
@@ -663,57 +669,57 @@ const Xe = /* @__PURE__ */ ie({
|
|
|
663
669
|
gap: () => i.gap,
|
|
664
670
|
paddingStart: () => i.paddingStart,
|
|
665
671
|
paddingEnd: () => i.paddingEnd,
|
|
666
|
-
getItemKey: (
|
|
672
|
+
getItemKey: (d, h) => i.getItemKey?.(d, h) ?? h,
|
|
667
673
|
initialRect: () => ({
|
|
668
|
-
width:
|
|
669
|
-
height:
|
|
674
|
+
width: W(i.width),
|
|
675
|
+
height: W(i.height)
|
|
670
676
|
}),
|
|
671
677
|
revision: () => i.revision
|
|
672
|
-
}), b =
|
|
678
|
+
}), b = R(
|
|
673
679
|
() => re({
|
|
674
680
|
height: i.height,
|
|
675
681
|
width: i.width,
|
|
676
682
|
horizontal: i.horizontal
|
|
677
683
|
})
|
|
678
|
-
), E =
|
|
679
|
-
function
|
|
680
|
-
return
|
|
684
|
+
), E = R(() => We(s.value, i.horizontal));
|
|
685
|
+
function k(d, h) {
|
|
686
|
+
return _e(d, i.horizontal, h);
|
|
681
687
|
}
|
|
682
|
-
function
|
|
688
|
+
function f(d) {
|
|
683
689
|
return (h) => {
|
|
684
|
-
|
|
690
|
+
w(h, d);
|
|
685
691
|
};
|
|
686
692
|
}
|
|
687
693
|
return t({
|
|
688
694
|
scrollToIndex: p,
|
|
689
|
-
scrollToOffset:
|
|
695
|
+
scrollToOffset: x,
|
|
690
696
|
measure: I
|
|
691
|
-
}), (
|
|
697
|
+
}), (d, h) => (T(), Y(q(e.tag), {
|
|
692
698
|
ref_key: "container",
|
|
693
699
|
ref: n,
|
|
694
700
|
"data-virtual-container": "",
|
|
695
701
|
role: "list",
|
|
696
702
|
style: F(b.value)
|
|
697
703
|
}, {
|
|
698
|
-
default:
|
|
699
|
-
e.items.length ? (T(),
|
|
704
|
+
default: U(() => [
|
|
705
|
+
e.items.length ? (T(), $("div", {
|
|
700
706
|
key: 1,
|
|
701
707
|
"data-virtual-spacer": "",
|
|
702
708
|
style: F(E.value)
|
|
703
709
|
}, [
|
|
704
|
-
(T(!0),
|
|
710
|
+
(T(!0), $(D, null, P(K(r), (l) => (T(), Y(q(e.itemTag), ne({
|
|
705
711
|
key: l.key,
|
|
706
712
|
ref_for: !0,
|
|
707
|
-
ref:
|
|
713
|
+
ref: f(l.index),
|
|
708
714
|
role: "listitem",
|
|
709
715
|
"data-index": l.index,
|
|
710
716
|
"data-key": String(l.key),
|
|
711
717
|
"aria-setsize": e.items.length,
|
|
712
718
|
"aria-posinset": l.index + 1,
|
|
713
|
-
style:
|
|
719
|
+
style: k(l.start - K(u), l.size)
|
|
714
720
|
}, { ref_for: !0 }, e.itemAttrs), {
|
|
715
|
-
default:
|
|
716
|
-
|
|
721
|
+
default: U(() => [
|
|
722
|
+
G(d.$slots, "default", {
|
|
717
723
|
item: l.item,
|
|
718
724
|
index: l.index,
|
|
719
725
|
start: l.start,
|
|
@@ -723,12 +729,12 @@ const Xe = /* @__PURE__ */ ie({
|
|
|
723
729
|
]),
|
|
724
730
|
_: 2
|
|
725
731
|
}, 1040, ["data-index", "data-key", "aria-setsize", "aria-posinset", "style"]))), 128))
|
|
726
|
-
], 4)) :
|
|
732
|
+
], 4)) : G(d.$slots, "empty", {}, void 0, void 0, 0)
|
|
727
733
|
]),
|
|
728
734
|
_: 3
|
|
729
735
|
}, 8, ["style"]));
|
|
730
736
|
}
|
|
731
|
-
}),
|
|
737
|
+
}), De = ["data-index", "data-key"], qe = /* @__PURE__ */ ie({
|
|
732
738
|
__name: "VirtualGrid",
|
|
733
739
|
props: {
|
|
734
740
|
items: {},
|
|
@@ -751,14 +757,14 @@ const Xe = /* @__PURE__ */ ie({
|
|
|
751
757
|
const i = e, n = L(null), {
|
|
752
758
|
virtualCells: r,
|
|
753
759
|
totalWidth: s,
|
|
754
|
-
totalHeight:
|
|
760
|
+
totalHeight: u,
|
|
755
761
|
scrollAdjustX: p,
|
|
756
|
-
scrollAdjustY:
|
|
762
|
+
scrollAdjustY: x,
|
|
757
763
|
scrollToIndex: I,
|
|
758
|
-
scrollToOffset:
|
|
764
|
+
scrollToOffset: w,
|
|
759
765
|
measureRow: b,
|
|
760
766
|
measureRowElement: E
|
|
761
|
-
} =
|
|
767
|
+
} = Be({
|
|
762
768
|
items: () => i.items,
|
|
763
769
|
columnCount: () => i.columnCount,
|
|
764
770
|
estimateRowSize: () => i.estimateRowSize,
|
|
@@ -769,64 +775,68 @@ const Xe = /* @__PURE__ */ ie({
|
|
|
769
775
|
overscanColumns: () => i.overscanColumns,
|
|
770
776
|
rowGap: () => i.rowGap,
|
|
771
777
|
columnGap: () => i.columnGap,
|
|
772
|
-
getItemKey: (l,
|
|
778
|
+
getItemKey: (l, z) => i.getItemKey?.(l, z) ?? z,
|
|
773
779
|
initialRect: () => ({
|
|
774
|
-
width:
|
|
775
|
-
height:
|
|
780
|
+
width: W(i.width),
|
|
781
|
+
height: W(i.height)
|
|
776
782
|
}),
|
|
777
783
|
revision: () => i.revision
|
|
778
|
-
}),
|
|
784
|
+
}), k = R(
|
|
779
785
|
() => re({
|
|
780
786
|
height: i.height,
|
|
781
787
|
width: i.width,
|
|
782
788
|
horizontal: !1
|
|
783
789
|
})
|
|
784
|
-
),
|
|
790
|
+
), f = R(() => ({
|
|
785
791
|
position: "relative",
|
|
786
|
-
width: `${
|
|
787
|
-
height: `${
|
|
792
|
+
width: `${N(s.value)}px`,
|
|
793
|
+
height: `${N(u.value)}px`
|
|
788
794
|
}));
|
|
789
|
-
function
|
|
790
|
-
return (
|
|
791
|
-
E(
|
|
795
|
+
function d(l) {
|
|
796
|
+
return (z) => {
|
|
797
|
+
E(z, l);
|
|
792
798
|
};
|
|
793
799
|
}
|
|
794
|
-
function h(l,
|
|
800
|
+
function h(l, z, m, j) {
|
|
795
801
|
return {
|
|
796
802
|
position: "absolute",
|
|
797
803
|
top: 0,
|
|
798
804
|
left: 0,
|
|
799
|
-
width: `${
|
|
800
|
-
|
|
805
|
+
width: `${z}px`,
|
|
806
|
+
height: `${j}px`,
|
|
807
|
+
transform: `translate(${l}px, ${m}px)`,
|
|
808
|
+
contain: "layout style",
|
|
809
|
+
boxSizing: "border-box",
|
|
810
|
+
overflow: "hidden"
|
|
801
811
|
};
|
|
802
812
|
}
|
|
803
813
|
return t({
|
|
804
814
|
scrollToIndex: I,
|
|
805
|
-
scrollToOffset:
|
|
815
|
+
scrollToOffset: w,
|
|
806
816
|
measureRow: b
|
|
807
|
-
}), (l,
|
|
817
|
+
}), (l, z) => (T(), Y(q(e.tag), {
|
|
808
818
|
ref_key: "container",
|
|
809
819
|
ref: n,
|
|
810
820
|
"data-virtual-container": "",
|
|
811
821
|
role: "grid",
|
|
812
|
-
style: F(
|
|
822
|
+
style: F(k.value)
|
|
813
823
|
}, {
|
|
814
|
-
default:
|
|
815
|
-
e.items.length ? (T(),
|
|
824
|
+
default: U(() => [
|
|
825
|
+
e.items.length ? (T(), $("div", {
|
|
816
826
|
key: 1,
|
|
817
827
|
"data-virtual-spacer": "",
|
|
818
|
-
style: F(
|
|
828
|
+
style: F(f.value)
|
|
819
829
|
}, [
|
|
820
|
-
(T(!0),
|
|
830
|
+
(T(!0), $(D, null, P(K(r), (m) => (T(), $("div", ne({
|
|
821
831
|
key: m.key,
|
|
822
832
|
ref_for: !0,
|
|
823
|
-
ref:
|
|
833
|
+
ref: d(m.row.index),
|
|
824
834
|
role: "gridcell",
|
|
825
835
|
"data-index": m.index,
|
|
826
836
|
"data-key": String(m.key),
|
|
827
|
-
style: h(m.column.start - K(p), m.column.size, m.row.start - K(
|
|
837
|
+
style: h(m.column.start - K(p), m.column.size, m.row.start - K(x), m.row.size)
|
|
828
838
|
}, { ref_for: !0 }, e.itemAttrs), [
|
|
829
|
-
|
|
839
|
+
G(l.$slots, "default", {
|
|
830
840
|
item: m.item,
|
|
831
841
|
index: m.index,
|
|
832
842
|
rowIndex: m.row.index,
|
|
@@ -834,13 +844,13 @@ const Xe = /* @__PURE__ */ ie({
|
|
|
834
844
|
row: m.row,
|
|
835
845
|
column: m.column
|
|
836
846
|
})
|
|
837
|
-
], 16,
|
|
838
|
-
], 4)) :
|
|
847
|
+
], 16, De))), 128))
|
|
848
|
+
], 4)) : G(l.$slots, "empty", {}, void 0, void 0, 0)
|
|
839
849
|
]),
|
|
840
850
|
_: 3
|
|
841
851
|
}, 8, ["style"]));
|
|
842
852
|
}
|
|
843
|
-
}),
|
|
853
|
+
}), Pe = ["data-index", "data-key", "aria-rowindex"], Ue = /* @__PURE__ */ ie({
|
|
844
854
|
__name: "VirtualTable",
|
|
845
855
|
props: {
|
|
846
856
|
rows: {},
|
|
@@ -848,7 +858,7 @@ const Xe = /* @__PURE__ */ ie({
|
|
|
848
858
|
estimateRowSize: { type: [Number, Function], default: 44 },
|
|
849
859
|
height: {},
|
|
850
860
|
width: {},
|
|
851
|
-
overscan: { default:
|
|
861
|
+
overscan: { default: 8 },
|
|
852
862
|
getRowKey: {},
|
|
853
863
|
stickyHeader: { type: Boolean, default: !0 },
|
|
854
864
|
tag: { default: "div" },
|
|
@@ -857,58 +867,58 @@ const Xe = /* @__PURE__ */ ie({
|
|
|
857
867
|
},
|
|
858
868
|
setup(e, { expose: t }) {
|
|
859
869
|
const i = e, n = L(null), r = L(null), s = L(0), {
|
|
860
|
-
virtualRows:
|
|
870
|
+
virtualRows: u,
|
|
861
871
|
columns: p,
|
|
862
|
-
totalWidth:
|
|
872
|
+
totalWidth: x,
|
|
863
873
|
totalHeight: I,
|
|
864
|
-
scrollAdjust:
|
|
874
|
+
scrollAdjust: w,
|
|
865
875
|
scrollToIndex: b,
|
|
866
876
|
scrollToOffset: E,
|
|
867
|
-
measure:
|
|
868
|
-
measureElement:
|
|
869
|
-
} =
|
|
877
|
+
measure: k,
|
|
878
|
+
measureElement: f
|
|
879
|
+
} = He({
|
|
870
880
|
rows: () => i.rows,
|
|
871
881
|
columns: () => i.columns,
|
|
872
|
-
estimateRowSize: (v,
|
|
873
|
-
const
|
|
874
|
-
return typeof
|
|
882
|
+
estimateRowSize: (v, y) => {
|
|
883
|
+
const S = i.estimateRowSize;
|
|
884
|
+
return typeof S == "number" ? S : S(v, y);
|
|
875
885
|
},
|
|
876
886
|
container: n,
|
|
877
887
|
overscan: () => i.overscan,
|
|
878
|
-
getRowKey: (v,
|
|
888
|
+
getRowKey: (v, y) => i.getRowKey?.(v, y) ?? y,
|
|
879
889
|
initialRect: () => ({
|
|
880
|
-
width:
|
|
881
|
-
height:
|
|
890
|
+
width: W(i.width),
|
|
891
|
+
height: W(i.height)
|
|
882
892
|
}),
|
|
883
893
|
viewportInset: s,
|
|
884
894
|
revision: () => i.revision,
|
|
885
895
|
itemSize: () => typeof i.estimateRowSize == "number" ? i.estimateRowSize : void 0
|
|
886
896
|
});
|
|
887
|
-
|
|
888
|
-
if (
|
|
889
|
-
const
|
|
897
|
+
ge(r, (v, y, S) => {
|
|
898
|
+
if (y === v && !v || !v || !Z() || typeof ResizeObserver > "u") return;
|
|
899
|
+
const V = () => {
|
|
890
900
|
s.value = v.getBoundingClientRect().height;
|
|
891
|
-
},
|
|
892
|
-
|
|
901
|
+
}, B = new ResizeObserver(V);
|
|
902
|
+
B.observe(v), V(), S(() => B.disconnect());
|
|
893
903
|
});
|
|
894
|
-
const
|
|
904
|
+
const d = R(
|
|
895
905
|
() => re({
|
|
896
906
|
height: i.height,
|
|
897
907
|
width: i.width,
|
|
898
908
|
horizontal: !1
|
|
899
909
|
})
|
|
900
|
-
), h =
|
|
901
|
-
minWidth: `${
|
|
902
|
-
})), l =
|
|
910
|
+
), h = R(() => ({
|
|
911
|
+
minWidth: `${x.value}px`
|
|
912
|
+
})), l = R(() => ({
|
|
903
913
|
position: i.stickyHeader ? "sticky" : "relative",
|
|
904
914
|
top: i.stickyHeader ? "0px" : void 0,
|
|
905
915
|
zIndex: 1,
|
|
906
916
|
display: "flex",
|
|
907
|
-
width: `${
|
|
908
|
-
})),
|
|
917
|
+
width: `${x.value}px`
|
|
918
|
+
})), z = R(() => ({
|
|
909
919
|
position: "relative",
|
|
910
|
-
height: `${
|
|
911
|
-
width: `${
|
|
920
|
+
height: `${N(I.value)}px`,
|
|
921
|
+
width: `${N(x.value)}px`
|
|
912
922
|
}));
|
|
913
923
|
function m(v) {
|
|
914
924
|
return {
|
|
@@ -918,85 +928,89 @@ const Xe = /* @__PURE__ */ ie({
|
|
|
918
928
|
textAlign: v.align ?? "left"
|
|
919
929
|
};
|
|
920
930
|
}
|
|
921
|
-
function
|
|
931
|
+
function j(v, y) {
|
|
922
932
|
return {
|
|
923
933
|
position: "absolute",
|
|
924
934
|
top: 0,
|
|
925
935
|
left: 0,
|
|
926
936
|
width: "100%",
|
|
937
|
+
height: `${y}px`,
|
|
927
938
|
display: "flex",
|
|
928
|
-
transform: `translateY(${v}px)
|
|
939
|
+
transform: `translateY(${v}px)`,
|
|
940
|
+
contain: "layout style",
|
|
941
|
+
boxSizing: "border-box",
|
|
942
|
+
overflow: "hidden"
|
|
929
943
|
};
|
|
930
944
|
}
|
|
931
945
|
function X(v) {
|
|
932
|
-
return (
|
|
933
|
-
|
|
946
|
+
return (y) => {
|
|
947
|
+
f(y, v);
|
|
934
948
|
};
|
|
935
949
|
}
|
|
936
|
-
function
|
|
937
|
-
return
|
|
950
|
+
function _(v, y, S) {
|
|
951
|
+
return y.accessor ? y.accessor(v, S) : v && typeof v == "object" && y.id in v ? v[y.id] : "";
|
|
938
952
|
}
|
|
939
953
|
return t({
|
|
940
954
|
scrollToIndex: b,
|
|
941
955
|
scrollToOffset: E,
|
|
942
|
-
measure:
|
|
943
|
-
}), (v,
|
|
956
|
+
measure: k
|
|
957
|
+
}), (v, y) => (T(), Y(q(e.tag), {
|
|
944
958
|
ref_key: "container",
|
|
945
959
|
ref: n,
|
|
946
960
|
"data-virtual-container": "",
|
|
947
961
|
role: "table",
|
|
948
|
-
style: F(
|
|
962
|
+
style: F(d.value)
|
|
949
963
|
}, {
|
|
950
|
-
default:
|
|
951
|
-
|
|
964
|
+
default: U(() => [
|
|
965
|
+
ue("div", {
|
|
952
966
|
style: F(h.value)
|
|
953
967
|
}, [
|
|
954
|
-
|
|
968
|
+
ue("div", {
|
|
955
969
|
ref_key: "header",
|
|
956
970
|
ref: r,
|
|
957
971
|
role: "row",
|
|
958
972
|
style: F(l.value)
|
|
959
973
|
}, [
|
|
960
|
-
|
|
961
|
-
(T(!0),
|
|
962
|
-
key:
|
|
974
|
+
G(v.$slots, "header", { columns: K(p) }, () => [
|
|
975
|
+
(T(!0), $(D, null, P(K(p), (S) => (T(), $("div", {
|
|
976
|
+
key: S.id,
|
|
963
977
|
role: "columnheader",
|
|
964
|
-
style: F(m(
|
|
965
|
-
},
|
|
978
|
+
style: F(m(S))
|
|
979
|
+
}, ce(S.header), 5))), 128))
|
|
966
980
|
])
|
|
967
981
|
], 4),
|
|
968
|
-
e.rows.length ? (T(),
|
|
982
|
+
e.rows.length ? (T(), $("div", {
|
|
969
983
|
key: 1,
|
|
970
984
|
"data-virtual-spacer": "",
|
|
971
985
|
role: "rowgroup",
|
|
972
|
-
style: F(
|
|
986
|
+
style: F(z.value)
|
|
973
987
|
}, [
|
|
974
|
-
(T(!0),
|
|
975
|
-
key:
|
|
988
|
+
(T(!0), $(D, null, P(K(u), (S) => (T(), $("div", ne({
|
|
989
|
+
key: S.key,
|
|
976
990
|
ref_for: !0,
|
|
977
|
-
ref: X(
|
|
991
|
+
ref: X(S.index),
|
|
978
992
|
role: "row",
|
|
979
|
-
"data-index":
|
|
980
|
-
"data-key": String(
|
|
981
|
-
"aria-rowindex":
|
|
982
|
-
style:
|
|
993
|
+
"data-index": S.index,
|
|
994
|
+
"data-key": String(S.key),
|
|
995
|
+
"aria-rowindex": S.index + 1,
|
|
996
|
+
style: j(S.start - K(w), S.size)
|
|
983
997
|
}, { ref_for: !0 }, e.rowAttrs), [
|
|
984
|
-
(T(!0),
|
|
985
|
-
key:
|
|
998
|
+
(T(!0), $(D, null, P(K(p), (V) => (T(), $("div", {
|
|
999
|
+
key: V.id,
|
|
986
1000
|
role: "cell",
|
|
987
|
-
style: F(m(
|
|
1001
|
+
style: F(m(V))
|
|
988
1002
|
}, [
|
|
989
|
-
|
|
990
|
-
row:
|
|
991
|
-
column:
|
|
992
|
-
rowIndex:
|
|
993
|
-
value:
|
|
1003
|
+
G(v.$slots, "cell", {
|
|
1004
|
+
row: S.item,
|
|
1005
|
+
column: V,
|
|
1006
|
+
rowIndex: S.index,
|
|
1007
|
+
value: _(S.item, V, S.index)
|
|
994
1008
|
}, () => [
|
|
995
|
-
|
|
1009
|
+
Oe(ce(_(S.item, V, S.index)), 1)
|
|
996
1010
|
])
|
|
997
1011
|
], 4))), 128))
|
|
998
|
-
], 16,
|
|
999
|
-
], 4)) :
|
|
1012
|
+
], 16, Pe))), 128))
|
|
1013
|
+
], 4)) : G(v.$slots, "empty", {}, void 0, void 0, 0)
|
|
1000
1014
|
], 4)
|
|
1001
1015
|
]),
|
|
1002
1016
|
_: 3
|
|
@@ -1004,20 +1018,20 @@ const Xe = /* @__PURE__ */ ie({
|
|
|
1004
1018
|
}
|
|
1005
1019
|
});
|
|
1006
1020
|
export {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1021
|
+
Re as MeasurementCache,
|
|
1022
|
+
qe as VirtualGrid,
|
|
1023
|
+
Ye as VirtualList,
|
|
1024
|
+
Ue as VirtualTable,
|
|
1025
|
+
Ae as Virtualizer,
|
|
1026
|
+
H as clampScrollOffset,
|
|
1027
|
+
Ee as mapDomOffsetToVirtual,
|
|
1014
1028
|
ke as mapVirtualOffsetToDom,
|
|
1015
1029
|
ee as normalizeSize,
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1030
|
+
Ve as resolveScrollOffset,
|
|
1031
|
+
N as scrollContentSize,
|
|
1032
|
+
Be as useVirtualGrid,
|
|
1033
|
+
ye as useVirtualList,
|
|
1034
|
+
He as useVirtualTable,
|
|
1021
1035
|
te as useVirtualizer
|
|
1022
1036
|
};
|
|
1023
1037
|
//# sourceMappingURL=index.mjs.map
|