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