@pdanpdan/virtual-scroll 0.10.1 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +553 -522
- package/dist/index.mjs.map +1 -1
- package/dist/virtual-scroll.css +1 -1
- package/package.json +1 -1
- package/src/components/VirtualScroll.vue +1 -1
- package/src/composables/useVirtualScroll.ts +60 -16
- package/src/composables/useVirtualScrollSizes.ts +1 -1
- package/src/extensions/sticky.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, getCurrentInstance, guardReactiveProps, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onMounted, onUnmounted, openBlock, reactive, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toRefs, toValue, unref, useId, useSlots, watch, watchEffect, withCtx } from "vue";
|
|
2
|
-
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, getCurrentInstance as s, guardReactiveProps as c, mergeProps as l, nextTick as u, normalizeClass as d, normalizeProps as f, normalizeStyle as p, onMounted as m, onUnmounted as h, openBlock as g, reactive as _, ref as v, renderList as y, renderSlot as b, resolveDynamicComponent as x, shallowRef as S, toDisplayString as C, toRefs as w, toValue as T, unref as E, useId as ee, useSlots as te, watch as D, watchEffect as O, withCtx as k } from "vue";
|
|
2
|
+
//#region src/types.ts
|
|
3
|
+
var A = 40, ne = 100, re = 5, j = {
|
|
3
4
|
items: [],
|
|
4
5
|
currentIndex: 0,
|
|
5
6
|
currentColIndex: 0,
|
|
@@ -37,35 +38,37 @@ const DEFAULT_ITEM_SIZE = 40, DEFAULT_COLUMN_WIDTH = 100, DEFAULT_BUFFER = 5, EM
|
|
|
37
38
|
padStart: 0,
|
|
38
39
|
padEnd: 0
|
|
39
40
|
}
|
|
40
|
-
},
|
|
41
|
-
function
|
|
41
|
+
}, M = 1e7;
|
|
42
|
+
function N(e) {
|
|
42
43
|
return e === null || typeof document < "u" && e === document.documentElement || typeof window < "u" && e === window;
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function ie(e) {
|
|
45
46
|
return typeof e == "object" && !!e && "tagName" in e && e.tagName === "BODY";
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
48
|
+
function ae(e) {
|
|
49
|
+
return N(e) || ie(e);
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function P(e) {
|
|
51
52
|
return e != null && "getBoundingClientRect" in e;
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function oe(e) {
|
|
54
55
|
return e != null && "scrollLeft" in e;
|
|
55
56
|
}
|
|
56
|
-
function
|
|
57
|
-
|
|
57
|
+
function se(e, t) {
|
|
58
|
+
N(e) ? window.scrollTo(t) : e != null && oe(e) && (typeof e.scrollTo == "function" ? e.scrollTo(t) : (t.left !== void 0 && (e.scrollLeft = t.left), t.top !== void 0 && (e.scrollTop = t.top)));
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
+
function ce(e) {
|
|
60
61
|
return typeof e == "object" && !!e && ("align" in e || "behavior" in e || "isCorrection" in e || "dryRun" in e);
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function le(e, t) {
|
|
63
64
|
return typeof e == "object" && e ? e.x || 0 : (t === "horizontal" || t === "both") && e || 0;
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
+
function ue(e, t) {
|
|
66
67
|
return typeof e == "object" && e ? e.y || 0 : (t === "vertical" || t === "both") && e || 0;
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/utils/virtual-scroll-logic.ts
|
|
71
|
+
function F({ scrollPos: e, containerSize: t, count: n, bufferBefore: r, bufferAfter: i, gap: a, fixedSize: o, findLowerBound: s, query: c }) {
|
|
69
72
|
let l = 0, u = n, d = e + t;
|
|
70
73
|
if (o !== null) {
|
|
71
74
|
let t = o + a;
|
|
@@ -76,7 +79,7 @@ function calculateGenericRange({ scrollPos: e, containerSize: t, count: n, buffe
|
|
|
76
79
|
end: Math.min(n, u + i)
|
|
77
80
|
};
|
|
78
81
|
}
|
|
79
|
-
function
|
|
82
|
+
function I(e, t) {
|
|
80
83
|
let n = 0, r = e.length - 1, i;
|
|
81
84
|
for (; n <= r;) {
|
|
82
85
|
let a = n + r >>> 1;
|
|
@@ -84,7 +87,7 @@ function findNextStickyIndex(e, t) {
|
|
|
84
87
|
}
|
|
85
88
|
return i;
|
|
86
89
|
}
|
|
87
|
-
function
|
|
90
|
+
function de(e, t) {
|
|
88
91
|
let n = 0, r = e.length - 1, i;
|
|
89
92
|
for (; n <= r;) {
|
|
90
93
|
let a = n + r >>> 1;
|
|
@@ -92,7 +95,7 @@ function findPrevStickyIndex(e, t) {
|
|
|
92
95
|
}
|
|
93
96
|
return i;
|
|
94
97
|
}
|
|
95
|
-
function
|
|
98
|
+
function fe({ align: e, targetPos: t, itemSize: n, scrollPos: r, viewSize: i, stickyOffsetStart: a, stickyOffsetEnd: o }) {
|
|
96
99
|
let s = t - a, c = t - (i - o - n);
|
|
97
100
|
return e === "start" ? {
|
|
98
101
|
target: s,
|
|
@@ -103,7 +106,7 @@ function calculateAxisAlignment({ align: e, targetPos: t, itemSize: n, scrollPos
|
|
|
103
106
|
} : e === "end" ? {
|
|
104
107
|
target: c,
|
|
105
108
|
effectiveAlign: "end"
|
|
106
|
-
} :
|
|
109
|
+
} : pe(t, n, r, i, a, o) ? {
|
|
107
110
|
target: r,
|
|
108
111
|
effectiveAlign: "auto"
|
|
109
112
|
} : n <= i - a - o ? t < r + a ? {
|
|
@@ -120,23 +123,23 @@ function calculateAxisAlignment({ align: e, targetPos: t, itemSize: n, scrollPos
|
|
|
120
123
|
effectiveAlign: "end"
|
|
121
124
|
};
|
|
122
125
|
}
|
|
123
|
-
function
|
|
126
|
+
function L(e, t, n, r) {
|
|
124
127
|
return e <= 0 ? 0 : t === null ? Math.max(0, r(e) - n) : Math.max(0, e * (t + n) - n);
|
|
125
128
|
}
|
|
126
|
-
function
|
|
129
|
+
function R(e, t, n, r, i) {
|
|
127
130
|
let a = t - e;
|
|
128
131
|
return a <= 0 ? 0 : n === null ? Math.max(0, i(t) - i(e) - r) : Math.max(0, a * (n + r) - r);
|
|
129
132
|
}
|
|
130
|
-
function
|
|
133
|
+
function z(e, t, n, r) {
|
|
131
134
|
return t === null ? r(e) : e * (t + n);
|
|
132
135
|
}
|
|
133
|
-
function
|
|
136
|
+
function B({ index: e, align: t, viewSize: n, scrollPos: r, fixedSize: i, gap: a, query: o, getSize: s, stickyIndices: c, stickyStart: l, stickyEnd: u = 0 }) {
|
|
134
137
|
let d = l;
|
|
135
138
|
if (c && c.length > 0) {
|
|
136
|
-
let t =
|
|
137
|
-
t !== void 0 && (d +=
|
|
139
|
+
let t = de(c, e);
|
|
140
|
+
t !== void 0 && (d += L(1, i, 0, () => s(t)));
|
|
138
141
|
}
|
|
139
|
-
let f = i === null ? o(e) : e * (i + a), p = i === null ? s(e) - a : i, { target: m, effectiveAlign: h } =
|
|
142
|
+
let f = i === null ? o(e) : e * (i + a), p = i === null ? s(e) - a : i, { target: m, effectiveAlign: h } = fe({
|
|
140
143
|
align: t,
|
|
141
144
|
targetPos: f,
|
|
142
145
|
itemSize: p,
|
|
@@ -151,12 +154,12 @@ function calculateAxisTarget({ index: e, align: t, viewSize: n, scrollPos: r, fi
|
|
|
151
154
|
effectiveAlign: h
|
|
152
155
|
};
|
|
153
156
|
}
|
|
154
|
-
function
|
|
157
|
+
function V(e, t, n, r, i, a, o) {
|
|
155
158
|
if (e <= t) return {
|
|
156
159
|
isActive: !1,
|
|
157
160
|
offset: 0
|
|
158
161
|
};
|
|
159
|
-
let s = o === void 0 ?
|
|
162
|
+
let s = o === void 0 ? I(i, r) : o;
|
|
160
163
|
if (s === void 0) return {
|
|
161
164
|
isActive: !0,
|
|
162
165
|
offset: 0
|
|
@@ -170,30 +173,30 @@ function calculateAxisSticky(e, t, n, r, i, a, o) {
|
|
|
170
173
|
offset: Math.max(0, Math.min(n, c - e)) - n
|
|
171
174
|
};
|
|
172
175
|
}
|
|
173
|
-
function
|
|
176
|
+
function pe(e, t, n, r, i = 0, a = 0) {
|
|
174
177
|
let o = n + i, s = n + r - a;
|
|
175
178
|
return t <= r - i - a ? e >= o - .5 && e + t <= s + .5 : e <= o + .5 && e + t >= s - .5;
|
|
176
179
|
}
|
|
177
|
-
function
|
|
180
|
+
function H(e, t, n) {
|
|
178
181
|
if (e || t <= 1e7) return 1;
|
|
179
|
-
let r = Math.min(t,
|
|
182
|
+
let r = Math.min(t, M), i = t - n, a = r - n;
|
|
180
183
|
return a > 0 ? i / a : 1;
|
|
181
184
|
}
|
|
182
|
-
function
|
|
183
|
-
return e ? t : Math.min(t,
|
|
185
|
+
function U(e, t) {
|
|
186
|
+
return e ? t : Math.min(t, M);
|
|
184
187
|
}
|
|
185
|
-
function
|
|
188
|
+
function me(e, t, n) {
|
|
186
189
|
return (e - t) * n;
|
|
187
190
|
}
|
|
188
|
-
function
|
|
191
|
+
function he(e, t, n) {
|
|
189
192
|
return e / n + t;
|
|
190
193
|
}
|
|
191
|
-
function
|
|
192
|
-
let
|
|
193
|
-
|
|
194
|
-
let
|
|
194
|
+
function ge({ 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: ee = 0, stickyEndY: te = 0, flowPaddingStartX: D = 0, flowPaddingStartY: O = 0, paddingStartX: k = 0, paddingStartY: A = 0, paddingEndX: ne = 0, paddingEndY: re = 0 }) {
|
|
195
|
+
let j;
|
|
196
|
+
j = ce(n) ? n.align : n;
|
|
197
|
+
let N = (j && typeof j == "object" ? j.x : j) || "auto", ie = (j && typeof j == "object" ? j.y : j) || "auto", ae = f, P = p, oe = 0, se = 0, le = "auto", ue = "auto", F = b === 1 ? o : M, I = x === 1 ? s : M, de = Math.max(0, S + F - i), fe = Math.max(0, C + I - a), L = (de - S) * b, R = (fe - C) * x, z = D + T + k, V = O + E + A;
|
|
195
198
|
if (e != null) {
|
|
196
|
-
let t =
|
|
199
|
+
let t = B({
|
|
197
200
|
index: e,
|
|
198
201
|
align: ie,
|
|
199
202
|
viewSize: a,
|
|
@@ -203,15 +206,15 @@ function calculateScrollTarget({ rowIndex: e, colIndex: t, options: n, direction
|
|
|
203
206
|
query: g,
|
|
204
207
|
getSize: m,
|
|
205
208
|
stickyIndices: w,
|
|
206
|
-
stickyStart: E +
|
|
207
|
-
stickyEnd:
|
|
209
|
+
stickyStart: E + A,
|
|
210
|
+
stickyEnd: te + re
|
|
208
211
|
});
|
|
209
|
-
|
|
212
|
+
P = t.target + V, se = t.itemSize, ue = t.effectiveAlign;
|
|
210
213
|
}
|
|
211
214
|
if (t != null) {
|
|
212
|
-
let e = r === "both", n =
|
|
215
|
+
let e = r === "both", n = B({
|
|
213
216
|
index: t,
|
|
214
|
-
align:
|
|
217
|
+
align: N,
|
|
215
218
|
viewSize: i,
|
|
216
219
|
scrollPos: f,
|
|
217
220
|
fixedSize: e ? d : u,
|
|
@@ -219,23 +222,23 @@ function calculateScrollTarget({ rowIndex: e, colIndex: t, options: n, direction
|
|
|
219
222
|
query: e ? y : _,
|
|
220
223
|
getSize: e ? v : h,
|
|
221
224
|
stickyIndices: w,
|
|
222
|
-
stickyStart: T +
|
|
223
|
-
stickyEnd:
|
|
225
|
+
stickyStart: T + k,
|
|
226
|
+
stickyEnd: ee + ne
|
|
224
227
|
});
|
|
225
|
-
ae = n.target +
|
|
228
|
+
ae = n.target + z, oe = n.itemSize, le = n.effectiveAlign;
|
|
226
229
|
}
|
|
227
|
-
return ae = Math.max(0, Math.min(ae, L)),
|
|
230
|
+
return ae = Math.max(0, Math.min(ae, L)), P = Math.max(0, Math.min(P, R)), {
|
|
228
231
|
targetX: ae,
|
|
229
|
-
targetY:
|
|
230
|
-
itemWidth:
|
|
231
|
-
itemHeight:
|
|
232
|
-
effectiveAlignX:
|
|
233
|
-
effectiveAlignY:
|
|
232
|
+
targetY: P,
|
|
233
|
+
itemWidth: oe,
|
|
234
|
+
itemHeight: se,
|
|
235
|
+
effectiveAlignX: le,
|
|
236
|
+
effectiveAlignY: ue
|
|
234
237
|
};
|
|
235
238
|
}
|
|
236
|
-
function
|
|
239
|
+
function _e({ 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 }) {
|
|
237
240
|
let h = e === "vertical" || e === "both";
|
|
238
|
-
return
|
|
241
|
+
return F({
|
|
239
242
|
scrollPos: h ? n : t,
|
|
240
243
|
containerSize: h ? i : r,
|
|
241
244
|
count: a,
|
|
@@ -247,14 +250,14 @@ function calculateRange({ direction: e, relativeScrollX: t, relativeScrollY: n,
|
|
|
247
250
|
query: h ? p : m
|
|
248
251
|
});
|
|
249
252
|
}
|
|
250
|
-
function
|
|
253
|
+
function ve({ columnCount: e, relativeScrollX: t, usableWidth: n, colBuffer: r, fixedWidth: i, columnGap: a, findLowerBound: o, query: s, totalColsQuery: c }) {
|
|
251
254
|
if (!e) return {
|
|
252
255
|
start: 0,
|
|
253
256
|
end: 0,
|
|
254
257
|
padStart: 0,
|
|
255
258
|
padEnd: 0
|
|
256
259
|
};
|
|
257
|
-
let { start: l, end: u } =
|
|
260
|
+
let { start: l, end: u } = F({
|
|
258
261
|
scrollPos: t,
|
|
259
262
|
containerSize: n,
|
|
260
263
|
count: e,
|
|
@@ -272,7 +275,7 @@ function calculateColumnRange({ columnCount: e, relativeScrollX: t, usableWidth:
|
|
|
272
275
|
padEnd: Math.max(0, m - h)
|
|
273
276
|
};
|
|
274
277
|
}
|
|
275
|
-
function
|
|
278
|
+
function ye({ index: e, isSticky: t, direction: n, relativeScrollX: r, relativeScrollY: i, originalX: a, originalY: o, width: s, height: c, stickyIndices: l, fixedSize: u, gap: d, columnGap: f, getItemQueryY: p, getItemQueryX: m, nextStickyIndex: h }) {
|
|
276
279
|
let g = !1, _ = !1, v = {
|
|
277
280
|
x: 0,
|
|
278
281
|
y: 0
|
|
@@ -284,11 +287,11 @@ function calculateStickyItem({ index: e, isSticky: t, direction: n, relativeScro
|
|
|
284
287
|
stickyOffset: v
|
|
285
288
|
};
|
|
286
289
|
if (n === "vertical" || n === "both") {
|
|
287
|
-
let t =
|
|
290
|
+
let t = V(i, o, c, e, l, (e) => u === null ? p(e) : e * (u + d), h);
|
|
288
291
|
_ = t.isActive, v.y = t.offset;
|
|
289
292
|
}
|
|
290
293
|
if (n === "horizontal") {
|
|
291
|
-
let t =
|
|
294
|
+
let t = V(r, a, s, e, l, (e) => u === null ? m(e) : e * (u + f), h);
|
|
292
295
|
t.isActive && (g = !0, v.x = t.offset);
|
|
293
296
|
}
|
|
294
297
|
return {
|
|
@@ -298,7 +301,7 @@ function calculateStickyItem({ index: e, isSticky: t, direction: n, relativeScro
|
|
|
298
301
|
stickyOffset: v
|
|
299
302
|
};
|
|
300
303
|
}
|
|
301
|
-
function
|
|
304
|
+
function be({ index: e, direction: t, fixedSize: n, gap: r, columnGap: i, usableWidth: a, usableHeight: o, totalWidth: s, queryY: c, queryX: l, getSizeY: u, getSizeX: d, columnRange: f }) {
|
|
302
305
|
let p = 0, m = 0, h = 0, g = 0;
|
|
303
306
|
return t === "horizontal" ? (p = n === null ? l(e) : e * (n + i), h = n === null ? d(e) - i : n, g = o) : t === "both" && f ? (m = n === null ? c(e) : e * (n + r), g = n === null ? u(e) - r : n, p = f.padStart, h = Math.max(0, s - f.padStart - f.padEnd)) : (m = n === null ? c(e) : e * (n + r), g = n === null ? u(e) - r : n, h = t === "both" ? s : a), {
|
|
304
307
|
height: g,
|
|
@@ -307,7 +310,7 @@ function calculateItemPosition({ index: e, direction: t, fixedSize: n, gap: r, c
|
|
|
307
310
|
y: m
|
|
308
311
|
};
|
|
309
312
|
}
|
|
310
|
-
function
|
|
313
|
+
function xe({ item: e, direction: t, itemSize: n, containerTag: r, paddingStartX: i, paddingStartY: a, isHydrated: o, isRtl: s }) {
|
|
311
314
|
let c = t === "vertical", l = t === "horizontal", u = t === "both", d = n == null || n === 0, f = { blockSize: l ? "100%" : d ? "auto" : `${e.size.height}px` };
|
|
312
315
|
if (c && r === "table" ? f.minInlineSize = "100%" : f.inlineSize = c ? "100%" : d ? "auto" : `${e.size.width}px`, d && (c || (f.minInlineSize = "1px"), l || (f.minBlockSize = "1px")), o) {
|
|
313
316
|
let t = e.isStickyActiveY ?? (e.isStickyActive && (c || u)), n = e.isStickyActiveX ?? (e.isStickyActive && l), r = s ? -(n ? e.stickyOffset.x : e.offset.x) : n ? e.stickyOffset.x : e.offset.x, o = t ? e.stickyOffset.y : e.offset.y;
|
|
@@ -315,14 +318,14 @@ function calculateItemStyle({ item: e, direction: t, itemSize: n, containerTag:
|
|
|
315
318
|
}
|
|
316
319
|
return f;
|
|
317
320
|
}
|
|
318
|
-
function
|
|
319
|
-
let l = t.start || 0, u = t.colStart || 0, d = 0, f = e === "horizontal" ? 0 :
|
|
320
|
-
return e === "horizontal" ? d =
|
|
321
|
+
function Se(e, t, n, r, i, a, o, s, c) {
|
|
322
|
+
let l = t.start || 0, u = t.colStart || 0, d = 0, f = e === "horizontal" ? 0 : z(l, n, i, o);
|
|
323
|
+
return e === "horizontal" ? d = z(u, n, a, s) : e === "both" && (d = z(u, r, a, c)), {
|
|
321
324
|
x: d,
|
|
322
325
|
y: f
|
|
323
326
|
};
|
|
324
327
|
}
|
|
325
|
-
function
|
|
328
|
+
function Ce(e, t) {
|
|
326
329
|
if (e.length === 0 || t.length <= e.length) return 0;
|
|
327
330
|
let n = e[0];
|
|
328
331
|
if (n === void 0) return 0;
|
|
@@ -330,14 +333,14 @@ function calculatePrependCount(e, t) {
|
|
|
330
333
|
for (let e = 1; e <= r; e++) if (t[e] === n) return e;
|
|
331
334
|
return 0;
|
|
332
335
|
}
|
|
333
|
-
function
|
|
336
|
+
function W({ direction: e, itemsLength: t, columnCount: n, fixedSize: r, fixedWidth: i, gap: a, columnGap: o, usableWidth: s, usableHeight: c, queryY: l, queryX: u, queryColumn: d }) {
|
|
334
337
|
let f = e === "both", p = e === "horizontal", m = 0, h = 0;
|
|
335
|
-
return f ? (m =
|
|
338
|
+
return f ? (m = L(n, i, o, d), h = L(t, r, a, l)) : p ? (m = L(t, r, o, u), h = c) : (m = s, h = L(t, r, a, l)), {
|
|
336
339
|
width: f ? Math.max(m, s) : m,
|
|
337
340
|
height: f ? Math.max(h, c) : h
|
|
338
341
|
};
|
|
339
342
|
}
|
|
340
|
-
function
|
|
343
|
+
function we(e, t, n = 16) {
|
|
341
344
|
let r = {
|
|
342
345
|
x: e.x * t,
|
|
343
346
|
y: e.y * t
|
|
@@ -350,7 +353,7 @@ function calculateInertiaStep(e, t, n = 16) {
|
|
|
350
353
|
}
|
|
351
354
|
};
|
|
352
355
|
}
|
|
353
|
-
function
|
|
356
|
+
function Te(e, t, n) {
|
|
354
357
|
return n <= 0 ? {
|
|
355
358
|
x: 0,
|
|
356
359
|
y: 0
|
|
@@ -359,7 +362,7 @@ function calculateInstantaneousVelocity(e, t, n) {
|
|
|
359
362
|
y: (e.y - t.y) / n
|
|
360
363
|
};
|
|
361
364
|
}
|
|
362
|
-
function
|
|
365
|
+
function Ee(e, t, n, r, i, a, o, s, c, l) {
|
|
363
366
|
let u = e;
|
|
364
367
|
if (e === "auto") if (t === "start") u = "end";
|
|
365
368
|
else if (t === "end") u = "start";
|
|
@@ -410,11 +413,13 @@ function resolveSnap(e, t, n, r, i, a, o, s, c, l) {
|
|
|
410
413
|
}
|
|
411
414
|
return null;
|
|
412
415
|
}
|
|
413
|
-
function
|
|
416
|
+
function De(e, t, n, r) {
|
|
414
417
|
let i = (t || 0) + n;
|
|
415
418
|
return t !== null && i > 0 ? Math.floor(e / i) : r(e);
|
|
416
419
|
}
|
|
417
|
-
|
|
420
|
+
//#endregion
|
|
421
|
+
//#region src/utils/fenwick-tree.ts
|
|
422
|
+
var Oe = class {
|
|
418
423
|
tree;
|
|
419
424
|
values;
|
|
420
425
|
constructor(e) {
|
|
@@ -471,8 +476,10 @@ var FenwickTree = class {
|
|
|
471
476
|
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();
|
|
472
477
|
}
|
|
473
478
|
};
|
|
474
|
-
|
|
475
|
-
|
|
479
|
+
//#endregion
|
|
480
|
+
//#region src/composables/useVirtualScrollSizes.ts
|
|
481
|
+
function ke(e) {
|
|
482
|
+
let n = t(() => T(e)), r = new Oe(n.value.props.items?.length || 0), i = new Oe(n.value.props.items?.length || 0), a = new Oe(n.value.props.columnCount || 0), o = S(new Uint8Array()), s = S(new Uint8Array()), c = S(new Uint8Array()), l = v(0), u = v(!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) => {
|
|
476
483
|
if (l.value, typeof t == "number" && t > 0) return t;
|
|
477
484
|
if (Array.isArray(t) && t.length > 0) {
|
|
478
485
|
let n = t[e % t.length];
|
|
@@ -524,7 +531,7 @@ function useVirtualScrollSizes(e) {
|
|
|
524
531
|
}, y = () => {
|
|
525
532
|
let e = n.value.props, t = e.items, a = t.length;
|
|
526
533
|
m(a, e.columnCount || 0);
|
|
527
|
-
let o = e.restoreScrollOnPrepend ?
|
|
534
|
+
let o = e.restoreScrollOnPrepend ? Ce(d, t) : 0;
|
|
528
535
|
if (o > 0) {
|
|
529
536
|
r.shift(o), i.shift(o);
|
|
530
537
|
let e = new Uint8Array(a), t = new Uint8Array(a);
|
|
@@ -545,7 +552,7 @@ function useVirtualScrollSizes(e) {
|
|
|
545
552
|
getSizeAt: p,
|
|
546
553
|
initializeSizes: y,
|
|
547
554
|
updateItemSizes: (e, t, u, d, f, p) => {
|
|
548
|
-
let m = !1, h = { val: 0 }, g = { val: 0 }, v = n.value.props, y = v.gap || 0, b = v.columnGap || 0, x = t(n.value.direction === "horizontal" ? d : f), S = u(d), C = n.value.direction === "horizontal", w = n.value.direction === "both", T = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Set(),
|
|
555
|
+
let m = !1, h = { val: 0 }, g = { val: 0 }, v = n.value.props, y = v.gap || 0, b = v.columnGap || 0, x = t(n.value.direction === "horizontal" ? d : f), S = u(d), C = n.value.direction === "horizontal", w = n.value.direction === "both", T = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Set(), ee = (e, t) => {
|
|
549
556
|
e >= 0 && e < (v.columnCount || 0) && !E.has(e) && (E.add(e), _(e, t, a, o.value, b, S, h) && (m = !0));
|
|
550
557
|
};
|
|
551
558
|
for (let { index: t, inlineSize: a, blockSize: o, element: l } of e) {
|
|
@@ -555,10 +562,10 @@ function useVirtualScrollSizes(e) {
|
|
|
555
562
|
let u = n.value.isDynamicColumnWidth || typeof v.columnWidth == "function";
|
|
556
563
|
if (w && l && v.columnCount && u && (a > 0 || l.dataset.colIndex === void 0)) {
|
|
557
564
|
let e = l.dataset.colIndex;
|
|
558
|
-
if (e != null)
|
|
565
|
+
if (e != null) ee(Number.parseInt(e, 10), a);
|
|
559
566
|
else {
|
|
560
|
-
let e =
|
|
561
|
-
for (let t of e)
|
|
567
|
+
let e = [...l.querySelectorAll("[data-col-index]")];
|
|
568
|
+
for (let t of e) ee(Number.parseInt(t.dataset.colIndex, 10), t.getBoundingClientRect().width);
|
|
562
569
|
}
|
|
563
570
|
}
|
|
564
571
|
}
|
|
@@ -569,103 +576,105 @@ function useVirtualScrollSizes(e) {
|
|
|
569
576
|
}
|
|
570
577
|
};
|
|
571
578
|
}
|
|
572
|
-
|
|
573
|
-
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region src/composables/useVirtualScroll.ts
|
|
581
|
+
function Ae(e, n = []) {
|
|
582
|
+
let r = t(() => T(e)), i = v(0), a = v(0), o = v(0), c = v(0), l = v(!1), d = v(!1), f = v(!1), p = v(!1), g = v(!1), y = v(0), b = v(0), x = _({
|
|
574
583
|
x: 0,
|
|
575
584
|
y: 0
|
|
576
|
-
}), S =
|
|
585
|
+
}), S = _({
|
|
577
586
|
x: 0,
|
|
578
587
|
y: 0
|
|
579
|
-
}), C, w =
|
|
580
|
-
|
|
581
|
-
}, re = 0,
|
|
588
|
+
}), C, w = v(1), E = v(1), ee = v(null), te = v(null), O = v(null), k = v(!1), A, ne = () => {
|
|
589
|
+
k.value = !1, clearTimeout(A), O.value = null;
|
|
590
|
+
}, re = 0, j = 0, M = t(() => [
|
|
582
591
|
"vertical",
|
|
583
592
|
"horizontal",
|
|
584
593
|
"both"
|
|
585
|
-
].includes(r.value.direction) ? r.value.direction : "vertical"),
|
|
594
|
+
].includes(r.value.direction) ? r.value.direction : "vertical"), N = t(() => r.value.itemSize === void 0 || r.value.itemSize === null || r.value.itemSize === 0), ie = t(() => r.value.columnWidth === void 0 || r.value.columnWidth === null || r.value.columnWidth === 0), F = t(() => typeof r.value.itemSize == "number" && r.value.itemSize > 0 ? r.value.itemSize : null), I = t(() => typeof r.value.columnWidth == "number" && r.value.columnWidth > 0 ? r.value.columnWidth : null), fe = t(() => r.value.defaultItemSize || F.value || 40), { itemSizesX: L, itemSizesY: B, columnSizes: V, measuredColumns: pe, measuredItemsY: H, treeUpdateFlag: xe, getSizeAt: Ce, getItemBaseSize: we, initializeSizes: Te, updateItemSizes: Ee, refresh: Oe } = ke(t(() => ({
|
|
586
595
|
props: r.value,
|
|
587
|
-
isDynamicItemSize:
|
|
596
|
+
isDynamicItemSize: N.value,
|
|
588
597
|
isDynamicColumnWidth: ie.value,
|
|
589
|
-
defaultSize:
|
|
598
|
+
defaultSize: fe.value,
|
|
590
599
|
fixedItemSize: F.value,
|
|
591
|
-
direction:
|
|
592
|
-
}))),
|
|
593
|
-
direction:
|
|
600
|
+
direction: M.value
|
|
601
|
+
}))), Ae = t(() => le(r.value.scrollPaddingStart, r.value.direction)), je = t(() => le(r.value.scrollPaddingEnd, r.value.direction)), Me = t(() => ue(r.value.scrollPaddingStart, r.value.direction)), Ne = t(() => ue(r.value.scrollPaddingEnd, r.value.direction)), G = t(() => le(r.value.stickyStart, r.value.direction)), Pe = t(() => le(r.value.stickyEnd, r.value.direction)), K = t(() => ue(r.value.stickyStart, r.value.direction)), Fe = t(() => ue(r.value.stickyEnd, r.value.direction)), q = t(() => le(r.value.flowPaddingStart, r.value.direction)), Ie = t(() => le(r.value.flowPaddingEnd, r.value.direction)), Le = t(() => ue(r.value.flowPaddingStart, r.value.direction)), Re = t(() => ue(r.value.flowPaddingEnd, r.value.direction)), ze = t(() => y.value - (M.value === "vertical" ? 0 : G.value + Pe.value)), Be = t(() => b.value - (M.value === "horizontal" ? 0 : K.value + Fe.value)), Ve = t(() => (xe.value, W({
|
|
602
|
+
direction: M.value,
|
|
594
603
|
itemsLength: r.value.items.length,
|
|
595
604
|
columnCount: r.value.columnCount || 0,
|
|
596
605
|
fixedSize: F.value,
|
|
597
606
|
fixedWidth: I.value,
|
|
598
607
|
gap: r.value.gap || 0,
|
|
599
608
|
columnGap: r.value.columnGap || 0,
|
|
600
|
-
usableWidth:
|
|
601
|
-
usableHeight:
|
|
602
|
-
queryY: (e) =>
|
|
609
|
+
usableWidth: ze.value,
|
|
610
|
+
usableHeight: Be.value,
|
|
611
|
+
queryY: (e) => B.query(e),
|
|
603
612
|
queryX: (e) => L.query(e),
|
|
604
|
-
queryColumn: (e) =>
|
|
605
|
-
}))),
|
|
606
|
-
x:
|
|
607
|
-
y:
|
|
608
|
-
}),
|
|
609
|
-
if (
|
|
610
|
-
let e =
|
|
613
|
+
queryColumn: (e) => V.query(e)
|
|
614
|
+
}))), He = t(() => ae(r.value.container)), Ue = t(() => Ve.value.width + Ae.value + je.value), We = t(() => Ve.value.height + Me.value + Ne.value), Ge = t(() => q.value + G.value + Pe.value + Ie.value + Ue.value), Ke = t(() => Le.value + K.value + Fe.value + Re.value + We.value), J = _({
|
|
615
|
+
x: t(() => Math.max(0, x.x - (q.value + G.value))),
|
|
616
|
+
y: t(() => Math.max(0, x.y - (Le.value + K.value)))
|
|
617
|
+
}), qe = t(() => U(He.value, Ge.value)), Je = t(() => U(He.value, Ke.value)), Ye = t(() => U(He.value, Ue.value)), Xe = t(() => U(He.value, We.value)), Y = t(() => {
|
|
618
|
+
if (M.value === "vertical") return 0;
|
|
619
|
+
let e = q.value + G.value + Ae.value;
|
|
611
620
|
return o.value - e;
|
|
612
|
-
}),
|
|
613
|
-
if (
|
|
614
|
-
let e =
|
|
621
|
+
}), X = t(() => {
|
|
622
|
+
if (M.value === "horizontal") return 0;
|
|
623
|
+
let e = Le.value + K.value + Me.value;
|
|
615
624
|
return c.value - e;
|
|
616
|
-
}),
|
|
617
|
-
let t =
|
|
618
|
-
return
|
|
619
|
-
},
|
|
625
|
+
}), Ze = (e) => {
|
|
626
|
+
let t = M.value === "horizontal";
|
|
627
|
+
return De(e, F.value, t ? r.value.columnGap || 0 : r.value.gap || 0, (e) => t ? L.findLowerBound(e) : B.findLowerBound(e));
|
|
628
|
+
}, Qe = (e) => M.value === "both" ? De(e, I.value, r.value.columnGap || 0, (e) => V.findLowerBound(e)) : M.value === "horizontal" ? Ze(e) : 0, $e = (e) => M.value === "both" ? Ce(e, r.value.columnWidth, r.value.defaultColumnWidth || 100, r.value.columnGap || 0, V, !0) : Ce(e, r.value.itemSize, r.value.defaultItemSize || 40, r.value.columnGap || 0, L, !0), et = (e) => M.value === "horizontal" ? Be.value : Ce(e, r.value.itemSize, r.value.defaultItemSize || 40, r.value.gap || 0, B, !1), tt = (e) => M.value === "horizontal" ? q.value + G.value + Ae.value + z(e, F.value, r.value.columnGap || 0, (e) => L.query(e)) : Le.value + K.value + Me.value + z(e, F.value, r.value.gap || 0, (e) => B.query(e)), nt = (e) => M.value === "horizontal" ? $e(e) : et(e), rt = () => {
|
|
620
629
|
if (typeof window > "u") return;
|
|
621
|
-
let e = r.value.container || r.value.hostRef || window, t =
|
|
630
|
+
let e = r.value.container || r.value.hostRef || window, t = P(e) ? e : document.documentElement, n = window.getComputedStyle(t).direction === "rtl";
|
|
622
631
|
g.value !== n && (g.value = n);
|
|
623
632
|
}, it = (e, t) => {
|
|
624
|
-
|
|
625
|
-
Z(e > 0 ?
|
|
633
|
+
u(() => {
|
|
634
|
+
Z(e > 0 ? Y.value + e : null, t > 0 ? X.value + t : null, { behavior: "auto" });
|
|
626
635
|
});
|
|
627
636
|
};
|
|
628
637
|
function at(e, t, n) {
|
|
629
|
-
let s =
|
|
638
|
+
let s = ce(n) ? n.isCorrection : !1, l = ce(n) ? n.dryRun : !1, u = r.value.container || window, { targetX: d, targetY: f, effectiveAlignX: p, effectiveAlignY: m } = ge({
|
|
630
639
|
rowIndex: e,
|
|
631
640
|
colIndex: t,
|
|
632
641
|
options: n,
|
|
633
|
-
direction:
|
|
642
|
+
direction: M.value,
|
|
634
643
|
viewportWidth: y.value,
|
|
635
644
|
viewportHeight: b.value,
|
|
636
|
-
totalWidth:
|
|
637
|
-
totalHeight:
|
|
645
|
+
totalWidth: Ge.value,
|
|
646
|
+
totalHeight: Ke.value,
|
|
638
647
|
gap: r.value.gap || 0,
|
|
639
648
|
columnGap: r.value.columnGap || 0,
|
|
640
649
|
fixedSize: F.value,
|
|
641
650
|
fixedWidth: I.value,
|
|
642
|
-
relativeScrollX:
|
|
643
|
-
relativeScrollY:
|
|
644
|
-
getItemSizeY: (e) =>
|
|
651
|
+
relativeScrollX: Y.value,
|
|
652
|
+
relativeScrollY: X.value,
|
|
653
|
+
getItemSizeY: (e) => B.get(e),
|
|
645
654
|
getItemSizeX: (e) => L.get(e),
|
|
646
|
-
getItemQueryY: (e) =>
|
|
655
|
+
getItemQueryY: (e) => B.query(e),
|
|
647
656
|
getItemQueryX: (e) => L.query(e),
|
|
648
|
-
getColumnSize: (e) =>
|
|
649
|
-
getColumnQuery: (e) =>
|
|
657
|
+
getColumnSize: (e) => V.get(e),
|
|
658
|
+
getColumnQuery: (e) => V.query(e),
|
|
650
659
|
scaleX: w.value,
|
|
651
660
|
scaleY: E.value,
|
|
652
|
-
hostOffsetX:
|
|
653
|
-
hostOffsetY:
|
|
661
|
+
hostOffsetX: J.x,
|
|
662
|
+
hostOffsetY: J.y,
|
|
654
663
|
stickyIndices: r.value.stickyIndices || [],
|
|
655
|
-
stickyStartX:
|
|
656
|
-
stickyStartY:
|
|
657
|
-
stickyEndX:
|
|
658
|
-
stickyEndY:
|
|
659
|
-
flowPaddingStartX:
|
|
660
|
-
flowPaddingStartY:
|
|
661
|
-
paddingStartX:
|
|
662
|
-
paddingStartY:
|
|
663
|
-
paddingEndX:
|
|
664
|
-
paddingEndY:
|
|
664
|
+
stickyStartX: G.value,
|
|
665
|
+
stickyStartY: K.value,
|
|
666
|
+
stickyEndX: Pe.value,
|
|
667
|
+
stickyEndY: Fe.value,
|
|
668
|
+
flowPaddingStartX: q.value,
|
|
669
|
+
flowPaddingStartY: Le.value,
|
|
670
|
+
paddingStartX: Ae.value,
|
|
671
|
+
paddingStartY: Me.value,
|
|
672
|
+
paddingEndX: je.value,
|
|
673
|
+
paddingEndY: Ne.value
|
|
665
674
|
});
|
|
666
675
|
if (!s && !l) {
|
|
667
|
-
let r =
|
|
668
|
-
|
|
676
|
+
let r = ce(n) ? n.behavior : void 0;
|
|
677
|
+
O.value = {
|
|
669
678
|
rowIndex: e,
|
|
670
679
|
colIndex: t,
|
|
671
680
|
options: {
|
|
@@ -677,14 +686,16 @@ function useVirtualScroll(e, n = []) {
|
|
|
677
686
|
}
|
|
678
687
|
};
|
|
679
688
|
}
|
|
680
|
-
let h =
|
|
681
|
-
|
|
689
|
+
let h = he(d, J.x, w.value), _ = he(f, J.y, E.value), v = g.value ? -h : h, x = _, S;
|
|
690
|
+
ce(n) && (S = n.behavior);
|
|
682
691
|
let C = s ? "auto" : S || "smooth";
|
|
683
|
-
l || (
|
|
684
|
-
|
|
685
|
-
}, 1e3))
|
|
692
|
+
l || (k.value = !0, clearTimeout(A), A = C === "smooth" ? setTimeout(() => {
|
|
693
|
+
k.value = !1, A = void 0, gt();
|
|
694
|
+
}, 1e3) : setTimeout(() => {
|
|
695
|
+
k.value = !1, A = void 0;
|
|
696
|
+
}, 150));
|
|
686
697
|
let T = { behavior: C };
|
|
687
|
-
return t != null && (T.left = g.value ? v : Math.max(0, v)), e != null && (T.top = Math.max(0, x)),
|
|
698
|
+
return t != null && (T.left = g.value ? v : Math.max(0, v)), e != null && (T.top = Math.max(0, x)), l || se(u, T), !l && (C === "auto" || C === void 0) && (t != null && (i.value = g.value ? v : Math.max(0, v), o.value = d), e != null && (a.value = Math.max(0, x), c.value = f)), {
|
|
688
699
|
targetX: d,
|
|
689
700
|
targetY: f,
|
|
690
701
|
displayTargetX: h,
|
|
@@ -693,43 +704,45 @@ function useVirtualScroll(e, n = []) {
|
|
|
693
704
|
}
|
|
694
705
|
function Z(e, t, n) {
|
|
695
706
|
let s = r.value.container || window;
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
}, 1e3))
|
|
699
|
-
|
|
707
|
+
k.value = !0, clearTimeout(A), A = n?.behavior === "smooth" ? setTimeout(() => {
|
|
708
|
+
k.value = !1, A = void 0, gt();
|
|
709
|
+
}, 1e3) : setTimeout(() => {
|
|
710
|
+
k.value = !1, A = void 0;
|
|
711
|
+
}, 150), O.value = null;
|
|
712
|
+
let l = e == null ? null : Math.max(0, Math.min(e, Ge.value - y.value)), u = t == null ? null : Math.max(0, Math.min(t, Ke.value - b.value));
|
|
700
713
|
l !== null && (o.value = l), u !== null && (c.value = u);
|
|
701
|
-
let d = typeof window < "u" && s === window ? window.scrollX : s.scrollLeft, f = typeof window < "u" && s === window ? window.scrollY : s.scrollTop, p = l === null ? null :
|
|
702
|
-
e != null && (v.left = h), t != null && (v.top = _),
|
|
714
|
+
let d = typeof window < "u" && s === window ? window.scrollX : s.scrollLeft, f = typeof window < "u" && s === window ? window.scrollY : s.scrollTop, p = l === null ? null : he(l, J.x, w.value), m = u === null ? null : he(u, J.y, E.value), h = p === null ? d : g.value ? -p : p, _ = m === null ? f : m, v = { behavior: n?.behavior || "auto" };
|
|
715
|
+
e != null && (v.left = h), t != null && (v.top = _), se(s, v), (n?.behavior === "auto" || n?.behavior === void 0) && (e != null && (i.value = h), t != null && (a.value = _));
|
|
703
716
|
}
|
|
704
|
-
let ot =
|
|
705
|
-
if (
|
|
717
|
+
let ot = t(() => {
|
|
718
|
+
if (xe.value, (!d.value || f.value) && r.value.ssrRange) return {
|
|
706
719
|
start: r.value.ssrRange.start,
|
|
707
720
|
end: r.value.ssrRange.end
|
|
708
721
|
};
|
|
709
722
|
let e = r.value.ssrRange && !l.value ? 0 : r.value.bufferBefore ?? 5, t = r.value.bufferAfter ?? 5;
|
|
710
|
-
return
|
|
711
|
-
direction:
|
|
712
|
-
relativeScrollX:
|
|
713
|
-
relativeScrollY:
|
|
714
|
-
usableWidth:
|
|
715
|
-
usableHeight:
|
|
723
|
+
return _e({
|
|
724
|
+
direction: M.value,
|
|
725
|
+
relativeScrollX: Y.value,
|
|
726
|
+
relativeScrollY: X.value,
|
|
727
|
+
usableWidth: ze.value,
|
|
728
|
+
usableHeight: Be.value,
|
|
716
729
|
itemsLength: r.value.items.length,
|
|
717
730
|
bufferBefore: e,
|
|
718
731
|
bufferAfter: t,
|
|
719
732
|
gap: r.value.gap || 0,
|
|
720
733
|
columnGap: r.value.columnGap || 0,
|
|
721
734
|
fixedSize: F.value,
|
|
722
|
-
findLowerBoundY: (e) =>
|
|
735
|
+
findLowerBoundY: (e) => B.findLowerBound(e),
|
|
723
736
|
findLowerBoundX: (e) => L.findLowerBound(e),
|
|
724
|
-
queryY: (e) =>
|
|
737
|
+
queryY: (e) => B.query(e),
|
|
725
738
|
queryX: (e) => L.query(e)
|
|
726
739
|
});
|
|
727
|
-
}), st =
|
|
728
|
-
|
|
729
|
-
let e =
|
|
730
|
-
return
|
|
731
|
-
}), ct =
|
|
732
|
-
|
|
740
|
+
}), st = t(() => {
|
|
741
|
+
xe.value;
|
|
742
|
+
let e = Y.value + G.value, t = X.value + K.value;
|
|
743
|
+
return Ze(M.value === "horizontal" ? e : t);
|
|
744
|
+
}), ct = t(() => {
|
|
745
|
+
xe.value;
|
|
733
746
|
let e = r.value.columnCount || 0;
|
|
734
747
|
if (!e) return {
|
|
735
748
|
start: 0,
|
|
@@ -739,36 +752,36 @@ function useVirtualScroll(e, n = []) {
|
|
|
739
752
|
};
|
|
740
753
|
if ((!d.value || f.value) && r.value.ssrRange) {
|
|
741
754
|
let { colStart: t = 0, colEnd: n = 0 } = r.value.ssrRange, i = Math.max(0, t), a = Math.min(e, n || e);
|
|
742
|
-
return
|
|
755
|
+
return ve({
|
|
743
756
|
columnCount: e,
|
|
744
|
-
relativeScrollX:
|
|
745
|
-
usableWidth:
|
|
757
|
+
relativeScrollX: z(i, I.value, r.value.columnGap || 0, (e) => V.query(e)),
|
|
758
|
+
usableWidth: R(i, a, I.value, r.value.columnGap || 0, (e) => V.query(e)),
|
|
746
759
|
colBuffer: 0,
|
|
747
760
|
fixedWidth: I.value,
|
|
748
761
|
columnGap: r.value.columnGap || 0,
|
|
749
|
-
findLowerBound: (e) =>
|
|
750
|
-
query: (e) =>
|
|
751
|
-
totalColsQuery: () =>
|
|
762
|
+
findLowerBound: (e) => V.findLowerBound(e),
|
|
763
|
+
query: (e) => V.query(e),
|
|
764
|
+
totalColsQuery: () => V.query(e)
|
|
752
765
|
});
|
|
753
766
|
}
|
|
754
767
|
let t = r.value.ssrRange && !l.value ? 0 : 2;
|
|
755
|
-
return
|
|
768
|
+
return ve({
|
|
756
769
|
columnCount: e,
|
|
757
|
-
relativeScrollX:
|
|
758
|
-
usableWidth:
|
|
770
|
+
relativeScrollX: Y.value,
|
|
771
|
+
usableWidth: ze.value,
|
|
759
772
|
colBuffer: t,
|
|
760
773
|
fixedWidth: I.value,
|
|
761
774
|
columnGap: r.value.columnGap || 0,
|
|
762
|
-
findLowerBound: (e) =>
|
|
763
|
-
query: (e) =>
|
|
764
|
-
totalColsQuery: () =>
|
|
775
|
+
findLowerBound: (e) => V.findLowerBound(e),
|
|
776
|
+
query: (e) => V.query(e),
|
|
777
|
+
totalColsQuery: () => V.query(e)
|
|
765
778
|
});
|
|
766
779
|
}), lt = {
|
|
767
780
|
props: r,
|
|
768
781
|
scrollDetails: null,
|
|
769
|
-
totalSize:
|
|
770
|
-
width:
|
|
771
|
-
height:
|
|
782
|
+
totalSize: t(() => ({
|
|
783
|
+
width: Ge.value,
|
|
784
|
+
height: Ke.value
|
|
772
785
|
})),
|
|
773
786
|
range: ot,
|
|
774
787
|
currentIndex: st,
|
|
@@ -779,68 +792,68 @@ function useVirtualScroll(e, n = []) {
|
|
|
779
792
|
internalScrollY: c,
|
|
780
793
|
isRtl: g,
|
|
781
794
|
isScrolling: l,
|
|
782
|
-
isProgrammaticScroll:
|
|
795
|
+
isProgrammaticScroll: k,
|
|
783
796
|
viewportWidth: y,
|
|
784
797
|
viewportHeight: b,
|
|
785
798
|
scaleX: w,
|
|
786
799
|
scaleY: E,
|
|
787
|
-
scrollDirectionX:
|
|
788
|
-
scrollDirectionY:
|
|
789
|
-
relativeScrollX:
|
|
790
|
-
relativeScrollY:
|
|
800
|
+
scrollDirectionX: ee,
|
|
801
|
+
scrollDirectionY: te,
|
|
802
|
+
relativeScrollX: Y,
|
|
803
|
+
relativeScrollY: X
|
|
791
804
|
},
|
|
792
805
|
methods: {
|
|
793
806
|
scrollToIndex: at,
|
|
794
807
|
scrollToOffset: Z,
|
|
795
|
-
updateDirection:
|
|
796
|
-
getRowIndexAt:
|
|
797
|
-
getColIndexAt:
|
|
798
|
-
getItemSize:
|
|
799
|
-
getItemBaseSize:
|
|
800
|
-
getItemOffset:
|
|
808
|
+
updateDirection: rt,
|
|
809
|
+
getRowIndexAt: Ze,
|
|
810
|
+
getColIndexAt: Qe,
|
|
811
|
+
getItemSize: nt,
|
|
812
|
+
getItemBaseSize: we,
|
|
813
|
+
getItemOffset: tt,
|
|
801
814
|
handleScrollCorrection: it
|
|
802
815
|
}
|
|
803
|
-
}, ut = [], dt =
|
|
804
|
-
|
|
805
|
-
let { start: e, end: t } = ot.value, i = [], a =
|
|
816
|
+
}, ut = [], dt = t(() => {
|
|
817
|
+
xe.value;
|
|
818
|
+
let { start: e, end: t } = ot.value, i = [], a = (r.value.stickyIndices || []).toSorted((e, t) => e - t), s = new Set(a), l = [];
|
|
806
819
|
if (d.value || !r.value.ssrRange) {
|
|
807
|
-
let t = st.value, n =
|
|
820
|
+
let t = st.value, n = de(a, t);
|
|
808
821
|
n !== void 0 && n < e && l.push(n);
|
|
809
822
|
}
|
|
810
823
|
for (let n = e; n < t; n++) l.push(n);
|
|
811
|
-
let { x: u, y: f } = !d.value && r.value.ssrRange ?
|
|
824
|
+
let { x: u, y: f } = !d.value && r.value.ssrRange ? Se(M.value, r.value.ssrRange, F.value, I.value, r.value.gap || 0, r.value.columnGap || 0, (e) => B.query(e), (e) => L.query(e), (e) => V.query(e)) : {
|
|
812
825
|
x: 0,
|
|
813
826
|
y: 0
|
|
814
827
|
}, p = /* @__PURE__ */ new Map();
|
|
815
828
|
for (let e of ut) p.set(e.index, e);
|
|
816
|
-
let m = -1, h = 0, g = -1, _ = 0, v = (e) => e === m + 1 ? (h += L.get(m), m = e, h) : (h = L.query(e), m = e, h), y = (e) => e === g + 1 ? (_ +=
|
|
829
|
+
let m = -1, h = 0, g = -1, _ = 0, v = (e) => e === m + 1 ? (h += L.get(m), m = e, h) : (h = L.query(e), m = e, h), y = (e) => e === g + 1 ? (_ += B.get(g), g = e, _) : (_ = B.query(e), g = e, _), b = q.value + G.value + Ae.value, x = Le.value + K.value + Me.value, S = q.value + G.value, C = Le.value + K.value, T = ct.value, ee = 0;
|
|
817
830
|
for (let e of l) {
|
|
818
831
|
let t = r.value.items[e];
|
|
819
832
|
if (t === void 0) continue;
|
|
820
|
-
let { x: n, y: l, width: m, height: h } =
|
|
833
|
+
let { x: n, y: l, width: m, height: h } = be({
|
|
821
834
|
index: e,
|
|
822
|
-
direction:
|
|
835
|
+
direction: M.value,
|
|
823
836
|
fixedSize: F.value,
|
|
824
837
|
gap: r.value.gap || 0,
|
|
825
838
|
columnGap: r.value.columnGap || 0,
|
|
826
|
-
usableWidth:
|
|
827
|
-
usableHeight:
|
|
828
|
-
totalWidth:
|
|
839
|
+
usableWidth: ze.value,
|
|
840
|
+
usableHeight: Be.value,
|
|
841
|
+
totalWidth: Ve.value.width,
|
|
829
842
|
queryY: y,
|
|
830
843
|
queryX: v,
|
|
831
|
-
getSizeY: (e) =>
|
|
844
|
+
getSizeY: (e) => B.get(e),
|
|
832
845
|
getSizeX: (e) => L.get(e),
|
|
833
846
|
columnRange: T
|
|
834
|
-
}), g = s.has(e), _ = n,
|
|
835
|
-
for (;
|
|
836
|
-
let
|
|
847
|
+
}), g = s.has(e), _ = n, te = l;
|
|
848
|
+
for (; ee < a.length && a[ee] <= e;) ee++;
|
|
849
|
+
let D = ee < a.length ? a[ee] : void 0, { isStickyActive: O, isStickyActiveX: k, isStickyActiveY: A, stickyOffset: ne } = ye({
|
|
837
850
|
index: e,
|
|
838
851
|
isSticky: g,
|
|
839
|
-
direction:
|
|
840
|
-
relativeScrollX:
|
|
841
|
-
relativeScrollY:
|
|
852
|
+
direction: M.value,
|
|
853
|
+
relativeScrollX: Y.value,
|
|
854
|
+
relativeScrollY: X.value,
|
|
842
855
|
originalX: _,
|
|
843
|
-
originalY:
|
|
856
|
+
originalY: te,
|
|
844
857
|
width: m,
|
|
845
858
|
height: h,
|
|
846
859
|
stickyIndices: a,
|
|
@@ -848,37 +861,37 @@ function useVirtualScroll(e, n = []) {
|
|
|
848
861
|
fixedWidth: I.value,
|
|
849
862
|
gap: r.value.gap || 0,
|
|
850
863
|
columnGap: r.value.columnGap || 0,
|
|
851
|
-
getItemQueryY: (e) =>
|
|
864
|
+
getItemQueryY: (e) => B.query(e),
|
|
852
865
|
getItemQueryX: (e) => L.query(e),
|
|
853
|
-
nextStickyIndex:
|
|
854
|
-
}), re = d.value ? o.value / w.value + (n + b - o.value) - S : n - u,
|
|
855
|
-
|
|
866
|
+
nextStickyIndex: D
|
|
867
|
+
}), re = d.value ? o.value / w.value + (n + b - o.value) - S : n - u, j = d.value ? c.value / E.value + (l + x - c.value) - C : l - f, N = p.get(e);
|
|
868
|
+
N && N.item === t && N.offset.x === re && N.offset.y === j && N.size.width === m && N.size.height === h && N.isSticky === g && N.isStickyActive === O && N.isStickyActiveX === k && N.isStickyActiveY === A && N.stickyOffset.x === ne.x && N.stickyOffset.y === ne.y ? i.push(N) : i.push({
|
|
856
869
|
item: t,
|
|
857
870
|
index: e,
|
|
858
871
|
offset: {
|
|
859
872
|
x: re,
|
|
860
|
-
y:
|
|
873
|
+
y: j
|
|
861
874
|
},
|
|
862
875
|
size: {
|
|
863
876
|
width: m,
|
|
864
877
|
height: h
|
|
865
878
|
},
|
|
866
879
|
originalX: _,
|
|
867
|
-
originalY:
|
|
880
|
+
originalY: te,
|
|
868
881
|
isSticky: g,
|
|
869
|
-
isStickyActive:
|
|
870
|
-
isStickyActiveX:
|
|
871
|
-
isStickyActiveY:
|
|
882
|
+
isStickyActive: O,
|
|
883
|
+
isStickyActiveX: k,
|
|
884
|
+
isStickyActiveY: A,
|
|
872
885
|
stickyOffset: ne
|
|
873
886
|
});
|
|
874
887
|
}
|
|
875
|
-
let
|
|
888
|
+
let te = i;
|
|
876
889
|
return n.forEach((e) => {
|
|
877
|
-
e.transformRenderedItems && (
|
|
878
|
-
}), ut =
|
|
879
|
-
}), ft =
|
|
880
|
-
|
|
881
|
-
let e =
|
|
890
|
+
e.transformRenderedItems && (te = e.transformRenderedItems(te, lt));
|
|
891
|
+
}), ut = te, te;
|
|
892
|
+
}), ft = t(() => {
|
|
893
|
+
xe.value;
|
|
894
|
+
let e = Y.value + G.value, t = X.value + K.value, n = Y.value + (y.value - Pe.value) - 1, r = X.value + (b.value - Fe.value) - 1, s = Qe(e), u = Ze(t), d = Ze(M.value === "horizontal" ? n : r), f = Qe(n);
|
|
882
895
|
return {
|
|
883
896
|
items: dt.value,
|
|
884
897
|
currentIndex: u,
|
|
@@ -902,11 +915,11 @@ function useVirtualScroll(e, n = []) {
|
|
|
902
915
|
height: b.value
|
|
903
916
|
},
|
|
904
917
|
totalSize: {
|
|
905
|
-
width:
|
|
906
|
-
height:
|
|
918
|
+
width: Ge.value,
|
|
919
|
+
height: Ke.value
|
|
907
920
|
},
|
|
908
921
|
isScrolling: l.value,
|
|
909
|
-
isProgrammaticScroll:
|
|
922
|
+
isProgrammaticScroll: k.value,
|
|
910
923
|
range: ot.value,
|
|
911
924
|
columnRange: ct.value
|
|
912
925
|
};
|
|
@@ -915,19 +928,19 @@ function useVirtualScroll(e, n = []) {
|
|
|
915
928
|
let pt = (e) => {
|
|
916
929
|
let t = e.target;
|
|
917
930
|
if (typeof window > "u") return;
|
|
918
|
-
|
|
919
|
-
let r =
|
|
920
|
-
if (!
|
|
921
|
-
l.value || (re = o.value,
|
|
922
|
-
let e = r - re, t = s -
|
|
923
|
-
Math.abs(e) > .5 && (
|
|
931
|
+
rt(), t === window || t === document ? (i.value = window.scrollX, a.value = window.scrollY, y.value = document.documentElement.clientWidth, b.value = document.documentElement.clientHeight) : oe(t) && (i.value = t.scrollLeft, a.value = t.scrollTop, y.value = t.clientWidth, b.value = t.clientHeight);
|
|
932
|
+
let r = me(g.value ? Math.abs(i.value) : i.value, J.x, w.value), s = me(a.value, J.y, E.value);
|
|
933
|
+
if (!k.value) {
|
|
934
|
+
l.value || (re = o.value, j = c.value);
|
|
935
|
+
let e = r - re, t = s - j;
|
|
936
|
+
Math.abs(e) > .5 && (ee.value = e > 0 ? "end" : "start"), Math.abs(t) > .5 && (te.value = t > 0 ? "end" : "start");
|
|
924
937
|
}
|
|
925
|
-
o.value = r, c.value = s,
|
|
926
|
-
l.value = !1, n.forEach((e) => e.onScrollEnd?.(lt)),
|
|
938
|
+
o.value = r, c.value = s, k.value || (O.value = null), l.value ||= !0, n.forEach((t) => t.onScroll?.(lt, e)), clearTimeout(C), C = setTimeout(() => {
|
|
939
|
+
l.value = !1, n.forEach((e) => e.onScrollEnd?.(lt)), A === void 0 && (k.value = !1);
|
|
927
940
|
}, 150);
|
|
928
941
|
}, mt = (e) => {
|
|
929
|
-
|
|
930
|
-
!
|
|
942
|
+
Ee(e, Ze, Qe, Y.value, X.value, (e, t) => {
|
|
943
|
+
!O.value && !k.value && it(e, t);
|
|
931
944
|
});
|
|
932
945
|
}, ht = (e, t, n, r) => {
|
|
933
946
|
mt([{
|
|
@@ -938,50 +951,50 @@ function useVirtualScroll(e, n = []) {
|
|
|
938
951
|
}]);
|
|
939
952
|
};
|
|
940
953
|
function gt() {
|
|
941
|
-
if (
|
|
942
|
-
let { rowIndex: e, colIndex: t, options: n } =
|
|
943
|
-
if (
|
|
944
|
-
let i = r.value.container || window, a = typeof window < "u" && i === window ? window.scrollX : i.scrollLeft, o = typeof window < "u" && i === window ? window.scrollY : i.scrollTop, s = g.value ? Math.abs(a) : a, c = o, u =
|
|
954
|
+
if (O.value && !f.value) {
|
|
955
|
+
let { rowIndex: e, colIndex: t, options: n } = O.value;
|
|
956
|
+
if (ce(n) && n.behavior === "smooth" && (l.value || k.value)) return;
|
|
957
|
+
let i = r.value.container || window, a = typeof window < "u" && i === window ? window.scrollX : i.scrollLeft, o = typeof window < "u" && i === window ? window.scrollY : i.scrollTop, s = g.value ? Math.abs(a) : a, c = o, u = me(s, 0, w.value), d = me(c, 0, E.value), { targetX: f, targetY: p } = ge({
|
|
945
958
|
rowIndex: e,
|
|
946
959
|
colIndex: t,
|
|
947
960
|
options: n,
|
|
948
|
-
direction:
|
|
961
|
+
direction: M.value,
|
|
949
962
|
viewportWidth: y.value,
|
|
950
963
|
viewportHeight: b.value,
|
|
951
|
-
totalWidth:
|
|
952
|
-
totalHeight:
|
|
964
|
+
totalWidth: Ge.value,
|
|
965
|
+
totalHeight: Ke.value,
|
|
953
966
|
gap: r.value.gap || 0,
|
|
954
967
|
columnGap: r.value.columnGap || 0,
|
|
955
968
|
fixedSize: F.value,
|
|
956
969
|
fixedWidth: I.value,
|
|
957
970
|
relativeScrollX: u,
|
|
958
971
|
relativeScrollY: d,
|
|
959
|
-
getItemSizeY: (e) =>
|
|
972
|
+
getItemSizeY: (e) => B.get(e),
|
|
960
973
|
getItemSizeX: (e) => L.get(e),
|
|
961
|
-
getItemQueryY: (e) =>
|
|
974
|
+
getItemQueryY: (e) => B.query(e),
|
|
962
975
|
getItemQueryX: (e) => L.query(e),
|
|
963
|
-
getColumnSize: (e) =>
|
|
964
|
-
getColumnQuery: (e) =>
|
|
976
|
+
getColumnSize: (e) => V.get(e),
|
|
977
|
+
getColumnQuery: (e) => V.query(e),
|
|
965
978
|
scaleX: w.value,
|
|
966
979
|
scaleY: E.value,
|
|
967
|
-
hostOffsetX:
|
|
968
|
-
hostOffsetY:
|
|
980
|
+
hostOffsetX: J.x,
|
|
981
|
+
hostOffsetY: J.y,
|
|
969
982
|
stickyIndices: r.value.stickyIndices || [],
|
|
970
|
-
stickyStartX:
|
|
971
|
-
stickyStartY:
|
|
972
|
-
stickyEndX:
|
|
973
|
-
stickyEndY:
|
|
974
|
-
flowPaddingStartX:
|
|
975
|
-
flowPaddingStartY:
|
|
976
|
-
paddingStartX:
|
|
977
|
-
paddingStartY:
|
|
978
|
-
paddingEndX:
|
|
979
|
-
paddingEndY:
|
|
980
|
-
}), m = 2 * w.value, h = 2 * E.value, _ = t == null || Math.abs(u - f) < m, v = e == null || Math.abs(d - p) < h;
|
|
983
|
+
stickyStartX: G.value,
|
|
984
|
+
stickyStartY: K.value,
|
|
985
|
+
stickyEndX: Pe.value,
|
|
986
|
+
stickyEndY: Fe.value,
|
|
987
|
+
flowPaddingStartX: q.value,
|
|
988
|
+
flowPaddingStartY: Le.value,
|
|
989
|
+
paddingStartX: Ae.value,
|
|
990
|
+
paddingStartY: Me.value,
|
|
991
|
+
paddingEndX: je.value,
|
|
992
|
+
paddingEndY: Ne.value
|
|
993
|
+
}), m = 2 * w.value, h = 2 * E.value, _ = t == null || y.value > 0 && Math.abs(u - f) < m, v = e == null || b.value > 0 && Math.abs(d - p) < h;
|
|
981
994
|
if (_ && v) {
|
|
982
|
-
let n = t == null || t === void 0 ||
|
|
983
|
-
n && r && !l.value && !
|
|
984
|
-
} else at(e, t,
|
|
995
|
+
let n = t == null || t === void 0 || pe.value[t] === 1, r = e == null || e === void 0 || H.value[e] === 1;
|
|
996
|
+
n && r && !l.value && !k.value && (O.value = null);
|
|
997
|
+
} else at(e, t, ce(n) ? {
|
|
985
998
|
...n,
|
|
986
999
|
isCorrection: !0
|
|
987
1000
|
} : {
|
|
@@ -990,11 +1003,12 @@ function useVirtualScroll(e, n = []) {
|
|
|
990
1003
|
});
|
|
991
1004
|
}
|
|
992
1005
|
}
|
|
993
|
-
|
|
994
|
-
|
|
1006
|
+
D([
|
|
1007
|
+
xe,
|
|
995
1008
|
y,
|
|
996
|
-
b
|
|
997
|
-
|
|
1009
|
+
b,
|
|
1010
|
+
f
|
|
1011
|
+
], gt), D(l, (e) => {
|
|
998
1012
|
e || gt();
|
|
999
1013
|
});
|
|
1000
1014
|
let Q = () => {
|
|
@@ -1009,7 +1023,7 @@ function useVirtualScroll(e, n = []) {
|
|
|
1009
1023
|
x: 0,
|
|
1010
1024
|
y: 0
|
|
1011
1025
|
};
|
|
1012
|
-
if (
|
|
1026
|
+
if (P(e)) {
|
|
1013
1027
|
let t = e.getBoundingClientRect();
|
|
1014
1028
|
return {
|
|
1015
1029
|
x: g.value ? t.right - n.right - e.scrollLeft : n.left - t.left + e.scrollLeft,
|
|
@@ -1031,18 +1045,18 @@ function useVirtualScroll(e, n = []) {
|
|
|
1031
1045
|
}
|
|
1032
1046
|
}, _t = (e) => {
|
|
1033
1047
|
if (typeof window > "u") return;
|
|
1034
|
-
let t = e || window, n = t === window ||
|
|
1035
|
-
n.addEventListener("scroll", pt, { passive: !0 }),
|
|
1048
|
+
let t = e || window, n = t === window || P(t) && t === document.documentElement ? document : t;
|
|
1049
|
+
n.addEventListener("scroll", pt, { passive: !0 }), rt();
|
|
1036
1050
|
let r = null;
|
|
1037
|
-
|
|
1051
|
+
P(t) && (r = new MutationObserver(() => rt()), r.observe(t, {
|
|
1038
1052
|
attributes: !0,
|
|
1039
1053
|
attributeFilter: ["dir", "style"]
|
|
1040
1054
|
}));
|
|
1041
|
-
let o = setInterval(
|
|
1055
|
+
let o = setInterval(rt, 1e3);
|
|
1042
1056
|
if (t === window) {
|
|
1043
1057
|
y.value = document.documentElement.clientWidth, b.value = document.documentElement.clientHeight, i.value = window.scrollX, a.value = window.scrollY;
|
|
1044
1058
|
let e = () => {
|
|
1045
|
-
|
|
1059
|
+
rt(), y.value = document.documentElement.clientWidth, b.value = document.documentElement.clientHeight, Q();
|
|
1046
1060
|
};
|
|
1047
1061
|
return window.addEventListener("resize", e), () => {
|
|
1048
1062
|
n.removeEventListener("scroll", pt), window.removeEventListener("resize", e), r?.disconnect(), clearInterval(o);
|
|
@@ -1050,30 +1064,30 @@ function useVirtualScroll(e, n = []) {
|
|
|
1050
1064
|
} else {
|
|
1051
1065
|
y.value = t.clientWidth, b.value = t.clientHeight, i.value = t.scrollLeft, a.value = t.scrollTop;
|
|
1052
1066
|
let e = new ResizeObserver(() => {
|
|
1053
|
-
|
|
1067
|
+
rt(), y.value = t.clientWidth, b.value = t.clientHeight, Q();
|
|
1054
1068
|
});
|
|
1055
1069
|
return e.observe(t), () => {
|
|
1056
1070
|
n.removeEventListener("scroll", pt), e.disconnect(), r?.disconnect(), clearInterval(o);
|
|
1057
1071
|
};
|
|
1058
1072
|
}
|
|
1059
1073
|
}, vt;
|
|
1060
|
-
return
|
|
1061
|
-
p.value = !0,
|
|
1074
|
+
return s() && (m(() => {
|
|
1075
|
+
p.value = !0, rt(), D(() => r.value.container, (e) => {
|
|
1062
1076
|
vt?.(), vt = _t(e || null);
|
|
1063
|
-
}, { immediate: !0 }), Q(),
|
|
1077
|
+
}, { immediate: !0 }), Q(), u(() => {
|
|
1064
1078
|
if (Q(), r.value.ssrRange || r.value.initialScrollIndex !== void 0) {
|
|
1065
1079
|
let e = r.value.initialScrollIndex === void 0 ? r.value.ssrRange?.start : r.value.initialScrollIndex, t = r.value.initialScrollAlign || "start";
|
|
1066
1080
|
e != null && at(e, r.value.ssrRange?.colStart, {
|
|
1067
1081
|
align: t,
|
|
1068
1082
|
behavior: "auto"
|
|
1069
|
-
}), d.value = !0, f.value = !0,
|
|
1083
|
+
}), d.value = !0, f.value = !0, u(() => {
|
|
1070
1084
|
f.value = !1;
|
|
1071
1085
|
});
|
|
1072
1086
|
} else d.value = !0;
|
|
1073
1087
|
});
|
|
1074
|
-
}),
|
|
1088
|
+
}), h(() => {
|
|
1075
1089
|
vt?.();
|
|
1076
|
-
})),
|
|
1090
|
+
})), D([
|
|
1077
1091
|
() => r.value.items,
|
|
1078
1092
|
() => r.value.items.length,
|
|
1079
1093
|
() => r.value.direction,
|
|
@@ -1084,39 +1098,39 @@ function useVirtualScroll(e, n = []) {
|
|
|
1084
1098
|
() => r.value.columnGap,
|
|
1085
1099
|
() => r.value.defaultItemSize,
|
|
1086
1100
|
() => r.value.defaultColumnWidth
|
|
1087
|
-
], () =>
|
|
1101
|
+
], () => Te(), { immediate: !0 }), D(() => [r.value.container, r.value.hostElement], () => {
|
|
1088
1102
|
Q();
|
|
1089
|
-
}),
|
|
1103
|
+
}), D(g, (e, t) => {
|
|
1090
1104
|
if (t === void 0 || e === t || !p.value) return;
|
|
1091
|
-
if (
|
|
1105
|
+
if (M.value === "vertical") {
|
|
1092
1106
|
Q();
|
|
1093
1107
|
return;
|
|
1094
1108
|
}
|
|
1095
|
-
let n =
|
|
1109
|
+
let n = me(t ? Math.abs(i.value) : i.value, x.x, w.value);
|
|
1096
1110
|
Q(), Z(n, null, { behavior: "auto" });
|
|
1097
|
-
}, { flush: "sync" }),
|
|
1098
|
-
!p.value || l.value ||
|
|
1099
|
-
}),
|
|
1100
|
-
|
|
1101
|
-
let i = Math.max(0,
|
|
1111
|
+
}, { flush: "sync" }), D([w, E], () => {
|
|
1112
|
+
!p.value || l.value || k.value || Z(o.value, c.value, { behavior: "auto" });
|
|
1113
|
+
}), D([() => r.value.items.length, () => r.value.columnCount], ([e, t], [n, r]) => {
|
|
1114
|
+
u(() => {
|
|
1115
|
+
let i = Math.max(0, Ge.value - y.value), a = Math.max(0, Ke.value - b.value);
|
|
1102
1116
|
o.value > i || c.value > a ? Z(Math.min(o.value, i), Math.min(c.value, a), { behavior: "auto" }) : (e !== n && E.value !== 1 || t !== r && w.value !== 1) && Z(o.value, c.value, { behavior: "auto" }), Q();
|
|
1103
1117
|
});
|
|
1104
1118
|
}), {
|
|
1105
1119
|
renderedItems: dt,
|
|
1106
|
-
totalWidth:
|
|
1107
|
-
totalHeight:
|
|
1108
|
-
renderedWidth:
|
|
1109
|
-
renderedHeight:
|
|
1120
|
+
totalWidth: Ge,
|
|
1121
|
+
totalHeight: Ke,
|
|
1122
|
+
renderedWidth: qe,
|
|
1123
|
+
renderedHeight: Je,
|
|
1110
1124
|
scrollDetails: ft,
|
|
1111
|
-
getRowHeight:
|
|
1112
|
-
getColumnWidth:
|
|
1113
|
-
getRowOffset: (e) =>
|
|
1125
|
+
getRowHeight: et,
|
|
1126
|
+
getColumnWidth: $e,
|
|
1127
|
+
getRowOffset: (e) => Le.value + K.value + Me.value + z(e, F.value, r.value.gap || 0, (e) => B.query(e)),
|
|
1114
1128
|
getColumnOffset: (e) => {
|
|
1115
|
-
let t =
|
|
1116
|
-
return
|
|
1129
|
+
let t = q.value + G.value + Ae.value;
|
|
1130
|
+
return M.value === "both" ? t + z(e, I.value, r.value.columnGap || 0, (e) => V.query(e)) : t + z(e, F.value, r.value.columnGap || 0, (e) => L.query(e));
|
|
1117
1131
|
},
|
|
1118
|
-
getItemOffset:
|
|
1119
|
-
getItemSize:
|
|
1132
|
+
getItemOffset: tt,
|
|
1133
|
+
getItemSize: nt,
|
|
1120
1134
|
scrollToIndex: at,
|
|
1121
1135
|
scrollToOffset: Z,
|
|
1122
1136
|
stopProgrammaticScroll: ne,
|
|
@@ -1124,39 +1138,41 @@ function useVirtualScroll(e, n = []) {
|
|
|
1124
1138
|
updateItemSize: ht,
|
|
1125
1139
|
updateItemSizes: mt,
|
|
1126
1140
|
updateHostOffset: Q,
|
|
1127
|
-
updateDirection:
|
|
1141
|
+
updateDirection: rt,
|
|
1128
1142
|
columnRange: ct,
|
|
1129
|
-
refresh: () =>
|
|
1143
|
+
refresh: () => Oe(),
|
|
1130
1144
|
isHydrated: d,
|
|
1131
|
-
isWindowContainer:
|
|
1145
|
+
isWindowContainer: He,
|
|
1132
1146
|
isRtl: g,
|
|
1133
1147
|
scaleX: w,
|
|
1134
1148
|
scaleY: E,
|
|
1135
|
-
componentOffset:
|
|
1136
|
-
renderedVirtualWidth:
|
|
1137
|
-
renderedVirtualHeight:
|
|
1138
|
-
getRowIndexAt:
|
|
1139
|
-
getColIndexAt:
|
|
1149
|
+
componentOffset: J,
|
|
1150
|
+
renderedVirtualWidth: Ye,
|
|
1151
|
+
renderedVirtualHeight: Xe,
|
|
1152
|
+
getRowIndexAt: Ze,
|
|
1153
|
+
getColIndexAt: Qe,
|
|
1140
1154
|
__internalState: lt.internalState
|
|
1141
1155
|
};
|
|
1142
1156
|
}
|
|
1143
|
-
|
|
1144
|
-
|
|
1157
|
+
//#endregion
|
|
1158
|
+
//#region src/composables/useVirtualScrollbar.ts
|
|
1159
|
+
function je(e) {
|
|
1160
|
+
let n = t(() => T(e)), r = t(() => n.value.axis === "horizontal"), i = t(() => n.value.totalSize <= 0 ? 0 : Math.min(1, n.value.viewportSize / n.value.totalSize)), a = t(() => {
|
|
1145
1161
|
let e = n.value.totalSize - n.value.viewportSize;
|
|
1146
1162
|
return e <= 0 ? 0 : Math.max(0, Math.min(1, n.value.position / e));
|
|
1147
|
-
}), o =
|
|
1163
|
+
}), o = t(() => {
|
|
1148
1164
|
let e = n.value.viewportSize > 0 ? 32 / n.value.viewportSize : .1;
|
|
1149
1165
|
return Math.max(Math.min(e, .1), i.value) * 100;
|
|
1150
|
-
}), c =
|
|
1166
|
+
}), c = t(() => a.value * (100 - o.value)), l = t(() => r.value ? {
|
|
1151
1167
|
inlineSize: `${o.value}%`,
|
|
1152
1168
|
insetInlineStart: `${c.value}%`
|
|
1153
1169
|
} : {
|
|
1154
1170
|
blockSize: `${o.value}%`,
|
|
1155
1171
|
insetBlockStart: `${c.value}%`
|
|
1156
|
-
}), u =
|
|
1172
|
+
}), u = t(() => {
|
|
1157
1173
|
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))";
|
|
1158
1174
|
return r.value ? { inlineSize: `calc(${Math.max(0, e - 4)}px - ${t})` } : { blockSize: `calc(${Math.max(0, e - 4)}px - ${t})` };
|
|
1159
|
-
}), d =
|
|
1175
|
+
}), d = v(!1), f = 0, p = 0;
|
|
1160
1176
|
function m(e) {
|
|
1161
1177
|
let t = e.currentTarget;
|
|
1162
1178
|
if (e.target !== t) return;
|
|
@@ -1180,7 +1196,7 @@ function useVirtualScrollbar(e) {
|
|
|
1180
1196
|
function y(e) {
|
|
1181
1197
|
d.value && (d.value = !1, e.currentTarget.releasePointerCapture(e.pointerId));
|
|
1182
1198
|
}
|
|
1183
|
-
return
|
|
1199
|
+
return s() && h(() => {
|
|
1184
1200
|
d.value = !1;
|
|
1185
1201
|
}), {
|
|
1186
1202
|
viewportPercent: i,
|
|
@@ -1189,7 +1205,7 @@ function useVirtualScrollbar(e) {
|
|
|
1189
1205
|
thumbPositionPercent: c,
|
|
1190
1206
|
trackStyle: u,
|
|
1191
1207
|
thumbStyle: l,
|
|
1192
|
-
trackProps:
|
|
1208
|
+
trackProps: t(() => ({
|
|
1193
1209
|
class: ["virtual-scrollbar-track", `virtual-scrollbar-track--${r.value ? "horizontal" : "vertical"}`],
|
|
1194
1210
|
style: u.value,
|
|
1195
1211
|
role: "scrollbar",
|
|
@@ -1202,7 +1218,7 @@ function useVirtualScrollbar(e) {
|
|
|
1202
1218
|
tabindex: -1,
|
|
1203
1219
|
onMousedown: m
|
|
1204
1220
|
})),
|
|
1205
|
-
thumbProps:
|
|
1221
|
+
thumbProps: t(() => ({
|
|
1206
1222
|
class: [
|
|
1207
1223
|
"virtual-scrollbar-thumb",
|
|
1208
1224
|
`virtual-scrollbar-thumb--${r.value ? "horizontal" : "vertical"}`,
|
|
@@ -1217,14 +1233,16 @@ function useVirtualScrollbar(e) {
|
|
|
1217
1233
|
isDragging: d
|
|
1218
1234
|
};
|
|
1219
1235
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1236
|
+
//#endregion
|
|
1237
|
+
//#region src/extensions/rtl.ts
|
|
1238
|
+
function Me() {
|
|
1239
|
+
let e = v(!1);
|
|
1222
1240
|
return {
|
|
1223
1241
|
name: "rtl",
|
|
1224
1242
|
onInit(t) {
|
|
1225
1243
|
let n = () => {
|
|
1226
1244
|
if (typeof window > "u") return;
|
|
1227
|
-
let n = t.props.value.container || t.props.value.hostRef || window, r =
|
|
1245
|
+
let n = t.props.value.container || t.props.value.hostRef || window, r = P(n) ? n : document.documentElement, i = window.getComputedStyle(r).direction === "rtl";
|
|
1228
1246
|
e.value !== i && (e.value = i, t.internalState.isRtl.value = i);
|
|
1229
1247
|
}, r = t.methods.updateDirection;
|
|
1230
1248
|
t.methods.updateDirection = () => {
|
|
@@ -1233,18 +1251,20 @@ function useRtlExtension() {
|
|
|
1233
1251
|
}
|
|
1234
1252
|
};
|
|
1235
1253
|
}
|
|
1236
|
-
|
|
1254
|
+
//#endregion
|
|
1255
|
+
//#region src/extensions/snapping.ts
|
|
1256
|
+
function Ne() {
|
|
1237
1257
|
return {
|
|
1238
1258
|
name: "snapping",
|
|
1239
1259
|
onScrollEnd(e) {
|
|
1240
1260
|
if (!e.props.value.snap || e.internalState.isProgrammaticScroll.value) return;
|
|
1241
1261
|
let t = e.props.value.snap, n = t === !0 ? "auto" : t, r = e.scrollDetails.value, i = e.props.value.items.length, a = e.props.value.direction || "vertical", o = r.currentIndex, s = r.currentColIndex, c = "start", l = "start", u = !1;
|
|
1242
1262
|
if (a !== "horizontal") {
|
|
1243
|
-
let t =
|
|
1263
|
+
let t = Ee(n, e.internalState.scrollDirectionY.value, r.currentIndex, r.currentEndIndex, e.internalState.relativeScrollY.value, e.internalState.viewportHeight.value, i, (t) => e.methods.getItemSize(t), (t) => e.methods.getItemOffset(t), e.methods.getRowIndexAt);
|
|
1244
1264
|
t && (o = t.index, c = t.align, u = !0);
|
|
1245
1265
|
}
|
|
1246
1266
|
if (a !== "vertical") {
|
|
1247
|
-
let t = a === "both" ? e.props.value.columnCount || 0 : i, o =
|
|
1267
|
+
let t = a === "both" ? e.props.value.columnCount || 0 : i, o = Ee(n, e.internalState.scrollDirectionX.value, r.currentColIndex, r.currentEndColIndex, e.internalState.relativeScrollX.value, e.internalState.viewportWidth.value, t, (t) => e.methods.getItemSize(t), (t) => e.methods.getItemOffset(t), e.methods.getColIndexAt);
|
|
1248
1268
|
o && (s = o.index, l = o.align, u = !0);
|
|
1249
1269
|
}
|
|
1250
1270
|
if (u) {
|
|
@@ -1266,23 +1286,27 @@ function useSnappingExtension() {
|
|
|
1266
1286
|
}
|
|
1267
1287
|
};
|
|
1268
1288
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1289
|
+
//#endregion
|
|
1290
|
+
//#region src/extensions/sticky.ts
|
|
1291
|
+
function G() {
|
|
1292
|
+
let e = (e) => t(() => (e.props.value.stickyIndices || []).toSorted((e, t) => e - t));
|
|
1271
1293
|
return {
|
|
1272
1294
|
name: "sticky",
|
|
1273
1295
|
transformRenderedItems(t, n) {
|
|
1274
1296
|
let r = e(n).value;
|
|
1275
1297
|
if (r.length === 0) return t;
|
|
1276
|
-
let { start: i } = n.range.value, a = n.currentIndex.value, o =
|
|
1298
|
+
let { start: i } = n.range.value, a = n.currentIndex.value, o = de(r, a), s = [...t];
|
|
1277
1299
|
return o !== void 0 && o < i && t.some((e) => e.index === o), s;
|
|
1278
1300
|
}
|
|
1279
1301
|
};
|
|
1280
1302
|
}
|
|
1281
|
-
|
|
1303
|
+
//#endregion
|
|
1304
|
+
//#region src/extensions/infinite-loading.ts
|
|
1305
|
+
function Pe(e) {
|
|
1282
1306
|
return {
|
|
1283
1307
|
name: "infinite-loading",
|
|
1284
1308
|
onInit(t) {
|
|
1285
|
-
|
|
1309
|
+
D(t.scrollDetails, (n) => {
|
|
1286
1310
|
if (t.props.value.loading || !n || !n.totalSize || n.totalSize.width === 0 && n.totalSize.height === 0) return;
|
|
1287
1311
|
let r = t.props.value.direction || "vertical", i = t.props.value.loadDistance ?? 200;
|
|
1288
1312
|
r !== "horizontal" && n.totalSize.height - (n.scrollOffset.y + n.viewportSize.height) <= i && e.onLoad("vertical"), r !== "vertical" && n.totalSize.width - (n.scrollOffset.x + n.viewportSize.width) <= i && e.onLoad("horizontal");
|
|
@@ -1290,17 +1314,19 @@ function useInfiniteLoadingExtension(e) {
|
|
|
1290
1314
|
}
|
|
1291
1315
|
};
|
|
1292
1316
|
}
|
|
1293
|
-
|
|
1317
|
+
//#endregion
|
|
1318
|
+
//#region src/extensions/prepend-restoration.ts
|
|
1319
|
+
function K() {
|
|
1294
1320
|
let e = [];
|
|
1295
1321
|
return {
|
|
1296
1322
|
name: "prepend-restoration",
|
|
1297
1323
|
onInit(t) {
|
|
1298
|
-
e = [...t.props.value.items],
|
|
1324
|
+
e = [...t.props.value.items], D(() => t.props.value.items, (n) => {
|
|
1299
1325
|
if (!t.props.value.restoreScrollOnPrepend) {
|
|
1300
1326
|
e = [...n];
|
|
1301
1327
|
return;
|
|
1302
1328
|
}
|
|
1303
|
-
let r =
|
|
1329
|
+
let r = Ce(e, n);
|
|
1304
1330
|
if (r > 0) {
|
|
1305
1331
|
let e = t.props.value.direction || "vertical", i = (e === "horizontal" ? t.props.value.columnGap : t.props.value.gap) || 0, a = 0;
|
|
1306
1332
|
for (let e = 0; e < r; e++) a += t.methods.getItemBaseSize(n[e], e) + i;
|
|
@@ -1311,18 +1337,22 @@ function usePrependRestorationExtension() {
|
|
|
1311
1337
|
}
|
|
1312
1338
|
};
|
|
1313
1339
|
}
|
|
1314
|
-
|
|
1340
|
+
//#endregion
|
|
1341
|
+
//#region src/extensions/coordinate-scaling.ts
|
|
1342
|
+
function Fe() {
|
|
1315
1343
|
return {
|
|
1316
1344
|
name: "coordinate-scaling",
|
|
1317
1345
|
onInit(e) {
|
|
1318
|
-
|
|
1346
|
+
O(() => {
|
|
1319
1347
|
let t = e.props.value.container, n = e.totalSize.value, r = e.internalState.viewportWidth.value, i = e.internalState.viewportHeight.value, a = typeof window < "u" && t === window || t === void 0;
|
|
1320
|
-
n && r && i && (e.internalState.scaleX.value =
|
|
1348
|
+
n && r && i && (e.internalState.scaleX.value = H(a, n.width, r), e.internalState.scaleY.value = H(a, n.height, i));
|
|
1321
1349
|
});
|
|
1322
1350
|
}
|
|
1323
1351
|
};
|
|
1324
1352
|
}
|
|
1325
|
-
|
|
1353
|
+
//#endregion
|
|
1354
|
+
//#region src/components/VirtualScrollbar.vue
|
|
1355
|
+
var q = /* @__PURE__ */ o({
|
|
1326
1356
|
__name: "VirtualScrollbar",
|
|
1327
1357
|
props: {
|
|
1328
1358
|
axis: { default: "vertical" },
|
|
@@ -1339,7 +1369,7 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1339
1369
|
},
|
|
1340
1370
|
emits: ["scrollToOffset"],
|
|
1341
1371
|
setup(e, { emit: t }) {
|
|
1342
|
-
let n = e, r = t, { trackProps: o, thumbProps: s } =
|
|
1372
|
+
let n = e, r = t, { trackProps: o, thumbProps: s } = je(() => ({
|
|
1343
1373
|
axis: n.axis,
|
|
1344
1374
|
totalSize: n.totalSize,
|
|
1345
1375
|
position: n.position,
|
|
@@ -1350,20 +1380,20 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1350
1380
|
n.scrollToOffset?.(e), r("scrollToOffset", e);
|
|
1351
1381
|
}
|
|
1352
1382
|
}));
|
|
1353
|
-
return (e, t) => (
|
|
1383
|
+
return (e, t) => (g(), i("div", f(c(E(o))), [a("div", f(c(E(s))), null, 16)], 16));
|
|
1354
1384
|
}
|
|
1355
|
-
}),
|
|
1385
|
+
}), Ie = {
|
|
1356
1386
|
key: 0,
|
|
1357
1387
|
class: "virtual-scroll-scrollbar-container",
|
|
1358
1388
|
"aria-hidden": "true"
|
|
1359
|
-
},
|
|
1389
|
+
}, Le = {
|
|
1360
1390
|
key: 0,
|
|
1361
1391
|
class: "virtual-scroll-debug-info"
|
|
1362
|
-
},
|
|
1392
|
+
}, Re = .95, ze = .1, Be = /* @__PURE__ */ ((e, t) => {
|
|
1363
1393
|
let n = e.__vccOpts || e;
|
|
1364
1394
|
for (let [e, r] of t) n[e] = r;
|
|
1365
1395
|
return n;
|
|
1366
|
-
})(/* @__PURE__ */
|
|
1396
|
+
})(/* @__PURE__ */ o({
|
|
1367
1397
|
__name: "VirtualScroll",
|
|
1368
1398
|
props: {
|
|
1369
1399
|
containerTag: { default: "div" },
|
|
@@ -1424,51 +1454,51 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1424
1454
|
"visibleRangeChange"
|
|
1425
1455
|
],
|
|
1426
1456
|
setup(o, { expose: s, emit: c }) {
|
|
1427
|
-
let _ = o, S = c, T =
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
],
|
|
1435
|
-
let e =
|
|
1436
|
-
return e ===
|
|
1437
|
-
}), F =
|
|
1457
|
+
let _ = o, S = c, T = te(), O = v(null), A = v(null), ne = v(null), re = v(null), j = /* @__PURE__ */ new Map(), M = ee(), N = t(() => `vs-container-${M}`), ie = [
|
|
1458
|
+
Me(),
|
|
1459
|
+
Ne(),
|
|
1460
|
+
G(),
|
|
1461
|
+
Pe({ onLoad: (e) => S("load", e) }),
|
|
1462
|
+
K(),
|
|
1463
|
+
Fe()
|
|
1464
|
+
], P = v(0), oe = v(0), se = t(() => _.container === void 0 ? O.value : _.container), ce = t(() => {
|
|
1465
|
+
let e = se.value;
|
|
1466
|
+
return e === O.value || ae(e);
|
|
1467
|
+
}), F = t(() => (_.items.length, {
|
|
1438
1468
|
items: _.items,
|
|
1439
1469
|
itemSize: _.itemSize,
|
|
1440
1470
|
direction: _.direction,
|
|
1441
1471
|
bufferBefore: _.bufferBefore,
|
|
1442
1472
|
bufferAfter: _.bufferAfter,
|
|
1443
|
-
container:
|
|
1444
|
-
hostElement:
|
|
1445
|
-
hostRef:
|
|
1473
|
+
container: se.value,
|
|
1474
|
+
hostElement: A.value,
|
|
1475
|
+
hostRef: O.value,
|
|
1446
1476
|
ssrRange: _.ssrRange,
|
|
1447
1477
|
columnCount: _.columnCount,
|
|
1448
1478
|
columnWidth: _.columnWidth,
|
|
1449
1479
|
scrollPaddingStart: {
|
|
1450
|
-
x:
|
|
1451
|
-
y:
|
|
1480
|
+
x: le(_.scrollPaddingStart, _.direction),
|
|
1481
|
+
y: ue(_.scrollPaddingStart, _.direction)
|
|
1452
1482
|
},
|
|
1453
1483
|
scrollPaddingEnd: {
|
|
1454
|
-
x:
|
|
1455
|
-
y:
|
|
1484
|
+
x: le(_.scrollPaddingEnd, _.direction),
|
|
1485
|
+
y: ue(_.scrollPaddingEnd, _.direction)
|
|
1456
1486
|
},
|
|
1457
1487
|
flowPaddingStart: {
|
|
1458
1488
|
x: 0,
|
|
1459
|
-
y: _.stickyHeader ? 0 :
|
|
1489
|
+
y: _.stickyHeader ? 0 : P.value
|
|
1460
1490
|
},
|
|
1461
1491
|
flowPaddingEnd: {
|
|
1462
1492
|
x: 0,
|
|
1463
|
-
y: _.stickyFooter ? 0 :
|
|
1493
|
+
y: _.stickyFooter ? 0 : oe.value
|
|
1464
1494
|
},
|
|
1465
1495
|
stickyStart: {
|
|
1466
1496
|
x: 0,
|
|
1467
|
-
y: _.stickyHeader &&
|
|
1497
|
+
y: _.stickyHeader && ce.value ? P.value : 0
|
|
1468
1498
|
},
|
|
1469
1499
|
stickyEnd: {
|
|
1470
1500
|
x: 0,
|
|
1471
|
-
y: _.stickyFooter &&
|
|
1501
|
+
y: _.stickyFooter && ce.value ? oe.value : 0
|
|
1472
1502
|
},
|
|
1473
1503
|
gap: _.gap,
|
|
1474
1504
|
columnGap: _.columnGap,
|
|
@@ -1482,56 +1512,56 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1482
1512
|
defaultColumnWidth: _.defaultColumnWidth,
|
|
1483
1513
|
debug: _.debug,
|
|
1484
1514
|
snap: _.snap
|
|
1485
|
-
})), { isHydrated: I, isRtl:
|
|
1486
|
-
function
|
|
1515
|
+
})), { isHydrated: I, isRtl: de, columnRange: fe, renderedItems: L, scrollDetails: R, renderedHeight: z, renderedWidth: B, getColumnWidth: V, getRowHeight: pe, scrollToIndex: H, scrollToOffset: U, updateHostOffset: he, updateItemSizes: ge, updateDirection: _e, getItemOffset: ve, getRowOffset: ye, getColumnOffset: be, getItemSize: Se, refresh: Ce, stopProgrammaticScroll: W, scaleX: Ee, scaleY: De, isWindowContainer: Oe, componentOffset: ke, renderedVirtualWidth: Be, renderedVirtualHeight: Ve, getRowIndexAt: He, getColIndexAt: Ue } = Ae(F, ie), We = t(() => Ee.value !== 1 || De.value !== 1), Ge = t(() => Oe.value ? !1 : _.virtualScrollbar === !0 || Ee.value !== 1 || De.value !== 1);
|
|
1516
|
+
function Ke(e) {
|
|
1487
1517
|
let { displayViewportSize: t } = R.value;
|
|
1488
|
-
e >=
|
|
1518
|
+
e >= z.value - t.height - .5 ? U(null, Infinity) : U(null, me(e, ke.y, De.value));
|
|
1489
1519
|
}
|
|
1490
|
-
function
|
|
1520
|
+
function J(e) {
|
|
1491
1521
|
let { displayViewportSize: t } = R.value;
|
|
1492
|
-
e >=
|
|
1522
|
+
e >= B.value - t.width - .5 ? U(Infinity, null) : U(me(e, ke.x, Ee.value), null);
|
|
1493
1523
|
}
|
|
1494
|
-
let
|
|
1524
|
+
let qe = je(t(() => ({
|
|
1495
1525
|
axis: "vertical",
|
|
1496
|
-
totalSize:
|
|
1526
|
+
totalSize: z.value,
|
|
1497
1527
|
position: R.value.displayScrollOffset.y,
|
|
1498
1528
|
viewportSize: R.value.displayViewportSize.height,
|
|
1499
|
-
scrollToOffset:
|
|
1500
|
-
containerId:
|
|
1501
|
-
isRtl:
|
|
1502
|
-
}))),
|
|
1529
|
+
scrollToOffset: Ke,
|
|
1530
|
+
containerId: N.value,
|
|
1531
|
+
isRtl: de.value
|
|
1532
|
+
}))), Je = je(t(() => ({
|
|
1503
1533
|
axis: "horizontal",
|
|
1504
|
-
totalSize:
|
|
1534
|
+
totalSize: B.value,
|
|
1505
1535
|
position: R.value.displayScrollOffset.x,
|
|
1506
1536
|
viewportSize: R.value.displayViewportSize.width,
|
|
1507
|
-
scrollToOffset:
|
|
1508
|
-
containerId:
|
|
1509
|
-
isRtl:
|
|
1510
|
-
}))),
|
|
1511
|
-
...
|
|
1537
|
+
scrollToOffset: J,
|
|
1538
|
+
containerId: N.value,
|
|
1539
|
+
isRtl: de.value
|
|
1540
|
+
}))), Ye = t(() => _.direction === "both" ? {
|
|
1541
|
+
...fe.value,
|
|
1512
1542
|
padStart: 0,
|
|
1513
1543
|
padEnd: 0
|
|
1514
|
-
} :
|
|
1515
|
-
function
|
|
1516
|
-
|
|
1544
|
+
} : fe.value);
|
|
1545
|
+
function Xe() {
|
|
1546
|
+
Ce(), _e(), u(() => {
|
|
1517
1547
|
let e = [];
|
|
1518
|
-
for (let [t, n] of
|
|
1548
|
+
for (let [t, n] of j.entries()) n && e.push({
|
|
1519
1549
|
index: t,
|
|
1520
1550
|
inlineSize: n.offsetWidth,
|
|
1521
1551
|
blockSize: n.offsetHeight,
|
|
1522
1552
|
element: n
|
|
1523
1553
|
});
|
|
1524
|
-
e.length > 0 &&
|
|
1554
|
+
e.length > 0 && ge(e);
|
|
1525
1555
|
});
|
|
1526
1556
|
}
|
|
1527
|
-
|
|
1557
|
+
D(R, (e, t) => {
|
|
1528
1558
|
!I.value || !e || (S("scroll", e), (!t || !t.range || !t.columnRange || e.range.start !== t.range.start || e.range.end !== t.range.end || e.columnRange.start !== t.columnRange.start || e.columnRange.end !== t.columnRange.end) && S("visibleRangeChange", {
|
|
1529
1559
|
start: e.range.start,
|
|
1530
1560
|
end: e.range.end,
|
|
1531
1561
|
colStart: e.columnRange.start,
|
|
1532
1562
|
colEnd: e.columnRange.end
|
|
1533
1563
|
}));
|
|
1534
|
-
}),
|
|
1564
|
+
}), D(I, (e) => {
|
|
1535
1565
|
e && R.value?.range && R.value?.columnRange && S("visibleRangeChange", {
|
|
1536
1566
|
start: R.value.range.start,
|
|
1537
1567
|
end: R.value.range.end,
|
|
@@ -1539,7 +1569,7 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1539
1569
|
colEnd: R.value.columnRange.end
|
|
1540
1570
|
});
|
|
1541
1571
|
}, { once: !0 });
|
|
1542
|
-
let
|
|
1572
|
+
let Y = typeof window > "u" ? null : new ResizeObserver(he), X = typeof window > "u" ? null : new ResizeObserver((e) => {
|
|
1543
1573
|
let t = [];
|
|
1544
1574
|
for (let n of e) {
|
|
1545
1575
|
let e = n.target, r = Number(e.dataset.index), i = e.dataset.colIndex, a = n.contentRect.width, o = n.contentRect.height;
|
|
@@ -1555,41 +1585,41 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1555
1585
|
element: e
|
|
1556
1586
|
});
|
|
1557
1587
|
}
|
|
1558
|
-
t.length > 0 &&
|
|
1559
|
-
}),
|
|
1560
|
-
|
|
1588
|
+
t.length > 0 && ge(t);
|
|
1589
|
+
}), Ze = typeof window > "u" ? null : new ResizeObserver(() => {
|
|
1590
|
+
P.value = ne.value?.offsetHeight || 0, oe.value = re.value?.offsetHeight || 0, he();
|
|
1561
1591
|
});
|
|
1562
|
-
function
|
|
1563
|
-
|
|
1564
|
-
n &&
|
|
1592
|
+
function Qe(e, t) {
|
|
1593
|
+
D(e, (e, n) => {
|
|
1594
|
+
n && Ze?.unobserve(n), e ? Ze?.observe(e) : t.value = 0;
|
|
1565
1595
|
}, { immediate: !0 });
|
|
1566
1596
|
}
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
for (let e of
|
|
1570
|
-
}),
|
|
1571
|
-
t &&
|
|
1572
|
-
}),
|
|
1597
|
+
Qe(ne, P), Qe(re, oe), m(() => {
|
|
1598
|
+
O.value && Y?.observe(O.value);
|
|
1599
|
+
for (let e of j.values()) $e(e, !0);
|
|
1600
|
+
}), D([O, A], ([e], [t]) => {
|
|
1601
|
+
t && Y?.unobserve(t), e && Y?.observe(e);
|
|
1602
|
+
}), D([O, We], ([e, t], [n, r]) => {
|
|
1573
1603
|
let i = e !== n || t !== r;
|
|
1574
1604
|
n && i && n.removeEventListener("wheel", ft), e && i && e.addEventListener("wheel", ft, { passive: !t });
|
|
1575
1605
|
}, { immediate: !0 });
|
|
1576
|
-
function
|
|
1606
|
+
function $e(e, t) {
|
|
1577
1607
|
let n = t ? "observe" : "unobserve";
|
|
1578
|
-
|
|
1608
|
+
X?.[n](e), _.direction === "both" && e.children.length > 0 && e.querySelectorAll("[data-col-index]").forEach((e) => X?.[n](e));
|
|
1579
1609
|
}
|
|
1580
|
-
function
|
|
1610
|
+
function et(e, t) {
|
|
1581
1611
|
if (e) {
|
|
1582
1612
|
let n = e;
|
|
1583
|
-
|
|
1613
|
+
j.set(t, n), $e(n, !0);
|
|
1584
1614
|
} else {
|
|
1585
|
-
let e =
|
|
1586
|
-
e && (
|
|
1615
|
+
let e = j.get(t);
|
|
1616
|
+
e && ($e(e, !1), j.delete(t));
|
|
1587
1617
|
}
|
|
1588
1618
|
}
|
|
1589
|
-
let
|
|
1619
|
+
let tt = v(!1), nt = {
|
|
1590
1620
|
x: 0,
|
|
1591
1621
|
y: 0
|
|
1592
|
-
},
|
|
1622
|
+
}, rt = {
|
|
1593
1623
|
x: 0,
|
|
1594
1624
|
y: 0
|
|
1595
1625
|
}, it = {
|
|
@@ -1601,10 +1631,10 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1601
1631
|
}, ot = null;
|
|
1602
1632
|
function st() {
|
|
1603
1633
|
let e = () => {
|
|
1604
|
-
let { nextVelocity: t, delta: n } =
|
|
1634
|
+
let { nextVelocity: t, delta: n } = we(Z, Re);
|
|
1605
1635
|
Z.x = t.x, Z.y = t.y;
|
|
1606
1636
|
let { x: r, y: i } = R.value.scrollOffset;
|
|
1607
|
-
|
|
1637
|
+
U(r + n.x, i + n.y, { behavior: "auto" }), Math.abs(Z.x) > ze || Math.abs(Z.y) > ze ? ot = requestAnimationFrame(e) : ct();
|
|
1608
1638
|
};
|
|
1609
1639
|
ot = requestAnimationFrame(e);
|
|
1610
1640
|
}
|
|
@@ -1615,22 +1645,22 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1615
1645
|
};
|
|
1616
1646
|
}
|
|
1617
1647
|
function lt(e) {
|
|
1618
|
-
|
|
1648
|
+
W(), ct(), We.value && (e.pointerType === "mouse" && e.button !== 0 || (tt.value = !0, nt = {
|
|
1619
1649
|
x: e.clientX,
|
|
1620
1650
|
y: e.clientY
|
|
1621
1651
|
}, it = {
|
|
1622
1652
|
x: e.clientX,
|
|
1623
1653
|
y: e.clientY
|
|
1624
|
-
}, at = performance.now(),
|
|
1654
|
+
}, at = performance.now(), rt = {
|
|
1625
1655
|
x: R.value.scrollOffset.x,
|
|
1626
1656
|
y: R.value.scrollOffset.y
|
|
1627
1657
|
}, e.currentTarget.setPointerCapture(e.pointerId)));
|
|
1628
1658
|
}
|
|
1629
1659
|
function ut(e) {
|
|
1630
|
-
if (!
|
|
1660
|
+
if (!tt.value) return;
|
|
1631
1661
|
let t = performance.now(), n = t - at;
|
|
1632
1662
|
if (n > 0) {
|
|
1633
|
-
let t =
|
|
1663
|
+
let t = Te(it, {
|
|
1634
1664
|
x: e.clientX,
|
|
1635
1665
|
y: e.clientY
|
|
1636
1666
|
}, n);
|
|
@@ -1640,26 +1670,26 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1640
1670
|
x: e.clientX,
|
|
1641
1671
|
y: e.clientY
|
|
1642
1672
|
}, at = t;
|
|
1643
|
-
let r =
|
|
1673
|
+
let r = nt.x - e.clientX, i = nt.y - e.clientY;
|
|
1644
1674
|
requestAnimationFrame(() => {
|
|
1645
|
-
|
|
1675
|
+
U(rt.x + r, rt.y + i, { behavior: "auto" });
|
|
1646
1676
|
});
|
|
1647
1677
|
}
|
|
1648
1678
|
function dt(e) {
|
|
1649
|
-
|
|
1679
|
+
tt.value && (tt.value = !1, e.currentTarget.releasePointerCapture(e.pointerId), (Math.abs(Z.x) > ze || Math.abs(Z.y) > ze) && (Math.abs(Z.x) > 4 * Math.abs(Z.y) ? Z.y = 0 : Math.abs(Z.y) > 4 * Math.abs(Z.x) && (Z.x = 0), st()));
|
|
1650
1680
|
}
|
|
1651
1681
|
function ft(e) {
|
|
1652
1682
|
let { scrollOffset: t } = R.value;
|
|
1653
|
-
if (
|
|
1683
|
+
if (W(), We.value) {
|
|
1654
1684
|
e.preventDefault();
|
|
1655
1685
|
let { deltaX: n, deltaY: r } = e;
|
|
1656
|
-
e.shiftKey && n === 0 && (n = r, r = 0),
|
|
1686
|
+
e.shiftKey && n === 0 && (n = r, r = 0), U(t.x + n, t.y + r, { behavior: "auto" });
|
|
1657
1687
|
}
|
|
1658
1688
|
}
|
|
1659
1689
|
function pt(e) {
|
|
1660
1690
|
let { viewportSize: t, scrollOffset: n } = R.value, r = _.direction !== "vertical", i = _.direction !== "horizontal", a = F.value, o = a.stickyStart, s = a.stickyEnd, c = a.scrollPaddingStart, l = a.scrollPaddingEnd, u = _.snap === !0 ? "auto" : _.snap, d = u && u !== "auto" ? u : null, f = (e) => {
|
|
1661
1691
|
let r = (e ? n.x : n.y) + (e ? t.width : t.height) / 2;
|
|
1662
|
-
return e ?
|
|
1692
|
+
return e ? Ue(r) : He(r);
|
|
1663
1693
|
}, { currentIndex: p, currentEndIndex: m, currentColIndex: h, currentEndColIndex: g } = R.value, v = (e, t) => {
|
|
1664
1694
|
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;
|
|
1665
1695
|
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;
|
|
@@ -1667,78 +1697,78 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1667
1697
|
let i = !e;
|
|
1668
1698
|
if (d === "center") {
|
|
1669
1699
|
let t = f(i), n = i && _.columnCount ? _.columnCount - 1 : _.items.length - 1, a = r ? Math.min(n, t + 1) : Math.max(0, t - 1);
|
|
1670
|
-
|
|
1700
|
+
H(e ? a : null, i ? a : null, { align: "center" });
|
|
1671
1701
|
return;
|
|
1672
1702
|
}
|
|
1673
|
-
if (e) if (r) if (d === "start")
|
|
1703
|
+
if (e) if (r) if (d === "start") H(Math.min(_.items.length - 1, p + 1), null, { align: "start" });
|
|
1674
1704
|
else {
|
|
1675
1705
|
let e = d || "end", r = n.y + t.height - (s.y + l.y);
|
|
1676
|
-
|
|
1706
|
+
ye(m) + pe(m) > r + 1 ? H(m, null, { align: e }) : m < _.items.length - 1 && H(m + 1, null, { align: e });
|
|
1677
1707
|
}
|
|
1678
|
-
else if (d === "end")
|
|
1708
|
+
else if (d === "end") H(Math.max(0, m - 1), null, { align: "end" });
|
|
1679
1709
|
else {
|
|
1680
1710
|
let e = d || "start", t = n.y + o.y + c.y;
|
|
1681
|
-
|
|
1711
|
+
ye(p) < t - 1 ? H(p, null, { align: e }) : p > 0 && H(p - 1, null, { align: e });
|
|
1682
1712
|
}
|
|
1683
1713
|
else {
|
|
1684
1714
|
let e = _.columnCount ? _.columnCount - 1 : _.items.length - 1;
|
|
1685
|
-
if (
|
|
1715
|
+
if (de.value ? !r : r) if (d === "start") H(null, Math.min(e, h + 1), { align: "start" });
|
|
1686
1716
|
else {
|
|
1687
1717
|
let r = d || "end", i = n.x + t.width - (s.x + l.x);
|
|
1688
|
-
(_.columnCount ?
|
|
1718
|
+
(_.columnCount ? be(g) + V(g) : ve(g) + Se(g)) > i + 1 ? H(null, g, { align: r }) : g < e && H(null, g + 1, { align: r });
|
|
1689
1719
|
}
|
|
1690
|
-
else if (d === "end")
|
|
1720
|
+
else if (d === "end") H(null, Math.max(0, g - 1), { align: "end" });
|
|
1691
1721
|
else {
|
|
1692
1722
|
let e = d || "start", t = n.x + o.x + c.x;
|
|
1693
|
-
(_.columnCount ?
|
|
1723
|
+
(_.columnCount ? be(h) : ve(h)) < t - 1 ? H(null, h, { align: e }) : h > 0 && H(null, h - 1, { align: e });
|
|
1694
1724
|
}
|
|
1695
1725
|
}
|
|
1696
1726
|
};
|
|
1697
1727
|
switch (e.key) {
|
|
1698
1728
|
case "Home":
|
|
1699
|
-
e.preventDefault(),
|
|
1729
|
+
e.preventDefault(), W(), H(0, 0, {
|
|
1700
1730
|
behavior: Math.max(n.x, n.y) > 10 * (_.direction === "horizontal" ? t.width : t.height) ? "auto" : "smooth",
|
|
1701
1731
|
align: "start"
|
|
1702
1732
|
});
|
|
1703
1733
|
break;
|
|
1704
1734
|
case "End": {
|
|
1705
|
-
e.preventDefault(),
|
|
1735
|
+
e.preventDefault(), W();
|
|
1706
1736
|
let r = _.items.length - 1, i = (_.columnCount || 0) > 0 ? _.columnCount - 1 : 0, { totalSize: a } = R.value, o = Math.max(a.width - n.x - t.width, a.height - n.y - t.height) > 10 * (_.direction === "horizontal" ? t.width : t.height) ? "auto" : "smooth";
|
|
1707
|
-
_.direction === "both" ?
|
|
1737
|
+
_.direction === "both" ? H(r, i, {
|
|
1708
1738
|
behavior: o,
|
|
1709
1739
|
align: "end"
|
|
1710
|
-
}) :
|
|
1740
|
+
}) : H(_.direction === "vertical" ? r : 0, _.direction === "horizontal" ? r : 0, {
|
|
1711
1741
|
behavior: o,
|
|
1712
1742
|
align: "end"
|
|
1713
1743
|
});
|
|
1714
1744
|
break;
|
|
1715
1745
|
}
|
|
1716
1746
|
case "ArrowUp":
|
|
1717
|
-
e.preventDefault(),
|
|
1747
|
+
e.preventDefault(), W(), i && y(!0, !1);
|
|
1718
1748
|
break;
|
|
1719
1749
|
case "ArrowDown":
|
|
1720
|
-
e.preventDefault(),
|
|
1750
|
+
e.preventDefault(), W(), i && y(!0, !0);
|
|
1721
1751
|
break;
|
|
1722
1752
|
case "ArrowLeft":
|
|
1723
|
-
e.preventDefault(),
|
|
1753
|
+
e.preventDefault(), W(), r && y(!1, !1);
|
|
1724
1754
|
break;
|
|
1725
1755
|
case "ArrowRight":
|
|
1726
|
-
e.preventDefault(),
|
|
1756
|
+
e.preventDefault(), W(), r && y(!1, !0);
|
|
1727
1757
|
break;
|
|
1728
1758
|
case "PageUp":
|
|
1729
|
-
e.preventDefault(),
|
|
1759
|
+
e.preventDefault(), W(), _.direction === "horizontal" ? H(null, v(!1, !1), { align: d || "end" }) : H(v(!0, !1), null, { align: d || "end" });
|
|
1730
1760
|
break;
|
|
1731
1761
|
case "PageDown":
|
|
1732
|
-
e.preventDefault(),
|
|
1762
|
+
e.preventDefault(), W(), _.direction === "horizontal" ? H(null, v(!1, !0), { align: d || "start" }) : H(v(!0, !0), null, { align: d || "start" });
|
|
1733
1763
|
break;
|
|
1734
1764
|
}
|
|
1735
1765
|
}
|
|
1736
|
-
|
|
1737
|
-
|
|
1766
|
+
h(() => {
|
|
1767
|
+
Y?.disconnect(), X?.disconnect(), Ze?.disconnect();
|
|
1738
1768
|
});
|
|
1739
|
-
let mt =
|
|
1769
|
+
let mt = t(() => {
|
|
1740
1770
|
let e = { ..._.direction === "vertical" ? {} : { whiteSpace: "nowrap" } };
|
|
1741
|
-
return (
|
|
1771
|
+
return (Ge.value || !Oe.value) && (e.overflow = "auto"), We.value && (e.touchAction = "none"), Oe.value ? e : _.containerTag === "table" ? {
|
|
1742
1772
|
...e,
|
|
1743
1773
|
display: "block",
|
|
1744
1774
|
minInlineSize: _.direction === "vertical" ? "100%" : "auto"
|
|
@@ -1759,28 +1789,28 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1759
1789
|
position: n,
|
|
1760
1790
|
viewportSize: r,
|
|
1761
1791
|
scrollToOffset: i,
|
|
1762
|
-
containerId:
|
|
1763
|
-
isRtl:
|
|
1792
|
+
containerId: N.value,
|
|
1793
|
+
isRtl: de.value,
|
|
1764
1794
|
ariaLabel: `${e === "vertical" ? "Vertical" : "Horizontal"} scroll`
|
|
1765
1795
|
},
|
|
1766
1796
|
isDragging: a.isDragging.value
|
|
1767
1797
|
};
|
|
1768
1798
|
}
|
|
1769
|
-
let gt =
|
|
1799
|
+
let gt = t(() => {
|
|
1770
1800
|
if (_.direction === "horizontal") return null;
|
|
1771
1801
|
let { displayViewportSize: e, displayScrollOffset: t } = R.value;
|
|
1772
|
-
return ht("vertical",
|
|
1773
|
-
}), Q =
|
|
1802
|
+
return ht("vertical", z.value, t.y, e.height, Ke, qe);
|
|
1803
|
+
}), Q = t(() => {
|
|
1774
1804
|
if (_.direction === "vertical") return null;
|
|
1775
1805
|
let { displayViewportSize: e, displayScrollOffset: t } = R.value;
|
|
1776
|
-
return ht("horizontal",
|
|
1777
|
-
}), _t =
|
|
1806
|
+
return ht("horizontal", B.value, t.x, e.width, J, Je);
|
|
1807
|
+
}), _t = t(() => {
|
|
1778
1808
|
let e = _.direction === "horizontal", t = _.direction === "vertical", n = _.direction === "both", r = {
|
|
1779
|
-
inlineSize: t ? "100%" : `${
|
|
1780
|
-
blockSize: e ? "100%" : `${
|
|
1809
|
+
inlineSize: t ? "100%" : `${Be.value}px`,
|
|
1810
|
+
blockSize: e ? "100%" : `${Ve.value}px`
|
|
1781
1811
|
};
|
|
1782
1812
|
return I.value || (r.display = "flex", r.flexDirection = e ? "row" : "column", (e || n) && _.columnGap && (r.columnGap = `${_.columnGap}px`), (t || n) && _.gap && (r.rowGap = `${_.gap}px`)), r;
|
|
1783
|
-
}), vt =
|
|
1813
|
+
}), vt = t(() => {
|
|
1784
1814
|
let e = _.direction === "horizontal";
|
|
1785
1815
|
return {
|
|
1786
1816
|
display: e ? "inline-block" : "block",
|
|
@@ -1789,12 +1819,12 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1789
1819
|
verticalAlign: "top"
|
|
1790
1820
|
} : { inlineSize: "100%" }
|
|
1791
1821
|
};
|
|
1792
|
-
}), yt =
|
|
1793
|
-
inlineSize: _.direction === "vertical" ? "1px" : `${
|
|
1794
|
-
blockSize: _.direction === "horizontal" ? "1px" : `${
|
|
1822
|
+
}), yt = t(() => ({
|
|
1823
|
+
inlineSize: _.direction === "vertical" ? "1px" : `${Be.value}px`,
|
|
1824
|
+
blockSize: _.direction === "horizontal" ? "1px" : `${Ve.value}px`
|
|
1795
1825
|
}));
|
|
1796
1826
|
function bt(e) {
|
|
1797
|
-
let t =
|
|
1827
|
+
let t = xe({
|
|
1798
1828
|
containerTag: _.containerTag || "div",
|
|
1799
1829
|
direction: _.direction,
|
|
1800
1830
|
isHydrated: I.value,
|
|
@@ -1802,22 +1832,22 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1802
1832
|
itemSize: _.itemSize,
|
|
1803
1833
|
paddingStartX: F.value.scrollPaddingStart.x,
|
|
1804
1834
|
paddingStartY: F.value.scrollPaddingStart.y,
|
|
1805
|
-
isRtl:
|
|
1835
|
+
isRtl: de.value
|
|
1806
1836
|
});
|
|
1807
1837
|
return !I.value && _.direction === "both" && (t.display = "flex", _.columnGap && (t.columnGap = `${_.columnGap}px`)), t;
|
|
1808
1838
|
}
|
|
1809
|
-
let xt =
|
|
1839
|
+
let xt = t(() => _.debug), $ = t(() => _.containerTag === "table"), St = t(() => $.value ? "thead" : "div"), Ct = t(() => $.value ? "tfoot" : "div"), wt = t(() => _.role ? _.role : $.value ? null : _.direction === "both" ? "grid" : "list"), Tt = t(() => wt.value === "grid" || $.value), Et = t(() => $.value ? null : _.ariaLabel || _.ariaLabelledby ? "region" : "none"), Dt = t(() => $.value ? null : wt.value), Ot = t(() => {
|
|
1810
1840
|
if (Tt.value) return "row";
|
|
1811
1841
|
let e = wt.value;
|
|
1812
1842
|
return e === "tree" ? "treeitem" : e === "listbox" ? "option" : e === "menu" ? "menuitem" : "listitem";
|
|
1813
|
-
}), kt =
|
|
1843
|
+
}), kt = t(() => _.itemRole ?? Ot.value), At = t(() => _.role === "grid" || !_.role && _.direction === "both" ? "gridcell" : $.value ? "cell" : null), jt = t(() => {
|
|
1814
1844
|
let e = kt.value;
|
|
1815
1845
|
return e == null || e !== "none" && e !== "presentation";
|
|
1816
|
-
}), Mt =
|
|
1846
|
+
}), Mt = t(() => ({
|
|
1817
1847
|
"aria-label": _.ariaLabel,
|
|
1818
1848
|
"aria-labelledby": _.ariaLabelledby,
|
|
1819
1849
|
"aria-busy": _.loading ? "true" : void 0
|
|
1820
|
-
})), Nt =
|
|
1850
|
+
})), Nt = t(() => {
|
|
1821
1851
|
let e = {}, t = wt.value;
|
|
1822
1852
|
return t && [
|
|
1823
1853
|
"grid",
|
|
@@ -1840,46 +1870,46 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1840
1870
|
return Tt.value && (n["aria-colindex"] = e + 1), n;
|
|
1841
1871
|
}
|
|
1842
1872
|
return s({
|
|
1843
|
-
...
|
|
1873
|
+
...w(_),
|
|
1844
1874
|
scrollDetails: R,
|
|
1845
|
-
columnRange:
|
|
1846
|
-
getColumnWidth:
|
|
1847
|
-
getRowHeight:
|
|
1875
|
+
columnRange: fe,
|
|
1876
|
+
getColumnWidth: V,
|
|
1877
|
+
getRowHeight: pe,
|
|
1848
1878
|
getCellAriaProps: Ft,
|
|
1849
1879
|
getItemAriaProps: Pt,
|
|
1850
|
-
getRowOffset:
|
|
1851
|
-
getColumnOffset:
|
|
1852
|
-
getItemOffset:
|
|
1853
|
-
getItemSize:
|
|
1880
|
+
getRowOffset: ye,
|
|
1881
|
+
getColumnOffset: be,
|
|
1882
|
+
getItemOffset: ve,
|
|
1883
|
+
getItemSize: Se,
|
|
1854
1884
|
isTable: $,
|
|
1855
|
-
itemTag:
|
|
1856
|
-
getRowIndexAt:
|
|
1857
|
-
getColIndexAt:
|
|
1858
|
-
scrollToIndex:
|
|
1859
|
-
scrollToOffset:
|
|
1860
|
-
refresh:
|
|
1885
|
+
itemTag: t(() => _.itemTag || "div"),
|
|
1886
|
+
getRowIndexAt: He,
|
|
1887
|
+
getColIndexAt: Ue,
|
|
1888
|
+
scrollToIndex: H,
|
|
1889
|
+
scrollToOffset: U,
|
|
1890
|
+
refresh: Xe,
|
|
1861
1891
|
stopProgrammaticScroll: () => {
|
|
1862
|
-
|
|
1892
|
+
W(), ct();
|
|
1863
1893
|
},
|
|
1864
|
-
updateDirection:
|
|
1865
|
-
isRtl:
|
|
1894
|
+
updateDirection: _e,
|
|
1895
|
+
isRtl: de,
|
|
1866
1896
|
isHydrated: I,
|
|
1867
|
-
scaleX:
|
|
1868
|
-
scaleY:
|
|
1869
|
-
renderedWidth:
|
|
1870
|
-
renderedHeight:
|
|
1871
|
-
componentOffset:
|
|
1897
|
+
scaleX: Ee,
|
|
1898
|
+
scaleY: De,
|
|
1899
|
+
renderedWidth: B,
|
|
1900
|
+
renderedHeight: z,
|
|
1901
|
+
componentOffset: ke,
|
|
1872
1902
|
scrollbarPropsVertical: gt,
|
|
1873
1903
|
scrollbarPropsHorizontal: Q
|
|
1874
|
-
}), (t, s) => (
|
|
1875
|
-
id:
|
|
1904
|
+
}), (t, s) => (g(), n(x(o.containerTag), l({
|
|
1905
|
+
id: N.value,
|
|
1876
1906
|
ref_key: "hostRef",
|
|
1877
|
-
ref:
|
|
1907
|
+
ref: O,
|
|
1878
1908
|
class: ["virtual-scroll-container", [`virtual-scroll--${o.direction}`, {
|
|
1879
|
-
"virtual-scroll--hydrated":
|
|
1880
|
-
"virtual-scroll--window":
|
|
1909
|
+
"virtual-scroll--hydrated": E(I),
|
|
1910
|
+
"virtual-scroll--window": E(Oe),
|
|
1881
1911
|
"virtual-scroll--table": $.value,
|
|
1882
|
-
"virtual-scroll--hide-scrollbar":
|
|
1912
|
+
"virtual-scroll--hide-scrollbar": Ge.value
|
|
1883
1913
|
}]],
|
|
1884
1914
|
style: mt.value,
|
|
1885
1915
|
tabindex: "0",
|
|
@@ -1894,47 +1924,47 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1894
1924
|
onPointerup: dt,
|
|
1895
1925
|
onPointercancel: dt
|
|
1896
1926
|
}), {
|
|
1897
|
-
default:
|
|
1898
|
-
|
|
1927
|
+
default: k(() => [
|
|
1928
|
+
Ge.value ? (g(), i("div", Ie, [a("div", {
|
|
1899
1929
|
class: "virtual-scroll-scrollbar-viewport",
|
|
1900
|
-
style:
|
|
1901
|
-
inlineSize: `${
|
|
1902
|
-
blockSize: `${
|
|
1930
|
+
style: p({
|
|
1931
|
+
inlineSize: `${E(R).displayViewportSize.width}px`,
|
|
1932
|
+
blockSize: `${E(R).displayViewportSize.height}px`,
|
|
1903
1933
|
"--vsi-scrollbar-has-cross-gap": o.direction === "both" ? 1 : 0
|
|
1904
1934
|
})
|
|
1905
|
-
}, [T.scrollbar && gt.value ?
|
|
1906
|
-
T.header ? (
|
|
1935
|
+
}, [T.scrollbar && gt.value ? b(t.$slots, "scrollbar", f(l({ key: 0 }, gt.value)), void 0, !0) : gt.value ? (g(), n(q, f(l({ key: 1 }, gt.value.scrollbarProps)), null, 16)) : r("", !0), T.scrollbar && Q.value ? b(t.$slots, "scrollbar", f(l({ key: 2 }, Q.value)), void 0, !0) : Q.value ? (g(), n(q, f(l({ key: 3 }, Q.value.scrollbarProps)), null, 16)) : r("", !0)], 4)])) : r("", !0),
|
|
1936
|
+
T.header ? (g(), n(x(St.value), {
|
|
1907
1937
|
key: 1,
|
|
1908
1938
|
ref_key: "headerRef",
|
|
1909
1939
|
ref: ne,
|
|
1910
|
-
class:
|
|
1940
|
+
class: d(["virtual-scroll-header", { "virtual-scroll--sticky": o.stickyHeader }]),
|
|
1911
1941
|
role: $.value ? void 0 : "none"
|
|
1912
1942
|
}, {
|
|
1913
|
-
default:
|
|
1943
|
+
default: k(() => [b(t.$slots, "header", {}, void 0, !0)]),
|
|
1914
1944
|
_: 3
|
|
1915
|
-
}, 8, ["class", "role"])) :
|
|
1916
|
-
(
|
|
1945
|
+
}, 8, ["class", "role"])) : r("", !0),
|
|
1946
|
+
(g(), n(x(o.wrapperTag), l({
|
|
1917
1947
|
ref_key: "wrapperRef",
|
|
1918
|
-
ref:
|
|
1948
|
+
ref: A,
|
|
1919
1949
|
class: "virtual-scroll-wrapper",
|
|
1920
1950
|
style: _t.value,
|
|
1921
1951
|
role: $.value ? void 0 : Dt.value
|
|
1922
1952
|
}, $.value ? {} : Nt.value), {
|
|
1923
|
-
default:
|
|
1953
|
+
default: k(() => [$.value ? (g(), n(x(o.itemTag), {
|
|
1924
1954
|
key: 0,
|
|
1925
1955
|
class: "virtual-scroll-spacer",
|
|
1926
|
-
style:
|
|
1956
|
+
style: p(yt.value)
|
|
1927
1957
|
}, {
|
|
1928
|
-
default:
|
|
1958
|
+
default: k(() => [...s[0] ||= [a("td", { style: {
|
|
1929
1959
|
padding: "0",
|
|
1930
1960
|
border: "none",
|
|
1931
1961
|
"block-size": "inherit"
|
|
1932
1962
|
} }, null, -1)]]),
|
|
1933
1963
|
_: 1
|
|
1934
|
-
}, 8, ["style"])) :
|
|
1964
|
+
}, 8, ["style"])) : r("", !0), (g(!0), i(e, null, y(E(L), (e) => (g(), n(x(o.itemTag), l({
|
|
1935
1965
|
key: e.index,
|
|
1936
1966
|
ref_for: !0,
|
|
1937
|
-
ref: (t) =>
|
|
1967
|
+
ref: (t) => et(t, e.index),
|
|
1938
1968
|
"data-index": e.index,
|
|
1939
1969
|
class: ["virtual-scroll-item", {
|
|
1940
1970
|
"virtual-scroll--sticky": e.isStickyActive,
|
|
@@ -1942,12 +1972,12 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1942
1972
|
}],
|
|
1943
1973
|
style: bt(e)
|
|
1944
1974
|
}, { ref_for: !0 }, jt.value ? Pt(e.index) : { role: "none" }), {
|
|
1945
|
-
default:
|
|
1975
|
+
default: k(() => [b(t.$slots, "item", {
|
|
1946
1976
|
item: e.item,
|
|
1947
1977
|
index: e.index,
|
|
1948
1978
|
getItemAriaProps: Pt,
|
|
1949
|
-
columnRange:
|
|
1950
|
-
getColumnWidth:
|
|
1979
|
+
columnRange: Ye.value,
|
|
1980
|
+
getColumnWidth: E(V),
|
|
1951
1981
|
getCellAriaProps: Ft,
|
|
1952
1982
|
gap: _.gap,
|
|
1953
1983
|
columnGap: _.columnGap,
|
|
@@ -1956,7 +1986,7 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1956
1986
|
isStickyActiveX: e.isStickyActiveX,
|
|
1957
1987
|
isStickyActiveY: e.isStickyActiveY,
|
|
1958
1988
|
offset: e.offset
|
|
1959
|
-
}, void 0, !0), xt.value ? (
|
|
1989
|
+
}, void 0, !0), xt.value ? (g(), i("div", Le, " #" + C(e.index) + " (" + C(Math.round(e.offset.x)) + ", " + C(Math.round(e.offset.y)) + ") ", 1)) : r("", !0)]),
|
|
1960
1990
|
_: 2
|
|
1961
1991
|
}, 1040, [
|
|
1962
1992
|
"data-index",
|
|
@@ -1965,23 +1995,23 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1965
1995
|
]))), 128))]),
|
|
1966
1996
|
_: 3
|
|
1967
1997
|
}, 16, ["style", "role"])),
|
|
1968
|
-
o.loading && T.loading ? (
|
|
1998
|
+
o.loading && T.loading ? (g(), i("div", {
|
|
1969
1999
|
key: 2,
|
|
1970
2000
|
class: "virtual-scroll-loading",
|
|
1971
|
-
style:
|
|
2001
|
+
style: p(vt.value),
|
|
1972
2002
|
"aria-live": "polite",
|
|
1973
2003
|
"aria-atomic": "true"
|
|
1974
|
-
}, [
|
|
1975
|
-
T.footer ? (
|
|
2004
|
+
}, [b(t.$slots, "loading", {}, void 0, !0)], 4)) : r("", !0),
|
|
2005
|
+
T.footer ? (g(), n(x(Ct.value), {
|
|
1976
2006
|
key: 3,
|
|
1977
2007
|
ref_key: "footerRef",
|
|
1978
2008
|
ref: re,
|
|
1979
|
-
class:
|
|
2009
|
+
class: d(["virtual-scroll-footer", { "virtual-scroll--sticky": o.stickyFooter }]),
|
|
1980
2010
|
role: $.value ? void 0 : "none"
|
|
1981
2011
|
}, {
|
|
1982
|
-
default:
|
|
2012
|
+
default: k(() => [b(t.$slots, "footer", {}, void 0, !0)]),
|
|
1983
2013
|
_: 3
|
|
1984
|
-
}, 8, ["class", "role"])) :
|
|
2014
|
+
}, 8, ["class", "role"])) : r("", !0)
|
|
1985
2015
|
]),
|
|
1986
2016
|
_: 3
|
|
1987
2017
|
}, 16, [
|
|
@@ -1991,7 +2021,8 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1991
2021
|
"role"
|
|
1992
2022
|
]));
|
|
1993
2023
|
}
|
|
1994
|
-
}), [["__scopeId", "data-v-
|
|
1995
|
-
|
|
2024
|
+
}), [["__scopeId", "data-v-200891f5"]]);
|
|
2025
|
+
//#endregion
|
|
2026
|
+
export { M as BROWSER_MAX_SIZE, re as DEFAULT_BUFFER, ne as DEFAULT_COLUMN_WIDTH, A as DEFAULT_ITEM_SIZE, j as EMPTY_SCROLL_DETAILS, Oe as FenwickTree, Be as VirtualScroll, q as VirtualScrollbar, L as calculateAxisSize, ve as calculateColumnRange, De as calculateIndexAt, we as calculateInertiaStep, Te as calculateInstantaneousVelocity, be as calculateItemPosition, xe as calculateItemStyle, z as calculateOffsetAt, Ce as calculatePrependCount, _e as calculateRange, R as calculateRangeSize, U as calculateRenderedSize, Se as calculateSSROffsets, H as calculateScale, ge as calculateScrollTarget, ye as calculateStickyItem, W as calculateTotalSize, me as displayToVirtual, de as findPrevStickyIndex, le as getPaddingX, ue as getPaddingY, ie as isBody, P as isElement, pe as isItemVisible, ce as isScrollToIndexOptions, oe as isScrollableElement, N as isWindow, ae as isWindowLike, Ee as resolveSnap, se as scrollTo, Ae as useVirtualScroll, ke as useVirtualScrollSizes, je as useVirtualScrollbar, he as virtualToDisplay };
|
|
1996
2027
|
|
|
1997
2028
|
//# sourceMappingURL=index.mjs.map
|