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