@pdanpdan/virtual-scroll 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -6
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +295 -31
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +954 -878
- package/dist/index.mjs.map +1 -1
- package/dist/virtual-scroll.css +1 -1
- package/package.json +1 -1
- package/src/components/VirtualScroll.vue +301 -209
- package/src/components/VirtualScrollbar.vue +8 -8
- package/src/composables/useVirtualScroll.ts +261 -521
- package/src/composables/useVirtualScrollSizes.ts +448 -0
- package/src/composables/useVirtualScrollbar.ts +30 -35
- package/src/index.ts +1 -0
- package/src/types.ts +25 -2
- package/src/utils/scroll.ts +14 -14
- package/src/utils/virtual-scroll-logic.ts +305 -1
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, 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, 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,
|
|
@@ -37,65 +37,7 @@ const DEFAULT_ITEM_SIZE = 40, DEFAULT_COLUMN_WIDTH = 100, DEFAULT_BUFFER = 5, EM
|
|
|
37
37
|
padStart: 0,
|
|
38
38
|
padEnd: 0
|
|
39
39
|
}
|
|
40
|
-
};
|
|
41
|
-
var FenwickTree = class {
|
|
42
|
-
tree;
|
|
43
|
-
values;
|
|
44
|
-
constructor(e) {
|
|
45
|
-
this.tree = new Float64Array(e + 1), this.values = new Float64Array(e);
|
|
46
|
-
}
|
|
47
|
-
update(e, t) {
|
|
48
|
-
if (!(e < 0 || e >= this.values.length)) for (this.values[e] = this.values[e] + t, e++; e < this.tree.length;) this.tree[e] = this.tree[e] + t, e += e & -e;
|
|
49
|
-
}
|
|
50
|
-
query(e) {
|
|
51
|
-
let t = 0;
|
|
52
|
-
for (; e > 0;) t += this.tree[e] || 0, e -= e & -e;
|
|
53
|
-
return t;
|
|
54
|
-
}
|
|
55
|
-
set(e, t) {
|
|
56
|
-
e < 0 || e >= this.values.length || (this.values[e] = t);
|
|
57
|
-
}
|
|
58
|
-
get length() {
|
|
59
|
-
return this.values.length;
|
|
60
|
-
}
|
|
61
|
-
get(e) {
|
|
62
|
-
return this.values[e] || 0;
|
|
63
|
-
}
|
|
64
|
-
getValues() {
|
|
65
|
-
return this.values;
|
|
66
|
-
}
|
|
67
|
-
findLowerBound(e) {
|
|
68
|
-
let t = 0, n = this.tree.length, r = 1 << Math.floor(Math.log2(n - 1));
|
|
69
|
-
for (; r > 0;) {
|
|
70
|
-
let i = t + r;
|
|
71
|
-
if (i < n) {
|
|
72
|
-
let n = this.tree[i] || 0;
|
|
73
|
-
n <= e && (t = i, e -= n);
|
|
74
|
-
}
|
|
75
|
-
r >>= 1;
|
|
76
|
-
}
|
|
77
|
-
return t;
|
|
78
|
-
}
|
|
79
|
-
rebuild() {
|
|
80
|
-
this.tree.fill(0);
|
|
81
|
-
for (let e = 0; e < this.values.length; e++) this.tree[e + 1] = this.values[e] || 0;
|
|
82
|
-
for (let e = 1; e < this.tree.length; e++) {
|
|
83
|
-
let t = e + (e & -e);
|
|
84
|
-
t < this.tree.length && (this.tree[t] = this.tree[t] + this.tree[e]);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
resize(e) {
|
|
88
|
-
if (e === this.values.length) return;
|
|
89
|
-
let t = new Float64Array(e);
|
|
90
|
-
t.set(this.values.subarray(0, Math.min(e, this.values.length))), this.values = t, this.tree = new Float64Array(e + 1), this.rebuild();
|
|
91
|
-
}
|
|
92
|
-
shift(e) {
|
|
93
|
-
if (e === 0) return;
|
|
94
|
-
let t = this.values.length, n = new Float64Array(t);
|
|
95
|
-
e > 0 ? n.set(this.values.subarray(0, Math.min(t - e, this.values.length)), e) : n.set(this.values.subarray(-e)), this.values = n, this.rebuild();
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
const BROWSER_MAX_SIZE = 1e7;
|
|
40
|
+
}, BROWSER_MAX_SIZE = 1e7;
|
|
99
41
|
function isWindow(e) {
|
|
100
42
|
return e === null || e === document.documentElement || typeof window < "u" && e === window;
|
|
101
43
|
}
|
|
@@ -181,6 +123,13 @@ function calculateAxisAlignment({ align: e, targetPos: t, itemSize: n, scrollPos
|
|
|
181
123
|
function calculateAxisSize(e, t, n, r) {
|
|
182
124
|
return e <= 0 ? 0 : t === null ? Math.max(0, r(e) - n) : Math.max(0, e * (t + n) - n);
|
|
183
125
|
}
|
|
126
|
+
function calculateRangeSize(e, t, n, r, i) {
|
|
127
|
+
let a = t - e;
|
|
128
|
+
return a <= 0 ? 0 : n === null ? Math.max(0, i(t) - i(e) - r) : Math.max(0, a * (n + r) - r);
|
|
129
|
+
}
|
|
130
|
+
function calculateOffsetAt(e, t, n, r) {
|
|
131
|
+
return t === null ? r(e) : e * (t + n);
|
|
132
|
+
}
|
|
184
133
|
function calculateAxisTarget({ index: e, align: t, viewSize: n, scrollPos: r, fixedSize: i, gap: a, query: o, getSize: s, stickyIndices: c, stickyStart: l, stickyEnd: u = 0 }) {
|
|
185
134
|
let d = l;
|
|
186
135
|
if (c && c.length > 0) {
|
|
@@ -225,20 +174,28 @@ function isItemVisible(e, t, n, r, i = 0, a = 0) {
|
|
|
225
174
|
let o = n + i, s = n + r - a;
|
|
226
175
|
return t <= r - i - a ? e >= o - .5 && e + t <= s + .5 : e <= o + .5 && e + t >= s - .5;
|
|
227
176
|
}
|
|
177
|
+
function calculateScale(e, t, n) {
|
|
178
|
+
if (e || t <= 1e7) return 1;
|
|
179
|
+
let r = Math.min(t, BROWSER_MAX_SIZE), i = t - n, a = r - n;
|
|
180
|
+
return a > 0 ? i / a : 1;
|
|
181
|
+
}
|
|
182
|
+
function calculateRenderedSize(e, t) {
|
|
183
|
+
return e ? t : Math.min(t, BROWSER_MAX_SIZE);
|
|
184
|
+
}
|
|
228
185
|
function displayToVirtual(e, t, n) {
|
|
229
186
|
return (e - t) * n;
|
|
230
187
|
}
|
|
231
188
|
function virtualToDisplay(e, t, n) {
|
|
232
189
|
return e / n + t;
|
|
233
190
|
}
|
|
234
|
-
function calculateScrollTarget({ rowIndex: e, colIndex: t, options: n, direction: r, viewportWidth: i, viewportHeight: a, totalWidth: o, totalHeight: s, gap: c, columnGap: l, fixedSize: u, fixedWidth: d, relativeScrollX: f, relativeScrollY: p, getItemSizeY: m, getItemSizeX: h, getItemQueryY: g, getItemQueryX: _, getColumnSize: v, getColumnQuery: y, scaleX: b, scaleY: x, hostOffsetX: S, hostOffsetY: C, stickyIndices: w, stickyStartX: T = 0, stickyStartY:
|
|
235
|
-
let
|
|
236
|
-
|
|
237
|
-
let
|
|
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: te = 0, stickyEndY: ne = 0, flowPaddingStartX: re = 0, flowPaddingStartY: ie = 0, paddingStartX: D = 0, paddingStartY: O = 0, paddingEndX: k = 0, paddingEndY: ae = 0 }) {
|
|
192
|
+
let j;
|
|
193
|
+
j = isScrollToIndexOptions(n) ? n.align : n;
|
|
194
|
+
let oe = (j && typeof j == "object" ? j.x : j) || "auto", se = (j && typeof j == "object" ? j.y : j) || "auto", ce = f, le = p, ue = 0, fe = 0, pe = "auto", M = "auto", N = b === 1 ? o : BROWSER_MAX_SIZE, me = x === 1 ? s : BROWSER_MAX_SIZE, P = Math.max(0, S + N - i), he = Math.max(0, C + me - a), F = (P - S) * b, ge = (he - C) * x, I = re + T + D, ve = ie + E + O;
|
|
238
195
|
if (e != null) {
|
|
239
196
|
let t = calculateAxisTarget({
|
|
240
197
|
index: e,
|
|
241
|
-
align:
|
|
198
|
+
align: se,
|
|
242
199
|
viewSize: a,
|
|
243
200
|
scrollPos: p,
|
|
244
201
|
fixedSize: u,
|
|
@@ -246,15 +203,15 @@ function calculateScrollTarget({ rowIndex: e, colIndex: t, options: n, direction
|
|
|
246
203
|
query: g,
|
|
247
204
|
getSize: m,
|
|
248
205
|
stickyIndices: w,
|
|
249
|
-
stickyStart:
|
|
250
|
-
stickyEnd:
|
|
206
|
+
stickyStart: E + O,
|
|
207
|
+
stickyEnd: ne + ae
|
|
251
208
|
});
|
|
252
|
-
|
|
209
|
+
le = t.target + ve, fe = t.itemSize, M = t.effectiveAlign;
|
|
253
210
|
}
|
|
254
211
|
if (t != null) {
|
|
255
212
|
let e = r === "both", n = calculateAxisTarget({
|
|
256
213
|
index: t,
|
|
257
|
-
align:
|
|
214
|
+
align: oe,
|
|
258
215
|
viewSize: i,
|
|
259
216
|
scrollPos: f,
|
|
260
217
|
fixedSize: e ? d : u,
|
|
@@ -262,18 +219,18 @@ function calculateScrollTarget({ rowIndex: e, colIndex: t, options: n, direction
|
|
|
262
219
|
query: e ? y : _,
|
|
263
220
|
getSize: e ? v : h,
|
|
264
221
|
stickyIndices: w,
|
|
265
|
-
stickyStart: T +
|
|
266
|
-
stickyEnd:
|
|
222
|
+
stickyStart: T + D,
|
|
223
|
+
stickyEnd: te + k
|
|
267
224
|
});
|
|
268
|
-
|
|
225
|
+
ce = n.target + I, ue = n.itemSize, pe = n.effectiveAlign;
|
|
269
226
|
}
|
|
270
|
-
return
|
|
271
|
-
targetX:
|
|
272
|
-
targetY:
|
|
273
|
-
itemWidth:
|
|
274
|
-
itemHeight:
|
|
275
|
-
effectiveAlignX:
|
|
276
|
-
effectiveAlignY:
|
|
227
|
+
return ce = Math.max(0, Math.min(ce, F)), le = Math.max(0, Math.min(le, ge)), {
|
|
228
|
+
targetX: ce,
|
|
229
|
+
targetY: le,
|
|
230
|
+
itemWidth: ue,
|
|
231
|
+
itemHeight: fe,
|
|
232
|
+
effectiveAlignX: pe,
|
|
233
|
+
effectiveAlignY: M
|
|
277
234
|
};
|
|
278
235
|
}
|
|
279
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 }) {
|
|
@@ -358,6 +315,21 @@ function calculateItemStyle({ item: e, direction: t, itemSize: n, containerTag:
|
|
|
358
315
|
}
|
|
359
316
|
return f;
|
|
360
317
|
}
|
|
318
|
+
function calculateSSROffsets(e, t, n, r, i, a, o, s, c) {
|
|
319
|
+
let l = t.start || 0, u = t.colStart || 0, d = 0, f = e === "horizontal" ? 0 : calculateOffsetAt(l, n, i, o);
|
|
320
|
+
return e === "horizontal" ? d = calculateOffsetAt(u, n, a, s) : e === "both" && (d = calculateOffsetAt(u, r, a, c)), {
|
|
321
|
+
x: d,
|
|
322
|
+
y: f
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
function calculatePrependCount(e, t) {
|
|
326
|
+
if (e.length === 0 || t.length <= e.length) return 0;
|
|
327
|
+
let n = e[0];
|
|
328
|
+
if (n === void 0) return 0;
|
|
329
|
+
let r = t.length - e.length;
|
|
330
|
+
for (let e = 1; e <= r; e++) if (t[e] === n) return e;
|
|
331
|
+
return 0;
|
|
332
|
+
}
|
|
361
333
|
function calculateTotalSize({ direction: e, itemsLength: t, columnCount: n, fixedSize: r, fixedWidth: i, gap: a, columnGap: o, usableWidth: s, usableHeight: c, queryY: l, queryX: u, queryColumn: d }) {
|
|
362
334
|
let f = e === "both", p = e === "horizontal", m = 0, h = 0;
|
|
363
335
|
return f ? (m = calculateAxisSize(n, i, o, d), h = calculateAxisSize(t, r, a, l)) : p ? (m = calculateAxisSize(t, r, o, u), h = c) : (m = s, h = calculateAxisSize(t, r, a, l)), {
|
|
@@ -365,6 +337,250 @@ function calculateTotalSize({ direction: e, itemsLength: t, columnCount: n, fixe
|
|
|
365
337
|
height: f ? Math.max(h, c) : h
|
|
366
338
|
};
|
|
367
339
|
}
|
|
340
|
+
function calculateInertiaStep(e, t, n = 16) {
|
|
341
|
+
let r = {
|
|
342
|
+
x: e.x * t,
|
|
343
|
+
y: e.y * t
|
|
344
|
+
};
|
|
345
|
+
return {
|
|
346
|
+
nextVelocity: r,
|
|
347
|
+
delta: {
|
|
348
|
+
x: r.x * n,
|
|
349
|
+
y: r.y * n
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function calculateInstantaneousVelocity(e, t, n) {
|
|
354
|
+
return n <= 0 ? {
|
|
355
|
+
x: 0,
|
|
356
|
+
y: 0
|
|
357
|
+
} : {
|
|
358
|
+
x: (e.x - t.x) / n,
|
|
359
|
+
y: (e.y - t.y) / n
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
function resolveSnap(e, t, n, r, i, a, o, s, c, l) {
|
|
363
|
+
let u = e;
|
|
364
|
+
if (e === "auto") if (t === "start") u = "end";
|
|
365
|
+
else if (t === "end") u = "start";
|
|
366
|
+
else return null;
|
|
367
|
+
if (u === "start") {
|
|
368
|
+
let e = s(n);
|
|
369
|
+
if (e > a) return null;
|
|
370
|
+
let t = c(n) + e - i;
|
|
371
|
+
return {
|
|
372
|
+
index: Math.min(o - 1, t / e >= .5 ? n : n + 1),
|
|
373
|
+
align: "start"
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
if (u === "end") {
|
|
377
|
+
let e = s(r);
|
|
378
|
+
if (e > a) return null;
|
|
379
|
+
let t = i + a - c(r);
|
|
380
|
+
return {
|
|
381
|
+
index: Math.max(0, t / e >= .5 ? r : r - 1),
|
|
382
|
+
align: "end"
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
if (u === "center") {
|
|
386
|
+
let e = i + a / 2, t = Math.max(0, Math.min(o - 1, l(e)));
|
|
387
|
+
return s(t) > a ? null : {
|
|
388
|
+
index: t,
|
|
389
|
+
align: "center"
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
return null;
|
|
393
|
+
}
|
|
394
|
+
function calculateIndexAt(e, t, n, r) {
|
|
395
|
+
let i = (t || 0) + n;
|
|
396
|
+
return t !== null && i > 0 ? Math.floor(e / i) : r(e);
|
|
397
|
+
}
|
|
398
|
+
var FenwickTree = class {
|
|
399
|
+
tree;
|
|
400
|
+
values;
|
|
401
|
+
constructor(e) {
|
|
402
|
+
this.tree = new Float64Array(e + 1), this.values = new Float64Array(e);
|
|
403
|
+
}
|
|
404
|
+
update(e, t) {
|
|
405
|
+
if (!(e < 0 || e >= this.values.length)) for (this.values[e] = this.values[e] + t, e++; e < this.tree.length;) this.tree[e] = this.tree[e] + t, e += e & -e;
|
|
406
|
+
}
|
|
407
|
+
query(e) {
|
|
408
|
+
let t = 0;
|
|
409
|
+
for (; e > 0;) t += this.tree[e] || 0, e -= e & -e;
|
|
410
|
+
return t;
|
|
411
|
+
}
|
|
412
|
+
set(e, t) {
|
|
413
|
+
e < 0 || e >= this.values.length || (this.values[e] = t);
|
|
414
|
+
}
|
|
415
|
+
get length() {
|
|
416
|
+
return this.values.length;
|
|
417
|
+
}
|
|
418
|
+
get(e) {
|
|
419
|
+
return this.values[e] || 0;
|
|
420
|
+
}
|
|
421
|
+
getValues() {
|
|
422
|
+
return this.values;
|
|
423
|
+
}
|
|
424
|
+
findLowerBound(e) {
|
|
425
|
+
let t = 0, n = this.tree.length, r = 1 << Math.floor(Math.log2(n - 1));
|
|
426
|
+
for (; r > 0;) {
|
|
427
|
+
let i = t + r;
|
|
428
|
+
if (i < n) {
|
|
429
|
+
let n = this.tree[i] || 0;
|
|
430
|
+
n <= e && (t = i, e -= n);
|
|
431
|
+
}
|
|
432
|
+
r >>= 1;
|
|
433
|
+
}
|
|
434
|
+
return t;
|
|
435
|
+
}
|
|
436
|
+
rebuild() {
|
|
437
|
+
this.tree.fill(0);
|
|
438
|
+
for (let e = 0; e < this.values.length; e++) this.tree[e + 1] = this.values[e] || 0;
|
|
439
|
+
for (let e = 1; e < this.tree.length; e++) {
|
|
440
|
+
let t = e + (e & -e);
|
|
441
|
+
t < this.tree.length && (this.tree[t] = this.tree[t] + this.tree[e]);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
resize(e) {
|
|
445
|
+
if (e === this.values.length) return;
|
|
446
|
+
let t = new Float64Array(e);
|
|
447
|
+
t.set(this.values.subarray(0, Math.min(e, this.values.length))), this.values = t, this.tree = new Float64Array(e + 1), this.rebuild();
|
|
448
|
+
}
|
|
449
|
+
shift(e) {
|
|
450
|
+
if (e === 0) return;
|
|
451
|
+
let t = this.values.length, n = new Float64Array(t);
|
|
452
|
+
e > 0 ? n.set(this.values.subarray(0, Math.min(t - e, this.values.length)), e) : n.set(this.values.subarray(-e)), this.values = n, this.rebuild();
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
function useVirtualScrollSizes(e) {
|
|
456
|
+
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
|
+
if (l.value, typeof t == "number" && t > 0) return t;
|
|
458
|
+
if (o && Array.isArray(t) && t.length > 0) {
|
|
459
|
+
let n = t[e % t.length];
|
|
460
|
+
return n != null && n > 0 ? n : r;
|
|
461
|
+
}
|
|
462
|
+
if (typeof t == "function") {
|
|
463
|
+
let i = n.value.props.items[e];
|
|
464
|
+
return o && n.value.direction !== "both" || !o ? i === void 0 ? r : t(i, e) : t(e);
|
|
465
|
+
}
|
|
466
|
+
let s = a.get(e);
|
|
467
|
+
return s > 0 ? s - i : r;
|
|
468
|
+
}, m = (e, t) => {
|
|
469
|
+
if (r.resize(e), i.resize(e), a.resize(t), s.value.length !== e) {
|
|
470
|
+
let t = new Uint8Array(e);
|
|
471
|
+
t.set(s.value.subarray(0, Math.min(e, s.value.length))), s.value = t;
|
|
472
|
+
}
|
|
473
|
+
if (c.value.length !== e) {
|
|
474
|
+
let t = new Uint8Array(e);
|
|
475
|
+
t.set(c.value.subarray(0, Math.min(e, c.value.length))), c.value = t;
|
|
476
|
+
}
|
|
477
|
+
if (o.value.length !== t) {
|
|
478
|
+
let e = new Uint8Array(t);
|
|
479
|
+
e.set(o.value.subarray(0, Math.min(t, o.value.length))), o.value = e;
|
|
480
|
+
}
|
|
481
|
+
}, h = () => {
|
|
482
|
+
let e = n.value.props, t = e.items.length, l = e.columnCount || 0, u = e.gap || 0, d = e.columnGap || 0, p = e.columnWidth, m = !1, h = !1;
|
|
483
|
+
if (l > 0) for (let t = 0; t < l; t++) {
|
|
484
|
+
let r = a.get(t), i = o.value[t] === 1;
|
|
485
|
+
if (!n.value.isDynamicColumnWidth || !i && r === 0) {
|
|
486
|
+
let i = 0;
|
|
487
|
+
i = typeof p == "number" && p > 0 ? p : Array.isArray(p) && p.length > 0 ? p[t % p.length] || e.defaultColumnWidth || 100 : typeof p == "function" ? p(t) : e.defaultColumnWidth || 100;
|
|
488
|
+
let s = i + d;
|
|
489
|
+
Math.abs(r - s) > .5 ? (a.set(t, s), o.value[t] = n.value.isDynamicColumnWidth ? 0 : 1, m = !0) : n.value.isDynamicColumnWidth || (o.value[t] = 1);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
for (let a = 0; a < t; a++) {
|
|
493
|
+
let t = e.items[a], o = r.get(a), l = i.get(a), p = s.value[a] === 1, m = c.value[a] === 1;
|
|
494
|
+
if (n.value.direction === "horizontal") {
|
|
495
|
+
if (!n.value.isDynamicItemSize || !p && o === 0) {
|
|
496
|
+
let e = f(t, a) + d;
|
|
497
|
+
Math.abs(o - e) > .5 ? (r.set(a, e), s.value[a] = n.value.isDynamicItemSize ? 0 : 1, h = !0) : n.value.isDynamicItemSize || (s.value[a] = 1);
|
|
498
|
+
}
|
|
499
|
+
} else o !== 0 && (r.set(a, 0), s.value[a] = 0, h = !0);
|
|
500
|
+
if (n.value.direction !== "horizontal") {
|
|
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);
|
|
506
|
+
}
|
|
507
|
+
m && a.rebuild(), h && (r.rebuild(), i.rebuild());
|
|
508
|
+
}, g = (e) => {
|
|
509
|
+
let t = n.value.props, a = t.items, o = a.length;
|
|
510
|
+
m(o, t.columnCount || 0);
|
|
511
|
+
let p = t.restoreScrollOnPrepend ? calculatePrependCount(d, a) : 0;
|
|
512
|
+
if (p > 0) {
|
|
513
|
+
r.shift(p), i.shift(p);
|
|
514
|
+
let l = new Uint8Array(o), u = new Uint8Array(o);
|
|
515
|
+
l.set(s.value.subarray(0, Math.min(o - p, s.value.length)), p), u.set(c.value.subarray(0, Math.min(o - p, c.value.length)), p), s.value = l, c.value = u;
|
|
516
|
+
let d = t.gap || 0, m = t.columnGap || 0, h = 0, g = 0;
|
|
517
|
+
for (let e = 0; e < p; e++) {
|
|
518
|
+
let t = f(a[e], e);
|
|
519
|
+
n.value.direction === "horizontal" ? h += t + m : g += t + d;
|
|
520
|
+
}
|
|
521
|
+
(h > 0 || g > 0) && e && e(h, g);
|
|
522
|
+
}
|
|
523
|
+
h(), d = [...a], u.value = !0, l.value++;
|
|
524
|
+
};
|
|
525
|
+
return {
|
|
526
|
+
itemSizesX: r,
|
|
527
|
+
itemSizesY: i,
|
|
528
|
+
columnSizes: a,
|
|
529
|
+
measuredItemsX: s,
|
|
530
|
+
measuredItemsY: c,
|
|
531
|
+
measuredColumns: o,
|
|
532
|
+
treeUpdateFlag: l,
|
|
533
|
+
sizesInitialized: u,
|
|
534
|
+
getItemBaseSize: f,
|
|
535
|
+
getSizeAt: p,
|
|
536
|
+
initializeSizes: g,
|
|
537
|
+
updateItemSizes: (e, t, u, d, f, p) => {
|
|
538
|
+
let m = !1, h = 0, g = 0, _ = n.value.props, v = _.gap || 0, y = _.columnGap || 0, b = t(n.value.direction === "horizontal" ? d : f), x = u(d), S = n.value.direction === "horizontal", C = n.value.direction === "both", w = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Set(), E = (e, t) => {
|
|
539
|
+
if (e >= 0 && e < (_.columnCount || 0) && !T.has(e)) {
|
|
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
|
+
}
|
|
547
|
+
};
|
|
548
|
+
for (let { index: t, inlineSize: a, blockSize: o, element: l } of e) {
|
|
549
|
+
if (a <= 0 && o <= 0) continue;
|
|
550
|
+
let e = n.value.isDynamicItemSize || typeof _.itemSize == "function";
|
|
551
|
+
if (t >= 0 && !w.has(t) && e && o > 0) {
|
|
552
|
+
if (w.add(t), S && a > 0) {
|
|
553
|
+
let e = r.get(t), n = a + y;
|
|
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)) {
|
|
569
|
+
let e = l.dataset.colIndex;
|
|
570
|
+
if (e != null) E(Number.parseInt(e, 10), a);
|
|
571
|
+
else {
|
|
572
|
+
let e = Array.from(l.querySelectorAll("[data-col-index]"));
|
|
573
|
+
for (let t of e) E(Number.parseInt(t.dataset.colIndex, 10), t.getBoundingClientRect().width);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
m && (l.value++, (h !== 0 || g !== 0) && p(h, g));
|
|
578
|
+
},
|
|
579
|
+
refresh: (e) => {
|
|
580
|
+
r.resize(0), i.resize(0), a.resize(0), o.value.fill(0), s.value.fill(0), c.value.fill(0), g(e);
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
}
|
|
368
584
|
function useVirtualScroll(e) {
|
|
369
585
|
let n = computed(() => toValue(e)), r = ref(0), i = ref(0), a = ref(!1), o = ref(!1), c = ref(!1), l = ref(!1), d = ref(!1), f = ref(0), p = ref(0), g = reactive({
|
|
370
586
|
x: 0,
|
|
@@ -372,148 +588,89 @@ function useVirtualScroll(e) {
|
|
|
372
588
|
}), y = reactive({
|
|
373
589
|
x: 0,
|
|
374
590
|
y: 0
|
|
375
|
-
}), b, x = ref(!1), S = ref(0), C = ref(0),
|
|
591
|
+
}), b, x = ref(!1), S = ref(0), C = ref(0), w = 0, E = 0, te = null, ne = null, ie = null, D = () => {
|
|
376
592
|
if (typeof window > "u") return;
|
|
377
593
|
let e = n.value.container || n.value.hostRef || window, t = isElement(e) ? e : document.documentElement;
|
|
378
|
-
|
|
379
|
-
let r =
|
|
594
|
+
ie = window.getComputedStyle(t);
|
|
595
|
+
let r = ie.direction === "rtl";
|
|
380
596
|
d.value !== r && (d.value = r);
|
|
381
|
-
},
|
|
597
|
+
}, O = computed(() => [
|
|
382
598
|
"vertical",
|
|
383
599
|
"horizontal",
|
|
384
600
|
"both"
|
|
385
|
-
].includes(n.value.direction) ? n.value.direction : "vertical"),
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
l = Math.max(0, n * (z.value + o) - (n > 0 ? o : 0));
|
|
412
|
-
} else {
|
|
413
|
-
let n = D.query(t) - D.query(e);
|
|
414
|
-
l = Math.max(0, n - (t > e ? o : 0));
|
|
415
|
-
}
|
|
416
|
-
return {
|
|
417
|
-
width: Math.max(c, ke.value),
|
|
418
|
-
height: Math.max(l, Ae.value)
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
return calculateTotalSize({
|
|
422
|
-
direction: L.value,
|
|
423
|
-
itemsLength: n.value.items.length,
|
|
424
|
-
columnCount: n.value.columnCount || 0,
|
|
425
|
-
fixedSize: z.value,
|
|
426
|
-
fixedWidth: B.value,
|
|
427
|
-
gap: n.value.gap || 0,
|
|
428
|
-
columnGap: n.value.columnGap || 0,
|
|
429
|
-
usableWidth: ke.value,
|
|
430
|
-
usableHeight: Ae.value,
|
|
431
|
-
queryY: (e) => D.query(e),
|
|
432
|
-
queryX: (e) => E.query(e),
|
|
433
|
-
queryColumn: (e) => O.query(e)
|
|
434
|
-
});
|
|
435
|
-
}), Me = computed(() => isWindowLike(n.value.container)), Ne = computed(() => je.value.width + Se.value + Ce.value), Pe = computed(() => je.value.height + we.value + Te.value), q = computed(() => W.value + H.value + Ee.value + G.value + Ne.value), J = computed(() => K.value + U.value + De.value + Oe.value + Pe.value), Y = reactive({
|
|
436
|
-
x: computed(() => Math.max(0, g.x - (W.value + H.value))),
|
|
437
|
-
y: computed(() => Math.max(0, g.y - (K.value + U.value)))
|
|
438
|
-
}), Fe = computed(() => Me.value ? q.value : Math.min(q.value, BROWSER_MAX_SIZE)), Ie = computed(() => Me.value ? J.value : Math.min(J.value, BROWSER_MAX_SIZE)), Le = computed(() => Me.value ? Ne.value : Math.max(0, Fe.value - (W.value + H.value + Ee.value + G.value))), Re = computed(() => Me.value ? Pe.value : Math.max(0, Ie.value - (K.value + U.value + De.value + Oe.value))), X = computed(() => {
|
|
439
|
-
if (Me.value || q.value <= 1e7) return 1;
|
|
440
|
-
let e = q.value - f.value, t = Fe.value - f.value;
|
|
441
|
-
return t > 0 ? e / t : 1;
|
|
442
|
-
}), Z = computed(() => {
|
|
443
|
-
if (Me.value || J.value <= 1e7) return 1;
|
|
444
|
-
let e = J.value - p.value, t = Ie.value - p.value;
|
|
445
|
-
return t > 0 ? e / t : 1;
|
|
446
|
-
}), ze = computed(() => {
|
|
447
|
-
if (L.value === "vertical") return 0;
|
|
448
|
-
let e = W.value + H.value + Se.value;
|
|
601
|
+
].includes(n.value.direction) ? n.value.direction : "vertical"), k = computed(() => n.value.itemSize === void 0 || n.value.itemSize === null || n.value.itemSize === 0), ae = computed(() => n.value.columnWidth === void 0 || n.value.columnWidth === null || n.value.columnWidth === 0), A = computed(() => typeof n.value.itemSize == "number" && n.value.itemSize > 0 ? n.value.itemSize : null), j = computed(() => typeof n.value.columnWidth == "number" && n.value.columnWidth > 0 ? n.value.columnWidth : null), oe = computed(() => n.value.defaultItemSize || A.value || 40), { itemSizesX: M, itemSizesY: N, columnSizes: P, measuredColumns: he, measuredItemsY: _e, treeUpdateFlag: I, getSizeAt: ve, initializeSizes: Ee, updateItemSizes: Oe, refresh: ke } = useVirtualScrollSizes(computed(() => ({
|
|
602
|
+
props: n.value,
|
|
603
|
+
isDynamicItemSize: k.value,
|
|
604
|
+
isDynamicColumnWidth: ae.value,
|
|
605
|
+
defaultSize: oe.value,
|
|
606
|
+
fixedItemSize: A.value,
|
|
607
|
+
direction: O.value
|
|
608
|
+
}))), z = ref(null), Me = computed(() => [...n.value.stickyIndices || []].sort((e, t) => e - t)), Pe = computed(() => new Set(Me.value)), Fe = computed(() => getPaddingX(n.value.scrollPaddingStart, n.value.direction)), Ie = computed(() => getPaddingX(n.value.scrollPaddingEnd, n.value.direction)), Le = computed(() => getPaddingY(n.value.scrollPaddingStart, n.value.direction)), Re = computed(() => getPaddingY(n.value.scrollPaddingEnd, n.value.direction)), B = computed(() => getPaddingX(n.value.stickyStart, n.value.direction)), ze = computed(() => getPaddingX(n.value.stickyEnd, n.value.direction)), V = computed(() => getPaddingY(n.value.stickyStart, n.value.direction)), Be = computed(() => getPaddingY(n.value.stickyEnd, n.value.direction)), H = computed(() => getPaddingX(n.value.flowPaddingStart, n.value.direction)), Ve = computed(() => getPaddingX(n.value.flowPaddingEnd, n.value.direction)), U = computed(() => getPaddingY(n.value.flowPaddingStart, n.value.direction)), He = computed(() => getPaddingY(n.value.flowPaddingEnd, n.value.direction)), Ue = computed(() => f.value - (O.value === "vertical" ? 0 : B.value + ze.value)), We = computed(() => p.value - (O.value === "horizontal" ? 0 : V.value + Be.value)), Ge = computed(() => (I.value, calculateTotalSize({
|
|
609
|
+
direction: O.value,
|
|
610
|
+
itemsLength: n.value.items.length,
|
|
611
|
+
columnCount: n.value.columnCount || 0,
|
|
612
|
+
fixedSize: A.value,
|
|
613
|
+
fixedWidth: j.value,
|
|
614
|
+
gap: n.value.gap || 0,
|
|
615
|
+
columnGap: n.value.columnGap || 0,
|
|
616
|
+
usableWidth: Ue.value,
|
|
617
|
+
usableHeight: We.value,
|
|
618
|
+
queryY: (e) => N.query(e),
|
|
619
|
+
queryX: (e) => M.query(e),
|
|
620
|
+
queryColumn: (e) => P.query(e)
|
|
621
|
+
}))), Ke = computed(() => isWindowLike(n.value.container)), qe = computed(() => Ge.value.width + Fe.value + Ie.value), Je = computed(() => Ge.value.height + Le.value + Re.value), W = computed(() => H.value + B.value + ze.value + Ve.value + qe.value), G = computed(() => U.value + V.value + Be.value + He.value + Je.value), K = reactive({
|
|
622
|
+
x: computed(() => Math.max(0, g.x - (H.value + B.value))),
|
|
623
|
+
y: computed(() => Math.max(0, g.y - (U.value + V.value)))
|
|
624
|
+
}), Ye = computed(() => calculateRenderedSize(Ke.value, W.value)), Xe = computed(() => calculateRenderedSize(Ke.value, G.value)), Ze = computed(() => calculateRenderedSize(Ke.value, qe.value)), Qe = computed(() => calculateRenderedSize(Ke.value, Je.value)), q = computed(() => calculateScale(Ke.value, W.value, f.value)), J = computed(() => calculateScale(Ke.value, G.value, p.value)), Y = computed(() => {
|
|
625
|
+
if (O.value === "vertical") return 0;
|
|
626
|
+
let e = H.value + B.value + Fe.value;
|
|
449
627
|
return S.value - e;
|
|
450
|
-
}),
|
|
451
|
-
if (
|
|
452
|
-
let e =
|
|
628
|
+
}), X = computed(() => {
|
|
629
|
+
if (O.value === "horizontal") return 0;
|
|
630
|
+
let e = U.value + V.value + Le.value;
|
|
453
631
|
return C.value - e;
|
|
454
|
-
}),
|
|
455
|
-
|
|
456
|
-
let t = n.value.columnGap || 0, r = n.value.columnWidth;
|
|
457
|
-
if (typeof r == "number" && r > 0) return r;
|
|
458
|
-
if (Array.isArray(r) && r.length > 0) {
|
|
459
|
-
let t = r[e % r.length];
|
|
460
|
-
return t != null && t > 0 ? t : n.value.defaultColumnWidth || 100;
|
|
461
|
-
}
|
|
462
|
-
if (typeof r == "function") return r(e);
|
|
463
|
-
let i = O.get(e);
|
|
464
|
-
return i > 0 ? i - t : n.value.defaultColumnWidth || 100;
|
|
465
|
-
}, He = (e) => {
|
|
466
|
-
if (k.value, L.value === "horizontal") return Ae.value;
|
|
467
|
-
let t = n.value.gap || 0, r = n.value.itemSize;
|
|
468
|
-
if (typeof r == "number" && r > 0) return r;
|
|
469
|
-
if (typeof r == "function") {
|
|
470
|
-
let t = n.value.items[e];
|
|
471
|
-
return t === void 0 ? n.value.defaultItemSize || 40 : r(t, e);
|
|
472
|
-
}
|
|
473
|
-
let i = D.get(e);
|
|
474
|
-
return i > 0 ? i - t : n.value.defaultItemSize || 40;
|
|
475
|
-
};
|
|
476
|
-
function Ue(e, t, a) {
|
|
632
|
+
}), Z = (e) => O.value === "both" ? ve(e, n.value.columnWidth, n.value.defaultColumnWidth || 100, n.value.columnGap || 0, P, !0) : ve(e, n.value.itemSize, n.value.defaultItemSize || 40, n.value.columnGap || 0, M, !0), $e = (e) => O.value === "horizontal" ? We.value : ve(e, n.value.itemSize, n.value.defaultItemSize || 40, n.value.gap || 0, N, !1);
|
|
633
|
+
function et(e, t, a) {
|
|
477
634
|
let o = typeof a == "object" && a && "isCorrection" in a ? a.isCorrection : !1, s = n.value.container || window, { targetX: c, targetY: l, effectiveAlignX: u, effectiveAlignY: m } = calculateScrollTarget({
|
|
478
635
|
rowIndex: e,
|
|
479
636
|
colIndex: t,
|
|
480
637
|
options: a,
|
|
481
|
-
direction:
|
|
638
|
+
direction: O.value,
|
|
482
639
|
viewportWidth: f.value,
|
|
483
640
|
viewportHeight: p.value,
|
|
484
|
-
totalWidth:
|
|
485
|
-
totalHeight:
|
|
641
|
+
totalWidth: W.value,
|
|
642
|
+
totalHeight: G.value,
|
|
486
643
|
gap: n.value.gap || 0,
|
|
487
644
|
columnGap: n.value.columnGap || 0,
|
|
488
|
-
fixedSize:
|
|
489
|
-
fixedWidth:
|
|
490
|
-
relativeScrollX:
|
|
491
|
-
relativeScrollY:
|
|
492
|
-
getItemSizeY: (e) =>
|
|
493
|
-
getItemSizeX: (e) =>
|
|
494
|
-
getItemQueryY: (e) =>
|
|
495
|
-
getItemQueryX: (e) =>
|
|
496
|
-
getColumnSize: (e) =>
|
|
497
|
-
getColumnQuery: (e) =>
|
|
498
|
-
scaleX:
|
|
499
|
-
scaleY:
|
|
500
|
-
hostOffsetX:
|
|
501
|
-
hostOffsetY:
|
|
502
|
-
stickyIndices:
|
|
503
|
-
stickyStartX:
|
|
504
|
-
stickyStartY:
|
|
505
|
-
stickyEndX:
|
|
506
|
-
stickyEndY:
|
|
507
|
-
flowPaddingStartX:
|
|
508
|
-
flowPaddingStartY:
|
|
509
|
-
paddingStartX:
|
|
510
|
-
paddingStartY:
|
|
511
|
-
paddingEndX:
|
|
512
|
-
paddingEndY:
|
|
645
|
+
fixedSize: A.value,
|
|
646
|
+
fixedWidth: j.value,
|
|
647
|
+
relativeScrollX: Y.value,
|
|
648
|
+
relativeScrollY: X.value,
|
|
649
|
+
getItemSizeY: (e) => N.get(e),
|
|
650
|
+
getItemSizeX: (e) => M.get(e),
|
|
651
|
+
getItemQueryY: (e) => N.query(e),
|
|
652
|
+
getItemQueryX: (e) => M.query(e),
|
|
653
|
+
getColumnSize: (e) => P.get(e),
|
|
654
|
+
getColumnQuery: (e) => P.query(e),
|
|
655
|
+
scaleX: q.value,
|
|
656
|
+
scaleY: J.value,
|
|
657
|
+
hostOffsetX: K.x,
|
|
658
|
+
hostOffsetY: K.y,
|
|
659
|
+
stickyIndices: Me.value,
|
|
660
|
+
stickyStartX: B.value,
|
|
661
|
+
stickyStartY: V.value,
|
|
662
|
+
stickyEndX: ze.value,
|
|
663
|
+
stickyEndY: Be.value,
|
|
664
|
+
flowPaddingStartX: H.value,
|
|
665
|
+
flowPaddingStartY: U.value,
|
|
666
|
+
paddingStartX: Fe.value,
|
|
667
|
+
paddingStartY: Le.value,
|
|
668
|
+
paddingEndX: Ie.value,
|
|
669
|
+
paddingEndY: Re.value
|
|
513
670
|
});
|
|
514
671
|
if (!o) {
|
|
515
672
|
let n = isScrollToIndexOptions(a) ? a.behavior : void 0;
|
|
516
|
-
|
|
673
|
+
z.value = {
|
|
517
674
|
rowIndex: e,
|
|
518
675
|
colIndex: t,
|
|
519
676
|
options: {
|
|
@@ -525,97 +682,31 @@ function useVirtualScroll(e) {
|
|
|
525
682
|
}
|
|
526
683
|
};
|
|
527
684
|
}
|
|
528
|
-
let h = virtualToDisplay(c,
|
|
685
|
+
let h = virtualToDisplay(c, K.x, q.value), g = virtualToDisplay(l, K.y, J.value), _ = d.value ? -h : h, v = g, y;
|
|
529
686
|
isScrollToIndexOptions(a) && (y = a.behavior);
|
|
530
687
|
let b = o ? "auto" : y || "smooth";
|
|
531
688
|
x.value = !0;
|
|
532
689
|
let w = { behavior: b };
|
|
533
|
-
if (t != null && (w.left = d.value ? _ : Math.max(0, _)), e != null && (w.top = Math.max(0, v)), scrollTo(s, w), (b === "auto" || b === void 0) && (t != null && (r.value = d.value ? _ : Math.max(0, _), S.value = c), e != null && (i.value = Math.max(0, v), C.value = l),
|
|
534
|
-
let e =
|
|
535
|
-
isScrollToIndexOptions(e)
|
|
536
|
-
align: e,
|
|
537
|
-
behavior: "auto"
|
|
538
|
-
};
|
|
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), z.value)) {
|
|
691
|
+
let e = z.value.options;
|
|
692
|
+
isScrollToIndexOptions(e) && (e.behavior = "auto");
|
|
539
693
|
}
|
|
540
694
|
}
|
|
541
|
-
let
|
|
695
|
+
let tt = (e, t, a) => {
|
|
542
696
|
let o = n.value.container || window;
|
|
543
|
-
x.value = !0,
|
|
544
|
-
let s = e == null ? null : Math.max(0, Math.min(e,
|
|
697
|
+
x.value = !0, z.value = null;
|
|
698
|
+
let s = e == null ? null : Math.max(0, Math.min(e, W.value - f.value)), c = t == null ? null : Math.max(0, Math.min(t, G.value - p.value));
|
|
545
699
|
s !== null && (S.value = s), c !== null && (C.value = c);
|
|
546
|
-
let l = typeof window < "u" && o === window ? window.scrollX : o.scrollLeft, u = typeof window < "u" && o === window ? window.scrollY : o.scrollTop, m = s === null ? null : virtualToDisplay(s,
|
|
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, K.x, q.value), h = c === null ? null : virtualToDisplay(c, K.y, J.value), g = m === null ? l : d.value ? -m : m, _ = h === null ? u : h, v = { behavior: a?.behavior || "auto" };
|
|
547
701
|
e != null && (v.left = g), t != null && (v.top = _), scrollTo(o, v), (a?.behavior === "auto" || a?.behavior === void 0) && (e != null && (r.value = g), t != null && (i.value = _));
|
|
548
|
-
},
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
if (N.length !== e) {
|
|
554
|
-
let t = new Uint8Array(e);
|
|
555
|
-
t.set(N.subarray(0, Math.min(e, N.length))), N = t;
|
|
556
|
-
}
|
|
557
|
-
if (A.length !== t) {
|
|
558
|
-
let e = new Uint8Array(t);
|
|
559
|
-
e.set(A.subarray(0, Math.min(t, A.length))), A = e;
|
|
560
|
-
}
|
|
561
|
-
}, Q = () => {
|
|
562
|
-
let e = n.value.items.length, t = n.value.columnCount || 0, r = n.value.gap || 0, i = n.value.columnGap || 0, a = n.value.columnWidth, o = !1, s = !1;
|
|
563
|
-
if (t > 0) for (let e = 0; e < t; e++) {
|
|
564
|
-
let t = O.get(e), r = A[e] === 1;
|
|
565
|
-
if (!de.value || !r && t === 0) {
|
|
566
|
-
let r = 0;
|
|
567
|
-
r = typeof a == "number" && a > 0 ? a : Array.isArray(a) && a.length > 0 ? a[e % a.length] || n.value.defaultColumnWidth || 100 : typeof a == "function" ? a(e) : n.value.defaultColumnWidth || 100;
|
|
568
|
-
let s = r + i;
|
|
569
|
-
Math.abs(t - s) > .5 ? (O.set(e, s), A[e] = de.value ? 0 : 1, o = !0) : de.value || (A[e] = 1);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
for (let t = 0; t < e; t++) {
|
|
573
|
-
let e = n.value.items[t], a = E.get(t), o = D.get(t), c = j[t] === 1, l = N[t] === 1;
|
|
574
|
-
if (L.value === "horizontal") {
|
|
575
|
-
if (!R.value || !c && a === 0) {
|
|
576
|
-
let r = (typeof n.value.itemSize == "function" ? n.value.itemSize(e, t) : ve.value) + i;
|
|
577
|
-
Math.abs(a - r) > .5 ? (E.set(t, r), j[t] = R.value ? 0 : 1, s = !0) : R.value || (j[t] = 1);
|
|
578
|
-
}
|
|
579
|
-
} else a !== 0 && (E.set(t, 0), j[t] = 0, s = !0);
|
|
580
|
-
if (L.value !== "horizontal") {
|
|
581
|
-
if (!R.value || !l && o === 0) {
|
|
582
|
-
let i = (typeof n.value.itemSize == "function" ? n.value.itemSize(e, t) : ve.value) + r;
|
|
583
|
-
Math.abs(o - i) > .5 ? (D.set(t, i), N[t] = R.value ? 0 : 1, s = !0) : R.value || (N[t] = 1);
|
|
584
|
-
}
|
|
585
|
-
} else o !== 0 && (D.set(t, 0), N[t] = 0, s = !0);
|
|
586
|
-
}
|
|
587
|
-
o && O.rebuild(), s && (E.rebuild(), D.rebuild());
|
|
588
|
-
}, Ke = () => {
|
|
589
|
-
let e = n.value.items, t = e.length;
|
|
590
|
-
Ge(t, n.value.columnCount || 0);
|
|
591
|
-
let r = 0;
|
|
592
|
-
if (n.value.restoreScrollOnPrepend && I.length > 0 && t > I.length) {
|
|
593
|
-
let n = I[0];
|
|
594
|
-
if (n !== void 0) {
|
|
595
|
-
for (let i = 1; i <= t - I.length; i++) if (e[i] === n) {
|
|
596
|
-
r = i;
|
|
597
|
-
break;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
if (r > 0) {
|
|
602
|
-
E.shift(r), D.shift(r), P.value && P.value.rowIndex !== null && P.value.rowIndex !== void 0 && (P.value.rowIndex += r);
|
|
603
|
-
let i = new Uint8Array(t), a = new Uint8Array(t);
|
|
604
|
-
i.set(j.subarray(0, Math.min(t - r, j.length)), r), a.set(N.subarray(0, Math.min(t - r, N.length)), r), j = i, N = a;
|
|
605
|
-
let o = n.value.gap || 0, s = n.value.columnGap || 0, c = 0, l = 0;
|
|
606
|
-
for (let t = 0; t < r; t++) {
|
|
607
|
-
let r = typeof n.value.itemSize == "function" ? n.value.itemSize(e[t], t) : ve.value;
|
|
608
|
-
L.value === "horizontal" ? c += r + s : l += r + o;
|
|
609
|
-
}
|
|
610
|
-
(c > 0 || l > 0) && nextTick(() => {
|
|
611
|
-
We(c > 0 ? ze.value + c : null, l > 0 ? Be.value + l : null, {
|
|
612
|
-
behavior: "auto",
|
|
613
|
-
isCorrection: !0
|
|
614
|
-
});
|
|
702
|
+
}, nt = (e, t) => {
|
|
703
|
+
nextTick(() => {
|
|
704
|
+
tt(e > 0 ? Y.value + e : null, t > 0 ? X.value + t : null, {
|
|
705
|
+
behavior: "auto",
|
|
706
|
+
isCorrection: !0
|
|
615
707
|
});
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
}, qe = () => {
|
|
708
|
+
});
|
|
709
|
+
}, rt = () => Ee(nt), Q = () => {
|
|
619
710
|
if (typeof window > "u") return;
|
|
620
711
|
let e = n.value.container || window, t = (t) => {
|
|
621
712
|
let n = t.getBoundingClientRect();
|
|
@@ -659,61 +750,56 @@ function useVirtualScroll(e) {
|
|
|
659
750
|
() => n.value.columnGap,
|
|
660
751
|
() => n.value.defaultItemSize,
|
|
661
752
|
() => n.value.defaultColumnWidth
|
|
662
|
-
],
|
|
663
|
-
|
|
753
|
+
], rt, { immediate: !0 }), watch(() => [n.value.container, n.value.hostElement], () => {
|
|
754
|
+
Q();
|
|
664
755
|
}), watch(d, (e, t) => {
|
|
665
756
|
if (t === void 0 || e === t || !l.value) return;
|
|
666
|
-
if (
|
|
667
|
-
|
|
757
|
+
if (O.value === "vertical") {
|
|
758
|
+
Q();
|
|
668
759
|
return;
|
|
669
760
|
}
|
|
670
|
-
let n = displayToVirtual(t ? Math.abs(r.value) : r.value, g.x,
|
|
671
|
-
|
|
672
|
-
}, { flush: "sync" }), watch([
|
|
673
|
-
!l.value || a.value || x.value ||
|
|
761
|
+
let n = displayToVirtual(t ? Math.abs(r.value) : r.value, g.x, q.value);
|
|
762
|
+
Q(), tt(n, null, { behavior: "auto" });
|
|
763
|
+
}, { flush: "sync" }), watch([q, J], () => {
|
|
764
|
+
!l.value || a.value || x.value || tt(S.value, C.value, { behavior: "auto" });
|
|
674
765
|
}), watch([() => n.value.items.length, () => n.value.columnCount], ([e, t], [n, r]) => {
|
|
675
766
|
nextTick(() => {
|
|
676
|
-
let i = Math.max(0,
|
|
677
|
-
S.value > i || C.value > a ?
|
|
767
|
+
let i = Math.max(0, W.value - f.value), a = Math.max(0, G.value - p.value);
|
|
768
|
+
S.value > i || C.value > a ? tt(Math.min(S.value, i), Math.min(C.value, a), { behavior: "auto" }) : (e !== n && J.value !== 1 || t !== r && q.value !== 1) && tt(S.value, C.value, { behavior: "auto" }), Q();
|
|
678
769
|
});
|
|
679
770
|
});
|
|
680
|
-
let
|
|
681
|
-
let t =
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
}
|
|
686
|
-
let a = (i || 0) + t;
|
|
687
|
-
return i !== null && a > 0 ? Math.floor(e / a) : D.findLowerBound(e);
|
|
688
|
-
}, Ye = (e) => L.value === "both" ? O.findLowerBound(e) : L.value === "horizontal" ? Je(e) : 0, Xe = computed(() => {
|
|
689
|
-
if (k.value, (!o.value || c.value) && n.value.ssrRange) return {
|
|
771
|
+
let it = (e) => {
|
|
772
|
+
let t = O.value === "horizontal";
|
|
773
|
+
return calculateIndexAt(e, A.value, t ? n.value.columnGap || 0 : n.value.gap || 0, (e) => t ? M.findLowerBound(e) : N.findLowerBound(e));
|
|
774
|
+
}, at = (e) => O.value === "both" ? calculateIndexAt(e, j.value, n.value.columnGap || 0, (e) => P.findLowerBound(e)) : O.value === "horizontal" ? it(e) : 0, ot = computed(() => {
|
|
775
|
+
if (I.value, (!o.value || c.value) && n.value.ssrRange) return {
|
|
690
776
|
start: n.value.ssrRange.start,
|
|
691
777
|
end: n.value.ssrRange.end
|
|
692
778
|
};
|
|
693
779
|
let e = n.value.ssrRange && !a.value ? 0 : n.value.bufferBefore ?? 5, t = n.value.bufferAfter ?? 5;
|
|
694
780
|
return calculateRange({
|
|
695
|
-
direction:
|
|
696
|
-
relativeScrollX:
|
|
697
|
-
relativeScrollY:
|
|
698
|
-
usableWidth:
|
|
699
|
-
usableHeight:
|
|
781
|
+
direction: O.value,
|
|
782
|
+
relativeScrollX: Y.value,
|
|
783
|
+
relativeScrollY: X.value,
|
|
784
|
+
usableWidth: Ue.value,
|
|
785
|
+
usableHeight: We.value,
|
|
700
786
|
itemsLength: n.value.items.length,
|
|
701
787
|
bufferBefore: e,
|
|
702
788
|
bufferAfter: t,
|
|
703
789
|
gap: n.value.gap || 0,
|
|
704
790
|
columnGap: n.value.columnGap || 0,
|
|
705
|
-
fixedSize:
|
|
706
|
-
findLowerBoundY: (e) =>
|
|
707
|
-
findLowerBoundX: (e) =>
|
|
708
|
-
queryY: (e) =>
|
|
709
|
-
queryX: (e) =>
|
|
791
|
+
fixedSize: A.value,
|
|
792
|
+
findLowerBoundY: (e) => N.findLowerBound(e),
|
|
793
|
+
findLowerBoundX: (e) => M.findLowerBound(e),
|
|
794
|
+
queryY: (e) => N.query(e),
|
|
795
|
+
queryX: (e) => M.query(e)
|
|
710
796
|
});
|
|
711
|
-
}),
|
|
712
|
-
|
|
713
|
-
let e =
|
|
714
|
-
return
|
|
715
|
-
}),
|
|
716
|
-
|
|
797
|
+
}), st = computed(() => {
|
|
798
|
+
I.value;
|
|
799
|
+
let e = Y.value + B.value, t = X.value + V.value;
|
|
800
|
+
return it(O.value === "horizontal" ? e : t);
|
|
801
|
+
}), ct = computed(() => {
|
|
802
|
+
I.value;
|
|
717
803
|
let e = n.value.columnCount || 0;
|
|
718
804
|
if (!e) return {
|
|
719
805
|
start: 0,
|
|
@@ -722,98 +808,104 @@ function useVirtualScroll(e) {
|
|
|
722
808
|
padEnd: 0
|
|
723
809
|
};
|
|
724
810
|
if ((!o.value || c.value) && n.value.ssrRange) {
|
|
725
|
-
let { colStart: t = 0, colEnd: r = 0 } = n.value.ssrRange, i = Math.max(0, t), a = Math.min(e, r || e)
|
|
726
|
-
return {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
811
|
+
let { colStart: t = 0, colEnd: r = 0 } = n.value.ssrRange, i = Math.max(0, t), a = Math.min(e, r || e);
|
|
812
|
+
return calculateColumnRange({
|
|
813
|
+
columnCount: e,
|
|
814
|
+
relativeScrollX: calculateOffsetAt(i, j.value, n.value.columnGap || 0, (e) => P.query(e)),
|
|
815
|
+
usableWidth: calculateRangeSize(i, a, j.value, n.value.columnGap || 0, (e) => P.query(e)),
|
|
816
|
+
colBuffer: 0,
|
|
817
|
+
fixedWidth: j.value,
|
|
818
|
+
columnGap: n.value.columnGap || 0,
|
|
819
|
+
findLowerBound: (e) => P.findLowerBound(e),
|
|
820
|
+
query: (e) => P.query(e),
|
|
821
|
+
totalColsQuery: () => P.query(e)
|
|
822
|
+
});
|
|
732
823
|
}
|
|
733
824
|
let t = n.value.ssrRange && !a.value ? 0 : 2;
|
|
734
825
|
return calculateColumnRange({
|
|
735
826
|
columnCount: e,
|
|
736
|
-
relativeScrollX:
|
|
737
|
-
usableWidth:
|
|
827
|
+
relativeScrollX: Y.value,
|
|
828
|
+
usableWidth: Ue.value,
|
|
738
829
|
colBuffer: t,
|
|
739
|
-
fixedWidth:
|
|
830
|
+
fixedWidth: j.value,
|
|
740
831
|
columnGap: n.value.columnGap || 0,
|
|
741
|
-
findLowerBound: (e) =>
|
|
742
|
-
query: (e) =>
|
|
743
|
-
totalColsQuery: () =>
|
|
832
|
+
findLowerBound: (e) => P.findLowerBound(e),
|
|
833
|
+
query: (e) => P.query(e),
|
|
834
|
+
totalColsQuery: () => P.query(e)
|
|
744
835
|
});
|
|
745
|
-
}),
|
|
746
|
-
|
|
747
|
-
let { start: e, end: t } =
|
|
836
|
+
}), lt = [], ut = computed(() => {
|
|
837
|
+
I.value;
|
|
838
|
+
let { start: e, end: t } = ot.value, r = [], i = Me.value, a = Pe.value, s = [];
|
|
748
839
|
if (o.value || !n.value.ssrRange) {
|
|
749
|
-
let t =
|
|
750
|
-
n !== void 0 && n < e &&
|
|
840
|
+
let t = st.value, n = findPrevStickyIndex(i, t);
|
|
841
|
+
n !== void 0 && n < e && s.push(n);
|
|
751
842
|
}
|
|
752
|
-
for (let n = e; n < t; n++)
|
|
753
|
-
let
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
843
|
+
for (let n = e; n < t; n++) s.push(n);
|
|
844
|
+
let { x: c, y: l } = !o.value && n.value.ssrRange ? calculateSSROffsets(O.value, n.value.ssrRange, A.value, j.value, n.value.gap || 0, n.value.columnGap || 0, (e) => N.query(e), (e) => M.query(e), (e) => P.query(e)) : {
|
|
845
|
+
x: 0,
|
|
846
|
+
y: 0
|
|
847
|
+
}, u = new Map(lt.map((e) => [e.index, e])), d = -1, f = 0, p = -1, m = 0, h = (e) => e === d + 1 ? (f += M.get(d), d = e, f) : (f = M.query(e), d = e, f), g = (e) => e === p + 1 ? (m += N.get(p), p = e, m) : (m = N.query(e), p = e, m), _ = H.value + B.value + Fe.value, v = U.value + V.value + Le.value, y = H.value + B.value, b = U.value + V.value, x = ct.value;
|
|
848
|
+
for (let e of s) {
|
|
757
849
|
let t = n.value.items[e];
|
|
758
850
|
if (t === void 0) continue;
|
|
759
|
-
let { x:
|
|
851
|
+
let { x: s, y: d, width: f, height: p } = calculateItemPosition({
|
|
760
852
|
index: e,
|
|
761
|
-
direction:
|
|
762
|
-
fixedSize:
|
|
853
|
+
direction: O.value,
|
|
854
|
+
fixedSize: A.value,
|
|
763
855
|
gap: n.value.gap || 0,
|
|
764
856
|
columnGap: n.value.columnGap || 0,
|
|
765
|
-
usableWidth:
|
|
766
|
-
usableHeight:
|
|
767
|
-
totalWidth:
|
|
768
|
-
queryY:
|
|
769
|
-
queryX:
|
|
770
|
-
getSizeY: (e) =>
|
|
771
|
-
getSizeX: (e) =>
|
|
772
|
-
columnRange:
|
|
773
|
-
}),
|
|
857
|
+
usableWidth: Ue.value,
|
|
858
|
+
usableHeight: We.value,
|
|
859
|
+
totalWidth: Ge.value.width,
|
|
860
|
+
queryY: g,
|
|
861
|
+
queryX: h,
|
|
862
|
+
getSizeY: (e) => N.get(e),
|
|
863
|
+
getSizeX: (e) => M.get(e),
|
|
864
|
+
columnRange: x
|
|
865
|
+
}), m = a.has(e), w = s, T = d, { isStickyActive: E, isStickyActiveX: te, isStickyActiveY: ne, stickyOffset: re } = calculateStickyItem({
|
|
774
866
|
index: e,
|
|
775
|
-
isSticky:
|
|
776
|
-
direction:
|
|
777
|
-
relativeScrollX:
|
|
778
|
-
relativeScrollY:
|
|
779
|
-
originalX:
|
|
780
|
-
originalY:
|
|
781
|
-
width:
|
|
782
|
-
height:
|
|
783
|
-
stickyIndices:
|
|
784
|
-
fixedSize:
|
|
785
|
-
fixedWidth:
|
|
867
|
+
isSticky: m,
|
|
868
|
+
direction: O.value,
|
|
869
|
+
relativeScrollX: Y.value,
|
|
870
|
+
relativeScrollY: X.value,
|
|
871
|
+
originalX: w,
|
|
872
|
+
originalY: T,
|
|
873
|
+
width: f,
|
|
874
|
+
height: p,
|
|
875
|
+
stickyIndices: i,
|
|
876
|
+
fixedSize: A.value,
|
|
877
|
+
fixedWidth: j.value,
|
|
786
878
|
gap: n.value.gap || 0,
|
|
787
879
|
columnGap: n.value.columnGap || 0,
|
|
788
|
-
getItemQueryY:
|
|
789
|
-
getItemQueryX:
|
|
790
|
-
}),
|
|
791
|
-
|
|
880
|
+
getItemQueryY: g,
|
|
881
|
+
getItemQueryX: h
|
|
882
|
+
}), ie = o.value ? S.value / q.value + (s + _ - S.value) - y : s - c, D = o.value ? C.value / J.value + (d + v - C.value) - b : d - l, k = u.get(e);
|
|
883
|
+
k && k.item === t && k.offset.x === ie && k.offset.y === D && k.size.width === f && k.size.height === p && k.isSticky === m && k.isStickyActive === E && k.isStickyActiveX === te && k.isStickyActiveY === ne && k.stickyOffset.x === re.x && k.stickyOffset.y === re.y ? r.push(k) : r.push({
|
|
792
884
|
item: t,
|
|
793
885
|
index: e,
|
|
794
886
|
offset: {
|
|
795
|
-
x:
|
|
796
|
-
y:
|
|
887
|
+
x: ie,
|
|
888
|
+
y: D
|
|
797
889
|
},
|
|
798
890
|
size: {
|
|
799
|
-
width:
|
|
800
|
-
height:
|
|
891
|
+
width: f,
|
|
892
|
+
height: p
|
|
801
893
|
},
|
|
802
|
-
originalX:
|
|
803
|
-
originalY:
|
|
804
|
-
isSticky:
|
|
805
|
-
isStickyActive:
|
|
806
|
-
isStickyActiveX:
|
|
807
|
-
isStickyActiveY:
|
|
808
|
-
stickyOffset:
|
|
894
|
+
originalX: w,
|
|
895
|
+
originalY: T,
|
|
896
|
+
isSticky: m,
|
|
897
|
+
isStickyActive: E,
|
|
898
|
+
isStickyActiveX: te,
|
|
899
|
+
isStickyActiveY: ne,
|
|
900
|
+
stickyOffset: re
|
|
809
901
|
});
|
|
810
902
|
}
|
|
811
|
-
return
|
|
812
|
-
}),
|
|
813
|
-
|
|
814
|
-
let e =
|
|
903
|
+
return lt = r, r;
|
|
904
|
+
}), dt = computed(() => {
|
|
905
|
+
I.value;
|
|
906
|
+
let e = Y.value + B.value, t = X.value + V.value, n = Y.value + (f.value - ze.value) - 1, o = X.value + (p.value - Be.value) - 1, s = at(e), c = it(t), l = it(O.value === "horizontal" ? n : o), u = at(n);
|
|
815
907
|
return {
|
|
816
|
-
items:
|
|
908
|
+
items: ut.value,
|
|
817
909
|
currentIndex: c,
|
|
818
910
|
currentColIndex: s,
|
|
819
911
|
currentEndIndex: l,
|
|
@@ -835,115 +927,96 @@ function useVirtualScroll(e) {
|
|
|
835
927
|
height: p.value
|
|
836
928
|
},
|
|
837
929
|
totalSize: {
|
|
838
|
-
width:
|
|
839
|
-
height:
|
|
930
|
+
width: W.value,
|
|
931
|
+
height: G.value
|
|
840
932
|
},
|
|
841
933
|
isScrolling: a.value,
|
|
842
934
|
isProgrammaticScroll: x.value,
|
|
843
|
-
range:
|
|
844
|
-
columnRange:
|
|
935
|
+
range: ot.value,
|
|
936
|
+
columnRange: ct.value
|
|
845
937
|
};
|
|
846
|
-
}),
|
|
847
|
-
x.value = !1,
|
|
848
|
-
},
|
|
938
|
+
}), ft = () => {
|
|
939
|
+
x.value = !1, z.value = null;
|
|
940
|
+
}, pt = (e) => {
|
|
849
941
|
let t = e.target;
|
|
850
|
-
typeof window > "u"
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
if (
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
Math.abs(i) > .1 && (O.update(e, i), t = !0, e < u && (r += i)), A[e] = 1;
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
};
|
|
864
|
-
for (let { index: s, inlineSize: c, blockSize: u, element: m } of e) {
|
|
865
|
-
if (c <= 0 && u <= 0) continue;
|
|
866
|
-
let e = R.value || typeof n.value.itemSize == "function";
|
|
867
|
-
if (s >= 0 && !p.has(s) && e && u > 0) {
|
|
868
|
-
if (p.add(s), d && c > 0) {
|
|
869
|
-
let e = E.get(s), n = c + o;
|
|
870
|
-
if (!j[s] || Math.abs(n - e) > .1) {
|
|
871
|
-
let i = n - e;
|
|
872
|
-
E.update(s, i), j[s] = 1, t = !0, s < l && (r += i);
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
if (!d) {
|
|
876
|
-
let e = D.get(s), n = u + a;
|
|
877
|
-
if (!N[s] || Math.abs(n - e) > .1) {
|
|
878
|
-
let r = n - e;
|
|
879
|
-
D.update(s, r), N[s] = 1, t = !0, s < l && (i += r);
|
|
880
|
-
}
|
|
942
|
+
if (typeof window > "u") return;
|
|
943
|
+
D(), 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);
|
|
944
|
+
let o = displayToVirtual(d.value ? Math.abs(r.value) : r.value, K.x, q.value), s = displayToVirtual(i.value, K.y, J.value);
|
|
945
|
+
Math.abs(o - w) > .5 && (te = o > w ? "end" : "start", w = o), Math.abs(s - E) > .5 && (ne = s > E ? "end" : "start", E = s), S.value = o, C.value = s, x.value || (z.value = null), a.value ||= !0, clearTimeout(b), b = setTimeout(() => {
|
|
946
|
+
let e = x.value;
|
|
947
|
+
if (a.value = !1, x.value = !1, n.value.snap && !e) {
|
|
948
|
+
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 (O.value !== "horizontal") {
|
|
950
|
+
let e = resolveSnap(t, ne, r.currentIndex, r.currentEndIndex, X.value, p.value, i, (e) => N.get(e), (e) => N.query(e), it);
|
|
951
|
+
e && (a = e.index, s = e.align, l = !0);
|
|
881
952
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
let e = m.dataset.colIndex;
|
|
886
|
-
if (e != null) h(Number.parseInt(e, 10), c);
|
|
887
|
-
else {
|
|
888
|
-
let e = Array.from(m.querySelectorAll("[data-col-index]"));
|
|
889
|
-
for (let t of e) h(Number.parseInt(t.dataset.colIndex, 10), t.getBoundingClientRect().width);
|
|
953
|
+
if (O.value !== "vertical") {
|
|
954
|
+
let e = O.value === "both", a = e ? n.value.columnCount || 0 : i, s = resolveSnap(t, te, r.currentColIndex, r.currentEndColIndex, Y.value, f.value, a, (t) => e ? P.get(t) : M.get(t), (t) => e ? P.query(t) : M.query(t), at);
|
|
955
|
+
s && (o = s.index, c = s.align, l = !0);
|
|
890
956
|
}
|
|
957
|
+
l && et(a, o, {
|
|
958
|
+
align: {
|
|
959
|
+
x: c,
|
|
960
|
+
y: s
|
|
961
|
+
},
|
|
962
|
+
behavior: "smooth"
|
|
963
|
+
});
|
|
891
964
|
}
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
}
|
|
897
|
-
},
|
|
898
|
-
|
|
965
|
+
}, 250);
|
|
966
|
+
}, mt = (e) => {
|
|
967
|
+
Oe(e, it, at, Y.value, X.value, (e, t) => {
|
|
968
|
+
z.value !== null || x.value || nt(e, t);
|
|
969
|
+
});
|
|
970
|
+
}, $ = (e, t, n, r) => {
|
|
971
|
+
mt([{
|
|
899
972
|
index: e,
|
|
900
973
|
inlineSize: t,
|
|
901
974
|
blockSize: n,
|
|
902
975
|
element: r
|
|
903
976
|
}]);
|
|
904
977
|
};
|
|
905
|
-
function
|
|
906
|
-
if (
|
|
907
|
-
let { rowIndex: e, colIndex: t, options: r } =
|
|
978
|
+
function ht() {
|
|
979
|
+
if (z.value && !c.value) {
|
|
980
|
+
let { rowIndex: e, colIndex: t, options: r } = z.value;
|
|
908
981
|
if (isScrollToIndexOptions(r) && r.behavior === "smooth" && a.value) return;
|
|
909
|
-
let i = n.value.container || window, o = typeof window < "u" && i === window ? window.scrollX : i.scrollLeft, s = typeof window < "u" && i === window ? window.scrollY : i.scrollTop, c = d.value ? Math.abs(o) : o, l = s, u = displayToVirtual(c, 0,
|
|
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, q.value), m = displayToVirtual(l, 0, J.value), { targetX: h, targetY: g } = calculateScrollTarget({
|
|
910
983
|
rowIndex: e,
|
|
911
984
|
colIndex: t,
|
|
912
985
|
options: r,
|
|
913
|
-
direction:
|
|
986
|
+
direction: O.value,
|
|
914
987
|
viewportWidth: f.value,
|
|
915
988
|
viewportHeight: p.value,
|
|
916
|
-
totalWidth:
|
|
917
|
-
totalHeight:
|
|
989
|
+
totalWidth: qe.value,
|
|
990
|
+
totalHeight: Je.value,
|
|
918
991
|
gap: n.value.gap || 0,
|
|
919
992
|
columnGap: n.value.columnGap || 0,
|
|
920
|
-
fixedSize:
|
|
921
|
-
fixedWidth:
|
|
993
|
+
fixedSize: A.value,
|
|
994
|
+
fixedWidth: j.value,
|
|
922
995
|
relativeScrollX: u,
|
|
923
996
|
relativeScrollY: m,
|
|
924
|
-
getItemSizeY: (e) =>
|
|
925
|
-
getItemSizeX: (e) =>
|
|
926
|
-
getItemQueryY: (e) =>
|
|
927
|
-
getItemQueryX: (e) =>
|
|
928
|
-
getColumnSize: (e) =>
|
|
929
|
-
getColumnQuery: (e) =>
|
|
930
|
-
scaleX:
|
|
931
|
-
scaleY:
|
|
932
|
-
hostOffsetX:
|
|
933
|
-
hostOffsetY:
|
|
934
|
-
stickyIndices:
|
|
935
|
-
stickyStartX:
|
|
936
|
-
stickyStartY:
|
|
937
|
-
stickyEndX:
|
|
938
|
-
stickyEndY:
|
|
939
|
-
flowPaddingStartX:
|
|
940
|
-
flowPaddingStartY:
|
|
941
|
-
paddingStartX:
|
|
942
|
-
paddingStartY:
|
|
943
|
-
paddingEndX:
|
|
944
|
-
paddingEndY:
|
|
945
|
-
}), _ = t == null || Math.abs(u - h) < 2, v = e == null || Math.abs(m - g) < 2, y = t == null || t === void 0 ||
|
|
946
|
-
_ && v ? y && b && !a.value && !x.value && (
|
|
997
|
+
getItemSizeY: (e) => N.get(e),
|
|
998
|
+
getItemSizeX: (e) => M.get(e),
|
|
999
|
+
getItemQueryY: (e) => N.query(e),
|
|
1000
|
+
getItemQueryX: (e) => M.query(e),
|
|
1001
|
+
getColumnSize: (e) => P.get(e),
|
|
1002
|
+
getColumnQuery: (e) => P.query(e),
|
|
1003
|
+
scaleX: q.value,
|
|
1004
|
+
scaleY: J.value,
|
|
1005
|
+
hostOffsetX: K.x,
|
|
1006
|
+
hostOffsetY: K.y,
|
|
1007
|
+
stickyIndices: Me.value,
|
|
1008
|
+
stickyStartX: B.value,
|
|
1009
|
+
stickyStartY: V.value,
|
|
1010
|
+
stickyEndX: ze.value,
|
|
1011
|
+
stickyEndY: Be.value,
|
|
1012
|
+
flowPaddingStartX: H.value,
|
|
1013
|
+
flowPaddingStartY: U.value,
|
|
1014
|
+
paddingStartX: Fe.value,
|
|
1015
|
+
paddingStartY: Le.value,
|
|
1016
|
+
paddingEndX: Ie.value,
|
|
1017
|
+
paddingEndY: Re.value
|
|
1018
|
+
}), _ = t == null || Math.abs(u - h) < 2, v = e == null || Math.abs(m - g) < 2, y = t == null || t === void 0 || he.value[t] === 1, b = e == null || e === void 0 || _e.value[e] === 1;
|
|
1019
|
+
_ && v ? y && b && !a.value && !x.value && (z.value = null) : et(e, t, isScrollToIndexOptions(r) ? {
|
|
947
1020
|
...r,
|
|
948
1021
|
isCorrection: !0
|
|
949
1022
|
} : {
|
|
@@ -953,39 +1026,39 @@ function useVirtualScroll(e) {
|
|
|
953
1026
|
}
|
|
954
1027
|
}
|
|
955
1028
|
watch([
|
|
956
|
-
|
|
1029
|
+
I,
|
|
957
1030
|
f,
|
|
958
1031
|
p
|
|
959
|
-
],
|
|
960
|
-
e ||
|
|
1032
|
+
], ht), watch(a, (e) => {
|
|
1033
|
+
e || ht();
|
|
961
1034
|
});
|
|
962
|
-
let
|
|
1035
|
+
let gt = null, _t = null, vt, yt = (e) => {
|
|
963
1036
|
if (typeof window > "u") return;
|
|
964
1037
|
let t = e || window, n = t === window || isElement(t) && t === document.documentElement ? document : t;
|
|
965
|
-
if (n.addEventListener("scroll",
|
|
1038
|
+
if (n.addEventListener("scroll", pt, { passive: !0 }), ie = null, D(), isElement(t) && (_t = new MutationObserver(() => D()), _t.observe(t, {
|
|
966
1039
|
attributes: !0,
|
|
967
1040
|
attributeFilter: ["dir", "style"]
|
|
968
|
-
})),
|
|
1041
|
+
})), vt = setInterval(D, 1e3), t === window) {
|
|
969
1042
|
f.value = document.documentElement.clientWidth, p.value = document.documentElement.clientHeight, r.value = window.scrollX, i.value = window.scrollY;
|
|
970
1043
|
let e = () => {
|
|
971
|
-
|
|
1044
|
+
D(), f.value = document.documentElement.clientWidth, p.value = document.documentElement.clientHeight, Q();
|
|
972
1045
|
};
|
|
973
1046
|
return window.addEventListener("resize", e), () => {
|
|
974
|
-
n.removeEventListener("scroll",
|
|
1047
|
+
n.removeEventListener("scroll", pt), window.removeEventListener("resize", e), _t?.disconnect(), clearInterval(vt), ie = null;
|
|
975
1048
|
};
|
|
976
|
-
} else return f.value = t.clientWidth, p.value = t.clientHeight, r.value = t.scrollLeft, i.value = t.scrollTop,
|
|
977
|
-
|
|
978
|
-
}),
|
|
979
|
-
n.removeEventListener("scroll",
|
|
1049
|
+
} else return f.value = t.clientWidth, p.value = t.clientHeight, r.value = t.scrollLeft, i.value = t.scrollTop, gt = new ResizeObserver(() => {
|
|
1050
|
+
D(), f.value = t.clientWidth, p.value = t.clientHeight, Q();
|
|
1051
|
+
}), gt.observe(t), () => {
|
|
1052
|
+
n.removeEventListener("scroll", pt), gt?.disconnect(), _t?.disconnect(), clearInterval(vt), ie = null;
|
|
980
1053
|
};
|
|
981
|
-
},
|
|
1054
|
+
}, bt;
|
|
982
1055
|
return getCurrentInstance() && (onMounted(() => {
|
|
983
|
-
l.value = !0,
|
|
984
|
-
|
|
985
|
-
}, { immediate: !0 }),
|
|
986
|
-
if (
|
|
1056
|
+
l.value = !0, D(), watch(() => n.value.container, (e) => {
|
|
1057
|
+
bt?.(), bt = yt(e || null);
|
|
1058
|
+
}, { immediate: !0 }), Q(), nextTick(() => {
|
|
1059
|
+
if (Q(), n.value.ssrRange || n.value.initialScrollIndex !== void 0) {
|
|
987
1060
|
let e = n.value.initialScrollIndex === void 0 ? n.value.ssrRange?.start : n.value.initialScrollIndex, t = n.value.initialScrollAlign || "start";
|
|
988
|
-
e != null &&
|
|
1061
|
+
e != null && et(e, n.value.ssrRange?.colStart, {
|
|
989
1062
|
align: t,
|
|
990
1063
|
behavior: "auto"
|
|
991
1064
|
}), o.value = !0, c.value = !0, nextTick(() => {
|
|
@@ -994,125 +1067,121 @@ function useVirtualScroll(e) {
|
|
|
994
1067
|
} else o.value = !0;
|
|
995
1068
|
});
|
|
996
1069
|
}), onUnmounted(() => {
|
|
997
|
-
|
|
1070
|
+
bt?.();
|
|
998
1071
|
})), {
|
|
999
|
-
renderedItems:
|
|
1000
|
-
totalWidth:
|
|
1001
|
-
totalHeight:
|
|
1002
|
-
renderedWidth:
|
|
1003
|
-
renderedHeight:
|
|
1004
|
-
scrollDetails:
|
|
1005
|
-
getRowHeight:
|
|
1006
|
-
getColumnWidth:
|
|
1007
|
-
getRowOffset: (e) =>
|
|
1008
|
-
getColumnOffset: (e) =>
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
if (L.value === "horizontal") return Math.max(0, E.get(e) - (n.value.columnGap || 0));
|
|
1012
|
-
let t = n.value.itemSize;
|
|
1013
|
-
if (typeof t == "number" && t > 0) return t;
|
|
1014
|
-
if (typeof t == "function") {
|
|
1015
|
-
let r = n.value.items[e];
|
|
1016
|
-
return r === void 0 ? n.value.defaultItemSize || 40 : t(r, e);
|
|
1017
|
-
}
|
|
1018
|
-
return Math.max(0, D.get(e) - (n.value.gap || 0));
|
|
1072
|
+
renderedItems: ut,
|
|
1073
|
+
totalWidth: W,
|
|
1074
|
+
totalHeight: G,
|
|
1075
|
+
renderedWidth: Ye,
|
|
1076
|
+
renderedHeight: Xe,
|
|
1077
|
+
scrollDetails: dt,
|
|
1078
|
+
getRowHeight: $e,
|
|
1079
|
+
getColumnWidth: Z,
|
|
1080
|
+
getRowOffset: (e) => U.value + V.value + Le.value + calculateOffsetAt(e, A.value, n.value.gap || 0, (e) => N.query(e)),
|
|
1081
|
+
getColumnOffset: (e) => {
|
|
1082
|
+
let t = H.value + B.value + Fe.value;
|
|
1083
|
+
return O.value === "both" ? t + calculateOffsetAt(e, j.value, n.value.columnGap || 0, (e) => P.query(e)) : t + calculateOffsetAt(e, A.value, n.value.columnGap || 0, (e) => M.query(e));
|
|
1019
1084
|
},
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1085
|
+
getItemOffset: (e) => O.value === "horizontal" ? H.value + B.value + Fe.value + calculateOffsetAt(e, A.value, n.value.columnGap || 0, (e) => M.query(e)) : U.value + V.value + Le.value + calculateOffsetAt(e, A.value, n.value.gap || 0, (e) => N.query(e)),
|
|
1086
|
+
getItemSize: (e) => O.value === "horizontal" ? Z(e) : $e(e),
|
|
1087
|
+
scrollToIndex: et,
|
|
1088
|
+
scrollToOffset: tt,
|
|
1089
|
+
stopProgrammaticScroll: ft,
|
|
1090
|
+
updateItemSize: $,
|
|
1091
|
+
updateItemSizes: mt,
|
|
1092
|
+
updateHostOffset: Q,
|
|
1093
|
+
updateDirection: D,
|
|
1094
|
+
columnRange: ct,
|
|
1028
1095
|
refresh: () => {
|
|
1029
|
-
|
|
1096
|
+
ke(nt);
|
|
1030
1097
|
},
|
|
1031
1098
|
isHydrated: o,
|
|
1032
|
-
isWindowContainer:
|
|
1099
|
+
isWindowContainer: Ke,
|
|
1033
1100
|
isRtl: d,
|
|
1034
|
-
scaleX:
|
|
1035
|
-
scaleY:
|
|
1036
|
-
componentOffset:
|
|
1037
|
-
renderedVirtualWidth:
|
|
1038
|
-
renderedVirtualHeight:
|
|
1101
|
+
scaleX: q,
|
|
1102
|
+
scaleY: J,
|
|
1103
|
+
componentOffset: K,
|
|
1104
|
+
renderedVirtualWidth: Ze,
|
|
1105
|
+
renderedVirtualHeight: Qe,
|
|
1106
|
+
getRowIndexAt: it,
|
|
1107
|
+
getColIndexAt: at
|
|
1039
1108
|
};
|
|
1040
1109
|
}
|
|
1041
1110
|
function useVirtualScrollbar(e) {
|
|
1042
|
-
let n = computed(() => toValue(e
|
|
1043
|
-
let e =
|
|
1044
|
-
return e <= 0 ? 0 : Math.max(0, Math.min(1,
|
|
1045
|
-
}),
|
|
1046
|
-
let e =
|
|
1047
|
-
return Math.max(Math.min(e, .1),
|
|
1048
|
-
}),
|
|
1049
|
-
inlineSize: `${
|
|
1050
|
-
insetInlineStart: `${
|
|
1111
|
+
let n = computed(() => toValue(e)), r = computed(() => n.value.axis === "horizontal"), i = computed(() => n.value.totalSize <= 0 ? 0 : Math.min(1, n.value.viewportSize / n.value.totalSize)), a = computed(() => {
|
|
1112
|
+
let e = n.value.totalSize - n.value.viewportSize;
|
|
1113
|
+
return e <= 0 ? 0 : Math.max(0, Math.min(1, n.value.position / e));
|
|
1114
|
+
}), o = computed(() => {
|
|
1115
|
+
let e = n.value.viewportSize > 0 ? 32 / n.value.viewportSize : .1;
|
|
1116
|
+
return Math.max(Math.min(e, .1), i.value) * 100;
|
|
1117
|
+
}), c = computed(() => a.value * (100 - o.value)), l = computed(() => r.value ? {
|
|
1118
|
+
inlineSize: `${o.value}%`,
|
|
1119
|
+
insetInlineStart: `${c.value}%`
|
|
1051
1120
|
} : {
|
|
1052
|
-
blockSize: `${
|
|
1053
|
-
insetBlockStart: `${
|
|
1054
|
-
}),
|
|
1055
|
-
let e =
|
|
1056
|
-
return
|
|
1057
|
-
}),
|
|
1058
|
-
function
|
|
1059
|
-
let
|
|
1060
|
-
if (
|
|
1061
|
-
let i =
|
|
1062
|
-
s =
|
|
1063
|
-
let
|
|
1064
|
-
|
|
1121
|
+
blockSize: `${o.value}%`,
|
|
1122
|
+
insetBlockStart: `${c.value}%`
|
|
1123
|
+
}), u = computed(() => {
|
|
1124
|
+
let e = n.value.viewportSize, t = "var(--vs-scrollbar-has-cross-gap, var(--vsi-scrollbar-has-cross-gap, 0)) * var(--vs-scrollbar-cross-gap, var(--vsi-scrollbar-size, 8px))";
|
|
1125
|
+
return r.value ? { inlineSize: `calc(${Math.max(0, e - 4)}px - ${t})` } : { blockSize: `calc(${Math.max(0, e - 4)}px - ${t})` };
|
|
1126
|
+
}), d = ref(!1), f = 0, p = 0;
|
|
1127
|
+
function m(e) {
|
|
1128
|
+
let t = e.currentTarget;
|
|
1129
|
+
if (e.target !== t) return;
|
|
1130
|
+
let i = t.getBoundingClientRect(), a = r.value ? i.width : i.height, s = 0;
|
|
1131
|
+
s = r.value ? n.value.isRtl ? i.right - e.clientX : e.clientX - i.left : e.clientY - i.top;
|
|
1132
|
+
let c = o.value / 100 * a, l = (s - c / 2) / (a - c), u = n.value.totalSize - n.value.viewportSize, d = l * u;
|
|
1133
|
+
d > u - 1 && (d = u), n.value.scrollToOffset(Math.max(0, Math.min(u, d)));
|
|
1065
1134
|
}
|
|
1066
|
-
function
|
|
1067
|
-
|
|
1135
|
+
function g(e) {
|
|
1136
|
+
d.value = !0, f = r.value ? n.value.isRtl ? -e.clientX : e.clientX : e.clientY, p = n.value.position, e.currentTarget.setPointerCapture(e.pointerId), e.preventDefault(), e.stopPropagation();
|
|
1068
1137
|
}
|
|
1069
|
-
function
|
|
1070
|
-
if (!
|
|
1071
|
-
let
|
|
1072
|
-
if (!
|
|
1073
|
-
let i = (
|
|
1074
|
-
if (
|
|
1075
|
-
let
|
|
1076
|
-
|
|
1138
|
+
function _(e) {
|
|
1139
|
+
if (!d.value) return;
|
|
1140
|
+
let t = e.currentTarget.parentElement;
|
|
1141
|
+
if (!t) return;
|
|
1142
|
+
let i = (r.value ? n.value.isRtl ? -e.clientX : e.clientX : e.clientY) - f, a = t.getBoundingClientRect(), s = r.value ? a.width : a.height, c = s - o.value / 100 * s;
|
|
1143
|
+
if (c <= 0) return;
|
|
1144
|
+
let l = n.value.totalSize - n.value.viewportSize, u = p + i / c * l;
|
|
1145
|
+
u > l - 1 && (u = l), n.value.scrollToOffset(Math.max(0, Math.min(l, u)));
|
|
1077
1146
|
}
|
|
1078
|
-
function
|
|
1079
|
-
|
|
1147
|
+
function y(e) {
|
|
1148
|
+
d.value && (d.value = !1, e.currentTarget.releasePointerCapture(e.pointerId));
|
|
1080
1149
|
}
|
|
1081
1150
|
return getCurrentInstance() && onUnmounted(() => {
|
|
1082
|
-
|
|
1151
|
+
d.value = !1;
|
|
1083
1152
|
}), {
|
|
1084
|
-
viewportPercent:
|
|
1085
|
-
positionPercent:
|
|
1086
|
-
thumbSizePercent:
|
|
1087
|
-
thumbPositionPercent:
|
|
1088
|
-
trackStyle:
|
|
1089
|
-
thumbStyle:
|
|
1153
|
+
viewportPercent: i,
|
|
1154
|
+
positionPercent: a,
|
|
1155
|
+
thumbSizePercent: o,
|
|
1156
|
+
thumbPositionPercent: c,
|
|
1157
|
+
trackStyle: u,
|
|
1158
|
+
thumbStyle: l,
|
|
1090
1159
|
trackProps: computed(() => ({
|
|
1091
|
-
class: ["virtual-scrollbar-track", `virtual-scrollbar-track--${
|
|
1092
|
-
style:
|
|
1160
|
+
class: ["virtual-scrollbar-track", `virtual-scrollbar-track--${r.value ? "horizontal" : "vertical"}`],
|
|
1161
|
+
style: u.value,
|
|
1093
1162
|
role: "scrollbar",
|
|
1094
|
-
"aria-label":
|
|
1095
|
-
"aria-orientation": n.value,
|
|
1096
|
-
"aria-valuenow": Math.round(
|
|
1163
|
+
"aria-label": n.value.ariaLabel,
|
|
1164
|
+
"aria-orientation": n.value.axis,
|
|
1165
|
+
"aria-valuenow": Math.round(n.value.position),
|
|
1097
1166
|
"aria-valuemin": 0,
|
|
1098
|
-
"aria-valuemax": Math.round(
|
|
1099
|
-
"aria-controls":
|
|
1167
|
+
"aria-valuemax": Math.round(n.value.totalSize - n.value.viewportSize),
|
|
1168
|
+
"aria-controls": n.value.containerId,
|
|
1100
1169
|
tabindex: -1,
|
|
1101
|
-
onMousedown:
|
|
1170
|
+
onMousedown: m
|
|
1102
1171
|
})),
|
|
1103
1172
|
thumbProps: computed(() => ({
|
|
1104
1173
|
class: [
|
|
1105
1174
|
"virtual-scrollbar-thumb",
|
|
1106
|
-
`virtual-scrollbar-thumb--${
|
|
1107
|
-
{ "virtual-scrollbar-thumb--active":
|
|
1175
|
+
`virtual-scrollbar-thumb--${r.value ? "horizontal" : "vertical"}`,
|
|
1176
|
+
{ "virtual-scrollbar-thumb--active": d.value }
|
|
1108
1177
|
],
|
|
1109
|
-
style:
|
|
1110
|
-
onPointerdown:
|
|
1111
|
-
onPointermove:
|
|
1112
|
-
onPointerup:
|
|
1113
|
-
onPointercancel:
|
|
1178
|
+
style: l.value,
|
|
1179
|
+
onPointerdown: g,
|
|
1180
|
+
onPointermove: _,
|
|
1181
|
+
onPointerup: y,
|
|
1182
|
+
onPointercancel: y
|
|
1114
1183
|
})),
|
|
1115
|
-
isDragging:
|
|
1184
|
+
isDragging: d
|
|
1116
1185
|
};
|
|
1117
1186
|
}
|
|
1118
1187
|
var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
@@ -1132,17 +1201,17 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1132
1201
|
},
|
|
1133
1202
|
emits: ["scrollToOffset"],
|
|
1134
1203
|
setup(e, { emit: t }) {
|
|
1135
|
-
let n = e, r = t, { trackProps: o, thumbProps: s } = useVirtualScrollbar({
|
|
1136
|
-
axis:
|
|
1137
|
-
totalSize:
|
|
1138
|
-
position:
|
|
1139
|
-
viewportSize:
|
|
1140
|
-
containerId:
|
|
1141
|
-
isRtl:
|
|
1204
|
+
let n = e, r = t, { trackProps: o, thumbProps: s } = useVirtualScrollbar(() => ({
|
|
1205
|
+
axis: n.axis,
|
|
1206
|
+
totalSize: n.totalSize,
|
|
1207
|
+
position: n.position,
|
|
1208
|
+
viewportSize: n.viewportSize,
|
|
1209
|
+
containerId: n.containerId,
|
|
1210
|
+
isRtl: n.isRtl,
|
|
1142
1211
|
scrollToOffset: (e) => {
|
|
1143
1212
|
n.scrollToOffset?.(e), r("scrollToOffset", e);
|
|
1144
1213
|
}
|
|
1145
|
-
});
|
|
1214
|
+
}));
|
|
1146
1215
|
return (e, t) => (openBlock(), createElementBlock("div", normalizeProps(guardReactiveProps(unref(o))), [createElementVNode("div", normalizeProps(guardReactiveProps(unref(s))), null, 16)], 16));
|
|
1147
1216
|
}
|
|
1148
1217
|
}), _hoisted_1 = {
|
|
@@ -1208,7 +1277,8 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1208
1277
|
role: {},
|
|
1209
1278
|
ariaLabel: {},
|
|
1210
1279
|
ariaLabelledby: {},
|
|
1211
|
-
itemRole: { default: void 0 }
|
|
1280
|
+
itemRole: { default: void 0 },
|
|
1281
|
+
snap: { type: [Boolean, String] }
|
|
1212
1282
|
},
|
|
1213
1283
|
emits: [
|
|
1214
1284
|
"scroll",
|
|
@@ -1216,18 +1286,18 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1216
1286
|
"visibleRangeChange"
|
|
1217
1287
|
],
|
|
1218
1288
|
setup(o, { expose: s, emit: c }) {
|
|
1219
|
-
let _ = o,
|
|
1220
|
-
let e =
|
|
1221
|
-
return e ===
|
|
1222
|
-
}),
|
|
1289
|
+
let _ = o, S = c, T = useSlots(), D = ref(null), O = ref(null), k = ref(null), ae = ref(null), A = /* @__PURE__ */ new Map(), j = useId(), oe = computed(() => `vs-container-${j}`), ce = ref(0), le = ref(0), ue = computed(() => _.container === void 0 ? D.value : _.container), de = computed(() => {
|
|
1290
|
+
let e = ue.value;
|
|
1291
|
+
return e === D.value || isWindowLike(e);
|
|
1292
|
+
}), M = computed(() => (_.items.length, {
|
|
1223
1293
|
items: _.items,
|
|
1224
1294
|
itemSize: _.itemSize,
|
|
1225
1295
|
direction: _.direction,
|
|
1226
1296
|
bufferBefore: _.bufferBefore,
|
|
1227
1297
|
bufferAfter: _.bufferAfter,
|
|
1228
|
-
container:
|
|
1229
|
-
hostElement:
|
|
1230
|
-
hostRef:
|
|
1298
|
+
container: ue.value,
|
|
1299
|
+
hostElement: O.value,
|
|
1300
|
+
hostRef: D.value,
|
|
1231
1301
|
ssrRange: _.ssrRange,
|
|
1232
1302
|
columnCount: _.columnCount,
|
|
1233
1303
|
columnWidth: _.columnWidth,
|
|
@@ -1241,19 +1311,19 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1241
1311
|
},
|
|
1242
1312
|
flowPaddingStart: {
|
|
1243
1313
|
x: 0,
|
|
1244
|
-
y: _.stickyHeader ? 0 :
|
|
1314
|
+
y: _.stickyHeader ? 0 : ce.value
|
|
1245
1315
|
},
|
|
1246
1316
|
flowPaddingEnd: {
|
|
1247
1317
|
x: 0,
|
|
1248
|
-
y: _.stickyFooter ? 0 :
|
|
1318
|
+
y: _.stickyFooter ? 0 : le.value
|
|
1249
1319
|
},
|
|
1250
1320
|
stickyStart: {
|
|
1251
1321
|
x: 0,
|
|
1252
|
-
y: _.stickyHeader &&
|
|
1322
|
+
y: _.stickyHeader && de.value ? ce.value : 0
|
|
1253
1323
|
},
|
|
1254
1324
|
stickyEnd: {
|
|
1255
1325
|
x: 0,
|
|
1256
|
-
y: _.stickyFooter &&
|
|
1326
|
+
y: _.stickyFooter && de.value ? le.value : 0
|
|
1257
1327
|
},
|
|
1258
1328
|
gap: _.gap,
|
|
1259
1329
|
columnGap: _.columnGap,
|
|
@@ -1265,65 +1335,66 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1265
1335
|
initialScrollAlign: _.initialScrollAlign,
|
|
1266
1336
|
defaultItemSize: _.defaultItemSize,
|
|
1267
1337
|
defaultColumnWidth: _.defaultColumnWidth,
|
|
1268
|
-
debug: _.debug
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1338
|
+
debug: _.debug,
|
|
1339
|
+
snap: _.snap
|
|
1340
|
+
})), { isHydrated: N, isRtl: me, columnRange: P, renderedItems: he, scrollDetails: F, renderedHeight: ge, renderedWidth: _e, getColumnWidth: I, getRowHeight: ve, scrollToIndex: L, scrollToOffset: ye, updateHostOffset: be, updateItemSizes: xe, updateDirection: Se, getItemOffset: Ce, getRowOffset: we, getColumnOffset: Te, getItemSize: De, refresh: Oe, stopProgrammaticScroll: R, scaleX: Ae, scaleY: je, isWindowContainer: Me, componentOffset: Ne, renderedVirtualWidth: V, renderedVirtualHeight: Be, getRowIndexAt: H, getColIndexAt: Ve } = useVirtualScroll(M), U = computed(() => Ae.value !== 1 || je.value !== 1), He = computed(() => Me.value ? !1 : _.virtualScrollbar === !0 || Ae.value !== 1 || je.value !== 1);
|
|
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));
|
|
1273
1344
|
}
|
|
1274
|
-
function
|
|
1275
|
-
let { displayViewportSize: t } =
|
|
1276
|
-
e >=
|
|
1345
|
+
function We(e) {
|
|
1346
|
+
let { displayViewportSize: t } = F.value;
|
|
1347
|
+
e >= _e.value - t.width - .5 ? ye(Infinity, null) : ye(displayToVirtual(e, Ne.x, Ae.value), null);
|
|
1277
1348
|
}
|
|
1278
|
-
let
|
|
1349
|
+
let Ge = useVirtualScrollbar(computed(() => ({
|
|
1279
1350
|
axis: "vertical",
|
|
1280
|
-
totalSize:
|
|
1281
|
-
position:
|
|
1282
|
-
viewportSize:
|
|
1283
|
-
scrollToOffset:
|
|
1284
|
-
containerId:
|
|
1285
|
-
isRtl:
|
|
1286
|
-
}),
|
|
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(() => ({
|
|
1287
1358
|
axis: "horizontal",
|
|
1288
|
-
totalSize:
|
|
1289
|
-
position:
|
|
1290
|
-
viewportSize:
|
|
1291
|
-
scrollToOffset:
|
|
1292
|
-
containerId:
|
|
1293
|
-
isRtl:
|
|
1294
|
-
}),
|
|
1295
|
-
...
|
|
1359
|
+
totalSize: _e.value,
|
|
1360
|
+
position: F.value.displayScrollOffset.x,
|
|
1361
|
+
viewportSize: F.value.displayViewportSize.width,
|
|
1362
|
+
scrollToOffset: We,
|
|
1363
|
+
containerId: oe.value,
|
|
1364
|
+
isRtl: me.value
|
|
1365
|
+
}))), qe = computed(() => _.direction === "both" ? {
|
|
1366
|
+
...P.value,
|
|
1296
1367
|
padStart: 0,
|
|
1297
1368
|
padEnd: 0
|
|
1298
|
-
} :
|
|
1299
|
-
function
|
|
1300
|
-
|
|
1369
|
+
} : P.value);
|
|
1370
|
+
function Je() {
|
|
1371
|
+
Oe(), Se(), nextTick(() => {
|
|
1301
1372
|
let e = [];
|
|
1302
|
-
for (let [t, n] of
|
|
1373
|
+
for (let [t, n] of A.entries()) n && e.push({
|
|
1303
1374
|
index: t,
|
|
1304
1375
|
inlineSize: n.offsetWidth,
|
|
1305
1376
|
blockSize: n.offsetHeight,
|
|
1306
1377
|
element: n
|
|
1307
1378
|
});
|
|
1308
|
-
e.length > 0 &&
|
|
1379
|
+
e.length > 0 && xe(e);
|
|
1309
1380
|
});
|
|
1310
1381
|
}
|
|
1311
|
-
watch(
|
|
1312
|
-
!
|
|
1382
|
+
watch(F, (e, t) => {
|
|
1383
|
+
!N.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", {
|
|
1313
1384
|
start: e.range.start,
|
|
1314
1385
|
end: e.range.end,
|
|
1315
1386
|
colStart: e.columnRange.start,
|
|
1316
1387
|
colEnd: e.columnRange.end
|
|
1317
|
-
}), !_.loading && (_.direction !== "horizontal" && e.totalSize && e.totalSize.height - (e.scrollOffset.y + e.viewportSize.height) <= _.loadDistance &&
|
|
1318
|
-
}), watch(
|
|
1319
|
-
e &&
|
|
1320
|
-
start:
|
|
1321
|
-
end:
|
|
1322
|
-
colStart:
|
|
1323
|
-
colEnd:
|
|
1388
|
+
}), !_.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(N, (e) => {
|
|
1390
|
+
e && F.value?.range && F.value?.columnRange && S("visibleRangeChange", {
|
|
1391
|
+
start: F.value.range.start,
|
|
1392
|
+
end: F.value.range.end,
|
|
1393
|
+
colStart: F.value.columnRange.start,
|
|
1394
|
+
colEnd: F.value.columnRange.end
|
|
1324
1395
|
});
|
|
1325
1396
|
}, { once: !0 });
|
|
1326
|
-
let
|
|
1397
|
+
let W = typeof window > "u" ? null : new ResizeObserver(be), G = typeof window > "u" ? null : new ResizeObserver((e) => {
|
|
1327
1398
|
let t = [];
|
|
1328
1399
|
for (let n of e) {
|
|
1329
1400
|
let e = n.target, r = Number(e.dataset.index), i = e.dataset.colIndex, a = n.contentRect.width, o = n.contentRect.height;
|
|
@@ -1339,229 +1410,232 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1339
1410
|
element: e
|
|
1340
1411
|
});
|
|
1341
1412
|
}
|
|
1342
|
-
t.length > 0 &&
|
|
1343
|
-
}),
|
|
1344
|
-
|
|
1413
|
+
t.length > 0 && xe(t);
|
|
1414
|
+
}), K = typeof window > "u" ? null : new ResizeObserver(() => {
|
|
1415
|
+
ce.value = k.value?.offsetHeight || 0, le.value = ae.value?.offsetHeight || 0, be();
|
|
1345
1416
|
});
|
|
1346
|
-
function
|
|
1417
|
+
function Ye(e, t) {
|
|
1347
1418
|
watch(e, (e, n) => {
|
|
1348
|
-
n &&
|
|
1419
|
+
n && K?.unobserve(n), e ? K?.observe(e) : t.value = 0;
|
|
1349
1420
|
}, { immediate: !0 });
|
|
1350
1421
|
}
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
for (let e of
|
|
1354
|
-
}), watch([
|
|
1355
|
-
t &&
|
|
1356
|
-
}), watch([
|
|
1422
|
+
Ye(k, ce), Ye(ae, le), onMounted(() => {
|
|
1423
|
+
D.value && W?.observe(D.value);
|
|
1424
|
+
for (let e of A.values()) Xe(e, !0);
|
|
1425
|
+
}), watch([D, O], ([e], [t]) => {
|
|
1426
|
+
t && W?.unobserve(t), e && W?.observe(e);
|
|
1427
|
+
}), watch([D, U], ([e, t], [n, r]) => {
|
|
1357
1428
|
let i = e !== n || t !== r;
|
|
1358
|
-
n && i && n.removeEventListener("wheel",
|
|
1429
|
+
n && i && n.removeEventListener("wheel", it), e && i && e.addEventListener("wheel", it, { passive: !t });
|
|
1359
1430
|
}, { immediate: !0 });
|
|
1360
|
-
function
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1431
|
+
function Xe(e, t) {
|
|
1432
|
+
let n = t ? "observe" : "unobserve";
|
|
1433
|
+
G?.[n](e), _.direction === "both" && e.children.length > 0 && e.querySelectorAll("[data-col-index]").forEach((e) => G?.[n](e));
|
|
1434
|
+
}
|
|
1435
|
+
function Ze(e, t) {
|
|
1436
|
+
if (e) {
|
|
1437
|
+
let n = e;
|
|
1438
|
+
A.set(t, n), Xe(n, !0);
|
|
1439
|
+
} else {
|
|
1440
|
+
let e = A.get(t);
|
|
1441
|
+
e && (Xe(e, !1), A.delete(t));
|
|
1365
1442
|
}
|
|
1366
1443
|
}
|
|
1367
|
-
let
|
|
1444
|
+
let Qe = ref(!1), q = {
|
|
1368
1445
|
x: 0,
|
|
1369
1446
|
y: 0
|
|
1370
|
-
},
|
|
1447
|
+
}, J = {
|
|
1371
1448
|
x: 0,
|
|
1372
1449
|
y: 0
|
|
1373
|
-
},
|
|
1450
|
+
}, Y = {
|
|
1374
1451
|
x: 0,
|
|
1375
1452
|
y: 0
|
|
1376
|
-
},
|
|
1453
|
+
}, X = 0, Z = {
|
|
1377
1454
|
x: 0,
|
|
1378
1455
|
y: 0
|
|
1379
|
-
},
|
|
1380
|
-
function
|
|
1456
|
+
}, $e = null;
|
|
1457
|
+
function et() {
|
|
1381
1458
|
let e = () => {
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1459
|
+
let { nextVelocity: t, delta: n } = calculateInertiaStep(Z, FRICTION);
|
|
1460
|
+
Z.x = t.x, Z.y = t.y;
|
|
1461
|
+
let { x: r, y: i } = F.value.scrollOffset;
|
|
1462
|
+
ye(r + n.x, i + n.y, { behavior: "auto" }), Math.abs(Z.x) > MIN_VELOCITY || Math.abs(Z.y) > MIN_VELOCITY ? $e = requestAnimationFrame(e) : tt();
|
|
1385
1463
|
};
|
|
1386
|
-
|
|
1464
|
+
$e = requestAnimationFrame(e);
|
|
1387
1465
|
}
|
|
1388
|
-
function
|
|
1389
|
-
|
|
1466
|
+
function tt() {
|
|
1467
|
+
$e !== null && (cancelAnimationFrame($e), $e = null), Z = {
|
|
1390
1468
|
x: 0,
|
|
1391
1469
|
y: 0
|
|
1392
1470
|
};
|
|
1393
1471
|
}
|
|
1394
|
-
function
|
|
1395
|
-
|
|
1472
|
+
function nt(e) {
|
|
1473
|
+
R(), tt(), U.value && (e.pointerType === "mouse" && e.button !== 0 || (Qe.value = !0, q = {
|
|
1396
1474
|
x: e.clientX,
|
|
1397
1475
|
y: e.clientY
|
|
1398
|
-
},
|
|
1476
|
+
}, Y = {
|
|
1399
1477
|
x: e.clientX,
|
|
1400
1478
|
y: e.clientY
|
|
1401
|
-
},
|
|
1402
|
-
x:
|
|
1403
|
-
y:
|
|
1479
|
+
}, X = performance.now(), J = {
|
|
1480
|
+
x: F.value.scrollOffset.x,
|
|
1481
|
+
y: F.value.scrollOffset.y
|
|
1404
1482
|
}, e.currentTarget.setPointerCapture(e.pointerId)));
|
|
1405
1483
|
}
|
|
1406
|
-
function
|
|
1407
|
-
if (!
|
|
1408
|
-
let t = performance.now(), n = t -
|
|
1484
|
+
function rt(e) {
|
|
1485
|
+
if (!Qe.value) return;
|
|
1486
|
+
let t = performance.now(), n = t - X;
|
|
1409
1487
|
if (n > 0) {
|
|
1410
|
-
let t = (
|
|
1411
|
-
|
|
1488
|
+
let t = calculateInstantaneousVelocity(Y, {
|
|
1489
|
+
x: e.clientX,
|
|
1490
|
+
y: e.clientY
|
|
1491
|
+
}, n);
|
|
1492
|
+
Z.x = Z.x * .2 + t.x * .8, Z.y = Z.y * .2 + t.y * .8;
|
|
1412
1493
|
}
|
|
1413
|
-
|
|
1494
|
+
Y = {
|
|
1414
1495
|
x: e.clientX,
|
|
1415
1496
|
y: e.clientY
|
|
1416
|
-
},
|
|
1417
|
-
let r =
|
|
1497
|
+
}, X = t;
|
|
1498
|
+
let r = q.x - e.clientX, i = q.y - e.clientY;
|
|
1418
1499
|
requestAnimationFrame(() => {
|
|
1419
|
-
|
|
1500
|
+
ye(J.x + r, J.y + i, { behavior: "auto" });
|
|
1420
1501
|
});
|
|
1421
1502
|
}
|
|
1422
|
-
function
|
|
1423
|
-
|
|
1503
|
+
function Q(e) {
|
|
1504
|
+
Qe.value && (Qe.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), et()));
|
|
1424
1505
|
}
|
|
1425
|
-
function
|
|
1426
|
-
let { scrollOffset: t } =
|
|
1427
|
-
if (
|
|
1506
|
+
function it(e) {
|
|
1507
|
+
let { scrollOffset: t } = F.value;
|
|
1508
|
+
if (R(), U.value) {
|
|
1428
1509
|
e.preventDefault();
|
|
1429
|
-
let
|
|
1430
|
-
e.shiftKey && n === 0 && (n = r, r = 0),
|
|
1510
|
+
let { deltaX: n, deltaY: r } = e;
|
|
1511
|
+
e.shiftKey && n === 0 && (n = r, r = 0), ye(t.x + n, t.y + r, { behavior: "auto" });
|
|
1431
1512
|
}
|
|
1432
1513
|
}
|
|
1433
|
-
function
|
|
1434
|
-
let { viewportSize: t, scrollOffset: n } =
|
|
1514
|
+
function at(e) {
|
|
1515
|
+
let { viewportSize: t, scrollOffset: n } = F.value, r = _.direction !== "vertical", i = _.direction !== "horizontal", a = M.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
|
+
let r = (e ? n.x : n.y) + (e ? t.width : t.height) / 2;
|
|
1517
|
+
return e ? Ve(r) : H(r);
|
|
1518
|
+
}, { currentIndex: p, currentEndIndex: m, currentColIndex: h, currentEndColIndex: g } = F.value, v = (e, t) => {
|
|
1519
|
+
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
|
+
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
|
+
}, y = (e, r) => {
|
|
1522
|
+
let i = !e;
|
|
1523
|
+
if (d === "center") {
|
|
1524
|
+
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
|
+
L(e ? a : null, i ? a : null, { align: "center" });
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
if (e) if (r) if (d === "start") L(Math.min(_.items.length - 1, p + 1), null, { align: "start" });
|
|
1529
|
+
else {
|
|
1530
|
+
let e = d || "end", r = n.y + t.height - (s.y + l.y);
|
|
1531
|
+
we(m) + ve(m) > r + 1 ? L(m, null, { align: e }) : m < _.items.length - 1 && L(m + 1, null, { align: e });
|
|
1532
|
+
}
|
|
1533
|
+
else if (d === "end") L(Math.max(0, m - 1), null, { align: "end" });
|
|
1534
|
+
else {
|
|
1535
|
+
let e = d || "start", t = n.y + o.y + c.y;
|
|
1536
|
+
we(p) < t - 1 ? L(p, null, { align: e }) : p > 0 && L(p - 1, null, { align: e });
|
|
1537
|
+
}
|
|
1538
|
+
else {
|
|
1539
|
+
let e = _.columnCount ? _.columnCount - 1 : _.items.length - 1;
|
|
1540
|
+
if (me.value ? !r : r) if (d === "start") L(null, Math.min(e, h + 1), { align: "start" });
|
|
1541
|
+
else {
|
|
1542
|
+
let r = d || "end", i = n.x + t.width - (s.x + l.x);
|
|
1543
|
+
(_.columnCount ? Te(g) + I(g) : Ce(g) + De(g)) > i + 1 ? L(null, g, { align: r }) : g < e && L(null, g + 1, { align: r });
|
|
1544
|
+
}
|
|
1545
|
+
else if (d === "end") L(null, Math.max(0, g - 1), { align: "end" });
|
|
1546
|
+
else {
|
|
1547
|
+
let e = d || "start", t = n.x + o.x + c.x;
|
|
1548
|
+
(_.columnCount ? Te(h) : Ce(h)) < t - 1 ? L(null, h, { align: e }) : h > 0 && L(null, h - 1, { align: e });
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
};
|
|
1435
1552
|
switch (e.key) {
|
|
1436
1553
|
case "Home":
|
|
1437
|
-
e.preventDefault(),
|
|
1554
|
+
e.preventDefault(), R(), L(0, 0, {
|
|
1438
1555
|
behavior: Math.max(n.x, n.y) > 10 * (_.direction === "horizontal" ? t.width : t.height) ? "auto" : "smooth",
|
|
1439
1556
|
align: "start"
|
|
1440
1557
|
});
|
|
1441
1558
|
break;
|
|
1442
1559
|
case "End": {
|
|
1443
|
-
e.preventDefault(),
|
|
1444
|
-
let r = _.items.length - 1, i = (_.columnCount || 0) > 0 ? _.columnCount - 1 : 0, { totalSize: a } =
|
|
1445
|
-
_.direction === "both" ?
|
|
1560
|
+
e.preventDefault(), R();
|
|
1561
|
+
let r = _.items.length - 1, i = (_.columnCount || 0) > 0 ? _.columnCount - 1 : 0, { totalSize: a } = F.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";
|
|
1562
|
+
_.direction === "both" ? L(r, i, {
|
|
1446
1563
|
behavior: o,
|
|
1447
1564
|
align: "end"
|
|
1448
|
-
}) :
|
|
1565
|
+
}) : L(_.direction === "vertical" ? r : 0, _.direction === "horizontal" ? r : 0, {
|
|
1449
1566
|
behavior: o,
|
|
1450
1567
|
align: "end"
|
|
1451
1568
|
});
|
|
1452
1569
|
break;
|
|
1453
1570
|
}
|
|
1454
|
-
case "ArrowUp":
|
|
1455
|
-
|
|
1456
|
-
let { currentIndex: t, scrollOffset: n } = R.value, r = n.y + a.y + F.value.scrollPaddingStart.y;
|
|
1457
|
-
Ee(t) < r - 1 ? V(t, null, { align: "start" }) : t > 0 && V(t - 1, null, { align: "start" });
|
|
1571
|
+
case "ArrowUp":
|
|
1572
|
+
e.preventDefault(), R(), i && y(!0, !1);
|
|
1458
1573
|
break;
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
if (e.preventDefault(), G(), !i) return;
|
|
1462
|
-
let { currentEndIndex: r } = R.value, a = n.y + t.height - (o.y + F.value.scrollPaddingEnd.y);
|
|
1463
|
-
Ee(r) + pe(r) > a + 1 ? V(r, null, { align: "end" }) : r < _.items.length - 1 && V(r + 1, null, { align: "end" });
|
|
1574
|
+
case "ArrowDown":
|
|
1575
|
+
e.preventDefault(), R(), i && y(!0, !0);
|
|
1464
1576
|
break;
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
if (e.preventDefault(), G(), !r) return;
|
|
1468
|
-
let { currentColIndex: i, currentEndColIndex: s } = R.value;
|
|
1469
|
-
if (I.value) {
|
|
1470
|
-
let e = n.x + t.width - (o.x + F.value.scrollPaddingEnd.x);
|
|
1471
|
-
(_.columnCount ? U(s) + B(s) : ye(s) + De(s)) > e + 1 ? V(null, s, { align: "end" }) : s < (_.columnCount ? _.columnCount - 1 : _.items.length - 1) && V(null, s + 1, { align: "end" });
|
|
1472
|
-
} else {
|
|
1473
|
-
let e = n.x + a.x + F.value.scrollPaddingStart.x;
|
|
1474
|
-
(_.columnCount ? U(i) : ye(i)) < e - 1 ? V(null, i, { align: "start" }) : i > 0 && V(null, i - 1, { align: "start" });
|
|
1475
|
-
}
|
|
1577
|
+
case "ArrowLeft":
|
|
1578
|
+
e.preventDefault(), R(), r && y(!1, !1);
|
|
1476
1579
|
break;
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
if (e.preventDefault(), G(), !r) return;
|
|
1480
|
-
let { currentColIndex: i, currentEndColIndex: s } = R.value;
|
|
1481
|
-
if (I.value) {
|
|
1482
|
-
let e = n.x + a.x + F.value.scrollPaddingStart.x;
|
|
1483
|
-
(_.columnCount ? U(i) : ye(i)) < e - 1 ? V(null, i, { align: "start" }) : i > 0 && V(null, i - 1, { align: "start" });
|
|
1484
|
-
} else {
|
|
1485
|
-
let e = n.x + t.width - (o.x + F.value.scrollPaddingEnd.x);
|
|
1486
|
-
(_.columnCount ? U(s) + B(s) : ye(s) + De(s)) > e + 1 ? V(null, s, { align: "end" }) : s < (_.columnCount ? _.columnCount - 1 : _.items.length - 1) && V(null, s + 1, { align: "end" });
|
|
1487
|
-
}
|
|
1580
|
+
case "ArrowRight":
|
|
1581
|
+
e.preventDefault(), R(), r && y(!1, !0);
|
|
1488
1582
|
break;
|
|
1489
|
-
}
|
|
1490
1583
|
case "PageUp":
|
|
1491
|
-
e.preventDefault(),
|
|
1584
|
+
e.preventDefault(), R(), _.direction === "horizontal" ? L(null, v(!1, !1), { align: d || "end" }) : L(v(!0, !1), null, { align: d || "end" });
|
|
1492
1585
|
break;
|
|
1493
1586
|
case "PageDown":
|
|
1494
|
-
e.preventDefault(),
|
|
1587
|
+
e.preventDefault(), R(), _.direction === "horizontal" ? L(null, v(!1, !0), { align: d || "start" }) : L(v(!0, !0), null, { align: d || "start" });
|
|
1495
1588
|
break;
|
|
1496
1589
|
}
|
|
1497
1590
|
}
|
|
1498
1591
|
onUnmounted(() => {
|
|
1499
|
-
|
|
1592
|
+
W?.disconnect(), G?.disconnect(), K?.disconnect();
|
|
1500
1593
|
});
|
|
1501
|
-
let
|
|
1594
|
+
let ot = computed(() => {
|
|
1502
1595
|
let e = { ..._.direction === "vertical" ? {} : { whiteSpace: "nowrap" } };
|
|
1503
|
-
return (
|
|
1596
|
+
return (He.value || !Me.value) && (e.overflow = "auto"), U.value && (e.touchAction = "none"), Me.value ? e : _.containerTag === "table" ? {
|
|
1504
1597
|
...e,
|
|
1505
1598
|
display: "block",
|
|
1506
1599
|
minInlineSize: _.direction === "vertical" ? "100%" : "auto"
|
|
1507
1600
|
} : e;
|
|
1508
|
-
})
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
thumbProps: Y.thumbProps.value,
|
|
1530
|
-
scrollbarProps: n,
|
|
1531
|
-
isDragging: Y.isDragging.value
|
|
1601
|
+
});
|
|
1602
|
+
function st(e, t, n, r, i, a) {
|
|
1603
|
+
return t <= r ? null : {
|
|
1604
|
+
axis: e,
|
|
1605
|
+
positionPercent: a.positionPercent.value,
|
|
1606
|
+
viewportPercent: a.viewportPercent.value,
|
|
1607
|
+
thumbSizePercent: a.thumbSizePercent.value,
|
|
1608
|
+
thumbPositionPercent: a.thumbPositionPercent.value,
|
|
1609
|
+
trackProps: a.trackProps.value,
|
|
1610
|
+
thumbProps: a.thumbProps.value,
|
|
1611
|
+
scrollbarProps: {
|
|
1612
|
+
axis: e,
|
|
1613
|
+
totalSize: t,
|
|
1614
|
+
position: n,
|
|
1615
|
+
viewportSize: r,
|
|
1616
|
+
scrollToOffset: i,
|
|
1617
|
+
containerId: oe.value,
|
|
1618
|
+
isRtl: me.value,
|
|
1619
|
+
ariaLabel: `${e === "vertical" ? "Vertical" : "Horizontal"} scroll`
|
|
1620
|
+
},
|
|
1621
|
+
isDragging: a.isDragging.value
|
|
1532
1622
|
};
|
|
1533
|
-
}
|
|
1623
|
+
}
|
|
1624
|
+
let ct = computed(() => {
|
|
1625
|
+
if (_.direction === "horizontal") return null;
|
|
1626
|
+
let { displayViewportSize: e, displayScrollOffset: t } = F.value;
|
|
1627
|
+
return st("vertical", ge.value, t.y, e.height, Ue, Ge);
|
|
1628
|
+
}), lt = computed(() => {
|
|
1534
1629
|
if (_.direction === "vertical") return null;
|
|
1535
|
-
let { displayViewportSize: e, displayScrollOffset: t } =
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
axis: "horizontal",
|
|
1539
|
-
totalSize: z.value,
|
|
1540
|
-
position: t.x,
|
|
1541
|
-
viewportSize: e.width,
|
|
1542
|
-
scrollToOffset: J,
|
|
1543
|
-
containerId: P.value,
|
|
1544
|
-
isRtl: I.value,
|
|
1545
|
-
ariaLabel: "Horizontal scroll"
|
|
1546
|
-
};
|
|
1547
|
-
return {
|
|
1548
|
-
axis: "horizontal",
|
|
1549
|
-
positionPercent: Fe.positionPercent.value,
|
|
1550
|
-
viewportPercent: Fe.viewportPercent.value,
|
|
1551
|
-
thumbSizePercent: Fe.thumbSizePercent.value,
|
|
1552
|
-
thumbPositionPercent: Fe.thumbPositionPercent.value,
|
|
1553
|
-
trackProps: Fe.trackProps.value,
|
|
1554
|
-
thumbProps: Fe.thumbProps.value,
|
|
1555
|
-
scrollbarProps: n,
|
|
1556
|
-
isDragging: Fe.isDragging.value
|
|
1557
|
-
};
|
|
1558
|
-
}), rt = computed(() => {
|
|
1630
|
+
let { displayViewportSize: e, displayScrollOffset: t } = F.value;
|
|
1631
|
+
return st("horizontal", _e.value, t.x, e.width, We, Ke);
|
|
1632
|
+
}), ut = computed(() => {
|
|
1559
1633
|
let e = _.direction === "horizontal", t = _.direction === "vertical", n = _.direction === "both", r = {
|
|
1560
|
-
inlineSize: t ? "100%" : `${
|
|
1561
|
-
blockSize: e ? "100%" : `${
|
|
1634
|
+
inlineSize: t ? "100%" : `${V.value}px`,
|
|
1635
|
+
blockSize: e ? "100%" : `${Be.value}px`
|
|
1562
1636
|
};
|
|
1563
|
-
return
|
|
1564
|
-
}),
|
|
1637
|
+
return N.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
|
+
}), dt = computed(() => {
|
|
1565
1639
|
let e = _.direction === "horizontal";
|
|
1566
1640
|
return {
|
|
1567
1641
|
display: e ? "inline-block" : "block",
|
|
@@ -1570,120 +1644,122 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1570
1644
|
verticalAlign: "top"
|
|
1571
1645
|
} : { inlineSize: "100%" }
|
|
1572
1646
|
};
|
|
1573
|
-
}),
|
|
1574
|
-
inlineSize: _.direction === "vertical" ? "1px" : `${
|
|
1575
|
-
blockSize: _.direction === "horizontal" ? "1px" : `${
|
|
1647
|
+
}), ft = computed(() => ({
|
|
1648
|
+
inlineSize: _.direction === "vertical" ? "1px" : `${V.value}px`,
|
|
1649
|
+
blockSize: _.direction === "horizontal" ? "1px" : `${Be.value}px`
|
|
1576
1650
|
}));
|
|
1577
|
-
function
|
|
1651
|
+
function pt(e) {
|
|
1578
1652
|
let t = calculateItemStyle({
|
|
1579
1653
|
containerTag: _.containerTag || "div",
|
|
1580
1654
|
direction: _.direction,
|
|
1581
|
-
isHydrated:
|
|
1655
|
+
isHydrated: N.value,
|
|
1582
1656
|
item: e,
|
|
1583
1657
|
itemSize: _.itemSize,
|
|
1584
|
-
paddingStartX:
|
|
1585
|
-
paddingStartY:
|
|
1586
|
-
isRtl:
|
|
1658
|
+
paddingStartX: M.value.scrollPaddingStart.x,
|
|
1659
|
+
paddingStartY: M.value.scrollPaddingStart.y,
|
|
1660
|
+
isRtl: me.value
|
|
1587
1661
|
});
|
|
1588
|
-
return !
|
|
1662
|
+
return !N.value && _.direction === "both" && (t.display = "flex", _.columnGap && (t.columnGap = `${_.columnGap}px`)), t;
|
|
1589
1663
|
}
|
|
1590
|
-
let
|
|
1591
|
-
if (
|
|
1592
|
-
let e =
|
|
1664
|
+
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
|
+
if (vt.value) return "row";
|
|
1666
|
+
let e = _t.value;
|
|
1593
1667
|
return e === "tree" ? "treeitem" : e === "listbox" ? "option" : e === "menu" ? "menuitem" : "listitem";
|
|
1594
|
-
}),
|
|
1595
|
-
let e =
|
|
1668
|
+
}), St = computed(() => _.itemRole == null ? xt.value : _.itemRole), Ct = computed(() => _.role === "grid" || !_.role && _.direction === "both" ? "gridcell" : $.value ? "cell" : null), wt = computed(() => {
|
|
1669
|
+
let e = St.value;
|
|
1596
1670
|
return e == null || e !== "none" && e !== "presentation";
|
|
1597
|
-
}),
|
|
1671
|
+
}), Tt = computed(() => ({
|
|
1598
1672
|
"aria-label": _.ariaLabel,
|
|
1599
1673
|
"aria-labelledby": _.ariaLabelledby,
|
|
1600
1674
|
"aria-busy": _.loading ? "true" : void 0
|
|
1601
|
-
})),
|
|
1602
|
-
let e = {}, t =
|
|
1675
|
+
})), Et = computed(() => {
|
|
1676
|
+
let e = {}, t = _t.value;
|
|
1603
1677
|
return t && [
|
|
1604
1678
|
"grid",
|
|
1605
1679
|
"tree",
|
|
1606
1680
|
"listbox",
|
|
1607
1681
|
"menu",
|
|
1608
1682
|
"tablist"
|
|
1609
|
-
].includes(t) && (e["aria-orientation"] = _.direction === "both" ? void 0 : _.direction),
|
|
1683
|
+
].includes(t) && (e["aria-orientation"] = _.direction === "both" ? void 0 : _.direction), vt.value && (e["aria-rowcount"] = _.items.length, _.columnCount > 0 && (e["aria-colcount"] = _.columnCount)), e;
|
|
1610
1684
|
});
|
|
1611
|
-
function
|
|
1685
|
+
function Dt(e) {
|
|
1612
1686
|
let t = {};
|
|
1613
|
-
|
|
1614
|
-
let n =
|
|
1615
|
-
return n !== null && (t.role = n === "none" || n === "presentation" ?
|
|
1687
|
+
vt.value ? t["aria-rowindex"] = e + 1 : (t["aria-setsize"] = _.items.length, t["aria-posinset"] = e + 1);
|
|
1688
|
+
let n = St.value;
|
|
1689
|
+
return n !== null && (t.role = n === "none" || n === "presentation" ? xt.value : n), t;
|
|
1616
1690
|
}
|
|
1617
|
-
function
|
|
1618
|
-
let t =
|
|
1691
|
+
function Ot(e) {
|
|
1692
|
+
let t = Ct.value;
|
|
1619
1693
|
if (!t) return {};
|
|
1620
1694
|
let n = { role: t };
|
|
1621
|
-
return
|
|
1695
|
+
return vt.value && (n["aria-colindex"] = e + 1), n;
|
|
1622
1696
|
}
|
|
1623
1697
|
return s({
|
|
1624
1698
|
...toRefs(_),
|
|
1625
|
-
scrollDetails:
|
|
1626
|
-
columnRange:
|
|
1627
|
-
getColumnWidth:
|
|
1628
|
-
getRowHeight:
|
|
1629
|
-
getCellAriaProps:
|
|
1630
|
-
getItemAriaProps:
|
|
1631
|
-
getRowOffset:
|
|
1632
|
-
getColumnOffset:
|
|
1633
|
-
getItemOffset:
|
|
1699
|
+
scrollDetails: F,
|
|
1700
|
+
columnRange: P,
|
|
1701
|
+
getColumnWidth: I,
|
|
1702
|
+
getRowHeight: ve,
|
|
1703
|
+
getCellAriaProps: Ot,
|
|
1704
|
+
getItemAriaProps: Dt,
|
|
1705
|
+
getRowOffset: we,
|
|
1706
|
+
getColumnOffset: Te,
|
|
1707
|
+
getItemOffset: Ce,
|
|
1634
1708
|
getItemSize: De,
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1709
|
+
getRowIndexAt: H,
|
|
1710
|
+
getColIndexAt: Ve,
|
|
1711
|
+
scrollToIndex: L,
|
|
1712
|
+
scrollToOffset: ye,
|
|
1713
|
+
refresh: Je,
|
|
1638
1714
|
stopProgrammaticScroll: () => {
|
|
1639
|
-
|
|
1715
|
+
R(), tt();
|
|
1640
1716
|
},
|
|
1641
|
-
updateDirection:
|
|
1642
|
-
isRtl:
|
|
1643
|
-
isHydrated:
|
|
1644
|
-
scaleX:
|
|
1645
|
-
scaleY:
|
|
1646
|
-
renderedWidth:
|
|
1647
|
-
renderedHeight:
|
|
1648
|
-
componentOffset:
|
|
1649
|
-
scrollbarPropsVertical:
|
|
1650
|
-
scrollbarPropsHorizontal:
|
|
1717
|
+
updateDirection: Se,
|
|
1718
|
+
isRtl: me,
|
|
1719
|
+
isHydrated: N,
|
|
1720
|
+
scaleX: Ae,
|
|
1721
|
+
scaleY: je,
|
|
1722
|
+
renderedWidth: _e,
|
|
1723
|
+
renderedHeight: ge,
|
|
1724
|
+
componentOffset: Ne,
|
|
1725
|
+
scrollbarPropsVertical: ct,
|
|
1726
|
+
scrollbarPropsHorizontal: lt
|
|
1651
1727
|
}), (t, s) => (openBlock(), createBlock(resolveDynamicComponent(o.containerTag), mergeProps({
|
|
1652
|
-
id:
|
|
1728
|
+
id: oe.value,
|
|
1653
1729
|
ref_key: "hostRef",
|
|
1654
|
-
ref:
|
|
1730
|
+
ref: D,
|
|
1655
1731
|
class: ["virtual-scroll-container", [`virtual-scroll--${o.direction}`, {
|
|
1656
|
-
"virtual-scroll--hydrated": unref(
|
|
1657
|
-
"virtual-scroll--window": unref(
|
|
1732
|
+
"virtual-scroll--hydrated": unref(N),
|
|
1733
|
+
"virtual-scroll--window": unref(Me),
|
|
1658
1734
|
"virtual-scroll--table": $.value,
|
|
1659
|
-
"virtual-scroll--hide-scrollbar":
|
|
1735
|
+
"virtual-scroll--hide-scrollbar": He.value
|
|
1660
1736
|
}]],
|
|
1661
|
-
style:
|
|
1737
|
+
style: ot.value,
|
|
1662
1738
|
tabindex: "0",
|
|
1663
|
-
role: $.value ? void 0 :
|
|
1739
|
+
role: $.value ? void 0 : yt.value
|
|
1664
1740
|
}, $.value ? {
|
|
1665
|
-
...
|
|
1666
|
-
...
|
|
1667
|
-
} :
|
|
1668
|
-
onKeydown:
|
|
1669
|
-
onPointerdown:
|
|
1670
|
-
onPointermove:
|
|
1671
|
-
onPointerup:
|
|
1672
|
-
onPointercancel:
|
|
1741
|
+
...Tt.value,
|
|
1742
|
+
...Et.value
|
|
1743
|
+
} : Tt.value, {
|
|
1744
|
+
onKeydown: at,
|
|
1745
|
+
onPointerdown: nt,
|
|
1746
|
+
onPointermove: rt,
|
|
1747
|
+
onPointerup: Q,
|
|
1748
|
+
onPointercancel: Q
|
|
1673
1749
|
}), {
|
|
1674
1750
|
default: withCtx(() => [
|
|
1675
|
-
|
|
1751
|
+
He.value ? (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", {
|
|
1676
1752
|
class: "virtual-scroll-scrollbar-viewport",
|
|
1677
1753
|
style: normalizeStyle({
|
|
1678
|
-
inlineSize: `${unref(
|
|
1679
|
-
blockSize: `${unref(
|
|
1754
|
+
inlineSize: `${unref(F).displayViewportSize.width}px`,
|
|
1755
|
+
blockSize: `${unref(F).displayViewportSize.height}px`,
|
|
1680
1756
|
"--vsi-scrollbar-has-cross-gap": o.direction === "both" ? 1 : 0
|
|
1681
1757
|
})
|
|
1682
|
-
}, [
|
|
1683
|
-
|
|
1758
|
+
}, [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
|
+
T.header ? (openBlock(), createBlock(resolveDynamicComponent(ht.value), {
|
|
1684
1760
|
key: 1,
|
|
1685
1761
|
ref_key: "headerRef",
|
|
1686
|
-
ref:
|
|
1762
|
+
ref: k,
|
|
1687
1763
|
class: normalizeClass(["virtual-scroll-header", { "virtual-scroll--sticky": o.stickyHeader }]),
|
|
1688
1764
|
role: $.value ? void 0 : "none"
|
|
1689
1765
|
}, {
|
|
@@ -1692,15 +1768,15 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1692
1768
|
}, 8, ["class", "role"])) : createCommentVNode("", !0),
|
|
1693
1769
|
(openBlock(), createBlock(resolveDynamicComponent(o.wrapperTag), mergeProps({
|
|
1694
1770
|
ref_key: "wrapperRef",
|
|
1695
|
-
ref:
|
|
1771
|
+
ref: O,
|
|
1696
1772
|
class: "virtual-scroll-wrapper",
|
|
1697
|
-
style:
|
|
1698
|
-
role: $.value ? void 0 :
|
|
1699
|
-
}, $.value ? {} :
|
|
1773
|
+
style: ut.value,
|
|
1774
|
+
role: $.value ? void 0 : bt.value
|
|
1775
|
+
}, $.value ? {} : Et.value), {
|
|
1700
1776
|
default: withCtx(() => [$.value ? (openBlock(), createBlock(resolveDynamicComponent(o.itemTag), {
|
|
1701
1777
|
key: 0,
|
|
1702
1778
|
class: "virtual-scroll-spacer",
|
|
1703
|
-
style: normalizeStyle(
|
|
1779
|
+
style: normalizeStyle(ft.value)
|
|
1704
1780
|
}, {
|
|
1705
1781
|
default: withCtx(() => [...s[0] ||= [createElementVNode("td", { style: {
|
|
1706
1782
|
padding: "0",
|
|
@@ -1708,24 +1784,24 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1708
1784
|
"block-size": "inherit"
|
|
1709
1785
|
} }, null, -1)]]),
|
|
1710
1786
|
_: 1
|
|
1711
|
-
}, 8, ["style"])) : createCommentVNode("", !0), (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(
|
|
1787
|
+
}, 8, ["style"])) : createCommentVNode("", !0), (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(he), (e) => (openBlock(), createBlock(resolveDynamicComponent(o.itemTag), mergeProps({
|
|
1712
1788
|
key: e.index,
|
|
1713
1789
|
ref_for: !0,
|
|
1714
|
-
ref: (t) =>
|
|
1790
|
+
ref: (t) => Ze(t, e.index),
|
|
1715
1791
|
"data-index": e.index,
|
|
1716
1792
|
class: ["virtual-scroll-item", {
|
|
1717
1793
|
"virtual-scroll--sticky": e.isStickyActive,
|
|
1718
|
-
"virtual-scroll--debug":
|
|
1794
|
+
"virtual-scroll--debug": mt.value
|
|
1719
1795
|
}],
|
|
1720
|
-
style:
|
|
1721
|
-
}, { ref_for: !0 },
|
|
1796
|
+
style: pt(e)
|
|
1797
|
+
}, { ref_for: !0 }, wt.value ? Dt(e.index) : { role: "none" }), {
|
|
1722
1798
|
default: withCtx(() => [renderSlot(t.$slots, "item", {
|
|
1723
1799
|
item: e.item,
|
|
1724
1800
|
index: e.index,
|
|
1725
|
-
getItemAriaProps:
|
|
1726
|
-
columnRange:
|
|
1727
|
-
getColumnWidth: unref(
|
|
1728
|
-
getCellAriaProps:
|
|
1801
|
+
getItemAriaProps: Dt,
|
|
1802
|
+
columnRange: qe.value,
|
|
1803
|
+
getColumnWidth: unref(I),
|
|
1804
|
+
getCellAriaProps: Ot,
|
|
1729
1805
|
gap: _.gap,
|
|
1730
1806
|
columnGap: _.columnGap,
|
|
1731
1807
|
isSticky: e.isSticky,
|
|
@@ -1733,7 +1809,7 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1733
1809
|
isStickyActiveX: e.isStickyActiveX,
|
|
1734
1810
|
isStickyActiveY: e.isStickyActiveY,
|
|
1735
1811
|
offset: e.offset
|
|
1736
|
-
}, void 0, !0),
|
|
1812
|
+
}, void 0, !0), mt.value ? (openBlock(), createElementBlock("div", _hoisted_2, " #" + toDisplayString(e.index) + " (" + toDisplayString(Math.round(e.offset.x)) + ", " + toDisplayString(Math.round(e.offset.y)) + ") ", 1)) : createCommentVNode("", !0)]),
|
|
1737
1813
|
_: 2
|
|
1738
1814
|
}, 1040, [
|
|
1739
1815
|
"data-index",
|
|
@@ -1742,17 +1818,17 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1742
1818
|
]))), 128))]),
|
|
1743
1819
|
_: 3
|
|
1744
1820
|
}, 16, ["style", "role"])),
|
|
1745
|
-
o.loading &&
|
|
1821
|
+
o.loading && T.loading ? (openBlock(), createElementBlock("div", {
|
|
1746
1822
|
key: 2,
|
|
1747
1823
|
class: "virtual-scroll-loading",
|
|
1748
|
-
style: normalizeStyle(
|
|
1824
|
+
style: normalizeStyle(dt.value),
|
|
1749
1825
|
"aria-live": "polite",
|
|
1750
1826
|
"aria-atomic": "true"
|
|
1751
1827
|
}, [renderSlot(t.$slots, "loading", {}, void 0, !0)], 4)) : createCommentVNode("", !0),
|
|
1752
|
-
|
|
1828
|
+
T.footer ? (openBlock(), createBlock(resolveDynamicComponent(gt.value), {
|
|
1753
1829
|
key: 3,
|
|
1754
1830
|
ref_key: "footerRef",
|
|
1755
|
-
ref:
|
|
1831
|
+
ref: ae,
|
|
1756
1832
|
class: normalizeClass(["virtual-scroll-footer", { "virtual-scroll--sticky": o.stickyFooter }]),
|
|
1757
1833
|
role: $.value ? void 0 : "none"
|
|
1758
1834
|
}, {
|
|
@@ -1768,7 +1844,7 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1768
1844
|
"role"
|
|
1769
1845
|
]));
|
|
1770
1846
|
}
|
|
1771
|
-
}), [["__scopeId", "data-v-
|
|
1772
|
-
export { BROWSER_MAX_SIZE, DEFAULT_BUFFER, DEFAULT_COLUMN_WIDTH, DEFAULT_ITEM_SIZE, EMPTY_SCROLL_DETAILS, FenwickTree, VirtualScroll_default as VirtualScroll, VirtualScrollbar_default as VirtualScrollbar, calculateColumnRange, calculateItemPosition, calculateItemStyle, calculateRange, calculateScrollTarget, calculateStickyItem, calculateTotalSize, displayToVirtual, findPrevStickyIndex, getPaddingX, getPaddingY, isBody, isElement, isItemVisible, isScrollToIndexOptions, isScrollableElement, isWindow, isWindowLike, scrollTo, useVirtualScroll, useVirtualScrollbar, virtualToDisplay };
|
|
1847
|
+
}), [["__scopeId", "data-v-55dd91b2"]]);
|
|
1848
|
+
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 };
|
|
1773
1849
|
|
|
1774
1850
|
//# sourceMappingURL=index.mjs.map
|