@pdanpdan/virtual-scroll 0.6.0 → 0.7.0
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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +49 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +615 -559
- package/dist/index.mjs.map +1 -1
- package/dist/virtual-scroll.css +1 -1
- package/package.json +2 -4
- package/src/components/VirtualScroll.vue +133 -0
- package/src/composables/useVirtualScrollbar.ts +3 -0
- package/src/types.ts +37 -0
- package/src/components/VirtualScroll.test.ts +0 -2368
- package/src/components/VirtualScrollbar.test.ts +0 -174
- package/src/composables/useVirtualScroll.test.ts +0 -1627
- package/src/composables/useVirtualScrollbar.test.ts +0 -526
- package/src/utils/fenwick-tree.test.ts +0 -134
- package/src/utils/scroll.test.ts +0 -228
- package/src/utils/virtual-scroll-logic.test.ts +0 -2867
package/dist/index.mjs
CHANGED
|
@@ -231,14 +231,14 @@ function displayToVirtual(e, t, n) {
|
|
|
231
231
|
function virtualToDisplay(e, t, n) {
|
|
232
232
|
return e / n + t;
|
|
233
233
|
}
|
|
234
|
-
function calculateScrollTarget({ rowIndex: e, colIndex: t, options: n, direction: r, viewportWidth: i, viewportHeight: a, totalWidth: o, totalHeight: s, gap: c, columnGap: l, fixedSize: u, fixedWidth: d, relativeScrollX: f, relativeScrollY: p, getItemSizeY: m, getItemSizeX: h, getItemQueryY: g, getItemQueryX: _, getColumnSize: v, getColumnQuery: y, scaleX: b, scaleY: x, hostOffsetX: S, hostOffsetY: C, stickyIndices: w, stickyStartX: T = 0, stickyStartY:
|
|
235
|
-
let
|
|
236
|
-
|
|
237
|
-
let
|
|
234
|
+
function calculateScrollTarget({ rowIndex: e, colIndex: t, options: n, direction: r, viewportWidth: i, viewportHeight: a, totalWidth: o, totalHeight: s, gap: c, columnGap: l, fixedSize: u, fixedWidth: d, relativeScrollX: f, relativeScrollY: p, getItemSizeY: m, getItemSizeX: h, getItemQueryY: g, getItemQueryX: _, getColumnSize: v, getColumnQuery: y, scaleX: b, scaleY: x, hostOffsetX: S, hostOffsetY: C, stickyIndices: w, stickyStartX: T = 0, stickyStartY: ee = 0, stickyEndX: E = 0, stickyEndY: te = 0, flowPaddingStartX: D = 0, flowPaddingStartY: O = 0, paddingStartX: k = 0, paddingStartY: A = 0, paddingEndX: j = 0, paddingEndY: M = 0 }) {
|
|
235
|
+
let N;
|
|
236
|
+
N = isScrollToIndexOptions(n) ? n.align : n;
|
|
237
|
+
let P = (N && typeof N == "object" ? N.x : N) || "auto", re = (N && typeof N == "object" ? N.y : N) || "auto", ie = f, ae = p, oe = 0, se = 0, ce = "auto", le = "auto", I = b === 1 ? o : BROWSER_MAX_SIZE, ue = x === 1 ? s : BROWSER_MAX_SIZE, L = Math.max(0, S + I - i), R = Math.max(0, C + ue - a), z = (L - S) * b, B = (R - C) * x, fe = D + T + k, pe = O + ee + A;
|
|
238
238
|
if (e != null) {
|
|
239
239
|
let t = calculateAxisTarget({
|
|
240
240
|
index: e,
|
|
241
|
-
align:
|
|
241
|
+
align: re,
|
|
242
242
|
viewSize: a,
|
|
243
243
|
scrollPos: p,
|
|
244
244
|
fixedSize: u,
|
|
@@ -246,15 +246,15 @@ function calculateScrollTarget({ rowIndex: e, colIndex: t, options: n, direction
|
|
|
246
246
|
query: g,
|
|
247
247
|
getSize: m,
|
|
248
248
|
stickyIndices: w,
|
|
249
|
-
stickyStart:
|
|
250
|
-
stickyEnd:
|
|
249
|
+
stickyStart: ee + A,
|
|
250
|
+
stickyEnd: te + M
|
|
251
251
|
});
|
|
252
|
-
|
|
252
|
+
ae = t.target + pe, se = t.itemSize, le = t.effectiveAlign;
|
|
253
253
|
}
|
|
254
254
|
if (t != null) {
|
|
255
255
|
let e = r === "both", n = calculateAxisTarget({
|
|
256
256
|
index: t,
|
|
257
|
-
align:
|
|
257
|
+
align: P,
|
|
258
258
|
viewSize: i,
|
|
259
259
|
scrollPos: f,
|
|
260
260
|
fixedSize: e ? d : u,
|
|
@@ -262,18 +262,18 @@ function calculateScrollTarget({ rowIndex: e, colIndex: t, options: n, direction
|
|
|
262
262
|
query: e ? y : _,
|
|
263
263
|
getSize: e ? v : h,
|
|
264
264
|
stickyIndices: w,
|
|
265
|
-
stickyStart: T +
|
|
266
|
-
stickyEnd:
|
|
265
|
+
stickyStart: T + k,
|
|
266
|
+
stickyEnd: E + j
|
|
267
267
|
});
|
|
268
|
-
|
|
268
|
+
ie = n.target + fe, oe = n.itemSize, ce = n.effectiveAlign;
|
|
269
269
|
}
|
|
270
|
-
return
|
|
271
|
-
targetX:
|
|
272
|
-
targetY:
|
|
273
|
-
itemWidth:
|
|
274
|
-
itemHeight:
|
|
275
|
-
effectiveAlignX:
|
|
276
|
-
effectiveAlignY:
|
|
270
|
+
return ie = Math.max(0, Math.min(ie, z)), ae = Math.max(0, Math.min(ae, B)), {
|
|
271
|
+
targetX: ie,
|
|
272
|
+
targetY: ae,
|
|
273
|
+
itemWidth: oe,
|
|
274
|
+
itemHeight: se,
|
|
275
|
+
effectiveAlignX: ce,
|
|
276
|
+
effectiveAlignY: le
|
|
277
277
|
};
|
|
278
278
|
}
|
|
279
279
|
function calculateRange({ direction: e, relativeScrollX: t, relativeScrollY: n, usableWidth: r, usableHeight: i, itemsLength: a, bufferBefore: o, bufferAfter: s, gap: c, columnGap: l, fixedSize: u, findLowerBoundY: d, findLowerBoundX: f, queryY: p, queryX: m }) {
|
|
@@ -372,87 +372,87 @@ function useVirtualScroll(e) {
|
|
|
372
372
|
}), y = reactive({
|
|
373
373
|
x: 0,
|
|
374
374
|
y: 0
|
|
375
|
-
}), b, x = ref(!1), S = ref(0), C = ref(0), T = null,
|
|
375
|
+
}), b, x = ref(!1), S = ref(0), C = ref(0), T = null, ee = () => {
|
|
376
376
|
if (typeof window > "u") return;
|
|
377
377
|
let e = n.value.container || n.value.hostRef || window, t = isElement(e) ? e : document.documentElement;
|
|
378
378
|
(!T || !("direction" in T)) && (T = window.getComputedStyle(t));
|
|
379
379
|
let r = T.direction === "rtl";
|
|
380
380
|
d.value !== r && (d.value = r);
|
|
381
|
-
},
|
|
381
|
+
}, E = new FenwickTree(n.value.items?.length || 0), D = new FenwickTree(n.value.items?.length || 0), O = new FenwickTree(n.value.columnCount || 0), k = ref(0), A = new Uint8Array(), j = new Uint8Array(), N = new Uint8Array(), P = ref(null), le = ref(!1), I = [], L = computed(() => [
|
|
382
382
|
"vertical",
|
|
383
383
|
"horizontal",
|
|
384
384
|
"both"
|
|
385
|
-
].includes(n.value.direction) ? n.value.direction : "vertical"),
|
|
386
|
-
if (
|
|
385
|
+
].includes(n.value.direction) ? n.value.direction : "vertical"), R = computed(() => n.value.itemSize === void 0 || n.value.itemSize === null || n.value.itemSize === 0), de = computed(() => n.value.columnWidth === void 0 || n.value.columnWidth === null || n.value.columnWidth === 0), z = computed(() => typeof n.value.itemSize == "number" && n.value.itemSize > 0 ? n.value.itemSize : null), B = computed(() => typeof n.value.columnWidth == "number" && n.value.columnWidth > 0 ? n.value.columnWidth : null), ve = computed(() => n.value.defaultItemSize || z.value || 40), be = computed(() => [...n.value.stickyIndices || []].sort((e, t) => e - t)), xe = computed(() => new Set(be.value)), Se = computed(() => getPaddingX(n.value.scrollPaddingStart, n.value.direction)), Ce = computed(() => getPaddingX(n.value.scrollPaddingEnd, n.value.direction)), we = computed(() => getPaddingY(n.value.scrollPaddingStart, n.value.direction)), Te = computed(() => getPaddingY(n.value.scrollPaddingEnd, n.value.direction)), H = computed(() => getPaddingX(n.value.stickyStart, n.value.direction)), Ee = computed(() => getPaddingX(n.value.stickyEnd, n.value.direction)), U = computed(() => getPaddingY(n.value.stickyStart, n.value.direction)), De = computed(() => getPaddingY(n.value.stickyEnd, n.value.direction)), W = computed(() => getPaddingX(n.value.flowPaddingStart, n.value.direction)), G = computed(() => getPaddingX(n.value.flowPaddingEnd, n.value.direction)), K = computed(() => getPaddingY(n.value.flowPaddingStart, n.value.direction)), Oe = computed(() => getPaddingY(n.value.flowPaddingEnd, n.value.direction)), ke = computed(() => f.value - (L.value === "vertical" ? 0 : H.value + Ee.value)), Ae = computed(() => p.value - (L.value === "horizontal" ? 0 : U.value + De.value)), je = computed(() => {
|
|
386
|
+
if (k.value, !o.value && n.value.ssrRange && !l.value) {
|
|
387
387
|
let { start: e = 0, end: t = 0, colStart: r = 0, colEnd: i = 0 } = n.value.ssrRange, a = n.value.columnCount || 0, o = n.value.gap || 0, s = n.value.columnGap || 0, c = 0, l = 0;
|
|
388
|
-
if (
|
|
388
|
+
if (L.value === "both") {
|
|
389
389
|
if (a > 0) {
|
|
390
|
-
let e = i || a, t =
|
|
390
|
+
let e = i || a, t = O.query(e) - O.query(r);
|
|
391
391
|
c = Math.max(0, t - (e > r ? s : 0));
|
|
392
392
|
}
|
|
393
|
-
if (
|
|
393
|
+
if (z.value !== null) {
|
|
394
394
|
let n = t - e;
|
|
395
|
-
l = Math.max(0, n * (
|
|
395
|
+
l = Math.max(0, n * (z.value + o) - (n > 0 ? o : 0));
|
|
396
396
|
} else {
|
|
397
|
-
let n =
|
|
397
|
+
let n = D.query(t) - D.query(e);
|
|
398
398
|
l = Math.max(0, n - (t > e ? o : 0));
|
|
399
399
|
}
|
|
400
|
-
} else if (
|
|
401
|
-
if (
|
|
400
|
+
} else if (L.value === "horizontal") {
|
|
401
|
+
if (z.value !== null) {
|
|
402
402
|
let n = t - e;
|
|
403
|
-
c = Math.max(0, n * (
|
|
403
|
+
c = Math.max(0, n * (z.value + s) - (n > 0 ? s : 0));
|
|
404
404
|
} else {
|
|
405
|
-
let n =
|
|
405
|
+
let n = E.query(t) - E.query(e);
|
|
406
406
|
c = Math.max(0, n - (t > e ? s : 0));
|
|
407
407
|
}
|
|
408
|
-
l =
|
|
409
|
-
} else if (c =
|
|
408
|
+
l = Ae.value;
|
|
409
|
+
} else if (c = ke.value, z.value !== null) {
|
|
410
410
|
let n = t - e;
|
|
411
|
-
l = Math.max(0, n * (
|
|
411
|
+
l = Math.max(0, n * (z.value + o) - (n > 0 ? o : 0));
|
|
412
412
|
} else {
|
|
413
|
-
let n =
|
|
413
|
+
let n = D.query(t) - D.query(e);
|
|
414
414
|
l = Math.max(0, n - (t > e ? o : 0));
|
|
415
415
|
}
|
|
416
416
|
return {
|
|
417
|
-
width: Math.max(c,
|
|
418
|
-
height: Math.max(l,
|
|
417
|
+
width: Math.max(c, ke.value),
|
|
418
|
+
height: Math.max(l, Ae.value)
|
|
419
419
|
};
|
|
420
420
|
}
|
|
421
421
|
return calculateTotalSize({
|
|
422
|
-
direction:
|
|
422
|
+
direction: L.value,
|
|
423
423
|
itemsLength: n.value.items.length,
|
|
424
424
|
columnCount: n.value.columnCount || 0,
|
|
425
|
-
fixedSize:
|
|
426
|
-
fixedWidth:
|
|
425
|
+
fixedSize: z.value,
|
|
426
|
+
fixedWidth: B.value,
|
|
427
427
|
gap: n.value.gap || 0,
|
|
428
428
|
columnGap: n.value.columnGap || 0,
|
|
429
|
-
usableWidth:
|
|
430
|
-
usableHeight:
|
|
431
|
-
queryY: (e) =>
|
|
432
|
-
queryX: (e) =>
|
|
433
|
-
queryColumn: (e) =>
|
|
429
|
+
usableWidth: ke.value,
|
|
430
|
+
usableHeight: Ae.value,
|
|
431
|
+
queryY: (e) => D.query(e),
|
|
432
|
+
queryX: (e) => E.query(e),
|
|
433
|
+
queryColumn: (e) => O.query(e)
|
|
434
434
|
});
|
|
435
|
-
}),
|
|
436
|
-
x: computed(() => Math.max(0, g.x - (
|
|
437
|
-
y: computed(() => Math.max(0, g.y - (
|
|
438
|
-
}),
|
|
439
|
-
if (
|
|
440
|
-
let e =
|
|
435
|
+
}), Me = computed(() => isWindowLike(n.value.container)), Ne = computed(() => je.value.width + Se.value + Ce.value), Pe = computed(() => je.value.height + we.value + Te.value), q = computed(() => W.value + H.value + Ee.value + G.value + Ne.value), J = computed(() => K.value + U.value + De.value + Oe.value + Pe.value), Y = reactive({
|
|
436
|
+
x: computed(() => Math.max(0, g.x - (W.value + H.value))),
|
|
437
|
+
y: computed(() => Math.max(0, g.y - (K.value + U.value)))
|
|
438
|
+
}), Fe = computed(() => Me.value ? q.value : Math.min(q.value, BROWSER_MAX_SIZE)), Ie = computed(() => Me.value ? J.value : Math.min(J.value, BROWSER_MAX_SIZE)), Le = computed(() => Me.value ? Ne.value : Math.max(0, Fe.value - (W.value + H.value + Ee.value + G.value))), Re = computed(() => Me.value ? Pe.value : Math.max(0, Ie.value - (K.value + U.value + De.value + Oe.value))), X = computed(() => {
|
|
439
|
+
if (Me.value || q.value <= 1e7) return 1;
|
|
440
|
+
let e = q.value - f.value, t = Fe.value - f.value;
|
|
441
441
|
return t > 0 ? e / t : 1;
|
|
442
|
-
}),
|
|
443
|
-
if (
|
|
444
|
-
let e =
|
|
442
|
+
}), Z = computed(() => {
|
|
443
|
+
if (Me.value || J.value <= 1e7) return 1;
|
|
444
|
+
let e = J.value - p.value, t = Ie.value - p.value;
|
|
445
445
|
return t > 0 ? e / t : 1;
|
|
446
|
-
}), Re = computed(() => {
|
|
447
|
-
if (R.value === "vertical") return 0;
|
|
448
|
-
let e = G.value + U.value + xe.value;
|
|
449
|
-
return S.value - e;
|
|
450
446
|
}), ze = computed(() => {
|
|
451
|
-
if (
|
|
452
|
-
let e =
|
|
447
|
+
if (L.value === "vertical") return 0;
|
|
448
|
+
let e = W.value + H.value + Se.value;
|
|
449
|
+
return S.value - e;
|
|
450
|
+
}), Be = computed(() => {
|
|
451
|
+
if (L.value === "horizontal") return 0;
|
|
452
|
+
let e = K.value + U.value + we.value;
|
|
453
453
|
return C.value - e;
|
|
454
|
-
}),
|
|
455
|
-
|
|
454
|
+
}), Ve = (e) => {
|
|
455
|
+
k.value;
|
|
456
456
|
let t = n.value.columnGap || 0, r = n.value.columnWidth;
|
|
457
457
|
if (typeof r == "number" && r > 0) return r;
|
|
458
458
|
if (Array.isArray(r) && r.length > 0) {
|
|
@@ -460,60 +460,60 @@ function useVirtualScroll(e) {
|
|
|
460
460
|
return t != null && t > 0 ? t : n.value.defaultColumnWidth || 100;
|
|
461
461
|
}
|
|
462
462
|
if (typeof r == "function") return r(e);
|
|
463
|
-
let i =
|
|
463
|
+
let i = O.get(e);
|
|
464
464
|
return i > 0 ? i - t : n.value.defaultColumnWidth || 100;
|
|
465
|
-
},
|
|
466
|
-
if (
|
|
465
|
+
}, He = (e) => {
|
|
466
|
+
if (k.value, L.value === "horizontal") return Ae.value;
|
|
467
467
|
let t = n.value.gap || 0, r = n.value.itemSize;
|
|
468
468
|
if (typeof r == "number" && r > 0) return r;
|
|
469
469
|
if (typeof r == "function") {
|
|
470
470
|
let t = n.value.items[e];
|
|
471
471
|
return t === void 0 ? n.value.defaultItemSize || 40 : r(t, e);
|
|
472
472
|
}
|
|
473
|
-
let i =
|
|
473
|
+
let i = D.get(e);
|
|
474
474
|
return i > 0 ? i - t : n.value.defaultItemSize || 40;
|
|
475
475
|
};
|
|
476
|
-
function
|
|
476
|
+
function Ue(e, t, a) {
|
|
477
477
|
let o = typeof a == "object" && a && "isCorrection" in a ? a.isCorrection : !1, s = n.value.container || window, { targetX: c, targetY: l, effectiveAlignX: u, effectiveAlignY: m } = calculateScrollTarget({
|
|
478
478
|
rowIndex: e,
|
|
479
479
|
colIndex: t,
|
|
480
480
|
options: a,
|
|
481
|
-
direction:
|
|
481
|
+
direction: L.value,
|
|
482
482
|
viewportWidth: f.value,
|
|
483
483
|
viewportHeight: p.value,
|
|
484
|
-
totalWidth:
|
|
485
|
-
totalHeight:
|
|
484
|
+
totalWidth: q.value,
|
|
485
|
+
totalHeight: J.value,
|
|
486
486
|
gap: n.value.gap || 0,
|
|
487
487
|
columnGap: n.value.columnGap || 0,
|
|
488
|
-
fixedSize:
|
|
489
|
-
fixedWidth:
|
|
490
|
-
relativeScrollX:
|
|
491
|
-
relativeScrollY:
|
|
492
|
-
getItemSizeY: (e) =>
|
|
493
|
-
getItemSizeX: (e) =>
|
|
494
|
-
getItemQueryY: (e) =>
|
|
495
|
-
getItemQueryX: (e) =>
|
|
496
|
-
getColumnSize: (e) =>
|
|
497
|
-
getColumnQuery: (e) =>
|
|
498
|
-
scaleX:
|
|
499
|
-
scaleY:
|
|
500
|
-
hostOffsetX:
|
|
501
|
-
hostOffsetY:
|
|
502
|
-
stickyIndices:
|
|
503
|
-
stickyStartX:
|
|
504
|
-
stickyStartY:
|
|
505
|
-
stickyEndX:
|
|
506
|
-
stickyEndY:
|
|
507
|
-
flowPaddingStartX:
|
|
508
|
-
flowPaddingStartY:
|
|
509
|
-
paddingStartX:
|
|
510
|
-
paddingStartY:
|
|
511
|
-
paddingEndX:
|
|
512
|
-
paddingEndY:
|
|
488
|
+
fixedSize: z.value,
|
|
489
|
+
fixedWidth: B.value,
|
|
490
|
+
relativeScrollX: ze.value,
|
|
491
|
+
relativeScrollY: Be.value,
|
|
492
|
+
getItemSizeY: (e) => D.get(e),
|
|
493
|
+
getItemSizeX: (e) => E.get(e),
|
|
494
|
+
getItemQueryY: (e) => D.query(e),
|
|
495
|
+
getItemQueryX: (e) => E.query(e),
|
|
496
|
+
getColumnSize: (e) => O.get(e),
|
|
497
|
+
getColumnQuery: (e) => O.query(e),
|
|
498
|
+
scaleX: X.value,
|
|
499
|
+
scaleY: Z.value,
|
|
500
|
+
hostOffsetX: Y.x,
|
|
501
|
+
hostOffsetY: Y.y,
|
|
502
|
+
stickyIndices: be.value,
|
|
503
|
+
stickyStartX: H.value,
|
|
504
|
+
stickyStartY: U.value,
|
|
505
|
+
stickyEndX: Ee.value,
|
|
506
|
+
stickyEndY: De.value,
|
|
507
|
+
flowPaddingStartX: W.value,
|
|
508
|
+
flowPaddingStartY: K.value,
|
|
509
|
+
paddingStartX: Se.value,
|
|
510
|
+
paddingStartY: we.value,
|
|
511
|
+
paddingEndX: Ce.value,
|
|
512
|
+
paddingEndY: Te.value
|
|
513
513
|
});
|
|
514
514
|
if (!o) {
|
|
515
515
|
let n = isScrollToIndexOptions(a) ? a.behavior : void 0;
|
|
516
|
-
|
|
516
|
+
P.value = {
|
|
517
517
|
rowIndex: e,
|
|
518
518
|
colIndex: t,
|
|
519
519
|
options: {
|
|
@@ -525,97 +525,97 @@ function useVirtualScroll(e) {
|
|
|
525
525
|
}
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
|
-
let h = virtualToDisplay(c,
|
|
528
|
+
let h = virtualToDisplay(c, Y.x, X.value), g = virtualToDisplay(l, Y.y, Z.value), _ = d.value ? -h : h, v = g, y;
|
|
529
529
|
isScrollToIndexOptions(a) && (y = a.behavior);
|
|
530
530
|
let b = o ? "auto" : y || "smooth";
|
|
531
531
|
x.value = !0;
|
|
532
532
|
let w = { behavior: b };
|
|
533
|
-
if (t != null && (w.left = d.value ? _ : Math.max(0, _)), e != null && (w.top = Math.max(0, v)), scrollTo(s, w), (b === "auto" || b === void 0) && (t != null && (r.value = d.value ? _ : Math.max(0, _), S.value = c), e != null && (i.value = Math.max(0, v), C.value = l),
|
|
534
|
-
let e =
|
|
535
|
-
isScrollToIndexOptions(e) ? e.behavior = "auto" :
|
|
533
|
+
if (t != null && (w.left = d.value ? _ : Math.max(0, _)), e != null && (w.top = Math.max(0, v)), scrollTo(s, w), (b === "auto" || b === void 0) && (t != null && (r.value = d.value ? _ : Math.max(0, _), S.value = c), e != null && (i.value = Math.max(0, v), C.value = l), P.value)) {
|
|
534
|
+
let e = P.value.options;
|
|
535
|
+
isScrollToIndexOptions(e) ? e.behavior = "auto" : P.value.options = {
|
|
536
536
|
align: e,
|
|
537
537
|
behavior: "auto"
|
|
538
538
|
};
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
|
-
let
|
|
541
|
+
let We = (e, t, a) => {
|
|
542
542
|
let o = n.value.container || window;
|
|
543
|
-
x.value = !0,
|
|
544
|
-
let s = e == null ? null : Math.max(0, Math.min(e,
|
|
543
|
+
x.value = !0, P.value = null;
|
|
544
|
+
let s = e == null ? null : Math.max(0, Math.min(e, q.value - f.value)), c = t == null ? null : Math.max(0, Math.min(t, J.value - p.value));
|
|
545
545
|
s !== null && (S.value = s), c !== null && (C.value = c);
|
|
546
|
-
let l = typeof window < "u" && o === window ? window.scrollX : o.scrollLeft, u = typeof window < "u" && o === window ? window.scrollY : o.scrollTop, m = s === null ? null : virtualToDisplay(s,
|
|
546
|
+
let l = typeof window < "u" && o === window ? window.scrollX : o.scrollLeft, u = typeof window < "u" && o === window ? window.scrollY : o.scrollTop, m = s === null ? null : virtualToDisplay(s, Y.x, X.value), h = c === null ? null : virtualToDisplay(c, Y.y, Z.value), g = m === null ? l : d.value ? -m : m, _ = h === null ? u : h, v = { behavior: a?.behavior || "auto" };
|
|
547
547
|
e != null && (v.left = g), t != null && (v.top = _), scrollTo(o, v), (a?.behavior === "auto" || a?.behavior === void 0) && (e != null && (r.value = g), t != null && (i.value = _));
|
|
548
|
-
},
|
|
549
|
-
if (
|
|
548
|
+
}, Ge = (e, t) => {
|
|
549
|
+
if (E.resize(e), D.resize(e), O.resize(t), j.length !== e) {
|
|
550
550
|
let t = new Uint8Array(e);
|
|
551
|
-
t.set(
|
|
551
|
+
t.set(j.subarray(0, Math.min(e, j.length))), j = t;
|
|
552
552
|
}
|
|
553
|
-
if (
|
|
553
|
+
if (N.length !== e) {
|
|
554
554
|
let t = new Uint8Array(e);
|
|
555
|
-
t.set(
|
|
555
|
+
t.set(N.subarray(0, Math.min(e, N.length))), N = t;
|
|
556
556
|
}
|
|
557
|
-
if (
|
|
557
|
+
if (A.length !== t) {
|
|
558
558
|
let e = new Uint8Array(t);
|
|
559
|
-
e.set(
|
|
559
|
+
e.set(A.subarray(0, Math.min(t, A.length))), A = e;
|
|
560
560
|
}
|
|
561
|
-
},
|
|
561
|
+
}, Q = () => {
|
|
562
562
|
let e = n.value.items.length, t = n.value.columnCount || 0, r = n.value.gap || 0, i = n.value.columnGap || 0, a = n.value.columnWidth, o = !1, s = !1;
|
|
563
563
|
if (t > 0) for (let e = 0; e < t; e++) {
|
|
564
|
-
let t =
|
|
565
|
-
if (!
|
|
564
|
+
let t = O.get(e), r = A[e] === 1;
|
|
565
|
+
if (!de.value || !r && t === 0) {
|
|
566
566
|
let r = 0;
|
|
567
567
|
r = typeof a == "number" && a > 0 ? a : Array.isArray(a) && a.length > 0 ? a[e % a.length] || n.value.defaultColumnWidth || 100 : typeof a == "function" ? a(e) : n.value.defaultColumnWidth || 100;
|
|
568
568
|
let s = r + i;
|
|
569
|
-
Math.abs(t - s) > .5 ? (
|
|
569
|
+
Math.abs(t - s) > .5 ? (O.set(e, s), A[e] = de.value ? 0 : 1, o = !0) : de.value || (A[e] = 1);
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
572
|
for (let t = 0; t < e; t++) {
|
|
573
|
-
let e = n.value.items[t], a =
|
|
574
|
-
if (
|
|
575
|
-
if (!
|
|
576
|
-
let r = (typeof n.value.itemSize == "function" ? n.value.itemSize(e, t) :
|
|
577
|
-
Math.abs(a - r) > .5 ? (
|
|
573
|
+
let e = n.value.items[t], a = E.get(t), o = D.get(t), c = j[t] === 1, l = N[t] === 1;
|
|
574
|
+
if (L.value === "horizontal") {
|
|
575
|
+
if (!R.value || !c && a === 0) {
|
|
576
|
+
let r = (typeof n.value.itemSize == "function" ? n.value.itemSize(e, t) : ve.value) + i;
|
|
577
|
+
Math.abs(a - r) > .5 ? (E.set(t, r), j[t] = R.value ? 0 : 1, s = !0) : R.value || (j[t] = 1);
|
|
578
578
|
}
|
|
579
|
-
} else a !== 0 && (
|
|
580
|
-
if (
|
|
581
|
-
if (!
|
|
582
|
-
let i = (typeof n.value.itemSize == "function" ? n.value.itemSize(e, t) :
|
|
583
|
-
Math.abs(o - i) > .5 ? (
|
|
579
|
+
} else a !== 0 && (E.set(t, 0), j[t] = 0, s = !0);
|
|
580
|
+
if (L.value !== "horizontal") {
|
|
581
|
+
if (!R.value || !l && o === 0) {
|
|
582
|
+
let i = (typeof n.value.itemSize == "function" ? n.value.itemSize(e, t) : ve.value) + r;
|
|
583
|
+
Math.abs(o - i) > .5 ? (D.set(t, i), N[t] = R.value ? 0 : 1, s = !0) : R.value || (N[t] = 1);
|
|
584
584
|
}
|
|
585
|
-
} else o !== 0 && (
|
|
585
|
+
} else o !== 0 && (D.set(t, 0), N[t] = 0, s = !0);
|
|
586
586
|
}
|
|
587
|
-
o &&
|
|
588
|
-
},
|
|
587
|
+
o && O.rebuild(), s && (E.rebuild(), D.rebuild());
|
|
588
|
+
}, Ke = () => {
|
|
589
589
|
let e = n.value.items, t = e.length;
|
|
590
|
-
|
|
590
|
+
Ge(t, n.value.columnCount || 0);
|
|
591
591
|
let r = 0;
|
|
592
|
-
if (n.value.restoreScrollOnPrepend &&
|
|
593
|
-
let n =
|
|
592
|
+
if (n.value.restoreScrollOnPrepend && I.length > 0 && t > I.length) {
|
|
593
|
+
let n = I[0];
|
|
594
594
|
if (n !== void 0) {
|
|
595
|
-
for (let i = 1; i <= t -
|
|
595
|
+
for (let i = 1; i <= t - I.length; i++) if (e[i] === n) {
|
|
596
596
|
r = i;
|
|
597
597
|
break;
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
601
|
if (r > 0) {
|
|
602
|
-
|
|
602
|
+
E.shift(r), D.shift(r), P.value && P.value.rowIndex !== null && P.value.rowIndex !== void 0 && (P.value.rowIndex += r);
|
|
603
603
|
let i = new Uint8Array(t), a = new Uint8Array(t);
|
|
604
|
-
i.set(
|
|
604
|
+
i.set(j.subarray(0, Math.min(t - r, j.length)), r), a.set(N.subarray(0, Math.min(t - r, N.length)), r), j = i, N = a;
|
|
605
605
|
let o = n.value.gap || 0, s = n.value.columnGap || 0, c = 0, l = 0;
|
|
606
606
|
for (let t = 0; t < r; t++) {
|
|
607
|
-
let r = typeof n.value.itemSize == "function" ? n.value.itemSize(e[t], t) :
|
|
608
|
-
|
|
607
|
+
let r = typeof n.value.itemSize == "function" ? n.value.itemSize(e[t], t) : ve.value;
|
|
608
|
+
L.value === "horizontal" ? c += r + s : l += r + o;
|
|
609
609
|
}
|
|
610
610
|
(c > 0 || l > 0) && nextTick(() => {
|
|
611
|
-
|
|
611
|
+
We(c > 0 ? ze.value + c : null, l > 0 ? Be.value + l : null, {
|
|
612
612
|
behavior: "auto",
|
|
613
613
|
isCorrection: !0
|
|
614
614
|
});
|
|
615
615
|
});
|
|
616
616
|
}
|
|
617
|
-
|
|
618
|
-
},
|
|
617
|
+
Q(), I = [...e], le.value = !0, k.value++;
|
|
618
|
+
}, qe = () => {
|
|
619
619
|
if (typeof window > "u") return;
|
|
620
620
|
let e = n.value.container || window, t = (t) => {
|
|
621
621
|
let n = t.getBoundingClientRect();
|
|
@@ -659,61 +659,61 @@ function useVirtualScroll(e) {
|
|
|
659
659
|
() => n.value.columnGap,
|
|
660
660
|
() => n.value.defaultItemSize,
|
|
661
661
|
() => n.value.defaultColumnWidth
|
|
662
|
-
],
|
|
663
|
-
|
|
662
|
+
], Ke, { immediate: !0 }), watch(() => [n.value.container, n.value.hostElement], () => {
|
|
663
|
+
qe();
|
|
664
664
|
}), watch(d, (e, t) => {
|
|
665
665
|
if (t === void 0 || e === t || !l.value) return;
|
|
666
|
-
if (
|
|
667
|
-
|
|
666
|
+
if (L.value === "vertical") {
|
|
667
|
+
qe();
|
|
668
668
|
return;
|
|
669
669
|
}
|
|
670
|
-
let n = displayToVirtual(t ? Math.abs(r.value) : r.value, g.x,
|
|
671
|
-
|
|
672
|
-
}, { flush: "sync" }), watch([
|
|
673
|
-
!l.value || a.value || x.value ||
|
|
670
|
+
let n = displayToVirtual(t ? Math.abs(r.value) : r.value, g.x, X.value);
|
|
671
|
+
qe(), We(n, null, { behavior: "auto" });
|
|
672
|
+
}, { flush: "sync" }), watch([X, Z], () => {
|
|
673
|
+
!l.value || a.value || x.value || We(S.value, C.value, { behavior: "auto" });
|
|
674
674
|
}), watch([() => n.value.items.length, () => n.value.columnCount], ([e, t], [n, r]) => {
|
|
675
675
|
nextTick(() => {
|
|
676
|
-
let i = Math.max(0,
|
|
677
|
-
S.value > i || C.value > a ?
|
|
676
|
+
let i = Math.max(0, q.value - f.value), a = Math.max(0, J.value - p.value);
|
|
677
|
+
S.value > i || C.value > a ? We(Math.min(S.value, i), Math.min(C.value, a), { behavior: "auto" }) : (e !== n && Z.value !== 1 || t !== r && X.value !== 1) && We(S.value, C.value, { behavior: "auto" }), qe();
|
|
678
678
|
});
|
|
679
679
|
});
|
|
680
|
-
let
|
|
681
|
-
let t = n.value.gap || 0, r = n.value.columnGap || 0, i =
|
|
682
|
-
if (
|
|
680
|
+
let Je = (e) => {
|
|
681
|
+
let t = n.value.gap || 0, r = n.value.columnGap || 0, i = z.value;
|
|
682
|
+
if (L.value === "horizontal") {
|
|
683
683
|
let t = (i || 0) + r;
|
|
684
|
-
return i !== null && t > 0 ? Math.floor(e / t) :
|
|
684
|
+
return i !== null && t > 0 ? Math.floor(e / t) : E.findLowerBound(e);
|
|
685
685
|
}
|
|
686
686
|
let a = (i || 0) + t;
|
|
687
|
-
return i !== null && a > 0 ? Math.floor(e / a) :
|
|
688
|
-
},
|
|
689
|
-
if (
|
|
687
|
+
return i !== null && a > 0 ? Math.floor(e / a) : D.findLowerBound(e);
|
|
688
|
+
}, Ye = (e) => L.value === "both" ? O.findLowerBound(e) : L.value === "horizontal" ? Je(e) : 0, Xe = computed(() => {
|
|
689
|
+
if (k.value, (!o.value || c.value) && n.value.ssrRange) return {
|
|
690
690
|
start: n.value.ssrRange.start,
|
|
691
691
|
end: n.value.ssrRange.end
|
|
692
692
|
};
|
|
693
693
|
let e = n.value.ssrRange && !a.value ? 0 : n.value.bufferBefore ?? 5, t = n.value.bufferAfter ?? 5;
|
|
694
694
|
return calculateRange({
|
|
695
|
-
direction:
|
|
696
|
-
relativeScrollX:
|
|
697
|
-
relativeScrollY:
|
|
698
|
-
usableWidth:
|
|
699
|
-
usableHeight:
|
|
695
|
+
direction: L.value,
|
|
696
|
+
relativeScrollX: ze.value,
|
|
697
|
+
relativeScrollY: Be.value,
|
|
698
|
+
usableWidth: ke.value,
|
|
699
|
+
usableHeight: Ae.value,
|
|
700
700
|
itemsLength: n.value.items.length,
|
|
701
701
|
bufferBefore: e,
|
|
702
702
|
bufferAfter: t,
|
|
703
703
|
gap: n.value.gap || 0,
|
|
704
704
|
columnGap: n.value.columnGap || 0,
|
|
705
|
-
fixedSize:
|
|
706
|
-
findLowerBoundY: (e) =>
|
|
707
|
-
findLowerBoundX: (e) =>
|
|
708
|
-
queryY: (e) =>
|
|
709
|
-
queryX: (e) =>
|
|
705
|
+
fixedSize: z.value,
|
|
706
|
+
findLowerBoundY: (e) => D.findLowerBound(e),
|
|
707
|
+
findLowerBoundX: (e) => E.findLowerBound(e),
|
|
708
|
+
queryY: (e) => D.query(e),
|
|
709
|
+
queryX: (e) => E.query(e)
|
|
710
710
|
});
|
|
711
|
-
}), Xe = computed(() => {
|
|
712
|
-
A.value;
|
|
713
|
-
let e = Re.value + U.value, t = ze.value + W.value;
|
|
714
|
-
return qe(R.value === "horizontal" ? e : t);
|
|
715
711
|
}), Ze = computed(() => {
|
|
716
|
-
|
|
712
|
+
k.value;
|
|
713
|
+
let e = ze.value + H.value, t = Be.value + U.value;
|
|
714
|
+
return Je(L.value === "horizontal" ? e : t);
|
|
715
|
+
}), Qe = computed(() => {
|
|
716
|
+
k.value;
|
|
717
717
|
let e = n.value.columnCount || 0;
|
|
718
718
|
if (!e) return {
|
|
719
719
|
start: 0,
|
|
@@ -722,7 +722,7 @@ function useVirtualScroll(e) {
|
|
|
722
722
|
padEnd: 0
|
|
723
723
|
};
|
|
724
724
|
if ((!o.value || c.value) && n.value.ssrRange) {
|
|
725
|
-
let { colStart: t = 0, colEnd: r = 0 } = n.value.ssrRange, i = Math.max(0, t), a = Math.min(e, r || e), o = n.value.columnGap || 0, s =
|
|
725
|
+
let { colStart: t = 0, colEnd: r = 0 } = n.value.ssrRange, i = Math.max(0, t), a = Math.min(e, r || e), o = n.value.columnGap || 0, s = B.value === null ? O.query(i) : i * (B.value + o), c = B.value === null ? Math.max(0, O.query(e) - o) : e * (B.value + o) - o, l = B.value === null ? O.query(a) - (a > 0 ? o : 0) : a * (B.value + o) - (a > 0 ? o : 0);
|
|
726
726
|
return {
|
|
727
727
|
start: i,
|
|
728
728
|
end: a,
|
|
@@ -733,67 +733,67 @@ function useVirtualScroll(e) {
|
|
|
733
733
|
let t = n.value.ssrRange && !a.value ? 0 : 2;
|
|
734
734
|
return calculateColumnRange({
|
|
735
735
|
columnCount: e,
|
|
736
|
-
relativeScrollX:
|
|
737
|
-
usableWidth:
|
|
736
|
+
relativeScrollX: ze.value,
|
|
737
|
+
usableWidth: ke.value,
|
|
738
738
|
colBuffer: t,
|
|
739
|
-
fixedWidth:
|
|
739
|
+
fixedWidth: B.value,
|
|
740
740
|
columnGap: n.value.columnGap || 0,
|
|
741
|
-
findLowerBound: (e) =>
|
|
742
|
-
query: (e) =>
|
|
743
|
-
totalColsQuery: () =>
|
|
741
|
+
findLowerBound: (e) => O.findLowerBound(e),
|
|
742
|
+
query: (e) => O.query(e),
|
|
743
|
+
totalColsQuery: () => O.query(e)
|
|
744
744
|
});
|
|
745
|
-
}),
|
|
746
|
-
|
|
747
|
-
let { start: e, end: t } =
|
|
745
|
+
}), $e = [], et = computed(() => {
|
|
746
|
+
k.value;
|
|
747
|
+
let { start: e, end: t } = Xe.value, r = [], i = z.value, a = n.value.gap || 0, s = n.value.columnGap || 0, c = be.value, l = xe.value, u = [];
|
|
748
748
|
if (o.value || !n.value.ssrRange) {
|
|
749
|
-
let t =
|
|
749
|
+
let t = Ze.value, n = findPrevStickyIndex(c, t);
|
|
750
750
|
n !== void 0 && n < e && u.push(n);
|
|
751
751
|
}
|
|
752
752
|
for (let n = e; n < t; n++) u.push(n);
|
|
753
753
|
let d = n.value.ssrRange?.start || 0, f = n.value.ssrRange?.colStart || 0, p = 0, m = 0;
|
|
754
|
-
!o.value && n.value.ssrRange && (m =
|
|
755
|
-
let h = new Map(
|
|
754
|
+
!o.value && n.value.ssrRange && (m = L.value === "horizontal" ? 0 : i === null ? D.query(d) : d * (i + a), L.value === "horizontal" ? p = i === null ? E.query(f) : f * (i + s) : L.value === "both" && (p = O.query(f)));
|
|
755
|
+
let h = new Map($e.map((e) => [e.index, e])), g = -1, _ = 0, v = -1, y = 0, b = (e) => e === g + 1 ? (_ += E.get(g), g = e, _) : (_ = E.query(e), g = e, _), x = (e) => e === v + 1 ? (y += D.get(v), v = e, y) : (y = D.query(e), v = e, y), w = W.value + H.value + Se.value, T = K.value + U.value + we.value, ee = W.value + H.value, te = K.value + U.value, A = Qe.value;
|
|
756
756
|
for (let e of u) {
|
|
757
757
|
let t = n.value.items[e];
|
|
758
758
|
if (t === void 0) continue;
|
|
759
759
|
let { x: i, y: a, width: s, height: u } = calculateItemPosition({
|
|
760
760
|
index: e,
|
|
761
|
-
direction:
|
|
762
|
-
fixedSize:
|
|
761
|
+
direction: L.value,
|
|
762
|
+
fixedSize: z.value,
|
|
763
763
|
gap: n.value.gap || 0,
|
|
764
764
|
columnGap: n.value.columnGap || 0,
|
|
765
|
-
usableWidth:
|
|
766
|
-
usableHeight:
|
|
767
|
-
totalWidth:
|
|
765
|
+
usableWidth: ke.value,
|
|
766
|
+
usableHeight: Ae.value,
|
|
767
|
+
totalWidth: je.value.width,
|
|
768
768
|
queryY: x,
|
|
769
769
|
queryX: b,
|
|
770
|
-
getSizeY: (e) =>
|
|
771
|
-
getSizeX: (e) =>
|
|
772
|
-
columnRange:
|
|
773
|
-
}), d = l.has(e), f = i, g = a, { isStickyActive: _, isStickyActiveX: v, isStickyActiveY: y, stickyOffset:
|
|
770
|
+
getSizeY: (e) => D.get(e),
|
|
771
|
+
getSizeX: (e) => E.get(e),
|
|
772
|
+
columnRange: A
|
|
773
|
+
}), d = l.has(e), f = i, g = a, { isStickyActive: _, isStickyActiveX: v, isStickyActiveY: y, stickyOffset: O } = calculateStickyItem({
|
|
774
774
|
index: e,
|
|
775
775
|
isSticky: d,
|
|
776
|
-
direction:
|
|
777
|
-
relativeScrollX:
|
|
778
|
-
relativeScrollY:
|
|
776
|
+
direction: L.value,
|
|
777
|
+
relativeScrollX: ze.value,
|
|
778
|
+
relativeScrollY: Be.value,
|
|
779
779
|
originalX: f,
|
|
780
780
|
originalY: g,
|
|
781
781
|
width: s,
|
|
782
782
|
height: u,
|
|
783
783
|
stickyIndices: c,
|
|
784
|
-
fixedSize:
|
|
785
|
-
fixedWidth:
|
|
784
|
+
fixedSize: z.value,
|
|
785
|
+
fixedWidth: B.value,
|
|
786
786
|
gap: n.value.gap || 0,
|
|
787
787
|
columnGap: n.value.columnGap || 0,
|
|
788
788
|
getItemQueryY: x,
|
|
789
789
|
getItemQueryX: b
|
|
790
|
-
}),
|
|
791
|
-
|
|
790
|
+
}), k = o.value ? S.value / X.value + (i + w - S.value) - ee : i - p, j = o.value ? C.value / Z.value + (a + T - C.value) - te : a - m, M = h.get(e);
|
|
791
|
+
M && M.item === t && M.offset.x === k && M.offset.y === j && M.size.width === s && M.size.height === u && M.isSticky === d && M.isStickyActive === _ && M.isStickyActiveX === v && M.isStickyActiveY === y && M.stickyOffset.x === O.x && M.stickyOffset.y === O.y ? r.push(M) : r.push({
|
|
792
792
|
item: t,
|
|
793
793
|
index: e,
|
|
794
794
|
offset: {
|
|
795
|
-
x:
|
|
796
|
-
y:
|
|
795
|
+
x: k,
|
|
796
|
+
y: j
|
|
797
797
|
},
|
|
798
798
|
size: {
|
|
799
799
|
width: s,
|
|
@@ -805,15 +805,15 @@ function useVirtualScroll(e) {
|
|
|
805
805
|
isStickyActive: _,
|
|
806
806
|
isStickyActiveX: v,
|
|
807
807
|
isStickyActiveY: y,
|
|
808
|
-
stickyOffset:
|
|
808
|
+
stickyOffset: O
|
|
809
809
|
});
|
|
810
810
|
}
|
|
811
|
-
return
|
|
812
|
-
}),
|
|
813
|
-
|
|
814
|
-
let e =
|
|
811
|
+
return $e = r, r;
|
|
812
|
+
}), tt = computed(() => {
|
|
813
|
+
k.value;
|
|
814
|
+
let e = ze.value + H.value, t = Be.value + U.value, n = ze.value + (f.value - Ee.value) - 1, o = Be.value + (p.value - De.value) - 1, s = Ye(e), c = Je(t), l = Je(L.value === "horizontal" ? n : o), u = Ye(n);
|
|
815
815
|
return {
|
|
816
|
-
items:
|
|
816
|
+
items: et.value,
|
|
817
817
|
currentIndex: c,
|
|
818
818
|
currentColIndex: s,
|
|
819
819
|
currentEndIndex: l,
|
|
@@ -835,52 +835,52 @@ function useVirtualScroll(e) {
|
|
|
835
835
|
height: p.value
|
|
836
836
|
},
|
|
837
837
|
totalSize: {
|
|
838
|
-
width:
|
|
839
|
-
height:
|
|
838
|
+
width: q.value,
|
|
839
|
+
height: J.value
|
|
840
840
|
},
|
|
841
841
|
isScrolling: a.value,
|
|
842
842
|
isProgrammaticScroll: x.value,
|
|
843
|
-
range:
|
|
844
|
-
columnRange:
|
|
843
|
+
range: Xe.value,
|
|
844
|
+
columnRange: Qe.value
|
|
845
845
|
};
|
|
846
|
-
}),
|
|
847
|
-
x.value = !1,
|
|
848
|
-
},
|
|
846
|
+
}), nt = () => {
|
|
847
|
+
x.value = !1, P.value = null;
|
|
848
|
+
}, rt = (e) => {
|
|
849
849
|
let t = e.target;
|
|
850
|
-
typeof window > "u" || (
|
|
850
|
+
typeof window > "u" || (ee(), t === window || t === document ? (r.value = window.scrollX, i.value = window.scrollY, f.value = document.documentElement.clientWidth, p.value = document.documentElement.clientHeight) : isScrollableElement(t) && (r.value = t.scrollLeft, i.value = t.scrollTop, f.value = t.clientWidth, p.value = t.clientHeight), S.value = displayToVirtual(d.value ? Math.abs(r.value) : r.value, Y.x, X.value), C.value = displayToVirtual(i.value, Y.y, Z.value), a.value ||= (x.value || (P.value = null), !0), clearTimeout(b), b = setTimeout(() => {
|
|
851
851
|
a.value = !1, x.value = !1;
|
|
852
852
|
}, 250));
|
|
853
|
-
},
|
|
854
|
-
let t = !1, r = 0, i = 0, a = n.value.gap || 0, o = n.value.columnGap || 0, s =
|
|
853
|
+
}, it = (e) => {
|
|
854
|
+
let t = !1, r = 0, i = 0, a = n.value.gap || 0, o = n.value.columnGap || 0, s = ze.value, c = Be.value, l = Je(L.value === "horizontal" ? s : c), u = Ye(s), d = L.value === "horizontal", f = L.value === "both", p = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set(), h = (e, i) => {
|
|
855
855
|
if (e >= 0 && e < (n.value.columnCount || 0) && !m.has(e)) {
|
|
856
856
|
m.add(e);
|
|
857
|
-
let n =
|
|
858
|
-
if (!
|
|
857
|
+
let n = O.get(e), a = i + o;
|
|
858
|
+
if (!A[e] || Math.abs(n - a) > .1) {
|
|
859
859
|
let i = a - n;
|
|
860
|
-
Math.abs(i) > .1 && (
|
|
860
|
+
Math.abs(i) > .1 && (O.update(e, i), t = !0, e < u && (r += i)), A[e] = 1;
|
|
861
861
|
}
|
|
862
862
|
}
|
|
863
863
|
};
|
|
864
864
|
for (let { index: s, inlineSize: c, blockSize: u, element: m } of e) {
|
|
865
865
|
if (c <= 0 && u <= 0) continue;
|
|
866
|
-
let e =
|
|
866
|
+
let e = R.value || typeof n.value.itemSize == "function";
|
|
867
867
|
if (s >= 0 && !p.has(s) && e && u > 0) {
|
|
868
868
|
if (p.add(s), d && c > 0) {
|
|
869
|
-
let e =
|
|
870
|
-
if (!
|
|
869
|
+
let e = E.get(s), n = c + o;
|
|
870
|
+
if (!j[s] || Math.abs(n - e) > .1) {
|
|
871
871
|
let i = n - e;
|
|
872
|
-
|
|
872
|
+
E.update(s, i), j[s] = 1, t = !0, s < l && (r += i);
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
875
|
if (!d) {
|
|
876
|
-
let e =
|
|
877
|
-
if (!
|
|
876
|
+
let e = D.get(s), n = u + a;
|
|
877
|
+
if (!N[s] || Math.abs(n - e) > .1) {
|
|
878
878
|
let r = n - e;
|
|
879
|
-
|
|
879
|
+
D.update(s, r), N[s] = 1, t = !0, s < l && (i += r);
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
882
|
}
|
|
883
|
-
let g =
|
|
883
|
+
let g = de.value || typeof n.value.columnWidth == "function";
|
|
884
884
|
if (f && m && n.value.columnCount && g && (c > 0 || m.dataset.colIndex === void 0)) {
|
|
885
885
|
let e = m.dataset.colIndex;
|
|
886
886
|
if (e != null) h(Number.parseInt(e, 10), c);
|
|
@@ -890,60 +890,60 @@ function useVirtualScroll(e) {
|
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
|
-
if (t && (
|
|
894
|
-
let e =
|
|
895
|
-
|
|
893
|
+
if (t && (k.value++, !(P.value !== null || x.value) && (r !== 0 || i !== 0))) {
|
|
894
|
+
let e = W.value + H.value + Se.value, t = K.value + U.value + we.value;
|
|
895
|
+
We(r === 0 ? null : s + r + e, i === 0 ? null : c + i + t, { behavior: "auto" });
|
|
896
896
|
}
|
|
897
|
-
},
|
|
898
|
-
|
|
897
|
+
}, at = (e, t, n, r) => {
|
|
898
|
+
it([{
|
|
899
899
|
index: e,
|
|
900
900
|
inlineSize: t,
|
|
901
901
|
blockSize: n,
|
|
902
902
|
element: r
|
|
903
903
|
}]);
|
|
904
904
|
};
|
|
905
|
-
function
|
|
906
|
-
if (
|
|
907
|
-
let { rowIndex: e, colIndex: t, options: r } =
|
|
905
|
+
function ot() {
|
|
906
|
+
if (P.value && !c.value) {
|
|
907
|
+
let { rowIndex: e, colIndex: t, options: r } = P.value;
|
|
908
908
|
if (isScrollToIndexOptions(r) && r.behavior === "smooth" && a.value) return;
|
|
909
|
-
let i = n.value.container || window, o = typeof window < "u" && i === window ? window.scrollX : i.scrollLeft, s = typeof window < "u" && i === window ? window.scrollY : i.scrollTop, c = d.value ? Math.abs(o) : o, l = s, u = displayToVirtual(c, 0,
|
|
909
|
+
let i = n.value.container || window, o = typeof window < "u" && i === window ? window.scrollX : i.scrollLeft, s = typeof window < "u" && i === window ? window.scrollY : i.scrollTop, c = d.value ? Math.abs(o) : o, l = s, u = displayToVirtual(c, 0, X.value), m = displayToVirtual(l, 0, Z.value), { targetX: h, targetY: g } = calculateScrollTarget({
|
|
910
910
|
rowIndex: e,
|
|
911
911
|
colIndex: t,
|
|
912
912
|
options: r,
|
|
913
|
-
direction:
|
|
913
|
+
direction: L.value,
|
|
914
914
|
viewportWidth: f.value,
|
|
915
915
|
viewportHeight: p.value,
|
|
916
|
-
totalWidth:
|
|
917
|
-
totalHeight:
|
|
916
|
+
totalWidth: Ne.value,
|
|
917
|
+
totalHeight: Pe.value,
|
|
918
918
|
gap: n.value.gap || 0,
|
|
919
919
|
columnGap: n.value.columnGap || 0,
|
|
920
|
-
fixedSize:
|
|
921
|
-
fixedWidth:
|
|
920
|
+
fixedSize: z.value,
|
|
921
|
+
fixedWidth: B.value,
|
|
922
922
|
relativeScrollX: u,
|
|
923
923
|
relativeScrollY: m,
|
|
924
|
-
getItemSizeY: (e) =>
|
|
925
|
-
getItemSizeX: (e) =>
|
|
926
|
-
getItemQueryY: (e) =>
|
|
927
|
-
getItemQueryX: (e) =>
|
|
928
|
-
getColumnSize: (e) =>
|
|
929
|
-
getColumnQuery: (e) =>
|
|
930
|
-
scaleX:
|
|
931
|
-
scaleY:
|
|
932
|
-
hostOffsetX:
|
|
933
|
-
hostOffsetY:
|
|
934
|
-
stickyIndices:
|
|
935
|
-
stickyStartX:
|
|
936
|
-
stickyStartY:
|
|
937
|
-
stickyEndX:
|
|
938
|
-
stickyEndY:
|
|
939
|
-
flowPaddingStartX:
|
|
940
|
-
flowPaddingStartY:
|
|
941
|
-
paddingStartX:
|
|
942
|
-
paddingStartY:
|
|
943
|
-
paddingEndX:
|
|
944
|
-
paddingEndY:
|
|
945
|
-
}), _ = t == null || Math.abs(u - h) < 2, v = e == null || Math.abs(m - g) < 2, y = t == null || t === void 0 ||
|
|
946
|
-
_ && v ? y && b && !a.value && !x.value && (
|
|
924
|
+
getItemSizeY: (e) => D.get(e),
|
|
925
|
+
getItemSizeX: (e) => E.get(e),
|
|
926
|
+
getItemQueryY: (e) => D.query(e),
|
|
927
|
+
getItemQueryX: (e) => E.query(e),
|
|
928
|
+
getColumnSize: (e) => O.get(e),
|
|
929
|
+
getColumnQuery: (e) => O.query(e),
|
|
930
|
+
scaleX: X.value,
|
|
931
|
+
scaleY: Z.value,
|
|
932
|
+
hostOffsetX: Y.x,
|
|
933
|
+
hostOffsetY: Y.y,
|
|
934
|
+
stickyIndices: be.value,
|
|
935
|
+
stickyStartX: H.value,
|
|
936
|
+
stickyStartY: U.value,
|
|
937
|
+
stickyEndX: Ee.value,
|
|
938
|
+
stickyEndY: De.value,
|
|
939
|
+
flowPaddingStartX: W.value,
|
|
940
|
+
flowPaddingStartY: K.value,
|
|
941
|
+
paddingStartX: Se.value,
|
|
942
|
+
paddingStartY: we.value,
|
|
943
|
+
paddingEndX: Ce.value,
|
|
944
|
+
paddingEndY: Te.value
|
|
945
|
+
}), _ = t == null || Math.abs(u - h) < 2, v = e == null || Math.abs(m - g) < 2, y = t == null || t === void 0 || A[t] === 1, b = e == null || e === void 0 || N[e] === 1;
|
|
946
|
+
_ && v ? y && b && !a.value && !x.value && (P.value = null) : Ue(e, t, isScrollToIndexOptions(r) ? {
|
|
947
947
|
...r,
|
|
948
948
|
isCorrection: !0
|
|
949
949
|
} : {
|
|
@@ -953,39 +953,39 @@ function useVirtualScroll(e) {
|
|
|
953
953
|
}
|
|
954
954
|
}
|
|
955
955
|
watch([
|
|
956
|
-
|
|
956
|
+
k,
|
|
957
957
|
f,
|
|
958
958
|
p
|
|
959
|
-
],
|
|
960
|
-
e ||
|
|
959
|
+
], ot), watch(a, (e) => {
|
|
960
|
+
e || ot();
|
|
961
961
|
});
|
|
962
|
-
let
|
|
962
|
+
let st = null, $ = null, ct, lt = (e) => {
|
|
963
963
|
if (typeof window > "u") return;
|
|
964
964
|
let t = e || window, n = t === window || isElement(t) && t === document.documentElement ? document : t;
|
|
965
|
-
if (n.addEventListener("scroll",
|
|
965
|
+
if (n.addEventListener("scroll", rt, { passive: !0 }), T = null, ee(), isElement(t) && ($ = new MutationObserver(() => ee()), $.observe(t, {
|
|
966
966
|
attributes: !0,
|
|
967
967
|
attributeFilter: ["dir", "style"]
|
|
968
|
-
})), ct = setInterval(
|
|
968
|
+
})), ct = setInterval(ee, 1e3), t === window) {
|
|
969
969
|
f.value = document.documentElement.clientWidth, p.value = document.documentElement.clientHeight, r.value = window.scrollX, i.value = window.scrollY;
|
|
970
970
|
let e = () => {
|
|
971
|
-
|
|
971
|
+
ee(), f.value = document.documentElement.clientWidth, p.value = document.documentElement.clientHeight, qe();
|
|
972
972
|
};
|
|
973
973
|
return window.addEventListener("resize", e), () => {
|
|
974
|
-
n.removeEventListener("scroll",
|
|
974
|
+
n.removeEventListener("scroll", rt), window.removeEventListener("resize", e), $?.disconnect(), clearInterval(ct), T = null;
|
|
975
975
|
};
|
|
976
|
-
} else return f.value = t.clientWidth, p.value = t.clientHeight, r.value = t.scrollLeft, i.value = t.scrollTop,
|
|
977
|
-
|
|
978
|
-
}),
|
|
979
|
-
n.removeEventListener("scroll",
|
|
976
|
+
} else return f.value = t.clientWidth, p.value = t.clientHeight, r.value = t.scrollLeft, i.value = t.scrollTop, st = new ResizeObserver(() => {
|
|
977
|
+
ee(), f.value = t.clientWidth, p.value = t.clientHeight, qe();
|
|
978
|
+
}), st.observe(t), () => {
|
|
979
|
+
n.removeEventListener("scroll", rt), st?.disconnect(), $?.disconnect(), clearInterval(ct), T = null;
|
|
980
980
|
};
|
|
981
981
|
}, ut;
|
|
982
982
|
return getCurrentInstance() && (onMounted(() => {
|
|
983
|
-
l.value = !0,
|
|
983
|
+
l.value = !0, ee(), watch(() => n.value.container, (e) => {
|
|
984
984
|
ut?.(), ut = lt(e || null);
|
|
985
|
-
}, { immediate: !0 }),
|
|
986
|
-
if (
|
|
985
|
+
}, { immediate: !0 }), qe(), nextTick(() => {
|
|
986
|
+
if (qe(), n.value.ssrRange || n.value.initialScrollIndex !== void 0) {
|
|
987
987
|
let e = n.value.initialScrollIndex === void 0 ? n.value.ssrRange?.start : n.value.initialScrollIndex, t = n.value.initialScrollAlign || "start";
|
|
988
|
-
e != null &&
|
|
988
|
+
e != null && Ue(e, n.value.ssrRange?.colStart, {
|
|
989
989
|
align: t,
|
|
990
990
|
behavior: "auto"
|
|
991
991
|
}), o.value = !0, c.value = !0, nextTick(() => {
|
|
@@ -996,46 +996,46 @@ function useVirtualScroll(e) {
|
|
|
996
996
|
}), onUnmounted(() => {
|
|
997
997
|
ut?.();
|
|
998
998
|
})), {
|
|
999
|
-
renderedItems:
|
|
1000
|
-
totalWidth:
|
|
1001
|
-
totalHeight:
|
|
1002
|
-
renderedWidth:
|
|
1003
|
-
renderedHeight:
|
|
1004
|
-
scrollDetails:
|
|
1005
|
-
getRowHeight:
|
|
1006
|
-
getColumnWidth:
|
|
1007
|
-
getRowOffset: (e) =>
|
|
1008
|
-
getColumnOffset: (e) =>
|
|
1009
|
-
getItemOffset: (e) =>
|
|
999
|
+
renderedItems: et,
|
|
1000
|
+
totalWidth: q,
|
|
1001
|
+
totalHeight: J,
|
|
1002
|
+
renderedWidth: Fe,
|
|
1003
|
+
renderedHeight: Ie,
|
|
1004
|
+
scrollDetails: tt,
|
|
1005
|
+
getRowHeight: He,
|
|
1006
|
+
getColumnWidth: Ve,
|
|
1007
|
+
getRowOffset: (e) => K.value + U.value + we.value + D.query(e),
|
|
1008
|
+
getColumnOffset: (e) => W.value + H.value + Se.value + O.query(e),
|
|
1009
|
+
getItemOffset: (e) => L.value === "horizontal" ? W.value + H.value + Se.value + E.query(e) : K.value + U.value + we.value + D.query(e),
|
|
1010
1010
|
getItemSize: (e) => {
|
|
1011
|
-
if (
|
|
1011
|
+
if (L.value === "horizontal") return Math.max(0, E.get(e) - (n.value.columnGap || 0));
|
|
1012
1012
|
let t = n.value.itemSize;
|
|
1013
1013
|
if (typeof t == "number" && t > 0) return t;
|
|
1014
1014
|
if (typeof t == "function") {
|
|
1015
1015
|
let r = n.value.items[e];
|
|
1016
1016
|
return r === void 0 ? n.value.defaultItemSize || 40 : t(r, e);
|
|
1017
1017
|
}
|
|
1018
|
-
return Math.max(0,
|
|
1018
|
+
return Math.max(0, D.get(e) - (n.value.gap || 0));
|
|
1019
1019
|
},
|
|
1020
|
-
scrollToIndex:
|
|
1021
|
-
scrollToOffset:
|
|
1022
|
-
stopProgrammaticScroll:
|
|
1023
|
-
updateItemSize:
|
|
1024
|
-
updateItemSizes:
|
|
1025
|
-
updateHostOffset:
|
|
1026
|
-
updateDirection:
|
|
1027
|
-
columnRange:
|
|
1020
|
+
scrollToIndex: Ue,
|
|
1021
|
+
scrollToOffset: We,
|
|
1022
|
+
stopProgrammaticScroll: nt,
|
|
1023
|
+
updateItemSize: at,
|
|
1024
|
+
updateItemSizes: it,
|
|
1025
|
+
updateHostOffset: qe,
|
|
1026
|
+
updateDirection: ee,
|
|
1027
|
+
columnRange: Qe,
|
|
1028
1028
|
refresh: () => {
|
|
1029
|
-
|
|
1029
|
+
E.resize(0), D.resize(0), O.resize(0), A.fill(0), j.fill(0), N.fill(0), Ke();
|
|
1030
1030
|
},
|
|
1031
1031
|
isHydrated: o,
|
|
1032
|
-
isWindowContainer:
|
|
1032
|
+
isWindowContainer: Me,
|
|
1033
1033
|
isRtl: d,
|
|
1034
|
-
scaleX:
|
|
1035
|
-
scaleY:
|
|
1036
|
-
componentOffset:
|
|
1037
|
-
renderedVirtualWidth:
|
|
1038
|
-
renderedVirtualHeight:
|
|
1034
|
+
scaleX: X,
|
|
1035
|
+
scaleY: Z,
|
|
1036
|
+
componentOffset: Y,
|
|
1037
|
+
renderedVirtualWidth: Le,
|
|
1038
|
+
renderedVirtualHeight: Re
|
|
1039
1039
|
};
|
|
1040
1040
|
}
|
|
1041
1041
|
function useVirtualScrollbar(e) {
|
|
@@ -1091,6 +1091,7 @@ function useVirtualScrollbar(e) {
|
|
|
1091
1091
|
class: ["virtual-scrollbar-track", `virtual-scrollbar-track--${l.value ? "horizontal" : "vertical"}`],
|
|
1092
1092
|
style: g.value,
|
|
1093
1093
|
role: "scrollbar",
|
|
1094
|
+
"aria-label": toValue(e.ariaLabel),
|
|
1094
1095
|
"aria-orientation": n.value,
|
|
1095
1096
|
"aria-valuenow": Math.round(i.value),
|
|
1096
1097
|
"aria-valuemin": 0,
|
|
@@ -1126,7 +1127,8 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1126
1127
|
isRtl: {
|
|
1127
1128
|
type: Boolean,
|
|
1128
1129
|
default: !1
|
|
1129
|
-
}
|
|
1130
|
+
},
|
|
1131
|
+
ariaLabel: {}
|
|
1130
1132
|
},
|
|
1131
1133
|
emits: ["scrollToOffset"],
|
|
1132
1134
|
setup(e, { emit: t }) {
|
|
@@ -1145,7 +1147,8 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1145
1147
|
}
|
|
1146
1148
|
}), _hoisted_1 = {
|
|
1147
1149
|
key: 0,
|
|
1148
|
-
class: "virtual-scroll-scrollbar-container"
|
|
1150
|
+
class: "virtual-scroll-scrollbar-container",
|
|
1151
|
+
"aria-hidden": "true"
|
|
1149
1152
|
}, _hoisted_2 = {
|
|
1150
1153
|
key: 0,
|
|
1151
1154
|
class: "virtual-scroll-debug-info"
|
|
@@ -1201,7 +1204,11 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1201
1204
|
debug: {
|
|
1202
1205
|
type: Boolean,
|
|
1203
1206
|
default: !1
|
|
1204
|
-
}
|
|
1207
|
+
},
|
|
1208
|
+
role: {},
|
|
1209
|
+
ariaLabel: {},
|
|
1210
|
+
ariaLabelledby: {},
|
|
1211
|
+
itemRole: { default: void 0 }
|
|
1205
1212
|
},
|
|
1206
1213
|
emits: [
|
|
1207
1214
|
"scroll",
|
|
@@ -1209,18 +1216,18 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1209
1216
|
"visibleRangeChange"
|
|
1210
1217
|
],
|
|
1211
1218
|
setup(o, { expose: s, emit: c }) {
|
|
1212
|
-
let _ = o, w = c,
|
|
1213
|
-
let e =
|
|
1214
|
-
return e ===
|
|
1215
|
-
}),
|
|
1219
|
+
let _ = o, w = c, O = useSlots(), k = ref(null), A = ref(null), j = ref(null), M = ref(null), ne = /* @__PURE__ */ new Map(), N = useId(), P = computed(() => `vs-container-${N}`), re = ref(0), ie = ref(0), ae = computed(() => _.container === void 0 ? k.value : _.container), oe = computed(() => {
|
|
1220
|
+
let e = ae.value;
|
|
1221
|
+
return e === k.value || typeof window < "u" && (e === window || e === null);
|
|
1222
|
+
}), F = computed(() => (_.items.length, {
|
|
1216
1223
|
items: _.items,
|
|
1217
1224
|
itemSize: _.itemSize,
|
|
1218
1225
|
direction: _.direction,
|
|
1219
1226
|
bufferBefore: _.bufferBefore,
|
|
1220
1227
|
bufferAfter: _.bufferAfter,
|
|
1221
|
-
container:
|
|
1222
|
-
hostElement:
|
|
1223
|
-
hostRef:
|
|
1228
|
+
container: ae.value,
|
|
1229
|
+
hostElement: A.value,
|
|
1230
|
+
hostRef: k.value,
|
|
1224
1231
|
ssrRange: _.ssrRange,
|
|
1225
1232
|
columnCount: _.columnCount,
|
|
1226
1233
|
columnWidth: _.columnWidth,
|
|
@@ -1234,19 +1241,19 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1234
1241
|
},
|
|
1235
1242
|
flowPaddingStart: {
|
|
1236
1243
|
x: 0,
|
|
1237
|
-
y: _.stickyHeader ? 0 :
|
|
1244
|
+
y: _.stickyHeader ? 0 : re.value
|
|
1238
1245
|
},
|
|
1239
1246
|
flowPaddingEnd: {
|
|
1240
1247
|
x: 0,
|
|
1241
|
-
y: _.stickyFooter ? 0 :
|
|
1248
|
+
y: _.stickyFooter ? 0 : ie.value
|
|
1242
1249
|
},
|
|
1243
1250
|
stickyStart: {
|
|
1244
1251
|
x: 0,
|
|
1245
|
-
y: _.stickyHeader &&
|
|
1252
|
+
y: _.stickyHeader && oe.value ? re.value : 0
|
|
1246
1253
|
},
|
|
1247
1254
|
stickyEnd: {
|
|
1248
1255
|
x: 0,
|
|
1249
|
-
y: _.stickyFooter &&
|
|
1256
|
+
y: _.stickyFooter && oe.value ? ie.value : 0
|
|
1250
1257
|
},
|
|
1251
1258
|
gap: _.gap,
|
|
1252
1259
|
columnGap: _.columnGap,
|
|
@@ -1259,64 +1266,64 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1259
1266
|
defaultItemSize: _.defaultItemSize,
|
|
1260
1267
|
defaultColumnWidth: _.defaultColumnWidth,
|
|
1261
1268
|
debug: _.debug
|
|
1262
|
-
})), { isHydrated:
|
|
1263
|
-
function
|
|
1264
|
-
let { displayViewportSize: t } =
|
|
1265
|
-
e >=
|
|
1269
|
+
})), { isHydrated: le, isRtl: I, columnRange: ue, renderedItems: L, scrollDetails: R, renderedHeight: de, renderedWidth: z, getColumnWidth: B, getRowHeight: pe, scrollToIndex: V, scrollToOffset: me, updateHostOffset: he, updateItemSizes: ge, updateDirection: _e, getItemOffset: ye, getRowOffset: Ee, getColumnOffset: U, getItemSize: De, refresh: W, stopProgrammaticScroll: G, scaleX: K, scaleY: Oe, isWindowContainer: ke, componentOffset: Ae, renderedVirtualWidth: je, renderedVirtualHeight: Me } = useVirtualScroll(F), Ne = computed(() => K.value !== 1 || Oe.value !== 1), Pe = computed(() => ke.value ? !1 : _.virtualScrollbar === !0 || K.value !== 1 || Oe.value !== 1);
|
|
1270
|
+
function q(e) {
|
|
1271
|
+
let { displayViewportSize: t } = R.value;
|
|
1272
|
+
e >= de.value - t.height - .5 ? me(null, Infinity) : me(null, displayToVirtual(e, Ae.y, Oe.value));
|
|
1266
1273
|
}
|
|
1267
|
-
function
|
|
1268
|
-
let { displayViewportSize: t } =
|
|
1269
|
-
e >=
|
|
1274
|
+
function J(e) {
|
|
1275
|
+
let { displayViewportSize: t } = R.value;
|
|
1276
|
+
e >= z.value - t.width - .5 ? me(Infinity, null) : me(displayToVirtual(e, Ae.x, K.value), null);
|
|
1270
1277
|
}
|
|
1271
|
-
let
|
|
1278
|
+
let Y = useVirtualScrollbar({
|
|
1272
1279
|
axis: "vertical",
|
|
1273
|
-
totalSize:
|
|
1274
|
-
position: computed(() =>
|
|
1275
|
-
viewportSize: computed(() =>
|
|
1276
|
-
scrollToOffset:
|
|
1277
|
-
containerId:
|
|
1278
|
-
isRtl:
|
|
1279
|
-
}),
|
|
1280
|
+
totalSize: de,
|
|
1281
|
+
position: computed(() => R.value.displayScrollOffset.y),
|
|
1282
|
+
viewportSize: computed(() => R.value.displayViewportSize.height),
|
|
1283
|
+
scrollToOffset: q,
|
|
1284
|
+
containerId: P,
|
|
1285
|
+
isRtl: I
|
|
1286
|
+
}), Fe = useVirtualScrollbar({
|
|
1280
1287
|
axis: "horizontal",
|
|
1281
|
-
totalSize:
|
|
1282
|
-
position: computed(() =>
|
|
1283
|
-
viewportSize: computed(() =>
|
|
1284
|
-
scrollToOffset:
|
|
1285
|
-
containerId:
|
|
1286
|
-
isRtl:
|
|
1287
|
-
}),
|
|
1288
|
-
...
|
|
1288
|
+
totalSize: z,
|
|
1289
|
+
position: computed(() => R.value.displayScrollOffset.x),
|
|
1290
|
+
viewportSize: computed(() => R.value.displayViewportSize.width),
|
|
1291
|
+
scrollToOffset: J,
|
|
1292
|
+
containerId: P,
|
|
1293
|
+
isRtl: I
|
|
1294
|
+
}), Ie = computed(() => _.direction === "both" ? {
|
|
1295
|
+
...ue.value,
|
|
1289
1296
|
padStart: 0,
|
|
1290
1297
|
padEnd: 0
|
|
1291
|
-
} :
|
|
1292
|
-
function
|
|
1293
|
-
|
|
1298
|
+
} : ue.value);
|
|
1299
|
+
function Le() {
|
|
1300
|
+
W(), _e(), nextTick(() => {
|
|
1294
1301
|
let e = [];
|
|
1295
|
-
for (let [t, n] of
|
|
1302
|
+
for (let [t, n] of ne.entries()) n && e.push({
|
|
1296
1303
|
index: t,
|
|
1297
1304
|
inlineSize: n.offsetWidth,
|
|
1298
1305
|
blockSize: n.offsetHeight,
|
|
1299
1306
|
element: n
|
|
1300
1307
|
});
|
|
1301
|
-
e.length > 0 &&
|
|
1308
|
+
e.length > 0 && ge(e);
|
|
1302
1309
|
});
|
|
1303
1310
|
}
|
|
1304
|
-
watch(
|
|
1305
|
-
!
|
|
1311
|
+
watch(R, (e, t) => {
|
|
1312
|
+
!le.value || !e || (w("scroll", e), (!t || !t.range || !t.columnRange || e.range.start !== t.range.start || e.range.end !== t.range.end || e.columnRange.start !== t.columnRange.start || e.columnRange.end !== t.columnRange.end) && w("visibleRangeChange", {
|
|
1306
1313
|
start: e.range.start,
|
|
1307
1314
|
end: e.range.end,
|
|
1308
1315
|
colStart: e.columnRange.start,
|
|
1309
1316
|
colEnd: e.columnRange.end
|
|
1310
1317
|
}), !_.loading && (_.direction !== "horizontal" && e.totalSize && e.totalSize.height - (e.scrollOffset.y + e.viewportSize.height) <= _.loadDistance && w("load", "vertical"), _.direction !== "vertical" && e.totalSize && e.totalSize.width - (e.scrollOffset.x + e.viewportSize.width) <= _.loadDistance && w("load", "horizontal")));
|
|
1311
|
-
}), watch(
|
|
1312
|
-
e &&
|
|
1313
|
-
start:
|
|
1314
|
-
end:
|
|
1315
|
-
colStart:
|
|
1316
|
-
colEnd:
|
|
1318
|
+
}), watch(le, (e) => {
|
|
1319
|
+
e && R.value?.range && R.value?.columnRange && w("visibleRangeChange", {
|
|
1320
|
+
start: R.value.range.start,
|
|
1321
|
+
end: R.value.range.end,
|
|
1322
|
+
colStart: R.value.columnRange.start,
|
|
1323
|
+
colEnd: R.value.columnRange.end
|
|
1317
1324
|
});
|
|
1318
1325
|
}, { once: !0 });
|
|
1319
|
-
let
|
|
1326
|
+
let Re = typeof window > "u" ? null : new ResizeObserver(he), X = typeof window > "u" ? null : new ResizeObserver((e) => {
|
|
1320
1327
|
let t = [];
|
|
1321
1328
|
for (let n of e) {
|
|
1322
1329
|
let e = n.target, r = Number(e.dataset.index), i = e.dataset.colIndex, a = n.contentRect.width, o = n.contentRect.height;
|
|
@@ -1332,227 +1339,229 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1332
1339
|
element: e
|
|
1333
1340
|
});
|
|
1334
1341
|
}
|
|
1335
|
-
t.length > 0 &&
|
|
1336
|
-
}),
|
|
1337
|
-
|
|
1342
|
+
t.length > 0 && ge(t);
|
|
1343
|
+
}), Z = typeof window > "u" ? null : new ResizeObserver(() => {
|
|
1344
|
+
re.value = j.value?.offsetHeight || 0, ie.value = M.value?.offsetHeight || 0, he();
|
|
1338
1345
|
});
|
|
1339
|
-
function
|
|
1346
|
+
function ze(e, t) {
|
|
1340
1347
|
watch(e, (e, n) => {
|
|
1341
|
-
n &&
|
|
1348
|
+
n && Z?.unobserve(n), e ? Z?.observe(e) : t.value = 0;
|
|
1342
1349
|
}, { immediate: !0 });
|
|
1343
1350
|
}
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
for (let e of
|
|
1347
|
-
}), watch([
|
|
1348
|
-
t &&
|
|
1349
|
-
}), watch([
|
|
1351
|
+
ze(j, re), ze(M, ie), onMounted(() => {
|
|
1352
|
+
k.value && Re?.observe(k.value);
|
|
1353
|
+
for (let e of ne.values()) X?.observe(e), _.direction === "both" && e.querySelectorAll("[data-col-index]").forEach((e) => X?.observe(e));
|
|
1354
|
+
}), watch([k, A], ([e], [t]) => {
|
|
1355
|
+
t && Re?.unobserve(t), e && Re?.observe(e);
|
|
1356
|
+
}), watch([k, Ne], ([e, t], [n, r]) => {
|
|
1350
1357
|
let i = e !== n || t !== r;
|
|
1351
|
-
n && i && n.removeEventListener("wheel",
|
|
1358
|
+
n && i && n.removeEventListener("wheel", Qe), e && i && e.addEventListener("wheel", Qe, { passive: !t });
|
|
1352
1359
|
}, { immediate: !0 });
|
|
1353
|
-
function
|
|
1354
|
-
if (e)
|
|
1360
|
+
function Be(e, t) {
|
|
1361
|
+
if (e) ne.set(t, e), X?.observe(e), _.direction === "both" && e.querySelectorAll("[data-col-index]").forEach((e) => X?.observe(e));
|
|
1355
1362
|
else {
|
|
1356
|
-
let e =
|
|
1357
|
-
e && (
|
|
1363
|
+
let e = ne.get(t);
|
|
1364
|
+
e && (X?.unobserve(e), _.direction === "both" && e.querySelectorAll("[data-col-index]").forEach((e) => X?.unobserve(e)), ne.delete(t));
|
|
1358
1365
|
}
|
|
1359
1366
|
}
|
|
1360
|
-
let
|
|
1367
|
+
let Ve = ref(!1), He = {
|
|
1361
1368
|
x: 0,
|
|
1362
1369
|
y: 0
|
|
1363
|
-
},
|
|
1370
|
+
}, Ue = {
|
|
1364
1371
|
x: 0,
|
|
1365
1372
|
y: 0
|
|
1366
|
-
},
|
|
1373
|
+
}, We = {
|
|
1367
1374
|
x: 0,
|
|
1368
1375
|
y: 0
|
|
1369
|
-
},
|
|
1376
|
+
}, Ge = 0, Q = {
|
|
1370
1377
|
x: 0,
|
|
1371
1378
|
y: 0
|
|
1372
|
-
},
|
|
1373
|
-
function
|
|
1379
|
+
}, Ke = null;
|
|
1380
|
+
function qe() {
|
|
1374
1381
|
let e = () => {
|
|
1375
|
-
|
|
1376
|
-
let t =
|
|
1377
|
-
|
|
1382
|
+
Q.x *= FRICTION, Q.y *= FRICTION;
|
|
1383
|
+
let t = R.value.scrollOffset.x, n = R.value.scrollOffset.y;
|
|
1384
|
+
me(t + Q.x * 16, n + Q.y * 16, { behavior: "auto" }), Math.abs(Q.x) > MIN_VELOCITY || Math.abs(Q.y) > MIN_VELOCITY ? Ke = requestAnimationFrame(e) : Je();
|
|
1378
1385
|
};
|
|
1379
|
-
|
|
1386
|
+
Ke = requestAnimationFrame(e);
|
|
1380
1387
|
}
|
|
1381
|
-
function
|
|
1382
|
-
|
|
1388
|
+
function Je() {
|
|
1389
|
+
Ke !== null && (cancelAnimationFrame(Ke), Ke = null), Q = {
|
|
1383
1390
|
x: 0,
|
|
1384
1391
|
y: 0
|
|
1385
1392
|
};
|
|
1386
1393
|
}
|
|
1387
|
-
function
|
|
1388
|
-
|
|
1394
|
+
function Ye(e) {
|
|
1395
|
+
G(), Je(), Ne.value && (e.pointerType === "mouse" && e.button !== 0 || (Ve.value = !0, He = {
|
|
1389
1396
|
x: e.clientX,
|
|
1390
1397
|
y: e.clientY
|
|
1391
|
-
},
|
|
1398
|
+
}, We = {
|
|
1392
1399
|
x: e.clientX,
|
|
1393
1400
|
y: e.clientY
|
|
1394
|
-
},
|
|
1395
|
-
x:
|
|
1396
|
-
y:
|
|
1401
|
+
}, Ge = performance.now(), Ue = {
|
|
1402
|
+
x: R.value.scrollOffset.x,
|
|
1403
|
+
y: R.value.scrollOffset.y
|
|
1397
1404
|
}, e.currentTarget.setPointerCapture(e.pointerId)));
|
|
1398
1405
|
}
|
|
1399
|
-
function
|
|
1400
|
-
if (!
|
|
1401
|
-
let t = performance.now(), n = t -
|
|
1406
|
+
function Xe(e) {
|
|
1407
|
+
if (!Ve.value) return;
|
|
1408
|
+
let t = performance.now(), n = t - Ge;
|
|
1402
1409
|
if (n > 0) {
|
|
1403
|
-
let t = (
|
|
1404
|
-
|
|
1410
|
+
let t = (We.x - e.clientX) / n, r = (We.y - e.clientY) / n;
|
|
1411
|
+
Q.x = Q.x * .2 + t * .8, Q.y = Q.y * .2 + r * .8;
|
|
1405
1412
|
}
|
|
1406
|
-
|
|
1413
|
+
We = {
|
|
1407
1414
|
x: e.clientX,
|
|
1408
1415
|
y: e.clientY
|
|
1409
|
-
},
|
|
1410
|
-
let r =
|
|
1416
|
+
}, Ge = t;
|
|
1417
|
+
let r = He.x - e.clientX, i = He.y - e.clientY;
|
|
1411
1418
|
requestAnimationFrame(() => {
|
|
1412
|
-
|
|
1419
|
+
me(Ue.x + r, Ue.y + i, { behavior: "auto" });
|
|
1413
1420
|
});
|
|
1414
1421
|
}
|
|
1415
|
-
function Xe(e) {
|
|
1416
|
-
Be.value && (Be.value = !1, e.currentTarget.releasePointerCapture(e.pointerId), (Math.abs($.x) > MIN_VELOCITY || Math.abs($.y) > MIN_VELOCITY) && (Math.abs($.x) > 4 * Math.abs($.y) ? $.y = 0 : Math.abs($.y) > 4 * Math.abs($.x) && ($.x = 0), Ke()));
|
|
1417
|
-
}
|
|
1418
1422
|
function Ze(e) {
|
|
1419
|
-
|
|
1420
|
-
|
|
1423
|
+
Ve.value && (Ve.value = !1, e.currentTarget.releasePointerCapture(e.pointerId), (Math.abs(Q.x) > MIN_VELOCITY || Math.abs(Q.y) > MIN_VELOCITY) && (Math.abs(Q.x) > 4 * Math.abs(Q.y) ? Q.y = 0 : Math.abs(Q.y) > 4 * Math.abs(Q.x) && (Q.x = 0), qe()));
|
|
1424
|
+
}
|
|
1425
|
+
function Qe(e) {
|
|
1426
|
+
let { scrollOffset: t } = R.value;
|
|
1427
|
+
if (G(), Ne.value) {
|
|
1421
1428
|
e.preventDefault();
|
|
1422
1429
|
let n = e.deltaX, r = e.deltaY;
|
|
1423
|
-
e.shiftKey && n === 0 && (n = r, r = 0),
|
|
1430
|
+
e.shiftKey && n === 0 && (n = r, r = 0), me(t.x + n, t.y + r, { behavior: "auto" });
|
|
1424
1431
|
}
|
|
1425
1432
|
}
|
|
1426
|
-
function
|
|
1427
|
-
let { viewportSize: t, scrollOffset: n } =
|
|
1433
|
+
function $e(e) {
|
|
1434
|
+
let { viewportSize: t, scrollOffset: n } = R.value, r = _.direction !== "vertical", i = _.direction !== "horizontal", a = F.value.stickyStart, o = F.value.stickyEnd;
|
|
1428
1435
|
switch (e.key) {
|
|
1429
1436
|
case "Home":
|
|
1430
|
-
e.preventDefault(),
|
|
1437
|
+
e.preventDefault(), G(), V(0, 0, {
|
|
1431
1438
|
behavior: Math.max(n.x, n.y) > 10 * (_.direction === "horizontal" ? t.width : t.height) ? "auto" : "smooth",
|
|
1432
1439
|
align: "start"
|
|
1433
1440
|
});
|
|
1434
1441
|
break;
|
|
1435
1442
|
case "End": {
|
|
1436
|
-
e.preventDefault(),
|
|
1437
|
-
let r = _.items.length - 1, i = (_.columnCount || 0) > 0 ? _.columnCount - 1 : 0, { totalSize: a } =
|
|
1438
|
-
_.direction === "both" ?
|
|
1443
|
+
e.preventDefault(), G();
|
|
1444
|
+
let r = _.items.length - 1, i = (_.columnCount || 0) > 0 ? _.columnCount - 1 : 0, { totalSize: a } = R.value, o = Math.max(a.width - n.x - t.width, a.height - n.y - t.height) > 10 * (_.direction === "horizontal" ? t.width : t.height) ? "auto" : "smooth";
|
|
1445
|
+
_.direction === "both" ? V(r, i, {
|
|
1439
1446
|
behavior: o,
|
|
1440
1447
|
align: "end"
|
|
1441
|
-
}) :
|
|
1448
|
+
}) : V(_.direction === "vertical" ? r : 0, _.direction === "horizontal" ? r : 0, {
|
|
1442
1449
|
behavior: o,
|
|
1443
1450
|
align: "end"
|
|
1444
1451
|
});
|
|
1445
1452
|
break;
|
|
1446
1453
|
}
|
|
1447
1454
|
case "ArrowUp": {
|
|
1448
|
-
if (e.preventDefault(),
|
|
1449
|
-
let { currentIndex: t, scrollOffset: n } =
|
|
1450
|
-
|
|
1455
|
+
if (e.preventDefault(), G(), !i) return;
|
|
1456
|
+
let { currentIndex: t, scrollOffset: n } = R.value, r = n.y + a.y + F.value.scrollPaddingStart.y;
|
|
1457
|
+
Ee(t) < r - 1 ? V(t, null, { align: "start" }) : t > 0 && V(t - 1, null, { align: "start" });
|
|
1451
1458
|
break;
|
|
1452
1459
|
}
|
|
1453
1460
|
case "ArrowDown": {
|
|
1454
|
-
if (e.preventDefault(),
|
|
1455
|
-
let { currentEndIndex: r } =
|
|
1456
|
-
|
|
1461
|
+
if (e.preventDefault(), G(), !i) return;
|
|
1462
|
+
let { currentEndIndex: r } = R.value, a = n.y + t.height - (o.y + F.value.scrollPaddingEnd.y);
|
|
1463
|
+
Ee(r) + pe(r) > a + 1 ? V(r, null, { align: "end" }) : r < _.items.length - 1 && V(r + 1, null, { align: "end" });
|
|
1457
1464
|
break;
|
|
1458
1465
|
}
|
|
1459
1466
|
case "ArrowLeft": {
|
|
1460
|
-
if (e.preventDefault(),
|
|
1461
|
-
let { currentColIndex: i, currentEndColIndex: s } =
|
|
1462
|
-
if (
|
|
1463
|
-
let e = n.x + t.width - (o.x +
|
|
1464
|
-
(_.columnCount ?
|
|
1467
|
+
if (e.preventDefault(), G(), !r) return;
|
|
1468
|
+
let { currentColIndex: i, currentEndColIndex: s } = R.value;
|
|
1469
|
+
if (I.value) {
|
|
1470
|
+
let e = n.x + t.width - (o.x + F.value.scrollPaddingEnd.x);
|
|
1471
|
+
(_.columnCount ? U(s) + B(s) : ye(s) + De(s)) > e + 1 ? V(null, s, { align: "end" }) : s < (_.columnCount ? _.columnCount - 1 : _.items.length - 1) && V(null, s + 1, { align: "end" });
|
|
1465
1472
|
} else {
|
|
1466
|
-
let e = n.x + a.x +
|
|
1467
|
-
(_.columnCount ?
|
|
1473
|
+
let e = n.x + a.x + F.value.scrollPaddingStart.x;
|
|
1474
|
+
(_.columnCount ? U(i) : ye(i)) < e - 1 ? V(null, i, { align: "start" }) : i > 0 && V(null, i - 1, { align: "start" });
|
|
1468
1475
|
}
|
|
1469
1476
|
break;
|
|
1470
1477
|
}
|
|
1471
1478
|
case "ArrowRight": {
|
|
1472
|
-
if (e.preventDefault(),
|
|
1473
|
-
let { currentColIndex: i, currentEndColIndex: s } =
|
|
1474
|
-
if (
|
|
1475
|
-
let e = n.x + a.x +
|
|
1476
|
-
(_.columnCount ?
|
|
1479
|
+
if (e.preventDefault(), G(), !r) return;
|
|
1480
|
+
let { currentColIndex: i, currentEndColIndex: s } = R.value;
|
|
1481
|
+
if (I.value) {
|
|
1482
|
+
let e = n.x + a.x + F.value.scrollPaddingStart.x;
|
|
1483
|
+
(_.columnCount ? U(i) : ye(i)) < e - 1 ? V(null, i, { align: "start" }) : i > 0 && V(null, i - 1, { align: "start" });
|
|
1477
1484
|
} else {
|
|
1478
|
-
let e = n.x + t.width - (o.x +
|
|
1479
|
-
(_.columnCount ?
|
|
1485
|
+
let e = n.x + t.width - (o.x + F.value.scrollPaddingEnd.x);
|
|
1486
|
+
(_.columnCount ? U(s) + B(s) : ye(s) + De(s)) > e + 1 ? V(null, s, { align: "end" }) : s < (_.columnCount ? _.columnCount - 1 : _.items.length - 1) && V(null, s + 1, { align: "end" });
|
|
1480
1487
|
}
|
|
1481
1488
|
break;
|
|
1482
1489
|
}
|
|
1483
1490
|
case "PageUp":
|
|
1484
|
-
e.preventDefault(),
|
|
1491
|
+
e.preventDefault(), G(), me(!i && r ? n.x - t.width : null, i ? n.y - t.height : null);
|
|
1485
1492
|
break;
|
|
1486
1493
|
case "PageDown":
|
|
1487
|
-
e.preventDefault(),
|
|
1494
|
+
e.preventDefault(), G(), me(!i && r ? n.x + t.width : null, i ? n.y + t.height : null);
|
|
1488
1495
|
break;
|
|
1489
1496
|
}
|
|
1490
1497
|
}
|
|
1491
1498
|
onUnmounted(() => {
|
|
1492
|
-
|
|
1499
|
+
Re?.disconnect(), X?.disconnect(), Z?.disconnect();
|
|
1493
1500
|
});
|
|
1494
|
-
let
|
|
1501
|
+
let et = computed(() => {
|
|
1495
1502
|
let e = { ..._.direction === "vertical" ? {} : { whiteSpace: "nowrap" } };
|
|
1496
|
-
return (
|
|
1503
|
+
return (Pe.value || !ke.value) && (e.overflow = "auto"), Ne.value && (e.touchAction = "none"), ke.value ? e : _.containerTag === "table" ? {
|
|
1497
1504
|
...e,
|
|
1498
1505
|
display: "block",
|
|
1499
1506
|
minInlineSize: _.direction === "vertical" ? "100%" : "auto"
|
|
1500
1507
|
} : e;
|
|
1501
|
-
}),
|
|
1508
|
+
}), tt = computed(() => {
|
|
1502
1509
|
if (_.direction === "horizontal") return null;
|
|
1503
|
-
let { displayViewportSize: e, displayScrollOffset: t } =
|
|
1504
|
-
if (
|
|
1510
|
+
let { displayViewportSize: e, displayScrollOffset: t } = R.value;
|
|
1511
|
+
if (de.value <= e.height) return null;
|
|
1505
1512
|
let n = {
|
|
1506
1513
|
axis: "vertical",
|
|
1507
|
-
totalSize:
|
|
1514
|
+
totalSize: de.value,
|
|
1508
1515
|
position: t.y,
|
|
1509
1516
|
viewportSize: e.height,
|
|
1510
|
-
scrollToOffset:
|
|
1511
|
-
containerId:
|
|
1512
|
-
isRtl:
|
|
1517
|
+
scrollToOffset: q,
|
|
1518
|
+
containerId: P.value,
|
|
1519
|
+
isRtl: I.value,
|
|
1520
|
+
ariaLabel: "Vertical scroll"
|
|
1513
1521
|
};
|
|
1514
1522
|
return {
|
|
1515
1523
|
axis: "vertical",
|
|
1516
|
-
positionPercent:
|
|
1517
|
-
viewportPercent:
|
|
1518
|
-
thumbSizePercent:
|
|
1519
|
-
thumbPositionPercent:
|
|
1520
|
-
trackProps:
|
|
1521
|
-
thumbProps:
|
|
1524
|
+
positionPercent: Y.positionPercent.value,
|
|
1525
|
+
viewportPercent: Y.viewportPercent.value,
|
|
1526
|
+
thumbSizePercent: Y.thumbSizePercent.value,
|
|
1527
|
+
thumbPositionPercent: Y.thumbPositionPercent.value,
|
|
1528
|
+
trackProps: Y.trackProps.value,
|
|
1529
|
+
thumbProps: Y.thumbProps.value,
|
|
1522
1530
|
scrollbarProps: n,
|
|
1523
|
-
isDragging:
|
|
1531
|
+
isDragging: Y.isDragging.value
|
|
1524
1532
|
};
|
|
1525
|
-
}),
|
|
1533
|
+
}), nt = computed(() => {
|
|
1526
1534
|
if (_.direction === "vertical") return null;
|
|
1527
|
-
let { displayViewportSize: e, displayScrollOffset: t } =
|
|
1528
|
-
if (
|
|
1535
|
+
let { displayViewportSize: e, displayScrollOffset: t } = R.value;
|
|
1536
|
+
if (z.value <= e.width) return null;
|
|
1529
1537
|
let n = {
|
|
1530
1538
|
axis: "horizontal",
|
|
1531
|
-
totalSize:
|
|
1539
|
+
totalSize: z.value,
|
|
1532
1540
|
position: t.x,
|
|
1533
1541
|
viewportSize: e.width,
|
|
1534
|
-
scrollToOffset:
|
|
1535
|
-
containerId:
|
|
1536
|
-
isRtl:
|
|
1542
|
+
scrollToOffset: J,
|
|
1543
|
+
containerId: P.value,
|
|
1544
|
+
isRtl: I.value,
|
|
1545
|
+
ariaLabel: "Horizontal scroll"
|
|
1537
1546
|
};
|
|
1538
1547
|
return {
|
|
1539
1548
|
axis: "horizontal",
|
|
1540
|
-
positionPercent:
|
|
1541
|
-
viewportPercent:
|
|
1542
|
-
thumbSizePercent:
|
|
1543
|
-
thumbPositionPercent:
|
|
1544
|
-
trackProps:
|
|
1545
|
-
thumbProps:
|
|
1549
|
+
positionPercent: Fe.positionPercent.value,
|
|
1550
|
+
viewportPercent: Fe.viewportPercent.value,
|
|
1551
|
+
thumbSizePercent: Fe.thumbSizePercent.value,
|
|
1552
|
+
thumbPositionPercent: Fe.thumbPositionPercent.value,
|
|
1553
|
+
trackProps: Fe.trackProps.value,
|
|
1554
|
+
thumbProps: Fe.thumbProps.value,
|
|
1546
1555
|
scrollbarProps: n,
|
|
1547
|
-
isDragging:
|
|
1556
|
+
isDragging: Fe.isDragging.value
|
|
1548
1557
|
};
|
|
1549
|
-
}),
|
|
1558
|
+
}), rt = computed(() => {
|
|
1550
1559
|
let e = _.direction === "horizontal", t = _.direction === "vertical", n = _.direction === "both", r = {
|
|
1551
|
-
inlineSize: t ? "100%" : `${
|
|
1552
|
-
blockSize: e ? "100%" : `${
|
|
1560
|
+
inlineSize: t ? "100%" : `${je.value}px`,
|
|
1561
|
+
blockSize: e ? "100%" : `${Me.value}px`
|
|
1553
1562
|
};
|
|
1554
|
-
return
|
|
1555
|
-
}),
|
|
1563
|
+
return le.value || (r.display = "flex", r.flexDirection = e ? "row" : "column", (e || n) && _.columnGap && (r.columnGap = `${_.columnGap}px`), (t || n) && _.gap && (r.rowGap = `${_.gap}px`)), r;
|
|
1564
|
+
}), it = computed(() => {
|
|
1556
1565
|
let e = _.direction === "horizontal";
|
|
1557
1566
|
return {
|
|
1558
1567
|
display: e ? "inline-block" : "block",
|
|
@@ -1561,96 +1570,137 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1561
1570
|
verticalAlign: "top"
|
|
1562
1571
|
} : { inlineSize: "100%" }
|
|
1563
1572
|
};
|
|
1564
|
-
}),
|
|
1565
|
-
inlineSize: _.direction === "vertical" ? "1px" : `${
|
|
1566
|
-
blockSize: _.direction === "horizontal" ? "1px" : `${
|
|
1573
|
+
}), at = computed(() => ({
|
|
1574
|
+
inlineSize: _.direction === "vertical" ? "1px" : `${je.value}px`,
|
|
1575
|
+
blockSize: _.direction === "horizontal" ? "1px" : `${Me.value}px`
|
|
1567
1576
|
}));
|
|
1568
|
-
function
|
|
1577
|
+
function ot(e) {
|
|
1569
1578
|
let t = calculateItemStyle({
|
|
1570
1579
|
containerTag: _.containerTag || "div",
|
|
1571
1580
|
direction: _.direction,
|
|
1572
|
-
isHydrated:
|
|
1581
|
+
isHydrated: le.value,
|
|
1573
1582
|
item: e,
|
|
1574
1583
|
itemSize: _.itemSize,
|
|
1575
|
-
paddingStartX:
|
|
1576
|
-
paddingStartY:
|
|
1577
|
-
isRtl:
|
|
1584
|
+
paddingStartX: F.value.scrollPaddingStart.x,
|
|
1585
|
+
paddingStartY: F.value.scrollPaddingStart.y,
|
|
1586
|
+
isRtl: I.value
|
|
1578
1587
|
});
|
|
1579
|
-
return !
|
|
1588
|
+
return !le.value && _.direction === "both" && (t.display = "flex", _.columnGap && (t.columnGap = `${_.columnGap}px`)), t;
|
|
1589
|
+
}
|
|
1590
|
+
let st = computed(() => _.debug), $ = computed(() => _.containerTag === "table"), ct = computed(() => $.value ? "thead" : "div"), lt = computed(() => $.value ? "tfoot" : "div"), ut = computed(() => _.role ? _.role : $.value ? null : _.direction === "both" ? "grid" : "list"), dt = computed(() => ut.value === "grid" || $.value), ft = computed(() => $.value ? null : _.ariaLabel || _.ariaLabelledby ? "region" : "none"), pt = computed(() => $.value ? null : ut.value), mt = computed(() => {
|
|
1591
|
+
if (dt.value) return "row";
|
|
1592
|
+
let e = ut.value;
|
|
1593
|
+
return e === "tree" ? "treeitem" : e === "listbox" ? "option" : e === "menu" ? "menuitem" : "listitem";
|
|
1594
|
+
}), ht = computed(() => _.itemRole == null ? mt.value : _.itemRole), gt = computed(() => _.role === "grid" || !_.role && _.direction === "both" ? "gridcell" : $.value ? "cell" : null), _t = computed(() => {
|
|
1595
|
+
let e = ht.value;
|
|
1596
|
+
return e == null || e !== "none" && e !== "presentation";
|
|
1597
|
+
}), vt = computed(() => ({
|
|
1598
|
+
"aria-label": _.ariaLabel,
|
|
1599
|
+
"aria-labelledby": _.ariaLabelledby,
|
|
1600
|
+
"aria-busy": _.loading ? "true" : void 0
|
|
1601
|
+
})), yt = computed(() => {
|
|
1602
|
+
let e = {}, t = ut.value;
|
|
1603
|
+
return t && [
|
|
1604
|
+
"grid",
|
|
1605
|
+
"tree",
|
|
1606
|
+
"listbox",
|
|
1607
|
+
"menu",
|
|
1608
|
+
"tablist"
|
|
1609
|
+
].includes(t) && (e["aria-orientation"] = _.direction === "both" ? void 0 : _.direction), dt.value && (e["aria-rowcount"] = _.items.length, _.columnCount > 0 && (e["aria-colcount"] = _.columnCount)), e;
|
|
1610
|
+
});
|
|
1611
|
+
function bt(e) {
|
|
1612
|
+
let t = {};
|
|
1613
|
+
dt.value ? t["aria-rowindex"] = e + 1 : (t["aria-setsize"] = _.items.length, t["aria-posinset"] = e + 1);
|
|
1614
|
+
let n = ht.value;
|
|
1615
|
+
return n !== null && (t.role = n === "none" || n === "presentation" ? mt.value : n), t;
|
|
1616
|
+
}
|
|
1617
|
+
function xt(e) {
|
|
1618
|
+
let t = gt.value;
|
|
1619
|
+
if (!t) return {};
|
|
1620
|
+
let n = { role: t };
|
|
1621
|
+
return dt.value && (n["aria-colindex"] = e + 1), n;
|
|
1580
1622
|
}
|
|
1581
|
-
let ot = computed(() => _.debug), st = computed(() => _.containerTag === "table"), ct = computed(() => st.value ? "thead" : "div"), lt = computed(() => st.value ? "tfoot" : "div");
|
|
1582
1623
|
return s({
|
|
1583
1624
|
...toRefs(_),
|
|
1584
|
-
scrollDetails:
|
|
1585
|
-
columnRange:
|
|
1586
|
-
getColumnWidth:
|
|
1587
|
-
getRowHeight:
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1625
|
+
scrollDetails: R,
|
|
1626
|
+
columnRange: ue,
|
|
1627
|
+
getColumnWidth: B,
|
|
1628
|
+
getRowHeight: pe,
|
|
1629
|
+
getCellAriaProps: xt,
|
|
1630
|
+
getItemAriaProps: bt,
|
|
1631
|
+
getRowOffset: Ee,
|
|
1632
|
+
getColumnOffset: U,
|
|
1633
|
+
getItemOffset: ye,
|
|
1634
|
+
getItemSize: De,
|
|
1635
|
+
scrollToIndex: V,
|
|
1636
|
+
scrollToOffset: me,
|
|
1637
|
+
refresh: Le,
|
|
1595
1638
|
stopProgrammaticScroll: () => {
|
|
1596
|
-
|
|
1639
|
+
G(), Je();
|
|
1597
1640
|
},
|
|
1598
|
-
updateDirection:
|
|
1599
|
-
isRtl:
|
|
1600
|
-
isHydrated:
|
|
1601
|
-
scaleX:
|
|
1602
|
-
scaleY:
|
|
1603
|
-
renderedWidth:
|
|
1604
|
-
renderedHeight:
|
|
1605
|
-
componentOffset:
|
|
1606
|
-
scrollbarPropsVertical:
|
|
1607
|
-
scrollbarPropsHorizontal:
|
|
1608
|
-
}), (t, s) => (openBlock(), createBlock(resolveDynamicComponent(o.containerTag), {
|
|
1609
|
-
id:
|
|
1641
|
+
updateDirection: _e,
|
|
1642
|
+
isRtl: I,
|
|
1643
|
+
isHydrated: le,
|
|
1644
|
+
scaleX: K,
|
|
1645
|
+
scaleY: Oe,
|
|
1646
|
+
renderedWidth: z,
|
|
1647
|
+
renderedHeight: de,
|
|
1648
|
+
componentOffset: Ae,
|
|
1649
|
+
scrollbarPropsVertical: tt,
|
|
1650
|
+
scrollbarPropsHorizontal: nt
|
|
1651
|
+
}), (t, s) => (openBlock(), createBlock(resolveDynamicComponent(o.containerTag), mergeProps({
|
|
1652
|
+
id: P.value,
|
|
1610
1653
|
ref_key: "hostRef",
|
|
1611
|
-
ref:
|
|
1612
|
-
class:
|
|
1613
|
-
"virtual-scroll--hydrated": unref(
|
|
1614
|
-
"virtual-scroll--window": unref(
|
|
1615
|
-
"virtual-scroll--table":
|
|
1616
|
-
"virtual-scroll--hide-scrollbar":
|
|
1617
|
-
}]]
|
|
1618
|
-
style:
|
|
1654
|
+
ref: k,
|
|
1655
|
+
class: ["virtual-scroll-container", [`virtual-scroll--${o.direction}`, {
|
|
1656
|
+
"virtual-scroll--hydrated": unref(le),
|
|
1657
|
+
"virtual-scroll--window": unref(ke),
|
|
1658
|
+
"virtual-scroll--table": $.value,
|
|
1659
|
+
"virtual-scroll--hide-scrollbar": Pe.value
|
|
1660
|
+
}]],
|
|
1661
|
+
style: et.value,
|
|
1619
1662
|
tabindex: "0",
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1663
|
+
role: $.value ? void 0 : ft.value
|
|
1664
|
+
}, $.value ? {
|
|
1665
|
+
...vt.value,
|
|
1666
|
+
...yt.value
|
|
1667
|
+
} : vt.value, {
|
|
1668
|
+
onKeydown: $e,
|
|
1669
|
+
onPointerdown: Ye,
|
|
1670
|
+
onPointermove: Xe,
|
|
1671
|
+
onPointerup: Ze,
|
|
1672
|
+
onPointercancel: Ze
|
|
1673
|
+
}), {
|
|
1626
1674
|
default: withCtx(() => [
|
|
1627
|
-
|
|
1675
|
+
Pe.value ? (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", {
|
|
1628
1676
|
class: "virtual-scroll-scrollbar-viewport",
|
|
1629
1677
|
style: normalizeStyle({
|
|
1630
|
-
inlineSize: `${unref(
|
|
1631
|
-
blockSize: `${unref(
|
|
1678
|
+
inlineSize: `${unref(R).displayViewportSize.width}px`,
|
|
1679
|
+
blockSize: `${unref(R).displayViewportSize.height}px`,
|
|
1632
1680
|
"--vsi-scrollbar-has-cross-gap": o.direction === "both" ? 1 : 0
|
|
1633
1681
|
})
|
|
1634
|
-
}, [
|
|
1635
|
-
|
|
1682
|
+
}, [O.scrollbar && tt.value ? renderSlot(t.$slots, "scrollbar", normalizeProps(mergeProps({ key: 0 }, tt.value)), void 0, !0) : tt.value ? (openBlock(), createBlock(VirtualScrollbar_default, normalizeProps(mergeProps({ key: 1 }, tt.value.scrollbarProps)), null, 16)) : createCommentVNode("", !0), O.scrollbar && nt.value ? renderSlot(t.$slots, "scrollbar", normalizeProps(mergeProps({ key: 2 }, nt.value)), void 0, !0) : nt.value ? (openBlock(), createBlock(VirtualScrollbar_default, normalizeProps(mergeProps({ key: 3 }, nt.value.scrollbarProps)), null, 16)) : createCommentVNode("", !0)], 4)])) : createCommentVNode("", !0),
|
|
1683
|
+
O.header ? (openBlock(), createBlock(resolveDynamicComponent(ct.value), {
|
|
1636
1684
|
key: 1,
|
|
1637
1685
|
ref_key: "headerRef",
|
|
1638
|
-
ref:
|
|
1639
|
-
class: normalizeClass(["virtual-scroll-header", { "virtual-scroll--sticky": o.stickyHeader }])
|
|
1686
|
+
ref: j,
|
|
1687
|
+
class: normalizeClass(["virtual-scroll-header", { "virtual-scroll--sticky": o.stickyHeader }]),
|
|
1688
|
+
role: $.value ? void 0 : "none"
|
|
1640
1689
|
}, {
|
|
1641
1690
|
default: withCtx(() => [renderSlot(t.$slots, "header", {}, void 0, !0)]),
|
|
1642
1691
|
_: 3
|
|
1643
|
-
}, 8, ["class"])) : createCommentVNode("", !0),
|
|
1644
|
-
(openBlock(), createBlock(resolveDynamicComponent(o.wrapperTag), {
|
|
1692
|
+
}, 8, ["class", "role"])) : createCommentVNode("", !0),
|
|
1693
|
+
(openBlock(), createBlock(resolveDynamicComponent(o.wrapperTag), mergeProps({
|
|
1645
1694
|
ref_key: "wrapperRef",
|
|
1646
|
-
ref:
|
|
1695
|
+
ref: A,
|
|
1647
1696
|
class: "virtual-scroll-wrapper",
|
|
1648
|
-
style:
|
|
1649
|
-
|
|
1650
|
-
|
|
1697
|
+
style: rt.value,
|
|
1698
|
+
role: $.value ? void 0 : pt.value
|
|
1699
|
+
}, $.value ? {} : yt.value), {
|
|
1700
|
+
default: withCtx(() => [$.value ? (openBlock(), createBlock(resolveDynamicComponent(o.itemTag), {
|
|
1651
1701
|
key: 0,
|
|
1652
1702
|
class: "virtual-scroll-spacer",
|
|
1653
|
-
style: normalizeStyle(
|
|
1703
|
+
style: normalizeStyle(at.value)
|
|
1654
1704
|
}, {
|
|
1655
1705
|
default: withCtx(() => [...s[0] ||= [createElementVNode("td", { style: {
|
|
1656
1706
|
padding: "0",
|
|
@@ -1658,22 +1708,24 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1658
1708
|
"block-size": "inherit"
|
|
1659
1709
|
} }, null, -1)]]),
|
|
1660
1710
|
_: 1
|
|
1661
|
-
}, 8, ["style"])) : createCommentVNode("", !0), (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(
|
|
1711
|
+
}, 8, ["style"])) : createCommentVNode("", !0), (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(L), (e) => (openBlock(), createBlock(resolveDynamicComponent(o.itemTag), mergeProps({
|
|
1662
1712
|
key: e.index,
|
|
1663
1713
|
ref_for: !0,
|
|
1664
|
-
ref: (t) =>
|
|
1714
|
+
ref: (t) => Be(t, e.index),
|
|
1665
1715
|
"data-index": e.index,
|
|
1666
|
-
class:
|
|
1716
|
+
class: ["virtual-scroll-item", {
|
|
1667
1717
|
"virtual-scroll--sticky": e.isStickyActive,
|
|
1668
|
-
"virtual-scroll--debug":
|
|
1669
|
-
}]
|
|
1670
|
-
style:
|
|
1671
|
-
}, {
|
|
1718
|
+
"virtual-scroll--debug": st.value
|
|
1719
|
+
}],
|
|
1720
|
+
style: ot(e)
|
|
1721
|
+
}, { ref_for: !0 }, _t.value ? bt(e.index) : { role: "none" }), {
|
|
1672
1722
|
default: withCtx(() => [renderSlot(t.$slots, "item", {
|
|
1673
1723
|
item: e.item,
|
|
1674
1724
|
index: e.index,
|
|
1675
|
-
|
|
1676
|
-
|
|
1725
|
+
getItemAriaProps: bt,
|
|
1726
|
+
columnRange: Ie.value,
|
|
1727
|
+
getColumnWidth: unref(B),
|
|
1728
|
+
getCellAriaProps: xt,
|
|
1677
1729
|
gap: _.gap,
|
|
1678
1730
|
columnGap: _.columnGap,
|
|
1679
1731
|
isSticky: e.isSticky,
|
|
@@ -1681,38 +1733,42 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1681
1733
|
isStickyActiveX: e.isStickyActiveX,
|
|
1682
1734
|
isStickyActiveY: e.isStickyActiveY,
|
|
1683
1735
|
offset: e.offset
|
|
1684
|
-
}, void 0, !0),
|
|
1736
|
+
}, void 0, !0), st.value ? (openBlock(), createElementBlock("div", _hoisted_2, " #" + toDisplayString(e.index) + " (" + toDisplayString(Math.round(e.offset.x)) + ", " + toDisplayString(Math.round(e.offset.y)) + ") ", 1)) : createCommentVNode("", !0)]),
|
|
1685
1737
|
_: 2
|
|
1686
|
-
},
|
|
1738
|
+
}, 1040, [
|
|
1687
1739
|
"data-index",
|
|
1688
1740
|
"class",
|
|
1689
1741
|
"style"
|
|
1690
1742
|
]))), 128))]),
|
|
1691
1743
|
_: 3
|
|
1692
|
-
},
|
|
1693
|
-
o.loading &&
|
|
1744
|
+
}, 16, ["style", "role"])),
|
|
1745
|
+
o.loading && O.loading ? (openBlock(), createElementBlock("div", {
|
|
1694
1746
|
key: 2,
|
|
1695
1747
|
class: "virtual-scroll-loading",
|
|
1696
|
-
style: normalizeStyle(
|
|
1748
|
+
style: normalizeStyle(it.value),
|
|
1749
|
+
"aria-live": "polite",
|
|
1750
|
+
"aria-atomic": "true"
|
|
1697
1751
|
}, [renderSlot(t.$slots, "loading", {}, void 0, !0)], 4)) : createCommentVNode("", !0),
|
|
1698
|
-
|
|
1752
|
+
O.footer ? (openBlock(), createBlock(resolveDynamicComponent(lt.value), {
|
|
1699
1753
|
key: 3,
|
|
1700
1754
|
ref_key: "footerRef",
|
|
1701
|
-
ref:
|
|
1702
|
-
class: normalizeClass(["virtual-scroll-footer", { "virtual-scroll--sticky": o.stickyFooter }])
|
|
1755
|
+
ref: M,
|
|
1756
|
+
class: normalizeClass(["virtual-scroll-footer", { "virtual-scroll--sticky": o.stickyFooter }]),
|
|
1757
|
+
role: $.value ? void 0 : "none"
|
|
1703
1758
|
}, {
|
|
1704
1759
|
default: withCtx(() => [renderSlot(t.$slots, "footer", {}, void 0, !0)]),
|
|
1705
1760
|
_: 3
|
|
1706
|
-
}, 8, ["class"])) : createCommentVNode("", !0)
|
|
1761
|
+
}, 8, ["class", "role"])) : createCommentVNode("", !0)
|
|
1707
1762
|
]),
|
|
1708
1763
|
_: 3
|
|
1709
|
-
},
|
|
1764
|
+
}, 16, [
|
|
1710
1765
|
"id",
|
|
1711
1766
|
"class",
|
|
1712
|
-
"style"
|
|
1767
|
+
"style",
|
|
1768
|
+
"role"
|
|
1713
1769
|
]));
|
|
1714
1770
|
}
|
|
1715
|
-
}), [["__scopeId", "data-v-
|
|
1771
|
+
}), [["__scopeId", "data-v-184bc0a9"]]);
|
|
1716
1772
|
export { BROWSER_MAX_SIZE, DEFAULT_BUFFER, DEFAULT_COLUMN_WIDTH, DEFAULT_ITEM_SIZE, EMPTY_SCROLL_DETAILS, FenwickTree, VirtualScroll_default as VirtualScroll, VirtualScrollbar_default as VirtualScrollbar, calculateColumnRange, calculateItemPosition, calculateItemStyle, calculateRange, calculateScrollTarget, calculateStickyItem, calculateTotalSize, displayToVirtual, findPrevStickyIndex, getPaddingX, getPaddingY, isBody, isElement, isItemVisible, isScrollToIndexOptions, isScrollableElement, isWindow, isWindowLike, scrollTo, useVirtualScroll, useVirtualScrollbar, virtualToDisplay };
|
|
1717
1773
|
|
|
1718
1774
|
//# sourceMappingURL=index.mjs.map
|