@pdanpdan/virtual-scroll 0.9.0 → 0.9.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 +8 -8
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +479 -499
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/composables/useVirtualScroll.ts +16 -3
- package/src/composables/useVirtualScrollSizes.ts +126 -115
- package/src/utils/virtual-scroll-logic.ts +11 -2
package/dist/index.mjs
CHANGED
|
@@ -151,23 +151,23 @@ function calculateAxisTarget({ index: e, align: t, viewSize: n, scrollPos: r, fi
|
|
|
151
151
|
effectiveAlign: h
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
|
-
function calculateAxisSticky(e, t, n, r, i, a) {
|
|
154
|
+
function calculateAxisSticky(e, t, n, r, i, a, o) {
|
|
155
155
|
if (e <= t) return {
|
|
156
156
|
isActive: !1,
|
|
157
157
|
offset: 0
|
|
158
158
|
};
|
|
159
|
-
let
|
|
160
|
-
if (
|
|
159
|
+
let s = o === void 0 ? findNextStickyIndex(i, r) : o;
|
|
160
|
+
if (s === void 0) return {
|
|
161
161
|
isActive: !0,
|
|
162
162
|
offset: 0
|
|
163
163
|
};
|
|
164
|
-
let
|
|
165
|
-
return e >=
|
|
164
|
+
let c = a(s);
|
|
165
|
+
return e >= c ? {
|
|
166
166
|
isActive: !1,
|
|
167
167
|
offset: 0
|
|
168
168
|
} : {
|
|
169
169
|
isActive: !0,
|
|
170
|
-
offset: Math.max(0, Math.min(n,
|
|
170
|
+
offset: Math.max(0, Math.min(n, c - e)) - n
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
173
|
function isItemVisible(e, t, n, r, i = 0, a = 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: te = 0, stickyEndX: ne = 0, stickyEndY: re = 0, flowPaddingStartX: ie = 0, flowPaddingStartY: ae = 0, paddingStartX: E = 0, paddingStartY: D = 0, paddingEndX: oe = 0, paddingEndY: se = 0 }) {
|
|
192
|
+
let k;
|
|
193
|
+
k = isScrollToIndexOptions(n) ? n.align : n;
|
|
194
|
+
let A = (k && typeof k == "object" ? k.x : k) || "auto", ce = (k && typeof k == "object" ? k.y : k) || "auto", le = f, ue = p, de = 0, pe = 0, me = "auto", j = "auto", M = b === 1 ? o : BROWSER_MAX_SIZE, he = x === 1 ? s : BROWSER_MAX_SIZE, N = Math.max(0, S + M - i), ge = Math.max(0, C + he - a), P = (N - S) * b, _e = (ge - C) * x, F = ie + T + E, ye = ae + te + D;
|
|
195
195
|
if (e != null) {
|
|
196
196
|
let t = calculateAxisTarget({
|
|
197
197
|
index: e,
|
|
198
|
-
align:
|
|
198
|
+
align: ce,
|
|
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: te + D,
|
|
207
|
+
stickyEnd: re + se
|
|
208
208
|
});
|
|
209
|
-
|
|
209
|
+
ue = t.target + ye, pe = t.itemSize, j = 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: A,
|
|
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 + E,
|
|
223
|
+
stickyEnd: ne + oe
|
|
224
224
|
});
|
|
225
|
-
|
|
225
|
+
le = n.target + F, de = n.itemSize, me = n.effectiveAlign;
|
|
226
226
|
}
|
|
227
|
-
return
|
|
228
|
-
targetX:
|
|
229
|
-
targetY:
|
|
230
|
-
itemWidth:
|
|
231
|
-
itemHeight:
|
|
232
|
-
effectiveAlignX:
|
|
233
|
-
effectiveAlignY:
|
|
227
|
+
return le = Math.max(0, Math.min(le, P)), ue = Math.max(0, Math.min(ue, _e)), {
|
|
228
|
+
targetX: le,
|
|
229
|
+
targetY: ue,
|
|
230
|
+
itemWidth: de,
|
|
231
|
+
itemHeight: pe,
|
|
232
|
+
effectiveAlignX: me,
|
|
233
|
+
effectiveAlignY: j
|
|
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 }) {
|
|
@@ -272,30 +272,30 @@ function calculateColumnRange({ columnCount: e, relativeScrollX: t, usableWidth:
|
|
|
272
272
|
padEnd: Math.max(0, m - h)
|
|
273
273
|
};
|
|
274
274
|
}
|
|
275
|
-
function calculateStickyItem({ index: e, isSticky: t, direction: n, relativeScrollX: r, relativeScrollY: i, originalX: a, originalY: o, width: s, height: c, stickyIndices: l, fixedSize: u, gap: d, columnGap: f, getItemQueryY: p, getItemQueryX: m }) {
|
|
276
|
-
let
|
|
275
|
+
function calculateStickyItem({ index: e, isSticky: t, direction: n, relativeScrollX: r, relativeScrollY: i, originalX: a, originalY: o, width: s, height: c, stickyIndices: l, fixedSize: u, gap: d, columnGap: f, getItemQueryY: p, getItemQueryX: m, nextStickyIndex: h }) {
|
|
276
|
+
let g = !1, _ = !1, v = {
|
|
277
277
|
x: 0,
|
|
278
278
|
y: 0
|
|
279
279
|
};
|
|
280
280
|
if (!t) return {
|
|
281
|
-
isStickyActiveX:
|
|
282
|
-
isStickyActiveY:
|
|
281
|
+
isStickyActiveX: g,
|
|
282
|
+
isStickyActiveY: _,
|
|
283
283
|
isStickyActive: !1,
|
|
284
|
-
stickyOffset:
|
|
284
|
+
stickyOffset: v
|
|
285
285
|
};
|
|
286
286
|
if (n === "vertical" || n === "both") {
|
|
287
|
-
let t = calculateAxisSticky(i, o, c, e, l, (e) => u === null ? p(e) : e * (u + d));
|
|
288
|
-
|
|
287
|
+
let t = calculateAxisSticky(i, o, c, e, l, (e) => u === null ? p(e) : e * (u + d), h);
|
|
288
|
+
_ = t.isActive, v.y = t.offset;
|
|
289
289
|
}
|
|
290
290
|
if (n === "horizontal") {
|
|
291
|
-
let t = calculateAxisSticky(r, a, s, e, l, (e) => u === null ? m(e) : e * (u + f));
|
|
292
|
-
t.isActive && (
|
|
291
|
+
let t = calculateAxisSticky(r, a, s, e, l, (e) => u === null ? m(e) : e * (u + f), h);
|
|
292
|
+
t.isActive && (g = !0, v.x = t.offset);
|
|
293
293
|
}
|
|
294
294
|
return {
|
|
295
|
-
isStickyActiveX:
|
|
296
|
-
isStickyActiveY:
|
|
297
|
-
isStickyActive:
|
|
298
|
-
stickyOffset:
|
|
295
|
+
isStickyActiveX: g,
|
|
296
|
+
isStickyActiveY: _,
|
|
297
|
+
isStickyActive: g || _,
|
|
298
|
+
stickyOffset: v
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
301
|
function calculateItemPosition({ index: e, direction: t, fixedSize: n, gap: r, columnGap: i, usableWidth: a, usableHeight: o, totalWidth: s, queryY: c, queryX: l, getSizeY: u, getSizeX: d, columnRange: f }) {
|
|
@@ -478,34 +478,31 @@ function useVirtualScrollSizes(e) {
|
|
|
478
478
|
let e = new Uint8Array(t);
|
|
479
479
|
e.set(o.value.subarray(0, Math.min(t, o.value.length))), o.value = e;
|
|
480
480
|
}
|
|
481
|
-
}, h = () => {
|
|
482
|
-
let
|
|
483
|
-
if (
|
|
484
|
-
let r =
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
481
|
+
}, h = (e, t, n, r, i, a, o, s, c) => {
|
|
482
|
+
let l = !1;
|
|
483
|
+
if (c) {
|
|
484
|
+
for (let r = 0; r < e; r++) t.get(r) !== 0 && (t.set(r, 0), n[r] = 0, l = !0);
|
|
485
|
+
return l;
|
|
486
|
+
}
|
|
487
|
+
for (let c = 0; c < e; c++) {
|
|
488
|
+
let e = t.get(c), u = n[c] === 1;
|
|
489
|
+
if (!o || !u && e === 0) {
|
|
490
|
+
let u = p(c, r, i, a, t, s) + a;
|
|
491
|
+
Math.abs(e - u) > .5 ? (t.set(c, u), n[c] = o ? 0 : 1, l = !0) : o || (n[c] = 1);
|
|
490
492
|
}
|
|
491
493
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
if (!n.value.isDynamicItemSize || !m && l === 0) {
|
|
502
|
-
let e = f(t, a) + u;
|
|
503
|
-
Math.abs(l - e) > .5 ? (i.set(a, e), c.value[a] = n.value.isDynamicItemSize ? 0 : 1, h = !0) : n.value.isDynamicItemSize || (c.value[a] = 1);
|
|
504
|
-
}
|
|
505
|
-
} else l !== 0 && (i.set(a, 0), c.value[a] = 0, h = !0);
|
|
494
|
+
return l;
|
|
495
|
+
}, g = () => {
|
|
496
|
+
let e = n.value.props, t = e.items.length, l = e.columnCount || 0, u = e.gap || 0, d = e.columnGap || 0, f = e.columnWidth, p = e.itemSize, m = e.defaultColumnWidth || 100, g = e.defaultItemSize || n.value.defaultSize, _ = h(l, a, o.value, f, m, d, n.value.isDynamicColumnWidth, !0, !1), v = h(t, r, s.value, p, g, d, n.value.isDynamicItemSize, !0, n.value.direction !== "horizontal"), y = h(t, i, c.value, p, g, u, n.value.isDynamicItemSize, !1, n.value.direction === "horizontal");
|
|
497
|
+
_ && a.rebuild(), v && r.rebuild(), y && i.rebuild();
|
|
498
|
+
}, _ = (e, t, n, r, i, a, o) => {
|
|
499
|
+
let s = n.get(e), c = t + i, l = !1;
|
|
500
|
+
if (!r[e] || Math.abs(c - s) > .1) {
|
|
501
|
+
let t = c - s;
|
|
502
|
+
n.update(e, t), r[e] = 1, l = !0, e < a && s > 0 && (o.val += t);
|
|
506
503
|
}
|
|
507
|
-
|
|
508
|
-
},
|
|
504
|
+
return l;
|
|
505
|
+
}, y = (e) => {
|
|
509
506
|
let t = n.value.props, a = t.items, o = a.length;
|
|
510
507
|
m(o, t.columnCount || 0);
|
|
511
508
|
let p = t.restoreScrollOnPrepend ? calculatePrependCount(d, a) : 0;
|
|
@@ -520,7 +517,7 @@ function useVirtualScrollSizes(e) {
|
|
|
520
517
|
}
|
|
521
518
|
(h > 0 || g > 0) && e && e(h, g);
|
|
522
519
|
}
|
|
523
|
-
|
|
520
|
+
g(), d = [...a], u.value = !0, l.value++;
|
|
524
521
|
};
|
|
525
522
|
return {
|
|
526
523
|
itemSizesX: r,
|
|
@@ -533,51 +530,29 @@ function useVirtualScrollSizes(e) {
|
|
|
533
530
|
sizesInitialized: u,
|
|
534
531
|
getItemBaseSize: f,
|
|
535
532
|
getSizeAt: p,
|
|
536
|
-
initializeSizes:
|
|
533
|
+
initializeSizes: y,
|
|
537
534
|
updateItemSizes: (e, t, u, d, f, p) => {
|
|
538
|
-
let m = !1, h = 0, g = 0,
|
|
539
|
-
|
|
540
|
-
T.add(e);
|
|
541
|
-
let n = a.get(e), r = t + y;
|
|
542
|
-
if (!o.value[e] || Math.abs(n - r) > .1) {
|
|
543
|
-
let t = r - n;
|
|
544
|
-
Math.abs(t) > .1 && (a.update(e, t), m = !0, e < x && n > 0 && (h += t)), o.value[e] = 1;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
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(), te = /* @__PURE__ */ new Set(), ne = (e, t) => {
|
|
536
|
+
e >= 0 && e < (v.columnCount || 0) && !te.has(e) && (te.add(e), _(e, t, a, o.value, b, S, h) && (m = !0));
|
|
547
537
|
};
|
|
548
538
|
for (let { index: t, inlineSize: a, blockSize: o, element: l } of e) {
|
|
549
539
|
if (a <= 0 && o <= 0) continue;
|
|
550
|
-
let e = n.value.isDynamicItemSize || typeof
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
if (!s.value[t] || Math.abs(n - e) > .1) {
|
|
555
|
-
let i = n - e;
|
|
556
|
-
r.update(t, i), s.value[t] = 1, m = !0, t < b && e > 0 && (h += i);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
if (!S) {
|
|
560
|
-
let e = i.get(t), n = o + v;
|
|
561
|
-
if (!c.value[t] || Math.abs(n - e) > .1) {
|
|
562
|
-
let r = n - e;
|
|
563
|
-
i.update(t, r), c.value[t] = 1, m = !0, t < b && e > 0 && (g += r);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
let u = n.value.isDynamicColumnWidth || typeof _.columnWidth == "function";
|
|
568
|
-
if (C && l && _.columnCount && u && (a > 0 || l.dataset.colIndex === void 0)) {
|
|
540
|
+
let e = n.value.isDynamicItemSize || typeof v.itemSize == "function";
|
|
541
|
+
t >= 0 && !T.has(t) && e && o > 0 && (T.add(t), C && a > 0 && _(t, a, r, s.value, b, x, h) && (m = !0), C || _(t, o, i, c.value, y, x, g) && (m = !0));
|
|
542
|
+
let u = n.value.isDynamicColumnWidth || typeof v.columnWidth == "function";
|
|
543
|
+
if (w && l && v.columnCount && u && (a > 0 || l.dataset.colIndex === void 0)) {
|
|
569
544
|
let e = l.dataset.colIndex;
|
|
570
|
-
if (e != null)
|
|
545
|
+
if (e != null) ne(Number.parseInt(e, 10), a);
|
|
571
546
|
else {
|
|
572
547
|
let e = Array.from(l.querySelectorAll("[data-col-index]"));
|
|
573
|
-
for (let t of e)
|
|
548
|
+
for (let t of e) ne(Number.parseInt(t.dataset.colIndex, 10), t.getBoundingClientRect().width);
|
|
574
549
|
}
|
|
575
550
|
}
|
|
576
551
|
}
|
|
577
|
-
m && (l.value++, (h !== 0 || g !== 0) && p(h, g));
|
|
552
|
+
m && (l.value++, (h.val !== 0 || g.val !== 0) && p(h.val, g.val));
|
|
578
553
|
},
|
|
579
554
|
refresh: (e) => {
|
|
580
|
-
r.resize(0), i.resize(0), a.resize(0), o.value.fill(0), s.value.fill(0), c.value.fill(0),
|
|
555
|
+
r.resize(0), i.resize(0), a.resize(0), o.value.fill(0), s.value.fill(0), c.value.fill(0), y(e);
|
|
581
556
|
}
|
|
582
557
|
};
|
|
583
558
|
}
|
|
@@ -588,89 +563,89 @@ function useVirtualScroll(e) {
|
|
|
588
563
|
}), y = reactive({
|
|
589
564
|
x: 0,
|
|
590
565
|
y: 0
|
|
591
|
-
}), b, x = ref(!1), S = ref(0), C = ref(0), w = 0,
|
|
566
|
+
}), b, x = ref(!1), S = ref(0), C = ref(0), w = 0, te = 0, ne = null, re = null, ae = null, E = () => {
|
|
592
567
|
if (typeof window > "u") return;
|
|
593
568
|
let e = n.value.container || n.value.hostRef || window, t = isElement(e) ? e : document.documentElement;
|
|
594
|
-
|
|
595
|
-
let r =
|
|
569
|
+
ae = window.getComputedStyle(t);
|
|
570
|
+
let r = ae.direction === "rtl";
|
|
596
571
|
d.value !== r && (d.value = r);
|
|
597
|
-
},
|
|
572
|
+
}, D = computed(() => [
|
|
598
573
|
"vertical",
|
|
599
574
|
"horizontal",
|
|
600
575
|
"both"
|
|
601
|
-
].includes(n.value.direction) ? n.value.direction : "vertical"),
|
|
576
|
+
].includes(n.value.direction) ? n.value.direction : "vertical"), oe = computed(() => n.value.itemSize === void 0 || n.value.itemSize === null || n.value.itemSize === 0), se = computed(() => n.value.columnWidth === void 0 || n.value.columnWidth === null || n.value.columnWidth === 0), O = computed(() => typeof n.value.itemSize == "number" && n.value.itemSize > 0 ? n.value.itemSize : null), k = computed(() => typeof n.value.columnWidth == "number" && n.value.columnWidth > 0 ? n.value.columnWidth : null), A = computed(() => n.value.defaultItemSize || O.value || 40), { itemSizesX: j, itemSizesY: M, columnSizes: N, measuredColumns: ge, measuredItemsY: ve, treeUpdateFlag: F, getSizeAt: ye, initializeSizes: De, updateItemSizes: ke, refresh: Ae } = useVirtualScrollSizes(computed(() => ({
|
|
602
577
|
props: n.value,
|
|
603
|
-
isDynamicItemSize:
|
|
604
|
-
isDynamicColumnWidth:
|
|
605
|
-
defaultSize:
|
|
606
|
-
fixedItemSize:
|
|
607
|
-
direction:
|
|
608
|
-
}))),
|
|
609
|
-
direction:
|
|
578
|
+
isDynamicItemSize: oe.value,
|
|
579
|
+
isDynamicColumnWidth: se.value,
|
|
580
|
+
defaultSize: A.value,
|
|
581
|
+
fixedItemSize: O.value,
|
|
582
|
+
direction: D.value
|
|
583
|
+
}))), R = ref(null), Ne = computed(() => [...n.value.stickyIndices || []].sort((e, t) => e - t)), Fe = computed(() => new Set(Ne.value)), Ie = computed(() => getPaddingX(n.value.scrollPaddingStart, n.value.direction)), Le = computed(() => getPaddingX(n.value.scrollPaddingEnd, n.value.direction)), Re = computed(() => getPaddingY(n.value.scrollPaddingStart, n.value.direction)), ze = computed(() => getPaddingY(n.value.scrollPaddingEnd, n.value.direction)), z = computed(() => getPaddingX(n.value.stickyStart, n.value.direction)), Be = computed(() => getPaddingX(n.value.stickyEnd, n.value.direction)), B = computed(() => getPaddingY(n.value.stickyStart, n.value.direction)), Ve = computed(() => getPaddingY(n.value.stickyEnd, n.value.direction)), V = computed(() => getPaddingX(n.value.flowPaddingStart, n.value.direction)), He = computed(() => getPaddingX(n.value.flowPaddingEnd, n.value.direction)), H = computed(() => getPaddingY(n.value.flowPaddingStart, n.value.direction)), Ue = computed(() => getPaddingY(n.value.flowPaddingEnd, n.value.direction)), We = computed(() => f.value - (D.value === "vertical" ? 0 : z.value + Be.value)), Ge = computed(() => p.value - (D.value === "horizontal" ? 0 : B.value + Ve.value)), Ke = computed(() => (F.value, calculateTotalSize({
|
|
584
|
+
direction: D.value,
|
|
610
585
|
itemsLength: n.value.items.length,
|
|
611
586
|
columnCount: n.value.columnCount || 0,
|
|
612
|
-
fixedSize:
|
|
613
|
-
fixedWidth:
|
|
587
|
+
fixedSize: O.value,
|
|
588
|
+
fixedWidth: k.value,
|
|
614
589
|
gap: n.value.gap || 0,
|
|
615
590
|
columnGap: n.value.columnGap || 0,
|
|
616
|
-
usableWidth:
|
|
617
|
-
usableHeight:
|
|
618
|
-
queryY: (e) =>
|
|
619
|
-
queryX: (e) =>
|
|
620
|
-
queryColumn: (e) =>
|
|
621
|
-
}))),
|
|
622
|
-
x: computed(() => Math.max(0, g.x - (
|
|
623
|
-
y: computed(() => Math.max(0, g.y - (
|
|
624
|
-
}),
|
|
625
|
-
if (
|
|
626
|
-
let e =
|
|
591
|
+
usableWidth: We.value,
|
|
592
|
+
usableHeight: Ge.value,
|
|
593
|
+
queryY: (e) => M.query(e),
|
|
594
|
+
queryX: (e) => j.query(e),
|
|
595
|
+
queryColumn: (e) => N.query(e)
|
|
596
|
+
}))), qe = computed(() => isWindowLike(n.value.container)), Je = computed(() => Ke.value.width + Ie.value + Le.value), Ye = computed(() => Ke.value.height + Re.value + ze.value), U = computed(() => V.value + z.value + Be.value + He.value + Je.value), W = computed(() => H.value + B.value + Ve.value + Ue.value + Ye.value), G = reactive({
|
|
597
|
+
x: computed(() => Math.max(0, g.x - (V.value + z.value))),
|
|
598
|
+
y: computed(() => Math.max(0, g.y - (H.value + B.value)))
|
|
599
|
+
}), Xe = computed(() => calculateRenderedSize(qe.value, U.value)), Ze = computed(() => calculateRenderedSize(qe.value, W.value)), Qe = computed(() => calculateRenderedSize(qe.value, Je.value)), $e = computed(() => calculateRenderedSize(qe.value, Ye.value)), K = computed(() => calculateScale(qe.value, U.value, f.value)), q = computed(() => calculateScale(qe.value, W.value, p.value)), J = computed(() => {
|
|
600
|
+
if (D.value === "vertical") return 0;
|
|
601
|
+
let e = V.value + z.value + Ie.value;
|
|
627
602
|
return S.value - e;
|
|
628
|
-
}),
|
|
629
|
-
if (
|
|
630
|
-
let e =
|
|
603
|
+
}), Y = computed(() => {
|
|
604
|
+
if (D.value === "horizontal") return 0;
|
|
605
|
+
let e = H.value + B.value + Re.value;
|
|
631
606
|
return C.value - e;
|
|
632
|
-
}),
|
|
633
|
-
function
|
|
607
|
+
}), X = (e) => D.value === "both" ? ye(e, n.value.columnWidth, n.value.defaultColumnWidth || 100, n.value.columnGap || 0, N, !0) : ye(e, n.value.itemSize, n.value.defaultItemSize || 40, n.value.columnGap || 0, j, !0), et = (e) => D.value === "horizontal" ? Ge.value : ye(e, n.value.itemSize, n.value.defaultItemSize || 40, n.value.gap || 0, M, !1);
|
|
608
|
+
function tt(e, t, a) {
|
|
634
609
|
let o = typeof a == "object" && a && "isCorrection" in a ? a.isCorrection : !1, s = n.value.container || window, { targetX: c, targetY: l, effectiveAlignX: u, effectiveAlignY: m } = calculateScrollTarget({
|
|
635
610
|
rowIndex: e,
|
|
636
611
|
colIndex: t,
|
|
637
612
|
options: a,
|
|
638
|
-
direction:
|
|
613
|
+
direction: D.value,
|
|
639
614
|
viewportWidth: f.value,
|
|
640
615
|
viewportHeight: p.value,
|
|
641
|
-
totalWidth:
|
|
642
|
-
totalHeight:
|
|
616
|
+
totalWidth: U.value,
|
|
617
|
+
totalHeight: W.value,
|
|
643
618
|
gap: n.value.gap || 0,
|
|
644
619
|
columnGap: n.value.columnGap || 0,
|
|
645
|
-
fixedSize:
|
|
646
|
-
fixedWidth:
|
|
647
|
-
relativeScrollX:
|
|
648
|
-
relativeScrollY:
|
|
649
|
-
getItemSizeY: (e) =>
|
|
650
|
-
getItemSizeX: (e) =>
|
|
651
|
-
getItemQueryY: (e) =>
|
|
652
|
-
getItemQueryX: (e) =>
|
|
653
|
-
getColumnSize: (e) =>
|
|
654
|
-
getColumnQuery: (e) =>
|
|
655
|
-
scaleX:
|
|
656
|
-
scaleY:
|
|
657
|
-
hostOffsetX:
|
|
658
|
-
hostOffsetY:
|
|
659
|
-
stickyIndices:
|
|
660
|
-
stickyStartX:
|
|
661
|
-
stickyStartY:
|
|
662
|
-
stickyEndX:
|
|
663
|
-
stickyEndY:
|
|
664
|
-
flowPaddingStartX:
|
|
665
|
-
flowPaddingStartY:
|
|
666
|
-
paddingStartX:
|
|
667
|
-
paddingStartY:
|
|
668
|
-
paddingEndX:
|
|
669
|
-
paddingEndY:
|
|
620
|
+
fixedSize: O.value,
|
|
621
|
+
fixedWidth: k.value,
|
|
622
|
+
relativeScrollX: J.value,
|
|
623
|
+
relativeScrollY: Y.value,
|
|
624
|
+
getItemSizeY: (e) => M.get(e),
|
|
625
|
+
getItemSizeX: (e) => j.get(e),
|
|
626
|
+
getItemQueryY: (e) => M.query(e),
|
|
627
|
+
getItemQueryX: (e) => j.query(e),
|
|
628
|
+
getColumnSize: (e) => N.get(e),
|
|
629
|
+
getColumnQuery: (e) => N.query(e),
|
|
630
|
+
scaleX: K.value,
|
|
631
|
+
scaleY: q.value,
|
|
632
|
+
hostOffsetX: G.x,
|
|
633
|
+
hostOffsetY: G.y,
|
|
634
|
+
stickyIndices: Ne.value,
|
|
635
|
+
stickyStartX: z.value,
|
|
636
|
+
stickyStartY: B.value,
|
|
637
|
+
stickyEndX: Be.value,
|
|
638
|
+
stickyEndY: Ve.value,
|
|
639
|
+
flowPaddingStartX: V.value,
|
|
640
|
+
flowPaddingStartY: H.value,
|
|
641
|
+
paddingStartX: Ie.value,
|
|
642
|
+
paddingStartY: Re.value,
|
|
643
|
+
paddingEndX: Le.value,
|
|
644
|
+
paddingEndY: ze.value
|
|
670
645
|
});
|
|
671
646
|
if (!o) {
|
|
672
647
|
let n = isScrollToIndexOptions(a) ? a.behavior : void 0;
|
|
673
|
-
|
|
648
|
+
R.value = {
|
|
674
649
|
rowIndex: e,
|
|
675
650
|
colIndex: t,
|
|
676
651
|
options: {
|
|
@@ -682,31 +657,31 @@ function useVirtualScroll(e) {
|
|
|
682
657
|
}
|
|
683
658
|
};
|
|
684
659
|
}
|
|
685
|
-
let h = virtualToDisplay(c,
|
|
660
|
+
let h = virtualToDisplay(c, G.x, K.value), g = virtualToDisplay(l, G.y, q.value), _ = d.value ? -h : h, v = g, y;
|
|
686
661
|
isScrollToIndexOptions(a) && (y = a.behavior);
|
|
687
662
|
let b = o ? "auto" : y || "smooth";
|
|
688
663
|
x.value = !0;
|
|
689
664
|
let w = { behavior: b };
|
|
690
|
-
if (t != null && (w.left = d.value ? _ : Math.max(0, _)), e != null && (w.top = Math.max(0, v)), scrollTo(s, w), (b === "auto" || b === void 0) && (t != null && (r.value = d.value ? _ : Math.max(0, _), S.value = c), e != null && (i.value = Math.max(0, v), C.value = l),
|
|
691
|
-
let e =
|
|
665
|
+
if (t != null && (w.left = d.value ? _ : Math.max(0, _)), e != null && (w.top = Math.max(0, v)), scrollTo(s, w), (b === "auto" || b === void 0) && (t != null && (r.value = d.value ? _ : Math.max(0, _), S.value = c), e != null && (i.value = Math.max(0, v), C.value = l), R.value)) {
|
|
666
|
+
let e = R.value.options;
|
|
692
667
|
isScrollToIndexOptions(e) && (e.behavior = "auto");
|
|
693
668
|
}
|
|
694
669
|
}
|
|
695
|
-
let
|
|
670
|
+
let nt = (e, t, a) => {
|
|
696
671
|
let o = n.value.container || window;
|
|
697
|
-
x.value = !0,
|
|
698
|
-
let s = e == null ? null : Math.max(0, Math.min(e,
|
|
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));
|
|
699
674
|
s !== null && (S.value = s), c !== null && (C.value = c);
|
|
700
|
-
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,
|
|
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" };
|
|
701
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 = _));
|
|
702
|
-
},
|
|
677
|
+
}, rt = (e, t) => {
|
|
703
678
|
nextTick(() => {
|
|
704
|
-
|
|
679
|
+
nt(e > 0 ? J.value + e : null, t > 0 ? Y.value + t : null, {
|
|
705
680
|
behavior: "auto",
|
|
706
681
|
isCorrection: !0
|
|
707
682
|
});
|
|
708
683
|
});
|
|
709
|
-
},
|
|
684
|
+
}, it = () => De(rt), Z = () => {
|
|
710
685
|
if (typeof window > "u") return;
|
|
711
686
|
let e = n.value.container || window, t = (t) => {
|
|
712
687
|
let n = t.getBoundingClientRect();
|
|
@@ -750,56 +725,56 @@ function useVirtualScroll(e) {
|
|
|
750
725
|
() => n.value.columnGap,
|
|
751
726
|
() => n.value.defaultItemSize,
|
|
752
727
|
() => n.value.defaultColumnWidth
|
|
753
|
-
],
|
|
754
|
-
|
|
728
|
+
], it, { immediate: !0 }), watch(() => [n.value.container, n.value.hostElement], () => {
|
|
729
|
+
Z();
|
|
755
730
|
}), watch(d, (e, t) => {
|
|
756
731
|
if (t === void 0 || e === t || !l.value) return;
|
|
757
|
-
if (
|
|
758
|
-
|
|
732
|
+
if (D.value === "vertical") {
|
|
733
|
+
Z();
|
|
759
734
|
return;
|
|
760
735
|
}
|
|
761
|
-
let n = displayToVirtual(t ? Math.abs(r.value) : r.value, g.x,
|
|
762
|
-
|
|
763
|
-
}, { flush: "sync" }), watch([
|
|
764
|
-
!l.value || a.value || x.value ||
|
|
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" });
|
|
765
740
|
}), watch([() => n.value.items.length, () => n.value.columnCount], ([e, t], [n, r]) => {
|
|
766
741
|
nextTick(() => {
|
|
767
|
-
let i = Math.max(0,
|
|
768
|
-
S.value > i || C.value > a ?
|
|
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();
|
|
769
744
|
});
|
|
770
745
|
});
|
|
771
|
-
let
|
|
772
|
-
let t =
|
|
773
|
-
return calculateIndexAt(e,
|
|
774
|
-
}, at = (e) =>
|
|
775
|
-
if (
|
|
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 {
|
|
776
751
|
start: n.value.ssrRange.start,
|
|
777
752
|
end: n.value.ssrRange.end
|
|
778
753
|
};
|
|
779
754
|
let e = n.value.ssrRange && !a.value ? 0 : n.value.bufferBefore ?? 5, t = n.value.bufferAfter ?? 5;
|
|
780
755
|
return calculateRange({
|
|
781
|
-
direction:
|
|
782
|
-
relativeScrollX:
|
|
783
|
-
relativeScrollY:
|
|
784
|
-
usableWidth:
|
|
785
|
-
usableHeight:
|
|
756
|
+
direction: D.value,
|
|
757
|
+
relativeScrollX: J.value,
|
|
758
|
+
relativeScrollY: Y.value,
|
|
759
|
+
usableWidth: We.value,
|
|
760
|
+
usableHeight: Ge.value,
|
|
786
761
|
itemsLength: n.value.items.length,
|
|
787
762
|
bufferBefore: e,
|
|
788
763
|
bufferAfter: t,
|
|
789
764
|
gap: n.value.gap || 0,
|
|
790
765
|
columnGap: n.value.columnGap || 0,
|
|
791
|
-
fixedSize:
|
|
792
|
-
findLowerBoundY: (e) =>
|
|
793
|
-
findLowerBoundX: (e) =>
|
|
794
|
-
queryY: (e) =>
|
|
795
|
-
queryX: (e) =>
|
|
766
|
+
fixedSize: O.value,
|
|
767
|
+
findLowerBoundY: (e) => M.findLowerBound(e),
|
|
768
|
+
findLowerBoundX: (e) => j.findLowerBound(e),
|
|
769
|
+
queryY: (e) => M.query(e),
|
|
770
|
+
queryX: (e) => j.query(e)
|
|
796
771
|
});
|
|
797
772
|
}), st = computed(() => {
|
|
798
|
-
|
|
799
|
-
let e =
|
|
800
|
-
return
|
|
773
|
+
F.value;
|
|
774
|
+
let e = J.value + z.value, t = Y.value + B.value;
|
|
775
|
+
return Q(D.value === "horizontal" ? e : t);
|
|
801
776
|
}), ct = computed(() => {
|
|
802
|
-
|
|
777
|
+
F.value;
|
|
803
778
|
let e = n.value.columnCount || 0;
|
|
804
779
|
if (!e) return {
|
|
805
780
|
start: 0,
|
|
@@ -811,99 +786,104 @@ function useVirtualScroll(e) {
|
|
|
811
786
|
let { colStart: t = 0, colEnd: r = 0 } = n.value.ssrRange, i = Math.max(0, t), a = Math.min(e, r || e);
|
|
812
787
|
return calculateColumnRange({
|
|
813
788
|
columnCount: e,
|
|
814
|
-
relativeScrollX: calculateOffsetAt(i,
|
|
815
|
-
usableWidth: calculateRangeSize(i, a,
|
|
789
|
+
relativeScrollX: calculateOffsetAt(i, k.value, n.value.columnGap || 0, (e) => N.query(e)),
|
|
790
|
+
usableWidth: calculateRangeSize(i, a, k.value, n.value.columnGap || 0, (e) => N.query(e)),
|
|
816
791
|
colBuffer: 0,
|
|
817
|
-
fixedWidth:
|
|
792
|
+
fixedWidth: k.value,
|
|
818
793
|
columnGap: n.value.columnGap || 0,
|
|
819
|
-
findLowerBound: (e) =>
|
|
820
|
-
query: (e) =>
|
|
821
|
-
totalColsQuery: () =>
|
|
794
|
+
findLowerBound: (e) => N.findLowerBound(e),
|
|
795
|
+
query: (e) => N.query(e),
|
|
796
|
+
totalColsQuery: () => N.query(e)
|
|
822
797
|
});
|
|
823
798
|
}
|
|
824
799
|
let t = n.value.ssrRange && !a.value ? 0 : 2;
|
|
825
800
|
return calculateColumnRange({
|
|
826
801
|
columnCount: e,
|
|
827
|
-
relativeScrollX:
|
|
828
|
-
usableWidth:
|
|
802
|
+
relativeScrollX: J.value,
|
|
803
|
+
usableWidth: We.value,
|
|
829
804
|
colBuffer: t,
|
|
830
|
-
fixedWidth:
|
|
805
|
+
fixedWidth: k.value,
|
|
831
806
|
columnGap: n.value.columnGap || 0,
|
|
832
|
-
findLowerBound: (e) =>
|
|
833
|
-
query: (e) =>
|
|
834
|
-
totalColsQuery: () =>
|
|
807
|
+
findLowerBound: (e) => N.findLowerBound(e),
|
|
808
|
+
query: (e) => N.query(e),
|
|
809
|
+
totalColsQuery: () => N.query(e)
|
|
835
810
|
});
|
|
836
811
|
}), lt = [], ut = computed(() => {
|
|
837
|
-
|
|
838
|
-
let { start: e, end: t } = ot.value, r = [], i =
|
|
812
|
+
F.value;
|
|
813
|
+
let { start: e, end: t } = ot.value, r = [], i = Ne.value, a = Fe.value, s = [];
|
|
839
814
|
if (o.value || !n.value.ssrRange) {
|
|
840
815
|
let t = st.value, n = findPrevStickyIndex(i, t);
|
|
841
816
|
n !== void 0 && n < e && s.push(n);
|
|
842
817
|
}
|
|
843
818
|
for (let n = e; n < t; n++) s.push(n);
|
|
844
|
-
let { x: c, y: l } = !o.value && n.value.ssrRange ? calculateSSROffsets(
|
|
819
|
+
let { x: c, y: l } = !o.value && n.value.ssrRange ? calculateSSROffsets(D.value, n.value.ssrRange, O.value, k.value, n.value.gap || 0, n.value.columnGap || 0, (e) => M.query(e), (e) => j.query(e), (e) => N.query(e)) : {
|
|
845
820
|
x: 0,
|
|
846
821
|
y: 0
|
|
847
|
-
}, u =
|
|
822
|
+
}, u = /* @__PURE__ */ new Map();
|
|
823
|
+
for (let e of lt) u.set(e.index, e);
|
|
824
|
+
let d = -1, f = 0, p = -1, m = 0, h = (e) => e === d + 1 ? (f += j.get(d), d = e, f) : (f = j.query(e), d = e, f), g = (e) => e === p + 1 ? (m += M.get(p), p = e, m) : (m = M.query(e), p = e, m), _ = V.value + z.value + Ie.value, v = H.value + B.value + Re.value, y = V.value + z.value, b = H.value + B.value, x = ct.value, w = 0;
|
|
848
825
|
for (let e of s) {
|
|
849
826
|
let t = n.value.items[e];
|
|
850
827
|
if (t === void 0) continue;
|
|
851
828
|
let { x: s, y: d, width: f, height: p } = calculateItemPosition({
|
|
852
829
|
index: e,
|
|
853
|
-
direction:
|
|
854
|
-
fixedSize:
|
|
830
|
+
direction: D.value,
|
|
831
|
+
fixedSize: O.value,
|
|
855
832
|
gap: n.value.gap || 0,
|
|
856
833
|
columnGap: n.value.columnGap || 0,
|
|
857
|
-
usableWidth:
|
|
858
|
-
usableHeight:
|
|
859
|
-
totalWidth:
|
|
834
|
+
usableWidth: We.value,
|
|
835
|
+
usableHeight: Ge.value,
|
|
836
|
+
totalWidth: Ke.value.width,
|
|
860
837
|
queryY: g,
|
|
861
838
|
queryX: h,
|
|
862
|
-
getSizeY: (e) =>
|
|
863
|
-
getSizeX: (e) =>
|
|
839
|
+
getSizeY: (e) => M.get(e),
|
|
840
|
+
getSizeX: (e) => j.get(e),
|
|
864
841
|
columnRange: x
|
|
865
|
-
}), m = a.has(e),
|
|
842
|
+
}), m = a.has(e), T = s, te = d;
|
|
843
|
+
for (; w < i.length && i[w] <= e;) w++;
|
|
844
|
+
let ne = w < i.length ? i[w] : void 0, { isStickyActive: re, isStickyActiveX: ie, isStickyActiveY: ae, stickyOffset: E } = calculateStickyItem({
|
|
866
845
|
index: e,
|
|
867
846
|
isSticky: m,
|
|
868
|
-
direction:
|
|
869
|
-
relativeScrollX:
|
|
870
|
-
relativeScrollY:
|
|
871
|
-
originalX:
|
|
872
|
-
originalY:
|
|
847
|
+
direction: D.value,
|
|
848
|
+
relativeScrollX: J.value,
|
|
849
|
+
relativeScrollY: Y.value,
|
|
850
|
+
originalX: T,
|
|
851
|
+
originalY: te,
|
|
873
852
|
width: f,
|
|
874
853
|
height: p,
|
|
875
854
|
stickyIndices: i,
|
|
876
|
-
fixedSize:
|
|
877
|
-
fixedWidth:
|
|
855
|
+
fixedSize: O.value,
|
|
856
|
+
fixedWidth: k.value,
|
|
878
857
|
gap: n.value.gap || 0,
|
|
879
858
|
columnGap: n.value.columnGap || 0,
|
|
880
|
-
getItemQueryY:
|
|
881
|
-
getItemQueryX:
|
|
882
|
-
|
|
883
|
-
|
|
859
|
+
getItemQueryY: (e) => M.query(e),
|
|
860
|
+
getItemQueryX: (e) => j.query(e),
|
|
861
|
+
nextStickyIndex: ne
|
|
862
|
+
}), oe = o.value ? S.value / K.value + (s + _ - S.value) - y : s - c, se = o.value ? C.value / q.value + (d + v - C.value) - b : d - l, A = u.get(e);
|
|
863
|
+
A && A.item === t && A.offset.x === oe && A.offset.y === se && A.size.width === f && A.size.height === p && A.isSticky === m && A.isStickyActive === re && A.isStickyActiveX === ie && A.isStickyActiveY === ae && A.stickyOffset.x === E.x && A.stickyOffset.y === E.y ? r.push(A) : r.push({
|
|
884
864
|
item: t,
|
|
885
865
|
index: e,
|
|
886
866
|
offset: {
|
|
887
|
-
x:
|
|
888
|
-
y:
|
|
867
|
+
x: oe,
|
|
868
|
+
y: se
|
|
889
869
|
},
|
|
890
870
|
size: {
|
|
891
871
|
width: f,
|
|
892
872
|
height: p
|
|
893
873
|
},
|
|
894
|
-
originalX:
|
|
895
|
-
originalY:
|
|
874
|
+
originalX: T,
|
|
875
|
+
originalY: te,
|
|
896
876
|
isSticky: m,
|
|
897
|
-
isStickyActive:
|
|
898
|
-
isStickyActiveX:
|
|
899
|
-
isStickyActiveY:
|
|
900
|
-
stickyOffset:
|
|
877
|
+
isStickyActive: re,
|
|
878
|
+
isStickyActiveX: ie,
|
|
879
|
+
isStickyActiveY: ae,
|
|
880
|
+
stickyOffset: E
|
|
901
881
|
});
|
|
902
882
|
}
|
|
903
883
|
return lt = r, r;
|
|
904
884
|
}), dt = computed(() => {
|
|
905
|
-
|
|
906
|
-
let e =
|
|
885
|
+
F.value;
|
|
886
|
+
let e = J.value + z.value, t = Y.value + B.value, n = J.value + (f.value - Be.value) - 1, o = Y.value + (p.value - Ve.value) - 1, s = at(e), c = Q(t), l = Q(D.value === "horizontal" ? n : o), u = at(n);
|
|
907
887
|
return {
|
|
908
888
|
items: ut.value,
|
|
909
889
|
currentIndex: c,
|
|
@@ -927,8 +907,8 @@ function useVirtualScroll(e) {
|
|
|
927
907
|
height: p.value
|
|
928
908
|
},
|
|
929
909
|
totalSize: {
|
|
930
|
-
width:
|
|
931
|
-
height:
|
|
910
|
+
width: U.value,
|
|
911
|
+
height: W.value
|
|
932
912
|
},
|
|
933
913
|
isScrolling: a.value,
|
|
934
914
|
isProgrammaticScroll: x.value,
|
|
@@ -936,25 +916,25 @@ function useVirtualScroll(e) {
|
|
|
936
916
|
columnRange: ct.value
|
|
937
917
|
};
|
|
938
918
|
}), ft = () => {
|
|
939
|
-
x.value = !1,
|
|
919
|
+
x.value = !1, R.value = null;
|
|
940
920
|
}, pt = (e) => {
|
|
941
921
|
let t = e.target;
|
|
942
922
|
if (typeof window > "u") return;
|
|
943
|
-
|
|
944
|
-
let o = displayToVirtual(d.value ? Math.abs(r.value) : r.value,
|
|
945
|
-
Math.abs(o - w) > .5 && (
|
|
923
|
+
E(), t === window || t === document ? (r.value = window.scrollX, i.value = window.scrollY, f.value = document.documentElement.clientWidth, p.value = document.documentElement.clientHeight) : isScrollableElement(t) && (r.value = t.scrollLeft, i.value = t.scrollTop, f.value = t.clientWidth, p.value = t.clientHeight);
|
|
924
|
+
let o = displayToVirtual(d.value ? Math.abs(r.value) : r.value, G.x, K.value), s = displayToVirtual(i.value, G.y, q.value);
|
|
925
|
+
Math.abs(o - w) > .5 && (ne = o > w ? "end" : "start", w = o), Math.abs(s - te) > .5 && (re = s > te ? "end" : "start", te = s), S.value = o, C.value = s, x.value || (R.value = null), a.value ||= !0, clearTimeout(b), b = setTimeout(() => {
|
|
946
926
|
let e = x.value;
|
|
947
927
|
if (a.value = !1, x.value = !1, n.value.snap && !e) {
|
|
948
928
|
let e = n.value.snap, t = e === !0 ? "auto" : e, r = dt.value, i = n.value.items.length, a = r.currentIndex, o = r.currentColIndex, s = "start", c = "start", l = !1;
|
|
949
|
-
if (
|
|
950
|
-
let e = resolveSnap(t,
|
|
929
|
+
if (D.value !== "horizontal") {
|
|
930
|
+
let e = resolveSnap(t, re, r.currentIndex, r.currentEndIndex, Y.value, p.value, i, (e) => M.get(e), (e) => M.query(e), Q);
|
|
951
931
|
e && (a = e.index, s = e.align, l = !0);
|
|
952
932
|
}
|
|
953
|
-
if (
|
|
954
|
-
let e =
|
|
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);
|
|
955
935
|
s && (o = s.index, c = s.align, l = !0);
|
|
956
936
|
}
|
|
957
|
-
l &&
|
|
937
|
+
l && tt(a, o, {
|
|
958
938
|
align: {
|
|
959
939
|
x: c,
|
|
960
940
|
y: s
|
|
@@ -964,8 +944,8 @@ function useVirtualScroll(e) {
|
|
|
964
944
|
}
|
|
965
945
|
}, 250);
|
|
966
946
|
}, mt = (e) => {
|
|
967
|
-
|
|
968
|
-
|
|
947
|
+
ke(e, Q, at, J.value, Y.value, (e, t) => {
|
|
948
|
+
R.value !== null || x.value || rt(e, t);
|
|
969
949
|
});
|
|
970
950
|
}, $ = (e, t, n, r) => {
|
|
971
951
|
mt([{
|
|
@@ -976,47 +956,47 @@ function useVirtualScroll(e) {
|
|
|
976
956
|
}]);
|
|
977
957
|
};
|
|
978
958
|
function ht() {
|
|
979
|
-
if (
|
|
980
|
-
let { rowIndex: e, colIndex: t, options: r } =
|
|
959
|
+
if (R.value && !c.value) {
|
|
960
|
+
let { rowIndex: e, colIndex: t, options: r } = R.value;
|
|
981
961
|
if (isScrollToIndexOptions(r) && r.behavior === "smooth" && a.value) return;
|
|
982
|
-
let i = n.value.container || window, o = typeof window < "u" && i === window ? window.scrollX : i.scrollLeft, s = typeof window < "u" && i === window ? window.scrollY : i.scrollTop, c = d.value ? Math.abs(o) : o, l = s, u = displayToVirtual(c, 0,
|
|
962
|
+
let i = n.value.container || window, o = typeof window < "u" && i === window ? window.scrollX : i.scrollLeft, s = typeof window < "u" && i === window ? window.scrollY : i.scrollTop, c = d.value ? Math.abs(o) : o, l = s, u = displayToVirtual(c, 0, K.value), m = displayToVirtual(l, 0, q.value), { targetX: h, targetY: g } = calculateScrollTarget({
|
|
983
963
|
rowIndex: e,
|
|
984
964
|
colIndex: t,
|
|
985
965
|
options: r,
|
|
986
|
-
direction:
|
|
966
|
+
direction: D.value,
|
|
987
967
|
viewportWidth: f.value,
|
|
988
968
|
viewportHeight: p.value,
|
|
989
|
-
totalWidth:
|
|
990
|
-
totalHeight:
|
|
969
|
+
totalWidth: Je.value,
|
|
970
|
+
totalHeight: Ye.value,
|
|
991
971
|
gap: n.value.gap || 0,
|
|
992
972
|
columnGap: n.value.columnGap || 0,
|
|
993
|
-
fixedSize:
|
|
994
|
-
fixedWidth:
|
|
973
|
+
fixedSize: O.value,
|
|
974
|
+
fixedWidth: k.value,
|
|
995
975
|
relativeScrollX: u,
|
|
996
976
|
relativeScrollY: m,
|
|
997
|
-
getItemSizeY: (e) =>
|
|
998
|
-
getItemSizeX: (e) =>
|
|
999
|
-
getItemQueryY: (e) =>
|
|
1000
|
-
getItemQueryX: (e) =>
|
|
1001
|
-
getColumnSize: (e) =>
|
|
1002
|
-
getColumnQuery: (e) =>
|
|
1003
|
-
scaleX:
|
|
1004
|
-
scaleY:
|
|
1005
|
-
hostOffsetX:
|
|
1006
|
-
hostOffsetY:
|
|
1007
|
-
stickyIndices:
|
|
1008
|
-
stickyStartX:
|
|
1009
|
-
stickyStartY:
|
|
1010
|
-
stickyEndX:
|
|
1011
|
-
stickyEndY:
|
|
1012
|
-
flowPaddingStartX:
|
|
1013
|
-
flowPaddingStartY:
|
|
1014
|
-
paddingStartX:
|
|
1015
|
-
paddingStartY:
|
|
1016
|
-
paddingEndX:
|
|
1017
|
-
paddingEndY:
|
|
1018
|
-
}), _ = t == null || Math.abs(u - h) < 2, v = e == null || Math.abs(m - g) < 2, y = t == null || t === void 0 ||
|
|
1019
|
-
_ && v ? y && b && !a.value && !x.value && (
|
|
977
|
+
getItemSizeY: (e) => M.get(e),
|
|
978
|
+
getItemSizeX: (e) => j.get(e),
|
|
979
|
+
getItemQueryY: (e) => M.query(e),
|
|
980
|
+
getItemQueryX: (e) => j.query(e),
|
|
981
|
+
getColumnSize: (e) => N.get(e),
|
|
982
|
+
getColumnQuery: (e) => N.query(e),
|
|
983
|
+
scaleX: K.value,
|
|
984
|
+
scaleY: q.value,
|
|
985
|
+
hostOffsetX: G.x,
|
|
986
|
+
hostOffsetY: G.y,
|
|
987
|
+
stickyIndices: Ne.value,
|
|
988
|
+
stickyStartX: z.value,
|
|
989
|
+
stickyStartY: B.value,
|
|
990
|
+
stickyEndX: Be.value,
|
|
991
|
+
stickyEndY: Ve.value,
|
|
992
|
+
flowPaddingStartX: V.value,
|
|
993
|
+
flowPaddingStartY: H.value,
|
|
994
|
+
paddingStartX: Ie.value,
|
|
995
|
+
paddingStartY: Re.value,
|
|
996
|
+
paddingEndX: Le.value,
|
|
997
|
+
paddingEndY: ze.value
|
|
998
|
+
}), _ = t == null || Math.abs(u - h) < 2, v = e == null || Math.abs(m - g) < 2, y = t == null || t === void 0 || ge.value[t] === 1, b = e == null || e === void 0 || ve.value[e] === 1;
|
|
999
|
+
_ && v ? y && b && !a.value && !x.value && (R.value = null) : tt(e, t, isScrollToIndexOptions(r) ? {
|
|
1020
1000
|
...r,
|
|
1021
1001
|
isCorrection: !0
|
|
1022
1002
|
} : {
|
|
@@ -1026,7 +1006,7 @@ function useVirtualScroll(e) {
|
|
|
1026
1006
|
}
|
|
1027
1007
|
}
|
|
1028
1008
|
watch([
|
|
1029
|
-
|
|
1009
|
+
F,
|
|
1030
1010
|
f,
|
|
1031
1011
|
p
|
|
1032
1012
|
], ht), watch(a, (e) => {
|
|
@@ -1035,30 +1015,30 @@ function useVirtualScroll(e) {
|
|
|
1035
1015
|
let gt = null, _t = null, vt, yt = (e) => {
|
|
1036
1016
|
if (typeof window > "u") return;
|
|
1037
1017
|
let t = e || window, n = t === window || isElement(t) && t === document.documentElement ? document : t;
|
|
1038
|
-
if (n.addEventListener("scroll", pt, { passive: !0 }),
|
|
1018
|
+
if (n.addEventListener("scroll", pt, { passive: !0 }), ae = null, E(), isElement(t) && (_t = new MutationObserver(() => E()), _t.observe(t, {
|
|
1039
1019
|
attributes: !0,
|
|
1040
1020
|
attributeFilter: ["dir", "style"]
|
|
1041
|
-
})), vt = setInterval(
|
|
1021
|
+
})), vt = setInterval(E, 1e3), t === window) {
|
|
1042
1022
|
f.value = document.documentElement.clientWidth, p.value = document.documentElement.clientHeight, r.value = window.scrollX, i.value = window.scrollY;
|
|
1043
1023
|
let e = () => {
|
|
1044
|
-
|
|
1024
|
+
E(), f.value = document.documentElement.clientWidth, p.value = document.documentElement.clientHeight, Z();
|
|
1045
1025
|
};
|
|
1046
1026
|
return window.addEventListener("resize", e), () => {
|
|
1047
|
-
n.removeEventListener("scroll", pt), window.removeEventListener("resize", e), _t?.disconnect(), clearInterval(vt),
|
|
1027
|
+
n.removeEventListener("scroll", pt), window.removeEventListener("resize", e), _t?.disconnect(), clearInterval(vt), ae = null;
|
|
1048
1028
|
};
|
|
1049
1029
|
} else return f.value = t.clientWidth, p.value = t.clientHeight, r.value = t.scrollLeft, i.value = t.scrollTop, gt = new ResizeObserver(() => {
|
|
1050
|
-
|
|
1030
|
+
E(), f.value = t.clientWidth, p.value = t.clientHeight, Z();
|
|
1051
1031
|
}), gt.observe(t), () => {
|
|
1052
|
-
n.removeEventListener("scroll", pt), gt?.disconnect(), _t?.disconnect(), clearInterval(vt),
|
|
1032
|
+
n.removeEventListener("scroll", pt), gt?.disconnect(), _t?.disconnect(), clearInterval(vt), ae = null;
|
|
1053
1033
|
};
|
|
1054
1034
|
}, bt;
|
|
1055
1035
|
return getCurrentInstance() && (onMounted(() => {
|
|
1056
|
-
l.value = !0,
|
|
1036
|
+
l.value = !0, E(), watch(() => n.value.container, (e) => {
|
|
1057
1037
|
bt?.(), bt = yt(e || null);
|
|
1058
|
-
}, { immediate: !0 }),
|
|
1059
|
-
if (
|
|
1038
|
+
}, { immediate: !0 }), Z(), nextTick(() => {
|
|
1039
|
+
if (Z(), n.value.ssrRange || n.value.initialScrollIndex !== void 0) {
|
|
1060
1040
|
let e = n.value.initialScrollIndex === void 0 ? n.value.ssrRange?.start : n.value.initialScrollIndex, t = n.value.initialScrollAlign || "start";
|
|
1061
|
-
e != null &&
|
|
1041
|
+
e != null && tt(e, n.value.ssrRange?.colStart, {
|
|
1062
1042
|
align: t,
|
|
1063
1043
|
behavior: "auto"
|
|
1064
1044
|
}), o.value = !0, c.value = !0, nextTick(() => {
|
|
@@ -1070,40 +1050,40 @@ function useVirtualScroll(e) {
|
|
|
1070
1050
|
bt?.();
|
|
1071
1051
|
})), {
|
|
1072
1052
|
renderedItems: ut,
|
|
1073
|
-
totalWidth:
|
|
1074
|
-
totalHeight:
|
|
1075
|
-
renderedWidth:
|
|
1076
|
-
renderedHeight:
|
|
1053
|
+
totalWidth: U,
|
|
1054
|
+
totalHeight: W,
|
|
1055
|
+
renderedWidth: Xe,
|
|
1056
|
+
renderedHeight: Ze,
|
|
1077
1057
|
scrollDetails: dt,
|
|
1078
|
-
getRowHeight:
|
|
1079
|
-
getColumnWidth:
|
|
1080
|
-
getRowOffset: (e) =>
|
|
1058
|
+
getRowHeight: et,
|
|
1059
|
+
getColumnWidth: X,
|
|
1060
|
+
getRowOffset: (e) => H.value + B.value + Re.value + calculateOffsetAt(e, O.value, n.value.gap || 0, (e) => M.query(e)),
|
|
1081
1061
|
getColumnOffset: (e) => {
|
|
1082
|
-
let t =
|
|
1083
|
-
return
|
|
1062
|
+
let t = V.value + z.value + Ie.value;
|
|
1063
|
+
return D.value === "both" ? t + calculateOffsetAt(e, k.value, n.value.columnGap || 0, (e) => N.query(e)) : t + calculateOffsetAt(e, O.value, n.value.columnGap || 0, (e) => j.query(e));
|
|
1084
1064
|
},
|
|
1085
|
-
getItemOffset: (e) =>
|
|
1086
|
-
getItemSize: (e) =>
|
|
1087
|
-
scrollToIndex:
|
|
1088
|
-
scrollToOffset:
|
|
1065
|
+
getItemOffset: (e) => D.value === "horizontal" ? V.value + z.value + Ie.value + calculateOffsetAt(e, O.value, n.value.columnGap || 0, (e) => j.query(e)) : H.value + B.value + Re.value + calculateOffsetAt(e, O.value, n.value.gap || 0, (e) => M.query(e)),
|
|
1066
|
+
getItemSize: (e) => D.value === "horizontal" ? X(e) : et(e),
|
|
1067
|
+
scrollToIndex: tt,
|
|
1068
|
+
scrollToOffset: nt,
|
|
1089
1069
|
stopProgrammaticScroll: ft,
|
|
1090
1070
|
updateItemSize: $,
|
|
1091
1071
|
updateItemSizes: mt,
|
|
1092
|
-
updateHostOffset:
|
|
1093
|
-
updateDirection:
|
|
1072
|
+
updateHostOffset: Z,
|
|
1073
|
+
updateDirection: E,
|
|
1094
1074
|
columnRange: ct,
|
|
1095
1075
|
refresh: () => {
|
|
1096
|
-
|
|
1076
|
+
Ae(rt);
|
|
1097
1077
|
},
|
|
1098
1078
|
isHydrated: o,
|
|
1099
|
-
isWindowContainer:
|
|
1079
|
+
isWindowContainer: qe,
|
|
1100
1080
|
isRtl: d,
|
|
1101
|
-
scaleX:
|
|
1102
|
-
scaleY:
|
|
1103
|
-
componentOffset:
|
|
1104
|
-
renderedVirtualWidth:
|
|
1105
|
-
renderedVirtualHeight:
|
|
1106
|
-
getRowIndexAt:
|
|
1081
|
+
scaleX: K,
|
|
1082
|
+
scaleY: q,
|
|
1083
|
+
componentOffset: G,
|
|
1084
|
+
renderedVirtualWidth: Qe,
|
|
1085
|
+
renderedVirtualHeight: $e,
|
|
1086
|
+
getRowIndexAt: Q,
|
|
1107
1087
|
getColIndexAt: at
|
|
1108
1088
|
};
|
|
1109
1089
|
}
|
|
@@ -1286,18 +1266,18 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1286
1266
|
"visibleRangeChange"
|
|
1287
1267
|
],
|
|
1288
1268
|
setup(o, { expose: s, emit: c }) {
|
|
1289
|
-
let _ = o, S = c, T = useSlots(),
|
|
1290
|
-
let e =
|
|
1291
|
-
return e ===
|
|
1292
|
-
}),
|
|
1269
|
+
let _ = o, S = c, T = useSlots(), E = ref(null), D = ref(null), oe = ref(null), se = ref(null), O = /* @__PURE__ */ new Map(), k = useId(), A = computed(() => `vs-container-${k}`), le = ref(0), ue = ref(0), de = computed(() => _.container === void 0 ? E.value : _.container), fe = computed(() => {
|
|
1270
|
+
let e = de.value;
|
|
1271
|
+
return e === E.value || isWindowLike(e);
|
|
1272
|
+
}), j = computed(() => (_.items.length, {
|
|
1293
1273
|
items: _.items,
|
|
1294
1274
|
itemSize: _.itemSize,
|
|
1295
1275
|
direction: _.direction,
|
|
1296
1276
|
bufferBefore: _.bufferBefore,
|
|
1297
1277
|
bufferAfter: _.bufferAfter,
|
|
1298
|
-
container:
|
|
1299
|
-
hostElement:
|
|
1300
|
-
hostRef:
|
|
1278
|
+
container: de.value,
|
|
1279
|
+
hostElement: D.value,
|
|
1280
|
+
hostRef: E.value,
|
|
1301
1281
|
ssrRange: _.ssrRange,
|
|
1302
1282
|
columnCount: _.columnCount,
|
|
1303
1283
|
columnWidth: _.columnWidth,
|
|
@@ -1311,19 +1291,19 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1311
1291
|
},
|
|
1312
1292
|
flowPaddingStart: {
|
|
1313
1293
|
x: 0,
|
|
1314
|
-
y: _.stickyHeader ? 0 :
|
|
1294
|
+
y: _.stickyHeader ? 0 : le.value
|
|
1315
1295
|
},
|
|
1316
1296
|
flowPaddingEnd: {
|
|
1317
1297
|
x: 0,
|
|
1318
|
-
y: _.stickyFooter ? 0 :
|
|
1298
|
+
y: _.stickyFooter ? 0 : ue.value
|
|
1319
1299
|
},
|
|
1320
1300
|
stickyStart: {
|
|
1321
1301
|
x: 0,
|
|
1322
|
-
y: _.stickyHeader &&
|
|
1302
|
+
y: _.stickyHeader && fe.value ? le.value : 0
|
|
1323
1303
|
},
|
|
1324
1304
|
stickyEnd: {
|
|
1325
1305
|
x: 0,
|
|
1326
|
-
y: _.stickyFooter &&
|
|
1306
|
+
y: _.stickyFooter && fe.value ? ue.value : 0
|
|
1327
1307
|
},
|
|
1328
1308
|
gap: _.gap,
|
|
1329
1309
|
columnGap: _.columnGap,
|
|
@@ -1337,64 +1317,64 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1337
1317
|
defaultColumnWidth: _.defaultColumnWidth,
|
|
1338
1318
|
debug: _.debug,
|
|
1339
1319
|
snap: _.snap
|
|
1340
|
-
})), { isHydrated:
|
|
1341
|
-
function Ue(e) {
|
|
1342
|
-
let { displayViewportSize: t } = F.value;
|
|
1343
|
-
e >= ge.value - t.height - .5 ? ye(null, Infinity) : ye(null, displayToVirtual(e, Ne.y, je.value));
|
|
1344
|
-
}
|
|
1320
|
+
})), { isHydrated: M, isRtl: he, columnRange: N, renderedItems: ge, scrollDetails: P, renderedHeight: _e, renderedWidth: ve, getColumnWidth: F, getRowHeight: ye, scrollToIndex: I, scrollToOffset: be, updateHostOffset: xe, updateItemSizes: Se, updateDirection: Ce, getItemOffset: we, getRowOffset: Te, getColumnOffset: Ee, getItemSize: Oe, refresh: ke, stopProgrammaticScroll: L, scaleX: je, scaleY: Me, isWindowContainer: Ne, componentOffset: Pe, renderedVirtualWidth: B, renderedVirtualHeight: Ve, getRowIndexAt: V, getColIndexAt: He } = useVirtualScroll(j), H = computed(() => je.value !== 1 || Me.value !== 1), Ue = computed(() => Ne.value ? !1 : _.virtualScrollbar === !0 || je.value !== 1 || Me.value !== 1);
|
|
1345
1321
|
function We(e) {
|
|
1346
|
-
let { displayViewportSize: t } =
|
|
1347
|
-
e >= _e.value - t.
|
|
1322
|
+
let { displayViewportSize: t } = P.value;
|
|
1323
|
+
e >= _e.value - t.height - .5 ? be(null, Infinity) : be(null, displayToVirtual(e, Pe.y, Me.value));
|
|
1324
|
+
}
|
|
1325
|
+
function Ge(e) {
|
|
1326
|
+
let { displayViewportSize: t } = P.value;
|
|
1327
|
+
e >= ve.value - t.width - .5 ? be(Infinity, null) : be(displayToVirtual(e, Pe.x, je.value), null);
|
|
1348
1328
|
}
|
|
1349
|
-
let
|
|
1329
|
+
let Ke = useVirtualScrollbar(computed(() => ({
|
|
1350
1330
|
axis: "vertical",
|
|
1351
|
-
totalSize: ge.value,
|
|
1352
|
-
position: F.value.displayScrollOffset.y,
|
|
1353
|
-
viewportSize: F.value.displayViewportSize.height,
|
|
1354
|
-
scrollToOffset: Ue,
|
|
1355
|
-
containerId: oe.value,
|
|
1356
|
-
isRtl: me.value
|
|
1357
|
-
}))), Ke = useVirtualScrollbar(computed(() => ({
|
|
1358
|
-
axis: "horizontal",
|
|
1359
1331
|
totalSize: _e.value,
|
|
1360
|
-
position:
|
|
1361
|
-
viewportSize:
|
|
1332
|
+
position: P.value.displayScrollOffset.y,
|
|
1333
|
+
viewportSize: P.value.displayViewportSize.height,
|
|
1362
1334
|
scrollToOffset: We,
|
|
1363
|
-
containerId:
|
|
1364
|
-
isRtl:
|
|
1365
|
-
}))), qe = computed(() =>
|
|
1366
|
-
|
|
1335
|
+
containerId: A.value,
|
|
1336
|
+
isRtl: he.value
|
|
1337
|
+
}))), qe = useVirtualScrollbar(computed(() => ({
|
|
1338
|
+
axis: "horizontal",
|
|
1339
|
+
totalSize: ve.value,
|
|
1340
|
+
position: P.value.displayScrollOffset.x,
|
|
1341
|
+
viewportSize: P.value.displayViewportSize.width,
|
|
1342
|
+
scrollToOffset: Ge,
|
|
1343
|
+
containerId: A.value,
|
|
1344
|
+
isRtl: he.value
|
|
1345
|
+
}))), Je = computed(() => _.direction === "both" ? {
|
|
1346
|
+
...N.value,
|
|
1367
1347
|
padStart: 0,
|
|
1368
1348
|
padEnd: 0
|
|
1369
|
-
} :
|
|
1370
|
-
function
|
|
1371
|
-
|
|
1349
|
+
} : N.value);
|
|
1350
|
+
function Ye() {
|
|
1351
|
+
ke(), Ce(), nextTick(() => {
|
|
1372
1352
|
let e = [];
|
|
1373
|
-
for (let [t, n] of
|
|
1353
|
+
for (let [t, n] of O.entries()) n && e.push({
|
|
1374
1354
|
index: t,
|
|
1375
1355
|
inlineSize: n.offsetWidth,
|
|
1376
1356
|
blockSize: n.offsetHeight,
|
|
1377
1357
|
element: n
|
|
1378
1358
|
});
|
|
1379
|
-
e.length > 0 &&
|
|
1359
|
+
e.length > 0 && Se(e);
|
|
1380
1360
|
});
|
|
1381
1361
|
}
|
|
1382
|
-
watch(
|
|
1383
|
-
!
|
|
1362
|
+
watch(P, (e, t) => {
|
|
1363
|
+
!M.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", {
|
|
1384
1364
|
start: e.range.start,
|
|
1385
1365
|
end: e.range.end,
|
|
1386
1366
|
colStart: e.columnRange.start,
|
|
1387
1367
|
colEnd: e.columnRange.end
|
|
1388
1368
|
}), !_.loading && (_.direction !== "horizontal" && e.totalSize && e.totalSize.height - (e.scrollOffset.y + e.viewportSize.height) <= _.loadDistance && S("load", "vertical"), _.direction !== "vertical" && e.totalSize && e.totalSize.width - (e.scrollOffset.x + e.viewportSize.width) <= _.loadDistance && S("load", "horizontal")));
|
|
1389
|
-
}), watch(
|
|
1390
|
-
e &&
|
|
1391
|
-
start:
|
|
1392
|
-
end:
|
|
1393
|
-
colStart:
|
|
1394
|
-
colEnd:
|
|
1369
|
+
}), watch(M, (e) => {
|
|
1370
|
+
e && P.value?.range && P.value?.columnRange && S("visibleRangeChange", {
|
|
1371
|
+
start: P.value.range.start,
|
|
1372
|
+
end: P.value.range.end,
|
|
1373
|
+
colStart: P.value.columnRange.start,
|
|
1374
|
+
colEnd: P.value.columnRange.end
|
|
1395
1375
|
});
|
|
1396
1376
|
}, { once: !0 });
|
|
1397
|
-
let
|
|
1377
|
+
let U = typeof window > "u" ? null : new ResizeObserver(xe), W = typeof window > "u" ? null : new ResizeObserver((e) => {
|
|
1398
1378
|
let t = [];
|
|
1399
1379
|
for (let n of e) {
|
|
1400
1380
|
let e = n.target, r = Number(e.dataset.index), i = e.dataset.colIndex, a = n.contentRect.width, o = n.contentRect.height;
|
|
@@ -1410,190 +1390,190 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1410
1390
|
element: e
|
|
1411
1391
|
});
|
|
1412
1392
|
}
|
|
1413
|
-
t.length > 0 &&
|
|
1414
|
-
}),
|
|
1415
|
-
|
|
1393
|
+
t.length > 0 && Se(t);
|
|
1394
|
+
}), G = typeof window > "u" ? null : new ResizeObserver(() => {
|
|
1395
|
+
le.value = oe.value?.offsetHeight || 0, ue.value = se.value?.offsetHeight || 0, xe();
|
|
1416
1396
|
});
|
|
1417
|
-
function
|
|
1397
|
+
function Xe(e, t) {
|
|
1418
1398
|
watch(e, (e, n) => {
|
|
1419
|
-
n &&
|
|
1399
|
+
n && G?.unobserve(n), e ? G?.observe(e) : t.value = 0;
|
|
1420
1400
|
}, { immediate: !0 });
|
|
1421
1401
|
}
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
for (let e of
|
|
1425
|
-
}), watch([
|
|
1426
|
-
t &&
|
|
1427
|
-
}), watch([
|
|
1402
|
+
Xe(oe, le), Xe(se, ue), onMounted(() => {
|
|
1403
|
+
E.value && U?.observe(E.value);
|
|
1404
|
+
for (let e of O.values()) Ze(e, !0);
|
|
1405
|
+
}), watch([E, D], ([e], [t]) => {
|
|
1406
|
+
t && U?.unobserve(t), e && U?.observe(e);
|
|
1407
|
+
}), watch([E, H], ([e, t], [n, r]) => {
|
|
1428
1408
|
let i = e !== n || t !== r;
|
|
1429
|
-
n && i && n.removeEventListener("wheel",
|
|
1409
|
+
n && i && n.removeEventListener("wheel", Q), e && i && e.addEventListener("wheel", Q, { passive: !t });
|
|
1430
1410
|
}, { immediate: !0 });
|
|
1431
|
-
function
|
|
1411
|
+
function Ze(e, t) {
|
|
1432
1412
|
let n = t ? "observe" : "unobserve";
|
|
1433
|
-
|
|
1413
|
+
W?.[n](e), _.direction === "both" && e.children.length > 0 && e.querySelectorAll("[data-col-index]").forEach((e) => W?.[n](e));
|
|
1434
1414
|
}
|
|
1435
|
-
function
|
|
1415
|
+
function Qe(e, t) {
|
|
1436
1416
|
if (e) {
|
|
1437
1417
|
let n = e;
|
|
1438
|
-
|
|
1418
|
+
O.set(t, n), Ze(n, !0);
|
|
1439
1419
|
} else {
|
|
1440
|
-
let e =
|
|
1441
|
-
e && (
|
|
1420
|
+
let e = O.get(t);
|
|
1421
|
+
e && (Ze(e, !1), O.delete(t));
|
|
1442
1422
|
}
|
|
1443
1423
|
}
|
|
1444
|
-
let
|
|
1424
|
+
let $e = ref(!1), K = {
|
|
1445
1425
|
x: 0,
|
|
1446
1426
|
y: 0
|
|
1447
|
-
},
|
|
1427
|
+
}, q = {
|
|
1448
1428
|
x: 0,
|
|
1449
1429
|
y: 0
|
|
1450
|
-
},
|
|
1430
|
+
}, J = {
|
|
1451
1431
|
x: 0,
|
|
1452
1432
|
y: 0
|
|
1453
|
-
},
|
|
1433
|
+
}, Y = 0, X = {
|
|
1454
1434
|
x: 0,
|
|
1455
1435
|
y: 0
|
|
1456
|
-
},
|
|
1457
|
-
function
|
|
1436
|
+
}, et = null;
|
|
1437
|
+
function tt() {
|
|
1458
1438
|
let e = () => {
|
|
1459
|
-
let { nextVelocity: t, delta: n } = calculateInertiaStep(
|
|
1460
|
-
|
|
1461
|
-
let { x: r, y: i } =
|
|
1462
|
-
|
|
1439
|
+
let { nextVelocity: t, delta: n } = calculateInertiaStep(X, FRICTION);
|
|
1440
|
+
X.x = t.x, X.y = t.y;
|
|
1441
|
+
let { x: r, y: i } = P.value.scrollOffset;
|
|
1442
|
+
be(r + n.x, i + n.y, { behavior: "auto" }), Math.abs(X.x) > MIN_VELOCITY || Math.abs(X.y) > MIN_VELOCITY ? et = requestAnimationFrame(e) : nt();
|
|
1463
1443
|
};
|
|
1464
|
-
|
|
1444
|
+
et = requestAnimationFrame(e);
|
|
1465
1445
|
}
|
|
1466
|
-
function
|
|
1467
|
-
|
|
1446
|
+
function nt() {
|
|
1447
|
+
et !== null && (cancelAnimationFrame(et), et = null), X = {
|
|
1468
1448
|
x: 0,
|
|
1469
1449
|
y: 0
|
|
1470
1450
|
};
|
|
1471
1451
|
}
|
|
1472
|
-
function
|
|
1473
|
-
|
|
1452
|
+
function rt(e) {
|
|
1453
|
+
L(), nt(), H.value && (e.pointerType === "mouse" && e.button !== 0 || ($e.value = !0, K = {
|
|
1474
1454
|
x: e.clientX,
|
|
1475
1455
|
y: e.clientY
|
|
1476
|
-
},
|
|
1456
|
+
}, J = {
|
|
1477
1457
|
x: e.clientX,
|
|
1478
1458
|
y: e.clientY
|
|
1479
|
-
},
|
|
1480
|
-
x:
|
|
1481
|
-
y:
|
|
1459
|
+
}, Y = performance.now(), q = {
|
|
1460
|
+
x: P.value.scrollOffset.x,
|
|
1461
|
+
y: P.value.scrollOffset.y
|
|
1482
1462
|
}, e.currentTarget.setPointerCapture(e.pointerId)));
|
|
1483
1463
|
}
|
|
1484
|
-
function
|
|
1485
|
-
if (
|
|
1486
|
-
let t = performance.now(), n = t -
|
|
1464
|
+
function it(e) {
|
|
1465
|
+
if (!$e.value) return;
|
|
1466
|
+
let t = performance.now(), n = t - Y;
|
|
1487
1467
|
if (n > 0) {
|
|
1488
|
-
let t = calculateInstantaneousVelocity(
|
|
1468
|
+
let t = calculateInstantaneousVelocity(J, {
|
|
1489
1469
|
x: e.clientX,
|
|
1490
1470
|
y: e.clientY
|
|
1491
1471
|
}, n);
|
|
1492
|
-
|
|
1472
|
+
X.x = X.x * .2 + t.x * .8, X.y = X.y * .2 + t.y * .8;
|
|
1493
1473
|
}
|
|
1494
|
-
|
|
1474
|
+
J = {
|
|
1495
1475
|
x: e.clientX,
|
|
1496
1476
|
y: e.clientY
|
|
1497
|
-
},
|
|
1498
|
-
let r =
|
|
1477
|
+
}, Y = t;
|
|
1478
|
+
let r = K.x - e.clientX, i = K.y - e.clientY;
|
|
1499
1479
|
requestAnimationFrame(() => {
|
|
1500
|
-
|
|
1480
|
+
be(q.x + r, q.y + i, { behavior: "auto" });
|
|
1501
1481
|
});
|
|
1502
1482
|
}
|
|
1503
|
-
function
|
|
1504
|
-
|
|
1483
|
+
function Z(e) {
|
|
1484
|
+
$e.value && ($e.value = !1, e.currentTarget.releasePointerCapture(e.pointerId), (Math.abs(X.x) > MIN_VELOCITY || Math.abs(X.y) > MIN_VELOCITY) && (Math.abs(X.x) > 4 * Math.abs(X.y) ? X.y = 0 : Math.abs(X.y) > 4 * Math.abs(X.x) && (X.x = 0), tt()));
|
|
1505
1485
|
}
|
|
1506
|
-
function
|
|
1507
|
-
let { scrollOffset: t } =
|
|
1508
|
-
if (
|
|
1486
|
+
function Q(e) {
|
|
1487
|
+
let { scrollOffset: t } = P.value;
|
|
1488
|
+
if (L(), H.value) {
|
|
1509
1489
|
e.preventDefault();
|
|
1510
1490
|
let { deltaX: n, deltaY: r } = e;
|
|
1511
|
-
e.shiftKey && n === 0 && (n = r, r = 0),
|
|
1491
|
+
e.shiftKey && n === 0 && (n = r, r = 0), be(t.x + n, t.y + r, { behavior: "auto" });
|
|
1512
1492
|
}
|
|
1513
1493
|
}
|
|
1514
1494
|
function at(e) {
|
|
1515
|
-
let { viewportSize: t, scrollOffset: n } =
|
|
1495
|
+
let { viewportSize: t, scrollOffset: n } = P.value, r = _.direction !== "vertical", i = _.direction !== "horizontal", a = j.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) => {
|
|
1516
1496
|
let r = (e ? n.x : n.y) + (e ? t.width : t.height) / 2;
|
|
1517
|
-
return e ?
|
|
1518
|
-
}, { currentIndex: p, currentEndIndex: m, currentColIndex: h, currentEndColIndex: g } =
|
|
1497
|
+
return e ? He(r) : V(r);
|
|
1498
|
+
}, { currentIndex: p, currentEndIndex: m, currentColIndex: h, currentEndColIndex: g } = P.value, v = (e, t) => {
|
|
1519
1499
|
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;
|
|
1520
1500
|
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;
|
|
1521
1501
|
}, y = (e, r) => {
|
|
1522
1502
|
let i = !e;
|
|
1523
1503
|
if (d === "center") {
|
|
1524
1504
|
let t = f(i), n = i && _.columnCount ? _.columnCount - 1 : _.items.length - 1, a = r ? Math.min(n, t + 1) : Math.max(0, t - 1);
|
|
1525
|
-
|
|
1505
|
+
I(e ? a : null, i ? a : null, { align: "center" });
|
|
1526
1506
|
return;
|
|
1527
1507
|
}
|
|
1528
|
-
if (e) if (r) if (d === "start")
|
|
1508
|
+
if (e) if (r) if (d === "start") I(Math.min(_.items.length - 1, p + 1), null, { align: "start" });
|
|
1529
1509
|
else {
|
|
1530
1510
|
let e = d || "end", r = n.y + t.height - (s.y + l.y);
|
|
1531
|
-
|
|
1511
|
+
Te(m) + ye(m) > r + 1 ? I(m, null, { align: e }) : m < _.items.length - 1 && I(m + 1, null, { align: e });
|
|
1532
1512
|
}
|
|
1533
|
-
else if (d === "end")
|
|
1513
|
+
else if (d === "end") I(Math.max(0, m - 1), null, { align: "end" });
|
|
1534
1514
|
else {
|
|
1535
1515
|
let e = d || "start", t = n.y + o.y + c.y;
|
|
1536
|
-
|
|
1516
|
+
Te(p) < t - 1 ? I(p, null, { align: e }) : p > 0 && I(p - 1, null, { align: e });
|
|
1537
1517
|
}
|
|
1538
1518
|
else {
|
|
1539
1519
|
let e = _.columnCount ? _.columnCount - 1 : _.items.length - 1;
|
|
1540
|
-
if (
|
|
1520
|
+
if (he.value ? !r : r) if (d === "start") I(null, Math.min(e, h + 1), { align: "start" });
|
|
1541
1521
|
else {
|
|
1542
1522
|
let r = d || "end", i = n.x + t.width - (s.x + l.x);
|
|
1543
|
-
(_.columnCount ?
|
|
1523
|
+
(_.columnCount ? Ee(g) + F(g) : we(g) + Oe(g)) > i + 1 ? I(null, g, { align: r }) : g < e && I(null, g + 1, { align: r });
|
|
1544
1524
|
}
|
|
1545
|
-
else if (d === "end")
|
|
1525
|
+
else if (d === "end") I(null, Math.max(0, g - 1), { align: "end" });
|
|
1546
1526
|
else {
|
|
1547
1527
|
let e = d || "start", t = n.x + o.x + c.x;
|
|
1548
|
-
(_.columnCount ?
|
|
1528
|
+
(_.columnCount ? Ee(h) : we(h)) < t - 1 ? I(null, h, { align: e }) : h > 0 && I(null, h - 1, { align: e });
|
|
1549
1529
|
}
|
|
1550
1530
|
}
|
|
1551
1531
|
};
|
|
1552
1532
|
switch (e.key) {
|
|
1553
1533
|
case "Home":
|
|
1554
|
-
e.preventDefault(),
|
|
1534
|
+
e.preventDefault(), L(), I(0, 0, {
|
|
1555
1535
|
behavior: Math.max(n.x, n.y) > 10 * (_.direction === "horizontal" ? t.width : t.height) ? "auto" : "smooth",
|
|
1556
1536
|
align: "start"
|
|
1557
1537
|
});
|
|
1558
1538
|
break;
|
|
1559
1539
|
case "End": {
|
|
1560
|
-
e.preventDefault(),
|
|
1561
|
-
let r = _.items.length - 1, i = (_.columnCount || 0) > 0 ? _.columnCount - 1 : 0, { totalSize: a } =
|
|
1562
|
-
_.direction === "both" ?
|
|
1540
|
+
e.preventDefault(), L();
|
|
1541
|
+
let r = _.items.length - 1, i = (_.columnCount || 0) > 0 ? _.columnCount - 1 : 0, { totalSize: a } = P.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";
|
|
1542
|
+
_.direction === "both" ? I(r, i, {
|
|
1563
1543
|
behavior: o,
|
|
1564
1544
|
align: "end"
|
|
1565
|
-
}) :
|
|
1545
|
+
}) : I(_.direction === "vertical" ? r : 0, _.direction === "horizontal" ? r : 0, {
|
|
1566
1546
|
behavior: o,
|
|
1567
1547
|
align: "end"
|
|
1568
1548
|
});
|
|
1569
1549
|
break;
|
|
1570
1550
|
}
|
|
1571
1551
|
case "ArrowUp":
|
|
1572
|
-
e.preventDefault(),
|
|
1552
|
+
e.preventDefault(), L(), i && y(!0, !1);
|
|
1573
1553
|
break;
|
|
1574
1554
|
case "ArrowDown":
|
|
1575
|
-
e.preventDefault(),
|
|
1555
|
+
e.preventDefault(), L(), i && y(!0, !0);
|
|
1576
1556
|
break;
|
|
1577
1557
|
case "ArrowLeft":
|
|
1578
|
-
e.preventDefault(),
|
|
1558
|
+
e.preventDefault(), L(), r && y(!1, !1);
|
|
1579
1559
|
break;
|
|
1580
1560
|
case "ArrowRight":
|
|
1581
|
-
e.preventDefault(),
|
|
1561
|
+
e.preventDefault(), L(), r && y(!1, !0);
|
|
1582
1562
|
break;
|
|
1583
1563
|
case "PageUp":
|
|
1584
|
-
e.preventDefault(),
|
|
1564
|
+
e.preventDefault(), L(), _.direction === "horizontal" ? I(null, v(!1, !1), { align: d || "end" }) : I(v(!0, !1), null, { align: d || "end" });
|
|
1585
1565
|
break;
|
|
1586
1566
|
case "PageDown":
|
|
1587
|
-
e.preventDefault(),
|
|
1567
|
+
e.preventDefault(), L(), _.direction === "horizontal" ? I(null, v(!1, !0), { align: d || "start" }) : I(v(!0, !0), null, { align: d || "start" });
|
|
1588
1568
|
break;
|
|
1589
1569
|
}
|
|
1590
1570
|
}
|
|
1591
1571
|
onUnmounted(() => {
|
|
1592
|
-
|
|
1572
|
+
U?.disconnect(), W?.disconnect(), G?.disconnect();
|
|
1593
1573
|
});
|
|
1594
1574
|
let ot = computed(() => {
|
|
1595
1575
|
let e = { ..._.direction === "vertical" ? {} : { whiteSpace: "nowrap" } };
|
|
1596
|
-
return (
|
|
1576
|
+
return (Ue.value || !Ne.value) && (e.overflow = "auto"), H.value && (e.touchAction = "none"), Ne.value ? e : _.containerTag === "table" ? {
|
|
1597
1577
|
...e,
|
|
1598
1578
|
display: "block",
|
|
1599
1579
|
minInlineSize: _.direction === "vertical" ? "100%" : "auto"
|
|
@@ -1614,8 +1594,8 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1614
1594
|
position: n,
|
|
1615
1595
|
viewportSize: r,
|
|
1616
1596
|
scrollToOffset: i,
|
|
1617
|
-
containerId:
|
|
1618
|
-
isRtl:
|
|
1597
|
+
containerId: A.value,
|
|
1598
|
+
isRtl: he.value,
|
|
1619
1599
|
ariaLabel: `${e === "vertical" ? "Vertical" : "Horizontal"} scroll`
|
|
1620
1600
|
},
|
|
1621
1601
|
isDragging: a.isDragging.value
|
|
@@ -1623,18 +1603,18 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1623
1603
|
}
|
|
1624
1604
|
let ct = computed(() => {
|
|
1625
1605
|
if (_.direction === "horizontal") return null;
|
|
1626
|
-
let { displayViewportSize: e, displayScrollOffset: t } =
|
|
1627
|
-
return st("vertical",
|
|
1606
|
+
let { displayViewportSize: e, displayScrollOffset: t } = P.value;
|
|
1607
|
+
return st("vertical", _e.value, t.y, e.height, We, Ke);
|
|
1628
1608
|
}), lt = computed(() => {
|
|
1629
1609
|
if (_.direction === "vertical") return null;
|
|
1630
|
-
let { displayViewportSize: e, displayScrollOffset: t } =
|
|
1631
|
-
return st("horizontal",
|
|
1610
|
+
let { displayViewportSize: e, displayScrollOffset: t } = P.value;
|
|
1611
|
+
return st("horizontal", ve.value, t.x, e.width, Ge, qe);
|
|
1632
1612
|
}), ut = computed(() => {
|
|
1633
1613
|
let e = _.direction === "horizontal", t = _.direction === "vertical", n = _.direction === "both", r = {
|
|
1634
|
-
inlineSize: t ? "100%" : `${
|
|
1635
|
-
blockSize: e ? "100%" : `${
|
|
1614
|
+
inlineSize: t ? "100%" : `${B.value}px`,
|
|
1615
|
+
blockSize: e ? "100%" : `${Ve.value}px`
|
|
1636
1616
|
};
|
|
1637
|
-
return
|
|
1617
|
+
return M.value || (r.display = "flex", r.flexDirection = e ? "row" : "column", (e || n) && _.columnGap && (r.columnGap = `${_.columnGap}px`), (t || n) && _.gap && (r.rowGap = `${_.gap}px`)), r;
|
|
1638
1618
|
}), dt = computed(() => {
|
|
1639
1619
|
let e = _.direction === "horizontal";
|
|
1640
1620
|
return {
|
|
@@ -1645,21 +1625,21 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1645
1625
|
} : { inlineSize: "100%" }
|
|
1646
1626
|
};
|
|
1647
1627
|
}), ft = computed(() => ({
|
|
1648
|
-
inlineSize: _.direction === "vertical" ? "1px" : `${
|
|
1649
|
-
blockSize: _.direction === "horizontal" ? "1px" : `${
|
|
1628
|
+
inlineSize: _.direction === "vertical" ? "1px" : `${B.value}px`,
|
|
1629
|
+
blockSize: _.direction === "horizontal" ? "1px" : `${Ve.value}px`
|
|
1650
1630
|
}));
|
|
1651
1631
|
function pt(e) {
|
|
1652
1632
|
let t = calculateItemStyle({
|
|
1653
1633
|
containerTag: _.containerTag || "div",
|
|
1654
1634
|
direction: _.direction,
|
|
1655
|
-
isHydrated:
|
|
1635
|
+
isHydrated: M.value,
|
|
1656
1636
|
item: e,
|
|
1657
1637
|
itemSize: _.itemSize,
|
|
1658
|
-
paddingStartX:
|
|
1659
|
-
paddingStartY:
|
|
1660
|
-
isRtl:
|
|
1638
|
+
paddingStartX: j.value.scrollPaddingStart.x,
|
|
1639
|
+
paddingStartY: j.value.scrollPaddingStart.y,
|
|
1640
|
+
isRtl: he.value
|
|
1661
1641
|
});
|
|
1662
|
-
return !
|
|
1642
|
+
return !M.value && _.direction === "both" && (t.display = "flex", _.columnGap && (t.columnGap = `${_.columnGap}px`)), t;
|
|
1663
1643
|
}
|
|
1664
1644
|
let mt = computed(() => _.debug), $ = computed(() => _.containerTag === "table"), ht = computed(() => $.value ? "thead" : "div"), gt = computed(() => $.value ? "tfoot" : "div"), _t = computed(() => _.role ? _.role : $.value ? null : _.direction === "both" ? "grid" : "list"), vt = computed(() => _t.value === "grid" || $.value), yt = computed(() => $.value ? null : _.ariaLabel || _.ariaLabelledby ? "region" : "none"), bt = computed(() => $.value ? null : _t.value), xt = computed(() => {
|
|
1665
1645
|
if (vt.value) return "row";
|
|
@@ -1696,43 +1676,43 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1696
1676
|
}
|
|
1697
1677
|
return s({
|
|
1698
1678
|
...toRefs(_),
|
|
1699
|
-
scrollDetails:
|
|
1700
|
-
columnRange:
|
|
1701
|
-
getColumnWidth:
|
|
1702
|
-
getRowHeight:
|
|
1679
|
+
scrollDetails: P,
|
|
1680
|
+
columnRange: N,
|
|
1681
|
+
getColumnWidth: F,
|
|
1682
|
+
getRowHeight: ye,
|
|
1703
1683
|
getCellAriaProps: Ot,
|
|
1704
1684
|
getItemAriaProps: Dt,
|
|
1705
|
-
getRowOffset:
|
|
1706
|
-
getColumnOffset:
|
|
1707
|
-
getItemOffset:
|
|
1708
|
-
getItemSize:
|
|
1709
|
-
getRowIndexAt:
|
|
1710
|
-
getColIndexAt:
|
|
1711
|
-
scrollToIndex:
|
|
1712
|
-
scrollToOffset:
|
|
1713
|
-
refresh:
|
|
1685
|
+
getRowOffset: Te,
|
|
1686
|
+
getColumnOffset: Ee,
|
|
1687
|
+
getItemOffset: we,
|
|
1688
|
+
getItemSize: Oe,
|
|
1689
|
+
getRowIndexAt: V,
|
|
1690
|
+
getColIndexAt: He,
|
|
1691
|
+
scrollToIndex: I,
|
|
1692
|
+
scrollToOffset: be,
|
|
1693
|
+
refresh: Ye,
|
|
1714
1694
|
stopProgrammaticScroll: () => {
|
|
1715
|
-
|
|
1695
|
+
L(), nt();
|
|
1716
1696
|
},
|
|
1717
|
-
updateDirection:
|
|
1718
|
-
isRtl:
|
|
1719
|
-
isHydrated:
|
|
1720
|
-
scaleX:
|
|
1721
|
-
scaleY:
|
|
1722
|
-
renderedWidth:
|
|
1723
|
-
renderedHeight:
|
|
1724
|
-
componentOffset:
|
|
1697
|
+
updateDirection: Ce,
|
|
1698
|
+
isRtl: he,
|
|
1699
|
+
isHydrated: M,
|
|
1700
|
+
scaleX: je,
|
|
1701
|
+
scaleY: Me,
|
|
1702
|
+
renderedWidth: ve,
|
|
1703
|
+
renderedHeight: _e,
|
|
1704
|
+
componentOffset: Pe,
|
|
1725
1705
|
scrollbarPropsVertical: ct,
|
|
1726
1706
|
scrollbarPropsHorizontal: lt
|
|
1727
1707
|
}), (t, s) => (openBlock(), createBlock(resolveDynamicComponent(o.containerTag), mergeProps({
|
|
1728
|
-
id:
|
|
1708
|
+
id: A.value,
|
|
1729
1709
|
ref_key: "hostRef",
|
|
1730
|
-
ref:
|
|
1710
|
+
ref: E,
|
|
1731
1711
|
class: ["virtual-scroll-container", [`virtual-scroll--${o.direction}`, {
|
|
1732
|
-
"virtual-scroll--hydrated": unref(
|
|
1733
|
-
"virtual-scroll--window": unref(
|
|
1712
|
+
"virtual-scroll--hydrated": unref(M),
|
|
1713
|
+
"virtual-scroll--window": unref(Ne),
|
|
1734
1714
|
"virtual-scroll--table": $.value,
|
|
1735
|
-
"virtual-scroll--hide-scrollbar":
|
|
1715
|
+
"virtual-scroll--hide-scrollbar": Ue.value
|
|
1736
1716
|
}]],
|
|
1737
1717
|
style: ot.value,
|
|
1738
1718
|
tabindex: "0",
|
|
@@ -1742,24 +1722,24 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1742
1722
|
...Et.value
|
|
1743
1723
|
} : Tt.value, {
|
|
1744
1724
|
onKeydown: at,
|
|
1745
|
-
onPointerdown:
|
|
1746
|
-
onPointermove:
|
|
1747
|
-
onPointerup:
|
|
1748
|
-
onPointercancel:
|
|
1725
|
+
onPointerdown: rt,
|
|
1726
|
+
onPointermove: it,
|
|
1727
|
+
onPointerup: Z,
|
|
1728
|
+
onPointercancel: Z
|
|
1749
1729
|
}), {
|
|
1750
1730
|
default: withCtx(() => [
|
|
1751
|
-
|
|
1731
|
+
Ue.value ? (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", {
|
|
1752
1732
|
class: "virtual-scroll-scrollbar-viewport",
|
|
1753
1733
|
style: normalizeStyle({
|
|
1754
|
-
inlineSize: `${unref(
|
|
1755
|
-
blockSize: `${unref(
|
|
1734
|
+
inlineSize: `${unref(P).displayViewportSize.width}px`,
|
|
1735
|
+
blockSize: `${unref(P).displayViewportSize.height}px`,
|
|
1756
1736
|
"--vsi-scrollbar-has-cross-gap": o.direction === "both" ? 1 : 0
|
|
1757
1737
|
})
|
|
1758
1738
|
}, [T.scrollbar && ct.value ? renderSlot(t.$slots, "scrollbar", normalizeProps(mergeProps({ key: 0 }, ct.value)), void 0, !0) : ct.value ? (openBlock(), createBlock(VirtualScrollbar_default, normalizeProps(mergeProps({ key: 1 }, ct.value.scrollbarProps)), null, 16)) : createCommentVNode("", !0), T.scrollbar && lt.value ? renderSlot(t.$slots, "scrollbar", normalizeProps(mergeProps({ key: 2 }, lt.value)), void 0, !0) : lt.value ? (openBlock(), createBlock(VirtualScrollbar_default, normalizeProps(mergeProps({ key: 3 }, lt.value.scrollbarProps)), null, 16)) : createCommentVNode("", !0)], 4)])) : createCommentVNode("", !0),
|
|
1759
1739
|
T.header ? (openBlock(), createBlock(resolveDynamicComponent(ht.value), {
|
|
1760
1740
|
key: 1,
|
|
1761
1741
|
ref_key: "headerRef",
|
|
1762
|
-
ref:
|
|
1742
|
+
ref: oe,
|
|
1763
1743
|
class: normalizeClass(["virtual-scroll-header", { "virtual-scroll--sticky": o.stickyHeader }]),
|
|
1764
1744
|
role: $.value ? void 0 : "none"
|
|
1765
1745
|
}, {
|
|
@@ -1768,7 +1748,7 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1768
1748
|
}, 8, ["class", "role"])) : createCommentVNode("", !0),
|
|
1769
1749
|
(openBlock(), createBlock(resolveDynamicComponent(o.wrapperTag), mergeProps({
|
|
1770
1750
|
ref_key: "wrapperRef",
|
|
1771
|
-
ref:
|
|
1751
|
+
ref: D,
|
|
1772
1752
|
class: "virtual-scroll-wrapper",
|
|
1773
1753
|
style: ut.value,
|
|
1774
1754
|
role: $.value ? void 0 : bt.value
|
|
@@ -1784,10 +1764,10 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1784
1764
|
"block-size": "inherit"
|
|
1785
1765
|
} }, null, -1)]]),
|
|
1786
1766
|
_: 1
|
|
1787
|
-
}, 8, ["style"])) : createCommentVNode("", !0), (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(
|
|
1767
|
+
}, 8, ["style"])) : createCommentVNode("", !0), (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(ge), (e) => (openBlock(), createBlock(resolveDynamicComponent(o.itemTag), mergeProps({
|
|
1788
1768
|
key: e.index,
|
|
1789
1769
|
ref_for: !0,
|
|
1790
|
-
ref: (t) =>
|
|
1770
|
+
ref: (t) => Qe(t, e.index),
|
|
1791
1771
|
"data-index": e.index,
|
|
1792
1772
|
class: ["virtual-scroll-item", {
|
|
1793
1773
|
"virtual-scroll--sticky": e.isStickyActive,
|
|
@@ -1799,8 +1779,8 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1799
1779
|
item: e.item,
|
|
1800
1780
|
index: e.index,
|
|
1801
1781
|
getItemAriaProps: Dt,
|
|
1802
|
-
columnRange:
|
|
1803
|
-
getColumnWidth: unref(
|
|
1782
|
+
columnRange: Je.value,
|
|
1783
|
+
getColumnWidth: unref(F),
|
|
1804
1784
|
getCellAriaProps: Ot,
|
|
1805
1785
|
gap: _.gap,
|
|
1806
1786
|
columnGap: _.columnGap,
|
|
@@ -1828,7 +1808,7 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1828
1808
|
T.footer ? (openBlock(), createBlock(resolveDynamicComponent(gt.value), {
|
|
1829
1809
|
key: 3,
|
|
1830
1810
|
ref_key: "footerRef",
|
|
1831
|
-
ref:
|
|
1811
|
+
ref: se,
|
|
1832
1812
|
class: normalizeClass(["virtual-scroll-footer", { "virtual-scroll--sticky": o.stickyFooter }]),
|
|
1833
1813
|
role: $.value ? void 0 : "none"
|
|
1834
1814
|
}, {
|