@pdanpdan/virtual-scroll 0.9.1 → 0.10.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/README.md +82 -4
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +170 -153
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +833 -692
- package/dist/index.mjs.map +1 -1
- package/dist/virtual-scroll.css +1 -1
- package/package.json +1 -1
- package/src/components/VirtualScroll.vue +30 -20
- package/src/composables/useVirtualScroll.ts +365 -804
- package/src/composables/useVirtualScrollSizes.ts +28 -37
- package/src/composables/useVirtualScrollbar.ts +16 -0
- package/src/extensions/all.ts +7 -0
- package/src/extensions/coordinate-scaling.ts +30 -0
- package/src/extensions/index.ts +88 -0
- package/src/extensions/infinite-loading.ts +47 -0
- package/src/extensions/prepend-restoration.ts +49 -0
- package/src/extensions/rtl.ts +42 -0
- package/src/extensions/snapping.ts +82 -0
- package/src/extensions/sticky.ts +43 -0
- package/src/types.ts +27 -7
- package/src/utils/scroll.ts +1 -1
- package/src/utils/virtual-scroll-logic.ts +33 -0
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, getCurrentInstance, guardReactiveProps, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onMounted, onUnmounted, openBlock, reactive, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toRefs, toValue, unref, useId, useSlots, watch, withCtx } from "vue";
|
|
1
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, getCurrentInstance, guardReactiveProps, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onMounted, onUnmounted, openBlock, reactive, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toRefs, toValue, unref, useId, useSlots, watch, watchEffect, withCtx } from "vue";
|
|
2
2
|
const DEFAULT_ITEM_SIZE = 40, DEFAULT_COLUMN_WIDTH = 100, DEFAULT_BUFFER = 5, EMPTY_SCROLL_DETAILS = {
|
|
3
3
|
items: [],
|
|
4
4
|
currentIndex: 0,
|
|
@@ -39,7 +39,7 @@ const DEFAULT_ITEM_SIZE = 40, DEFAULT_COLUMN_WIDTH = 100, DEFAULT_BUFFER = 5, EM
|
|
|
39
39
|
}
|
|
40
40
|
}, BROWSER_MAX_SIZE = 1e7;
|
|
41
41
|
function isWindow(e) {
|
|
42
|
-
return e === null || e === document.documentElement || typeof window < "u" && e === window;
|
|
42
|
+
return e === null || typeof document < "u" && e === document.documentElement || typeof window < "u" && e === window;
|
|
43
43
|
}
|
|
44
44
|
function isBody(e) {
|
|
45
45
|
return typeof e == "object" && !!e && "tagName" in e && e.tagName === "BODY";
|
|
@@ -188,14 +188,14 @@ function displayToVirtual(e, t, n) {
|
|
|
188
188
|
function virtualToDisplay(e, t, n) {
|
|
189
189
|
return e / n + t;
|
|
190
190
|
}
|
|
191
|
-
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:
|
|
192
|
-
let
|
|
193
|
-
|
|
194
|
-
let
|
|
191
|
+
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: E = 0, stickyEndX: D = 0, stickyEndY: te = 0, flowPaddingStartX: ne = 0, flowPaddingStartY: O = 0, paddingStartX: k = 0, paddingStartY: A = 0, paddingEndX: re = 0, paddingEndY: ie = 0 }) {
|
|
192
|
+
let j;
|
|
193
|
+
j = isScrollToIndexOptions(n) ? n.align : n;
|
|
194
|
+
let N = (j && typeof j == "object" ? j.x : j) || "auto", ae = (j && typeof j == "object" ? j.y : j) || "auto", oe = f, se = p, ce = 0, le = 0, de = "auto", fe = "auto", P = b === 1 ? o : BROWSER_MAX_SIZE, F = x === 1 ? s : BROWSER_MAX_SIZE, pe = Math.max(0, S + P - i), me = Math.max(0, C + F - a), I = (pe - S) * b, L = (me - C) * x, he = ne + T + k, z = O + E + A;
|
|
195
195
|
if (e != null) {
|
|
196
196
|
let t = calculateAxisTarget({
|
|
197
197
|
index: e,
|
|
198
|
-
align:
|
|
198
|
+
align: ae,
|
|
199
199
|
viewSize: a,
|
|
200
200
|
scrollPos: p,
|
|
201
201
|
fixedSize: u,
|
|
@@ -203,15 +203,15 @@ function calculateScrollTarget({ rowIndex: e, colIndex: t, options: n, direction
|
|
|
203
203
|
query: g,
|
|
204
204
|
getSize: m,
|
|
205
205
|
stickyIndices: w,
|
|
206
|
-
stickyStart:
|
|
207
|
-
stickyEnd:
|
|
206
|
+
stickyStart: E + A,
|
|
207
|
+
stickyEnd: te + ie
|
|
208
208
|
});
|
|
209
|
-
|
|
209
|
+
se = t.target + z, le = t.itemSize, fe = t.effectiveAlign;
|
|
210
210
|
}
|
|
211
211
|
if (t != null) {
|
|
212
212
|
let e = r === "both", n = calculateAxisTarget({
|
|
213
213
|
index: t,
|
|
214
|
-
align:
|
|
214
|
+
align: N,
|
|
215
215
|
viewSize: i,
|
|
216
216
|
scrollPos: f,
|
|
217
217
|
fixedSize: e ? d : u,
|
|
@@ -219,18 +219,18 @@ function calculateScrollTarget({ rowIndex: e, colIndex: t, options: n, direction
|
|
|
219
219
|
query: e ? y : _,
|
|
220
220
|
getSize: e ? v : h,
|
|
221
221
|
stickyIndices: w,
|
|
222
|
-
stickyStart: T +
|
|
223
|
-
stickyEnd:
|
|
222
|
+
stickyStart: T + k,
|
|
223
|
+
stickyEnd: D + re
|
|
224
224
|
});
|
|
225
|
-
|
|
225
|
+
oe = n.target + he, ce = n.itemSize, de = n.effectiveAlign;
|
|
226
226
|
}
|
|
227
|
-
return
|
|
228
|
-
targetX:
|
|
229
|
-
targetY:
|
|
230
|
-
itemWidth:
|
|
231
|
-
itemHeight:
|
|
232
|
-
effectiveAlignX:
|
|
233
|
-
effectiveAlignY:
|
|
227
|
+
return oe = Math.max(0, Math.min(oe, I)), se = Math.max(0, Math.min(se, L)), {
|
|
228
|
+
targetX: oe,
|
|
229
|
+
targetY: se,
|
|
230
|
+
itemWidth: ce,
|
|
231
|
+
itemHeight: le,
|
|
232
|
+
effectiveAlignX: de,
|
|
233
|
+
effectiveAlignY: fe
|
|
234
234
|
};
|
|
235
235
|
}
|
|
236
236
|
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 }) {
|
|
@@ -364,6 +364,19 @@ function resolveSnap(e, t, n, r, i, a, o, s, c, l) {
|
|
|
364
364
|
if (e === "auto") if (t === "start") u = "end";
|
|
365
365
|
else if (t === "end") u = "start";
|
|
366
366
|
else return null;
|
|
367
|
+
if (e === "next") {
|
|
368
|
+
if (t === "start") u = "end";
|
|
369
|
+
else if (t === "end") u = "start";
|
|
370
|
+
else return null;
|
|
371
|
+
if (u === "start") return s(n) > a ? null : {
|
|
372
|
+
index: Math.min(o - 1, n + 1),
|
|
373
|
+
align: "start"
|
|
374
|
+
};
|
|
375
|
+
if (u === "end") return s(r) > a ? null : {
|
|
376
|
+
index: Math.max(0, r - 1),
|
|
377
|
+
align: "end"
|
|
378
|
+
};
|
|
379
|
+
}
|
|
367
380
|
if (u === "start") {
|
|
368
381
|
let e = s(n);
|
|
369
382
|
if (e > a) return null;
|
|
@@ -455,7 +468,7 @@ var FenwickTree = class {
|
|
|
455
468
|
function useVirtualScrollSizes(e) {
|
|
456
469
|
let n = computed(() => toValue(e)), r = new FenwickTree(n.value.props.items?.length || 0), i = new FenwickTree(n.value.props.items?.length || 0), a = new FenwickTree(n.value.props.columnCount || 0), o = shallowRef(new Uint8Array()), s = shallowRef(new Uint8Array()), c = shallowRef(new Uint8Array()), l = ref(0), u = ref(!1), d = [], f = (e, t) => typeof n.value.props.itemSize == "function" ? n.value.props.itemSize(e, t) : n.value.defaultSize, p = (e, t, r, i, a, o) => {
|
|
457
470
|
if (l.value, typeof t == "number" && t > 0) return t;
|
|
458
|
-
if (
|
|
471
|
+
if (Array.isArray(t) && t.length > 0) {
|
|
459
472
|
let n = t[e % t.length];
|
|
460
473
|
return n != null && n > 0 ? n : r;
|
|
461
474
|
}
|
|
@@ -502,22 +515,16 @@ function useVirtualScrollSizes(e) {
|
|
|
502
515
|
n.update(e, t), r[e] = 1, l = !0, e < a && s > 0 && (o.val += t);
|
|
503
516
|
}
|
|
504
517
|
return l;
|
|
505
|
-
}, y = (
|
|
506
|
-
let
|
|
507
|
-
m(
|
|
508
|
-
let
|
|
509
|
-
if (
|
|
510
|
-
r.shift(
|
|
511
|
-
let
|
|
512
|
-
|
|
513
|
-
let d = t.gap || 0, m = t.columnGap || 0, h = 0, g = 0;
|
|
514
|
-
for (let e = 0; e < p; e++) {
|
|
515
|
-
let t = f(a[e], e);
|
|
516
|
-
n.value.direction === "horizontal" ? h += t + m : g += t + d;
|
|
517
|
-
}
|
|
518
|
-
(h > 0 || g > 0) && e && e(h, g);
|
|
518
|
+
}, y = () => {
|
|
519
|
+
let e = n.value.props, t = e.items, a = t.length;
|
|
520
|
+
m(a, e.columnCount || 0);
|
|
521
|
+
let o = e.restoreScrollOnPrepend ? calculatePrependCount(d, t) : 0;
|
|
522
|
+
if (o > 0) {
|
|
523
|
+
r.shift(o), i.shift(o);
|
|
524
|
+
let e = new Uint8Array(a), t = new Uint8Array(a);
|
|
525
|
+
e.set(s.value.subarray(0, Math.min(a - o, s.value.length)), o), t.set(c.value.subarray(0, Math.min(a - o, c.value.length)), o), s.value = e, c.value = t;
|
|
519
526
|
}
|
|
520
|
-
g(), d = [...
|
|
527
|
+
g(), d = [...t], u.value = !0, l.value++;
|
|
521
528
|
};
|
|
522
529
|
return {
|
|
523
530
|
itemSizesX: r,
|
|
@@ -532,8 +539,8 @@ function useVirtualScrollSizes(e) {
|
|
|
532
539
|
getSizeAt: p,
|
|
533
540
|
initializeSizes: y,
|
|
534
541
|
updateItemSizes: (e, t, u, d, f, p) => {
|
|
535
|
-
let m = !1, h = { val: 0 }, g = { val: 0 }, v = n.value.props, y = v.gap || 0, b = v.columnGap || 0, x = t(n.value.direction === "horizontal" ? d : f), S = u(d), C = n.value.direction === "horizontal", w = n.value.direction === "both", T = /* @__PURE__ */ new Set(),
|
|
536
|
-
e >= 0 && e < (v.columnCount || 0) && !
|
|
542
|
+
let m = !1, h = { val: 0 }, g = { val: 0 }, v = n.value.props, y = v.gap || 0, b = v.columnGap || 0, x = t(n.value.direction === "horizontal" ? d : f), S = u(d), C = n.value.direction === "horizontal", w = n.value.direction === "both", T = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Set(), D = (e, t) => {
|
|
543
|
+
e >= 0 && e < (v.columnCount || 0) && !E.has(e) && (E.add(e), _(e, t, a, o.value, b, S, h) && (m = !0));
|
|
537
544
|
};
|
|
538
545
|
for (let { index: t, inlineSize: a, blockSize: o, element: l } of e) {
|
|
539
546
|
if (a <= 0 && o <= 0) continue;
|
|
@@ -542,412 +549,371 @@ function useVirtualScrollSizes(e) {
|
|
|
542
549
|
let u = n.value.isDynamicColumnWidth || typeof v.columnWidth == "function";
|
|
543
550
|
if (w && l && v.columnCount && u && (a > 0 || l.dataset.colIndex === void 0)) {
|
|
544
551
|
let e = l.dataset.colIndex;
|
|
545
|
-
if (e != null)
|
|
552
|
+
if (e != null) D(Number.parseInt(e, 10), a);
|
|
546
553
|
else {
|
|
547
554
|
let e = Array.from(l.querySelectorAll("[data-col-index]"));
|
|
548
|
-
for (let t of e)
|
|
555
|
+
for (let t of e) D(Number.parseInt(t.dataset.colIndex, 10), t.getBoundingClientRect().width);
|
|
549
556
|
}
|
|
550
557
|
}
|
|
551
558
|
}
|
|
552
559
|
m && (l.value++, (h.val !== 0 || g.val !== 0) && p(h.val, g.val));
|
|
553
560
|
},
|
|
554
|
-
refresh: (
|
|
555
|
-
r.resize(0), i.resize(0), a.resize(0), o.value.fill(0), s.value.fill(0), c.value.fill(0), y(
|
|
561
|
+
refresh: () => {
|
|
562
|
+
r.resize(0), i.resize(0), a.resize(0), o.value.fill(0), s.value.fill(0), c.value.fill(0), y();
|
|
556
563
|
}
|
|
557
564
|
};
|
|
558
565
|
}
|
|
559
|
-
function useVirtualScroll(e) {
|
|
560
|
-
let
|
|
566
|
+
function useVirtualScroll(e, n = []) {
|
|
567
|
+
let r = computed(() => toValue(e)), i = ref(0), a = ref(0), o = ref(0), c = ref(0), l = ref(!1), d = ref(!1), f = ref(!1), p = ref(!1), g = ref(!1), y = ref(0), b = ref(0), x = reactive({
|
|
561
568
|
x: 0,
|
|
562
569
|
y: 0
|
|
563
|
-
}),
|
|
570
|
+
}), S = reactive({
|
|
564
571
|
x: 0,
|
|
565
572
|
y: 0
|
|
566
|
-
}),
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
ae = window.getComputedStyle(t);
|
|
570
|
-
let r = ae.direction === "rtl";
|
|
571
|
-
d.value !== r && (d.value = r);
|
|
572
|
-
}, D = computed(() => [
|
|
573
|
+
}), C, w = ref(1), E = ref(1), D = ref(null), te = ref(null), O = ref(null), k = ref(!1), A, re = () => {
|
|
574
|
+
k.value = !1, clearTimeout(A), O.value = null;
|
|
575
|
+
}, ie = 0, j = 0, M = computed(() => [
|
|
573
576
|
"vertical",
|
|
574
577
|
"horizontal",
|
|
575
578
|
"both"
|
|
576
|
-
].includes(
|
|
577
|
-
props:
|
|
578
|
-
isDynamicItemSize:
|
|
579
|
-
isDynamicColumnWidth:
|
|
580
|
-
defaultSize:
|
|
581
|
-
fixedItemSize:
|
|
582
|
-
direction:
|
|
583
|
-
}))),
|
|
584
|
-
direction:
|
|
585
|
-
itemsLength:
|
|
586
|
-
columnCount:
|
|
587
|
-
fixedSize:
|
|
588
|
-
fixedWidth:
|
|
589
|
-
gap:
|
|
590
|
-
columnGap:
|
|
591
|
-
usableWidth:
|
|
592
|
-
usableHeight:
|
|
593
|
-
queryY: (e) =>
|
|
594
|
-
queryX: (e) =>
|
|
595
|
-
queryColumn: (e) =>
|
|
596
|
-
}))),
|
|
597
|
-
x: computed(() => Math.max(0,
|
|
598
|
-
y: computed(() => Math.max(0,
|
|
599
|
-
}),
|
|
600
|
-
if (
|
|
601
|
-
let e =
|
|
602
|
-
return
|
|
603
|
-
}),
|
|
604
|
-
if (
|
|
605
|
-
let e =
|
|
606
|
-
return
|
|
607
|
-
}),
|
|
608
|
-
|
|
609
|
-
|
|
579
|
+
].includes(r.value.direction) ? r.value.direction : "vertical"), N = computed(() => r.value.itemSize === void 0 || r.value.itemSize === null || r.value.itemSize === 0), ae = computed(() => r.value.columnWidth === void 0 || r.value.columnWidth === null || r.value.columnWidth === 0), P = computed(() => typeof r.value.itemSize == "number" && r.value.itemSize > 0 ? r.value.itemSize : null), F = computed(() => typeof r.value.columnWidth == "number" && r.value.columnWidth > 0 ? r.value.columnWidth : null), me = computed(() => r.value.defaultItemSize || P.value || 40), { itemSizesX: I, itemSizesY: R, columnSizes: z, measuredColumns: ge, measuredItemsY: B, treeUpdateFlag: we, getSizeAt: Ee, getItemBaseSize: De, initializeSizes: Oe, updateItemSizes: ke, refresh: je } = useVirtualScrollSizes(computed(() => ({
|
|
580
|
+
props: r.value,
|
|
581
|
+
isDynamicItemSize: N.value,
|
|
582
|
+
isDynamicColumnWidth: ae.value,
|
|
583
|
+
defaultSize: me.value,
|
|
584
|
+
fixedItemSize: P.value,
|
|
585
|
+
direction: M.value
|
|
586
|
+
}))), Ne = computed(() => getPaddingX(r.value.scrollPaddingStart, r.value.direction)), Pe = computed(() => getPaddingX(r.value.scrollPaddingEnd, r.value.direction)), Fe = computed(() => getPaddingY(r.value.scrollPaddingStart, r.value.direction)), Ie = computed(() => getPaddingY(r.value.scrollPaddingEnd, r.value.direction)), H = computed(() => getPaddingX(r.value.stickyStart, r.value.direction)), Le = computed(() => getPaddingX(r.value.stickyEnd, r.value.direction)), U = computed(() => getPaddingY(r.value.stickyStart, r.value.direction)), Re = computed(() => getPaddingY(r.value.stickyEnd, r.value.direction)), W = computed(() => getPaddingX(r.value.flowPaddingStart, r.value.direction)), ze = computed(() => getPaddingX(r.value.flowPaddingEnd, r.value.direction)), Be = computed(() => getPaddingY(r.value.flowPaddingStart, r.value.direction)), Ve = computed(() => getPaddingY(r.value.flowPaddingEnd, r.value.direction)), He = computed(() => y.value - (M.value === "vertical" ? 0 : H.value + Le.value)), Ue = computed(() => b.value - (M.value === "horizontal" ? 0 : U.value + Re.value)), We = computed(() => (we.value, calculateTotalSize({
|
|
587
|
+
direction: M.value,
|
|
588
|
+
itemsLength: r.value.items.length,
|
|
589
|
+
columnCount: r.value.columnCount || 0,
|
|
590
|
+
fixedSize: P.value,
|
|
591
|
+
fixedWidth: F.value,
|
|
592
|
+
gap: r.value.gap || 0,
|
|
593
|
+
columnGap: r.value.columnGap || 0,
|
|
594
|
+
usableWidth: He.value,
|
|
595
|
+
usableHeight: Ue.value,
|
|
596
|
+
queryY: (e) => R.query(e),
|
|
597
|
+
queryX: (e) => I.query(e),
|
|
598
|
+
queryColumn: (e) => z.query(e)
|
|
599
|
+
}))), Ge = computed(() => isWindowLike(r.value.container)), Ke = computed(() => We.value.width + Ne.value + Pe.value), qe = computed(() => We.value.height + Fe.value + Ie.value), G = computed(() => W.value + H.value + Le.value + ze.value + Ke.value), Je = computed(() => Be.value + U.value + Re.value + Ve.value + qe.value), K = reactive({
|
|
600
|
+
x: computed(() => Math.max(0, x.x - (W.value + H.value))),
|
|
601
|
+
y: computed(() => Math.max(0, x.y - (Be.value + U.value)))
|
|
602
|
+
}), Ye = computed(() => calculateRenderedSize(Ge.value, G.value)), Xe = computed(() => calculateRenderedSize(Ge.value, Je.value)), Ze = computed(() => calculateRenderedSize(Ge.value, Ke.value)), Qe = computed(() => calculateRenderedSize(Ge.value, qe.value)), q = computed(() => {
|
|
603
|
+
if (M.value === "vertical") return 0;
|
|
604
|
+
let e = W.value + H.value + Ne.value;
|
|
605
|
+
return o.value - e;
|
|
606
|
+
}), J = computed(() => {
|
|
607
|
+
if (M.value === "horizontal") return 0;
|
|
608
|
+
let e = Be.value + U.value + Fe.value;
|
|
609
|
+
return c.value - e;
|
|
610
|
+
}), Y = (e) => {
|
|
611
|
+
let t = M.value === "horizontal";
|
|
612
|
+
return calculateIndexAt(e, P.value, t ? r.value.columnGap || 0 : r.value.gap || 0, (e) => t ? I.findLowerBound(e) : R.findLowerBound(e));
|
|
613
|
+
}, $e = (e) => M.value === "both" ? calculateIndexAt(e, F.value, r.value.columnGap || 0, (e) => z.findLowerBound(e)) : M.value === "horizontal" ? Y(e) : 0, et = (e) => M.value === "both" ? Ee(e, r.value.columnWidth, r.value.defaultColumnWidth || 100, r.value.columnGap || 0, z, !0) : Ee(e, r.value.itemSize, r.value.defaultItemSize || 40, r.value.columnGap || 0, I, !0), tt = (e) => M.value === "horizontal" ? Ue.value : Ee(e, r.value.itemSize, r.value.defaultItemSize || 40, r.value.gap || 0, R, !1), nt = (e) => M.value === "horizontal" ? W.value + H.value + Ne.value + calculateOffsetAt(e, P.value, r.value.columnGap || 0, (e) => I.query(e)) : Be.value + U.value + Fe.value + calculateOffsetAt(e, P.value, r.value.gap || 0, (e) => R.query(e)), rt = (e) => M.value === "horizontal" ? et(e) : tt(e), X = () => {
|
|
614
|
+
if (typeof window > "u") return;
|
|
615
|
+
let e = r.value.container || r.value.hostRef || window, t = isElement(e) ? e : document.documentElement, n = window.getComputedStyle(t).direction === "rtl";
|
|
616
|
+
g.value !== n && (g.value = n);
|
|
617
|
+
}, it = (e, t) => {
|
|
618
|
+
nextTick(() => {
|
|
619
|
+
Z(e > 0 ? q.value + e : null, t > 0 ? J.value + t : null, { behavior: "auto" });
|
|
620
|
+
});
|
|
621
|
+
};
|
|
622
|
+
function at(e, t, n) {
|
|
623
|
+
let s = typeof n == "object" && n && "isCorrection" in n ? n.isCorrection : !1, l = r.value.container || window, { targetX: u, targetY: d, effectiveAlignX: f, effectiveAlignY: p } = calculateScrollTarget({
|
|
610
624
|
rowIndex: e,
|
|
611
625
|
colIndex: t,
|
|
612
|
-
options:
|
|
613
|
-
direction:
|
|
614
|
-
viewportWidth:
|
|
615
|
-
viewportHeight:
|
|
616
|
-
totalWidth:
|
|
617
|
-
totalHeight:
|
|
618
|
-
gap:
|
|
619
|
-
columnGap:
|
|
620
|
-
fixedSize:
|
|
621
|
-
fixedWidth:
|
|
622
|
-
relativeScrollX:
|
|
623
|
-
relativeScrollY:
|
|
624
|
-
getItemSizeY: (e) =>
|
|
625
|
-
getItemSizeX: (e) =>
|
|
626
|
-
getItemQueryY: (e) =>
|
|
627
|
-
getItemQueryX: (e) =>
|
|
628
|
-
getColumnSize: (e) =>
|
|
629
|
-
getColumnQuery: (e) =>
|
|
630
|
-
scaleX:
|
|
631
|
-
scaleY:
|
|
632
|
-
hostOffsetX:
|
|
633
|
-
hostOffsetY:
|
|
634
|
-
stickyIndices:
|
|
635
|
-
stickyStartX:
|
|
636
|
-
stickyStartY:
|
|
637
|
-
stickyEndX:
|
|
638
|
-
stickyEndY:
|
|
639
|
-
flowPaddingStartX:
|
|
640
|
-
flowPaddingStartY:
|
|
641
|
-
paddingStartX:
|
|
642
|
-
paddingStartY:
|
|
643
|
-
paddingEndX:
|
|
644
|
-
paddingEndY:
|
|
626
|
+
options: n,
|
|
627
|
+
direction: M.value,
|
|
628
|
+
viewportWidth: y.value,
|
|
629
|
+
viewportHeight: b.value,
|
|
630
|
+
totalWidth: G.value,
|
|
631
|
+
totalHeight: Je.value,
|
|
632
|
+
gap: r.value.gap || 0,
|
|
633
|
+
columnGap: r.value.columnGap || 0,
|
|
634
|
+
fixedSize: P.value,
|
|
635
|
+
fixedWidth: F.value,
|
|
636
|
+
relativeScrollX: q.value,
|
|
637
|
+
relativeScrollY: J.value,
|
|
638
|
+
getItemSizeY: (e) => R.get(e),
|
|
639
|
+
getItemSizeX: (e) => I.get(e),
|
|
640
|
+
getItemQueryY: (e) => R.query(e),
|
|
641
|
+
getItemQueryX: (e) => I.query(e),
|
|
642
|
+
getColumnSize: (e) => z.get(e),
|
|
643
|
+
getColumnQuery: (e) => z.query(e),
|
|
644
|
+
scaleX: w.value,
|
|
645
|
+
scaleY: E.value,
|
|
646
|
+
hostOffsetX: K.x,
|
|
647
|
+
hostOffsetY: K.y,
|
|
648
|
+
stickyIndices: r.value.stickyIndices || [],
|
|
649
|
+
stickyStartX: H.value,
|
|
650
|
+
stickyStartY: U.value,
|
|
651
|
+
stickyEndX: Le.value,
|
|
652
|
+
stickyEndY: Re.value,
|
|
653
|
+
flowPaddingStartX: W.value,
|
|
654
|
+
flowPaddingStartY: Be.value,
|
|
655
|
+
paddingStartX: Ne.value,
|
|
656
|
+
paddingStartY: Fe.value,
|
|
657
|
+
paddingEndX: Pe.value,
|
|
658
|
+
paddingEndY: Ie.value
|
|
645
659
|
});
|
|
646
|
-
if (!
|
|
647
|
-
let
|
|
648
|
-
|
|
660
|
+
if (!s) {
|
|
661
|
+
let r = isScrollToIndexOptions(n) ? n.behavior : void 0;
|
|
662
|
+
O.value = {
|
|
649
663
|
rowIndex: e,
|
|
650
664
|
colIndex: t,
|
|
651
665
|
options: {
|
|
652
666
|
align: {
|
|
653
|
-
x:
|
|
654
|
-
y:
|
|
667
|
+
x: f,
|
|
668
|
+
y: p
|
|
655
669
|
},
|
|
656
|
-
...
|
|
670
|
+
...r == null ? {} : { behavior: r }
|
|
657
671
|
}
|
|
658
672
|
};
|
|
659
673
|
}
|
|
660
|
-
let
|
|
661
|
-
isScrollToIndexOptions(
|
|
662
|
-
let
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
}
|
|
674
|
+
let m = virtualToDisplay(u, K.x, w.value), h = virtualToDisplay(d, K.y, E.value), _ = g.value ? -m : m, v = h, x;
|
|
675
|
+
isScrollToIndexOptions(n) && (x = n.behavior);
|
|
676
|
+
let S = s ? "auto" : x || "smooth";
|
|
677
|
+
k.value = !0, clearTimeout(A), S === "smooth" && (A = setTimeout(() => {
|
|
678
|
+
k.value = !1, A = void 0, gt();
|
|
679
|
+
}, 500));
|
|
680
|
+
let C = { behavior: S };
|
|
681
|
+
t != null && (C.left = g.value ? _ : Math.max(0, _)), e != null && (C.top = Math.max(0, v)), scrollTo(l, C), (S === "auto" || S === void 0) && (t != null && (i.value = g.value ? _ : Math.max(0, _), o.value = u), e != null && (a.value = Math.max(0, v), c.value = d));
|
|
669
682
|
}
|
|
670
|
-
|
|
671
|
-
let
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
let l =
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
}, it = () => De(rt), Z = () => {
|
|
685
|
-
if (typeof window > "u") return;
|
|
686
|
-
let e = n.value.container || window, t = (t) => {
|
|
687
|
-
let n = t.getBoundingClientRect();
|
|
688
|
-
if (e === window) return {
|
|
689
|
-
x: d.value ? document.documentElement.clientWidth - n.right - window.scrollX : n.left + window.scrollX,
|
|
690
|
-
y: n.top + window.scrollY
|
|
691
|
-
};
|
|
692
|
-
if (e === t) return {
|
|
693
|
-
x: 0,
|
|
694
|
-
y: 0
|
|
695
|
-
};
|
|
696
|
-
if (isElement(e)) {
|
|
697
|
-
let t = e.getBoundingClientRect();
|
|
698
|
-
return {
|
|
699
|
-
x: d.value ? t.right - n.right - e.scrollLeft : n.left - t.left + e.scrollLeft,
|
|
700
|
-
y: n.top - t.top + e.scrollTop
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
return {
|
|
704
|
-
x: 0,
|
|
705
|
-
y: 0
|
|
706
|
-
};
|
|
707
|
-
};
|
|
708
|
-
if (n.value.hostElement) {
|
|
709
|
-
let e = t(n.value.hostElement);
|
|
710
|
-
(Math.abs(g.x - e.x) > .1 || Math.abs(g.y - e.y) > .1) && (g.x = e.x, g.y = e.y);
|
|
711
|
-
}
|
|
712
|
-
if (n.value.hostRef) {
|
|
713
|
-
let e = t(n.value.hostRef);
|
|
714
|
-
(Math.abs(y.x - e.x) > .1 || Math.abs(y.y - e.y) > .1) && (y.x = e.x, y.y = e.y);
|
|
715
|
-
}
|
|
716
|
-
};
|
|
717
|
-
watch([
|
|
718
|
-
() => n.value.items,
|
|
719
|
-
() => n.value.items.length,
|
|
720
|
-
() => n.value.direction,
|
|
721
|
-
() => n.value.columnCount,
|
|
722
|
-
() => n.value.columnWidth,
|
|
723
|
-
() => n.value.itemSize,
|
|
724
|
-
() => n.value.gap,
|
|
725
|
-
() => n.value.columnGap,
|
|
726
|
-
() => n.value.defaultItemSize,
|
|
727
|
-
() => n.value.defaultColumnWidth
|
|
728
|
-
], it, { immediate: !0 }), watch(() => [n.value.container, n.value.hostElement], () => {
|
|
729
|
-
Z();
|
|
730
|
-
}), watch(d, (e, t) => {
|
|
731
|
-
if (t === void 0 || e === t || !l.value) return;
|
|
732
|
-
if (D.value === "vertical") {
|
|
733
|
-
Z();
|
|
734
|
-
return;
|
|
735
|
-
}
|
|
736
|
-
let n = displayToVirtual(t ? Math.abs(r.value) : r.value, g.x, K.value);
|
|
737
|
-
Z(), nt(n, null, { behavior: "auto" });
|
|
738
|
-
}, { flush: "sync" }), watch([K, q], () => {
|
|
739
|
-
!l.value || a.value || x.value || nt(S.value, C.value, { behavior: "auto" });
|
|
740
|
-
}), watch([() => n.value.items.length, () => n.value.columnCount], ([e, t], [n, r]) => {
|
|
741
|
-
nextTick(() => {
|
|
742
|
-
let i = Math.max(0, U.value - f.value), a = Math.max(0, W.value - p.value);
|
|
743
|
-
S.value > i || C.value > a ? nt(Math.min(S.value, i), Math.min(C.value, a), { behavior: "auto" }) : (e !== n && q.value !== 1 || t !== r && K.value !== 1) && nt(S.value, C.value, { behavior: "auto" }), Z();
|
|
744
|
-
});
|
|
745
|
-
});
|
|
746
|
-
let Q = (e) => {
|
|
747
|
-
let t = D.value === "horizontal";
|
|
748
|
-
return calculateIndexAt(e, O.value, t ? n.value.columnGap || 0 : n.value.gap || 0, (e) => t ? j.findLowerBound(e) : M.findLowerBound(e));
|
|
749
|
-
}, at = (e) => D.value === "both" ? calculateIndexAt(e, k.value, n.value.columnGap || 0, (e) => N.findLowerBound(e)) : D.value === "horizontal" ? Q(e) : 0, ot = computed(() => {
|
|
750
|
-
if (F.value, (!o.value || c.value) && n.value.ssrRange) return {
|
|
751
|
-
start: n.value.ssrRange.start,
|
|
752
|
-
end: n.value.ssrRange.end
|
|
683
|
+
function Z(e, t, n) {
|
|
684
|
+
let s = r.value.container || window;
|
|
685
|
+
k.value = !0, clearTimeout(A), n?.behavior === "smooth" && (A = setTimeout(() => {
|
|
686
|
+
k.value = !1, A = void 0, gt();
|
|
687
|
+
}, 500)), O.value = null;
|
|
688
|
+
let l = e == null ? null : Math.max(0, Math.min(e, G.value - y.value)), u = t == null ? null : Math.max(0, Math.min(t, Je.value - b.value));
|
|
689
|
+
l !== null && (o.value = l), u !== null && (c.value = u);
|
|
690
|
+
let d = typeof window < "u" && s === window ? window.scrollX : s.scrollLeft, f = typeof window < "u" && s === window ? window.scrollY : s.scrollTop, p = l === null ? null : virtualToDisplay(l, K.x, w.value), m = u === null ? null : virtualToDisplay(u, K.y, E.value), h = p === null ? d : g.value ? -p : p, _ = m === null ? f : m, v = { behavior: n?.behavior || "auto" };
|
|
691
|
+
e != null && (v.left = h), t != null && (v.top = _), scrollTo(s, v), (n?.behavior === "auto" || n?.behavior === void 0) && (e != null && (i.value = h), t != null && (a.value = _));
|
|
692
|
+
}
|
|
693
|
+
let ot = computed(() => {
|
|
694
|
+
if (we.value, (!d.value || f.value) && r.value.ssrRange) return {
|
|
695
|
+
start: r.value.ssrRange.start,
|
|
696
|
+
end: r.value.ssrRange.end
|
|
753
697
|
};
|
|
754
|
-
let e =
|
|
698
|
+
let e = r.value.ssrRange && !l.value ? 0 : r.value.bufferBefore ?? 5, t = r.value.bufferAfter ?? 5;
|
|
755
699
|
return calculateRange({
|
|
756
|
-
direction:
|
|
757
|
-
relativeScrollX:
|
|
758
|
-
relativeScrollY:
|
|
759
|
-
usableWidth:
|
|
760
|
-
usableHeight:
|
|
761
|
-
itemsLength:
|
|
700
|
+
direction: M.value,
|
|
701
|
+
relativeScrollX: q.value,
|
|
702
|
+
relativeScrollY: J.value,
|
|
703
|
+
usableWidth: He.value,
|
|
704
|
+
usableHeight: Ue.value,
|
|
705
|
+
itemsLength: r.value.items.length,
|
|
762
706
|
bufferBefore: e,
|
|
763
707
|
bufferAfter: t,
|
|
764
|
-
gap:
|
|
765
|
-
columnGap:
|
|
766
|
-
fixedSize:
|
|
767
|
-
findLowerBoundY: (e) =>
|
|
768
|
-
findLowerBoundX: (e) =>
|
|
769
|
-
queryY: (e) =>
|
|
770
|
-
queryX: (e) =>
|
|
708
|
+
gap: r.value.gap || 0,
|
|
709
|
+
columnGap: r.value.columnGap || 0,
|
|
710
|
+
fixedSize: P.value,
|
|
711
|
+
findLowerBoundY: (e) => R.findLowerBound(e),
|
|
712
|
+
findLowerBoundX: (e) => I.findLowerBound(e),
|
|
713
|
+
queryY: (e) => R.query(e),
|
|
714
|
+
queryX: (e) => I.query(e)
|
|
771
715
|
});
|
|
772
716
|
}), st = computed(() => {
|
|
773
|
-
|
|
774
|
-
let e =
|
|
775
|
-
return
|
|
717
|
+
we.value;
|
|
718
|
+
let e = q.value + H.value, t = J.value + U.value;
|
|
719
|
+
return Y(M.value === "horizontal" ? e : t);
|
|
776
720
|
}), ct = computed(() => {
|
|
777
|
-
|
|
778
|
-
let e =
|
|
721
|
+
we.value;
|
|
722
|
+
let e = r.value.columnCount || 0;
|
|
779
723
|
if (!e) return {
|
|
780
724
|
start: 0,
|
|
781
725
|
end: 0,
|
|
782
726
|
padStart: 0,
|
|
783
727
|
padEnd: 0
|
|
784
728
|
};
|
|
785
|
-
if ((!
|
|
786
|
-
let { colStart: t = 0, colEnd:
|
|
729
|
+
if ((!d.value || f.value) && r.value.ssrRange) {
|
|
730
|
+
let { colStart: t = 0, colEnd: n = 0 } = r.value.ssrRange, i = Math.max(0, t), a = Math.min(e, n || e);
|
|
787
731
|
return calculateColumnRange({
|
|
788
732
|
columnCount: e,
|
|
789
|
-
relativeScrollX: calculateOffsetAt(i,
|
|
790
|
-
usableWidth: calculateRangeSize(i, a,
|
|
733
|
+
relativeScrollX: calculateOffsetAt(i, F.value, r.value.columnGap || 0, (e) => z.query(e)),
|
|
734
|
+
usableWidth: calculateRangeSize(i, a, F.value, r.value.columnGap || 0, (e) => z.query(e)),
|
|
791
735
|
colBuffer: 0,
|
|
792
|
-
fixedWidth:
|
|
793
|
-
columnGap:
|
|
794
|
-
findLowerBound: (e) =>
|
|
795
|
-
query: (e) =>
|
|
796
|
-
totalColsQuery: () =>
|
|
736
|
+
fixedWidth: F.value,
|
|
737
|
+
columnGap: r.value.columnGap || 0,
|
|
738
|
+
findLowerBound: (e) => z.findLowerBound(e),
|
|
739
|
+
query: (e) => z.query(e),
|
|
740
|
+
totalColsQuery: () => z.query(e)
|
|
797
741
|
});
|
|
798
742
|
}
|
|
799
|
-
let t =
|
|
743
|
+
let t = r.value.ssrRange && !l.value ? 0 : 2;
|
|
800
744
|
return calculateColumnRange({
|
|
801
745
|
columnCount: e,
|
|
802
|
-
relativeScrollX:
|
|
803
|
-
usableWidth:
|
|
746
|
+
relativeScrollX: q.value,
|
|
747
|
+
usableWidth: He.value,
|
|
804
748
|
colBuffer: t,
|
|
805
|
-
fixedWidth:
|
|
806
|
-
columnGap:
|
|
807
|
-
findLowerBound: (e) =>
|
|
808
|
-
query: (e) =>
|
|
809
|
-
totalColsQuery: () =>
|
|
749
|
+
fixedWidth: F.value,
|
|
750
|
+
columnGap: r.value.columnGap || 0,
|
|
751
|
+
findLowerBound: (e) => z.findLowerBound(e),
|
|
752
|
+
query: (e) => z.query(e),
|
|
753
|
+
totalColsQuery: () => z.query(e)
|
|
810
754
|
});
|
|
811
|
-
}), lt =
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
755
|
+
}), lt = {
|
|
756
|
+
props: r,
|
|
757
|
+
scrollDetails: null,
|
|
758
|
+
totalSize: computed(() => ({
|
|
759
|
+
width: G.value,
|
|
760
|
+
height: Je.value
|
|
761
|
+
})),
|
|
762
|
+
range: ot,
|
|
763
|
+
currentIndex: st,
|
|
764
|
+
internalState: {
|
|
765
|
+
scrollX: i,
|
|
766
|
+
scrollY: a,
|
|
767
|
+
internalScrollX: o,
|
|
768
|
+
internalScrollY: c,
|
|
769
|
+
isRtl: g,
|
|
770
|
+
isScrolling: l,
|
|
771
|
+
isProgrammaticScroll: k,
|
|
772
|
+
viewportWidth: y,
|
|
773
|
+
viewportHeight: b,
|
|
774
|
+
scaleX: w,
|
|
775
|
+
scaleY: E,
|
|
776
|
+
scrollDirectionX: D,
|
|
777
|
+
scrollDirectionY: te,
|
|
778
|
+
relativeScrollX: q,
|
|
779
|
+
relativeScrollY: J
|
|
780
|
+
},
|
|
781
|
+
methods: {
|
|
782
|
+
scrollToIndex: at,
|
|
783
|
+
scrollToOffset: Z,
|
|
784
|
+
updateDirection: X,
|
|
785
|
+
getRowIndexAt: Y,
|
|
786
|
+
getColIndexAt: $e,
|
|
787
|
+
getItemSize: rt,
|
|
788
|
+
getItemBaseSize: De,
|
|
789
|
+
getItemOffset: nt,
|
|
790
|
+
handleScrollCorrection: it
|
|
791
|
+
}
|
|
792
|
+
}, ut = [], dt = computed(() => {
|
|
793
|
+
we.value;
|
|
794
|
+
let { start: e, end: t } = ot.value, i = [], a = [...r.value.stickyIndices || []].sort((e, t) => e - t), s = new Set(a), l = [];
|
|
795
|
+
if (d.value || !r.value.ssrRange) {
|
|
796
|
+
let t = st.value, n = findPrevStickyIndex(a, t);
|
|
797
|
+
n !== void 0 && n < e && l.push(n);
|
|
817
798
|
}
|
|
818
|
-
for (let n = e; n < t; n++)
|
|
819
|
-
let { x:
|
|
799
|
+
for (let n = e; n < t; n++) l.push(n);
|
|
800
|
+
let { x: u, y: f } = !d.value && r.value.ssrRange ? calculateSSROffsets(M.value, r.value.ssrRange, P.value, F.value, r.value.gap || 0, r.value.columnGap || 0, (e) => R.query(e), (e) => I.query(e), (e) => z.query(e)) : {
|
|
820
801
|
x: 0,
|
|
821
802
|
y: 0
|
|
822
|
-
},
|
|
823
|
-
for (let e of
|
|
824
|
-
let
|
|
825
|
-
for (let e of
|
|
826
|
-
let t =
|
|
803
|
+
}, p = /* @__PURE__ */ new Map();
|
|
804
|
+
for (let e of ut) p.set(e.index, e);
|
|
805
|
+
let m = -1, h = 0, g = -1, _ = 0, v = (e) => e === m + 1 ? (h += I.get(m), m = e, h) : (h = I.query(e), m = e, h), y = (e) => e === g + 1 ? (_ += R.get(g), g = e, _) : (_ = R.query(e), g = e, _), b = W.value + H.value + Ne.value, x = Be.value + U.value + Fe.value, S = W.value + H.value, C = Be.value + U.value, T = ct.value, D = 0;
|
|
806
|
+
for (let e of l) {
|
|
807
|
+
let t = r.value.items[e];
|
|
827
808
|
if (t === void 0) continue;
|
|
828
|
-
let { x:
|
|
809
|
+
let { x: n, y: l, width: m, height: h } = calculateItemPosition({
|
|
829
810
|
index: e,
|
|
830
|
-
direction:
|
|
831
|
-
fixedSize:
|
|
832
|
-
gap:
|
|
833
|
-
columnGap:
|
|
834
|
-
usableWidth:
|
|
835
|
-
usableHeight:
|
|
836
|
-
totalWidth:
|
|
837
|
-
queryY:
|
|
838
|
-
queryX:
|
|
839
|
-
getSizeY: (e) =>
|
|
840
|
-
getSizeX: (e) =>
|
|
841
|
-
columnRange:
|
|
842
|
-
}),
|
|
843
|
-
for (;
|
|
844
|
-
let ne =
|
|
811
|
+
direction: M.value,
|
|
812
|
+
fixedSize: P.value,
|
|
813
|
+
gap: r.value.gap || 0,
|
|
814
|
+
columnGap: r.value.columnGap || 0,
|
|
815
|
+
usableWidth: He.value,
|
|
816
|
+
usableHeight: Ue.value,
|
|
817
|
+
totalWidth: We.value.width,
|
|
818
|
+
queryY: y,
|
|
819
|
+
queryX: v,
|
|
820
|
+
getSizeY: (e) => R.get(e),
|
|
821
|
+
getSizeX: (e) => I.get(e),
|
|
822
|
+
columnRange: T
|
|
823
|
+
}), g = s.has(e), _ = n, te = l;
|
|
824
|
+
for (; D < a.length && a[D] <= e;) D++;
|
|
825
|
+
let ne = D < a.length ? a[D] : void 0, { isStickyActive: O, isStickyActiveX: k, isStickyActiveY: A, stickyOffset: re } = calculateStickyItem({
|
|
845
826
|
index: e,
|
|
846
|
-
isSticky:
|
|
847
|
-
direction:
|
|
848
|
-
relativeScrollX:
|
|
849
|
-
relativeScrollY:
|
|
850
|
-
originalX:
|
|
827
|
+
isSticky: g,
|
|
828
|
+
direction: M.value,
|
|
829
|
+
relativeScrollX: q.value,
|
|
830
|
+
relativeScrollY: J.value,
|
|
831
|
+
originalX: _,
|
|
851
832
|
originalY: te,
|
|
852
|
-
width:
|
|
853
|
-
height:
|
|
854
|
-
stickyIndices:
|
|
855
|
-
fixedSize:
|
|
856
|
-
fixedWidth:
|
|
857
|
-
gap:
|
|
858
|
-
columnGap:
|
|
859
|
-
getItemQueryY: (e) =>
|
|
860
|
-
getItemQueryX: (e) =>
|
|
833
|
+
width: m,
|
|
834
|
+
height: h,
|
|
835
|
+
stickyIndices: a,
|
|
836
|
+
fixedSize: P.value,
|
|
837
|
+
fixedWidth: F.value,
|
|
838
|
+
gap: r.value.gap || 0,
|
|
839
|
+
columnGap: r.value.columnGap || 0,
|
|
840
|
+
getItemQueryY: (e) => R.query(e),
|
|
841
|
+
getItemQueryX: (e) => I.query(e),
|
|
861
842
|
nextStickyIndex: ne
|
|
862
|
-
}),
|
|
863
|
-
|
|
843
|
+
}), ie = d.value ? o.value / w.value + (n + b - o.value) - S : n - u, j = d.value ? c.value / E.value + (l + x - c.value) - C : l - f, N = p.get(e);
|
|
844
|
+
N && N.item === t && N.offset.x === ie && N.offset.y === j && N.size.width === m && N.size.height === h && N.isSticky === g && N.isStickyActive === O && N.isStickyActiveX === k && N.isStickyActiveY === A && N.stickyOffset.x === re.x && N.stickyOffset.y === re.y ? i.push(N) : i.push({
|
|
864
845
|
item: t,
|
|
865
846
|
index: e,
|
|
866
847
|
offset: {
|
|
867
|
-
x:
|
|
868
|
-
y:
|
|
848
|
+
x: ie,
|
|
849
|
+
y: j
|
|
869
850
|
},
|
|
870
851
|
size: {
|
|
871
|
-
width:
|
|
872
|
-
height:
|
|
852
|
+
width: m,
|
|
853
|
+
height: h
|
|
873
854
|
},
|
|
874
|
-
originalX:
|
|
855
|
+
originalX: _,
|
|
875
856
|
originalY: te,
|
|
876
|
-
isSticky:
|
|
877
|
-
isStickyActive:
|
|
878
|
-
isStickyActiveX:
|
|
879
|
-
isStickyActiveY:
|
|
880
|
-
stickyOffset:
|
|
857
|
+
isSticky: g,
|
|
858
|
+
isStickyActive: O,
|
|
859
|
+
isStickyActiveX: k,
|
|
860
|
+
isStickyActiveY: A,
|
|
861
|
+
stickyOffset: re
|
|
881
862
|
});
|
|
882
863
|
}
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
864
|
+
let te = i;
|
|
865
|
+
return n.forEach((e) => {
|
|
866
|
+
e.transformRenderedItems && (te = e.transformRenderedItems(te, lt));
|
|
867
|
+
}), ut = te, te;
|
|
868
|
+
}), ft = computed(() => {
|
|
869
|
+
we.value;
|
|
870
|
+
let e = q.value + H.value, t = J.value + U.value, n = q.value + (y.value - Le.value) - 1, r = J.value + (b.value - Re.value) - 1, s = $e(e), u = Y(t), d = Y(M.value === "horizontal" ? n : r), f = $e(n);
|
|
887
871
|
return {
|
|
888
|
-
items:
|
|
889
|
-
currentIndex:
|
|
872
|
+
items: dt.value,
|
|
873
|
+
currentIndex: u,
|
|
890
874
|
currentColIndex: s,
|
|
891
|
-
currentEndIndex:
|
|
892
|
-
currentEndColIndex:
|
|
875
|
+
currentEndIndex: d,
|
|
876
|
+
currentEndColIndex: f,
|
|
893
877
|
scrollOffset: {
|
|
894
|
-
x:
|
|
895
|
-
y:
|
|
878
|
+
x: o.value,
|
|
879
|
+
y: c.value
|
|
896
880
|
},
|
|
897
881
|
displayScrollOffset: {
|
|
898
|
-
x:
|
|
899
|
-
y: Math.max(0,
|
|
882
|
+
x: g.value ? Math.abs(i.value + S.x) : Math.max(0, i.value - S.x),
|
|
883
|
+
y: Math.max(0, a.value - S.y)
|
|
900
884
|
},
|
|
901
885
|
viewportSize: {
|
|
902
|
-
width:
|
|
903
|
-
height:
|
|
886
|
+
width: y.value,
|
|
887
|
+
height: b.value
|
|
904
888
|
},
|
|
905
889
|
displayViewportSize: {
|
|
906
|
-
width:
|
|
907
|
-
height:
|
|
890
|
+
width: y.value,
|
|
891
|
+
height: b.value
|
|
908
892
|
},
|
|
909
893
|
totalSize: {
|
|
910
|
-
width:
|
|
911
|
-
height:
|
|
894
|
+
width: G.value,
|
|
895
|
+
height: Je.value
|
|
912
896
|
},
|
|
913
|
-
isScrolling:
|
|
914
|
-
isProgrammaticScroll:
|
|
897
|
+
isScrolling: l.value,
|
|
898
|
+
isProgrammaticScroll: k.value,
|
|
915
899
|
range: ot.value,
|
|
916
900
|
columnRange: ct.value
|
|
917
901
|
};
|
|
918
|
-
})
|
|
919
|
-
|
|
920
|
-
|
|
902
|
+
});
|
|
903
|
+
lt.scrollDetails = ft, n.forEach((e) => e.onInit?.(lt));
|
|
904
|
+
let pt = (e) => {
|
|
921
905
|
let t = e.target;
|
|
922
906
|
if (typeof window > "u") return;
|
|
923
|
-
|
|
924
|
-
let
|
|
925
|
-
Math.abs(
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
let e = n.value.snap, t = e === !0 ? "auto" : e, r = dt.value, i = n.value.items.length, a = r.currentIndex, o = r.currentColIndex, s = "start", c = "start", l = !1;
|
|
929
|
-
if (D.value !== "horizontal") {
|
|
930
|
-
let e = resolveSnap(t, re, r.currentIndex, r.currentEndIndex, Y.value, p.value, i, (e) => M.get(e), (e) => M.query(e), Q);
|
|
931
|
-
e && (a = e.index, s = e.align, l = !0);
|
|
932
|
-
}
|
|
933
|
-
if (D.value !== "vertical") {
|
|
934
|
-
let e = D.value === "both", a = e ? n.value.columnCount || 0 : i, s = resolveSnap(t, ne, r.currentColIndex, r.currentEndColIndex, J.value, f.value, a, (t) => e ? N.get(t) : j.get(t), (t) => e ? N.query(t) : j.query(t), at);
|
|
935
|
-
s && (o = s.index, c = s.align, l = !0);
|
|
936
|
-
}
|
|
937
|
-
l && tt(a, o, {
|
|
938
|
-
align: {
|
|
939
|
-
x: c,
|
|
940
|
-
y: s
|
|
941
|
-
},
|
|
942
|
-
behavior: "smooth"
|
|
943
|
-
});
|
|
944
|
-
}
|
|
945
|
-
}, 250);
|
|
907
|
+
X(), t === window || t === document ? (i.value = window.scrollX, a.value = window.scrollY, y.value = document.documentElement.clientWidth, b.value = document.documentElement.clientHeight) : isScrollableElement(t) && (i.value = t.scrollLeft, a.value = t.scrollTop, y.value = t.clientWidth, b.value = t.clientHeight);
|
|
908
|
+
let r = displayToVirtual(g.value ? Math.abs(i.value) : i.value, K.x, w.value), s = displayToVirtual(a.value, K.y, E.value);
|
|
909
|
+
Math.abs(r - ie) > .5 && (D.value = r > ie ? "end" : "start", ie = r), Math.abs(s - j) > .5 && (te.value = s > j ? "end" : "start", j = s), o.value = r, c.value = s, k.value || (O.value = null), l.value ||= !0, n.forEach((t) => t.onScroll?.(lt, e)), clearTimeout(C), C = setTimeout(() => {
|
|
910
|
+
l.value = !1, n.forEach((e) => e.onScrollEnd?.(lt)), A === void 0 && (k.value = !1);
|
|
911
|
+
}, 150);
|
|
946
912
|
}, mt = (e) => {
|
|
947
|
-
ke(e,
|
|
948
|
-
|
|
913
|
+
ke(e, Y, $e, q.value, J.value, (e, t) => {
|
|
914
|
+
!O.value && !k.value && it(e, t);
|
|
949
915
|
});
|
|
950
|
-
},
|
|
916
|
+
}, ht = (e, t, n, r) => {
|
|
951
917
|
mt([{
|
|
952
918
|
index: e,
|
|
953
919
|
inlineSize: t,
|
|
@@ -955,136 +921,206 @@ function useVirtualScroll(e) {
|
|
|
955
921
|
element: r
|
|
956
922
|
}]);
|
|
957
923
|
};
|
|
958
|
-
function
|
|
959
|
-
if (
|
|
960
|
-
let { rowIndex: e, colIndex: t, options:
|
|
961
|
-
if (isScrollToIndexOptions(
|
|
962
|
-
let i =
|
|
924
|
+
function gt() {
|
|
925
|
+
if (O.value && !f.value) {
|
|
926
|
+
let { rowIndex: e, colIndex: t, options: n } = O.value;
|
|
927
|
+
if (isScrollToIndexOptions(n) && n.behavior === "smooth" && (l.value || k.value)) return;
|
|
928
|
+
let i = r.value.container || window, a = typeof window < "u" && i === window ? window.scrollX : i.scrollLeft, o = typeof window < "u" && i === window ? window.scrollY : i.scrollTop, s = g.value ? Math.abs(a) : a, c = o, u = displayToVirtual(s, 0, w.value), d = displayToVirtual(c, 0, E.value), { targetX: f, targetY: p } = calculateScrollTarget({
|
|
963
929
|
rowIndex: e,
|
|
964
930
|
colIndex: t,
|
|
965
|
-
options:
|
|
966
|
-
direction:
|
|
967
|
-
viewportWidth:
|
|
968
|
-
viewportHeight:
|
|
969
|
-
totalWidth:
|
|
970
|
-
totalHeight:
|
|
971
|
-
gap:
|
|
972
|
-
columnGap:
|
|
973
|
-
fixedSize:
|
|
974
|
-
fixedWidth:
|
|
931
|
+
options: n,
|
|
932
|
+
direction: M.value,
|
|
933
|
+
viewportWidth: y.value,
|
|
934
|
+
viewportHeight: b.value,
|
|
935
|
+
totalWidth: Ke.value,
|
|
936
|
+
totalHeight: qe.value,
|
|
937
|
+
gap: r.value.gap || 0,
|
|
938
|
+
columnGap: r.value.columnGap || 0,
|
|
939
|
+
fixedSize: P.value,
|
|
940
|
+
fixedWidth: F.value,
|
|
975
941
|
relativeScrollX: u,
|
|
976
|
-
relativeScrollY:
|
|
977
|
-
getItemSizeY: (e) =>
|
|
978
|
-
getItemSizeX: (e) =>
|
|
979
|
-
getItemQueryY: (e) =>
|
|
980
|
-
getItemQueryX: (e) =>
|
|
981
|
-
getColumnSize: (e) =>
|
|
982
|
-
getColumnQuery: (e) =>
|
|
983
|
-
scaleX:
|
|
984
|
-
scaleY:
|
|
985
|
-
hostOffsetX:
|
|
986
|
-
hostOffsetY:
|
|
987
|
-
stickyIndices:
|
|
988
|
-
stickyStartX:
|
|
989
|
-
stickyStartY:
|
|
990
|
-
stickyEndX:
|
|
991
|
-
stickyEndY:
|
|
992
|
-
flowPaddingStartX:
|
|
993
|
-
flowPaddingStartY:
|
|
994
|
-
paddingStartX:
|
|
995
|
-
paddingStartY:
|
|
996
|
-
paddingEndX:
|
|
997
|
-
paddingEndY:
|
|
998
|
-
}),
|
|
999
|
-
_ && v
|
|
1000
|
-
|
|
942
|
+
relativeScrollY: d,
|
|
943
|
+
getItemSizeY: (e) => R.get(e),
|
|
944
|
+
getItemSizeX: (e) => I.get(e),
|
|
945
|
+
getItemQueryY: (e) => R.query(e),
|
|
946
|
+
getItemQueryX: (e) => I.query(e),
|
|
947
|
+
getColumnSize: (e) => z.get(e),
|
|
948
|
+
getColumnQuery: (e) => z.query(e),
|
|
949
|
+
scaleX: w.value,
|
|
950
|
+
scaleY: E.value,
|
|
951
|
+
hostOffsetX: K.x,
|
|
952
|
+
hostOffsetY: K.y,
|
|
953
|
+
stickyIndices: r.value.stickyIndices || [],
|
|
954
|
+
stickyStartX: H.value,
|
|
955
|
+
stickyStartY: U.value,
|
|
956
|
+
stickyEndX: Le.value,
|
|
957
|
+
stickyEndY: Re.value,
|
|
958
|
+
flowPaddingStartX: W.value,
|
|
959
|
+
flowPaddingStartY: Be.value,
|
|
960
|
+
paddingStartX: Ne.value,
|
|
961
|
+
paddingStartY: Fe.value,
|
|
962
|
+
paddingEndX: Pe.value,
|
|
963
|
+
paddingEndY: Ie.value
|
|
964
|
+
}), m = 2 * w.value, h = 2 * E.value, _ = t == null || Math.abs(u - f) < m, v = e == null || Math.abs(d - p) < h;
|
|
965
|
+
if (_ && v) {
|
|
966
|
+
let n = t == null || t === void 0 || ge.value[t] === 1, r = e == null || e === void 0 || B.value[e] === 1;
|
|
967
|
+
n && r && !l.value && !k.value && (O.value = null);
|
|
968
|
+
} else at(e, t, isScrollToIndexOptions(n) ? {
|
|
969
|
+
...n,
|
|
1001
970
|
isCorrection: !0
|
|
1002
971
|
} : {
|
|
1003
|
-
align:
|
|
972
|
+
align: n,
|
|
1004
973
|
isCorrection: !0
|
|
1005
974
|
});
|
|
1006
975
|
}
|
|
1007
976
|
}
|
|
1008
977
|
watch([
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
],
|
|
1013
|
-
e ||
|
|
978
|
+
we,
|
|
979
|
+
y,
|
|
980
|
+
b
|
|
981
|
+
], gt), watch(l, (e) => {
|
|
982
|
+
e || gt();
|
|
1014
983
|
});
|
|
1015
|
-
let
|
|
984
|
+
let Q = () => {
|
|
985
|
+
if (typeof window > "u") return;
|
|
986
|
+
let e = r.value.container || window, t = (t) => {
|
|
987
|
+
let n = t.getBoundingClientRect();
|
|
988
|
+
if (e === window) return {
|
|
989
|
+
x: g.value ? document.documentElement.clientWidth - n.right - window.scrollX : n.left + window.scrollX,
|
|
990
|
+
y: n.top + window.scrollY
|
|
991
|
+
};
|
|
992
|
+
if (e === t) return {
|
|
993
|
+
x: 0,
|
|
994
|
+
y: 0
|
|
995
|
+
};
|
|
996
|
+
if (isElement(e)) {
|
|
997
|
+
let t = e.getBoundingClientRect();
|
|
998
|
+
return {
|
|
999
|
+
x: g.value ? t.right - n.right - e.scrollLeft : n.left - t.left + e.scrollLeft,
|
|
1000
|
+
y: n.top - t.top + e.scrollTop
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
return {
|
|
1004
|
+
x: 0,
|
|
1005
|
+
y: 0
|
|
1006
|
+
};
|
|
1007
|
+
};
|
|
1008
|
+
if (r.value.hostElement) {
|
|
1009
|
+
let e = t(r.value.hostElement);
|
|
1010
|
+
(Math.abs(x.x - e.x) > .1 || Math.abs(x.y - e.y) > .1) && (x.x = e.x, x.y = e.y);
|
|
1011
|
+
}
|
|
1012
|
+
if (r.value.hostRef) {
|
|
1013
|
+
let e = t(r.value.hostRef);
|
|
1014
|
+
(Math.abs(S.x - e.x) > .1 || Math.abs(S.y - e.y) > .1) && (S.x = e.x, S.y = e.y);
|
|
1015
|
+
}
|
|
1016
|
+
}, _t = (e) => {
|
|
1016
1017
|
if (typeof window > "u") return;
|
|
1017
1018
|
let t = e || window, n = t === window || isElement(t) && t === document.documentElement ? document : t;
|
|
1018
|
-
|
|
1019
|
+
n.addEventListener("scroll", pt, { passive: !0 }), X();
|
|
1020
|
+
let r = null;
|
|
1021
|
+
isElement(t) && (r = new MutationObserver(() => X()), r.observe(t, {
|
|
1019
1022
|
attributes: !0,
|
|
1020
1023
|
attributeFilter: ["dir", "style"]
|
|
1021
|
-
}))
|
|
1022
|
-
|
|
1024
|
+
}));
|
|
1025
|
+
let o = setInterval(X, 1e3);
|
|
1026
|
+
if (t === window) {
|
|
1027
|
+
y.value = document.documentElement.clientWidth, b.value = document.documentElement.clientHeight, i.value = window.scrollX, a.value = window.scrollY;
|
|
1023
1028
|
let e = () => {
|
|
1024
|
-
|
|
1029
|
+
X(), y.value = document.documentElement.clientWidth, b.value = document.documentElement.clientHeight, Q();
|
|
1025
1030
|
};
|
|
1026
1031
|
return window.addEventListener("resize", e), () => {
|
|
1027
|
-
n.removeEventListener("scroll", pt), window.removeEventListener("resize", e),
|
|
1032
|
+
n.removeEventListener("scroll", pt), window.removeEventListener("resize", e), r?.disconnect(), clearInterval(o);
|
|
1028
1033
|
};
|
|
1029
|
-
} else
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1034
|
+
} else {
|
|
1035
|
+
y.value = t.clientWidth, b.value = t.clientHeight, i.value = t.scrollLeft, a.value = t.scrollTop;
|
|
1036
|
+
let e = new ResizeObserver(() => {
|
|
1037
|
+
X(), y.value = t.clientWidth, b.value = t.clientHeight, Q();
|
|
1038
|
+
});
|
|
1039
|
+
return e.observe(t), () => {
|
|
1040
|
+
n.removeEventListener("scroll", pt), e.disconnect(), r?.disconnect(), clearInterval(o);
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
}, vt;
|
|
1035
1044
|
return getCurrentInstance() && (onMounted(() => {
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
}, { immediate: !0 }),
|
|
1039
|
-
if (
|
|
1040
|
-
let e =
|
|
1041
|
-
e != null &&
|
|
1045
|
+
p.value = !0, X(), watch(() => r.value.container, (e) => {
|
|
1046
|
+
vt?.(), vt = _t(e || null);
|
|
1047
|
+
}, { immediate: !0 }), Q(), nextTick(() => {
|
|
1048
|
+
if (Q(), r.value.ssrRange || r.value.initialScrollIndex !== void 0) {
|
|
1049
|
+
let e = r.value.initialScrollIndex === void 0 ? r.value.ssrRange?.start : r.value.initialScrollIndex, t = r.value.initialScrollAlign || "start";
|
|
1050
|
+
e != null && at(e, r.value.ssrRange?.colStart, {
|
|
1042
1051
|
align: t,
|
|
1043
1052
|
behavior: "auto"
|
|
1044
|
-
}),
|
|
1045
|
-
|
|
1053
|
+
}), d.value = !0, f.value = !0, nextTick(() => {
|
|
1054
|
+
f.value = !1;
|
|
1046
1055
|
});
|
|
1047
|
-
} else
|
|
1056
|
+
} else d.value = !0;
|
|
1048
1057
|
});
|
|
1049
1058
|
}), onUnmounted(() => {
|
|
1050
|
-
|
|
1051
|
-
})),
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1059
|
+
vt?.();
|
|
1060
|
+
})), watch([
|
|
1061
|
+
() => r.value.items,
|
|
1062
|
+
() => r.value.items.length,
|
|
1063
|
+
() => r.value.direction,
|
|
1064
|
+
() => r.value.columnCount,
|
|
1065
|
+
() => r.value.columnWidth,
|
|
1066
|
+
() => r.value.itemSize,
|
|
1067
|
+
() => r.value.gap,
|
|
1068
|
+
() => r.value.columnGap,
|
|
1069
|
+
() => r.value.defaultItemSize,
|
|
1070
|
+
() => r.value.defaultColumnWidth
|
|
1071
|
+
], () => Oe(), { immediate: !0 }), watch(() => [r.value.container, r.value.hostElement], () => {
|
|
1072
|
+
Q();
|
|
1073
|
+
}), watch(g, (e, t) => {
|
|
1074
|
+
if (t === void 0 || e === t || !p.value) return;
|
|
1075
|
+
if (M.value === "vertical") {
|
|
1076
|
+
Q();
|
|
1077
|
+
return;
|
|
1078
|
+
}
|
|
1079
|
+
let n = displayToVirtual(t ? Math.abs(i.value) : i.value, x.x, w.value);
|
|
1080
|
+
Q(), Z(n, null, { behavior: "auto" });
|
|
1081
|
+
}, { flush: "sync" }), watch([w, E], () => {
|
|
1082
|
+
!p.value || l.value || k.value || Z(o.value, c.value, { behavior: "auto" });
|
|
1083
|
+
}), watch([() => r.value.items.length, () => r.value.columnCount], ([e, t], [n, r]) => {
|
|
1084
|
+
nextTick(() => {
|
|
1085
|
+
let i = Math.max(0, G.value - y.value), a = Math.max(0, Je.value - b.value);
|
|
1086
|
+
o.value > i || c.value > a ? Z(Math.min(o.value, i), Math.min(c.value, a), { behavior: "auto" }) : (e !== n && E.value !== 1 || t !== r && w.value !== 1) && Z(o.value, c.value, { behavior: "auto" }), Q();
|
|
1087
|
+
});
|
|
1088
|
+
}), {
|
|
1089
|
+
renderedItems: dt,
|
|
1090
|
+
totalWidth: G,
|
|
1091
|
+
totalHeight: Je,
|
|
1092
|
+
renderedWidth: Ye,
|
|
1093
|
+
renderedHeight: Xe,
|
|
1094
|
+
scrollDetails: ft,
|
|
1095
|
+
getRowHeight: tt,
|
|
1096
|
+
getColumnWidth: et,
|
|
1097
|
+
getRowOffset: (e) => Be.value + U.value + Fe.value + calculateOffsetAt(e, P.value, r.value.gap || 0, (e) => R.query(e)),
|
|
1061
1098
|
getColumnOffset: (e) => {
|
|
1062
|
-
let t =
|
|
1063
|
-
return
|
|
1099
|
+
let t = W.value + H.value + Ne.value;
|
|
1100
|
+
return M.value === "both" ? t + calculateOffsetAt(e, F.value, r.value.columnGap || 0, (e) => z.query(e)) : t + calculateOffsetAt(e, P.value, r.value.columnGap || 0, (e) => I.query(e));
|
|
1064
1101
|
},
|
|
1065
|
-
getItemOffset:
|
|
1066
|
-
getItemSize:
|
|
1067
|
-
scrollToIndex:
|
|
1068
|
-
scrollToOffset:
|
|
1069
|
-
stopProgrammaticScroll:
|
|
1070
|
-
|
|
1102
|
+
getItemOffset: nt,
|
|
1103
|
+
getItemSize: rt,
|
|
1104
|
+
scrollToIndex: at,
|
|
1105
|
+
scrollToOffset: Z,
|
|
1106
|
+
stopProgrammaticScroll: re,
|
|
1107
|
+
handleScrollCorrection: it,
|
|
1108
|
+
updateItemSize: ht,
|
|
1071
1109
|
updateItemSizes: mt,
|
|
1072
|
-
updateHostOffset:
|
|
1073
|
-
updateDirection:
|
|
1110
|
+
updateHostOffset: Q,
|
|
1111
|
+
updateDirection: X,
|
|
1074
1112
|
columnRange: ct,
|
|
1075
|
-
refresh: () =>
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
getRowIndexAt: Q,
|
|
1087
|
-
getColIndexAt: at
|
|
1113
|
+
refresh: () => je(),
|
|
1114
|
+
isHydrated: d,
|
|
1115
|
+
isWindowContainer: Ge,
|
|
1116
|
+
isRtl: g,
|
|
1117
|
+
scaleX: w,
|
|
1118
|
+
scaleY: E,
|
|
1119
|
+
componentOffset: K,
|
|
1120
|
+
renderedVirtualWidth: Ze,
|
|
1121
|
+
renderedVirtualHeight: Qe,
|
|
1122
|
+
getRowIndexAt: Y,
|
|
1123
|
+
getColIndexAt: $e
|
|
1088
1124
|
};
|
|
1089
1125
|
}
|
|
1090
1126
|
function useVirtualScrollbar(e) {
|
|
@@ -1164,6 +1200,102 @@ function useVirtualScrollbar(e) {
|
|
|
1164
1200
|
isDragging: d
|
|
1165
1201
|
};
|
|
1166
1202
|
}
|
|
1203
|
+
function useRtlExtension() {
|
|
1204
|
+
let e = ref(!1);
|
|
1205
|
+
return {
|
|
1206
|
+
name: "rtl",
|
|
1207
|
+
onInit(t) {
|
|
1208
|
+
let n = () => {
|
|
1209
|
+
if (typeof window > "u") return;
|
|
1210
|
+
let n = t.props.value.container || t.props.value.hostRef || window, r = isElement(n) ? n : document.documentElement, i = window.getComputedStyle(r).direction === "rtl";
|
|
1211
|
+
e.value !== i && (e.value = i, t.internalState.isRtl.value = i);
|
|
1212
|
+
}, r = t.methods.updateDirection;
|
|
1213
|
+
t.methods.updateDirection = () => {
|
|
1214
|
+
n(), r();
|
|
1215
|
+
}, n();
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
}
|
|
1219
|
+
function useSnappingExtension() {
|
|
1220
|
+
return {
|
|
1221
|
+
name: "snapping",
|
|
1222
|
+
onScrollEnd(e) {
|
|
1223
|
+
if (!e.props.value.snap || e.internalState.isProgrammaticScroll.value) return;
|
|
1224
|
+
let t = e.props.value.snap, n = t === !0 ? "auto" : t, r = e.scrollDetails.value, i = e.props.value.items.length, a = e.props.value.direction || "vertical", o = r.currentIndex, s = r.currentColIndex, c = "start", l = "start", u = !1;
|
|
1225
|
+
if (a !== "horizontal") {
|
|
1226
|
+
let t = resolveSnap(n, e.internalState.scrollDirectionY.value, r.currentIndex, r.currentEndIndex, e.internalState.relativeScrollY.value, e.internalState.viewportHeight.value, i, (t) => e.methods.getItemSize(t), (t) => e.methods.getItemOffset(t), e.methods.getRowIndexAt);
|
|
1227
|
+
t && (o = t.index, c = t.align, u = !0);
|
|
1228
|
+
}
|
|
1229
|
+
if (a !== "vertical") {
|
|
1230
|
+
let t = a === "both" ? e.props.value.columnCount || 0 : i, o = resolveSnap(n, e.internalState.scrollDirectionX.value, r.currentColIndex, r.currentEndColIndex, e.internalState.relativeScrollX.value, e.internalState.viewportWidth.value, t, (t) => e.methods.getItemSize(t), (t) => e.methods.getItemOffset(t), e.methods.getColIndexAt);
|
|
1231
|
+
o && (s = o.index, l = o.align, u = !0);
|
|
1232
|
+
}
|
|
1233
|
+
u && e.methods.scrollToIndex(o, s, {
|
|
1234
|
+
align: {
|
|
1235
|
+
x: l,
|
|
1236
|
+
y: c
|
|
1237
|
+
},
|
|
1238
|
+
behavior: "smooth"
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
};
|
|
1242
|
+
}
|
|
1243
|
+
function useStickyExtension() {
|
|
1244
|
+
let e = (e) => computed(() => [...e.props.value.stickyIndices || []].sort((e, t) => e - t));
|
|
1245
|
+
return {
|
|
1246
|
+
name: "sticky",
|
|
1247
|
+
transformRenderedItems(t, n) {
|
|
1248
|
+
let r = e(n).value;
|
|
1249
|
+
if (r.length === 0) return t;
|
|
1250
|
+
let { start: i } = n.range.value, a = n.currentIndex.value, o = findPrevStickyIndex(r, a), s = [...t];
|
|
1251
|
+
return o !== void 0 && o < i && t.some((e) => e.index === o), s;
|
|
1252
|
+
}
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
function useInfiniteLoadingExtension(e) {
|
|
1256
|
+
return {
|
|
1257
|
+
name: "infinite-loading",
|
|
1258
|
+
onInit(t) {
|
|
1259
|
+
watch(t.scrollDetails, (n) => {
|
|
1260
|
+
if (t.props.value.loading || !n || !n.totalSize || n.totalSize.width === 0 && n.totalSize.height === 0) return;
|
|
1261
|
+
let r = t.props.value.direction || "vertical", i = t.props.value.loadDistance ?? 200;
|
|
1262
|
+
r !== "horizontal" && n.totalSize.height - (n.scrollOffset.y + n.viewportSize.height) <= i && e.onLoad("vertical"), r !== "vertical" && n.totalSize.width - (n.scrollOffset.x + n.viewportSize.width) <= i && e.onLoad("horizontal");
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
function usePrependRestorationExtension() {
|
|
1268
|
+
let e = [];
|
|
1269
|
+
return {
|
|
1270
|
+
name: "prepend-restoration",
|
|
1271
|
+
onInit(t) {
|
|
1272
|
+
e = [...t.props.value.items], watch(() => t.props.value.items, (n) => {
|
|
1273
|
+
if (!t.props.value.restoreScrollOnPrepend) {
|
|
1274
|
+
e = [...n];
|
|
1275
|
+
return;
|
|
1276
|
+
}
|
|
1277
|
+
let r = calculatePrependCount(e, n);
|
|
1278
|
+
if (r > 0) {
|
|
1279
|
+
let e = t.props.value.direction || "vertical", i = (e === "horizontal" ? t.props.value.columnGap : t.props.value.gap) || 0, a = 0;
|
|
1280
|
+
for (let e = 0; e < r; e++) a += t.methods.getItemBaseSize(n[e], e) + i;
|
|
1281
|
+
a > 0 && t.methods.handleScrollCorrection(e === "horizontal" ? a : 0, e === "horizontal" ? 0 : a);
|
|
1282
|
+
}
|
|
1283
|
+
e = [...n];
|
|
1284
|
+
}, { deep: !1 });
|
|
1285
|
+
}
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
function useCoordinateScalingExtension() {
|
|
1289
|
+
return {
|
|
1290
|
+
name: "coordinate-scaling",
|
|
1291
|
+
onInit(e) {
|
|
1292
|
+
watchEffect(() => {
|
|
1293
|
+
let t = e.props.value.container, n = e.totalSize.value, r = e.internalState.viewportWidth.value, i = e.internalState.viewportHeight.value, a = typeof window < "u" && t === window || t === void 0;
|
|
1294
|
+
n && r && i && (e.internalState.scaleX.value = calculateScale(a, n.width, r), e.internalState.scaleY.value = calculateScale(a, n.height, i));
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1167
1299
|
var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
1168
1300
|
__name: "VirtualScrollbar",
|
|
1169
1301
|
props: {
|
|
@@ -1266,18 +1398,25 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1266
1398
|
"visibleRangeChange"
|
|
1267
1399
|
],
|
|
1268
1400
|
setup(o, { expose: s, emit: c }) {
|
|
1269
|
-
let _ = o, S = c, T = useSlots(),
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1401
|
+
let _ = o, S = c, T = useSlots(), O = ref(null), A = ref(null), re = ref(null), ie = ref(null), j = /* @__PURE__ */ new Map(), M = useId(), N = computed(() => `vs-container-${M}`), ae = [
|
|
1402
|
+
useRtlExtension(),
|
|
1403
|
+
useSnappingExtension(),
|
|
1404
|
+
useStickyExtension(),
|
|
1405
|
+
useInfiniteLoadingExtension({ onLoad: (e) => S("load", e) }),
|
|
1406
|
+
usePrependRestorationExtension(),
|
|
1407
|
+
useCoordinateScalingExtension()
|
|
1408
|
+
], se = ref(0), ce = ref(0), le = computed(() => _.container === void 0 ? O.value : _.container), ue = computed(() => {
|
|
1409
|
+
let e = le.value;
|
|
1410
|
+
return e === O.value || isWindowLike(e);
|
|
1411
|
+
}), P = computed(() => (_.items.length, {
|
|
1273
1412
|
items: _.items,
|
|
1274
1413
|
itemSize: _.itemSize,
|
|
1275
1414
|
direction: _.direction,
|
|
1276
1415
|
bufferBefore: _.bufferBefore,
|
|
1277
1416
|
bufferAfter: _.bufferAfter,
|
|
1278
|
-
container:
|
|
1279
|
-
hostElement:
|
|
1280
|
-
hostRef:
|
|
1417
|
+
container: le.value,
|
|
1418
|
+
hostElement: A.value,
|
|
1419
|
+
hostRef: O.value,
|
|
1281
1420
|
ssrRange: _.ssrRange,
|
|
1282
1421
|
columnCount: _.columnCount,
|
|
1283
1422
|
columnWidth: _.columnWidth,
|
|
@@ -1291,19 +1430,19 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1291
1430
|
},
|
|
1292
1431
|
flowPaddingStart: {
|
|
1293
1432
|
x: 0,
|
|
1294
|
-
y: _.stickyHeader ? 0 :
|
|
1433
|
+
y: _.stickyHeader ? 0 : se.value
|
|
1295
1434
|
},
|
|
1296
1435
|
flowPaddingEnd: {
|
|
1297
1436
|
x: 0,
|
|
1298
|
-
y: _.stickyFooter ? 0 :
|
|
1437
|
+
y: _.stickyFooter ? 0 : ce.value
|
|
1299
1438
|
},
|
|
1300
1439
|
stickyStart: {
|
|
1301
1440
|
x: 0,
|
|
1302
|
-
y: _.stickyHeader &&
|
|
1441
|
+
y: _.stickyHeader && ue.value ? se.value : 0
|
|
1303
1442
|
},
|
|
1304
1443
|
stickyEnd: {
|
|
1305
1444
|
x: 0,
|
|
1306
|
-
y: _.stickyFooter &&
|
|
1445
|
+
y: _.stickyFooter && ue.value ? ce.value : 0
|
|
1307
1446
|
},
|
|
1308
1447
|
gap: _.gap,
|
|
1309
1448
|
columnGap: _.columnGap,
|
|
@@ -1317,64 +1456,64 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1317
1456
|
defaultColumnWidth: _.defaultColumnWidth,
|
|
1318
1457
|
debug: _.debug,
|
|
1319
1458
|
snap: _.snap
|
|
1320
|
-
})), { isHydrated:
|
|
1321
|
-
function
|
|
1322
|
-
let { displayViewportSize: t } =
|
|
1323
|
-
e >=
|
|
1459
|
+
})), { isHydrated: F, isRtl: pe, columnRange: me, renderedItems: I, scrollDetails: L, renderedHeight: he, renderedWidth: R, getColumnWidth: z, getRowHeight: ge, scrollToIndex: B, scrollToOffset: _e, updateHostOffset: ve, updateItemSizes: ye, updateDirection: be, getItemOffset: xe, getRowOffset: Se, getColumnOffset: Ce, getItemSize: Te, refresh: Ee, stopProgrammaticScroll: V, scaleX: ke, scaleY: Ae, isWindowContainer: je, componentOffset: Me, renderedVirtualWidth: Ue, renderedVirtualHeight: We, getRowIndexAt: Ge, getColIndexAt: Ke } = useVirtualScroll(P, ae), qe = computed(() => ke.value !== 1 || Ae.value !== 1), G = computed(() => je.value ? !1 : _.virtualScrollbar === !0 || ke.value !== 1 || Ae.value !== 1);
|
|
1460
|
+
function Je(e) {
|
|
1461
|
+
let { displayViewportSize: t } = L.value;
|
|
1462
|
+
e >= he.value - t.height - .5 ? _e(null, Infinity) : _e(null, displayToVirtual(e, Me.y, Ae.value));
|
|
1324
1463
|
}
|
|
1325
|
-
function
|
|
1326
|
-
let { displayViewportSize: t } =
|
|
1327
|
-
e >=
|
|
1464
|
+
function K(e) {
|
|
1465
|
+
let { displayViewportSize: t } = L.value;
|
|
1466
|
+
e >= R.value - t.width - .5 ? _e(Infinity, null) : _e(displayToVirtual(e, Me.x, ke.value), null);
|
|
1328
1467
|
}
|
|
1329
|
-
let
|
|
1468
|
+
let Ye = useVirtualScrollbar(computed(() => ({
|
|
1330
1469
|
axis: "vertical",
|
|
1331
|
-
totalSize:
|
|
1332
|
-
position:
|
|
1333
|
-
viewportSize:
|
|
1334
|
-
scrollToOffset:
|
|
1335
|
-
containerId:
|
|
1336
|
-
isRtl:
|
|
1337
|
-
}))),
|
|
1470
|
+
totalSize: he.value,
|
|
1471
|
+
position: L.value.displayScrollOffset.y,
|
|
1472
|
+
viewportSize: L.value.displayViewportSize.height,
|
|
1473
|
+
scrollToOffset: Je,
|
|
1474
|
+
containerId: N.value,
|
|
1475
|
+
isRtl: pe.value
|
|
1476
|
+
}))), Xe = useVirtualScrollbar(computed(() => ({
|
|
1338
1477
|
axis: "horizontal",
|
|
1339
|
-
totalSize:
|
|
1340
|
-
position:
|
|
1341
|
-
viewportSize:
|
|
1342
|
-
scrollToOffset:
|
|
1343
|
-
containerId:
|
|
1344
|
-
isRtl:
|
|
1345
|
-
}))),
|
|
1346
|
-
...
|
|
1478
|
+
totalSize: R.value,
|
|
1479
|
+
position: L.value.displayScrollOffset.x,
|
|
1480
|
+
viewportSize: L.value.displayViewportSize.width,
|
|
1481
|
+
scrollToOffset: K,
|
|
1482
|
+
containerId: N.value,
|
|
1483
|
+
isRtl: pe.value
|
|
1484
|
+
}))), Ze = computed(() => _.direction === "both" ? {
|
|
1485
|
+
...me.value,
|
|
1347
1486
|
padStart: 0,
|
|
1348
1487
|
padEnd: 0
|
|
1349
|
-
} :
|
|
1350
|
-
function
|
|
1351
|
-
|
|
1488
|
+
} : me.value);
|
|
1489
|
+
function Qe() {
|
|
1490
|
+
Ee(), be(), nextTick(() => {
|
|
1352
1491
|
let e = [];
|
|
1353
|
-
for (let [t, n] of
|
|
1492
|
+
for (let [t, n] of j.entries()) n && e.push({
|
|
1354
1493
|
index: t,
|
|
1355
1494
|
inlineSize: n.offsetWidth,
|
|
1356
1495
|
blockSize: n.offsetHeight,
|
|
1357
1496
|
element: n
|
|
1358
1497
|
});
|
|
1359
|
-
e.length > 0 &&
|
|
1498
|
+
e.length > 0 && ye(e);
|
|
1360
1499
|
});
|
|
1361
1500
|
}
|
|
1362
|
-
watch(
|
|
1363
|
-
!
|
|
1501
|
+
watch(L, (e, t) => {
|
|
1502
|
+
!F.value || !e || (S("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) && S("visibleRangeChange", {
|
|
1364
1503
|
start: e.range.start,
|
|
1365
1504
|
end: e.range.end,
|
|
1366
1505
|
colStart: e.columnRange.start,
|
|
1367
1506
|
colEnd: e.columnRange.end
|
|
1368
|
-
})
|
|
1369
|
-
}), watch(
|
|
1370
|
-
e &&
|
|
1371
|
-
start:
|
|
1372
|
-
end:
|
|
1373
|
-
colStart:
|
|
1374
|
-
colEnd:
|
|
1507
|
+
}));
|
|
1508
|
+
}), watch(F, (e) => {
|
|
1509
|
+
e && L.value?.range && L.value?.columnRange && S("visibleRangeChange", {
|
|
1510
|
+
start: L.value.range.start,
|
|
1511
|
+
end: L.value.range.end,
|
|
1512
|
+
colStart: L.value.columnRange.start,
|
|
1513
|
+
colEnd: L.value.columnRange.end
|
|
1375
1514
|
});
|
|
1376
1515
|
}, { once: !0 });
|
|
1377
|
-
let
|
|
1516
|
+
let q = typeof window > "u" ? null : new ResizeObserver(ve), J = typeof window > "u" ? null : new ResizeObserver((e) => {
|
|
1378
1517
|
let t = [];
|
|
1379
1518
|
for (let n of e) {
|
|
1380
1519
|
let e = n.target, r = Number(e.dataset.index), i = e.dataset.colIndex, a = n.contentRect.width, o = n.contentRect.height;
|
|
@@ -1390,196 +1529,196 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1390
1529
|
element: e
|
|
1391
1530
|
});
|
|
1392
1531
|
}
|
|
1393
|
-
t.length > 0 &&
|
|
1394
|
-
}),
|
|
1395
|
-
|
|
1532
|
+
t.length > 0 && ye(t);
|
|
1533
|
+
}), Y = typeof window > "u" ? null : new ResizeObserver(() => {
|
|
1534
|
+
se.value = re.value?.offsetHeight || 0, ce.value = ie.value?.offsetHeight || 0, ve();
|
|
1396
1535
|
});
|
|
1397
|
-
function
|
|
1536
|
+
function $e(e, t) {
|
|
1398
1537
|
watch(e, (e, n) => {
|
|
1399
|
-
n &&
|
|
1538
|
+
n && Y?.unobserve(n), e ? Y?.observe(e) : t.value = 0;
|
|
1400
1539
|
}, { immediate: !0 });
|
|
1401
1540
|
}
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
for (let e of
|
|
1405
|
-
}), watch([
|
|
1406
|
-
t &&
|
|
1407
|
-
}), watch([
|
|
1541
|
+
$e(re, se), $e(ie, ce), onMounted(() => {
|
|
1542
|
+
O.value && q?.observe(O.value);
|
|
1543
|
+
for (let e of j.values()) et(e, !0);
|
|
1544
|
+
}), watch([O, A], ([e], [t]) => {
|
|
1545
|
+
t && q?.unobserve(t), e && q?.observe(e);
|
|
1546
|
+
}), watch([O, qe], ([e, t], [n, r]) => {
|
|
1408
1547
|
let i = e !== n || t !== r;
|
|
1409
|
-
n && i && n.removeEventListener("wheel",
|
|
1548
|
+
n && i && n.removeEventListener("wheel", ft), e && i && e.addEventListener("wheel", ft, { passive: !t });
|
|
1410
1549
|
}, { immediate: !0 });
|
|
1411
|
-
function
|
|
1550
|
+
function et(e, t) {
|
|
1412
1551
|
let n = t ? "observe" : "unobserve";
|
|
1413
|
-
|
|
1552
|
+
J?.[n](e), _.direction === "both" && e.children.length > 0 && e.querySelectorAll("[data-col-index]").forEach((e) => J?.[n](e));
|
|
1414
1553
|
}
|
|
1415
|
-
function
|
|
1554
|
+
function tt(e, t) {
|
|
1416
1555
|
if (e) {
|
|
1417
1556
|
let n = e;
|
|
1418
|
-
|
|
1557
|
+
j.set(t, n), et(n, !0);
|
|
1419
1558
|
} else {
|
|
1420
|
-
let e =
|
|
1421
|
-
e && (
|
|
1559
|
+
let e = j.get(t);
|
|
1560
|
+
e && (et(e, !1), j.delete(t));
|
|
1422
1561
|
}
|
|
1423
1562
|
}
|
|
1424
|
-
let
|
|
1563
|
+
let nt = ref(!1), rt = {
|
|
1425
1564
|
x: 0,
|
|
1426
1565
|
y: 0
|
|
1427
|
-
},
|
|
1566
|
+
}, X = {
|
|
1428
1567
|
x: 0,
|
|
1429
1568
|
y: 0
|
|
1430
|
-
},
|
|
1569
|
+
}, it = {
|
|
1431
1570
|
x: 0,
|
|
1432
1571
|
y: 0
|
|
1433
|
-
},
|
|
1572
|
+
}, at = 0, Z = {
|
|
1434
1573
|
x: 0,
|
|
1435
1574
|
y: 0
|
|
1436
|
-
},
|
|
1437
|
-
function
|
|
1575
|
+
}, ot = null;
|
|
1576
|
+
function st() {
|
|
1438
1577
|
let e = () => {
|
|
1439
|
-
let { nextVelocity: t, delta: n } = calculateInertiaStep(
|
|
1440
|
-
|
|
1441
|
-
let { x: r, y: i } =
|
|
1442
|
-
|
|
1578
|
+
let { nextVelocity: t, delta: n } = calculateInertiaStep(Z, FRICTION);
|
|
1579
|
+
Z.x = t.x, Z.y = t.y;
|
|
1580
|
+
let { x: r, y: i } = L.value.scrollOffset;
|
|
1581
|
+
_e(r + n.x, i + n.y, { behavior: "auto" }), Math.abs(Z.x) > MIN_VELOCITY || Math.abs(Z.y) > MIN_VELOCITY ? ot = requestAnimationFrame(e) : ct();
|
|
1443
1582
|
};
|
|
1444
|
-
|
|
1583
|
+
ot = requestAnimationFrame(e);
|
|
1445
1584
|
}
|
|
1446
|
-
function
|
|
1447
|
-
|
|
1585
|
+
function ct() {
|
|
1586
|
+
ot !== null && (cancelAnimationFrame(ot), ot = null), Z = {
|
|
1448
1587
|
x: 0,
|
|
1449
1588
|
y: 0
|
|
1450
1589
|
};
|
|
1451
1590
|
}
|
|
1452
|
-
function
|
|
1453
|
-
|
|
1591
|
+
function lt(e) {
|
|
1592
|
+
V(), ct(), qe.value && (e.pointerType === "mouse" && e.button !== 0 || (nt.value = !0, rt = {
|
|
1454
1593
|
x: e.clientX,
|
|
1455
1594
|
y: e.clientY
|
|
1456
|
-
},
|
|
1595
|
+
}, it = {
|
|
1457
1596
|
x: e.clientX,
|
|
1458
1597
|
y: e.clientY
|
|
1459
|
-
},
|
|
1460
|
-
x:
|
|
1461
|
-
y:
|
|
1598
|
+
}, at = performance.now(), X = {
|
|
1599
|
+
x: L.value.scrollOffset.x,
|
|
1600
|
+
y: L.value.scrollOffset.y
|
|
1462
1601
|
}, e.currentTarget.setPointerCapture(e.pointerId)));
|
|
1463
1602
|
}
|
|
1464
|
-
function
|
|
1465
|
-
if (
|
|
1466
|
-
let t = performance.now(), n = t -
|
|
1603
|
+
function ut(e) {
|
|
1604
|
+
if (!nt.value) return;
|
|
1605
|
+
let t = performance.now(), n = t - at;
|
|
1467
1606
|
if (n > 0) {
|
|
1468
|
-
let t = calculateInstantaneousVelocity(
|
|
1607
|
+
let t = calculateInstantaneousVelocity(it, {
|
|
1469
1608
|
x: e.clientX,
|
|
1470
1609
|
y: e.clientY
|
|
1471
1610
|
}, n);
|
|
1472
|
-
|
|
1611
|
+
Z.x = Z.x * .2 + t.x * .8, Z.y = Z.y * .2 + t.y * .8;
|
|
1473
1612
|
}
|
|
1474
|
-
|
|
1613
|
+
it = {
|
|
1475
1614
|
x: e.clientX,
|
|
1476
1615
|
y: e.clientY
|
|
1477
|
-
},
|
|
1478
|
-
let r =
|
|
1616
|
+
}, at = t;
|
|
1617
|
+
let r = rt.x - e.clientX, i = rt.y - e.clientY;
|
|
1479
1618
|
requestAnimationFrame(() => {
|
|
1480
|
-
|
|
1619
|
+
_e(X.x + r, X.y + i, { behavior: "auto" });
|
|
1481
1620
|
});
|
|
1482
1621
|
}
|
|
1483
|
-
function
|
|
1484
|
-
|
|
1622
|
+
function dt(e) {
|
|
1623
|
+
nt.value && (nt.value = !1, e.currentTarget.releasePointerCapture(e.pointerId), (Math.abs(Z.x) > MIN_VELOCITY || Math.abs(Z.y) > MIN_VELOCITY) && (Math.abs(Z.x) > 4 * Math.abs(Z.y) ? Z.y = 0 : Math.abs(Z.y) > 4 * Math.abs(Z.x) && (Z.x = 0), st()));
|
|
1485
1624
|
}
|
|
1486
|
-
function
|
|
1487
|
-
let { scrollOffset: t } =
|
|
1488
|
-
if (
|
|
1625
|
+
function ft(e) {
|
|
1626
|
+
let { scrollOffset: t } = L.value;
|
|
1627
|
+
if (V(), qe.value) {
|
|
1489
1628
|
e.preventDefault();
|
|
1490
1629
|
let { deltaX: n, deltaY: r } = e;
|
|
1491
|
-
e.shiftKey && n === 0 && (n = r, r = 0),
|
|
1630
|
+
e.shiftKey && n === 0 && (n = r, r = 0), _e(t.x + n, t.y + r, { behavior: "auto" });
|
|
1492
1631
|
}
|
|
1493
1632
|
}
|
|
1494
|
-
function
|
|
1495
|
-
let { viewportSize: t, scrollOffset: n } =
|
|
1633
|
+
function pt(e) {
|
|
1634
|
+
let { viewportSize: t, scrollOffset: n } = L.value, r = _.direction !== "vertical", i = _.direction !== "horizontal", a = P.value, o = a.stickyStart, s = a.stickyEnd, c = a.scrollPaddingStart, l = a.scrollPaddingEnd, u = _.snap === !0 ? "auto" : _.snap, d = u && u !== "auto" ? u : null, f = (e) => {
|
|
1496
1635
|
let r = (e ? n.x : n.y) + (e ? t.width : t.height) / 2;
|
|
1497
|
-
return e ?
|
|
1498
|
-
}, { currentIndex: p, currentEndIndex: m, currentColIndex: h, currentEndColIndex: g } =
|
|
1636
|
+
return e ? Ke(r) : Ge(r);
|
|
1637
|
+
}, { currentIndex: p, currentEndIndex: m, currentColIndex: h, currentEndColIndex: g } = L.value, v = (e, t) => {
|
|
1499
1638
|
let n = !e, r = e ? p : h, i = e ? m : g, a = Math.max(1, i - r), o = e ? _.items.length - 1 : _.columnCount ? _.columnCount - 1 : _.items.length - 1;
|
|
1500
1639
|
return t ? d === "center" ? Math.min(o, f(n) + a) : d === "end" ? Math.min(o, i + a) : i : d === "center" ? Math.max(0, f(n) - a) : d === "start" ? Math.max(0, r - a) : r;
|
|
1501
1640
|
}, y = (e, r) => {
|
|
1502
1641
|
let i = !e;
|
|
1503
1642
|
if (d === "center") {
|
|
1504
1643
|
let t = f(i), n = i && _.columnCount ? _.columnCount - 1 : _.items.length - 1, a = r ? Math.min(n, t + 1) : Math.max(0, t - 1);
|
|
1505
|
-
|
|
1644
|
+
B(e ? a : null, i ? a : null, { align: "center" });
|
|
1506
1645
|
return;
|
|
1507
1646
|
}
|
|
1508
|
-
if (e) if (r) if (d === "start")
|
|
1647
|
+
if (e) if (r) if (d === "start") B(Math.min(_.items.length - 1, p + 1), null, { align: "start" });
|
|
1509
1648
|
else {
|
|
1510
1649
|
let e = d || "end", r = n.y + t.height - (s.y + l.y);
|
|
1511
|
-
|
|
1650
|
+
Se(m) + ge(m) > r + 1 ? B(m, null, { align: e }) : m < _.items.length - 1 && B(m + 1, null, { align: e });
|
|
1512
1651
|
}
|
|
1513
|
-
else if (d === "end")
|
|
1652
|
+
else if (d === "end") B(Math.max(0, m - 1), null, { align: "end" });
|
|
1514
1653
|
else {
|
|
1515
1654
|
let e = d || "start", t = n.y + o.y + c.y;
|
|
1516
|
-
|
|
1655
|
+
Se(p) < t - 1 ? B(p, null, { align: e }) : p > 0 && B(p - 1, null, { align: e });
|
|
1517
1656
|
}
|
|
1518
1657
|
else {
|
|
1519
1658
|
let e = _.columnCount ? _.columnCount - 1 : _.items.length - 1;
|
|
1520
|
-
if (
|
|
1659
|
+
if (pe.value ? !r : r) if (d === "start") B(null, Math.min(e, h + 1), { align: "start" });
|
|
1521
1660
|
else {
|
|
1522
1661
|
let r = d || "end", i = n.x + t.width - (s.x + l.x);
|
|
1523
|
-
(_.columnCount ?
|
|
1662
|
+
(_.columnCount ? Ce(g) + z(g) : xe(g) + Te(g)) > i + 1 ? B(null, g, { align: r }) : g < e && B(null, g + 1, { align: r });
|
|
1524
1663
|
}
|
|
1525
|
-
else if (d === "end")
|
|
1664
|
+
else if (d === "end") B(null, Math.max(0, g - 1), { align: "end" });
|
|
1526
1665
|
else {
|
|
1527
1666
|
let e = d || "start", t = n.x + o.x + c.x;
|
|
1528
|
-
(_.columnCount ?
|
|
1667
|
+
(_.columnCount ? Ce(h) : xe(h)) < t - 1 ? B(null, h, { align: e }) : h > 0 && B(null, h - 1, { align: e });
|
|
1529
1668
|
}
|
|
1530
1669
|
}
|
|
1531
1670
|
};
|
|
1532
1671
|
switch (e.key) {
|
|
1533
1672
|
case "Home":
|
|
1534
|
-
e.preventDefault(),
|
|
1673
|
+
e.preventDefault(), V(), B(0, 0, {
|
|
1535
1674
|
behavior: Math.max(n.x, n.y) > 10 * (_.direction === "horizontal" ? t.width : t.height) ? "auto" : "smooth",
|
|
1536
1675
|
align: "start"
|
|
1537
1676
|
});
|
|
1538
1677
|
break;
|
|
1539
1678
|
case "End": {
|
|
1540
|
-
e.preventDefault(),
|
|
1541
|
-
let r = _.items.length - 1, i = (_.columnCount || 0) > 0 ? _.columnCount - 1 : 0, { totalSize: a } =
|
|
1542
|
-
_.direction === "both" ?
|
|
1679
|
+
e.preventDefault(), V();
|
|
1680
|
+
let r = _.items.length - 1, i = (_.columnCount || 0) > 0 ? _.columnCount - 1 : 0, { totalSize: a } = L.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";
|
|
1681
|
+
_.direction === "both" ? B(r, i, {
|
|
1543
1682
|
behavior: o,
|
|
1544
1683
|
align: "end"
|
|
1545
|
-
}) :
|
|
1684
|
+
}) : B(_.direction === "vertical" ? r : 0, _.direction === "horizontal" ? r : 0, {
|
|
1546
1685
|
behavior: o,
|
|
1547
1686
|
align: "end"
|
|
1548
1687
|
});
|
|
1549
1688
|
break;
|
|
1550
1689
|
}
|
|
1551
1690
|
case "ArrowUp":
|
|
1552
|
-
e.preventDefault(),
|
|
1691
|
+
e.preventDefault(), V(), i && y(!0, !1);
|
|
1553
1692
|
break;
|
|
1554
1693
|
case "ArrowDown":
|
|
1555
|
-
e.preventDefault(),
|
|
1694
|
+
e.preventDefault(), V(), i && y(!0, !0);
|
|
1556
1695
|
break;
|
|
1557
1696
|
case "ArrowLeft":
|
|
1558
|
-
e.preventDefault(),
|
|
1697
|
+
e.preventDefault(), V(), r && y(!1, !1);
|
|
1559
1698
|
break;
|
|
1560
1699
|
case "ArrowRight":
|
|
1561
|
-
e.preventDefault(),
|
|
1700
|
+
e.preventDefault(), V(), r && y(!1, !0);
|
|
1562
1701
|
break;
|
|
1563
1702
|
case "PageUp":
|
|
1564
|
-
e.preventDefault(),
|
|
1703
|
+
e.preventDefault(), V(), _.direction === "horizontal" ? B(null, v(!1, !1), { align: d || "end" }) : B(v(!0, !1), null, { align: d || "end" });
|
|
1565
1704
|
break;
|
|
1566
1705
|
case "PageDown":
|
|
1567
|
-
e.preventDefault(),
|
|
1706
|
+
e.preventDefault(), V(), _.direction === "horizontal" ? B(null, v(!1, !0), { align: d || "start" }) : B(v(!0, !0), null, { align: d || "start" });
|
|
1568
1707
|
break;
|
|
1569
1708
|
}
|
|
1570
1709
|
}
|
|
1571
1710
|
onUnmounted(() => {
|
|
1572
|
-
|
|
1711
|
+
q?.disconnect(), J?.disconnect(), Y?.disconnect();
|
|
1573
1712
|
});
|
|
1574
|
-
let
|
|
1713
|
+
let mt = computed(() => {
|
|
1575
1714
|
let e = { ..._.direction === "vertical" ? {} : { whiteSpace: "nowrap" } };
|
|
1576
|
-
return (
|
|
1715
|
+
return (G.value || !je.value) && (e.overflow = "auto"), qe.value && (e.touchAction = "none"), je.value ? e : _.containerTag === "table" ? {
|
|
1577
1716
|
...e,
|
|
1578
1717
|
display: "block",
|
|
1579
1718
|
minInlineSize: _.direction === "vertical" ? "100%" : "auto"
|
|
1580
1719
|
} : e;
|
|
1581
1720
|
});
|
|
1582
|
-
function
|
|
1721
|
+
function ht(e, t, n, r, i, a) {
|
|
1583
1722
|
return t <= r ? null : {
|
|
1584
1723
|
axis: e,
|
|
1585
1724
|
positionPercent: a.positionPercent.value,
|
|
@@ -1594,28 +1733,28 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1594
1733
|
position: n,
|
|
1595
1734
|
viewportSize: r,
|
|
1596
1735
|
scrollToOffset: i,
|
|
1597
|
-
containerId:
|
|
1598
|
-
isRtl:
|
|
1736
|
+
containerId: N.value,
|
|
1737
|
+
isRtl: pe.value,
|
|
1599
1738
|
ariaLabel: `${e === "vertical" ? "Vertical" : "Horizontal"} scroll`
|
|
1600
1739
|
},
|
|
1601
1740
|
isDragging: a.isDragging.value
|
|
1602
1741
|
};
|
|
1603
1742
|
}
|
|
1604
|
-
let
|
|
1743
|
+
let gt = computed(() => {
|
|
1605
1744
|
if (_.direction === "horizontal") return null;
|
|
1606
|
-
let { displayViewportSize: e, displayScrollOffset: t } =
|
|
1607
|
-
return
|
|
1608
|
-
}),
|
|
1745
|
+
let { displayViewportSize: e, displayScrollOffset: t } = L.value;
|
|
1746
|
+
return ht("vertical", he.value, t.y, e.height, Je, Ye);
|
|
1747
|
+
}), Q = computed(() => {
|
|
1609
1748
|
if (_.direction === "vertical") return null;
|
|
1610
|
-
let { displayViewportSize: e, displayScrollOffset: t } =
|
|
1611
|
-
return
|
|
1612
|
-
}),
|
|
1749
|
+
let { displayViewportSize: e, displayScrollOffset: t } = L.value;
|
|
1750
|
+
return ht("horizontal", R.value, t.x, e.width, K, Xe);
|
|
1751
|
+
}), _t = computed(() => {
|
|
1613
1752
|
let e = _.direction === "horizontal", t = _.direction === "vertical", n = _.direction === "both", r = {
|
|
1614
|
-
inlineSize: t ? "100%" : `${
|
|
1615
|
-
blockSize: e ? "100%" : `${
|
|
1753
|
+
inlineSize: t ? "100%" : `${Ue.value}px`,
|
|
1754
|
+
blockSize: e ? "100%" : `${We.value}px`
|
|
1616
1755
|
};
|
|
1617
|
-
return
|
|
1618
|
-
}),
|
|
1756
|
+
return F.value || (r.display = "flex", r.flexDirection = e ? "row" : "column", (e || n) && _.columnGap && (r.columnGap = `${_.columnGap}px`), (t || n) && _.gap && (r.rowGap = `${_.gap}px`)), r;
|
|
1757
|
+
}), vt = computed(() => {
|
|
1619
1758
|
let e = _.direction === "horizontal";
|
|
1620
1759
|
return {
|
|
1621
1760
|
display: e ? "inline-block" : "block",
|
|
@@ -1624,122 +1763,124 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1624
1763
|
verticalAlign: "top"
|
|
1625
1764
|
} : { inlineSize: "100%" }
|
|
1626
1765
|
};
|
|
1627
|
-
}),
|
|
1628
|
-
inlineSize: _.direction === "vertical" ? "1px" : `${
|
|
1629
|
-
blockSize: _.direction === "horizontal" ? "1px" : `${
|
|
1766
|
+
}), yt = computed(() => ({
|
|
1767
|
+
inlineSize: _.direction === "vertical" ? "1px" : `${Ue.value}px`,
|
|
1768
|
+
blockSize: _.direction === "horizontal" ? "1px" : `${We.value}px`
|
|
1630
1769
|
}));
|
|
1631
|
-
function
|
|
1770
|
+
function bt(e) {
|
|
1632
1771
|
let t = calculateItemStyle({
|
|
1633
1772
|
containerTag: _.containerTag || "div",
|
|
1634
1773
|
direction: _.direction,
|
|
1635
|
-
isHydrated:
|
|
1774
|
+
isHydrated: F.value,
|
|
1636
1775
|
item: e,
|
|
1637
1776
|
itemSize: _.itemSize,
|
|
1638
|
-
paddingStartX:
|
|
1639
|
-
paddingStartY:
|
|
1640
|
-
isRtl:
|
|
1777
|
+
paddingStartX: P.value.scrollPaddingStart.x,
|
|
1778
|
+
paddingStartY: P.value.scrollPaddingStart.y,
|
|
1779
|
+
isRtl: pe.value
|
|
1641
1780
|
});
|
|
1642
|
-
return !
|
|
1781
|
+
return !F.value && _.direction === "both" && (t.display = "flex", _.columnGap && (t.columnGap = `${_.columnGap}px`)), t;
|
|
1643
1782
|
}
|
|
1644
|
-
let
|
|
1645
|
-
if (
|
|
1646
|
-
let e =
|
|
1783
|
+
let xt = computed(() => _.debug), $ = computed(() => _.containerTag === "table"), St = computed(() => $.value ? "thead" : "div"), Ct = computed(() => $.value ? "tfoot" : "div"), wt = computed(() => _.role ? _.role : $.value ? null : _.direction === "both" ? "grid" : "list"), Tt = computed(() => wt.value === "grid" || $.value), Et = computed(() => $.value ? null : _.ariaLabel || _.ariaLabelledby ? "region" : "none"), Dt = computed(() => $.value ? null : wt.value), Ot = computed(() => {
|
|
1784
|
+
if (Tt.value) return "row";
|
|
1785
|
+
let e = wt.value;
|
|
1647
1786
|
return e === "tree" ? "treeitem" : e === "listbox" ? "option" : e === "menu" ? "menuitem" : "listitem";
|
|
1648
|
-
}),
|
|
1649
|
-
let e =
|
|
1787
|
+
}), kt = computed(() => _.itemRole == null ? Ot.value : _.itemRole), At = computed(() => _.role === "grid" || !_.role && _.direction === "both" ? "gridcell" : $.value ? "cell" : null), jt = computed(() => {
|
|
1788
|
+
let e = kt.value;
|
|
1650
1789
|
return e == null || e !== "none" && e !== "presentation";
|
|
1651
|
-
}),
|
|
1790
|
+
}), Mt = computed(() => ({
|
|
1652
1791
|
"aria-label": _.ariaLabel,
|
|
1653
1792
|
"aria-labelledby": _.ariaLabelledby,
|
|
1654
1793
|
"aria-busy": _.loading ? "true" : void 0
|
|
1655
|
-
})),
|
|
1656
|
-
let e = {}, t =
|
|
1794
|
+
})), Nt = computed(() => {
|
|
1795
|
+
let e = {}, t = wt.value;
|
|
1657
1796
|
return t && [
|
|
1658
1797
|
"grid",
|
|
1659
1798
|
"tree",
|
|
1660
1799
|
"listbox",
|
|
1661
1800
|
"menu",
|
|
1662
1801
|
"tablist"
|
|
1663
|
-
].includes(t) && (e["aria-orientation"] = _.direction === "both" ? void 0 : _.direction),
|
|
1802
|
+
].includes(t) && (e["aria-orientation"] = _.direction === "both" ? void 0 : _.direction), Tt.value && (e["aria-rowcount"] = _.items.length, _.columnCount > 0 && (e["aria-colcount"] = _.columnCount)), e;
|
|
1664
1803
|
});
|
|
1665
|
-
function
|
|
1804
|
+
function Pt(e) {
|
|
1666
1805
|
let t = {};
|
|
1667
|
-
|
|
1668
|
-
let n =
|
|
1669
|
-
return n !== null && (t.role = n === "none" || n === "presentation" ?
|
|
1806
|
+
Tt.value ? t["aria-rowindex"] = e + 1 : (t["aria-setsize"] = _.items.length, t["aria-posinset"] = e + 1);
|
|
1807
|
+
let n = kt.value;
|
|
1808
|
+
return n !== null && (t.role = n === "none" || n === "presentation" ? Ot.value : n), t;
|
|
1670
1809
|
}
|
|
1671
|
-
function
|
|
1672
|
-
let t =
|
|
1810
|
+
function Ft(e) {
|
|
1811
|
+
let t = At.value;
|
|
1673
1812
|
if (!t) return {};
|
|
1674
1813
|
let n = { role: t };
|
|
1675
|
-
return
|
|
1814
|
+
return Tt.value && (n["aria-colindex"] = e + 1), n;
|
|
1676
1815
|
}
|
|
1677
1816
|
return s({
|
|
1678
1817
|
...toRefs(_),
|
|
1679
|
-
scrollDetails:
|
|
1680
|
-
columnRange:
|
|
1681
|
-
getColumnWidth:
|
|
1682
|
-
getRowHeight:
|
|
1683
|
-
getCellAriaProps:
|
|
1684
|
-
getItemAriaProps:
|
|
1685
|
-
getRowOffset:
|
|
1686
|
-
getColumnOffset:
|
|
1687
|
-
getItemOffset:
|
|
1688
|
-
getItemSize:
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1818
|
+
scrollDetails: L,
|
|
1819
|
+
columnRange: me,
|
|
1820
|
+
getColumnWidth: z,
|
|
1821
|
+
getRowHeight: ge,
|
|
1822
|
+
getCellAriaProps: Ft,
|
|
1823
|
+
getItemAriaProps: Pt,
|
|
1824
|
+
getRowOffset: Se,
|
|
1825
|
+
getColumnOffset: Ce,
|
|
1826
|
+
getItemOffset: xe,
|
|
1827
|
+
getItemSize: Te,
|
|
1828
|
+
isTable: $,
|
|
1829
|
+
itemTag: computed(() => _.itemTag || "div"),
|
|
1830
|
+
getRowIndexAt: Ge,
|
|
1831
|
+
getColIndexAt: Ke,
|
|
1832
|
+
scrollToIndex: B,
|
|
1833
|
+
scrollToOffset: _e,
|
|
1834
|
+
refresh: Qe,
|
|
1694
1835
|
stopProgrammaticScroll: () => {
|
|
1695
|
-
|
|
1836
|
+
V(), ct();
|
|
1696
1837
|
},
|
|
1697
|
-
updateDirection:
|
|
1698
|
-
isRtl:
|
|
1699
|
-
isHydrated:
|
|
1700
|
-
scaleX:
|
|
1701
|
-
scaleY:
|
|
1702
|
-
renderedWidth:
|
|
1703
|
-
renderedHeight:
|
|
1704
|
-
componentOffset:
|
|
1705
|
-
scrollbarPropsVertical:
|
|
1706
|
-
scrollbarPropsHorizontal:
|
|
1838
|
+
updateDirection: be,
|
|
1839
|
+
isRtl: pe,
|
|
1840
|
+
isHydrated: F,
|
|
1841
|
+
scaleX: ke,
|
|
1842
|
+
scaleY: Ae,
|
|
1843
|
+
renderedWidth: R,
|
|
1844
|
+
renderedHeight: he,
|
|
1845
|
+
componentOffset: Me,
|
|
1846
|
+
scrollbarPropsVertical: gt,
|
|
1847
|
+
scrollbarPropsHorizontal: Q
|
|
1707
1848
|
}), (t, s) => (openBlock(), createBlock(resolveDynamicComponent(o.containerTag), mergeProps({
|
|
1708
|
-
id:
|
|
1849
|
+
id: N.value,
|
|
1709
1850
|
ref_key: "hostRef",
|
|
1710
|
-
ref:
|
|
1851
|
+
ref: O,
|
|
1711
1852
|
class: ["virtual-scroll-container", [`virtual-scroll--${o.direction}`, {
|
|
1712
|
-
"virtual-scroll--hydrated": unref(
|
|
1713
|
-
"virtual-scroll--window": unref(
|
|
1853
|
+
"virtual-scroll--hydrated": unref(F),
|
|
1854
|
+
"virtual-scroll--window": unref(je),
|
|
1714
1855
|
"virtual-scroll--table": $.value,
|
|
1715
|
-
"virtual-scroll--hide-scrollbar":
|
|
1856
|
+
"virtual-scroll--hide-scrollbar": G.value
|
|
1716
1857
|
}]],
|
|
1717
|
-
style:
|
|
1858
|
+
style: mt.value,
|
|
1718
1859
|
tabindex: "0",
|
|
1719
|
-
role: $.value ? void 0 :
|
|
1860
|
+
role: $.value ? void 0 : Et.value
|
|
1720
1861
|
}, $.value ? {
|
|
1721
|
-
...
|
|
1722
|
-
...
|
|
1723
|
-
} :
|
|
1724
|
-
onKeydown:
|
|
1725
|
-
onPointerdown:
|
|
1726
|
-
onPointermove:
|
|
1727
|
-
onPointerup:
|
|
1728
|
-
onPointercancel:
|
|
1862
|
+
...Mt.value,
|
|
1863
|
+
...Nt.value
|
|
1864
|
+
} : Mt.value, {
|
|
1865
|
+
onKeydown: pt,
|
|
1866
|
+
onPointerdown: lt,
|
|
1867
|
+
onPointermove: ut,
|
|
1868
|
+
onPointerup: dt,
|
|
1869
|
+
onPointercancel: dt
|
|
1729
1870
|
}), {
|
|
1730
1871
|
default: withCtx(() => [
|
|
1731
|
-
|
|
1872
|
+
G.value ? (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", {
|
|
1732
1873
|
class: "virtual-scroll-scrollbar-viewport",
|
|
1733
1874
|
style: normalizeStyle({
|
|
1734
|
-
inlineSize: `${unref(
|
|
1735
|
-
blockSize: `${unref(
|
|
1875
|
+
inlineSize: `${unref(L).displayViewportSize.width}px`,
|
|
1876
|
+
blockSize: `${unref(L).displayViewportSize.height}px`,
|
|
1736
1877
|
"--vsi-scrollbar-has-cross-gap": o.direction === "both" ? 1 : 0
|
|
1737
1878
|
})
|
|
1738
|
-
}, [T.scrollbar &&
|
|
1739
|
-
T.header ? (openBlock(), createBlock(resolveDynamicComponent(
|
|
1879
|
+
}, [T.scrollbar && gt.value ? renderSlot(t.$slots, "scrollbar", normalizeProps(mergeProps({ key: 0 }, gt.value)), void 0, !0) : gt.value ? (openBlock(), createBlock(VirtualScrollbar_default, normalizeProps(mergeProps({ key: 1 }, gt.value.scrollbarProps)), null, 16)) : createCommentVNode("", !0), T.scrollbar && Q.value ? renderSlot(t.$slots, "scrollbar", normalizeProps(mergeProps({ key: 2 }, Q.value)), void 0, !0) : Q.value ? (openBlock(), createBlock(VirtualScrollbar_default, normalizeProps(mergeProps({ key: 3 }, Q.value.scrollbarProps)), null, 16)) : createCommentVNode("", !0)], 4)])) : createCommentVNode("", !0),
|
|
1880
|
+
T.header ? (openBlock(), createBlock(resolveDynamicComponent(St.value), {
|
|
1740
1881
|
key: 1,
|
|
1741
1882
|
ref_key: "headerRef",
|
|
1742
|
-
ref:
|
|
1883
|
+
ref: re,
|
|
1743
1884
|
class: normalizeClass(["virtual-scroll-header", { "virtual-scroll--sticky": o.stickyHeader }]),
|
|
1744
1885
|
role: $.value ? void 0 : "none"
|
|
1745
1886
|
}, {
|
|
@@ -1748,15 +1889,15 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1748
1889
|
}, 8, ["class", "role"])) : createCommentVNode("", !0),
|
|
1749
1890
|
(openBlock(), createBlock(resolveDynamicComponent(o.wrapperTag), mergeProps({
|
|
1750
1891
|
ref_key: "wrapperRef",
|
|
1751
|
-
ref:
|
|
1892
|
+
ref: A,
|
|
1752
1893
|
class: "virtual-scroll-wrapper",
|
|
1753
|
-
style:
|
|
1754
|
-
role: $.value ? void 0 :
|
|
1755
|
-
}, $.value ? {} :
|
|
1894
|
+
style: _t.value,
|
|
1895
|
+
role: $.value ? void 0 : Dt.value
|
|
1896
|
+
}, $.value ? {} : Nt.value), {
|
|
1756
1897
|
default: withCtx(() => [$.value ? (openBlock(), createBlock(resolveDynamicComponent(o.itemTag), {
|
|
1757
1898
|
key: 0,
|
|
1758
1899
|
class: "virtual-scroll-spacer",
|
|
1759
|
-
style: normalizeStyle(
|
|
1900
|
+
style: normalizeStyle(yt.value)
|
|
1760
1901
|
}, {
|
|
1761
1902
|
default: withCtx(() => [...s[0] ||= [createElementVNode("td", { style: {
|
|
1762
1903
|
padding: "0",
|
|
@@ -1764,24 +1905,24 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1764
1905
|
"block-size": "inherit"
|
|
1765
1906
|
} }, null, -1)]]),
|
|
1766
1907
|
_: 1
|
|
1767
|
-
}, 8, ["style"])) : createCommentVNode("", !0), (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(
|
|
1908
|
+
}, 8, ["style"])) : createCommentVNode("", !0), (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(I), (e) => (openBlock(), createBlock(resolveDynamicComponent(o.itemTag), mergeProps({
|
|
1768
1909
|
key: e.index,
|
|
1769
1910
|
ref_for: !0,
|
|
1770
|
-
ref: (t) =>
|
|
1911
|
+
ref: (t) => tt(t, e.index),
|
|
1771
1912
|
"data-index": e.index,
|
|
1772
1913
|
class: ["virtual-scroll-item", {
|
|
1773
1914
|
"virtual-scroll--sticky": e.isStickyActive,
|
|
1774
|
-
"virtual-scroll--debug":
|
|
1915
|
+
"virtual-scroll--debug": xt.value
|
|
1775
1916
|
}],
|
|
1776
|
-
style:
|
|
1777
|
-
}, { ref_for: !0 },
|
|
1917
|
+
style: bt(e)
|
|
1918
|
+
}, { ref_for: !0 }, jt.value ? Pt(e.index) : { role: "none" }), {
|
|
1778
1919
|
default: withCtx(() => [renderSlot(t.$slots, "item", {
|
|
1779
1920
|
item: e.item,
|
|
1780
1921
|
index: e.index,
|
|
1781
|
-
getItemAriaProps:
|
|
1782
|
-
columnRange:
|
|
1783
|
-
getColumnWidth: unref(
|
|
1784
|
-
getCellAriaProps:
|
|
1922
|
+
getItemAriaProps: Pt,
|
|
1923
|
+
columnRange: Ze.value,
|
|
1924
|
+
getColumnWidth: unref(z),
|
|
1925
|
+
getCellAriaProps: Ft,
|
|
1785
1926
|
gap: _.gap,
|
|
1786
1927
|
columnGap: _.columnGap,
|
|
1787
1928
|
isSticky: e.isSticky,
|
|
@@ -1789,7 +1930,7 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1789
1930
|
isStickyActiveX: e.isStickyActiveX,
|
|
1790
1931
|
isStickyActiveY: e.isStickyActiveY,
|
|
1791
1932
|
offset: e.offset
|
|
1792
|
-
}, void 0, !0),
|
|
1933
|
+
}, void 0, !0), xt.value ? (openBlock(), createElementBlock("div", _hoisted_2, " #" + toDisplayString(e.index) + " (" + toDisplayString(Math.round(e.offset.x)) + ", " + toDisplayString(Math.round(e.offset.y)) + ") ", 1)) : createCommentVNode("", !0)]),
|
|
1793
1934
|
_: 2
|
|
1794
1935
|
}, 1040, [
|
|
1795
1936
|
"data-index",
|
|
@@ -1801,14 +1942,14 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1801
1942
|
o.loading && T.loading ? (openBlock(), createElementBlock("div", {
|
|
1802
1943
|
key: 2,
|
|
1803
1944
|
class: "virtual-scroll-loading",
|
|
1804
|
-
style: normalizeStyle(
|
|
1945
|
+
style: normalizeStyle(vt.value),
|
|
1805
1946
|
"aria-live": "polite",
|
|
1806
1947
|
"aria-atomic": "true"
|
|
1807
1948
|
}, [renderSlot(t.$slots, "loading", {}, void 0, !0)], 4)) : createCommentVNode("", !0),
|
|
1808
|
-
T.footer ? (openBlock(), createBlock(resolveDynamicComponent(
|
|
1949
|
+
T.footer ? (openBlock(), createBlock(resolveDynamicComponent(Ct.value), {
|
|
1809
1950
|
key: 3,
|
|
1810
1951
|
ref_key: "footerRef",
|
|
1811
|
-
ref:
|
|
1952
|
+
ref: ie,
|
|
1812
1953
|
class: normalizeClass(["virtual-scroll-footer", { "virtual-scroll--sticky": o.stickyFooter }]),
|
|
1813
1954
|
role: $.value ? void 0 : "none"
|
|
1814
1955
|
}, {
|
|
@@ -1824,7 +1965,7 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1824
1965
|
"role"
|
|
1825
1966
|
]));
|
|
1826
1967
|
}
|
|
1827
|
-
}), [["__scopeId", "data-v-
|
|
1968
|
+
}), [["__scopeId", "data-v-a75851a5"]]);
|
|
1828
1969
|
export { BROWSER_MAX_SIZE, DEFAULT_BUFFER, DEFAULT_COLUMN_WIDTH, DEFAULT_ITEM_SIZE, EMPTY_SCROLL_DETAILS, FenwickTree, VirtualScroll_default as VirtualScroll, VirtualScrollbar_default as VirtualScrollbar, calculateAxisSize, calculateColumnRange, calculateIndexAt, calculateInertiaStep, calculateInstantaneousVelocity, calculateItemPosition, calculateItemStyle, calculateOffsetAt, calculatePrependCount, calculateRange, calculateRangeSize, calculateRenderedSize, calculateSSROffsets, calculateScale, calculateScrollTarget, calculateStickyItem, calculateTotalSize, displayToVirtual, findPrevStickyIndex, getPaddingX, getPaddingY, isBody, isElement, isItemVisible, isScrollToIndexOptions, isScrollableElement, isWindow, isWindowLike, resolveSnap, scrollTo, useVirtualScroll, useVirtualScrollSizes, useVirtualScrollbar, virtualToDisplay };
|
|
1829
1970
|
|
|
1830
1971
|
//# sourceMappingURL=index.mjs.map
|