@pdanpdan/virtual-scroll 0.10.2 → 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 +549 -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 +53 -19
- 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,16 +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
|
-
|
|
692
|
+
l || (k.value = !0, clearTimeout(A), A = C === "smooth" ? setTimeout(() => {
|
|
693
|
+
k.value = !1, A = void 0, gt();
|
|
685
694
|
}, 1e3) : setTimeout(() => {
|
|
686
|
-
|
|
695
|
+
k.value = !1, A = void 0;
|
|
687
696
|
}, 150));
|
|
688
697
|
let T = { behavior: C };
|
|
689
|
-
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)), {
|
|
690
699
|
targetX: d,
|
|
691
700
|
targetY: f,
|
|
692
701
|
displayTargetX: h,
|
|
@@ -695,45 +704,45 @@ function useVirtualScroll(e, n = []) {
|
|
|
695
704
|
}
|
|
696
705
|
function Z(e, t, n) {
|
|
697
706
|
let s = r.value.container || window;
|
|
698
|
-
|
|
699
|
-
|
|
707
|
+
k.value = !0, clearTimeout(A), A = n?.behavior === "smooth" ? setTimeout(() => {
|
|
708
|
+
k.value = !1, A = void 0, gt();
|
|
700
709
|
}, 1e3) : setTimeout(() => {
|
|
701
|
-
|
|
702
|
-
}, 150),
|
|
703
|
-
let l = e == null ? null : Math.max(0, Math.min(e,
|
|
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));
|
|
704
713
|
l !== null && (o.value = l), u !== null && (c.value = u);
|
|
705
|
-
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 :
|
|
706
|
-
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 = _));
|
|
707
716
|
}
|
|
708
|
-
let ot =
|
|
709
|
-
if (
|
|
717
|
+
let ot = t(() => {
|
|
718
|
+
if (xe.value, (!d.value || f.value) && r.value.ssrRange) return {
|
|
710
719
|
start: r.value.ssrRange.start,
|
|
711
720
|
end: r.value.ssrRange.end
|
|
712
721
|
};
|
|
713
722
|
let e = r.value.ssrRange && !l.value ? 0 : r.value.bufferBefore ?? 5, t = r.value.bufferAfter ?? 5;
|
|
714
|
-
return
|
|
715
|
-
direction:
|
|
716
|
-
relativeScrollX:
|
|
717
|
-
relativeScrollY:
|
|
718
|
-
usableWidth:
|
|
719
|
-
usableHeight:
|
|
723
|
+
return _e({
|
|
724
|
+
direction: M.value,
|
|
725
|
+
relativeScrollX: Y.value,
|
|
726
|
+
relativeScrollY: X.value,
|
|
727
|
+
usableWidth: ze.value,
|
|
728
|
+
usableHeight: Be.value,
|
|
720
729
|
itemsLength: r.value.items.length,
|
|
721
730
|
bufferBefore: e,
|
|
722
731
|
bufferAfter: t,
|
|
723
732
|
gap: r.value.gap || 0,
|
|
724
733
|
columnGap: r.value.columnGap || 0,
|
|
725
734
|
fixedSize: F.value,
|
|
726
|
-
findLowerBoundY: (e) =>
|
|
735
|
+
findLowerBoundY: (e) => B.findLowerBound(e),
|
|
727
736
|
findLowerBoundX: (e) => L.findLowerBound(e),
|
|
728
|
-
queryY: (e) =>
|
|
737
|
+
queryY: (e) => B.query(e),
|
|
729
738
|
queryX: (e) => L.query(e)
|
|
730
739
|
});
|
|
731
|
-
}), st =
|
|
732
|
-
|
|
733
|
-
let e =
|
|
734
|
-
return
|
|
735
|
-
}), ct =
|
|
736
|
-
|
|
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;
|
|
737
746
|
let e = r.value.columnCount || 0;
|
|
738
747
|
if (!e) return {
|
|
739
748
|
start: 0,
|
|
@@ -743,36 +752,36 @@ function useVirtualScroll(e, n = []) {
|
|
|
743
752
|
};
|
|
744
753
|
if ((!d.value || f.value) && r.value.ssrRange) {
|
|
745
754
|
let { colStart: t = 0, colEnd: n = 0 } = r.value.ssrRange, i = Math.max(0, t), a = Math.min(e, n || e);
|
|
746
|
-
return
|
|
755
|
+
return ve({
|
|
747
756
|
columnCount: e,
|
|
748
|
-
relativeScrollX:
|
|
749
|
-
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)),
|
|
750
759
|
colBuffer: 0,
|
|
751
760
|
fixedWidth: I.value,
|
|
752
761
|
columnGap: r.value.columnGap || 0,
|
|
753
|
-
findLowerBound: (e) =>
|
|
754
|
-
query: (e) =>
|
|
755
|
-
totalColsQuery: () =>
|
|
762
|
+
findLowerBound: (e) => V.findLowerBound(e),
|
|
763
|
+
query: (e) => V.query(e),
|
|
764
|
+
totalColsQuery: () => V.query(e)
|
|
756
765
|
});
|
|
757
766
|
}
|
|
758
767
|
let t = r.value.ssrRange && !l.value ? 0 : 2;
|
|
759
|
-
return
|
|
768
|
+
return ve({
|
|
760
769
|
columnCount: e,
|
|
761
|
-
relativeScrollX:
|
|
762
|
-
usableWidth:
|
|
770
|
+
relativeScrollX: Y.value,
|
|
771
|
+
usableWidth: ze.value,
|
|
763
772
|
colBuffer: t,
|
|
764
773
|
fixedWidth: I.value,
|
|
765
774
|
columnGap: r.value.columnGap || 0,
|
|
766
|
-
findLowerBound: (e) =>
|
|
767
|
-
query: (e) =>
|
|
768
|
-
totalColsQuery: () =>
|
|
775
|
+
findLowerBound: (e) => V.findLowerBound(e),
|
|
776
|
+
query: (e) => V.query(e),
|
|
777
|
+
totalColsQuery: () => V.query(e)
|
|
769
778
|
});
|
|
770
779
|
}), lt = {
|
|
771
780
|
props: r,
|
|
772
781
|
scrollDetails: null,
|
|
773
|
-
totalSize:
|
|
774
|
-
width:
|
|
775
|
-
height:
|
|
782
|
+
totalSize: t(() => ({
|
|
783
|
+
width: Ge.value,
|
|
784
|
+
height: Ke.value
|
|
776
785
|
})),
|
|
777
786
|
range: ot,
|
|
778
787
|
currentIndex: st,
|
|
@@ -783,68 +792,68 @@ function useVirtualScroll(e, n = []) {
|
|
|
783
792
|
internalScrollY: c,
|
|
784
793
|
isRtl: g,
|
|
785
794
|
isScrolling: l,
|
|
786
|
-
isProgrammaticScroll:
|
|
795
|
+
isProgrammaticScroll: k,
|
|
787
796
|
viewportWidth: y,
|
|
788
797
|
viewportHeight: b,
|
|
789
798
|
scaleX: w,
|
|
790
799
|
scaleY: E,
|
|
791
|
-
scrollDirectionX:
|
|
792
|
-
scrollDirectionY:
|
|
793
|
-
relativeScrollX:
|
|
794
|
-
relativeScrollY:
|
|
800
|
+
scrollDirectionX: ee,
|
|
801
|
+
scrollDirectionY: te,
|
|
802
|
+
relativeScrollX: Y,
|
|
803
|
+
relativeScrollY: X
|
|
795
804
|
},
|
|
796
805
|
methods: {
|
|
797
806
|
scrollToIndex: at,
|
|
798
807
|
scrollToOffset: Z,
|
|
799
|
-
updateDirection:
|
|
800
|
-
getRowIndexAt:
|
|
801
|
-
getColIndexAt:
|
|
802
|
-
getItemSize:
|
|
803
|
-
getItemBaseSize:
|
|
804
|
-
getItemOffset:
|
|
808
|
+
updateDirection: rt,
|
|
809
|
+
getRowIndexAt: Ze,
|
|
810
|
+
getColIndexAt: Qe,
|
|
811
|
+
getItemSize: nt,
|
|
812
|
+
getItemBaseSize: we,
|
|
813
|
+
getItemOffset: tt,
|
|
805
814
|
handleScrollCorrection: it
|
|
806
815
|
}
|
|
807
|
-
}, ut = [], dt =
|
|
808
|
-
|
|
809
|
-
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 = [];
|
|
810
819
|
if (d.value || !r.value.ssrRange) {
|
|
811
|
-
let t = st.value, n =
|
|
820
|
+
let t = st.value, n = de(a, t);
|
|
812
821
|
n !== void 0 && n < e && l.push(n);
|
|
813
822
|
}
|
|
814
823
|
for (let n = e; n < t; n++) l.push(n);
|
|
815
|
-
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)) : {
|
|
816
825
|
x: 0,
|
|
817
826
|
y: 0
|
|
818
827
|
}, p = /* @__PURE__ */ new Map();
|
|
819
828
|
for (let e of ut) p.set(e.index, e);
|
|
820
|
-
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;
|
|
821
830
|
for (let e of l) {
|
|
822
831
|
let t = r.value.items[e];
|
|
823
832
|
if (t === void 0) continue;
|
|
824
|
-
let { x: n, y: l, width: m, height: h } =
|
|
833
|
+
let { x: n, y: l, width: m, height: h } = be({
|
|
825
834
|
index: e,
|
|
826
|
-
direction:
|
|
835
|
+
direction: M.value,
|
|
827
836
|
fixedSize: F.value,
|
|
828
837
|
gap: r.value.gap || 0,
|
|
829
838
|
columnGap: r.value.columnGap || 0,
|
|
830
|
-
usableWidth:
|
|
831
|
-
usableHeight:
|
|
832
|
-
totalWidth:
|
|
839
|
+
usableWidth: ze.value,
|
|
840
|
+
usableHeight: Be.value,
|
|
841
|
+
totalWidth: Ve.value.width,
|
|
833
842
|
queryY: y,
|
|
834
843
|
queryX: v,
|
|
835
|
-
getSizeY: (e) =>
|
|
844
|
+
getSizeY: (e) => B.get(e),
|
|
836
845
|
getSizeX: (e) => L.get(e),
|
|
837
846
|
columnRange: T
|
|
838
|
-
}), g = s.has(e), _ = n,
|
|
839
|
-
for (;
|
|
840
|
-
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({
|
|
841
850
|
index: e,
|
|
842
851
|
isSticky: g,
|
|
843
|
-
direction:
|
|
844
|
-
relativeScrollX:
|
|
845
|
-
relativeScrollY:
|
|
852
|
+
direction: M.value,
|
|
853
|
+
relativeScrollX: Y.value,
|
|
854
|
+
relativeScrollY: X.value,
|
|
846
855
|
originalX: _,
|
|
847
|
-
originalY:
|
|
856
|
+
originalY: te,
|
|
848
857
|
width: m,
|
|
849
858
|
height: h,
|
|
850
859
|
stickyIndices: a,
|
|
@@ -852,37 +861,37 @@ function useVirtualScroll(e, n = []) {
|
|
|
852
861
|
fixedWidth: I.value,
|
|
853
862
|
gap: r.value.gap || 0,
|
|
854
863
|
columnGap: r.value.columnGap || 0,
|
|
855
|
-
getItemQueryY: (e) =>
|
|
864
|
+
getItemQueryY: (e) => B.query(e),
|
|
856
865
|
getItemQueryX: (e) => L.query(e),
|
|
857
|
-
nextStickyIndex:
|
|
858
|
-
}), re = d.value ? o.value / w.value + (n + b - o.value) - S : n - u,
|
|
859
|
-
|
|
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({
|
|
860
869
|
item: t,
|
|
861
870
|
index: e,
|
|
862
871
|
offset: {
|
|
863
872
|
x: re,
|
|
864
|
-
y:
|
|
873
|
+
y: j
|
|
865
874
|
},
|
|
866
875
|
size: {
|
|
867
876
|
width: m,
|
|
868
877
|
height: h
|
|
869
878
|
},
|
|
870
879
|
originalX: _,
|
|
871
|
-
originalY:
|
|
880
|
+
originalY: te,
|
|
872
881
|
isSticky: g,
|
|
873
|
-
isStickyActive:
|
|
874
|
-
isStickyActiveX:
|
|
875
|
-
isStickyActiveY:
|
|
882
|
+
isStickyActive: O,
|
|
883
|
+
isStickyActiveX: k,
|
|
884
|
+
isStickyActiveY: A,
|
|
876
885
|
stickyOffset: ne
|
|
877
886
|
});
|
|
878
887
|
}
|
|
879
|
-
let
|
|
888
|
+
let te = i;
|
|
880
889
|
return n.forEach((e) => {
|
|
881
|
-
e.transformRenderedItems && (
|
|
882
|
-
}), ut =
|
|
883
|
-
}), ft =
|
|
884
|
-
|
|
885
|
-
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);
|
|
886
895
|
return {
|
|
887
896
|
items: dt.value,
|
|
888
897
|
currentIndex: u,
|
|
@@ -906,11 +915,11 @@ function useVirtualScroll(e, n = []) {
|
|
|
906
915
|
height: b.value
|
|
907
916
|
},
|
|
908
917
|
totalSize: {
|
|
909
|
-
width:
|
|
910
|
-
height:
|
|
918
|
+
width: Ge.value,
|
|
919
|
+
height: Ke.value
|
|
911
920
|
},
|
|
912
921
|
isScrolling: l.value,
|
|
913
|
-
isProgrammaticScroll:
|
|
922
|
+
isProgrammaticScroll: k.value,
|
|
914
923
|
range: ot.value,
|
|
915
924
|
columnRange: ct.value
|
|
916
925
|
};
|
|
@@ -919,19 +928,19 @@ function useVirtualScroll(e, n = []) {
|
|
|
919
928
|
let pt = (e) => {
|
|
920
929
|
let t = e.target;
|
|
921
930
|
if (typeof window > "u") return;
|
|
922
|
-
|
|
923
|
-
let r =
|
|
924
|
-
if (!
|
|
925
|
-
l.value || (re = o.value,
|
|
926
|
-
let e = r - re, t = s -
|
|
927
|
-
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");
|
|
928
937
|
}
|
|
929
|
-
o.value = r, c.value = s,
|
|
930
|
-
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);
|
|
931
940
|
}, 150);
|
|
932
941
|
}, mt = (e) => {
|
|
933
|
-
|
|
934
|
-
!
|
|
942
|
+
Ee(e, Ze, Qe, Y.value, X.value, (e, t) => {
|
|
943
|
+
!O.value && !k.value && it(e, t);
|
|
935
944
|
});
|
|
936
945
|
}, ht = (e, t, n, r) => {
|
|
937
946
|
mt([{
|
|
@@ -942,50 +951,50 @@ function useVirtualScroll(e, n = []) {
|
|
|
942
951
|
}]);
|
|
943
952
|
};
|
|
944
953
|
function gt() {
|
|
945
|
-
if (
|
|
946
|
-
let { rowIndex: e, colIndex: t, options: n } =
|
|
947
|
-
if (
|
|
948
|
-
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({
|
|
949
958
|
rowIndex: e,
|
|
950
959
|
colIndex: t,
|
|
951
960
|
options: n,
|
|
952
|
-
direction:
|
|
961
|
+
direction: M.value,
|
|
953
962
|
viewportWidth: y.value,
|
|
954
963
|
viewportHeight: b.value,
|
|
955
|
-
totalWidth:
|
|
956
|
-
totalHeight:
|
|
964
|
+
totalWidth: Ge.value,
|
|
965
|
+
totalHeight: Ke.value,
|
|
957
966
|
gap: r.value.gap || 0,
|
|
958
967
|
columnGap: r.value.columnGap || 0,
|
|
959
968
|
fixedSize: F.value,
|
|
960
969
|
fixedWidth: I.value,
|
|
961
970
|
relativeScrollX: u,
|
|
962
971
|
relativeScrollY: d,
|
|
963
|
-
getItemSizeY: (e) =>
|
|
972
|
+
getItemSizeY: (e) => B.get(e),
|
|
964
973
|
getItemSizeX: (e) => L.get(e),
|
|
965
|
-
getItemQueryY: (e) =>
|
|
974
|
+
getItemQueryY: (e) => B.query(e),
|
|
966
975
|
getItemQueryX: (e) => L.query(e),
|
|
967
|
-
getColumnSize: (e) =>
|
|
968
|
-
getColumnQuery: (e) =>
|
|
976
|
+
getColumnSize: (e) => V.get(e),
|
|
977
|
+
getColumnQuery: (e) => V.query(e),
|
|
969
978
|
scaleX: w.value,
|
|
970
979
|
scaleY: E.value,
|
|
971
|
-
hostOffsetX:
|
|
972
|
-
hostOffsetY:
|
|
980
|
+
hostOffsetX: J.x,
|
|
981
|
+
hostOffsetY: J.y,
|
|
973
982
|
stickyIndices: r.value.stickyIndices || [],
|
|
974
|
-
stickyStartX:
|
|
975
|
-
stickyStartY:
|
|
976
|
-
stickyEndX:
|
|
977
|
-
stickyEndY:
|
|
978
|
-
flowPaddingStartX:
|
|
979
|
-
flowPaddingStartY:
|
|
980
|
-
paddingStartX:
|
|
981
|
-
paddingStartY:
|
|
982
|
-
paddingEndX:
|
|
983
|
-
paddingEndY:
|
|
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
|
|
984
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;
|
|
985
994
|
if (_ && v) {
|
|
986
|
-
let n = t == null || t === void 0 ||
|
|
987
|
-
n && r && !l.value && !
|
|
988
|
-
} 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) ? {
|
|
989
998
|
...n,
|
|
990
999
|
isCorrection: !0
|
|
991
1000
|
} : {
|
|
@@ -994,11 +1003,12 @@ function useVirtualScroll(e, n = []) {
|
|
|
994
1003
|
});
|
|
995
1004
|
}
|
|
996
1005
|
}
|
|
997
|
-
|
|
998
|
-
|
|
1006
|
+
D([
|
|
1007
|
+
xe,
|
|
999
1008
|
y,
|
|
1000
|
-
b
|
|
1001
|
-
|
|
1009
|
+
b,
|
|
1010
|
+
f
|
|
1011
|
+
], gt), D(l, (e) => {
|
|
1002
1012
|
e || gt();
|
|
1003
1013
|
});
|
|
1004
1014
|
let Q = () => {
|
|
@@ -1013,7 +1023,7 @@ function useVirtualScroll(e, n = []) {
|
|
|
1013
1023
|
x: 0,
|
|
1014
1024
|
y: 0
|
|
1015
1025
|
};
|
|
1016
|
-
if (
|
|
1026
|
+
if (P(e)) {
|
|
1017
1027
|
let t = e.getBoundingClientRect();
|
|
1018
1028
|
return {
|
|
1019
1029
|
x: g.value ? t.right - n.right - e.scrollLeft : n.left - t.left + e.scrollLeft,
|
|
@@ -1035,18 +1045,18 @@ function useVirtualScroll(e, n = []) {
|
|
|
1035
1045
|
}
|
|
1036
1046
|
}, _t = (e) => {
|
|
1037
1047
|
if (typeof window > "u") return;
|
|
1038
|
-
let t = e || window, n = t === window ||
|
|
1039
|
-
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();
|
|
1040
1050
|
let r = null;
|
|
1041
|
-
|
|
1051
|
+
P(t) && (r = new MutationObserver(() => rt()), r.observe(t, {
|
|
1042
1052
|
attributes: !0,
|
|
1043
1053
|
attributeFilter: ["dir", "style"]
|
|
1044
1054
|
}));
|
|
1045
|
-
let o = setInterval(
|
|
1055
|
+
let o = setInterval(rt, 1e3);
|
|
1046
1056
|
if (t === window) {
|
|
1047
1057
|
y.value = document.documentElement.clientWidth, b.value = document.documentElement.clientHeight, i.value = window.scrollX, a.value = window.scrollY;
|
|
1048
1058
|
let e = () => {
|
|
1049
|
-
|
|
1059
|
+
rt(), y.value = document.documentElement.clientWidth, b.value = document.documentElement.clientHeight, Q();
|
|
1050
1060
|
};
|
|
1051
1061
|
return window.addEventListener("resize", e), () => {
|
|
1052
1062
|
n.removeEventListener("scroll", pt), window.removeEventListener("resize", e), r?.disconnect(), clearInterval(o);
|
|
@@ -1054,30 +1064,30 @@ function useVirtualScroll(e, n = []) {
|
|
|
1054
1064
|
} else {
|
|
1055
1065
|
y.value = t.clientWidth, b.value = t.clientHeight, i.value = t.scrollLeft, a.value = t.scrollTop;
|
|
1056
1066
|
let e = new ResizeObserver(() => {
|
|
1057
|
-
|
|
1067
|
+
rt(), y.value = t.clientWidth, b.value = t.clientHeight, Q();
|
|
1058
1068
|
});
|
|
1059
1069
|
return e.observe(t), () => {
|
|
1060
1070
|
n.removeEventListener("scroll", pt), e.disconnect(), r?.disconnect(), clearInterval(o);
|
|
1061
1071
|
};
|
|
1062
1072
|
}
|
|
1063
1073
|
}, vt;
|
|
1064
|
-
return
|
|
1065
|
-
p.value = !0,
|
|
1074
|
+
return s() && (m(() => {
|
|
1075
|
+
p.value = !0, rt(), D(() => r.value.container, (e) => {
|
|
1066
1076
|
vt?.(), vt = _t(e || null);
|
|
1067
|
-
}, { immediate: !0 }), Q(),
|
|
1077
|
+
}, { immediate: !0 }), Q(), u(() => {
|
|
1068
1078
|
if (Q(), r.value.ssrRange || r.value.initialScrollIndex !== void 0) {
|
|
1069
1079
|
let e = r.value.initialScrollIndex === void 0 ? r.value.ssrRange?.start : r.value.initialScrollIndex, t = r.value.initialScrollAlign || "start";
|
|
1070
1080
|
e != null && at(e, r.value.ssrRange?.colStart, {
|
|
1071
1081
|
align: t,
|
|
1072
1082
|
behavior: "auto"
|
|
1073
|
-
}), d.value = !0, f.value = !0,
|
|
1083
|
+
}), d.value = !0, f.value = !0, u(() => {
|
|
1074
1084
|
f.value = !1;
|
|
1075
1085
|
});
|
|
1076
1086
|
} else d.value = !0;
|
|
1077
1087
|
});
|
|
1078
|
-
}),
|
|
1088
|
+
}), h(() => {
|
|
1079
1089
|
vt?.();
|
|
1080
|
-
})),
|
|
1090
|
+
})), D([
|
|
1081
1091
|
() => r.value.items,
|
|
1082
1092
|
() => r.value.items.length,
|
|
1083
1093
|
() => r.value.direction,
|
|
@@ -1088,39 +1098,39 @@ function useVirtualScroll(e, n = []) {
|
|
|
1088
1098
|
() => r.value.columnGap,
|
|
1089
1099
|
() => r.value.defaultItemSize,
|
|
1090
1100
|
() => r.value.defaultColumnWidth
|
|
1091
|
-
], () =>
|
|
1101
|
+
], () => Te(), { immediate: !0 }), D(() => [r.value.container, r.value.hostElement], () => {
|
|
1092
1102
|
Q();
|
|
1093
|
-
}),
|
|
1103
|
+
}), D(g, (e, t) => {
|
|
1094
1104
|
if (t === void 0 || e === t || !p.value) return;
|
|
1095
|
-
if (
|
|
1105
|
+
if (M.value === "vertical") {
|
|
1096
1106
|
Q();
|
|
1097
1107
|
return;
|
|
1098
1108
|
}
|
|
1099
|
-
let n =
|
|
1109
|
+
let n = me(t ? Math.abs(i.value) : i.value, x.x, w.value);
|
|
1100
1110
|
Q(), Z(n, null, { behavior: "auto" });
|
|
1101
|
-
}, { flush: "sync" }),
|
|
1102
|
-
!p.value || l.value ||
|
|
1103
|
-
}),
|
|
1104
|
-
|
|
1105
|
-
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);
|
|
1106
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();
|
|
1107
1117
|
});
|
|
1108
1118
|
}), {
|
|
1109
1119
|
renderedItems: dt,
|
|
1110
|
-
totalWidth:
|
|
1111
|
-
totalHeight:
|
|
1112
|
-
renderedWidth:
|
|
1113
|
-
renderedHeight:
|
|
1120
|
+
totalWidth: Ge,
|
|
1121
|
+
totalHeight: Ke,
|
|
1122
|
+
renderedWidth: qe,
|
|
1123
|
+
renderedHeight: Je,
|
|
1114
1124
|
scrollDetails: ft,
|
|
1115
|
-
getRowHeight:
|
|
1116
|
-
getColumnWidth:
|
|
1117
|
-
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)),
|
|
1118
1128
|
getColumnOffset: (e) => {
|
|
1119
|
-
let t =
|
|
1120
|
-
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));
|
|
1121
1131
|
},
|
|
1122
|
-
getItemOffset:
|
|
1123
|
-
getItemSize:
|
|
1132
|
+
getItemOffset: tt,
|
|
1133
|
+
getItemSize: nt,
|
|
1124
1134
|
scrollToIndex: at,
|
|
1125
1135
|
scrollToOffset: Z,
|
|
1126
1136
|
stopProgrammaticScroll: ne,
|
|
@@ -1128,39 +1138,41 @@ function useVirtualScroll(e, n = []) {
|
|
|
1128
1138
|
updateItemSize: ht,
|
|
1129
1139
|
updateItemSizes: mt,
|
|
1130
1140
|
updateHostOffset: Q,
|
|
1131
|
-
updateDirection:
|
|
1141
|
+
updateDirection: rt,
|
|
1132
1142
|
columnRange: ct,
|
|
1133
|
-
refresh: () =>
|
|
1143
|
+
refresh: () => Oe(),
|
|
1134
1144
|
isHydrated: d,
|
|
1135
|
-
isWindowContainer:
|
|
1145
|
+
isWindowContainer: He,
|
|
1136
1146
|
isRtl: g,
|
|
1137
1147
|
scaleX: w,
|
|
1138
1148
|
scaleY: E,
|
|
1139
|
-
componentOffset:
|
|
1140
|
-
renderedVirtualWidth:
|
|
1141
|
-
renderedVirtualHeight:
|
|
1142
|
-
getRowIndexAt:
|
|
1143
|
-
getColIndexAt:
|
|
1149
|
+
componentOffset: J,
|
|
1150
|
+
renderedVirtualWidth: Ye,
|
|
1151
|
+
renderedVirtualHeight: Xe,
|
|
1152
|
+
getRowIndexAt: Ze,
|
|
1153
|
+
getColIndexAt: Qe,
|
|
1144
1154
|
__internalState: lt.internalState
|
|
1145
1155
|
};
|
|
1146
1156
|
}
|
|
1147
|
-
|
|
1148
|
-
|
|
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(() => {
|
|
1149
1161
|
let e = n.value.totalSize - n.value.viewportSize;
|
|
1150
1162
|
return e <= 0 ? 0 : Math.max(0, Math.min(1, n.value.position / e));
|
|
1151
|
-
}), o =
|
|
1163
|
+
}), o = t(() => {
|
|
1152
1164
|
let e = n.value.viewportSize > 0 ? 32 / n.value.viewportSize : .1;
|
|
1153
1165
|
return Math.max(Math.min(e, .1), i.value) * 100;
|
|
1154
|
-
}), c =
|
|
1166
|
+
}), c = t(() => a.value * (100 - o.value)), l = t(() => r.value ? {
|
|
1155
1167
|
inlineSize: `${o.value}%`,
|
|
1156
1168
|
insetInlineStart: `${c.value}%`
|
|
1157
1169
|
} : {
|
|
1158
1170
|
blockSize: `${o.value}%`,
|
|
1159
1171
|
insetBlockStart: `${c.value}%`
|
|
1160
|
-
}), u =
|
|
1172
|
+
}), u = t(() => {
|
|
1161
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))";
|
|
1162
1174
|
return r.value ? { inlineSize: `calc(${Math.max(0, e - 4)}px - ${t})` } : { blockSize: `calc(${Math.max(0, e - 4)}px - ${t})` };
|
|
1163
|
-
}), d =
|
|
1175
|
+
}), d = v(!1), f = 0, p = 0;
|
|
1164
1176
|
function m(e) {
|
|
1165
1177
|
let t = e.currentTarget;
|
|
1166
1178
|
if (e.target !== t) return;
|
|
@@ -1184,7 +1196,7 @@ function useVirtualScrollbar(e) {
|
|
|
1184
1196
|
function y(e) {
|
|
1185
1197
|
d.value && (d.value = !1, e.currentTarget.releasePointerCapture(e.pointerId));
|
|
1186
1198
|
}
|
|
1187
|
-
return
|
|
1199
|
+
return s() && h(() => {
|
|
1188
1200
|
d.value = !1;
|
|
1189
1201
|
}), {
|
|
1190
1202
|
viewportPercent: i,
|
|
@@ -1193,7 +1205,7 @@ function useVirtualScrollbar(e) {
|
|
|
1193
1205
|
thumbPositionPercent: c,
|
|
1194
1206
|
trackStyle: u,
|
|
1195
1207
|
thumbStyle: l,
|
|
1196
|
-
trackProps:
|
|
1208
|
+
trackProps: t(() => ({
|
|
1197
1209
|
class: ["virtual-scrollbar-track", `virtual-scrollbar-track--${r.value ? "horizontal" : "vertical"}`],
|
|
1198
1210
|
style: u.value,
|
|
1199
1211
|
role: "scrollbar",
|
|
@@ -1206,7 +1218,7 @@ function useVirtualScrollbar(e) {
|
|
|
1206
1218
|
tabindex: -1,
|
|
1207
1219
|
onMousedown: m
|
|
1208
1220
|
})),
|
|
1209
|
-
thumbProps:
|
|
1221
|
+
thumbProps: t(() => ({
|
|
1210
1222
|
class: [
|
|
1211
1223
|
"virtual-scrollbar-thumb",
|
|
1212
1224
|
`virtual-scrollbar-thumb--${r.value ? "horizontal" : "vertical"}`,
|
|
@@ -1221,14 +1233,16 @@ function useVirtualScrollbar(e) {
|
|
|
1221
1233
|
isDragging: d
|
|
1222
1234
|
};
|
|
1223
1235
|
}
|
|
1224
|
-
|
|
1225
|
-
|
|
1236
|
+
//#endregion
|
|
1237
|
+
//#region src/extensions/rtl.ts
|
|
1238
|
+
function Me() {
|
|
1239
|
+
let e = v(!1);
|
|
1226
1240
|
return {
|
|
1227
1241
|
name: "rtl",
|
|
1228
1242
|
onInit(t) {
|
|
1229
1243
|
let n = () => {
|
|
1230
1244
|
if (typeof window > "u") return;
|
|
1231
|
-
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";
|
|
1232
1246
|
e.value !== i && (e.value = i, t.internalState.isRtl.value = i);
|
|
1233
1247
|
}, r = t.methods.updateDirection;
|
|
1234
1248
|
t.methods.updateDirection = () => {
|
|
@@ -1237,18 +1251,20 @@ function useRtlExtension() {
|
|
|
1237
1251
|
}
|
|
1238
1252
|
};
|
|
1239
1253
|
}
|
|
1240
|
-
|
|
1254
|
+
//#endregion
|
|
1255
|
+
//#region src/extensions/snapping.ts
|
|
1256
|
+
function Ne() {
|
|
1241
1257
|
return {
|
|
1242
1258
|
name: "snapping",
|
|
1243
1259
|
onScrollEnd(e) {
|
|
1244
1260
|
if (!e.props.value.snap || e.internalState.isProgrammaticScroll.value) return;
|
|
1245
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;
|
|
1246
1262
|
if (a !== "horizontal") {
|
|
1247
|
-
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);
|
|
1248
1264
|
t && (o = t.index, c = t.align, u = !0);
|
|
1249
1265
|
}
|
|
1250
1266
|
if (a !== "vertical") {
|
|
1251
|
-
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);
|
|
1252
1268
|
o && (s = o.index, l = o.align, u = !0);
|
|
1253
1269
|
}
|
|
1254
1270
|
if (u) {
|
|
@@ -1270,23 +1286,27 @@ function useSnappingExtension() {
|
|
|
1270
1286
|
}
|
|
1271
1287
|
};
|
|
1272
1288
|
}
|
|
1273
|
-
|
|
1274
|
-
|
|
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));
|
|
1275
1293
|
return {
|
|
1276
1294
|
name: "sticky",
|
|
1277
1295
|
transformRenderedItems(t, n) {
|
|
1278
1296
|
let r = e(n).value;
|
|
1279
1297
|
if (r.length === 0) return t;
|
|
1280
|
-
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];
|
|
1281
1299
|
return o !== void 0 && o < i && t.some((e) => e.index === o), s;
|
|
1282
1300
|
}
|
|
1283
1301
|
};
|
|
1284
1302
|
}
|
|
1285
|
-
|
|
1303
|
+
//#endregion
|
|
1304
|
+
//#region src/extensions/infinite-loading.ts
|
|
1305
|
+
function Pe(e) {
|
|
1286
1306
|
return {
|
|
1287
1307
|
name: "infinite-loading",
|
|
1288
1308
|
onInit(t) {
|
|
1289
|
-
|
|
1309
|
+
D(t.scrollDetails, (n) => {
|
|
1290
1310
|
if (t.props.value.loading || !n || !n.totalSize || n.totalSize.width === 0 && n.totalSize.height === 0) return;
|
|
1291
1311
|
let r = t.props.value.direction || "vertical", i = t.props.value.loadDistance ?? 200;
|
|
1292
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");
|
|
@@ -1294,17 +1314,19 @@ function useInfiniteLoadingExtension(e) {
|
|
|
1294
1314
|
}
|
|
1295
1315
|
};
|
|
1296
1316
|
}
|
|
1297
|
-
|
|
1317
|
+
//#endregion
|
|
1318
|
+
//#region src/extensions/prepend-restoration.ts
|
|
1319
|
+
function K() {
|
|
1298
1320
|
let e = [];
|
|
1299
1321
|
return {
|
|
1300
1322
|
name: "prepend-restoration",
|
|
1301
1323
|
onInit(t) {
|
|
1302
|
-
e = [...t.props.value.items],
|
|
1324
|
+
e = [...t.props.value.items], D(() => t.props.value.items, (n) => {
|
|
1303
1325
|
if (!t.props.value.restoreScrollOnPrepend) {
|
|
1304
1326
|
e = [...n];
|
|
1305
1327
|
return;
|
|
1306
1328
|
}
|
|
1307
|
-
let r =
|
|
1329
|
+
let r = Ce(e, n);
|
|
1308
1330
|
if (r > 0) {
|
|
1309
1331
|
let e = t.props.value.direction || "vertical", i = (e === "horizontal" ? t.props.value.columnGap : t.props.value.gap) || 0, a = 0;
|
|
1310
1332
|
for (let e = 0; e < r; e++) a += t.methods.getItemBaseSize(n[e], e) + i;
|
|
@@ -1315,18 +1337,22 @@ function usePrependRestorationExtension() {
|
|
|
1315
1337
|
}
|
|
1316
1338
|
};
|
|
1317
1339
|
}
|
|
1318
|
-
|
|
1340
|
+
//#endregion
|
|
1341
|
+
//#region src/extensions/coordinate-scaling.ts
|
|
1342
|
+
function Fe() {
|
|
1319
1343
|
return {
|
|
1320
1344
|
name: "coordinate-scaling",
|
|
1321
1345
|
onInit(e) {
|
|
1322
|
-
|
|
1346
|
+
O(() => {
|
|
1323
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;
|
|
1324
|
-
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));
|
|
1325
1349
|
});
|
|
1326
1350
|
}
|
|
1327
1351
|
};
|
|
1328
1352
|
}
|
|
1329
|
-
|
|
1353
|
+
//#endregion
|
|
1354
|
+
//#region src/components/VirtualScrollbar.vue
|
|
1355
|
+
var q = /* @__PURE__ */ o({
|
|
1330
1356
|
__name: "VirtualScrollbar",
|
|
1331
1357
|
props: {
|
|
1332
1358
|
axis: { default: "vertical" },
|
|
@@ -1343,7 +1369,7 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1343
1369
|
},
|
|
1344
1370
|
emits: ["scrollToOffset"],
|
|
1345
1371
|
setup(e, { emit: t }) {
|
|
1346
|
-
let n = e, r = t, { trackProps: o, thumbProps: s } =
|
|
1372
|
+
let n = e, r = t, { trackProps: o, thumbProps: s } = je(() => ({
|
|
1347
1373
|
axis: n.axis,
|
|
1348
1374
|
totalSize: n.totalSize,
|
|
1349
1375
|
position: n.position,
|
|
@@ -1354,20 +1380,20 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1354
1380
|
n.scrollToOffset?.(e), r("scrollToOffset", e);
|
|
1355
1381
|
}
|
|
1356
1382
|
}));
|
|
1357
|
-
return (e, t) => (
|
|
1383
|
+
return (e, t) => (g(), i("div", f(c(E(o))), [a("div", f(c(E(s))), null, 16)], 16));
|
|
1358
1384
|
}
|
|
1359
|
-
}),
|
|
1385
|
+
}), Ie = {
|
|
1360
1386
|
key: 0,
|
|
1361
1387
|
class: "virtual-scroll-scrollbar-container",
|
|
1362
1388
|
"aria-hidden": "true"
|
|
1363
|
-
},
|
|
1389
|
+
}, Le = {
|
|
1364
1390
|
key: 0,
|
|
1365
1391
|
class: "virtual-scroll-debug-info"
|
|
1366
|
-
},
|
|
1392
|
+
}, Re = .95, ze = .1, Be = /* @__PURE__ */ ((e, t) => {
|
|
1367
1393
|
let n = e.__vccOpts || e;
|
|
1368
1394
|
for (let [e, r] of t) n[e] = r;
|
|
1369
1395
|
return n;
|
|
1370
|
-
})(/* @__PURE__ */
|
|
1396
|
+
})(/* @__PURE__ */ o({
|
|
1371
1397
|
__name: "VirtualScroll",
|
|
1372
1398
|
props: {
|
|
1373
1399
|
containerTag: { default: "div" },
|
|
@@ -1428,51 +1454,51 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1428
1454
|
"visibleRangeChange"
|
|
1429
1455
|
],
|
|
1430
1456
|
setup(o, { expose: s, emit: c }) {
|
|
1431
|
-
let _ = o, S = c, T =
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
],
|
|
1439
|
-
let e =
|
|
1440
|
-
return e ===
|
|
1441
|
-
}), 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, {
|
|
1442
1468
|
items: _.items,
|
|
1443
1469
|
itemSize: _.itemSize,
|
|
1444
1470
|
direction: _.direction,
|
|
1445
1471
|
bufferBefore: _.bufferBefore,
|
|
1446
1472
|
bufferAfter: _.bufferAfter,
|
|
1447
|
-
container:
|
|
1448
|
-
hostElement:
|
|
1449
|
-
hostRef:
|
|
1473
|
+
container: se.value,
|
|
1474
|
+
hostElement: A.value,
|
|
1475
|
+
hostRef: O.value,
|
|
1450
1476
|
ssrRange: _.ssrRange,
|
|
1451
1477
|
columnCount: _.columnCount,
|
|
1452
1478
|
columnWidth: _.columnWidth,
|
|
1453
1479
|
scrollPaddingStart: {
|
|
1454
|
-
x:
|
|
1455
|
-
y:
|
|
1480
|
+
x: le(_.scrollPaddingStart, _.direction),
|
|
1481
|
+
y: ue(_.scrollPaddingStart, _.direction)
|
|
1456
1482
|
},
|
|
1457
1483
|
scrollPaddingEnd: {
|
|
1458
|
-
x:
|
|
1459
|
-
y:
|
|
1484
|
+
x: le(_.scrollPaddingEnd, _.direction),
|
|
1485
|
+
y: ue(_.scrollPaddingEnd, _.direction)
|
|
1460
1486
|
},
|
|
1461
1487
|
flowPaddingStart: {
|
|
1462
1488
|
x: 0,
|
|
1463
|
-
y: _.stickyHeader ? 0 :
|
|
1489
|
+
y: _.stickyHeader ? 0 : P.value
|
|
1464
1490
|
},
|
|
1465
1491
|
flowPaddingEnd: {
|
|
1466
1492
|
x: 0,
|
|
1467
|
-
y: _.stickyFooter ? 0 :
|
|
1493
|
+
y: _.stickyFooter ? 0 : oe.value
|
|
1468
1494
|
},
|
|
1469
1495
|
stickyStart: {
|
|
1470
1496
|
x: 0,
|
|
1471
|
-
y: _.stickyHeader &&
|
|
1497
|
+
y: _.stickyHeader && ce.value ? P.value : 0
|
|
1472
1498
|
},
|
|
1473
1499
|
stickyEnd: {
|
|
1474
1500
|
x: 0,
|
|
1475
|
-
y: _.stickyFooter &&
|
|
1501
|
+
y: _.stickyFooter && ce.value ? oe.value : 0
|
|
1476
1502
|
},
|
|
1477
1503
|
gap: _.gap,
|
|
1478
1504
|
columnGap: _.columnGap,
|
|
@@ -1486,56 +1512,56 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1486
1512
|
defaultColumnWidth: _.defaultColumnWidth,
|
|
1487
1513
|
debug: _.debug,
|
|
1488
1514
|
snap: _.snap
|
|
1489
|
-
})), { isHydrated: I, isRtl:
|
|
1490
|
-
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) {
|
|
1491
1517
|
let { displayViewportSize: t } = R.value;
|
|
1492
|
-
e >=
|
|
1518
|
+
e >= z.value - t.height - .5 ? U(null, Infinity) : U(null, me(e, ke.y, De.value));
|
|
1493
1519
|
}
|
|
1494
|
-
function
|
|
1520
|
+
function J(e) {
|
|
1495
1521
|
let { displayViewportSize: t } = R.value;
|
|
1496
|
-
e >=
|
|
1522
|
+
e >= B.value - t.width - .5 ? U(Infinity, null) : U(me(e, ke.x, Ee.value), null);
|
|
1497
1523
|
}
|
|
1498
|
-
let
|
|
1524
|
+
let qe = je(t(() => ({
|
|
1499
1525
|
axis: "vertical",
|
|
1500
|
-
totalSize:
|
|
1526
|
+
totalSize: z.value,
|
|
1501
1527
|
position: R.value.displayScrollOffset.y,
|
|
1502
1528
|
viewportSize: R.value.displayViewportSize.height,
|
|
1503
|
-
scrollToOffset:
|
|
1504
|
-
containerId:
|
|
1505
|
-
isRtl:
|
|
1506
|
-
}))),
|
|
1529
|
+
scrollToOffset: Ke,
|
|
1530
|
+
containerId: N.value,
|
|
1531
|
+
isRtl: de.value
|
|
1532
|
+
}))), Je = je(t(() => ({
|
|
1507
1533
|
axis: "horizontal",
|
|
1508
|
-
totalSize:
|
|
1534
|
+
totalSize: B.value,
|
|
1509
1535
|
position: R.value.displayScrollOffset.x,
|
|
1510
1536
|
viewportSize: R.value.displayViewportSize.width,
|
|
1511
|
-
scrollToOffset:
|
|
1512
|
-
containerId:
|
|
1513
|
-
isRtl:
|
|
1514
|
-
}))),
|
|
1515
|
-
...
|
|
1537
|
+
scrollToOffset: J,
|
|
1538
|
+
containerId: N.value,
|
|
1539
|
+
isRtl: de.value
|
|
1540
|
+
}))), Ye = t(() => _.direction === "both" ? {
|
|
1541
|
+
...fe.value,
|
|
1516
1542
|
padStart: 0,
|
|
1517
1543
|
padEnd: 0
|
|
1518
|
-
} :
|
|
1519
|
-
function
|
|
1520
|
-
|
|
1544
|
+
} : fe.value);
|
|
1545
|
+
function Xe() {
|
|
1546
|
+
Ce(), _e(), u(() => {
|
|
1521
1547
|
let e = [];
|
|
1522
|
-
for (let [t, n] of
|
|
1548
|
+
for (let [t, n] of j.entries()) n && e.push({
|
|
1523
1549
|
index: t,
|
|
1524
1550
|
inlineSize: n.offsetWidth,
|
|
1525
1551
|
blockSize: n.offsetHeight,
|
|
1526
1552
|
element: n
|
|
1527
1553
|
});
|
|
1528
|
-
e.length > 0 &&
|
|
1554
|
+
e.length > 0 && ge(e);
|
|
1529
1555
|
});
|
|
1530
1556
|
}
|
|
1531
|
-
|
|
1557
|
+
D(R, (e, t) => {
|
|
1532
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", {
|
|
1533
1559
|
start: e.range.start,
|
|
1534
1560
|
end: e.range.end,
|
|
1535
1561
|
colStart: e.columnRange.start,
|
|
1536
1562
|
colEnd: e.columnRange.end
|
|
1537
1563
|
}));
|
|
1538
|
-
}),
|
|
1564
|
+
}), D(I, (e) => {
|
|
1539
1565
|
e && R.value?.range && R.value?.columnRange && S("visibleRangeChange", {
|
|
1540
1566
|
start: R.value.range.start,
|
|
1541
1567
|
end: R.value.range.end,
|
|
@@ -1543,7 +1569,7 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1543
1569
|
colEnd: R.value.columnRange.end
|
|
1544
1570
|
});
|
|
1545
1571
|
}, { once: !0 });
|
|
1546
|
-
let
|
|
1572
|
+
let Y = typeof window > "u" ? null : new ResizeObserver(he), X = typeof window > "u" ? null : new ResizeObserver((e) => {
|
|
1547
1573
|
let t = [];
|
|
1548
1574
|
for (let n of e) {
|
|
1549
1575
|
let e = n.target, r = Number(e.dataset.index), i = e.dataset.colIndex, a = n.contentRect.width, o = n.contentRect.height;
|
|
@@ -1559,41 +1585,41 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1559
1585
|
element: e
|
|
1560
1586
|
});
|
|
1561
1587
|
}
|
|
1562
|
-
t.length > 0 &&
|
|
1563
|
-
}),
|
|
1564
|
-
|
|
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();
|
|
1565
1591
|
});
|
|
1566
|
-
function
|
|
1567
|
-
|
|
1568
|
-
n &&
|
|
1592
|
+
function Qe(e, t) {
|
|
1593
|
+
D(e, (e, n) => {
|
|
1594
|
+
n && Ze?.unobserve(n), e ? Ze?.observe(e) : t.value = 0;
|
|
1569
1595
|
}, { immediate: !0 });
|
|
1570
1596
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
for (let e of
|
|
1574
|
-
}),
|
|
1575
|
-
t &&
|
|
1576
|
-
}),
|
|
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]) => {
|
|
1577
1603
|
let i = e !== n || t !== r;
|
|
1578
1604
|
n && i && n.removeEventListener("wheel", ft), e && i && e.addEventListener("wheel", ft, { passive: !t });
|
|
1579
1605
|
}, { immediate: !0 });
|
|
1580
|
-
function
|
|
1606
|
+
function $e(e, t) {
|
|
1581
1607
|
let n = t ? "observe" : "unobserve";
|
|
1582
|
-
|
|
1608
|
+
X?.[n](e), _.direction === "both" && e.children.length > 0 && e.querySelectorAll("[data-col-index]").forEach((e) => X?.[n](e));
|
|
1583
1609
|
}
|
|
1584
|
-
function
|
|
1610
|
+
function et(e, t) {
|
|
1585
1611
|
if (e) {
|
|
1586
1612
|
let n = e;
|
|
1587
|
-
|
|
1613
|
+
j.set(t, n), $e(n, !0);
|
|
1588
1614
|
} else {
|
|
1589
|
-
let e =
|
|
1590
|
-
e && (
|
|
1615
|
+
let e = j.get(t);
|
|
1616
|
+
e && ($e(e, !1), j.delete(t));
|
|
1591
1617
|
}
|
|
1592
1618
|
}
|
|
1593
|
-
let
|
|
1619
|
+
let tt = v(!1), nt = {
|
|
1594
1620
|
x: 0,
|
|
1595
1621
|
y: 0
|
|
1596
|
-
},
|
|
1622
|
+
}, rt = {
|
|
1597
1623
|
x: 0,
|
|
1598
1624
|
y: 0
|
|
1599
1625
|
}, it = {
|
|
@@ -1605,10 +1631,10 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1605
1631
|
}, ot = null;
|
|
1606
1632
|
function st() {
|
|
1607
1633
|
let e = () => {
|
|
1608
|
-
let { nextVelocity: t, delta: n } =
|
|
1634
|
+
let { nextVelocity: t, delta: n } = we(Z, Re);
|
|
1609
1635
|
Z.x = t.x, Z.y = t.y;
|
|
1610
1636
|
let { x: r, y: i } = R.value.scrollOffset;
|
|
1611
|
-
|
|
1637
|
+
U(r + n.x, i + n.y, { behavior: "auto" }), Math.abs(Z.x) > ze || Math.abs(Z.y) > ze ? ot = requestAnimationFrame(e) : ct();
|
|
1612
1638
|
};
|
|
1613
1639
|
ot = requestAnimationFrame(e);
|
|
1614
1640
|
}
|
|
@@ -1619,22 +1645,22 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1619
1645
|
};
|
|
1620
1646
|
}
|
|
1621
1647
|
function lt(e) {
|
|
1622
|
-
|
|
1648
|
+
W(), ct(), We.value && (e.pointerType === "mouse" && e.button !== 0 || (tt.value = !0, nt = {
|
|
1623
1649
|
x: e.clientX,
|
|
1624
1650
|
y: e.clientY
|
|
1625
1651
|
}, it = {
|
|
1626
1652
|
x: e.clientX,
|
|
1627
1653
|
y: e.clientY
|
|
1628
|
-
}, at = performance.now(),
|
|
1654
|
+
}, at = performance.now(), rt = {
|
|
1629
1655
|
x: R.value.scrollOffset.x,
|
|
1630
1656
|
y: R.value.scrollOffset.y
|
|
1631
1657
|
}, e.currentTarget.setPointerCapture(e.pointerId)));
|
|
1632
1658
|
}
|
|
1633
1659
|
function ut(e) {
|
|
1634
|
-
if (!
|
|
1660
|
+
if (!tt.value) return;
|
|
1635
1661
|
let t = performance.now(), n = t - at;
|
|
1636
1662
|
if (n > 0) {
|
|
1637
|
-
let t =
|
|
1663
|
+
let t = Te(it, {
|
|
1638
1664
|
x: e.clientX,
|
|
1639
1665
|
y: e.clientY
|
|
1640
1666
|
}, n);
|
|
@@ -1644,26 +1670,26 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1644
1670
|
x: e.clientX,
|
|
1645
1671
|
y: e.clientY
|
|
1646
1672
|
}, at = t;
|
|
1647
|
-
let r =
|
|
1673
|
+
let r = nt.x - e.clientX, i = nt.y - e.clientY;
|
|
1648
1674
|
requestAnimationFrame(() => {
|
|
1649
|
-
|
|
1675
|
+
U(rt.x + r, rt.y + i, { behavior: "auto" });
|
|
1650
1676
|
});
|
|
1651
1677
|
}
|
|
1652
1678
|
function dt(e) {
|
|
1653
|
-
|
|
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()));
|
|
1654
1680
|
}
|
|
1655
1681
|
function ft(e) {
|
|
1656
1682
|
let { scrollOffset: t } = R.value;
|
|
1657
|
-
if (
|
|
1683
|
+
if (W(), We.value) {
|
|
1658
1684
|
e.preventDefault();
|
|
1659
1685
|
let { deltaX: n, deltaY: r } = e;
|
|
1660
|
-
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" });
|
|
1661
1687
|
}
|
|
1662
1688
|
}
|
|
1663
1689
|
function pt(e) {
|
|
1664
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) => {
|
|
1665
1691
|
let r = (e ? n.x : n.y) + (e ? t.width : t.height) / 2;
|
|
1666
|
-
return e ?
|
|
1692
|
+
return e ? Ue(r) : He(r);
|
|
1667
1693
|
}, { currentIndex: p, currentEndIndex: m, currentColIndex: h, currentEndColIndex: g } = R.value, v = (e, t) => {
|
|
1668
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;
|
|
1669
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;
|
|
@@ -1671,78 +1697,78 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1671
1697
|
let i = !e;
|
|
1672
1698
|
if (d === "center") {
|
|
1673
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);
|
|
1674
|
-
|
|
1700
|
+
H(e ? a : null, i ? a : null, { align: "center" });
|
|
1675
1701
|
return;
|
|
1676
1702
|
}
|
|
1677
|
-
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" });
|
|
1678
1704
|
else {
|
|
1679
1705
|
let e = d || "end", r = n.y + t.height - (s.y + l.y);
|
|
1680
|
-
|
|
1706
|
+
ye(m) + pe(m) > r + 1 ? H(m, null, { align: e }) : m < _.items.length - 1 && H(m + 1, null, { align: e });
|
|
1681
1707
|
}
|
|
1682
|
-
else if (d === "end")
|
|
1708
|
+
else if (d === "end") H(Math.max(0, m - 1), null, { align: "end" });
|
|
1683
1709
|
else {
|
|
1684
1710
|
let e = d || "start", t = n.y + o.y + c.y;
|
|
1685
|
-
|
|
1711
|
+
ye(p) < t - 1 ? H(p, null, { align: e }) : p > 0 && H(p - 1, null, { align: e });
|
|
1686
1712
|
}
|
|
1687
1713
|
else {
|
|
1688
1714
|
let e = _.columnCount ? _.columnCount - 1 : _.items.length - 1;
|
|
1689
|
-
if (
|
|
1715
|
+
if (de.value ? !r : r) if (d === "start") H(null, Math.min(e, h + 1), { align: "start" });
|
|
1690
1716
|
else {
|
|
1691
1717
|
let r = d || "end", i = n.x + t.width - (s.x + l.x);
|
|
1692
|
-
(_.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 });
|
|
1693
1719
|
}
|
|
1694
|
-
else if (d === "end")
|
|
1720
|
+
else if (d === "end") H(null, Math.max(0, g - 1), { align: "end" });
|
|
1695
1721
|
else {
|
|
1696
1722
|
let e = d || "start", t = n.x + o.x + c.x;
|
|
1697
|
-
(_.columnCount ?
|
|
1723
|
+
(_.columnCount ? be(h) : ve(h)) < t - 1 ? H(null, h, { align: e }) : h > 0 && H(null, h - 1, { align: e });
|
|
1698
1724
|
}
|
|
1699
1725
|
}
|
|
1700
1726
|
};
|
|
1701
1727
|
switch (e.key) {
|
|
1702
1728
|
case "Home":
|
|
1703
|
-
e.preventDefault(),
|
|
1729
|
+
e.preventDefault(), W(), H(0, 0, {
|
|
1704
1730
|
behavior: Math.max(n.x, n.y) > 10 * (_.direction === "horizontal" ? t.width : t.height) ? "auto" : "smooth",
|
|
1705
1731
|
align: "start"
|
|
1706
1732
|
});
|
|
1707
1733
|
break;
|
|
1708
1734
|
case "End": {
|
|
1709
|
-
e.preventDefault(),
|
|
1735
|
+
e.preventDefault(), W();
|
|
1710
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";
|
|
1711
|
-
_.direction === "both" ?
|
|
1737
|
+
_.direction === "both" ? H(r, i, {
|
|
1712
1738
|
behavior: o,
|
|
1713
1739
|
align: "end"
|
|
1714
|
-
}) :
|
|
1740
|
+
}) : H(_.direction === "vertical" ? r : 0, _.direction === "horizontal" ? r : 0, {
|
|
1715
1741
|
behavior: o,
|
|
1716
1742
|
align: "end"
|
|
1717
1743
|
});
|
|
1718
1744
|
break;
|
|
1719
1745
|
}
|
|
1720
1746
|
case "ArrowUp":
|
|
1721
|
-
e.preventDefault(),
|
|
1747
|
+
e.preventDefault(), W(), i && y(!0, !1);
|
|
1722
1748
|
break;
|
|
1723
1749
|
case "ArrowDown":
|
|
1724
|
-
e.preventDefault(),
|
|
1750
|
+
e.preventDefault(), W(), i && y(!0, !0);
|
|
1725
1751
|
break;
|
|
1726
1752
|
case "ArrowLeft":
|
|
1727
|
-
e.preventDefault(),
|
|
1753
|
+
e.preventDefault(), W(), r && y(!1, !1);
|
|
1728
1754
|
break;
|
|
1729
1755
|
case "ArrowRight":
|
|
1730
|
-
e.preventDefault(),
|
|
1756
|
+
e.preventDefault(), W(), r && y(!1, !0);
|
|
1731
1757
|
break;
|
|
1732
1758
|
case "PageUp":
|
|
1733
|
-
e.preventDefault(),
|
|
1759
|
+
e.preventDefault(), W(), _.direction === "horizontal" ? H(null, v(!1, !1), { align: d || "end" }) : H(v(!0, !1), null, { align: d || "end" });
|
|
1734
1760
|
break;
|
|
1735
1761
|
case "PageDown":
|
|
1736
|
-
e.preventDefault(),
|
|
1762
|
+
e.preventDefault(), W(), _.direction === "horizontal" ? H(null, v(!1, !0), { align: d || "start" }) : H(v(!0, !0), null, { align: d || "start" });
|
|
1737
1763
|
break;
|
|
1738
1764
|
}
|
|
1739
1765
|
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1766
|
+
h(() => {
|
|
1767
|
+
Y?.disconnect(), X?.disconnect(), Ze?.disconnect();
|
|
1742
1768
|
});
|
|
1743
|
-
let mt =
|
|
1769
|
+
let mt = t(() => {
|
|
1744
1770
|
let e = { ..._.direction === "vertical" ? {} : { whiteSpace: "nowrap" } };
|
|
1745
|
-
return (
|
|
1771
|
+
return (Ge.value || !Oe.value) && (e.overflow = "auto"), We.value && (e.touchAction = "none"), Oe.value ? e : _.containerTag === "table" ? {
|
|
1746
1772
|
...e,
|
|
1747
1773
|
display: "block",
|
|
1748
1774
|
minInlineSize: _.direction === "vertical" ? "100%" : "auto"
|
|
@@ -1763,28 +1789,28 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1763
1789
|
position: n,
|
|
1764
1790
|
viewportSize: r,
|
|
1765
1791
|
scrollToOffset: i,
|
|
1766
|
-
containerId:
|
|
1767
|
-
isRtl:
|
|
1792
|
+
containerId: N.value,
|
|
1793
|
+
isRtl: de.value,
|
|
1768
1794
|
ariaLabel: `${e === "vertical" ? "Vertical" : "Horizontal"} scroll`
|
|
1769
1795
|
},
|
|
1770
1796
|
isDragging: a.isDragging.value
|
|
1771
1797
|
};
|
|
1772
1798
|
}
|
|
1773
|
-
let gt =
|
|
1799
|
+
let gt = t(() => {
|
|
1774
1800
|
if (_.direction === "horizontal") return null;
|
|
1775
1801
|
let { displayViewportSize: e, displayScrollOffset: t } = R.value;
|
|
1776
|
-
return ht("vertical",
|
|
1777
|
-
}), Q =
|
|
1802
|
+
return ht("vertical", z.value, t.y, e.height, Ke, qe);
|
|
1803
|
+
}), Q = t(() => {
|
|
1778
1804
|
if (_.direction === "vertical") return null;
|
|
1779
1805
|
let { displayViewportSize: e, displayScrollOffset: t } = R.value;
|
|
1780
|
-
return ht("horizontal",
|
|
1781
|
-
}), _t =
|
|
1806
|
+
return ht("horizontal", B.value, t.x, e.width, J, Je);
|
|
1807
|
+
}), _t = t(() => {
|
|
1782
1808
|
let e = _.direction === "horizontal", t = _.direction === "vertical", n = _.direction === "both", r = {
|
|
1783
|
-
inlineSize: t ? "100%" : `${
|
|
1784
|
-
blockSize: e ? "100%" : `${
|
|
1809
|
+
inlineSize: t ? "100%" : `${Be.value}px`,
|
|
1810
|
+
blockSize: e ? "100%" : `${Ve.value}px`
|
|
1785
1811
|
};
|
|
1786
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;
|
|
1787
|
-
}), vt =
|
|
1813
|
+
}), vt = t(() => {
|
|
1788
1814
|
let e = _.direction === "horizontal";
|
|
1789
1815
|
return {
|
|
1790
1816
|
display: e ? "inline-block" : "block",
|
|
@@ -1793,12 +1819,12 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1793
1819
|
verticalAlign: "top"
|
|
1794
1820
|
} : { inlineSize: "100%" }
|
|
1795
1821
|
};
|
|
1796
|
-
}), yt =
|
|
1797
|
-
inlineSize: _.direction === "vertical" ? "1px" : `${
|
|
1798
|
-
blockSize: _.direction === "horizontal" ? "1px" : `${
|
|
1822
|
+
}), yt = t(() => ({
|
|
1823
|
+
inlineSize: _.direction === "vertical" ? "1px" : `${Be.value}px`,
|
|
1824
|
+
blockSize: _.direction === "horizontal" ? "1px" : `${Ve.value}px`
|
|
1799
1825
|
}));
|
|
1800
1826
|
function bt(e) {
|
|
1801
|
-
let t =
|
|
1827
|
+
let t = xe({
|
|
1802
1828
|
containerTag: _.containerTag || "div",
|
|
1803
1829
|
direction: _.direction,
|
|
1804
1830
|
isHydrated: I.value,
|
|
@@ -1806,22 +1832,22 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1806
1832
|
itemSize: _.itemSize,
|
|
1807
1833
|
paddingStartX: F.value.scrollPaddingStart.x,
|
|
1808
1834
|
paddingStartY: F.value.scrollPaddingStart.y,
|
|
1809
|
-
isRtl:
|
|
1835
|
+
isRtl: de.value
|
|
1810
1836
|
});
|
|
1811
1837
|
return !I.value && _.direction === "both" && (t.display = "flex", _.columnGap && (t.columnGap = `${_.columnGap}px`)), t;
|
|
1812
1838
|
}
|
|
1813
|
-
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(() => {
|
|
1814
1840
|
if (Tt.value) return "row";
|
|
1815
1841
|
let e = wt.value;
|
|
1816
1842
|
return e === "tree" ? "treeitem" : e === "listbox" ? "option" : e === "menu" ? "menuitem" : "listitem";
|
|
1817
|
-
}), kt =
|
|
1843
|
+
}), kt = t(() => _.itemRole ?? Ot.value), At = t(() => _.role === "grid" || !_.role && _.direction === "both" ? "gridcell" : $.value ? "cell" : null), jt = t(() => {
|
|
1818
1844
|
let e = kt.value;
|
|
1819
1845
|
return e == null || e !== "none" && e !== "presentation";
|
|
1820
|
-
}), Mt =
|
|
1846
|
+
}), Mt = t(() => ({
|
|
1821
1847
|
"aria-label": _.ariaLabel,
|
|
1822
1848
|
"aria-labelledby": _.ariaLabelledby,
|
|
1823
1849
|
"aria-busy": _.loading ? "true" : void 0
|
|
1824
|
-
})), Nt =
|
|
1850
|
+
})), Nt = t(() => {
|
|
1825
1851
|
let e = {}, t = wt.value;
|
|
1826
1852
|
return t && [
|
|
1827
1853
|
"grid",
|
|
@@ -1844,46 +1870,46 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1844
1870
|
return Tt.value && (n["aria-colindex"] = e + 1), n;
|
|
1845
1871
|
}
|
|
1846
1872
|
return s({
|
|
1847
|
-
...
|
|
1873
|
+
...w(_),
|
|
1848
1874
|
scrollDetails: R,
|
|
1849
|
-
columnRange:
|
|
1850
|
-
getColumnWidth:
|
|
1851
|
-
getRowHeight:
|
|
1875
|
+
columnRange: fe,
|
|
1876
|
+
getColumnWidth: V,
|
|
1877
|
+
getRowHeight: pe,
|
|
1852
1878
|
getCellAriaProps: Ft,
|
|
1853
1879
|
getItemAriaProps: Pt,
|
|
1854
|
-
getRowOffset:
|
|
1855
|
-
getColumnOffset:
|
|
1856
|
-
getItemOffset:
|
|
1857
|
-
getItemSize:
|
|
1880
|
+
getRowOffset: ye,
|
|
1881
|
+
getColumnOffset: be,
|
|
1882
|
+
getItemOffset: ve,
|
|
1883
|
+
getItemSize: Se,
|
|
1858
1884
|
isTable: $,
|
|
1859
|
-
itemTag:
|
|
1860
|
-
getRowIndexAt:
|
|
1861
|
-
getColIndexAt:
|
|
1862
|
-
scrollToIndex:
|
|
1863
|
-
scrollToOffset:
|
|
1864
|
-
refresh:
|
|
1885
|
+
itemTag: t(() => _.itemTag || "div"),
|
|
1886
|
+
getRowIndexAt: He,
|
|
1887
|
+
getColIndexAt: Ue,
|
|
1888
|
+
scrollToIndex: H,
|
|
1889
|
+
scrollToOffset: U,
|
|
1890
|
+
refresh: Xe,
|
|
1865
1891
|
stopProgrammaticScroll: () => {
|
|
1866
|
-
|
|
1892
|
+
W(), ct();
|
|
1867
1893
|
},
|
|
1868
|
-
updateDirection:
|
|
1869
|
-
isRtl:
|
|
1894
|
+
updateDirection: _e,
|
|
1895
|
+
isRtl: de,
|
|
1870
1896
|
isHydrated: I,
|
|
1871
|
-
scaleX:
|
|
1872
|
-
scaleY:
|
|
1873
|
-
renderedWidth:
|
|
1874
|
-
renderedHeight:
|
|
1875
|
-
componentOffset:
|
|
1897
|
+
scaleX: Ee,
|
|
1898
|
+
scaleY: De,
|
|
1899
|
+
renderedWidth: B,
|
|
1900
|
+
renderedHeight: z,
|
|
1901
|
+
componentOffset: ke,
|
|
1876
1902
|
scrollbarPropsVertical: gt,
|
|
1877
1903
|
scrollbarPropsHorizontal: Q
|
|
1878
|
-
}), (t, s) => (
|
|
1879
|
-
id:
|
|
1904
|
+
}), (t, s) => (g(), n(x(o.containerTag), l({
|
|
1905
|
+
id: N.value,
|
|
1880
1906
|
ref_key: "hostRef",
|
|
1881
|
-
ref:
|
|
1907
|
+
ref: O,
|
|
1882
1908
|
class: ["virtual-scroll-container", [`virtual-scroll--${o.direction}`, {
|
|
1883
|
-
"virtual-scroll--hydrated":
|
|
1884
|
-
"virtual-scroll--window":
|
|
1909
|
+
"virtual-scroll--hydrated": E(I),
|
|
1910
|
+
"virtual-scroll--window": E(Oe),
|
|
1885
1911
|
"virtual-scroll--table": $.value,
|
|
1886
|
-
"virtual-scroll--hide-scrollbar":
|
|
1912
|
+
"virtual-scroll--hide-scrollbar": Ge.value
|
|
1887
1913
|
}]],
|
|
1888
1914
|
style: mt.value,
|
|
1889
1915
|
tabindex: "0",
|
|
@@ -1898,47 +1924,47 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1898
1924
|
onPointerup: dt,
|
|
1899
1925
|
onPointercancel: dt
|
|
1900
1926
|
}), {
|
|
1901
|
-
default:
|
|
1902
|
-
|
|
1927
|
+
default: k(() => [
|
|
1928
|
+
Ge.value ? (g(), i("div", Ie, [a("div", {
|
|
1903
1929
|
class: "virtual-scroll-scrollbar-viewport",
|
|
1904
|
-
style:
|
|
1905
|
-
inlineSize: `${
|
|
1906
|
-
blockSize: `${
|
|
1930
|
+
style: p({
|
|
1931
|
+
inlineSize: `${E(R).displayViewportSize.width}px`,
|
|
1932
|
+
blockSize: `${E(R).displayViewportSize.height}px`,
|
|
1907
1933
|
"--vsi-scrollbar-has-cross-gap": o.direction === "both" ? 1 : 0
|
|
1908
1934
|
})
|
|
1909
|
-
}, [T.scrollbar && gt.value ?
|
|
1910
|
-
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), {
|
|
1911
1937
|
key: 1,
|
|
1912
1938
|
ref_key: "headerRef",
|
|
1913
1939
|
ref: ne,
|
|
1914
|
-
class:
|
|
1940
|
+
class: d(["virtual-scroll-header", { "virtual-scroll--sticky": o.stickyHeader }]),
|
|
1915
1941
|
role: $.value ? void 0 : "none"
|
|
1916
1942
|
}, {
|
|
1917
|
-
default:
|
|
1943
|
+
default: k(() => [b(t.$slots, "header", {}, void 0, !0)]),
|
|
1918
1944
|
_: 3
|
|
1919
|
-
}, 8, ["class", "role"])) :
|
|
1920
|
-
(
|
|
1945
|
+
}, 8, ["class", "role"])) : r("", !0),
|
|
1946
|
+
(g(), n(x(o.wrapperTag), l({
|
|
1921
1947
|
ref_key: "wrapperRef",
|
|
1922
|
-
ref:
|
|
1948
|
+
ref: A,
|
|
1923
1949
|
class: "virtual-scroll-wrapper",
|
|
1924
1950
|
style: _t.value,
|
|
1925
1951
|
role: $.value ? void 0 : Dt.value
|
|
1926
1952
|
}, $.value ? {} : Nt.value), {
|
|
1927
|
-
default:
|
|
1953
|
+
default: k(() => [$.value ? (g(), n(x(o.itemTag), {
|
|
1928
1954
|
key: 0,
|
|
1929
1955
|
class: "virtual-scroll-spacer",
|
|
1930
|
-
style:
|
|
1956
|
+
style: p(yt.value)
|
|
1931
1957
|
}, {
|
|
1932
|
-
default:
|
|
1958
|
+
default: k(() => [...s[0] ||= [a("td", { style: {
|
|
1933
1959
|
padding: "0",
|
|
1934
1960
|
border: "none",
|
|
1935
1961
|
"block-size": "inherit"
|
|
1936
1962
|
} }, null, -1)]]),
|
|
1937
1963
|
_: 1
|
|
1938
|
-
}, 8, ["style"])) :
|
|
1964
|
+
}, 8, ["style"])) : r("", !0), (g(!0), i(e, null, y(E(L), (e) => (g(), n(x(o.itemTag), l({
|
|
1939
1965
|
key: e.index,
|
|
1940
1966
|
ref_for: !0,
|
|
1941
|
-
ref: (t) =>
|
|
1967
|
+
ref: (t) => et(t, e.index),
|
|
1942
1968
|
"data-index": e.index,
|
|
1943
1969
|
class: ["virtual-scroll-item", {
|
|
1944
1970
|
"virtual-scroll--sticky": e.isStickyActive,
|
|
@@ -1946,12 +1972,12 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1946
1972
|
}],
|
|
1947
1973
|
style: bt(e)
|
|
1948
1974
|
}, { ref_for: !0 }, jt.value ? Pt(e.index) : { role: "none" }), {
|
|
1949
|
-
default:
|
|
1975
|
+
default: k(() => [b(t.$slots, "item", {
|
|
1950
1976
|
item: e.item,
|
|
1951
1977
|
index: e.index,
|
|
1952
1978
|
getItemAriaProps: Pt,
|
|
1953
|
-
columnRange:
|
|
1954
|
-
getColumnWidth:
|
|
1979
|
+
columnRange: Ye.value,
|
|
1980
|
+
getColumnWidth: E(V),
|
|
1955
1981
|
getCellAriaProps: Ft,
|
|
1956
1982
|
gap: _.gap,
|
|
1957
1983
|
columnGap: _.columnGap,
|
|
@@ -1960,7 +1986,7 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1960
1986
|
isStickyActiveX: e.isStickyActiveX,
|
|
1961
1987
|
isStickyActiveY: e.isStickyActiveY,
|
|
1962
1988
|
offset: e.offset
|
|
1963
|
-
}, 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)]),
|
|
1964
1990
|
_: 2
|
|
1965
1991
|
}, 1040, [
|
|
1966
1992
|
"data-index",
|
|
@@ -1969,23 +1995,23 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1969
1995
|
]))), 128))]),
|
|
1970
1996
|
_: 3
|
|
1971
1997
|
}, 16, ["style", "role"])),
|
|
1972
|
-
o.loading && T.loading ? (
|
|
1998
|
+
o.loading && T.loading ? (g(), i("div", {
|
|
1973
1999
|
key: 2,
|
|
1974
2000
|
class: "virtual-scroll-loading",
|
|
1975
|
-
style:
|
|
2001
|
+
style: p(vt.value),
|
|
1976
2002
|
"aria-live": "polite",
|
|
1977
2003
|
"aria-atomic": "true"
|
|
1978
|
-
}, [
|
|
1979
|
-
T.footer ? (
|
|
2004
|
+
}, [b(t.$slots, "loading", {}, void 0, !0)], 4)) : r("", !0),
|
|
2005
|
+
T.footer ? (g(), n(x(Ct.value), {
|
|
1980
2006
|
key: 3,
|
|
1981
2007
|
ref_key: "footerRef",
|
|
1982
2008
|
ref: re,
|
|
1983
|
-
class:
|
|
2009
|
+
class: d(["virtual-scroll-footer", { "virtual-scroll--sticky": o.stickyFooter }]),
|
|
1984
2010
|
role: $.value ? void 0 : "none"
|
|
1985
2011
|
}, {
|
|
1986
|
-
default:
|
|
2012
|
+
default: k(() => [b(t.$slots, "footer", {}, void 0, !0)]),
|
|
1987
2013
|
_: 3
|
|
1988
|
-
}, 8, ["class", "role"])) :
|
|
2014
|
+
}, 8, ["class", "role"])) : r("", !0)
|
|
1989
2015
|
]),
|
|
1990
2016
|
_: 3
|
|
1991
2017
|
}, 16, [
|
|
@@ -1995,7 +2021,8 @@ var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
|
1995
2021
|
"role"
|
|
1996
2022
|
]));
|
|
1997
2023
|
}
|
|
1998
|
-
}), [["__scopeId", "data-v-
|
|
1999
|
-
|
|
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 };
|
|
2000
2027
|
|
|
2001
2028
|
//# sourceMappingURL=index.mjs.map
|