@pdanpdan/virtual-scroll 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -174
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +192 -348
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1691 -2198
- package/dist/index.mjs.map +1 -1
- package/dist/virtual-scroll.css +2 -1
- package/package.json +4 -2
- package/src/components/VirtualScroll.test.ts +36 -0
- package/src/components/VirtualScroll.vue +25 -55
- package/src/composables/useVirtualScroll.ts +81 -145
- package/src/composables/useVirtualScrollbar.test.ts +14 -14
- package/src/composables/useVirtualScrollbar.ts +5 -0
- package/src/index.ts +7 -0
- package/src/types.ts +132 -170
- package/src/utils/scroll.test.ts +64 -10
- package/src/utils/scroll.ts +31 -0
- package/src/utils/virtual-scroll-logic.test.ts +48 -31
- package/src/utils/virtual-scroll-logic.ts +82 -49
package/dist/index.mjs
CHANGED
|
@@ -1,2225 +1,1718 @@
|
|
|
1
|
-
import { computed
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Resize the tree while preserving existing values and rebuilding the prefix sums.
|
|
105
|
-
*
|
|
106
|
-
* @param size - The new size of the tree.
|
|
107
|
-
*/
|
|
108
|
-
resize(e) {
|
|
109
|
-
if (e === this.values.length)
|
|
110
|
-
return;
|
|
111
|
-
const i = new Float64Array(e);
|
|
112
|
-
i.set(this.values.subarray(0, Math.min(e, this.values.length))), this.values = i, this.tree = new Float64Array(e + 1), this.rebuild();
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Shift values by a given offset and rebuild the tree.
|
|
116
|
-
* Useful when items are prepended to the list to maintain existing measurements.
|
|
117
|
-
*
|
|
118
|
-
* @param offset - Number of positions to shift. Positive for prepending (shifts right).
|
|
119
|
-
*/
|
|
120
|
-
shift(e) {
|
|
121
|
-
if (e === 0)
|
|
122
|
-
return;
|
|
123
|
-
const i = this.values.length, t = new Float64Array(i);
|
|
124
|
-
e > 0 ? t.set(this.values.subarray(0, Math.min(i - e, this.values.length)), e) : t.set(this.values.subarray(-e)), this.values = t, this.rebuild();
|
|
125
|
-
}
|
|
1
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, getCurrentInstance, guardReactiveProps, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onMounted, onUnmounted, openBlock, reactive, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, toRefs, toValue, unref, useId, useSlots, watch, withCtx } from "vue";
|
|
2
|
+
const DEFAULT_ITEM_SIZE = 40, DEFAULT_COLUMN_WIDTH = 100, DEFAULT_BUFFER = 5, EMPTY_SCROLL_DETAILS = {
|
|
3
|
+
items: [],
|
|
4
|
+
currentIndex: 0,
|
|
5
|
+
currentColIndex: 0,
|
|
6
|
+
currentEndIndex: 0,
|
|
7
|
+
currentEndColIndex: 0,
|
|
8
|
+
scrollOffset: {
|
|
9
|
+
x: 0,
|
|
10
|
+
y: 0
|
|
11
|
+
},
|
|
12
|
+
displayScrollOffset: {
|
|
13
|
+
x: 0,
|
|
14
|
+
y: 0
|
|
15
|
+
},
|
|
16
|
+
viewportSize: {
|
|
17
|
+
width: 0,
|
|
18
|
+
height: 0
|
|
19
|
+
},
|
|
20
|
+
displayViewportSize: {
|
|
21
|
+
width: 0,
|
|
22
|
+
height: 0
|
|
23
|
+
},
|
|
24
|
+
totalSize: {
|
|
25
|
+
width: 0,
|
|
26
|
+
height: 0
|
|
27
|
+
},
|
|
28
|
+
isScrolling: !1,
|
|
29
|
+
isProgrammaticScroll: !1,
|
|
30
|
+
range: {
|
|
31
|
+
start: 0,
|
|
32
|
+
end: 0
|
|
33
|
+
},
|
|
34
|
+
columnRange: {
|
|
35
|
+
start: 0,
|
|
36
|
+
end: 0,
|
|
37
|
+
padStart: 0,
|
|
38
|
+
padEnd: 0
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var FenwickTree = class {
|
|
42
|
+
tree;
|
|
43
|
+
values;
|
|
44
|
+
constructor(e) {
|
|
45
|
+
this.tree = new Float64Array(e + 1), this.values = new Float64Array(e);
|
|
46
|
+
}
|
|
47
|
+
update(e, t) {
|
|
48
|
+
if (!(e < 0 || e >= this.values.length)) for (this.values[e] = this.values[e] + t, e++; e < this.tree.length;) this.tree[e] = this.tree[e] + t, e += e & -e;
|
|
49
|
+
}
|
|
50
|
+
query(e) {
|
|
51
|
+
let t = 0;
|
|
52
|
+
for (; e > 0;) t += this.tree[e] || 0, e -= e & -e;
|
|
53
|
+
return t;
|
|
54
|
+
}
|
|
55
|
+
set(e, t) {
|
|
56
|
+
e < 0 || e >= this.values.length || (this.values[e] = t);
|
|
57
|
+
}
|
|
58
|
+
get length() {
|
|
59
|
+
return this.values.length;
|
|
60
|
+
}
|
|
61
|
+
get(e) {
|
|
62
|
+
return this.values[e] || 0;
|
|
63
|
+
}
|
|
64
|
+
getValues() {
|
|
65
|
+
return this.values;
|
|
66
|
+
}
|
|
67
|
+
findLowerBound(e) {
|
|
68
|
+
let t = 0, n = this.tree.length, r = 1 << Math.floor(Math.log2(n - 1));
|
|
69
|
+
for (; r > 0;) {
|
|
70
|
+
let i = t + r;
|
|
71
|
+
if (i < n) {
|
|
72
|
+
let n = this.tree[i] || 0;
|
|
73
|
+
n <= e && (t = i, e -= n);
|
|
74
|
+
}
|
|
75
|
+
r >>= 1;
|
|
76
|
+
}
|
|
77
|
+
return t;
|
|
78
|
+
}
|
|
79
|
+
rebuild() {
|
|
80
|
+
this.tree.fill(0);
|
|
81
|
+
for (let e = 0; e < this.values.length; e++) this.tree[e + 1] = this.values[e] || 0;
|
|
82
|
+
for (let e = 1; e < this.tree.length; e++) {
|
|
83
|
+
let t = e + (e & -e);
|
|
84
|
+
t < this.tree.length && (this.tree[t] = this.tree[t] + this.tree[e]);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
resize(e) {
|
|
88
|
+
if (e === this.values.length) return;
|
|
89
|
+
let t = new Float64Array(e);
|
|
90
|
+
t.set(this.values.subarray(0, Math.min(e, this.values.length))), this.values = t, this.tree = new Float64Array(e + 1), this.rebuild();
|
|
91
|
+
}
|
|
92
|
+
shift(e) {
|
|
93
|
+
if (e === 0) return;
|
|
94
|
+
let t = this.values.length, n = new Float64Array(t);
|
|
95
|
+
e > 0 ? n.set(this.values.subarray(0, Math.min(t - e, this.values.length)), e) : n.set(this.values.subarray(-e)), this.values = n, this.rebuild();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const BROWSER_MAX_SIZE = 1e7;
|
|
99
|
+
function isWindow(e) {
|
|
100
|
+
return e === null || e === document.documentElement || typeof window < "u" && e === window;
|
|
126
101
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return a === null || a === document.documentElement || typeof window < "u" && a === window;
|
|
102
|
+
function isBody(e) {
|
|
103
|
+
return typeof e == "object" && !!e && "tagName" in e && e.tagName === "BODY";
|
|
130
104
|
}
|
|
131
|
-
function
|
|
132
|
-
|
|
105
|
+
function isWindowLike(e) {
|
|
106
|
+
return isWindow(e) || isBody(e);
|
|
133
107
|
}
|
|
134
|
-
function
|
|
135
|
-
|
|
108
|
+
function isElement(e) {
|
|
109
|
+
return e != null && "getBoundingClientRect" in e;
|
|
136
110
|
}
|
|
137
|
-
function
|
|
138
|
-
|
|
111
|
+
function isScrollableElement(e) {
|
|
112
|
+
return e != null && "scrollLeft" in e;
|
|
139
113
|
}
|
|
140
|
-
function
|
|
141
|
-
|
|
114
|
+
function scrollTo(e, t) {
|
|
115
|
+
isWindow(e) ? window.scrollTo(t) : e != null && isScrollableElement(e) && (typeof e.scrollTo == "function" ? e.scrollTo(t) : (t.left !== void 0 && (e.scrollLeft = t.left), t.top !== void 0 && (e.scrollTop = t.top)));
|
|
142
116
|
}
|
|
143
|
-
function
|
|
144
|
-
|
|
117
|
+
function isScrollToIndexOptions(e) {
|
|
118
|
+
return typeof e == "object" && !!e && ("align" in e || "behavior" in e || "isCorrection" in e);
|
|
145
119
|
}
|
|
146
|
-
function
|
|
147
|
-
|
|
120
|
+
function getPaddingX(e, t) {
|
|
121
|
+
return typeof e == "object" && e ? e.x || 0 : (t === "horizontal" || t === "both") && e || 0;
|
|
148
122
|
}
|
|
149
|
-
function
|
|
150
|
-
|
|
123
|
+
function getPaddingY(e, t) {
|
|
124
|
+
return typeof e == "object" && e ? e.y || 0 : (t === "vertical" || t === "both") && e || 0;
|
|
151
125
|
}
|
|
152
|
-
function
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}) {
|
|
163
|
-
let z = 0, h = i;
|
|
164
|
-
const E = a + e;
|
|
165
|
-
if (S !== null) {
|
|
166
|
-
const b = S + d;
|
|
167
|
-
z = Math.floor(a / b), h = Math.ceil(E / b);
|
|
168
|
-
} else
|
|
169
|
-
z = w(a), h = w(E), h < i && m(h) < E && h++;
|
|
170
|
-
return {
|
|
171
|
-
start: Math.max(0, z - t),
|
|
172
|
-
end: Math.min(i, h + s)
|
|
173
|
-
};
|
|
126
|
+
function calculateGenericRange({ scrollPos: e, containerSize: t, count: n, bufferBefore: r, bufferAfter: i, gap: a, fixedSize: o, findLowerBound: s, query: c }) {
|
|
127
|
+
let l = 0, u = n, d = e + t;
|
|
128
|
+
if (o !== null) {
|
|
129
|
+
let t = o + a;
|
|
130
|
+
l = Math.floor(e / t), u = Math.ceil(d / t);
|
|
131
|
+
} else l = s(e), u = s(d), u < n && c(u) < d && u++;
|
|
132
|
+
return {
|
|
133
|
+
start: Math.max(0, l - r),
|
|
134
|
+
end: Math.min(n, u + i)
|
|
135
|
+
};
|
|
174
136
|
}
|
|
175
|
-
function
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
137
|
+
function findNextStickyIndex(e, t) {
|
|
138
|
+
let n = 0, r = e.length - 1, i;
|
|
139
|
+
for (; n <= r;) {
|
|
140
|
+
let a = n + r >>> 1;
|
|
141
|
+
e[a] > t ? (i = e[a], r = a - 1) : n = a + 1;
|
|
142
|
+
}
|
|
143
|
+
return i;
|
|
182
144
|
}
|
|
183
|
-
function
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
145
|
+
function findPrevStickyIndex(e, t) {
|
|
146
|
+
let n = 0, r = e.length - 1, i;
|
|
147
|
+
for (; n <= r;) {
|
|
148
|
+
let a = n + r >>> 1;
|
|
149
|
+
e[a] < t ? (i = e[a], n = a + 1) : r = a - 1;
|
|
150
|
+
}
|
|
151
|
+
return i;
|
|
190
152
|
}
|
|
191
|
-
function
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
effectiveAlign: "end"
|
|
219
|
-
} : Math.abs(w - t) < Math.abs(m - t) ? {
|
|
220
|
-
target: w,
|
|
221
|
-
effectiveAlign: "start"
|
|
222
|
-
} : {
|
|
223
|
-
target: m,
|
|
224
|
-
effectiveAlign: "end"
|
|
225
|
-
};
|
|
153
|
+
function calculateAxisAlignment({ align: e, targetPos: t, itemSize: n, scrollPos: r, viewSize: i, stickyOffsetStart: a, stickyOffsetEnd: o }) {
|
|
154
|
+
let s = t - a, c = t - (i - o - n);
|
|
155
|
+
return e === "start" ? {
|
|
156
|
+
target: s,
|
|
157
|
+
effectiveAlign: "start"
|
|
158
|
+
} : e === "center" ? {
|
|
159
|
+
target: t - a - (i - a - o - n) / 2,
|
|
160
|
+
effectiveAlign: "center"
|
|
161
|
+
} : e === "end" ? {
|
|
162
|
+
target: c,
|
|
163
|
+
effectiveAlign: "end"
|
|
164
|
+
} : isItemVisible(t, n, r, i, a, o) ? {
|
|
165
|
+
target: r,
|
|
166
|
+
effectiveAlign: "auto"
|
|
167
|
+
} : n <= i - a - o ? t < r + a ? {
|
|
168
|
+
target: s,
|
|
169
|
+
effectiveAlign: "start"
|
|
170
|
+
} : {
|
|
171
|
+
target: c,
|
|
172
|
+
effectiveAlign: "end"
|
|
173
|
+
} : Math.abs(s - r) < Math.abs(c - r) ? {
|
|
174
|
+
target: s,
|
|
175
|
+
effectiveAlign: "start"
|
|
176
|
+
} : {
|
|
177
|
+
target: c,
|
|
178
|
+
effectiveAlign: "end"
|
|
179
|
+
};
|
|
226
180
|
}
|
|
227
|
-
function
|
|
228
|
-
|
|
181
|
+
function calculateAxisSize(e, t, n, r) {
|
|
182
|
+
return e <= 0 ? 0 : t === null ? Math.max(0, r(e) - n) : Math.max(0, e * (t + n) - n);
|
|
229
183
|
}
|
|
230
|
-
function
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
targetPos: b,
|
|
251
|
-
itemSize: V,
|
|
252
|
-
scrollPos: t,
|
|
253
|
-
viewSize: i,
|
|
254
|
-
stickyOffsetStart: E,
|
|
255
|
-
stickyOffsetEnd: h
|
|
256
|
-
});
|
|
257
|
-
return { target: X, itemSize: V, effectiveAlign: R };
|
|
184
|
+
function calculateAxisTarget({ index: e, align: t, viewSize: n, scrollPos: r, fixedSize: i, gap: a, query: o, getSize: s, stickyIndices: c, stickyStart: l, stickyEnd: u = 0 }) {
|
|
185
|
+
let d = l;
|
|
186
|
+
if (c && c.length > 0) {
|
|
187
|
+
let t = findPrevStickyIndex(c, e);
|
|
188
|
+
t !== void 0 && (d += calculateAxisSize(1, i, 0, () => s(t)));
|
|
189
|
+
}
|
|
190
|
+
let f = i === null ? o(e) : e * (i + a), p = i === null ? s(e) - a : i, { target: m, effectiveAlign: h } = calculateAxisAlignment({
|
|
191
|
+
align: t,
|
|
192
|
+
targetPos: f,
|
|
193
|
+
itemSize: p,
|
|
194
|
+
scrollPos: r,
|
|
195
|
+
viewSize: n,
|
|
196
|
+
stickyOffsetStart: d,
|
|
197
|
+
stickyOffsetEnd: u
|
|
198
|
+
});
|
|
199
|
+
return {
|
|
200
|
+
target: m,
|
|
201
|
+
itemSize: p,
|
|
202
|
+
effectiveAlign: h
|
|
203
|
+
};
|
|
258
204
|
}
|
|
259
|
-
function
|
|
260
|
-
|
|
261
|
-
|
|
205
|
+
function calculateAxisSticky(e, t, n, r, i, a) {
|
|
206
|
+
if (e <= t) return {
|
|
207
|
+
isActive: !1,
|
|
208
|
+
offset: 0
|
|
209
|
+
};
|
|
210
|
+
let o = findNextStickyIndex(i, r);
|
|
211
|
+
if (o === void 0) return {
|
|
212
|
+
isActive: !0,
|
|
213
|
+
offset: 0
|
|
214
|
+
};
|
|
215
|
+
let s = a(o);
|
|
216
|
+
return e >= s ? {
|
|
217
|
+
isActive: !1,
|
|
218
|
+
offset: 0
|
|
219
|
+
} : {
|
|
220
|
+
isActive: !0,
|
|
221
|
+
offset: Math.max(0, Math.min(n, s - e)) - n
|
|
222
|
+
};
|
|
262
223
|
}
|
|
263
|
-
function
|
|
264
|
-
|
|
224
|
+
function isItemVisible(e, t, n, r, i = 0, a = 0) {
|
|
225
|
+
let o = n + i, s = n + r - a;
|
|
226
|
+
return t <= r - i - a ? e >= o - .5 && e + t <= s + .5 : e <= o + .5 && e + t >= s - .5;
|
|
265
227
|
}
|
|
266
|
-
function
|
|
267
|
-
|
|
228
|
+
function displayToVirtual(e, t, n) {
|
|
229
|
+
return (e - t) * n;
|
|
268
230
|
}
|
|
269
|
-
function
|
|
270
|
-
|
|
271
|
-
colIndex: e,
|
|
272
|
-
options: i,
|
|
273
|
-
direction: t,
|
|
274
|
-
viewportWidth: s,
|
|
275
|
-
viewportHeight: d,
|
|
276
|
-
totalWidth: S,
|
|
277
|
-
totalHeight: w,
|
|
278
|
-
gap: m,
|
|
279
|
-
columnGap: z,
|
|
280
|
-
fixedSize: h,
|
|
281
|
-
fixedWidth: E,
|
|
282
|
-
relativeScrollX: b,
|
|
283
|
-
relativeScrollY: V,
|
|
284
|
-
getItemSizeY: X,
|
|
285
|
-
getItemSizeX: R,
|
|
286
|
-
getItemQueryY: T,
|
|
287
|
-
getItemQueryX: $,
|
|
288
|
-
getColumnSize: L,
|
|
289
|
-
getColumnQuery: k,
|
|
290
|
-
scaleX: C,
|
|
291
|
-
scaleY: W,
|
|
292
|
-
hostOffsetX: P,
|
|
293
|
-
hostOffsetY: x,
|
|
294
|
-
stickyIndices: q,
|
|
295
|
-
stickyStartX: H = 0,
|
|
296
|
-
stickyStartY: K = 0,
|
|
297
|
-
stickyEndX: Q = 0,
|
|
298
|
-
stickyEndY: Z = 0,
|
|
299
|
-
flowPaddingStartX: Y = 0,
|
|
300
|
-
flowPaddingStartY: re = 0,
|
|
301
|
-
paddingStartX: de = 0,
|
|
302
|
-
paddingStartY: G = 0,
|
|
303
|
-
paddingEndX: le = 0,
|
|
304
|
-
paddingEndY: Be = 0
|
|
305
|
-
}) {
|
|
306
|
-
let ue;
|
|
307
|
-
yt(i) ? ue = i.align : ue = i;
|
|
308
|
-
const wt = (ue && typeof ue == "object" ? ue.x : ue) || "auto", te = (ue && typeof ue == "object" ? ue.y : ue) || "auto";
|
|
309
|
-
let Pe = b, ce = V, Le = 0, ae = 0, Te = "auto", ie = "auto";
|
|
310
|
-
const ke = C === 1 ? S : bt, fe = W === 1 ? w : bt, _e = Math.max(0, P + ke - s), pe = Math.max(0, x + fe - d), be = (_e - P) * C, ye = (pe - x) * W, Ge = Y + H + de, nt = re + K + G;
|
|
311
|
-
if (a != null) {
|
|
312
|
-
const ne = ul({
|
|
313
|
-
index: a,
|
|
314
|
-
align: te,
|
|
315
|
-
viewSize: d,
|
|
316
|
-
scrollPos: V,
|
|
317
|
-
fixedSize: h,
|
|
318
|
-
gap: m,
|
|
319
|
-
query: T,
|
|
320
|
-
getSize: X,
|
|
321
|
-
stickyIndices: q,
|
|
322
|
-
stickyStart: K + G,
|
|
323
|
-
stickyEnd: Z + Be
|
|
324
|
-
});
|
|
325
|
-
ce = ne.target + nt, ae = ne.itemSize, ie = ne.effectiveAlign;
|
|
326
|
-
}
|
|
327
|
-
if (e != null) {
|
|
328
|
-
const ne = t === "both", Ie = ul({
|
|
329
|
-
index: e,
|
|
330
|
-
align: wt,
|
|
331
|
-
viewSize: s,
|
|
332
|
-
scrollPos: b,
|
|
333
|
-
fixedSize: ne ? E : h,
|
|
334
|
-
gap: ne || t === "horizontal" ? z : m,
|
|
335
|
-
query: ne ? k : $,
|
|
336
|
-
getSize: ne ? L : R,
|
|
337
|
-
stickyIndices: q,
|
|
338
|
-
stickyStart: H + de,
|
|
339
|
-
stickyEnd: Q + le
|
|
340
|
-
});
|
|
341
|
-
Pe = Ie.target + Ge, Le = Ie.itemSize, Te = Ie.effectiveAlign;
|
|
342
|
-
}
|
|
343
|
-
return Pe = Math.max(0, Math.min(Pe, be)), ce = Math.max(0, Math.min(ce, ye)), { targetX: Pe, targetY: ce, itemWidth: Le, itemHeight: ae, effectiveAlignX: Te, effectiveAlignY: ie };
|
|
231
|
+
function virtualToDisplay(e, t, n) {
|
|
232
|
+
return e / n + t;
|
|
344
233
|
}
|
|
345
|
-
function
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
234
|
+
function calculateScrollTarget({ rowIndex: e, colIndex: t, options: n, direction: r, viewportWidth: i, viewportHeight: a, totalWidth: o, totalHeight: s, gap: c, columnGap: l, fixedSize: u, fixedWidth: d, relativeScrollX: f, relativeScrollY: p, getItemSizeY: m, getItemSizeX: h, getItemQueryY: g, getItemQueryX: _, getColumnSize: v, getColumnQuery: y, scaleX: b, scaleY: x, hostOffsetX: S, hostOffsetY: C, stickyIndices: w, stickyStartX: T = 0, stickyStartY: E = 0, stickyEndX: D = 0, stickyEndY: ee = 0, flowPaddingStartX: O = 0, flowPaddingStartY: k = 0, paddingStartX: A = 0, paddingStartY: j = 0, paddingEndX: M = 0, paddingEndY: N = 0 }) {
|
|
235
|
+
let P;
|
|
236
|
+
P = isScrollToIndexOptions(n) ? n.align : n;
|
|
237
|
+
let F = (P && typeof P == "object" ? P.x : P) || "auto", ne = (P && typeof P == "object" ? P.y : P) || "auto", re = f, ie = p, ae = 0, oe = 0, se = "auto", ce = "auto", L = b === 1 ? o : BROWSER_MAX_SIZE, le = x === 1 ? s : BROWSER_MAX_SIZE, R = Math.max(0, S + L - i), z = Math.max(0, C + le - a), B = (R - S) * b, V = (z - C) * x, de = O + T + A, fe = k + E + j;
|
|
238
|
+
if (e != null) {
|
|
239
|
+
let t = calculateAxisTarget({
|
|
240
|
+
index: e,
|
|
241
|
+
align: ne,
|
|
242
|
+
viewSize: a,
|
|
243
|
+
scrollPos: p,
|
|
244
|
+
fixedSize: u,
|
|
245
|
+
gap: c,
|
|
246
|
+
query: g,
|
|
247
|
+
getSize: m,
|
|
248
|
+
stickyIndices: w,
|
|
249
|
+
stickyStart: E + j,
|
|
250
|
+
stickyEnd: ee + N
|
|
251
|
+
});
|
|
252
|
+
ie = t.target + fe, oe = t.itemSize, ce = t.effectiveAlign;
|
|
253
|
+
}
|
|
254
|
+
if (t != null) {
|
|
255
|
+
let e = r === "both", n = calculateAxisTarget({
|
|
256
|
+
index: t,
|
|
257
|
+
align: F,
|
|
258
|
+
viewSize: i,
|
|
259
|
+
scrollPos: f,
|
|
260
|
+
fixedSize: e ? d : u,
|
|
261
|
+
gap: e || r === "horizontal" ? l : c,
|
|
262
|
+
query: e ? y : _,
|
|
263
|
+
getSize: e ? v : h,
|
|
264
|
+
stickyIndices: w,
|
|
265
|
+
stickyStart: T + A,
|
|
266
|
+
stickyEnd: D + M
|
|
267
|
+
});
|
|
268
|
+
re = n.target + de, ae = n.itemSize, se = n.effectiveAlign;
|
|
269
|
+
}
|
|
270
|
+
return re = Math.max(0, Math.min(re, B)), ie = Math.max(0, Math.min(ie, V)), {
|
|
271
|
+
targetX: re,
|
|
272
|
+
targetY: ie,
|
|
273
|
+
itemWidth: ae,
|
|
274
|
+
itemHeight: oe,
|
|
275
|
+
effectiveAlignX: se,
|
|
276
|
+
effectiveAlignY: ce
|
|
277
|
+
};
|
|
374
278
|
}
|
|
375
|
-
function
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
const { start: z, end: h } = ml({
|
|
389
|
-
scrollPos: e,
|
|
390
|
-
containerSize: i,
|
|
391
|
-
count: a,
|
|
392
|
-
bufferBefore: t,
|
|
393
|
-
bufferAfter: t,
|
|
394
|
-
gap: d,
|
|
395
|
-
fixedSize: s,
|
|
396
|
-
findLowerBound: S,
|
|
397
|
-
query: w
|
|
398
|
-
}), E = z, b = h, V = s !== null ? E * (s + d) : w(E), X = s !== null ? a * (s + d) - d : Math.max(0, m() - d), R = s !== null ? b * (s + d) - (b > 0 ? d : 0) : w(b) - (b > 0 ? d : 0);
|
|
399
|
-
return {
|
|
400
|
-
start: E,
|
|
401
|
-
end: b,
|
|
402
|
-
padStart: V,
|
|
403
|
-
padEnd: Math.max(0, X - R)
|
|
404
|
-
};
|
|
279
|
+
function calculateRange({ direction: e, relativeScrollX: t, relativeScrollY: n, usableWidth: r, usableHeight: i, itemsLength: a, bufferBefore: o, bufferAfter: s, gap: c, columnGap: l, fixedSize: u, findLowerBoundY: d, findLowerBoundX: f, queryY: p, queryX: m }) {
|
|
280
|
+
let h = e === "vertical" || e === "both";
|
|
281
|
+
return calculateGenericRange({
|
|
282
|
+
scrollPos: h ? n : t,
|
|
283
|
+
containerSize: h ? i : r,
|
|
284
|
+
count: a,
|
|
285
|
+
bufferBefore: o,
|
|
286
|
+
bufferAfter: s,
|
|
287
|
+
gap: h ? c : l,
|
|
288
|
+
fixedSize: u,
|
|
289
|
+
findLowerBound: h ? d : f,
|
|
290
|
+
query: h ? p : m
|
|
291
|
+
});
|
|
405
292
|
}
|
|
406
|
-
function
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
})
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
if (L !== void 0) {
|
|
431
|
-
const k = h !== null ? L * (h + b) : X(L);
|
|
432
|
-
s >= k ? T = !1 : (T = !0, $.y = Math.max(0, Math.min(m, k - s)) - m);
|
|
433
|
-
} else
|
|
434
|
-
T = !0;
|
|
435
|
-
}
|
|
436
|
-
if ((i === "horizontal" || i === "both" && !T) && t > d) {
|
|
437
|
-
const L = rl(z, a);
|
|
438
|
-
if (L !== void 0) {
|
|
439
|
-
const k = i === "horizontal" ? h !== null ? L * (h + V) : R(L) : E !== null ? L * (E + V) : R(L);
|
|
440
|
-
t >= k ? T = !1 : (T = !0, $.x = Math.max(0, Math.min(w, k - t)) - w);
|
|
441
|
-
} else
|
|
442
|
-
T = !0;
|
|
443
|
-
}
|
|
444
|
-
return { isStickyActive: T, stickyOffset: $ };
|
|
293
|
+
function calculateColumnRange({ columnCount: e, relativeScrollX: t, usableWidth: n, colBuffer: r, fixedWidth: i, columnGap: a, findLowerBound: o, query: s, totalColsQuery: c }) {
|
|
294
|
+
if (!e) return {
|
|
295
|
+
start: 0,
|
|
296
|
+
end: 0,
|
|
297
|
+
padStart: 0,
|
|
298
|
+
padEnd: 0
|
|
299
|
+
};
|
|
300
|
+
let { start: l, end: u } = calculateGenericRange({
|
|
301
|
+
scrollPos: t,
|
|
302
|
+
containerSize: n,
|
|
303
|
+
count: e,
|
|
304
|
+
bufferBefore: r,
|
|
305
|
+
bufferAfter: r,
|
|
306
|
+
gap: a,
|
|
307
|
+
fixedSize: i,
|
|
308
|
+
findLowerBound: o,
|
|
309
|
+
query: s
|
|
310
|
+
}), d = l, f = u, p = i === null ? s(d) : d * (i + a), m = i === null ? Math.max(0, c() - a) : e * (i + a) - a, h = i === null ? s(f) - (f > 0 ? a : 0) : f * (i + a) - (f > 0 ? a : 0);
|
|
311
|
+
return {
|
|
312
|
+
start: d,
|
|
313
|
+
end: f,
|
|
314
|
+
padStart: p,
|
|
315
|
+
padEnd: Math.max(0, m - h)
|
|
316
|
+
};
|
|
445
317
|
}
|
|
446
|
-
function
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
|
|
318
|
+
function calculateStickyItem({ index: e, isSticky: t, direction: n, relativeScrollX: r, relativeScrollY: i, originalX: a, originalY: o, width: s, height: c, stickyIndices: l, fixedSize: u, gap: d, columnGap: f, getItemQueryY: p, getItemQueryX: m }) {
|
|
319
|
+
let h = !1, g = !1, _ = {
|
|
320
|
+
x: 0,
|
|
321
|
+
y: 0
|
|
322
|
+
};
|
|
323
|
+
if (!t) return {
|
|
324
|
+
isStickyActiveX: h,
|
|
325
|
+
isStickyActiveY: g,
|
|
326
|
+
isStickyActive: !1,
|
|
327
|
+
stickyOffset: _
|
|
328
|
+
};
|
|
329
|
+
if (n === "vertical" || n === "both") {
|
|
330
|
+
let t = calculateAxisSticky(i, o, c, e, l, (e) => u === null ? p(e) : e * (u + d));
|
|
331
|
+
g = t.isActive, _.y = t.offset;
|
|
332
|
+
}
|
|
333
|
+
if (n === "horizontal") {
|
|
334
|
+
let t = calculateAxisSticky(r, a, s, e, l, (e) => u === null ? m(e) : e * (u + f));
|
|
335
|
+
t.isActive && (h = !0, _.x = t.offset);
|
|
336
|
+
}
|
|
337
|
+
return {
|
|
338
|
+
isStickyActiveX: h,
|
|
339
|
+
isStickyActiveY: g,
|
|
340
|
+
isStickyActive: h || g,
|
|
341
|
+
stickyOffset: _
|
|
342
|
+
};
|
|
463
343
|
}
|
|
464
|
-
function
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
isRtl: w
|
|
473
|
-
}) {
|
|
474
|
-
const m = e === "vertical", z = e === "horizontal", h = e === "both", E = i == null || i === 0, b = {
|
|
475
|
-
blockSize: z ? "100%" : E ? "auto" : `${a.size.height}px`
|
|
476
|
-
};
|
|
477
|
-
if (m && t === "table" ? b.minInlineSize = "100%" : b.inlineSize = m ? "100%" : E ? "auto" : `${a.size.width}px`, E && (m || (b.minInlineSize = "1px"), z || (b.minBlockSize = "1px")), S) {
|
|
478
|
-
const V = w ? -(a.isStickyActive ? a.stickyOffset.x : a.offset.x) : a.isStickyActive ? a.stickyOffset.x : a.offset.x;
|
|
479
|
-
a.isStickyActive ? ((m || h) && (b.insetBlockStart = `${d}px`), (z || h) && (b.insetInlineStart = `${s}px`), b.transform = `translate(${V}px, ${a.stickyOffset.y}px)`) : b.transform = `translate(${V}px, ${a.offset.y}px)`;
|
|
480
|
-
}
|
|
481
|
-
return b;
|
|
344
|
+
function calculateItemPosition({ index: e, direction: t, fixedSize: n, gap: r, columnGap: i, usableWidth: a, usableHeight: o, totalWidth: s, queryY: c, queryX: l, getSizeY: u, getSizeX: d, columnRange: f }) {
|
|
345
|
+
let p = 0, m = 0, h = 0, g = 0;
|
|
346
|
+
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), {
|
|
347
|
+
height: g,
|
|
348
|
+
width: h,
|
|
349
|
+
x: p,
|
|
350
|
+
y: m
|
|
351
|
+
};
|
|
482
352
|
}
|
|
483
|
-
function
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
columnGap: S,
|
|
491
|
-
usableWidth: w,
|
|
492
|
-
usableHeight: m,
|
|
493
|
-
queryY: z,
|
|
494
|
-
queryX: h,
|
|
495
|
-
queryColumn: E
|
|
496
|
-
}) {
|
|
497
|
-
const b = a === "both", V = a === "horizontal";
|
|
498
|
-
let X = 0, R = 0;
|
|
499
|
-
return b ? (X = Rt(i, s, S, E), R = Rt(e, t, d, z)) : V ? (X = Rt(e, t, S, h), R = m) : (X = w, R = Rt(e, t, d, z)), {
|
|
500
|
-
width: b ? Math.max(X, w) : X,
|
|
501
|
-
height: b ? Math.max(R, m) : R
|
|
502
|
-
};
|
|
353
|
+
function calculateItemStyle({ item: e, direction: t, itemSize: n, containerTag: r, paddingStartX: i, paddingStartY: a, isHydrated: o, isRtl: s }) {
|
|
354
|
+
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` };
|
|
355
|
+
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) {
|
|
356
|
+
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;
|
|
357
|
+
e.isStickyActive || e.isStickyActiveX || e.isStickyActiveY ? (f.insetBlockStart = t ? `${a}px` : "auto", f.insetInlineStart = n ? `${i}px` : "auto", f.transform = `translate(${r}px, ${o}px)`) : f.transform = `translate(${r}px, ${e.offset.y}px)`;
|
|
358
|
+
}
|
|
359
|
+
return f;
|
|
503
360
|
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
const L = () => {
|
|
511
|
-
if (typeof window > "u")
|
|
512
|
-
return;
|
|
513
|
-
const l = e.value.container || e.value.hostRef || window, r = Zt(l) ? l : document.documentElement;
|
|
514
|
-
(!$ || !("direction" in $)) && ($ = window.getComputedStyle(r));
|
|
515
|
-
const o = $.direction === "rtl";
|
|
516
|
-
m.value !== o && (m.value = o);
|
|
517
|
-
}, k = new Kt(e.value.items?.length || 0), C = new Kt(e.value.items?.length || 0), W = new Kt(e.value.columnCount || 0), P = ee(0);
|
|
518
|
-
let x = new Uint8Array(0), q = new Uint8Array(0), H = new Uint8Array(0);
|
|
519
|
-
const K = ee(null), Q = ee(!1);
|
|
520
|
-
let Z = [];
|
|
521
|
-
const Y = u(() => ["vertical", "horizontal", "both"].includes(e.value.direction) ? e.value.direction : "vertical"), re = u(
|
|
522
|
-
() => e.value.itemSize === void 0 || e.value.itemSize === null || e.value.itemSize === 0
|
|
523
|
-
), de = u(
|
|
524
|
-
() => e.value.columnWidth === void 0 || e.value.columnWidth === null || e.value.columnWidth === 0
|
|
525
|
-
), G = u(
|
|
526
|
-
() => typeof e.value.itemSize == "number" && e.value.itemSize > 0 ? e.value.itemSize : null
|
|
527
|
-
), le = u(
|
|
528
|
-
() => typeof e.value.columnWidth == "number" && e.value.columnWidth > 0 ? e.value.columnWidth : null
|
|
529
|
-
), Be = u(() => e.value.defaultItemSize || G.value || Dt), ue = u(
|
|
530
|
-
() => [...e.value.stickyIndices || []].sort((l, r) => l - r)
|
|
531
|
-
), wt = u(() => new Set(ue.value)), te = u(() => lt(e.value.scrollPaddingStart, e.value.direction)), Pe = u(() => lt(e.value.scrollPaddingEnd, e.value.direction)), ce = u(() => at(e.value.scrollPaddingStart, e.value.direction)), Le = u(() => at(e.value.scrollPaddingEnd, e.value.direction)), ae = u(() => lt(e.value.stickyStart, e.value.direction)), Te = u(() => lt(e.value.stickyEnd, e.value.direction)), ie = u(() => at(e.value.stickyStart, e.value.direction)), ke = u(() => at(e.value.stickyEnd, e.value.direction)), fe = u(() => lt(e.value.flowPaddingStart, e.value.direction)), _e = u(() => lt(e.value.flowPaddingEnd, e.value.direction)), pe = u(() => at(e.value.flowPaddingStart, e.value.direction)), be = u(() => at(e.value.flowPaddingEnd, e.value.direction)), ye = u(() => z.value - (Y.value !== "vertical" ? ae.value + Te.value : 0)), Ge = u(() => h.value - (Y.value !== "horizontal" ? ie.value + ke.value : 0)), nt = u(() => {
|
|
532
|
-
if (P.value, !d.value && e.value.ssrRange && !w.value) {
|
|
533
|
-
const { start: l = 0, end: r = 0, colStart: o = 0, colEnd: f = 0 } = e.value.ssrRange, p = e.value.columnCount || 0, y = e.value.gap || 0, B = e.value.columnGap || 0;
|
|
534
|
-
let F = 0, g = 0;
|
|
535
|
-
if (Y.value === "both") {
|
|
536
|
-
if (p > 0) {
|
|
537
|
-
const I = f || p, U = W.query(I) - W.query(o);
|
|
538
|
-
F = Math.max(0, U - (I > o ? B : 0));
|
|
539
|
-
}
|
|
540
|
-
if (G.value !== null) {
|
|
541
|
-
const I = r - l;
|
|
542
|
-
g = Math.max(0, I * (G.value + y) - (I > 0 ? y : 0));
|
|
543
|
-
} else {
|
|
544
|
-
const I = C.query(r) - C.query(l);
|
|
545
|
-
g = Math.max(0, I - (r > l ? y : 0));
|
|
546
|
-
}
|
|
547
|
-
} else if (Y.value === "horizontal") {
|
|
548
|
-
if (G.value !== null) {
|
|
549
|
-
const I = r - l;
|
|
550
|
-
F = Math.max(0, I * (G.value + B) - (I > 0 ? B : 0));
|
|
551
|
-
} else {
|
|
552
|
-
const I = k.query(r) - k.query(l);
|
|
553
|
-
F = Math.max(0, I - (r > l ? B : 0));
|
|
554
|
-
}
|
|
555
|
-
g = Ge.value;
|
|
556
|
-
} else if (F = ye.value, G.value !== null) {
|
|
557
|
-
const I = r - l;
|
|
558
|
-
g = Math.max(0, I * (G.value + y) - (I > 0 ? y : 0));
|
|
559
|
-
} else {
|
|
560
|
-
const I = C.query(r) - C.query(l);
|
|
561
|
-
g = Math.max(0, I - (r > l ? y : 0));
|
|
562
|
-
}
|
|
563
|
-
return {
|
|
564
|
-
width: Math.max(F, ye.value),
|
|
565
|
-
height: Math.max(g, Ge.value)
|
|
566
|
-
};
|
|
567
|
-
}
|
|
568
|
-
return Tl({
|
|
569
|
-
direction: Y.value,
|
|
570
|
-
itemsLength: e.value.items.length,
|
|
571
|
-
columnCount: e.value.columnCount || 0,
|
|
572
|
-
fixedSize: G.value,
|
|
573
|
-
fixedWidth: le.value,
|
|
574
|
-
gap: e.value.gap || 0,
|
|
575
|
-
columnGap: e.value.columnGap || 0,
|
|
576
|
-
usableWidth: ye.value,
|
|
577
|
-
usableHeight: Ge.value,
|
|
578
|
-
queryY: (l) => C.query(l),
|
|
579
|
-
queryX: (l) => k.query(l),
|
|
580
|
-
queryColumn: (l) => W.query(l)
|
|
581
|
-
});
|
|
582
|
-
}), ne = u(() => Pl(e.value.container)), Oe = u(() => nt.value.width + te.value + Pe.value), Ie = u(() => nt.value.height + ce.value + Le.value), Ve = u(() => fe.value + ae.value + Te.value + _e.value + Oe.value), we = u(() => pe.value + ie.value + ke.value + be.value + Ie.value), Se = jt({
|
|
583
|
-
x: u(() => Math.max(0, E.x - (fe.value + ae.value))),
|
|
584
|
-
y: u(() => Math.max(0, E.y - (pe.value + ie.value)))
|
|
585
|
-
}), ot = u(() => ne.value ? Ve.value : Math.min(Ve.value, bt)), Qe = u(() => ne.value ? we.value : Math.min(we.value, bt)), xt = u(() => ne.value ? Oe.value : Math.max(0, ot.value - (fe.value + ae.value + Te.value + _e.value))), oe = u(() => ne.value ? Ie.value : Math.max(0, Qe.value - (pe.value + ie.value + ke.value + be.value))), he = u(() => {
|
|
586
|
-
if (ne.value || Ve.value <= bt)
|
|
587
|
-
return 1;
|
|
588
|
-
const l = Ve.value - z.value, r = ot.value - z.value;
|
|
589
|
-
return r > 0 ? l / r : 1;
|
|
590
|
-
}), Ae = u(() => {
|
|
591
|
-
if (ne.value || we.value <= bt)
|
|
592
|
-
return 1;
|
|
593
|
-
const l = we.value - h.value, r = Qe.value - h.value;
|
|
594
|
-
return r > 0 ? l / r : 1;
|
|
595
|
-
}), Re = u(() => {
|
|
596
|
-
if (Y.value === "vertical")
|
|
597
|
-
return 0;
|
|
598
|
-
const l = fe.value + ae.value + te.value;
|
|
599
|
-
return R.value - l;
|
|
600
|
-
}), $e = u(() => {
|
|
601
|
-
if (Y.value === "horizontal")
|
|
602
|
-
return 0;
|
|
603
|
-
const l = pe.value + ie.value + ce.value;
|
|
604
|
-
return T.value - l;
|
|
605
|
-
}), $t = (l) => {
|
|
606
|
-
P.value;
|
|
607
|
-
const r = e.value.columnGap || 0, o = e.value.columnWidth;
|
|
608
|
-
if (typeof o == "number" && o > 0)
|
|
609
|
-
return o;
|
|
610
|
-
if (Array.isArray(o) && o.length > 0) {
|
|
611
|
-
const p = o[l % o.length];
|
|
612
|
-
return p != null && p > 0 ? p : e.value.defaultColumnWidth || Lt;
|
|
613
|
-
}
|
|
614
|
-
if (typeof o == "function")
|
|
615
|
-
return o(l);
|
|
616
|
-
const f = W.get(l);
|
|
617
|
-
return f > 0 ? f - r : e.value.defaultColumnWidth || Lt;
|
|
618
|
-
}, Xt = (l) => {
|
|
619
|
-
if (P.value, Y.value === "horizontal")
|
|
620
|
-
return Ge.value;
|
|
621
|
-
const r = e.value.gap || 0, o = e.value.itemSize;
|
|
622
|
-
if (typeof o == "number" && o > 0)
|
|
623
|
-
return o;
|
|
624
|
-
if (typeof o == "function") {
|
|
625
|
-
const p = e.value.items[l];
|
|
626
|
-
return p !== void 0 ? o(p, l) : e.value.defaultItemSize || Dt;
|
|
627
|
-
}
|
|
628
|
-
const f = C.get(l);
|
|
629
|
-
return f > 0 ? f - r : e.value.defaultItemSize || Dt;
|
|
630
|
-
};
|
|
631
|
-
function vt(l, r, o) {
|
|
632
|
-
const f = typeof o == "object" && o !== null && "isCorrection" in o ? o.isCorrection : !1, p = e.value.container || window, { targetX: y, targetY: B, effectiveAlignX: F, effectiveAlignY: g } = sl({
|
|
633
|
-
rowIndex: l,
|
|
634
|
-
colIndex: r,
|
|
635
|
-
options: o,
|
|
636
|
-
direction: Y.value,
|
|
637
|
-
viewportWidth: z.value,
|
|
638
|
-
viewportHeight: h.value,
|
|
639
|
-
totalWidth: Ve.value,
|
|
640
|
-
totalHeight: we.value,
|
|
641
|
-
gap: e.value.gap || 0,
|
|
642
|
-
columnGap: e.value.columnGap || 0,
|
|
643
|
-
fixedSize: G.value,
|
|
644
|
-
fixedWidth: le.value,
|
|
645
|
-
relativeScrollX: Re.value,
|
|
646
|
-
relativeScrollY: $e.value,
|
|
647
|
-
getItemSizeY: (M) => C.get(M),
|
|
648
|
-
getItemSizeX: (M) => k.get(M),
|
|
649
|
-
getItemQueryY: (M) => C.query(M),
|
|
650
|
-
getItemQueryX: (M) => k.query(M),
|
|
651
|
-
getColumnSize: (M) => W.get(M),
|
|
652
|
-
getColumnQuery: (M) => W.query(M),
|
|
653
|
-
scaleX: he.value,
|
|
654
|
-
scaleY: Ae.value,
|
|
655
|
-
hostOffsetX: Se.x,
|
|
656
|
-
hostOffsetY: Se.y,
|
|
657
|
-
stickyIndices: ue.value,
|
|
658
|
-
stickyStartX: ae.value,
|
|
659
|
-
stickyStartY: ie.value,
|
|
660
|
-
stickyEndX: Te.value,
|
|
661
|
-
stickyEndY: ke.value,
|
|
662
|
-
flowPaddingStartX: fe.value,
|
|
663
|
-
flowPaddingStartY: pe.value,
|
|
664
|
-
flowPaddingEndX: _e.value,
|
|
665
|
-
flowPaddingEndY: be.value,
|
|
666
|
-
paddingStartX: te.value,
|
|
667
|
-
paddingStartY: ce.value,
|
|
668
|
-
paddingEndX: Pe.value,
|
|
669
|
-
paddingEndY: Le.value
|
|
670
|
-
});
|
|
671
|
-
if (!f) {
|
|
672
|
-
const M = yt(o) ? o.behavior : void 0;
|
|
673
|
-
K.value = {
|
|
674
|
-
rowIndex: l,
|
|
675
|
-
colIndex: r,
|
|
676
|
-
options: {
|
|
677
|
-
align: { x: F, y: g },
|
|
678
|
-
...M != null ? { behavior: M } : {}
|
|
679
|
-
}
|
|
680
|
-
};
|
|
681
|
-
}
|
|
682
|
-
const I = Ht(y, Se.x, he.value), U = Ht(B, Se.y, Ae.value), D = m.value ? -I : I, J = U;
|
|
683
|
-
let Xe;
|
|
684
|
-
yt(o) && (Xe = o.behavior);
|
|
685
|
-
const N = f ? "auto" : Xe || "smooth";
|
|
686
|
-
if (X.value = !0, typeof window < "u" && p === window)
|
|
687
|
-
window.scrollTo({
|
|
688
|
-
left: r == null ? void 0 : m.value ? D : Math.max(0, D),
|
|
689
|
-
top: l == null ? void 0 : Math.max(0, J),
|
|
690
|
-
behavior: N
|
|
691
|
-
});
|
|
692
|
-
else if (Jt(p)) {
|
|
693
|
-
const M = {
|
|
694
|
-
behavior: N
|
|
695
|
-
};
|
|
696
|
-
r != null && (M.left = m.value ? D : Math.max(0, D)), l != null && (M.top = Math.max(0, J)), typeof p.scrollTo == "function" ? p.scrollTo(M) : (M.left !== void 0 && (p.scrollLeft = M.left), M.top !== void 0 && (p.scrollTop = M.top));
|
|
697
|
-
}
|
|
698
|
-
if ((N === "auto" || N === void 0) && (r != null && (i.value = m.value ? D : Math.max(0, D), R.value = y), l != null && (t.value = Math.max(0, J), T.value = B), K.value)) {
|
|
699
|
-
const M = K.value.options;
|
|
700
|
-
yt(M) ? M.behavior = "auto" : K.value.options = {
|
|
701
|
-
align: M,
|
|
702
|
-
behavior: "auto"
|
|
703
|
-
};
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
const je = (l, r, o) => {
|
|
707
|
-
const f = e.value.container || window;
|
|
708
|
-
X.value = !0, K.value = null;
|
|
709
|
-
const p = l != null ? Math.max(0, Math.min(l, Ve.value - z.value)) : null, y = r != null ? Math.max(0, Math.min(r, we.value - h.value)) : null;
|
|
710
|
-
p !== null && (R.value = p), y !== null && (T.value = y);
|
|
711
|
-
const B = typeof window < "u" && f === window ? window.scrollX : f.scrollLeft, F = typeof window < "u" && f === window ? window.scrollY : f.scrollTop, g = p !== null ? Ht(p, Se.x, he.value) : null, I = y !== null ? Ht(y, Se.y, Ae.value) : null, U = g !== null ? m.value ? -g : g : B, D = I !== null ? I : F;
|
|
712
|
-
if (typeof window < "u" && f === window)
|
|
713
|
-
window.scrollTo({
|
|
714
|
-
left: l != null ? U : void 0,
|
|
715
|
-
top: r != null ? D : void 0,
|
|
716
|
-
behavior: o?.behavior || "auto"
|
|
717
|
-
});
|
|
718
|
-
else if (Jt(f)) {
|
|
719
|
-
const J = {
|
|
720
|
-
behavior: o?.behavior || "auto"
|
|
721
|
-
};
|
|
722
|
-
l != null && (J.left = U), r != null && (J.top = D), typeof f.scrollTo == "function" ? f.scrollTo(J) : (J.left !== void 0 && (f.scrollLeft = J.left), J.top !== void 0 && (f.scrollTop = J.top));
|
|
723
|
-
}
|
|
724
|
-
(o?.behavior === "auto" || o?.behavior === void 0) && (l != null && (i.value = U), r != null && (t.value = D));
|
|
725
|
-
}, Ft = (l, r) => {
|
|
726
|
-
if (k.resize(l), C.resize(l), W.resize(r), q.length !== l) {
|
|
727
|
-
const o = new Uint8Array(l);
|
|
728
|
-
o.set(q.subarray(0, Math.min(l, q.length))), q = o;
|
|
729
|
-
}
|
|
730
|
-
if (H.length !== l) {
|
|
731
|
-
const o = new Uint8Array(l);
|
|
732
|
-
o.set(H.subarray(0, Math.min(l, H.length))), H = o;
|
|
733
|
-
}
|
|
734
|
-
if (x.length !== r) {
|
|
735
|
-
const o = new Uint8Array(r);
|
|
736
|
-
o.set(x.subarray(0, Math.min(r, x.length))), x = o;
|
|
737
|
-
}
|
|
738
|
-
}, it = () => {
|
|
739
|
-
const r = e.value.items.length, o = e.value.columnCount || 0, f = e.value.gap || 0, p = e.value.columnGap || 0, y = e.value.columnWidth;
|
|
740
|
-
let B = !1, F = !1;
|
|
741
|
-
if (o > 0)
|
|
742
|
-
for (let g = 0; g < o; g++) {
|
|
743
|
-
const I = W.get(g), U = x[g] === 1;
|
|
744
|
-
if (!de.value || !U && I === 0) {
|
|
745
|
-
let D = 0;
|
|
746
|
-
typeof y == "number" && y > 0 ? D = y : Array.isArray(y) && y.length > 0 ? D = y[g % y.length] || e.value.defaultColumnWidth || Lt : typeof y == "function" ? D = y(g) : D = e.value.defaultColumnWidth || Lt;
|
|
747
|
-
const J = D + p;
|
|
748
|
-
Math.abs(I - J) > 0.5 ? (W.set(g, J), x[g] = de.value ? 0 : 1, B = !0) : de.value || (x[g] = 1);
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
for (let g = 0; g < r; g++) {
|
|
752
|
-
const I = e.value.items[g], U = k.get(g), D = C.get(g), J = q[g] === 1, Xe = H[g] === 1;
|
|
753
|
-
if (Y.value === "horizontal") {
|
|
754
|
-
if (!re.value || !J && U === 0) {
|
|
755
|
-
const M = (typeof e.value.itemSize == "function" ? e.value.itemSize(I, g) : Be.value) + p;
|
|
756
|
-
Math.abs(U - M) > 0.5 ? (k.set(g, M), q[g] = re.value ? 0 : 1, F = !0) : re.value || (q[g] = 1);
|
|
757
|
-
}
|
|
758
|
-
} else U !== 0 && (k.set(g, 0), q[g] = 0, F = !0);
|
|
759
|
-
if (Y.value !== "horizontal") {
|
|
760
|
-
if (!re.value || !Xe && D === 0) {
|
|
761
|
-
const M = (typeof e.value.itemSize == "function" ? e.value.itemSize(I, g) : Be.value) + f;
|
|
762
|
-
Math.abs(D - M) > 0.5 ? (C.set(g, M), H[g] = re.value ? 0 : 1, F = !0) : re.value || (H[g] = 1);
|
|
763
|
-
}
|
|
764
|
-
} else D !== 0 && (C.set(g, 0), H[g] = 0, F = !0);
|
|
765
|
-
}
|
|
766
|
-
B && W.rebuild(), F && (k.rebuild(), C.rebuild());
|
|
767
|
-
}, Ke = () => {
|
|
768
|
-
const l = e.value.items, r = l.length, o = e.value.columnCount || 0;
|
|
769
|
-
Ft(r, o);
|
|
770
|
-
let f = 0;
|
|
771
|
-
if (e.value.restoreScrollOnPrepend && Z.length > 0 && r > Z.length) {
|
|
772
|
-
const p = Z[0];
|
|
773
|
-
if (p !== void 0) {
|
|
774
|
-
for (let y = 1; y <= r - Z.length; y++)
|
|
775
|
-
if (l[y] === p) {
|
|
776
|
-
f = y;
|
|
777
|
-
break;
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
if (f > 0) {
|
|
782
|
-
k.shift(f), C.shift(f), K.value && K.value.rowIndex !== null && K.value.rowIndex !== void 0 && (K.value.rowIndex += f);
|
|
783
|
-
const p = new Uint8Array(r), y = new Uint8Array(r);
|
|
784
|
-
p.set(q.subarray(0, Math.min(r - f, q.length)), f), y.set(H.subarray(0, Math.min(r - f, H.length)), f), q = p, H = y;
|
|
785
|
-
const B = e.value.gap || 0, F = e.value.columnGap || 0;
|
|
786
|
-
let g = 0, I = 0;
|
|
787
|
-
for (let U = 0; U < f; U++) {
|
|
788
|
-
const D = typeof e.value.itemSize == "function" ? e.value.itemSize(l[U], U) : Be.value;
|
|
789
|
-
Y.value === "horizontal" ? g += D + F : I += D + B;
|
|
790
|
-
}
|
|
791
|
-
(g > 0 || I > 0) && kt(() => {
|
|
792
|
-
je(
|
|
793
|
-
g > 0 ? Re.value + g : null,
|
|
794
|
-
I > 0 ? $e.value + I : null,
|
|
795
|
-
{ behavior: "auto" }
|
|
796
|
-
);
|
|
797
|
-
});
|
|
798
|
-
}
|
|
799
|
-
it(), Z = [...l], Q.value = !0, P.value++;
|
|
800
|
-
}, He = () => {
|
|
801
|
-
if (typeof window > "u")
|
|
802
|
-
return;
|
|
803
|
-
const l = e.value.container || window, r = (o) => {
|
|
804
|
-
const f = o.getBoundingClientRect();
|
|
805
|
-
if (l === window)
|
|
806
|
-
return {
|
|
807
|
-
x: m.value ? document.documentElement.clientWidth - f.right - window.scrollX : f.left + window.scrollX,
|
|
808
|
-
y: f.top + window.scrollY
|
|
809
|
-
};
|
|
810
|
-
if (l === o)
|
|
811
|
-
return { x: 0, y: 0 };
|
|
812
|
-
if (Zt(l)) {
|
|
813
|
-
const p = l.getBoundingClientRect();
|
|
814
|
-
return {
|
|
815
|
-
x: m.value ? p.right - f.right - l.scrollLeft : f.left - p.left + l.scrollLeft,
|
|
816
|
-
y: f.top - p.top + l.scrollTop
|
|
817
|
-
};
|
|
818
|
-
}
|
|
819
|
-
return { x: 0, y: 0 };
|
|
820
|
-
};
|
|
821
|
-
if (e.value.hostElement) {
|
|
822
|
-
const o = r(e.value.hostElement);
|
|
823
|
-
(Math.abs(E.x - o.x) > 0.1 || Math.abs(E.y - o.y) > 0.1) && (E.x = o.x, E.y = o.y);
|
|
824
|
-
}
|
|
825
|
-
if (e.value.hostRef) {
|
|
826
|
-
const o = r(e.value.hostRef);
|
|
827
|
-
(Math.abs(b.x - o.x) > 0.1 || Math.abs(b.y - o.y) > 0.1) && (b.x = o.x, b.y = o.y);
|
|
828
|
-
}
|
|
829
|
-
};
|
|
830
|
-
Me([
|
|
831
|
-
() => e.value.items,
|
|
832
|
-
() => e.value.items.length,
|
|
833
|
-
() => e.value.direction,
|
|
834
|
-
() => e.value.columnCount,
|
|
835
|
-
() => e.value.columnWidth,
|
|
836
|
-
() => e.value.itemSize,
|
|
837
|
-
() => e.value.gap,
|
|
838
|
-
() => e.value.columnGap,
|
|
839
|
-
() => e.value.defaultItemSize,
|
|
840
|
-
() => e.value.defaultColumnWidth
|
|
841
|
-
], Ke, { immediate: !0 }), Me(() => [e.value.container, e.value.hostElement], () => {
|
|
842
|
-
He();
|
|
843
|
-
}), Me(m, (l, r) => {
|
|
844
|
-
if (r === void 0 || l === r || !w.value)
|
|
845
|
-
return;
|
|
846
|
-
if (Y.value === "vertical") {
|
|
847
|
-
He();
|
|
848
|
-
return;
|
|
849
|
-
}
|
|
850
|
-
const o = r ? Math.abs(i.value) : i.value, f = ct(o, E.x, he.value);
|
|
851
|
-
He(), je(f, null, { behavior: "auto" });
|
|
852
|
-
}, { flush: "sync" }), Me([he, Ae], () => {
|
|
853
|
-
!w.value || s.value || X.value || je(R.value, T.value, { behavior: "auto" });
|
|
854
|
-
}), Me([() => e.value.items.length, () => e.value.columnCount], ([l, r], [o, f]) => {
|
|
855
|
-
kt(() => {
|
|
856
|
-
const p = Math.max(0, Ve.value - z.value), y = Math.max(0, we.value - h.value);
|
|
857
|
-
R.value > p || T.value > y ? je(
|
|
858
|
-
Math.min(R.value, p),
|
|
859
|
-
Math.min(T.value, y),
|
|
860
|
-
{ behavior: "auto" }
|
|
861
|
-
) : (l !== o && Ae.value !== 1 || r !== f && he.value !== 1) && je(R.value, T.value, { behavior: "auto" }), He();
|
|
862
|
-
});
|
|
863
|
-
});
|
|
864
|
-
const rt = (l) => {
|
|
865
|
-
const r = e.value.gap || 0, o = e.value.columnGap || 0, f = G.value;
|
|
866
|
-
if (Y.value === "horizontal") {
|
|
867
|
-
const y = (f || 0) + o;
|
|
868
|
-
return f !== null && y > 0 ? Math.floor(l / y) : k.findLowerBound(l);
|
|
869
|
-
}
|
|
870
|
-
const p = (f || 0) + r;
|
|
871
|
-
return f !== null && p > 0 ? Math.floor(l / p) : C.findLowerBound(l);
|
|
872
|
-
}, zt = (l) => Y.value === "both" ? W.findLowerBound(l) : Y.value === "horizontal" ? rt(l) : 0, Ct = u(() => {
|
|
873
|
-
if (P.value, (!d.value || S.value) && e.value.ssrRange)
|
|
874
|
-
return {
|
|
875
|
-
start: e.value.ssrRange.start,
|
|
876
|
-
end: e.value.ssrRange.end
|
|
877
|
-
};
|
|
878
|
-
const l = e.value.ssrRange && !s.value ? 0 : e.value.bufferBefore ?? cl, r = e.value.bufferAfter ?? cl;
|
|
879
|
-
return Rl({
|
|
880
|
-
direction: Y.value,
|
|
881
|
-
relativeScrollX: Re.value,
|
|
882
|
-
relativeScrollY: $e.value,
|
|
883
|
-
usableWidth: ye.value,
|
|
884
|
-
usableHeight: Ge.value,
|
|
885
|
-
itemsLength: e.value.items.length,
|
|
886
|
-
bufferBefore: l,
|
|
887
|
-
bufferAfter: r,
|
|
888
|
-
gap: e.value.gap || 0,
|
|
889
|
-
columnGap: e.value.columnGap || 0,
|
|
890
|
-
fixedSize: G.value,
|
|
891
|
-
findLowerBoundY: (o) => C.findLowerBound(o),
|
|
892
|
-
findLowerBoundX: (o) => k.findLowerBound(o),
|
|
893
|
-
queryY: (o) => C.query(o),
|
|
894
|
-
queryX: (o) => k.query(o)
|
|
895
|
-
});
|
|
896
|
-
}), Yt = u(() => {
|
|
897
|
-
P.value;
|
|
898
|
-
const l = Re.value + ae.value, r = $e.value + ie.value, o = Y.value === "horizontal" ? l : r;
|
|
899
|
-
return rt(o);
|
|
900
|
-
}), Ze = u(() => {
|
|
901
|
-
P.value;
|
|
902
|
-
const l = e.value.columnCount || 0;
|
|
903
|
-
if (!l)
|
|
904
|
-
return { start: 0, end: 0, padStart: 0, padEnd: 0 };
|
|
905
|
-
if ((!d.value || S.value) && e.value.ssrRange) {
|
|
906
|
-
const { colStart: o = 0, colEnd: f = 0 } = e.value.ssrRange, p = Math.max(0, o), y = Math.min(l, f || l), B = e.value.columnGap || 0, F = le.value !== null ? p * (le.value + B) : W.query(p), g = le.value !== null ? l * (le.value + B) - B : Math.max(0, W.query(l) - B), I = le.value !== null ? y * (le.value + B) - (y > 0 ? B : 0) : W.query(y) - (y > 0 ? B : 0);
|
|
907
|
-
return {
|
|
908
|
-
start: p,
|
|
909
|
-
end: y,
|
|
910
|
-
padStart: F,
|
|
911
|
-
padEnd: Math.max(0, g - I)
|
|
912
|
-
};
|
|
913
|
-
}
|
|
914
|
-
const r = e.value.ssrRange && !s.value ? 0 : 2;
|
|
915
|
-
return Xl({
|
|
916
|
-
columnCount: l,
|
|
917
|
-
relativeScrollX: Re.value,
|
|
918
|
-
usableWidth: ye.value,
|
|
919
|
-
colBuffer: r,
|
|
920
|
-
fixedWidth: le.value,
|
|
921
|
-
columnGap: e.value.columnGap || 0,
|
|
922
|
-
findLowerBound: (o) => W.findLowerBound(o),
|
|
923
|
-
query: (o) => W.query(o),
|
|
924
|
-
totalColsQuery: () => W.query(l)
|
|
925
|
-
});
|
|
926
|
-
});
|
|
927
|
-
let Et = [];
|
|
928
|
-
const Tt = u(() => {
|
|
929
|
-
P.value;
|
|
930
|
-
const { start: l, end: r } = Ct.value, o = [], f = G.value, p = e.value.gap || 0, y = e.value.columnGap || 0, B = ue.value, F = wt.value, g = [];
|
|
931
|
-
if (d.value || !e.value.ssrRange) {
|
|
932
|
-
const j = Yt.value, Ne = pl(B, j);
|
|
933
|
-
Ne !== void 0 && Ne < l && g.push(Ne);
|
|
934
|
-
}
|
|
935
|
-
for (let j = l; j < r; j++)
|
|
936
|
-
g.push(j);
|
|
937
|
-
const I = e.value.ssrRange?.start || 0, U = e.value.ssrRange?.colStart || 0;
|
|
938
|
-
let D = 0, J = 0;
|
|
939
|
-
!d.value && e.value.ssrRange && (J = Y.value !== "horizontal" ? f !== null ? I * (f + p) : C.query(I) : 0, Y.value === "horizontal" ? D = f !== null ? U * (f + y) : k.query(U) : Y.value === "both" && (D = W.query(U)));
|
|
940
|
-
const Xe = new Map(Et.map((j) => [j.index, j]));
|
|
941
|
-
let N = -1, M = 0, qe = -1, Ce = 0;
|
|
942
|
-
const Mt = (j) => j === N + 1 ? (M += k.get(N), N = j, M) : (M = k.query(j), N = j, M), me = (j) => j === qe + 1 ? (Ce += C.get(qe), qe = j, Ce) : (Ce = C.query(j), qe = j, Ce), Ue = fe.value + ae.value + te.value, se = pe.value + ie.value + ce.value, Ye = fe.value + ae.value, ze = pe.value + ie.value, ft = Ze.value;
|
|
943
|
-
for (const j of g) {
|
|
944
|
-
const Ne = e.value.items[j];
|
|
945
|
-
if (Ne === void 0)
|
|
946
|
-
continue;
|
|
947
|
-
const { x: Ot, y: Pt, width: Ut, height: Nt } = Yl({
|
|
948
|
-
index: j,
|
|
949
|
-
direction: Y.value,
|
|
950
|
-
fixedSize: G.value,
|
|
951
|
-
gap: e.value.gap || 0,
|
|
952
|
-
columnGap: e.value.columnGap || 0,
|
|
953
|
-
usableWidth: ye.value,
|
|
954
|
-
usableHeight: Ge.value,
|
|
955
|
-
totalWidth: nt.value.width,
|
|
956
|
-
queryY: me,
|
|
957
|
-
queryX: Mt,
|
|
958
|
-
getSizeY: (ut) => C.get(ut),
|
|
959
|
-
getSizeX: (ut) => k.get(ut),
|
|
960
|
-
columnRange: ft
|
|
961
|
-
}), _t = F.has(j), At = Ot, Wt = Pt, { isStickyActive: al, stickyOffset: qt } = Cl({
|
|
962
|
-
index: j,
|
|
963
|
-
isSticky: _t,
|
|
964
|
-
direction: Y.value,
|
|
965
|
-
relativeScrollX: Re.value,
|
|
966
|
-
relativeScrollY: $e.value,
|
|
967
|
-
originalX: At,
|
|
968
|
-
originalY: Wt,
|
|
969
|
-
width: Ut,
|
|
970
|
-
height: Nt,
|
|
971
|
-
stickyIndices: B,
|
|
972
|
-
fixedSize: G.value,
|
|
973
|
-
fixedWidth: le.value,
|
|
974
|
-
gap: e.value.gap || 0,
|
|
975
|
-
columnGap: e.value.columnGap || 0,
|
|
976
|
-
getItemQueryY: (ut) => C.query(ut),
|
|
977
|
-
getItemQueryX: (ut) => k.query(ut)
|
|
978
|
-
}), nl = d.value ? R.value / he.value + (At + Ue - R.value) - Ye : At - D, ol = d.value ? T.value / Ae.value + (Wt + se - T.value) - ze : Wt - J, De = Xe.get(j);
|
|
979
|
-
De && De.item === Ne && De.offset.x === nl && De.offset.y === ol && De.size.width === Ut && De.size.height === Nt && De.isSticky === _t && De.isStickyActive === al && De.stickyOffset.x === qt.x && De.stickyOffset.y === qt.y ? o.push(De) : o.push({
|
|
980
|
-
item: Ne,
|
|
981
|
-
index: j,
|
|
982
|
-
offset: { x: nl, y: ol },
|
|
983
|
-
size: { width: Ut, height: Nt },
|
|
984
|
-
originalX: At,
|
|
985
|
-
originalY: Wt,
|
|
986
|
-
isSticky: _t,
|
|
987
|
-
isStickyActive: al,
|
|
988
|
-
stickyOffset: {
|
|
989
|
-
x: qt.x,
|
|
990
|
-
y: qt.y
|
|
991
|
-
}
|
|
992
|
-
});
|
|
993
|
-
}
|
|
994
|
-
return Et = o, o;
|
|
995
|
-
}), n = u(() => {
|
|
996
|
-
P.value;
|
|
997
|
-
const l = Re.value + ae.value, r = $e.value + ie.value, o = Re.value + (z.value - Te.value) - 1, f = $e.value + (h.value - ke.value) - 1, p = zt(l), y = rt(r), B = rt(Y.value === "horizontal" ? o : f), F = zt(o);
|
|
998
|
-
return {
|
|
999
|
-
items: Tt.value,
|
|
1000
|
-
currentIndex: y,
|
|
1001
|
-
currentColIndex: p,
|
|
1002
|
-
currentEndIndex: B,
|
|
1003
|
-
currentEndColIndex: F,
|
|
1004
|
-
scrollOffset: {
|
|
1005
|
-
x: R.value,
|
|
1006
|
-
y: T.value
|
|
1007
|
-
},
|
|
1008
|
-
displayScrollOffset: {
|
|
1009
|
-
x: m.value ? Math.abs(i.value + b.x) : Math.max(0, i.value - b.x),
|
|
1010
|
-
y: Math.max(0, t.value - b.y)
|
|
1011
|
-
},
|
|
1012
|
-
viewportSize: {
|
|
1013
|
-
width: z.value,
|
|
1014
|
-
height: h.value
|
|
1015
|
-
},
|
|
1016
|
-
displayViewportSize: {
|
|
1017
|
-
width: z.value,
|
|
1018
|
-
height: h.value
|
|
1019
|
-
},
|
|
1020
|
-
totalSize: {
|
|
1021
|
-
width: Ve.value,
|
|
1022
|
-
height: we.value
|
|
1023
|
-
},
|
|
1024
|
-
isScrolling: s.value,
|
|
1025
|
-
isProgrammaticScroll: X.value,
|
|
1026
|
-
range: Ct.value,
|
|
1027
|
-
columnRange: Ze.value
|
|
1028
|
-
};
|
|
1029
|
-
}), v = () => {
|
|
1030
|
-
X.value = !1, K.value = null;
|
|
1031
|
-
}, c = (l) => {
|
|
1032
|
-
const r = l.target;
|
|
1033
|
-
if (typeof window > "u")
|
|
1034
|
-
return;
|
|
1035
|
-
L(), r === window || r === document ? (i.value = window.scrollX, t.value = window.scrollY, z.value = document.documentElement.clientWidth, h.value = document.documentElement.clientHeight) : Jt(r) && (i.value = r.scrollLeft, t.value = r.scrollTop, z.value = r.clientWidth, h.value = r.clientHeight);
|
|
1036
|
-
const o = m.value ? Math.abs(i.value) : i.value;
|
|
1037
|
-
R.value = ct(o, Se.x, he.value), T.value = ct(t.value, Se.y, Ae.value), s.value || (X.value || (K.value = null), s.value = !0), clearTimeout(V), V = setTimeout(() => {
|
|
1038
|
-
s.value = !1, X.value = !1;
|
|
1039
|
-
}, 250);
|
|
1040
|
-
}, A = (l) => {
|
|
1041
|
-
let r = !1, o = 0, f = 0;
|
|
1042
|
-
const p = e.value.gap || 0, y = e.value.columnGap || 0, B = Re.value, F = $e.value, g = rt(Y.value === "horizontal" ? B : F), I = zt(B), U = Y.value === "horizontal", D = Y.value === "both", J = /* @__PURE__ */ new Set(), Xe = /* @__PURE__ */ new Set();
|
|
1043
|
-
for (const { index: N, inlineSize: M, blockSize: qe, element: Ce } of l) {
|
|
1044
|
-
if (M <= 0 && qe <= 0)
|
|
1045
|
-
continue;
|
|
1046
|
-
const Mt = re.value || typeof e.value.itemSize == "function";
|
|
1047
|
-
if (N >= 0 && !J.has(N) && Mt && qe > 0) {
|
|
1048
|
-
if (J.add(N), U && M > 0) {
|
|
1049
|
-
const Ue = k.get(N), se = M + y;
|
|
1050
|
-
if (!q[N] || Math.abs(se - Ue) > 0.1) {
|
|
1051
|
-
const Ye = se - Ue;
|
|
1052
|
-
k.update(N, Ye), q[N] = 1, r = !0, N < g && (o += Ye);
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
if (!U) {
|
|
1056
|
-
const Ue = C.get(N), se = qe + p;
|
|
1057
|
-
if (!H[N] || Math.abs(se - Ue) > 0.1) {
|
|
1058
|
-
const Ye = se - Ue;
|
|
1059
|
-
C.update(N, Ye), H[N] = 1, r = !0, N < g && (f += Ye);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
const me = de.value || typeof e.value.columnWidth == "function";
|
|
1064
|
-
if (D && Ce && e.value.columnCount && me && (M > 0 || Ce.dataset.colIndex === void 0)) {
|
|
1065
|
-
const Ue = Ce.dataset.colIndex;
|
|
1066
|
-
if (Ue != null) {
|
|
1067
|
-
const se = Number.parseInt(Ue, 10);
|
|
1068
|
-
if (se >= 0 && se < (e.value.columnCount || 0) && !Xe.has(se)) {
|
|
1069
|
-
Xe.add(se);
|
|
1070
|
-
const Ye = W.get(se), ze = M + y;
|
|
1071
|
-
if (!x[se] || Math.abs(Ye - ze) > 0.1) {
|
|
1072
|
-
const ft = ze - Ye;
|
|
1073
|
-
Math.abs(ft) > 0.1 && (W.update(se, ft), r = !0, se < I && (o += ft)), x[se] = 1;
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
} else {
|
|
1077
|
-
const se = Ce.dataset.colIndex !== void 0 ? [Ce] : Array.from(Ce.querySelectorAll("[data-col-index]"));
|
|
1078
|
-
for (const Ye of se) {
|
|
1079
|
-
const ze = Number.parseInt(Ye.dataset.colIndex, 10);
|
|
1080
|
-
if (ze >= 0 && ze < (e.value.columnCount || 0) && !Xe.has(ze)) {
|
|
1081
|
-
Xe.add(ze);
|
|
1082
|
-
const j = Ye.getBoundingClientRect().width, Ne = W.get(ze), Ot = j + y;
|
|
1083
|
-
if (!x[ze] || Math.abs(Ne - Ot) > 0.1) {
|
|
1084
|
-
const Pt = Ot - Ne;
|
|
1085
|
-
Math.abs(Pt) > 0.1 && (W.update(ze, Pt), r = !0, ze < I && (o += Pt)), x[ze] = 1;
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
if (r && (P.value++, !(K.value !== null || X.value) && (o !== 0 || f !== 0))) {
|
|
1093
|
-
const M = fe.value + ae.value + te.value, qe = pe.value + ie.value + ce.value;
|
|
1094
|
-
je(
|
|
1095
|
-
o !== 0 ? B + o + M : null,
|
|
1096
|
-
f !== 0 ? F + f + qe : null,
|
|
1097
|
-
{ behavior: "auto" }
|
|
1098
|
-
);
|
|
1099
|
-
}
|
|
1100
|
-
}, ve = (l, r, o, f) => {
|
|
1101
|
-
A([{ index: l, inlineSize: r, blockSize: o, element: f }]);
|
|
1102
|
-
};
|
|
1103
|
-
function We() {
|
|
1104
|
-
if (K.value && !S.value) {
|
|
1105
|
-
const { rowIndex: l, colIndex: r, options: o } = K.value;
|
|
1106
|
-
if (yt(o) && o.behavior === "smooth" && s.value)
|
|
1107
|
-
return;
|
|
1108
|
-
const p = e.value.container || window, y = typeof window < "u" && p === window ? window.scrollX : p.scrollLeft, B = typeof window < "u" && p === window ? window.scrollY : p.scrollTop, F = m.value ? Math.abs(y) : y, g = B, I = ct(F, 0, he.value), U = ct(g, 0, Ae.value), { targetX: D, targetY: J } = sl({
|
|
1109
|
-
rowIndex: l,
|
|
1110
|
-
colIndex: r,
|
|
1111
|
-
options: o,
|
|
1112
|
-
direction: Y.value,
|
|
1113
|
-
viewportWidth: z.value,
|
|
1114
|
-
viewportHeight: h.value,
|
|
1115
|
-
totalWidth: Oe.value,
|
|
1116
|
-
totalHeight: Ie.value,
|
|
1117
|
-
gap: e.value.gap || 0,
|
|
1118
|
-
columnGap: e.value.columnGap || 0,
|
|
1119
|
-
fixedSize: G.value,
|
|
1120
|
-
fixedWidth: le.value,
|
|
1121
|
-
relativeScrollX: I,
|
|
1122
|
-
relativeScrollY: U,
|
|
1123
|
-
getItemSizeY: (me) => C.get(me),
|
|
1124
|
-
getItemSizeX: (me) => k.get(me),
|
|
1125
|
-
getItemQueryY: (me) => C.query(me),
|
|
1126
|
-
getItemQueryX: (me) => k.query(me),
|
|
1127
|
-
getColumnSize: (me) => W.get(me),
|
|
1128
|
-
getColumnQuery: (me) => W.query(me),
|
|
1129
|
-
scaleX: he.value,
|
|
1130
|
-
scaleY: Ae.value,
|
|
1131
|
-
hostOffsetX: Se.x,
|
|
1132
|
-
hostOffsetY: Se.y,
|
|
1133
|
-
stickyIndices: ue.value,
|
|
1134
|
-
stickyStartX: ae.value,
|
|
1135
|
-
stickyStartY: ie.value,
|
|
1136
|
-
stickyEndX: Te.value,
|
|
1137
|
-
stickyEndY: ke.value,
|
|
1138
|
-
flowPaddingStartX: fe.value,
|
|
1139
|
-
flowPaddingStartY: pe.value,
|
|
1140
|
-
flowPaddingEndX: _e.value,
|
|
1141
|
-
flowPaddingEndY: be.value,
|
|
1142
|
-
paddingStartX: te.value,
|
|
1143
|
-
paddingStartY: ce.value,
|
|
1144
|
-
paddingEndX: Pe.value,
|
|
1145
|
-
paddingEndY: Le.value
|
|
1146
|
-
}), Xe = 2, N = 2, M = r == null || Math.abs(I - D) < Xe, qe = l == null || Math.abs(U - J) < N, Ce = r == null || r === void 0 || x[r] === 1, Mt = l == null || l === void 0 || H[l] === 1;
|
|
1147
|
-
if (M && qe)
|
|
1148
|
-
Ce && Mt && !s.value && !X.value && (K.value = null);
|
|
1149
|
-
else {
|
|
1150
|
-
const me = yt(o) ? { ...o, isCorrection: !0 } : { align: o, isCorrection: !0 };
|
|
1151
|
-
vt(l, r, me);
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
Me([P, z, h], We), Me(s, (l) => {
|
|
1156
|
-
l || We();
|
|
1157
|
-
});
|
|
1158
|
-
let xe = null, O = null, _;
|
|
1159
|
-
const ge = (l) => {
|
|
1160
|
-
if (!l || typeof window > "u")
|
|
1161
|
-
return;
|
|
1162
|
-
const r = l === window ? document : l;
|
|
1163
|
-
if (r.addEventListener("scroll", c, { passive: !0 }), $ = null, L(), Zt(l) && (O = new MutationObserver(() => L()), O.observe(l, { attributes: !0, attributeFilter: ["dir", "style"] })), _ = setInterval(L, 1e3), l === window) {
|
|
1164
|
-
z.value = document.documentElement.clientWidth, h.value = document.documentElement.clientHeight, i.value = window.scrollX, t.value = window.scrollY;
|
|
1165
|
-
const o = () => {
|
|
1166
|
-
L(), z.value = document.documentElement.clientWidth, h.value = document.documentElement.clientHeight, He();
|
|
1167
|
-
};
|
|
1168
|
-
return window.addEventListener("resize", o), () => {
|
|
1169
|
-
r.removeEventListener("scroll", c), window.removeEventListener("resize", o), clearInterval(_), $ = null;
|
|
1170
|
-
};
|
|
1171
|
-
} else
|
|
1172
|
-
return z.value = l.clientWidth, h.value = l.clientHeight, i.value = l.scrollLeft, t.value = l.scrollTop, xe = new ResizeObserver((o) => {
|
|
1173
|
-
L();
|
|
1174
|
-
for (const f of o)
|
|
1175
|
-
f.target === l && (z.value = l.clientWidth, h.value = l.clientHeight, He());
|
|
1176
|
-
}), xe.observe(l), () => {
|
|
1177
|
-
r.removeEventListener("scroll", c), xe?.disconnect(), O?.disconnect(), clearInterval(_), $ = null;
|
|
1178
|
-
};
|
|
1179
|
-
};
|
|
1180
|
-
let Fe;
|
|
1181
|
-
return fl() && (hl(() => {
|
|
1182
|
-
w.value = !0, L(), Me(() => e.value.container, (l) => {
|
|
1183
|
-
Fe?.(), Fe = ge(l || null);
|
|
1184
|
-
}, { immediate: !0 }), He(), kt(() => {
|
|
1185
|
-
if (He(), e.value.ssrRange || e.value.initialScrollIndex !== void 0) {
|
|
1186
|
-
const l = e.value.initialScrollIndex !== void 0 ? e.value.initialScrollIndex : e.value.ssrRange?.start, r = e.value.initialScrollAlign || "start";
|
|
1187
|
-
l != null && vt(l, e.value.ssrRange?.colStart, { align: r, behavior: "auto" }), d.value = !0, S.value = !0, kt(() => {
|
|
1188
|
-
S.value = !1;
|
|
1189
|
-
});
|
|
1190
|
-
} else
|
|
1191
|
-
d.value = !0;
|
|
1192
|
-
});
|
|
1193
|
-
}), ll(() => {
|
|
1194
|
-
Fe?.();
|
|
1195
|
-
})), {
|
|
1196
|
-
/**
|
|
1197
|
-
* Array of items currently rendered in the DOM with their calculated offsets and sizes.
|
|
1198
|
-
* Offsets are in Display Units (DU), sizes are in Virtual Units (VU).
|
|
1199
|
-
* @see RenderedItem
|
|
1200
|
-
*/
|
|
1201
|
-
renderedItems: Tt,
|
|
1202
|
-
/**
|
|
1203
|
-
* Total calculated width of all items including gaps (in VU).
|
|
1204
|
-
*/
|
|
1205
|
-
totalWidth: Ve,
|
|
1206
|
-
/**
|
|
1207
|
-
* Total calculated height of all items including gaps (in VU).
|
|
1208
|
-
*/
|
|
1209
|
-
totalHeight: we,
|
|
1210
|
-
/**
|
|
1211
|
-
* Total width to be rendered in the DOM (clamped to browser limits, in DU).
|
|
1212
|
-
*/
|
|
1213
|
-
renderedWidth: ot,
|
|
1214
|
-
/**
|
|
1215
|
-
* Total height to be rendered in the DOM (clamped to browser limits, in DU).
|
|
1216
|
-
*/
|
|
1217
|
-
renderedHeight: Qe,
|
|
1218
|
-
/**
|
|
1219
|
-
* Detailed information about the current scroll state.
|
|
1220
|
-
* Includes currentIndex, scrollOffset (VU), displayScrollOffset (DU), viewportSize (DU), totalSize (VU), and scrolling status.
|
|
1221
|
-
* @see ScrollDetails
|
|
1222
|
-
*/
|
|
1223
|
-
scrollDetails: n,
|
|
1224
|
-
/**
|
|
1225
|
-
* Helper to get the height of a specific row based on current configuration and measurements.
|
|
1226
|
-
*
|
|
1227
|
-
* @param index - The row index.
|
|
1228
|
-
* @returns The height in VU (excluding gap).
|
|
1229
|
-
*/
|
|
1230
|
-
getRowHeight: Xt,
|
|
1231
|
-
/**
|
|
1232
|
-
* Helper to get the width of a specific column based on current configuration and measurements.
|
|
1233
|
-
*
|
|
1234
|
-
* @param index - The column index.
|
|
1235
|
-
* @returns The width in VU (excluding gap).
|
|
1236
|
-
*/
|
|
1237
|
-
getColumnWidth: $t,
|
|
1238
|
-
/**
|
|
1239
|
-
* Helper to get the virtual offset of a specific row.
|
|
1240
|
-
*
|
|
1241
|
-
* @param index - The row index.
|
|
1242
|
-
* @returns The virtual offset in VU.
|
|
1243
|
-
*/
|
|
1244
|
-
getRowOffset: (l) => pe.value + ie.value + ce.value + C.query(l),
|
|
1245
|
-
/**
|
|
1246
|
-
* Helper to get the virtual offset of a specific column.
|
|
1247
|
-
*
|
|
1248
|
-
* @param index - The column index.
|
|
1249
|
-
* @returns The virtual offset in VU.
|
|
1250
|
-
*/
|
|
1251
|
-
getColumnOffset: (l) => fe.value + ae.value + te.value + W.query(l),
|
|
1252
|
-
/**
|
|
1253
|
-
* Helper to get the virtual offset of a specific item along the scroll axis.
|
|
1254
|
-
*
|
|
1255
|
-
* @param index - The item index.
|
|
1256
|
-
* @returns The virtual offset in VU.
|
|
1257
|
-
*/
|
|
1258
|
-
getItemOffset: (l) => Y.value === "horizontal" ? fe.value + ae.value + te.value + k.query(l) : pe.value + ie.value + ce.value + C.query(l),
|
|
1259
|
-
/**
|
|
1260
|
-
* Helper to get the size of a specific item along the scroll axis.
|
|
1261
|
-
*
|
|
1262
|
-
* @param index - The item index.
|
|
1263
|
-
* @returns The size in VU (excluding gap).
|
|
1264
|
-
*/
|
|
1265
|
-
getItemSize: (l) => {
|
|
1266
|
-
if (Y.value === "horizontal")
|
|
1267
|
-
return Math.max(0, k.get(l) - (e.value.columnGap || 0));
|
|
1268
|
-
const r = e.value.itemSize;
|
|
1269
|
-
if (typeof r == "number" && r > 0)
|
|
1270
|
-
return r;
|
|
1271
|
-
if (typeof r == "function") {
|
|
1272
|
-
const o = e.value.items[l];
|
|
1273
|
-
return o !== void 0 ? r(o, l) : e.value.defaultItemSize || Dt;
|
|
1274
|
-
}
|
|
1275
|
-
return Math.max(0, C.get(l) - (e.value.gap || 0));
|
|
1276
|
-
},
|
|
1277
|
-
/**
|
|
1278
|
-
* Programmatically scroll to a specific row and/or column.
|
|
1279
|
-
*
|
|
1280
|
-
* @param rowIndex - The row index to scroll to. Pass null to only scroll horizontally.
|
|
1281
|
-
* @param colIndex - The column index to scroll to. Pass null to only scroll vertically.
|
|
1282
|
-
* @param options - Alignment and behavior options.
|
|
1283
|
-
* @see ScrollAlignment
|
|
1284
|
-
* @see ScrollToIndexOptions
|
|
1285
|
-
*/
|
|
1286
|
-
scrollToIndex: vt,
|
|
1287
|
-
/**
|
|
1288
|
-
* Programmatically scroll to a specific pixel offset relative to the content start.
|
|
1289
|
-
*
|
|
1290
|
-
* @param x - The pixel offset to scroll to on the X axis (VU). Pass null to keep current position.
|
|
1291
|
-
* @param y - The pixel offset to scroll to on the Y axis (VU). Pass null to keep current position.
|
|
1292
|
-
* @param options - Scroll options (behavior).
|
|
1293
|
-
*/
|
|
1294
|
-
scrollToOffset: je,
|
|
1295
|
-
/**
|
|
1296
|
-
* Stops any currently active smooth scroll animation and clears pending corrections.
|
|
1297
|
-
*/
|
|
1298
|
-
stopProgrammaticScroll: v,
|
|
1299
|
-
/**
|
|
1300
|
-
* Updates the stored size of an item. Should be called when an item is measured (e.g., via ResizeObserver).
|
|
1301
|
-
*
|
|
1302
|
-
* @param index - The item index.
|
|
1303
|
-
* @param width - The measured inlineSize (width in DU).
|
|
1304
|
-
* @param height - The measured blockSize (height in DU).
|
|
1305
|
-
* @param element - The measured element (optional, used for robust grid column detection).
|
|
1306
|
-
*/
|
|
1307
|
-
updateItemSize: ve,
|
|
1308
|
-
/**
|
|
1309
|
-
* Updates the stored size of multiple items simultaneously.
|
|
1310
|
-
*
|
|
1311
|
-
* @param updates - Array of measurement updates (sizes in DU).
|
|
1312
|
-
*/
|
|
1313
|
-
updateItemSizes: A,
|
|
1314
|
-
/**
|
|
1315
|
-
* Recalculates the host element's offset relative to the scroll container.
|
|
1316
|
-
* Useful if the container or host moves without a resize event.
|
|
1317
|
-
*/
|
|
1318
|
-
updateHostOffset: He,
|
|
1319
|
-
/**
|
|
1320
|
-
* Detects the current direction (LTR/RTL) of the scroll container.
|
|
1321
|
-
*/
|
|
1322
|
-
updateDirection: L,
|
|
1323
|
-
/**
|
|
1324
|
-
* Information about the current visible range of columns and their paddings.
|
|
1325
|
-
* @see ColumnRange
|
|
1326
|
-
*/
|
|
1327
|
-
columnRange: Ze,
|
|
1328
|
-
/**
|
|
1329
|
-
* Resets all dynamic measurements and re-initializes from props.
|
|
1330
|
-
* Useful if item sizes have changed externally.
|
|
1331
|
-
*/
|
|
1332
|
-
refresh: () => {
|
|
1333
|
-
k.resize(0), C.resize(0), W.resize(0), x.fill(0), q.fill(0), H.fill(0), Ke();
|
|
1334
|
-
},
|
|
1335
|
-
/**
|
|
1336
|
-
* Whether the component has finished its first client-side mount and hydration.
|
|
1337
|
-
*/
|
|
1338
|
-
isHydrated: d,
|
|
1339
|
-
/**
|
|
1340
|
-
* Whether the container is the window or body.
|
|
1341
|
-
*/
|
|
1342
|
-
isWindowContainer: ne,
|
|
1343
|
-
/**
|
|
1344
|
-
* Whether the scroll container is in Right-to-Left (RTL) mode.
|
|
1345
|
-
*/
|
|
1346
|
-
isRtl: m,
|
|
1347
|
-
/**
|
|
1348
|
-
* Coordinate scaling factor for X axis (VU/DU).
|
|
1349
|
-
*/
|
|
1350
|
-
scaleX: he,
|
|
1351
|
-
/**
|
|
1352
|
-
* Coordinate scaling factor for Y axis (VU/DU).
|
|
1353
|
-
*/
|
|
1354
|
-
scaleY: Ae,
|
|
1355
|
-
/**
|
|
1356
|
-
* Absolute offset of the component within its container (DU).
|
|
1357
|
-
*/
|
|
1358
|
-
componentOffset: Se,
|
|
1359
|
-
/**
|
|
1360
|
-
* Physical width of the items wrapper in the DOM (clamped to browser limits, in DU).
|
|
1361
|
-
*/
|
|
1362
|
-
renderedVirtualWidth: xt,
|
|
1363
|
-
/**
|
|
1364
|
-
* Physical height of the items wrapper in the DOM (clamped to browser limits, in DU).
|
|
1365
|
-
*/
|
|
1366
|
-
renderedVirtualHeight: oe
|
|
1367
|
-
};
|
|
361
|
+
function calculateTotalSize({ direction: e, itemsLength: t, columnCount: n, fixedSize: r, fixedWidth: i, gap: a, columnGap: o, usableWidth: s, usableHeight: c, queryY: l, queryX: u, queryColumn: d }) {
|
|
362
|
+
let f = e === "both", p = e === "horizontal", m = 0, h = 0;
|
|
363
|
+
return f ? (m = calculateAxisSize(n, i, o, d), h = calculateAxisSize(t, r, a, l)) : p ? (m = calculateAxisSize(t, r, o, u), h = c) : (m = s, h = calculateAxisSize(t, r, a, l)), {
|
|
364
|
+
width: f ? Math.max(m, s) : m,
|
|
365
|
+
height: f ? Math.max(h, c) : h
|
|
366
|
+
};
|
|
1368
367
|
}
|
|
1369
|
-
function
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
368
|
+
function useVirtualScroll(e) {
|
|
369
|
+
let n = computed(() => toValue(e)), r = ref(0), i = ref(0), a = ref(!1), o = ref(!1), c = ref(!1), l = ref(!1), d = ref(!1), f = ref(0), p = ref(0), g = reactive({
|
|
370
|
+
x: 0,
|
|
371
|
+
y: 0
|
|
372
|
+
}), y = reactive({
|
|
373
|
+
x: 0,
|
|
374
|
+
y: 0
|
|
375
|
+
}), b, x = ref(!1), S = ref(0), C = ref(0), T = null, E = () => {
|
|
376
|
+
if (typeof window > "u") return;
|
|
377
|
+
let e = n.value.container || n.value.hostRef || window, t = isElement(e) ? e : document.documentElement;
|
|
378
|
+
(!T || !("direction" in T)) && (T = window.getComputedStyle(t));
|
|
379
|
+
let r = T.direction === "rtl";
|
|
380
|
+
d.value !== r && (d.value = r);
|
|
381
|
+
}, D = new FenwickTree(n.value.items?.length || 0), O = new FenwickTree(n.value.items?.length || 0), k = new FenwickTree(n.value.columnCount || 0), A = ref(0), j = new Uint8Array(), M = new Uint8Array(), P = new Uint8Array(), F = ref(null), ce = ref(!1), L = [], R = computed(() => [
|
|
382
|
+
"vertical",
|
|
383
|
+
"horizontal",
|
|
384
|
+
"both"
|
|
385
|
+
].includes(n.value.direction) ? n.value.direction : "vertical"), z = computed(() => n.value.itemSize === void 0 || n.value.itemSize === null || n.value.itemSize === 0), ue = computed(() => n.value.columnWidth === void 0 || n.value.columnWidth === null || n.value.columnWidth === 0), B = computed(() => typeof n.value.itemSize == "number" && n.value.itemSize > 0 ? n.value.itemSize : null), V = computed(() => typeof n.value.columnWidth == "number" && n.value.columnWidth > 0 ? n.value.columnWidth : null), _e = computed(() => n.value.defaultItemSize || B.value || 40), ye = computed(() => [...n.value.stickyIndices || []].sort((e, t) => e - t)), be = computed(() => new Set(ye.value)), xe = computed(() => getPaddingX(n.value.scrollPaddingStart, n.value.direction)), Se = computed(() => getPaddingX(n.value.scrollPaddingEnd, n.value.direction)), Ce = computed(() => getPaddingY(n.value.scrollPaddingStart, n.value.direction)), we = computed(() => getPaddingY(n.value.scrollPaddingEnd, n.value.direction)), U = computed(() => getPaddingX(n.value.stickyStart, n.value.direction)), Te = computed(() => getPaddingX(n.value.stickyEnd, n.value.direction)), W = computed(() => getPaddingY(n.value.stickyStart, n.value.direction)), Ee = computed(() => getPaddingY(n.value.stickyEnd, n.value.direction)), G = computed(() => getPaddingX(n.value.flowPaddingStart, n.value.direction)), K = computed(() => getPaddingX(n.value.flowPaddingEnd, n.value.direction)), q = computed(() => getPaddingY(n.value.flowPaddingStart, n.value.direction)), De = computed(() => getPaddingY(n.value.flowPaddingEnd, n.value.direction)), Oe = computed(() => f.value - (R.value === "vertical" ? 0 : U.value + Te.value)), ke = computed(() => p.value - (R.value === "horizontal" ? 0 : W.value + Ee.value)), Ae = computed(() => {
|
|
386
|
+
if (A.value, !o.value && n.value.ssrRange && !l.value) {
|
|
387
|
+
let { start: e = 0, end: t = 0, colStart: r = 0, colEnd: i = 0 } = n.value.ssrRange, a = n.value.columnCount || 0, o = n.value.gap || 0, s = n.value.columnGap || 0, c = 0, l = 0;
|
|
388
|
+
if (R.value === "both") {
|
|
389
|
+
if (a > 0) {
|
|
390
|
+
let e = i || a, t = k.query(e) - k.query(r);
|
|
391
|
+
c = Math.max(0, t - (e > r ? s : 0));
|
|
392
|
+
}
|
|
393
|
+
if (B.value !== null) {
|
|
394
|
+
let n = t - e;
|
|
395
|
+
l = Math.max(0, n * (B.value + o) - (n > 0 ? o : 0));
|
|
396
|
+
} else {
|
|
397
|
+
let n = O.query(t) - O.query(e);
|
|
398
|
+
l = Math.max(0, n - (t > e ? o : 0));
|
|
399
|
+
}
|
|
400
|
+
} else if (R.value === "horizontal") {
|
|
401
|
+
if (B.value !== null) {
|
|
402
|
+
let n = t - e;
|
|
403
|
+
c = Math.max(0, n * (B.value + s) - (n > 0 ? s : 0));
|
|
404
|
+
} else {
|
|
405
|
+
let n = D.query(t) - D.query(e);
|
|
406
|
+
c = Math.max(0, n - (t > e ? s : 0));
|
|
407
|
+
}
|
|
408
|
+
l = ke.value;
|
|
409
|
+
} else if (c = Oe.value, B.value !== null) {
|
|
410
|
+
let n = t - e;
|
|
411
|
+
l = Math.max(0, n * (B.value + o) - (n > 0 ? o : 0));
|
|
412
|
+
} else {
|
|
413
|
+
let n = O.query(t) - O.query(e);
|
|
414
|
+
l = Math.max(0, n - (t > e ? o : 0));
|
|
415
|
+
}
|
|
416
|
+
return {
|
|
417
|
+
width: Math.max(c, Oe.value),
|
|
418
|
+
height: Math.max(l, ke.value)
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
return calculateTotalSize({
|
|
422
|
+
direction: R.value,
|
|
423
|
+
itemsLength: n.value.items.length,
|
|
424
|
+
columnCount: n.value.columnCount || 0,
|
|
425
|
+
fixedSize: B.value,
|
|
426
|
+
fixedWidth: V.value,
|
|
427
|
+
gap: n.value.gap || 0,
|
|
428
|
+
columnGap: n.value.columnGap || 0,
|
|
429
|
+
usableWidth: Oe.value,
|
|
430
|
+
usableHeight: ke.value,
|
|
431
|
+
queryY: (e) => O.query(e),
|
|
432
|
+
queryX: (e) => D.query(e),
|
|
433
|
+
queryColumn: (e) => k.query(e)
|
|
434
|
+
});
|
|
435
|
+
}), je = computed(() => isWindowLike(n.value.container)), Me = computed(() => Ae.value.width + xe.value + Se.value), Ne = computed(() => Ae.value.height + Ce.value + we.value), J = computed(() => G.value + U.value + Te.value + K.value + Me.value), Y = computed(() => q.value + W.value + Ee.value + De.value + Ne.value), X = reactive({
|
|
436
|
+
x: computed(() => Math.max(0, g.x - (G.value + U.value))),
|
|
437
|
+
y: computed(() => Math.max(0, g.y - (q.value + W.value)))
|
|
438
|
+
}), Pe = computed(() => je.value ? J.value : Math.min(J.value, BROWSER_MAX_SIZE)), Fe = computed(() => je.value ? Y.value : Math.min(Y.value, BROWSER_MAX_SIZE)), Ie = computed(() => je.value ? Me.value : Math.max(0, Pe.value - (G.value + U.value + Te.value + K.value))), Le = computed(() => je.value ? Ne.value : Math.max(0, Fe.value - (q.value + W.value + Ee.value + De.value))), Z = computed(() => {
|
|
439
|
+
if (je.value || J.value <= 1e7) return 1;
|
|
440
|
+
let e = J.value - f.value, t = Pe.value - f.value;
|
|
441
|
+
return t > 0 ? e / t : 1;
|
|
442
|
+
}), Q = computed(() => {
|
|
443
|
+
if (je.value || Y.value <= 1e7) return 1;
|
|
444
|
+
let e = Y.value - p.value, t = Fe.value - p.value;
|
|
445
|
+
return t > 0 ? e / t : 1;
|
|
446
|
+
}), Re = computed(() => {
|
|
447
|
+
if (R.value === "vertical") return 0;
|
|
448
|
+
let e = G.value + U.value + xe.value;
|
|
449
|
+
return S.value - e;
|
|
450
|
+
}), ze = computed(() => {
|
|
451
|
+
if (R.value === "horizontal") return 0;
|
|
452
|
+
let e = q.value + W.value + Ce.value;
|
|
453
|
+
return C.value - e;
|
|
454
|
+
}), Be = (e) => {
|
|
455
|
+
A.value;
|
|
456
|
+
let t = n.value.columnGap || 0, r = n.value.columnWidth;
|
|
457
|
+
if (typeof r == "number" && r > 0) return r;
|
|
458
|
+
if (Array.isArray(r) && r.length > 0) {
|
|
459
|
+
let t = r[e % r.length];
|
|
460
|
+
return t != null && t > 0 ? t : n.value.defaultColumnWidth || 100;
|
|
461
|
+
}
|
|
462
|
+
if (typeof r == "function") return r(e);
|
|
463
|
+
let i = k.get(e);
|
|
464
|
+
return i > 0 ? i - t : n.value.defaultColumnWidth || 100;
|
|
465
|
+
}, Ve = (e) => {
|
|
466
|
+
if (A.value, R.value === "horizontal") return ke.value;
|
|
467
|
+
let t = n.value.gap || 0, r = n.value.itemSize;
|
|
468
|
+
if (typeof r == "number" && r > 0) return r;
|
|
469
|
+
if (typeof r == "function") {
|
|
470
|
+
let t = n.value.items[e];
|
|
471
|
+
return t === void 0 ? n.value.defaultItemSize || 40 : r(t, e);
|
|
472
|
+
}
|
|
473
|
+
let i = O.get(e);
|
|
474
|
+
return i > 0 ? i - t : n.value.defaultItemSize || 40;
|
|
475
|
+
};
|
|
476
|
+
function He(e, t, a) {
|
|
477
|
+
let o = typeof a == "object" && a && "isCorrection" in a ? a.isCorrection : !1, s = n.value.container || window, { targetX: c, targetY: l, effectiveAlignX: u, effectiveAlignY: m } = calculateScrollTarget({
|
|
478
|
+
rowIndex: e,
|
|
479
|
+
colIndex: t,
|
|
480
|
+
options: a,
|
|
481
|
+
direction: R.value,
|
|
482
|
+
viewportWidth: f.value,
|
|
483
|
+
viewportHeight: p.value,
|
|
484
|
+
totalWidth: J.value,
|
|
485
|
+
totalHeight: Y.value,
|
|
486
|
+
gap: n.value.gap || 0,
|
|
487
|
+
columnGap: n.value.columnGap || 0,
|
|
488
|
+
fixedSize: B.value,
|
|
489
|
+
fixedWidth: V.value,
|
|
490
|
+
relativeScrollX: Re.value,
|
|
491
|
+
relativeScrollY: ze.value,
|
|
492
|
+
getItemSizeY: (e) => O.get(e),
|
|
493
|
+
getItemSizeX: (e) => D.get(e),
|
|
494
|
+
getItemQueryY: (e) => O.query(e),
|
|
495
|
+
getItemQueryX: (e) => D.query(e),
|
|
496
|
+
getColumnSize: (e) => k.get(e),
|
|
497
|
+
getColumnQuery: (e) => k.query(e),
|
|
498
|
+
scaleX: Z.value,
|
|
499
|
+
scaleY: Q.value,
|
|
500
|
+
hostOffsetX: X.x,
|
|
501
|
+
hostOffsetY: X.y,
|
|
502
|
+
stickyIndices: ye.value,
|
|
503
|
+
stickyStartX: U.value,
|
|
504
|
+
stickyStartY: W.value,
|
|
505
|
+
stickyEndX: Te.value,
|
|
506
|
+
stickyEndY: Ee.value,
|
|
507
|
+
flowPaddingStartX: G.value,
|
|
508
|
+
flowPaddingStartY: q.value,
|
|
509
|
+
paddingStartX: xe.value,
|
|
510
|
+
paddingStartY: Ce.value,
|
|
511
|
+
paddingEndX: Se.value,
|
|
512
|
+
paddingEndY: we.value
|
|
513
|
+
});
|
|
514
|
+
if (!o) {
|
|
515
|
+
let n = isScrollToIndexOptions(a) ? a.behavior : void 0;
|
|
516
|
+
F.value = {
|
|
517
|
+
rowIndex: e,
|
|
518
|
+
colIndex: t,
|
|
519
|
+
options: {
|
|
520
|
+
align: {
|
|
521
|
+
x: u,
|
|
522
|
+
y: m
|
|
523
|
+
},
|
|
524
|
+
...n == null ? {} : { behavior: n }
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
let h = virtualToDisplay(c, X.x, Z.value), g = virtualToDisplay(l, X.y, Q.value), _ = d.value ? -h : h, v = g, y;
|
|
529
|
+
isScrollToIndexOptions(a) && (y = a.behavior);
|
|
530
|
+
let b = o ? "auto" : y || "smooth";
|
|
531
|
+
x.value = !0;
|
|
532
|
+
let w = { behavior: b };
|
|
533
|
+
if (t != null && (w.left = d.value ? _ : Math.max(0, _)), e != null && (w.top = Math.max(0, v)), scrollTo(s, w), (b === "auto" || b === void 0) && (t != null && (r.value = d.value ? _ : Math.max(0, _), S.value = c), e != null && (i.value = Math.max(0, v), C.value = l), F.value)) {
|
|
534
|
+
let e = F.value.options;
|
|
535
|
+
isScrollToIndexOptions(e) ? e.behavior = "auto" : F.value.options = {
|
|
536
|
+
align: e,
|
|
537
|
+
behavior: "auto"
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
let Ue = (e, t, a) => {
|
|
542
|
+
let o = n.value.container || window;
|
|
543
|
+
x.value = !0, F.value = null;
|
|
544
|
+
let s = e == null ? null : Math.max(0, Math.min(e, J.value - f.value)), c = t == null ? null : Math.max(0, Math.min(t, Y.value - p.value));
|
|
545
|
+
s !== null && (S.value = s), c !== null && (C.value = c);
|
|
546
|
+
let l = typeof window < "u" && o === window ? window.scrollX : o.scrollLeft, u = typeof window < "u" && o === window ? window.scrollY : o.scrollTop, m = s === null ? null : virtualToDisplay(s, X.x, Z.value), h = c === null ? null : virtualToDisplay(c, X.y, Q.value), g = m === null ? l : d.value ? -m : m, _ = h === null ? u : h, v = { behavior: a?.behavior || "auto" };
|
|
547
|
+
e != null && (v.left = g), t != null && (v.top = _), scrollTo(o, v), (a?.behavior === "auto" || a?.behavior === void 0) && (e != null && (r.value = g), t != null && (i.value = _));
|
|
548
|
+
}, We = (e, t) => {
|
|
549
|
+
if (D.resize(e), O.resize(e), k.resize(t), M.length !== e) {
|
|
550
|
+
let t = new Uint8Array(e);
|
|
551
|
+
t.set(M.subarray(0, Math.min(e, M.length))), M = t;
|
|
552
|
+
}
|
|
553
|
+
if (P.length !== e) {
|
|
554
|
+
let t = new Uint8Array(e);
|
|
555
|
+
t.set(P.subarray(0, Math.min(e, P.length))), P = t;
|
|
556
|
+
}
|
|
557
|
+
if (j.length !== t) {
|
|
558
|
+
let e = new Uint8Array(t);
|
|
559
|
+
e.set(j.subarray(0, Math.min(t, j.length))), j = e;
|
|
560
|
+
}
|
|
561
|
+
}, $ = () => {
|
|
562
|
+
let e = n.value.items.length, t = n.value.columnCount || 0, r = n.value.gap || 0, i = n.value.columnGap || 0, a = n.value.columnWidth, o = !1, s = !1;
|
|
563
|
+
if (t > 0) for (let e = 0; e < t; e++) {
|
|
564
|
+
let t = k.get(e), r = j[e] === 1;
|
|
565
|
+
if (!ue.value || !r && t === 0) {
|
|
566
|
+
let r = 0;
|
|
567
|
+
r = typeof a == "number" && a > 0 ? a : Array.isArray(a) && a.length > 0 ? a[e % a.length] || n.value.defaultColumnWidth || 100 : typeof a == "function" ? a(e) : n.value.defaultColumnWidth || 100;
|
|
568
|
+
let s = r + i;
|
|
569
|
+
Math.abs(t - s) > .5 ? (k.set(e, s), j[e] = ue.value ? 0 : 1, o = !0) : ue.value || (j[e] = 1);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
for (let t = 0; t < e; t++) {
|
|
573
|
+
let e = n.value.items[t], a = D.get(t), o = O.get(t), c = M[t] === 1, l = P[t] === 1;
|
|
574
|
+
if (R.value === "horizontal") {
|
|
575
|
+
if (!z.value || !c && a === 0) {
|
|
576
|
+
let r = (typeof n.value.itemSize == "function" ? n.value.itemSize(e, t) : _e.value) + i;
|
|
577
|
+
Math.abs(a - r) > .5 ? (D.set(t, r), M[t] = z.value ? 0 : 1, s = !0) : z.value || (M[t] = 1);
|
|
578
|
+
}
|
|
579
|
+
} else a !== 0 && (D.set(t, 0), M[t] = 0, s = !0);
|
|
580
|
+
if (R.value !== "horizontal") {
|
|
581
|
+
if (!z.value || !l && o === 0) {
|
|
582
|
+
let i = (typeof n.value.itemSize == "function" ? n.value.itemSize(e, t) : _e.value) + r;
|
|
583
|
+
Math.abs(o - i) > .5 ? (O.set(t, i), P[t] = z.value ? 0 : 1, s = !0) : z.value || (P[t] = 1);
|
|
584
|
+
}
|
|
585
|
+
} else o !== 0 && (O.set(t, 0), P[t] = 0, s = !0);
|
|
586
|
+
}
|
|
587
|
+
o && k.rebuild(), s && (D.rebuild(), O.rebuild());
|
|
588
|
+
}, Ge = () => {
|
|
589
|
+
let e = n.value.items, t = e.length;
|
|
590
|
+
We(t, n.value.columnCount || 0);
|
|
591
|
+
let r = 0;
|
|
592
|
+
if (n.value.restoreScrollOnPrepend && L.length > 0 && t > L.length) {
|
|
593
|
+
let n = L[0];
|
|
594
|
+
if (n !== void 0) {
|
|
595
|
+
for (let i = 1; i <= t - L.length; i++) if (e[i] === n) {
|
|
596
|
+
r = i;
|
|
597
|
+
break;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
if (r > 0) {
|
|
602
|
+
D.shift(r), O.shift(r), F.value && F.value.rowIndex !== null && F.value.rowIndex !== void 0 && (F.value.rowIndex += r);
|
|
603
|
+
let i = new Uint8Array(t), a = new Uint8Array(t);
|
|
604
|
+
i.set(M.subarray(0, Math.min(t - r, M.length)), r), a.set(P.subarray(0, Math.min(t - r, P.length)), r), M = i, P = a;
|
|
605
|
+
let o = n.value.gap || 0, s = n.value.columnGap || 0, c = 0, l = 0;
|
|
606
|
+
for (let t = 0; t < r; t++) {
|
|
607
|
+
let r = typeof n.value.itemSize == "function" ? n.value.itemSize(e[t], t) : _e.value;
|
|
608
|
+
R.value === "horizontal" ? c += r + s : l += r + o;
|
|
609
|
+
}
|
|
610
|
+
(c > 0 || l > 0) && nextTick(() => {
|
|
611
|
+
Ue(c > 0 ? Re.value + c : null, l > 0 ? ze.value + l : null, {
|
|
612
|
+
behavior: "auto",
|
|
613
|
+
isCorrection: !0
|
|
614
|
+
});
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
$(), L = [...e], ce.value = !0, A.value++;
|
|
618
|
+
}, Ke = () => {
|
|
619
|
+
if (typeof window > "u") return;
|
|
620
|
+
let e = n.value.container || window, t = (t) => {
|
|
621
|
+
let n = t.getBoundingClientRect();
|
|
622
|
+
if (e === window) return {
|
|
623
|
+
x: d.value ? document.documentElement.clientWidth - n.right - window.scrollX : n.left + window.scrollX,
|
|
624
|
+
y: n.top + window.scrollY
|
|
625
|
+
};
|
|
626
|
+
if (e === t) return {
|
|
627
|
+
x: 0,
|
|
628
|
+
y: 0
|
|
629
|
+
};
|
|
630
|
+
if (isElement(e)) {
|
|
631
|
+
let t = e.getBoundingClientRect();
|
|
632
|
+
return {
|
|
633
|
+
x: d.value ? t.right - n.right - e.scrollLeft : n.left - t.left + e.scrollLeft,
|
|
634
|
+
y: n.top - t.top + e.scrollTop
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
return {
|
|
638
|
+
x: 0,
|
|
639
|
+
y: 0
|
|
640
|
+
};
|
|
641
|
+
};
|
|
642
|
+
if (n.value.hostElement) {
|
|
643
|
+
let e = t(n.value.hostElement);
|
|
644
|
+
(Math.abs(g.x - e.x) > .1 || Math.abs(g.y - e.y) > .1) && (g.x = e.x, g.y = e.y);
|
|
645
|
+
}
|
|
646
|
+
if (n.value.hostRef) {
|
|
647
|
+
let e = t(n.value.hostRef);
|
|
648
|
+
(Math.abs(y.x - e.x) > .1 || Math.abs(y.y - e.y) > .1) && (y.x = e.x, y.y = e.y);
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
watch([
|
|
652
|
+
() => n.value.items,
|
|
653
|
+
() => n.value.items.length,
|
|
654
|
+
() => n.value.direction,
|
|
655
|
+
() => n.value.columnCount,
|
|
656
|
+
() => n.value.columnWidth,
|
|
657
|
+
() => n.value.itemSize,
|
|
658
|
+
() => n.value.gap,
|
|
659
|
+
() => n.value.columnGap,
|
|
660
|
+
() => n.value.defaultItemSize,
|
|
661
|
+
() => n.value.defaultColumnWidth
|
|
662
|
+
], Ge, { immediate: !0 }), watch(() => [n.value.container, n.value.hostElement], () => {
|
|
663
|
+
Ke();
|
|
664
|
+
}), watch(d, (e, t) => {
|
|
665
|
+
if (t === void 0 || e === t || !l.value) return;
|
|
666
|
+
if (R.value === "vertical") {
|
|
667
|
+
Ke();
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
let n = displayToVirtual(t ? Math.abs(r.value) : r.value, g.x, Z.value);
|
|
671
|
+
Ke(), Ue(n, null, { behavior: "auto" });
|
|
672
|
+
}, { flush: "sync" }), watch([Z, Q], () => {
|
|
673
|
+
!l.value || a.value || x.value || Ue(S.value, C.value, { behavior: "auto" });
|
|
674
|
+
}), watch([() => n.value.items.length, () => n.value.columnCount], ([e, t], [n, r]) => {
|
|
675
|
+
nextTick(() => {
|
|
676
|
+
let i = Math.max(0, J.value - f.value), a = Math.max(0, Y.value - p.value);
|
|
677
|
+
S.value > i || C.value > a ? Ue(Math.min(S.value, i), Math.min(C.value, a), { behavior: "auto" }) : (e !== n && Q.value !== 1 || t !== r && Z.value !== 1) && Ue(S.value, C.value, { behavior: "auto" }), Ke();
|
|
678
|
+
});
|
|
679
|
+
});
|
|
680
|
+
let qe = (e) => {
|
|
681
|
+
let t = n.value.gap || 0, r = n.value.columnGap || 0, i = B.value;
|
|
682
|
+
if (R.value === "horizontal") {
|
|
683
|
+
let t = (i || 0) + r;
|
|
684
|
+
return i !== null && t > 0 ? Math.floor(e / t) : D.findLowerBound(e);
|
|
685
|
+
}
|
|
686
|
+
let a = (i || 0) + t;
|
|
687
|
+
return i !== null && a > 0 ? Math.floor(e / a) : O.findLowerBound(e);
|
|
688
|
+
}, Je = (e) => R.value === "both" ? k.findLowerBound(e) : R.value === "horizontal" ? qe(e) : 0, Ye = computed(() => {
|
|
689
|
+
if (A.value, (!o.value || c.value) && n.value.ssrRange) return {
|
|
690
|
+
start: n.value.ssrRange.start,
|
|
691
|
+
end: n.value.ssrRange.end
|
|
692
|
+
};
|
|
693
|
+
let e = n.value.ssrRange && !a.value ? 0 : n.value.bufferBefore ?? 5, t = n.value.bufferAfter ?? 5;
|
|
694
|
+
return calculateRange({
|
|
695
|
+
direction: R.value,
|
|
696
|
+
relativeScrollX: Re.value,
|
|
697
|
+
relativeScrollY: ze.value,
|
|
698
|
+
usableWidth: Oe.value,
|
|
699
|
+
usableHeight: ke.value,
|
|
700
|
+
itemsLength: n.value.items.length,
|
|
701
|
+
bufferBefore: e,
|
|
702
|
+
bufferAfter: t,
|
|
703
|
+
gap: n.value.gap || 0,
|
|
704
|
+
columnGap: n.value.columnGap || 0,
|
|
705
|
+
fixedSize: B.value,
|
|
706
|
+
findLowerBoundY: (e) => O.findLowerBound(e),
|
|
707
|
+
findLowerBoundX: (e) => D.findLowerBound(e),
|
|
708
|
+
queryY: (e) => O.query(e),
|
|
709
|
+
queryX: (e) => D.query(e)
|
|
710
|
+
});
|
|
711
|
+
}), Xe = computed(() => {
|
|
712
|
+
A.value;
|
|
713
|
+
let e = Re.value + U.value, t = ze.value + W.value;
|
|
714
|
+
return qe(R.value === "horizontal" ? e : t);
|
|
715
|
+
}), Ze = computed(() => {
|
|
716
|
+
A.value;
|
|
717
|
+
let e = n.value.columnCount || 0;
|
|
718
|
+
if (!e) return {
|
|
719
|
+
start: 0,
|
|
720
|
+
end: 0,
|
|
721
|
+
padStart: 0,
|
|
722
|
+
padEnd: 0
|
|
723
|
+
};
|
|
724
|
+
if ((!o.value || c.value) && n.value.ssrRange) {
|
|
725
|
+
let { colStart: t = 0, colEnd: r = 0 } = n.value.ssrRange, i = Math.max(0, t), a = Math.min(e, r || e), o = n.value.columnGap || 0, s = V.value === null ? k.query(i) : i * (V.value + o), c = V.value === null ? Math.max(0, k.query(e) - o) : e * (V.value + o) - o, l = V.value === null ? k.query(a) - (a > 0 ? o : 0) : a * (V.value + o) - (a > 0 ? o : 0);
|
|
726
|
+
return {
|
|
727
|
+
start: i,
|
|
728
|
+
end: a,
|
|
729
|
+
padStart: s,
|
|
730
|
+
padEnd: Math.max(0, c - l)
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
let t = n.value.ssrRange && !a.value ? 0 : 2;
|
|
734
|
+
return calculateColumnRange({
|
|
735
|
+
columnCount: e,
|
|
736
|
+
relativeScrollX: Re.value,
|
|
737
|
+
usableWidth: Oe.value,
|
|
738
|
+
colBuffer: t,
|
|
739
|
+
fixedWidth: V.value,
|
|
740
|
+
columnGap: n.value.columnGap || 0,
|
|
741
|
+
findLowerBound: (e) => k.findLowerBound(e),
|
|
742
|
+
query: (e) => k.query(e),
|
|
743
|
+
totalColsQuery: () => k.query(e)
|
|
744
|
+
});
|
|
745
|
+
}), Qe = [], $e = computed(() => {
|
|
746
|
+
A.value;
|
|
747
|
+
let { start: e, end: t } = Ye.value, r = [], i = B.value, a = n.value.gap || 0, s = n.value.columnGap || 0, c = ye.value, l = be.value, u = [];
|
|
748
|
+
if (o.value || !n.value.ssrRange) {
|
|
749
|
+
let t = Xe.value, n = findPrevStickyIndex(c, t);
|
|
750
|
+
n !== void 0 && n < e && u.push(n);
|
|
751
|
+
}
|
|
752
|
+
for (let n = e; n < t; n++) u.push(n);
|
|
753
|
+
let d = n.value.ssrRange?.start || 0, f = n.value.ssrRange?.colStart || 0, p = 0, m = 0;
|
|
754
|
+
!o.value && n.value.ssrRange && (m = R.value === "horizontal" ? 0 : i === null ? O.query(d) : d * (i + a), R.value === "horizontal" ? p = i === null ? D.query(f) : f * (i + s) : R.value === "both" && (p = k.query(f)));
|
|
755
|
+
let h = new Map(Qe.map((e) => [e.index, e])), g = -1, _ = 0, v = -1, y = 0, b = (e) => e === g + 1 ? (_ += D.get(g), g = e, _) : (_ = D.query(e), g = e, _), x = (e) => e === v + 1 ? (y += O.get(v), v = e, y) : (y = O.query(e), v = e, y), w = G.value + U.value + xe.value, T = q.value + W.value + Ce.value, E = G.value + U.value, ee = q.value + W.value, j = Ze.value;
|
|
756
|
+
for (let e of u) {
|
|
757
|
+
let t = n.value.items[e];
|
|
758
|
+
if (t === void 0) continue;
|
|
759
|
+
let { x: i, y: a, width: s, height: u } = calculateItemPosition({
|
|
760
|
+
index: e,
|
|
761
|
+
direction: R.value,
|
|
762
|
+
fixedSize: B.value,
|
|
763
|
+
gap: n.value.gap || 0,
|
|
764
|
+
columnGap: n.value.columnGap || 0,
|
|
765
|
+
usableWidth: Oe.value,
|
|
766
|
+
usableHeight: ke.value,
|
|
767
|
+
totalWidth: Ae.value.width,
|
|
768
|
+
queryY: x,
|
|
769
|
+
queryX: b,
|
|
770
|
+
getSizeY: (e) => O.get(e),
|
|
771
|
+
getSizeX: (e) => D.get(e),
|
|
772
|
+
columnRange: j
|
|
773
|
+
}), d = l.has(e), f = i, g = a, { isStickyActive: _, isStickyActiveX: v, isStickyActiveY: y, stickyOffset: k } = calculateStickyItem({
|
|
774
|
+
index: e,
|
|
775
|
+
isSticky: d,
|
|
776
|
+
direction: R.value,
|
|
777
|
+
relativeScrollX: Re.value,
|
|
778
|
+
relativeScrollY: ze.value,
|
|
779
|
+
originalX: f,
|
|
780
|
+
originalY: g,
|
|
781
|
+
width: s,
|
|
782
|
+
height: u,
|
|
783
|
+
stickyIndices: c,
|
|
784
|
+
fixedSize: B.value,
|
|
785
|
+
fixedWidth: V.value,
|
|
786
|
+
gap: n.value.gap || 0,
|
|
787
|
+
columnGap: n.value.columnGap || 0,
|
|
788
|
+
getItemQueryY: x,
|
|
789
|
+
getItemQueryX: b
|
|
790
|
+
}), A = o.value ? S.value / Z.value + (i + w - S.value) - E : i - p, M = o.value ? C.value / Q.value + (a + T - C.value) - ee : a - m, N = h.get(e);
|
|
791
|
+
N && N.item === t && N.offset.x === A && N.offset.y === M && N.size.width === s && N.size.height === u && N.isSticky === d && N.isStickyActive === _ && N.isStickyActiveX === v && N.isStickyActiveY === y && N.stickyOffset.x === k.x && N.stickyOffset.y === k.y ? r.push(N) : r.push({
|
|
792
|
+
item: t,
|
|
793
|
+
index: e,
|
|
794
|
+
offset: {
|
|
795
|
+
x: A,
|
|
796
|
+
y: M
|
|
797
|
+
},
|
|
798
|
+
size: {
|
|
799
|
+
width: s,
|
|
800
|
+
height: u
|
|
801
|
+
},
|
|
802
|
+
originalX: f,
|
|
803
|
+
originalY: g,
|
|
804
|
+
isSticky: d,
|
|
805
|
+
isStickyActive: _,
|
|
806
|
+
isStickyActiveX: v,
|
|
807
|
+
isStickyActiveY: y,
|
|
808
|
+
stickyOffset: k
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
return Qe = r, r;
|
|
812
|
+
}), et = computed(() => {
|
|
813
|
+
A.value;
|
|
814
|
+
let e = Re.value + U.value, t = ze.value + W.value, n = Re.value + (f.value - Te.value) - 1, o = ze.value + (p.value - Ee.value) - 1, s = Je(e), c = qe(t), l = qe(R.value === "horizontal" ? n : o), u = Je(n);
|
|
815
|
+
return {
|
|
816
|
+
items: $e.value,
|
|
817
|
+
currentIndex: c,
|
|
818
|
+
currentColIndex: s,
|
|
819
|
+
currentEndIndex: l,
|
|
820
|
+
currentEndColIndex: u,
|
|
821
|
+
scrollOffset: {
|
|
822
|
+
x: S.value,
|
|
823
|
+
y: C.value
|
|
824
|
+
},
|
|
825
|
+
displayScrollOffset: {
|
|
826
|
+
x: d.value ? Math.abs(r.value + y.x) : Math.max(0, r.value - y.x),
|
|
827
|
+
y: Math.max(0, i.value - y.y)
|
|
828
|
+
},
|
|
829
|
+
viewportSize: {
|
|
830
|
+
width: f.value,
|
|
831
|
+
height: p.value
|
|
832
|
+
},
|
|
833
|
+
displayViewportSize: {
|
|
834
|
+
width: f.value,
|
|
835
|
+
height: p.value
|
|
836
|
+
},
|
|
837
|
+
totalSize: {
|
|
838
|
+
width: J.value,
|
|
839
|
+
height: Y.value
|
|
840
|
+
},
|
|
841
|
+
isScrolling: a.value,
|
|
842
|
+
isProgrammaticScroll: x.value,
|
|
843
|
+
range: Ye.value,
|
|
844
|
+
columnRange: Ze.value
|
|
845
|
+
};
|
|
846
|
+
}), tt = () => {
|
|
847
|
+
x.value = !1, F.value = null;
|
|
848
|
+
}, nt = (e) => {
|
|
849
|
+
let t = e.target;
|
|
850
|
+
typeof window > "u" || (E(), t === window || t === document ? (r.value = window.scrollX, i.value = window.scrollY, f.value = document.documentElement.clientWidth, p.value = document.documentElement.clientHeight) : isScrollableElement(t) && (r.value = t.scrollLeft, i.value = t.scrollTop, f.value = t.clientWidth, p.value = t.clientHeight), S.value = displayToVirtual(d.value ? Math.abs(r.value) : r.value, X.x, Z.value), C.value = displayToVirtual(i.value, X.y, Q.value), a.value ||= (x.value || (F.value = null), !0), clearTimeout(b), b = setTimeout(() => {
|
|
851
|
+
a.value = !1, x.value = !1;
|
|
852
|
+
}, 250));
|
|
853
|
+
}, rt = (e) => {
|
|
854
|
+
let t = !1, r = 0, i = 0, a = n.value.gap || 0, o = n.value.columnGap || 0, s = Re.value, c = ze.value, l = qe(R.value === "horizontal" ? s : c), u = Je(s), d = R.value === "horizontal", f = R.value === "both", p = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set(), h = (e, i) => {
|
|
855
|
+
if (e >= 0 && e < (n.value.columnCount || 0) && !m.has(e)) {
|
|
856
|
+
m.add(e);
|
|
857
|
+
let n = k.get(e), a = i + o;
|
|
858
|
+
if (!j[e] || Math.abs(n - a) > .1) {
|
|
859
|
+
let i = a - n;
|
|
860
|
+
Math.abs(i) > .1 && (k.update(e, i), t = !0, e < u && (r += i)), j[e] = 1;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
};
|
|
864
|
+
for (let { index: s, inlineSize: c, blockSize: u, element: m } of e) {
|
|
865
|
+
if (c <= 0 && u <= 0) continue;
|
|
866
|
+
let e = z.value || typeof n.value.itemSize == "function";
|
|
867
|
+
if (s >= 0 && !p.has(s) && e && u > 0) {
|
|
868
|
+
if (p.add(s), d && c > 0) {
|
|
869
|
+
let e = D.get(s), n = c + o;
|
|
870
|
+
if (!M[s] || Math.abs(n - e) > .1) {
|
|
871
|
+
let i = n - e;
|
|
872
|
+
D.update(s, i), M[s] = 1, t = !0, s < l && (r += i);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
if (!d) {
|
|
876
|
+
let e = O.get(s), n = u + a;
|
|
877
|
+
if (!P[s] || Math.abs(n - e) > .1) {
|
|
878
|
+
let r = n - e;
|
|
879
|
+
O.update(s, r), P[s] = 1, t = !0, s < l && (i += r);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
let g = ue.value || typeof n.value.columnWidth == "function";
|
|
884
|
+
if (f && m && n.value.columnCount && g && (c > 0 || m.dataset.colIndex === void 0)) {
|
|
885
|
+
let e = m.dataset.colIndex;
|
|
886
|
+
if (e != null) h(Number.parseInt(e, 10), c);
|
|
887
|
+
else {
|
|
888
|
+
let e = Array.from(m.querySelectorAll("[data-col-index]"));
|
|
889
|
+
for (let t of e) h(Number.parseInt(t.dataset.colIndex, 10), t.getBoundingClientRect().width);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
if (t && (A.value++, !(F.value !== null || x.value) && (r !== 0 || i !== 0))) {
|
|
894
|
+
let e = G.value + U.value + xe.value, t = q.value + W.value + Ce.value;
|
|
895
|
+
Ue(r === 0 ? null : s + r + e, i === 0 ? null : c + i + t, { behavior: "auto" });
|
|
896
|
+
}
|
|
897
|
+
}, it = (e, t, n, r) => {
|
|
898
|
+
rt([{
|
|
899
|
+
index: e,
|
|
900
|
+
inlineSize: t,
|
|
901
|
+
blockSize: n,
|
|
902
|
+
element: r
|
|
903
|
+
}]);
|
|
904
|
+
};
|
|
905
|
+
function at() {
|
|
906
|
+
if (F.value && !c.value) {
|
|
907
|
+
let { rowIndex: e, colIndex: t, options: r } = F.value;
|
|
908
|
+
if (isScrollToIndexOptions(r) && r.behavior === "smooth" && a.value) return;
|
|
909
|
+
let i = n.value.container || window, o = typeof window < "u" && i === window ? window.scrollX : i.scrollLeft, s = typeof window < "u" && i === window ? window.scrollY : i.scrollTop, c = d.value ? Math.abs(o) : o, l = s, u = displayToVirtual(c, 0, Z.value), m = displayToVirtual(l, 0, Q.value), { targetX: h, targetY: g } = calculateScrollTarget({
|
|
910
|
+
rowIndex: e,
|
|
911
|
+
colIndex: t,
|
|
912
|
+
options: r,
|
|
913
|
+
direction: R.value,
|
|
914
|
+
viewportWidth: f.value,
|
|
915
|
+
viewportHeight: p.value,
|
|
916
|
+
totalWidth: Me.value,
|
|
917
|
+
totalHeight: Ne.value,
|
|
918
|
+
gap: n.value.gap || 0,
|
|
919
|
+
columnGap: n.value.columnGap || 0,
|
|
920
|
+
fixedSize: B.value,
|
|
921
|
+
fixedWidth: V.value,
|
|
922
|
+
relativeScrollX: u,
|
|
923
|
+
relativeScrollY: m,
|
|
924
|
+
getItemSizeY: (e) => O.get(e),
|
|
925
|
+
getItemSizeX: (e) => D.get(e),
|
|
926
|
+
getItemQueryY: (e) => O.query(e),
|
|
927
|
+
getItemQueryX: (e) => D.query(e),
|
|
928
|
+
getColumnSize: (e) => k.get(e),
|
|
929
|
+
getColumnQuery: (e) => k.query(e),
|
|
930
|
+
scaleX: Z.value,
|
|
931
|
+
scaleY: Q.value,
|
|
932
|
+
hostOffsetX: X.x,
|
|
933
|
+
hostOffsetY: X.y,
|
|
934
|
+
stickyIndices: ye.value,
|
|
935
|
+
stickyStartX: U.value,
|
|
936
|
+
stickyStartY: W.value,
|
|
937
|
+
stickyEndX: Te.value,
|
|
938
|
+
stickyEndY: Ee.value,
|
|
939
|
+
flowPaddingStartX: G.value,
|
|
940
|
+
flowPaddingStartY: q.value,
|
|
941
|
+
paddingStartX: xe.value,
|
|
942
|
+
paddingStartY: Ce.value,
|
|
943
|
+
paddingEndX: Se.value,
|
|
944
|
+
paddingEndY: we.value
|
|
945
|
+
}), _ = t == null || Math.abs(u - h) < 2, v = e == null || Math.abs(m - g) < 2, y = t == null || t === void 0 || j[t] === 1, b = e == null || e === void 0 || P[e] === 1;
|
|
946
|
+
_ && v ? y && b && !a.value && !x.value && (F.value = null) : He(e, t, isScrollToIndexOptions(r) ? {
|
|
947
|
+
...r,
|
|
948
|
+
isCorrection: !0
|
|
949
|
+
} : {
|
|
950
|
+
align: r,
|
|
951
|
+
isCorrection: !0
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
watch([
|
|
956
|
+
A,
|
|
957
|
+
f,
|
|
958
|
+
p
|
|
959
|
+
], at), watch(a, (e) => {
|
|
960
|
+
e || at();
|
|
961
|
+
});
|
|
962
|
+
let ot = null, st = null, ct, lt = (e) => {
|
|
963
|
+
if (typeof window > "u") return;
|
|
964
|
+
let t = e || window, n = t === window || isElement(t) && t === document.documentElement ? document : t;
|
|
965
|
+
if (n.addEventListener("scroll", nt, { passive: !0 }), T = null, E(), isElement(t) && (st = new MutationObserver(() => E()), st.observe(t, {
|
|
966
|
+
attributes: !0,
|
|
967
|
+
attributeFilter: ["dir", "style"]
|
|
968
|
+
})), ct = setInterval(E, 1e3), t === window) {
|
|
969
|
+
f.value = document.documentElement.clientWidth, p.value = document.documentElement.clientHeight, r.value = window.scrollX, i.value = window.scrollY;
|
|
970
|
+
let e = () => {
|
|
971
|
+
E(), f.value = document.documentElement.clientWidth, p.value = document.documentElement.clientHeight, Ke();
|
|
972
|
+
};
|
|
973
|
+
return window.addEventListener("resize", e), () => {
|
|
974
|
+
n.removeEventListener("scroll", nt), window.removeEventListener("resize", e), st?.disconnect(), clearInterval(ct), T = null;
|
|
975
|
+
};
|
|
976
|
+
} else return f.value = t.clientWidth, p.value = t.clientHeight, r.value = t.scrollLeft, i.value = t.scrollTop, ot = new ResizeObserver(() => {
|
|
977
|
+
E(), f.value = t.clientWidth, p.value = t.clientHeight, Ke();
|
|
978
|
+
}), ot.observe(t), () => {
|
|
979
|
+
n.removeEventListener("scroll", nt), ot?.disconnect(), st?.disconnect(), clearInterval(ct), T = null;
|
|
980
|
+
};
|
|
981
|
+
}, ut;
|
|
982
|
+
return getCurrentInstance() && (onMounted(() => {
|
|
983
|
+
l.value = !0, E(), watch(() => n.value.container, (e) => {
|
|
984
|
+
ut?.(), ut = lt(e || null);
|
|
985
|
+
}, { immediate: !0 }), Ke(), nextTick(() => {
|
|
986
|
+
if (Ke(), n.value.ssrRange || n.value.initialScrollIndex !== void 0) {
|
|
987
|
+
let e = n.value.initialScrollIndex === void 0 ? n.value.ssrRange?.start : n.value.initialScrollIndex, t = n.value.initialScrollAlign || "start";
|
|
988
|
+
e != null && He(e, n.value.ssrRange?.colStart, {
|
|
989
|
+
align: t,
|
|
990
|
+
behavior: "auto"
|
|
991
|
+
}), o.value = !0, c.value = !0, nextTick(() => {
|
|
992
|
+
c.value = !1;
|
|
993
|
+
});
|
|
994
|
+
} else o.value = !0;
|
|
995
|
+
});
|
|
996
|
+
}), onUnmounted(() => {
|
|
997
|
+
ut?.();
|
|
998
|
+
})), {
|
|
999
|
+
renderedItems: $e,
|
|
1000
|
+
totalWidth: J,
|
|
1001
|
+
totalHeight: Y,
|
|
1002
|
+
renderedWidth: Pe,
|
|
1003
|
+
renderedHeight: Fe,
|
|
1004
|
+
scrollDetails: et,
|
|
1005
|
+
getRowHeight: Ve,
|
|
1006
|
+
getColumnWidth: Be,
|
|
1007
|
+
getRowOffset: (e) => q.value + W.value + Ce.value + O.query(e),
|
|
1008
|
+
getColumnOffset: (e) => G.value + U.value + xe.value + k.query(e),
|
|
1009
|
+
getItemOffset: (e) => R.value === "horizontal" ? G.value + U.value + xe.value + D.query(e) : q.value + W.value + Ce.value + O.query(e),
|
|
1010
|
+
getItemSize: (e) => {
|
|
1011
|
+
if (R.value === "horizontal") return Math.max(0, D.get(e) - (n.value.columnGap || 0));
|
|
1012
|
+
let t = n.value.itemSize;
|
|
1013
|
+
if (typeof t == "number" && t > 0) return t;
|
|
1014
|
+
if (typeof t == "function") {
|
|
1015
|
+
let r = n.value.items[e];
|
|
1016
|
+
return r === void 0 ? n.value.defaultItemSize || 40 : t(r, e);
|
|
1017
|
+
}
|
|
1018
|
+
return Math.max(0, O.get(e) - (n.value.gap || 0));
|
|
1019
|
+
},
|
|
1020
|
+
scrollToIndex: He,
|
|
1021
|
+
scrollToOffset: Ue,
|
|
1022
|
+
stopProgrammaticScroll: tt,
|
|
1023
|
+
updateItemSize: it,
|
|
1024
|
+
updateItemSizes: rt,
|
|
1025
|
+
updateHostOffset: Ke,
|
|
1026
|
+
updateDirection: E,
|
|
1027
|
+
columnRange: Ze,
|
|
1028
|
+
refresh: () => {
|
|
1029
|
+
D.resize(0), O.resize(0), k.resize(0), j.fill(0), M.fill(0), P.fill(0), Ge();
|
|
1030
|
+
},
|
|
1031
|
+
isHydrated: o,
|
|
1032
|
+
isWindowContainer: je,
|
|
1033
|
+
isRtl: d,
|
|
1034
|
+
scaleX: Z,
|
|
1035
|
+
scaleY: Q,
|
|
1036
|
+
componentOffset: X,
|
|
1037
|
+
renderedVirtualWidth: Ie,
|
|
1038
|
+
renderedVirtualHeight: Le
|
|
1039
|
+
};
|
|
1472
1040
|
}
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
item: c.item,
|
|
2152
|
-
index: c.index,
|
|
2153
|
-
columnRange: Ge.value,
|
|
2154
|
-
getColumnWidth: tt(H),
|
|
2155
|
-
gap: t.gap,
|
|
2156
|
-
columnGap: t.columnGap,
|
|
2157
|
-
isSticky: c.isSticky,
|
|
2158
|
-
isStickyActive: c.isStickyActive
|
|
2159
|
-
}, void 0, !0),
|
|
2160
|
-
Yt.value ? (Ee(), It("div", Wl, " #" + Qt(c.index) + " (" + Qt(Math.round(c.offset.x)) + ", " + Qt(Math.round(c.offset.y)) + ") ", 1)) : et("", !0)
|
|
2161
|
-
]),
|
|
2162
|
-
_: 2
|
|
2163
|
-
}, 1032, ["data-index", "class", "style"]))), 128))
|
|
2164
|
-
]),
|
|
2165
|
-
_: 3
|
|
2166
|
-
}, 8, ["style"])),
|
|
2167
|
-
a.loading && d.loading ? (Ee(), It("div", {
|
|
2168
|
-
key: 2,
|
|
2169
|
-
class: "virtual-scroll-loading",
|
|
2170
|
-
style: gt(rt.value)
|
|
2171
|
-
}, [
|
|
2172
|
-
pt(n.$slots, "loading", {}, void 0, !0)
|
|
2173
|
-
], 4)) : et("", !0),
|
|
2174
|
-
d.footer ? (Ee(), Je(ht(Tt.value), {
|
|
2175
|
-
key: 3,
|
|
2176
|
-
ref_key: "footerRef",
|
|
2177
|
-
ref: z,
|
|
2178
|
-
class: Bt(["virtual-scroll-footer", { "virtual-scroll--sticky": a.stickyFooter }])
|
|
2179
|
-
}, {
|
|
2180
|
-
default: mt(() => [
|
|
2181
|
-
pt(n.$slots, "footer", {}, void 0, !0)
|
|
2182
|
-
]),
|
|
2183
|
-
_: 3
|
|
2184
|
-
}, 8, ["class"])) : et("", !0)
|
|
2185
|
-
]),
|
|
2186
|
-
_: 3
|
|
2187
|
-
}, 40, ["id", "class", "style"]));
|
|
2188
|
-
}
|
|
2189
|
-
}), Bl = (a, e) => {
|
|
2190
|
-
const i = a.__vccOpts || a;
|
|
2191
|
-
for (const [t, s] of e)
|
|
2192
|
-
i[t] = s;
|
|
2193
|
-
return i;
|
|
2194
|
-
}, Hl = /* @__PURE__ */ Bl(ql, [["__scopeId", "data-v-91b6ab6c"]]);
|
|
2195
|
-
export {
|
|
2196
|
-
bt as BROWSER_MAX_SIZE,
|
|
2197
|
-
cl as DEFAULT_BUFFER,
|
|
2198
|
-
Lt as DEFAULT_COLUMN_WIDTH,
|
|
2199
|
-
Dt as DEFAULT_ITEM_SIZE,
|
|
2200
|
-
Kt as FenwickTree,
|
|
2201
|
-
Hl as VirtualScroll,
|
|
2202
|
-
vl as VirtualScrollbar,
|
|
2203
|
-
Xl as calculateColumnRange,
|
|
2204
|
-
Yl as calculateItemPosition,
|
|
2205
|
-
El as calculateItemStyle,
|
|
2206
|
-
Rl as calculateRange,
|
|
2207
|
-
sl as calculateScrollTarget,
|
|
2208
|
-
Cl as calculateStickyItem,
|
|
2209
|
-
Tl as calculateTotalSize,
|
|
2210
|
-
ct as displayToVirtual,
|
|
2211
|
-
pl as findPrevStickyIndex,
|
|
2212
|
-
lt as getPaddingX,
|
|
2213
|
-
at as getPaddingY,
|
|
2214
|
-
Ml as isBody,
|
|
2215
|
-
Zt as isElement,
|
|
2216
|
-
Il as isItemVisible,
|
|
2217
|
-
yt as isScrollToIndexOptions,
|
|
2218
|
-
Jt as isScrollableElement,
|
|
2219
|
-
zl as isWindow,
|
|
2220
|
-
Pl as isWindowLike,
|
|
2221
|
-
Ol as useVirtualScroll,
|
|
2222
|
-
tl as useVirtualScrollbar,
|
|
2223
|
-
Ht as virtualToDisplay
|
|
2224
|
-
};
|
|
2225
|
-
//# sourceMappingURL=index.mjs.map
|
|
1041
|
+
function useVirtualScrollbar(e) {
|
|
1042
|
+
let n = computed(() => toValue(e.axis)), r = computed(() => toValue(e.totalSize)), i = computed(() => toValue(e.position)), a = computed(() => toValue(e.viewportSize)), o = computed(() => toValue(e.containerId)), c = computed(() => !!toValue(e.isRtl)), l = computed(() => n.value === "horizontal"), u = computed(() => r.value <= 0 ? 0 : Math.min(1, a.value / r.value)), d = computed(() => {
|
|
1043
|
+
let e = r.value - a.value;
|
|
1044
|
+
return e <= 0 ? 0 : Math.max(0, Math.min(1, i.value / e));
|
|
1045
|
+
}), f = computed(() => {
|
|
1046
|
+
let e = a.value > 0 ? 32 / a.value : .1;
|
|
1047
|
+
return Math.max(Math.min(e, .1), u.value) * 100;
|
|
1048
|
+
}), p = computed(() => d.value * (100 - f.value)), m = computed(() => l.value ? {
|
|
1049
|
+
inlineSize: `${f.value}%`,
|
|
1050
|
+
insetInlineStart: `${p.value}%`
|
|
1051
|
+
} : {
|
|
1052
|
+
blockSize: `${f.value}%`,
|
|
1053
|
+
insetBlockStart: `${p.value}%`
|
|
1054
|
+
}), g = computed(() => {
|
|
1055
|
+
let e = a.value, t = "var(--vs-scrollbar-has-cross-gap, var(--vsi-scrollbar-has-cross-gap, 0)) * var(--vs-scrollbar-cross-gap, var(--vsi-scrollbar-size, 8px))";
|
|
1056
|
+
return l.value ? { inlineSize: `calc(${Math.max(0, e - 4)}px - ${t})` } : { blockSize: `calc(${Math.max(0, e - 4)}px - ${t})` };
|
|
1057
|
+
}), _ = ref(!1), y = 0, b = 0;
|
|
1058
|
+
function x(t) {
|
|
1059
|
+
let n = t.currentTarget;
|
|
1060
|
+
if (t.target !== n) return;
|
|
1061
|
+
let i = n.getBoundingClientRect(), o = l.value ? i.width : i.height, s = 0;
|
|
1062
|
+
s = l.value ? c.value ? i.right - t.clientX : t.clientX - i.left : t.clientY - i.top;
|
|
1063
|
+
let u = f.value / 100 * o, d = (s - u / 2) / (o - u), p = r.value - a.value, m = d * p;
|
|
1064
|
+
m > p - 1 && (m = p), e.scrollToOffset(Math.max(0, Math.min(p, m)));
|
|
1065
|
+
}
|
|
1066
|
+
function S(e) {
|
|
1067
|
+
_.value = !0, y = l.value ? c.value ? -e.clientX : e.clientX : e.clientY, b = i.value, e.currentTarget.setPointerCapture(e.pointerId), e.preventDefault(), e.stopPropagation();
|
|
1068
|
+
}
|
|
1069
|
+
function C(t) {
|
|
1070
|
+
if (!_.value) return;
|
|
1071
|
+
let n = t.currentTarget.parentElement;
|
|
1072
|
+
if (!n) return;
|
|
1073
|
+
let i = (l.value ? c.value ? -t.clientX : t.clientX : t.clientY) - y, o = n.getBoundingClientRect(), s = l.value ? o.width : o.height, u = s - f.value / 100 * s;
|
|
1074
|
+
if (u <= 0) return;
|
|
1075
|
+
let d = r.value - a.value, p = b + i / u * d;
|
|
1076
|
+
p > d - 1 && (p = d), e.scrollToOffset(Math.max(0, Math.min(d, p)));
|
|
1077
|
+
}
|
|
1078
|
+
function T(e) {
|
|
1079
|
+
_.value && (_.value = !1, e.currentTarget.releasePointerCapture(e.pointerId));
|
|
1080
|
+
}
|
|
1081
|
+
return getCurrentInstance() && onUnmounted(() => {
|
|
1082
|
+
_.value = !1;
|
|
1083
|
+
}), {
|
|
1084
|
+
viewportPercent: u,
|
|
1085
|
+
positionPercent: d,
|
|
1086
|
+
thumbSizePercent: f,
|
|
1087
|
+
thumbPositionPercent: p,
|
|
1088
|
+
trackStyle: g,
|
|
1089
|
+
thumbStyle: m,
|
|
1090
|
+
trackProps: computed(() => ({
|
|
1091
|
+
class: ["virtual-scrollbar-track", `virtual-scrollbar-track--${l.value ? "horizontal" : "vertical"}`],
|
|
1092
|
+
style: g.value,
|
|
1093
|
+
role: "scrollbar",
|
|
1094
|
+
"aria-orientation": n.value,
|
|
1095
|
+
"aria-valuenow": Math.round(i.value),
|
|
1096
|
+
"aria-valuemin": 0,
|
|
1097
|
+
"aria-valuemax": Math.round(r.value - a.value),
|
|
1098
|
+
"aria-controls": o.value,
|
|
1099
|
+
tabindex: -1,
|
|
1100
|
+
onMousedown: x
|
|
1101
|
+
})),
|
|
1102
|
+
thumbProps: computed(() => ({
|
|
1103
|
+
class: [
|
|
1104
|
+
"virtual-scrollbar-thumb",
|
|
1105
|
+
`virtual-scrollbar-thumb--${l.value ? "horizontal" : "vertical"}`,
|
|
1106
|
+
{ "virtual-scrollbar-thumb--active": _.value }
|
|
1107
|
+
],
|
|
1108
|
+
style: m.value,
|
|
1109
|
+
onPointerdown: S,
|
|
1110
|
+
onPointermove: C,
|
|
1111
|
+
onPointerup: T,
|
|
1112
|
+
onPointercancel: T
|
|
1113
|
+
})),
|
|
1114
|
+
isDragging: _
|
|
1115
|
+
};
|
|
1116
|
+
}
|
|
1117
|
+
var VirtualScrollbar_default = /* @__PURE__ */ defineComponent({
|
|
1118
|
+
__name: "VirtualScrollbar",
|
|
1119
|
+
props: {
|
|
1120
|
+
axis: { default: "vertical" },
|
|
1121
|
+
totalSize: {},
|
|
1122
|
+
position: {},
|
|
1123
|
+
viewportSize: {},
|
|
1124
|
+
scrollToOffset: {},
|
|
1125
|
+
containerId: {},
|
|
1126
|
+
isRtl: {
|
|
1127
|
+
type: Boolean,
|
|
1128
|
+
default: !1
|
|
1129
|
+
}
|
|
1130
|
+
},
|
|
1131
|
+
emits: ["scrollToOffset"],
|
|
1132
|
+
setup(e, { emit: t }) {
|
|
1133
|
+
let n = e, r = t, { trackProps: o, thumbProps: s } = useVirtualScrollbar({
|
|
1134
|
+
axis: () => n.axis,
|
|
1135
|
+
totalSize: () => n.totalSize,
|
|
1136
|
+
position: () => n.position,
|
|
1137
|
+
viewportSize: () => n.viewportSize,
|
|
1138
|
+
containerId: () => n.containerId,
|
|
1139
|
+
isRtl: () => n.isRtl,
|
|
1140
|
+
scrollToOffset: (e) => {
|
|
1141
|
+
n.scrollToOffset?.(e), r("scrollToOffset", e);
|
|
1142
|
+
}
|
|
1143
|
+
});
|
|
1144
|
+
return (e, t) => (openBlock(), createElementBlock("div", normalizeProps(guardReactiveProps(unref(o))), [createElementVNode("div", normalizeProps(guardReactiveProps(unref(s))), null, 16)], 16));
|
|
1145
|
+
}
|
|
1146
|
+
}), _hoisted_1 = {
|
|
1147
|
+
key: 0,
|
|
1148
|
+
class: "virtual-scroll-scrollbar-container"
|
|
1149
|
+
}, _hoisted_2 = {
|
|
1150
|
+
key: 0,
|
|
1151
|
+
class: "virtual-scroll-debug-info"
|
|
1152
|
+
}, FRICTION = .95, MIN_VELOCITY = .1, VirtualScroll_default = /* @__PURE__ */ ((e, t) => {
|
|
1153
|
+
let n = e.__vccOpts || e;
|
|
1154
|
+
for (let [e, r] of t) n[e] = r;
|
|
1155
|
+
return n;
|
|
1156
|
+
})(/* @__PURE__ */ defineComponent({
|
|
1157
|
+
__name: "VirtualScroll",
|
|
1158
|
+
props: {
|
|
1159
|
+
containerTag: { default: "div" },
|
|
1160
|
+
wrapperTag: { default: "div" },
|
|
1161
|
+
itemTag: { default: "div" },
|
|
1162
|
+
stickyHeader: {
|
|
1163
|
+
type: Boolean,
|
|
1164
|
+
default: !1
|
|
1165
|
+
},
|
|
1166
|
+
stickyFooter: {
|
|
1167
|
+
type: Boolean,
|
|
1168
|
+
default: !1
|
|
1169
|
+
},
|
|
1170
|
+
virtualScrollbar: {
|
|
1171
|
+
type: Boolean,
|
|
1172
|
+
default: !1
|
|
1173
|
+
},
|
|
1174
|
+
items: {},
|
|
1175
|
+
itemSize: {},
|
|
1176
|
+
direction: { default: "vertical" },
|
|
1177
|
+
bufferBefore: { default: 5 },
|
|
1178
|
+
bufferAfter: { default: 5 },
|
|
1179
|
+
container: {},
|
|
1180
|
+
ssrRange: {},
|
|
1181
|
+
columnCount: { default: 0 },
|
|
1182
|
+
columnWidth: {},
|
|
1183
|
+
scrollPaddingStart: { default: 0 },
|
|
1184
|
+
scrollPaddingEnd: { default: 0 },
|
|
1185
|
+
gap: { default: 0 },
|
|
1186
|
+
columnGap: { default: 0 },
|
|
1187
|
+
stickyIndices: { default: () => [] },
|
|
1188
|
+
loadDistance: { default: 200 },
|
|
1189
|
+
loading: {
|
|
1190
|
+
type: Boolean,
|
|
1191
|
+
default: !1
|
|
1192
|
+
},
|
|
1193
|
+
restoreScrollOnPrepend: {
|
|
1194
|
+
type: Boolean,
|
|
1195
|
+
default: !1
|
|
1196
|
+
},
|
|
1197
|
+
initialScrollIndex: {},
|
|
1198
|
+
initialScrollAlign: {},
|
|
1199
|
+
defaultItemSize: {},
|
|
1200
|
+
defaultColumnWidth: {},
|
|
1201
|
+
debug: {
|
|
1202
|
+
type: Boolean,
|
|
1203
|
+
default: !1
|
|
1204
|
+
}
|
|
1205
|
+
},
|
|
1206
|
+
emits: [
|
|
1207
|
+
"scroll",
|
|
1208
|
+
"load",
|
|
1209
|
+
"visibleRangeChange"
|
|
1210
|
+
],
|
|
1211
|
+
setup(o, { expose: s, emit: c }) {
|
|
1212
|
+
let _ = o, w = c, k = useSlots(), A = ref(null), j = ref(null), M = ref(null), N = ref(null), te = /* @__PURE__ */ new Map(), P = useId(), F = computed(() => `vs-container-${P}`), ne = ref(0), re = ref(0), ie = computed(() => _.container === void 0 ? A.value : _.container), ae = computed(() => {
|
|
1213
|
+
let e = ie.value;
|
|
1214
|
+
return e === A.value || typeof window < "u" && (e === window || e === null);
|
|
1215
|
+
}), I = computed(() => (_.items.length, {
|
|
1216
|
+
items: _.items,
|
|
1217
|
+
itemSize: _.itemSize,
|
|
1218
|
+
direction: _.direction,
|
|
1219
|
+
bufferBefore: _.bufferBefore,
|
|
1220
|
+
bufferAfter: _.bufferAfter,
|
|
1221
|
+
container: ie.value,
|
|
1222
|
+
hostElement: j.value,
|
|
1223
|
+
hostRef: A.value,
|
|
1224
|
+
ssrRange: _.ssrRange,
|
|
1225
|
+
columnCount: _.columnCount,
|
|
1226
|
+
columnWidth: _.columnWidth,
|
|
1227
|
+
scrollPaddingStart: {
|
|
1228
|
+
x: getPaddingX(_.scrollPaddingStart, _.direction),
|
|
1229
|
+
y: getPaddingY(_.scrollPaddingStart, _.direction)
|
|
1230
|
+
},
|
|
1231
|
+
scrollPaddingEnd: {
|
|
1232
|
+
x: getPaddingX(_.scrollPaddingEnd, _.direction),
|
|
1233
|
+
y: getPaddingY(_.scrollPaddingEnd, _.direction)
|
|
1234
|
+
},
|
|
1235
|
+
flowPaddingStart: {
|
|
1236
|
+
x: 0,
|
|
1237
|
+
y: _.stickyHeader ? 0 : ne.value
|
|
1238
|
+
},
|
|
1239
|
+
flowPaddingEnd: {
|
|
1240
|
+
x: 0,
|
|
1241
|
+
y: _.stickyFooter ? 0 : re.value
|
|
1242
|
+
},
|
|
1243
|
+
stickyStart: {
|
|
1244
|
+
x: 0,
|
|
1245
|
+
y: _.stickyHeader && ae.value ? ne.value : 0
|
|
1246
|
+
},
|
|
1247
|
+
stickyEnd: {
|
|
1248
|
+
x: 0,
|
|
1249
|
+
y: _.stickyFooter && ae.value ? re.value : 0
|
|
1250
|
+
},
|
|
1251
|
+
gap: _.gap,
|
|
1252
|
+
columnGap: _.columnGap,
|
|
1253
|
+
stickyIndices: _.stickyIndices,
|
|
1254
|
+
loadDistance: _.loadDistance,
|
|
1255
|
+
loading: _.loading,
|
|
1256
|
+
restoreScrollOnPrepend: _.restoreScrollOnPrepend,
|
|
1257
|
+
initialScrollIndex: _.initialScrollIndex,
|
|
1258
|
+
initialScrollAlign: _.initialScrollAlign,
|
|
1259
|
+
defaultItemSize: _.defaultItemSize,
|
|
1260
|
+
defaultColumnWidth: _.defaultColumnWidth,
|
|
1261
|
+
debug: _.debug
|
|
1262
|
+
})), { isHydrated: ce, isRtl: L, columnRange: le, renderedItems: R, scrollDetails: z, renderedHeight: ue, renderedWidth: B, getColumnWidth: V, getRowHeight: fe, scrollToIndex: H, scrollToOffset: pe, updateHostOffset: me, updateItemSizes: he, updateDirection: ge, getItemOffset: ve, getRowOffset: Te, getColumnOffset: W, getItemSize: Ee, refresh: G, stopProgrammaticScroll: K, scaleX: q, scaleY: De, isWindowContainer: Oe, componentOffset: ke, renderedVirtualWidth: Ae, renderedVirtualHeight: je } = useVirtualScroll(I), Me = computed(() => q.value !== 1 || De.value !== 1), Ne = computed(() => Oe.value ? !1 : _.virtualScrollbar === !0 || q.value !== 1 || De.value !== 1);
|
|
1263
|
+
function J(e) {
|
|
1264
|
+
let { displayViewportSize: t } = z.value;
|
|
1265
|
+
e >= ue.value - t.height - .5 ? pe(null, Infinity) : pe(null, displayToVirtual(e, ke.y, De.value));
|
|
1266
|
+
}
|
|
1267
|
+
function Y(e) {
|
|
1268
|
+
let { displayViewportSize: t } = z.value;
|
|
1269
|
+
e >= B.value - t.width - .5 ? pe(Infinity, null) : pe(displayToVirtual(e, ke.x, q.value), null);
|
|
1270
|
+
}
|
|
1271
|
+
let X = useVirtualScrollbar({
|
|
1272
|
+
axis: "vertical",
|
|
1273
|
+
totalSize: ue,
|
|
1274
|
+
position: computed(() => z.value.displayScrollOffset.y),
|
|
1275
|
+
viewportSize: computed(() => z.value.displayViewportSize.height),
|
|
1276
|
+
scrollToOffset: J,
|
|
1277
|
+
containerId: F,
|
|
1278
|
+
isRtl: L
|
|
1279
|
+
}), Pe = useVirtualScrollbar({
|
|
1280
|
+
axis: "horizontal",
|
|
1281
|
+
totalSize: B,
|
|
1282
|
+
position: computed(() => z.value.displayScrollOffset.x),
|
|
1283
|
+
viewportSize: computed(() => z.value.displayViewportSize.width),
|
|
1284
|
+
scrollToOffset: Y,
|
|
1285
|
+
containerId: F,
|
|
1286
|
+
isRtl: L
|
|
1287
|
+
}), Fe = computed(() => _.direction === "both" ? {
|
|
1288
|
+
...le.value,
|
|
1289
|
+
padStart: 0,
|
|
1290
|
+
padEnd: 0
|
|
1291
|
+
} : le.value);
|
|
1292
|
+
function Ie() {
|
|
1293
|
+
G(), ge(), nextTick(() => {
|
|
1294
|
+
let e = [];
|
|
1295
|
+
for (let [t, n] of te.entries()) n && e.push({
|
|
1296
|
+
index: t,
|
|
1297
|
+
inlineSize: n.offsetWidth,
|
|
1298
|
+
blockSize: n.offsetHeight,
|
|
1299
|
+
element: n
|
|
1300
|
+
});
|
|
1301
|
+
e.length > 0 && he(e);
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1304
|
+
watch(z, (e, t) => {
|
|
1305
|
+
!ce.value || !e || (w("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) && w("visibleRangeChange", {
|
|
1306
|
+
start: e.range.start,
|
|
1307
|
+
end: e.range.end,
|
|
1308
|
+
colStart: e.columnRange.start,
|
|
1309
|
+
colEnd: e.columnRange.end
|
|
1310
|
+
}), !_.loading && (_.direction !== "horizontal" && e.totalSize && e.totalSize.height - (e.scrollOffset.y + e.viewportSize.height) <= _.loadDistance && w("load", "vertical"), _.direction !== "vertical" && e.totalSize && e.totalSize.width - (e.scrollOffset.x + e.viewportSize.width) <= _.loadDistance && w("load", "horizontal")));
|
|
1311
|
+
}), watch(ce, (e) => {
|
|
1312
|
+
e && z.value?.range && z.value?.columnRange && w("visibleRangeChange", {
|
|
1313
|
+
start: z.value.range.start,
|
|
1314
|
+
end: z.value.range.end,
|
|
1315
|
+
colStart: z.value.columnRange.start,
|
|
1316
|
+
colEnd: z.value.columnRange.end
|
|
1317
|
+
});
|
|
1318
|
+
}, { once: !0 });
|
|
1319
|
+
let Le = typeof window > "u" ? null : new ResizeObserver(me), Z = typeof window > "u" ? null : new ResizeObserver((e) => {
|
|
1320
|
+
let t = [];
|
|
1321
|
+
for (let n of e) {
|
|
1322
|
+
let e = n.target, r = Number(e.dataset.index), i = e.dataset.colIndex, a = n.contentRect.width, o = n.contentRect.height;
|
|
1323
|
+
n.borderBoxSize && n.borderBoxSize.length > 0 ? (a = n.borderBoxSize[0].inlineSize, o = n.borderBoxSize[0].blockSize) : (a = e.offsetWidth, o = e.offsetHeight), i === void 0 ? Number.isNaN(r) || t.push({
|
|
1324
|
+
index: r,
|
|
1325
|
+
inlineSize: a,
|
|
1326
|
+
blockSize: o,
|
|
1327
|
+
element: e
|
|
1328
|
+
}) : t.push({
|
|
1329
|
+
index: -1,
|
|
1330
|
+
inlineSize: a,
|
|
1331
|
+
blockSize: o,
|
|
1332
|
+
element: e
|
|
1333
|
+
});
|
|
1334
|
+
}
|
|
1335
|
+
t.length > 0 && he(t);
|
|
1336
|
+
}), Q = typeof window > "u" ? null : new ResizeObserver(() => {
|
|
1337
|
+
ne.value = M.value?.offsetHeight || 0, re.value = N.value?.offsetHeight || 0, me();
|
|
1338
|
+
});
|
|
1339
|
+
function Re(e, t) {
|
|
1340
|
+
watch(e, (e, n) => {
|
|
1341
|
+
n && Q?.unobserve(n), e ? Q?.observe(e) : t.value = 0;
|
|
1342
|
+
}, { immediate: !0 });
|
|
1343
|
+
}
|
|
1344
|
+
Re(M, ne), Re(N, re), onMounted(() => {
|
|
1345
|
+
A.value && Le?.observe(A.value);
|
|
1346
|
+
for (let e of te.values()) Z?.observe(e), _.direction === "both" && e.querySelectorAll("[data-col-index]").forEach((e) => Z?.observe(e));
|
|
1347
|
+
}), watch([A, j], ([e], [t]) => {
|
|
1348
|
+
t && Le?.unobserve(t), e && Le?.observe(e);
|
|
1349
|
+
}), watch([A, Me], ([e, t], [n, r]) => {
|
|
1350
|
+
let i = e !== n || t !== r;
|
|
1351
|
+
n && i && n.removeEventListener("wheel", Ze), e && i && e.addEventListener("wheel", Ze, { passive: !t });
|
|
1352
|
+
}, { immediate: !0 });
|
|
1353
|
+
function ze(e, t) {
|
|
1354
|
+
if (e) te.set(t, e), Z?.observe(e), _.direction === "both" && e.querySelectorAll("[data-col-index]").forEach((e) => Z?.observe(e));
|
|
1355
|
+
else {
|
|
1356
|
+
let e = te.get(t);
|
|
1357
|
+
e && (Z?.unobserve(e), _.direction === "both" && e.querySelectorAll("[data-col-index]").forEach((e) => Z?.unobserve(e)), te.delete(t));
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
let Be = ref(!1), Ve = {
|
|
1361
|
+
x: 0,
|
|
1362
|
+
y: 0
|
|
1363
|
+
}, He = {
|
|
1364
|
+
x: 0,
|
|
1365
|
+
y: 0
|
|
1366
|
+
}, Ue = {
|
|
1367
|
+
x: 0,
|
|
1368
|
+
y: 0
|
|
1369
|
+
}, We = 0, $ = {
|
|
1370
|
+
x: 0,
|
|
1371
|
+
y: 0
|
|
1372
|
+
}, Ge = null;
|
|
1373
|
+
function Ke() {
|
|
1374
|
+
let e = () => {
|
|
1375
|
+
$.x *= FRICTION, $.y *= FRICTION;
|
|
1376
|
+
let t = z.value.scrollOffset.x, n = z.value.scrollOffset.y;
|
|
1377
|
+
pe(t + $.x * 16, n + $.y * 16, { behavior: "auto" }), Math.abs($.x) > MIN_VELOCITY || Math.abs($.y) > MIN_VELOCITY ? Ge = requestAnimationFrame(e) : qe();
|
|
1378
|
+
};
|
|
1379
|
+
Ge = requestAnimationFrame(e);
|
|
1380
|
+
}
|
|
1381
|
+
function qe() {
|
|
1382
|
+
Ge !== null && (cancelAnimationFrame(Ge), Ge = null), $ = {
|
|
1383
|
+
x: 0,
|
|
1384
|
+
y: 0
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
function Je(e) {
|
|
1388
|
+
K(), qe(), Me.value && (e.pointerType === "mouse" && e.button !== 0 || (Be.value = !0, Ve = {
|
|
1389
|
+
x: e.clientX,
|
|
1390
|
+
y: e.clientY
|
|
1391
|
+
}, Ue = {
|
|
1392
|
+
x: e.clientX,
|
|
1393
|
+
y: e.clientY
|
|
1394
|
+
}, We = performance.now(), He = {
|
|
1395
|
+
x: z.value.scrollOffset.x,
|
|
1396
|
+
y: z.value.scrollOffset.y
|
|
1397
|
+
}, e.currentTarget.setPointerCapture(e.pointerId)));
|
|
1398
|
+
}
|
|
1399
|
+
function Ye(e) {
|
|
1400
|
+
if (!Be.value) return;
|
|
1401
|
+
let t = performance.now(), n = t - We;
|
|
1402
|
+
if (n > 0) {
|
|
1403
|
+
let t = (Ue.x - e.clientX) / n, r = (Ue.y - e.clientY) / n;
|
|
1404
|
+
$.x = $.x * .2 + t * .8, $.y = $.y * .2 + r * .8;
|
|
1405
|
+
}
|
|
1406
|
+
Ue = {
|
|
1407
|
+
x: e.clientX,
|
|
1408
|
+
y: e.clientY
|
|
1409
|
+
}, We = t;
|
|
1410
|
+
let r = Ve.x - e.clientX, i = Ve.y - e.clientY;
|
|
1411
|
+
requestAnimationFrame(() => {
|
|
1412
|
+
pe(He.x + r, He.y + i, { behavior: "auto" });
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1415
|
+
function Xe(e) {
|
|
1416
|
+
Be.value && (Be.value = !1, e.currentTarget.releasePointerCapture(e.pointerId), (Math.abs($.x) > MIN_VELOCITY || Math.abs($.y) > MIN_VELOCITY) && (Math.abs($.x) > 4 * Math.abs($.y) ? $.y = 0 : Math.abs($.y) > 4 * Math.abs($.x) && ($.x = 0), Ke()));
|
|
1417
|
+
}
|
|
1418
|
+
function Ze(e) {
|
|
1419
|
+
let { scrollOffset: t } = z.value;
|
|
1420
|
+
if (K(), Me.value) {
|
|
1421
|
+
e.preventDefault();
|
|
1422
|
+
let n = e.deltaX, r = e.deltaY;
|
|
1423
|
+
e.shiftKey && n === 0 && (n = r, r = 0), pe(t.x + n, t.y + r, { behavior: "auto" });
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
function Qe(e) {
|
|
1427
|
+
let { viewportSize: t, scrollOffset: n } = z.value, r = _.direction !== "vertical", i = _.direction !== "horizontal", a = I.value.stickyStart, o = I.value.stickyEnd;
|
|
1428
|
+
switch (e.key) {
|
|
1429
|
+
case "Home":
|
|
1430
|
+
e.preventDefault(), K(), H(0, 0, {
|
|
1431
|
+
behavior: Math.max(n.x, n.y) > 10 * (_.direction === "horizontal" ? t.width : t.height) ? "auto" : "smooth",
|
|
1432
|
+
align: "start"
|
|
1433
|
+
});
|
|
1434
|
+
break;
|
|
1435
|
+
case "End": {
|
|
1436
|
+
e.preventDefault(), K();
|
|
1437
|
+
let r = _.items.length - 1, i = (_.columnCount || 0) > 0 ? _.columnCount - 1 : 0, { totalSize: a } = z.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";
|
|
1438
|
+
_.direction === "both" ? H(r, i, {
|
|
1439
|
+
behavior: o,
|
|
1440
|
+
align: "end"
|
|
1441
|
+
}) : H(_.direction === "vertical" ? r : 0, _.direction === "horizontal" ? r : 0, {
|
|
1442
|
+
behavior: o,
|
|
1443
|
+
align: "end"
|
|
1444
|
+
});
|
|
1445
|
+
break;
|
|
1446
|
+
}
|
|
1447
|
+
case "ArrowUp": {
|
|
1448
|
+
if (e.preventDefault(), K(), !i) return;
|
|
1449
|
+
let { currentIndex: t, scrollOffset: n } = z.value, r = n.y + a.y + I.value.scrollPaddingStart.y;
|
|
1450
|
+
Te(t) < r - 1 ? H(t, null, { align: "start" }) : t > 0 && H(t - 1, null, { align: "start" });
|
|
1451
|
+
break;
|
|
1452
|
+
}
|
|
1453
|
+
case "ArrowDown": {
|
|
1454
|
+
if (e.preventDefault(), K(), !i) return;
|
|
1455
|
+
let { currentEndIndex: r } = z.value, a = n.y + t.height - (o.y + I.value.scrollPaddingEnd.y);
|
|
1456
|
+
Te(r) + fe(r) > a + 1 ? H(r, null, { align: "end" }) : r < _.items.length - 1 && H(r + 1, null, { align: "end" });
|
|
1457
|
+
break;
|
|
1458
|
+
}
|
|
1459
|
+
case "ArrowLeft": {
|
|
1460
|
+
if (e.preventDefault(), K(), !r) return;
|
|
1461
|
+
let { currentColIndex: i, currentEndColIndex: s } = z.value;
|
|
1462
|
+
if (L.value) {
|
|
1463
|
+
let e = n.x + t.width - (o.x + I.value.scrollPaddingEnd.x);
|
|
1464
|
+
(_.columnCount ? W(s) + V(s) : ve(s) + Ee(s)) > e + 1 ? H(null, s, { align: "end" }) : s < (_.columnCount ? _.columnCount - 1 : _.items.length - 1) && H(null, s + 1, { align: "end" });
|
|
1465
|
+
} else {
|
|
1466
|
+
let e = n.x + a.x + I.value.scrollPaddingStart.x;
|
|
1467
|
+
(_.columnCount ? W(i) : ve(i)) < e - 1 ? H(null, i, { align: "start" }) : i > 0 && H(null, i - 1, { align: "start" });
|
|
1468
|
+
}
|
|
1469
|
+
break;
|
|
1470
|
+
}
|
|
1471
|
+
case "ArrowRight": {
|
|
1472
|
+
if (e.preventDefault(), K(), !r) return;
|
|
1473
|
+
let { currentColIndex: i, currentEndColIndex: s } = z.value;
|
|
1474
|
+
if (L.value) {
|
|
1475
|
+
let e = n.x + a.x + I.value.scrollPaddingStart.x;
|
|
1476
|
+
(_.columnCount ? W(i) : ve(i)) < e - 1 ? H(null, i, { align: "start" }) : i > 0 && H(null, i - 1, { align: "start" });
|
|
1477
|
+
} else {
|
|
1478
|
+
let e = n.x + t.width - (o.x + I.value.scrollPaddingEnd.x);
|
|
1479
|
+
(_.columnCount ? W(s) + V(s) : ve(s) + Ee(s)) > e + 1 ? H(null, s, { align: "end" }) : s < (_.columnCount ? _.columnCount - 1 : _.items.length - 1) && H(null, s + 1, { align: "end" });
|
|
1480
|
+
}
|
|
1481
|
+
break;
|
|
1482
|
+
}
|
|
1483
|
+
case "PageUp":
|
|
1484
|
+
e.preventDefault(), K(), pe(!i && r ? n.x - t.width : null, i ? n.y - t.height : null);
|
|
1485
|
+
break;
|
|
1486
|
+
case "PageDown":
|
|
1487
|
+
e.preventDefault(), K(), pe(!i && r ? n.x + t.width : null, i ? n.y + t.height : null);
|
|
1488
|
+
break;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
onUnmounted(() => {
|
|
1492
|
+
Le?.disconnect(), Z?.disconnect(), Q?.disconnect();
|
|
1493
|
+
});
|
|
1494
|
+
let $e = computed(() => {
|
|
1495
|
+
let e = { ..._.direction === "vertical" ? {} : { whiteSpace: "nowrap" } };
|
|
1496
|
+
return (Ne.value || !Oe.value) && (e.overflow = "auto"), Me.value && (e.touchAction = "none"), Oe.value ? e : _.containerTag === "table" ? {
|
|
1497
|
+
...e,
|
|
1498
|
+
display: "block",
|
|
1499
|
+
minInlineSize: _.direction === "vertical" ? "100%" : "auto"
|
|
1500
|
+
} : e;
|
|
1501
|
+
}), et = computed(() => {
|
|
1502
|
+
if (_.direction === "horizontal") return null;
|
|
1503
|
+
let { displayViewportSize: e, displayScrollOffset: t } = z.value;
|
|
1504
|
+
if (ue.value <= e.height) return null;
|
|
1505
|
+
let n = {
|
|
1506
|
+
axis: "vertical",
|
|
1507
|
+
totalSize: ue.value,
|
|
1508
|
+
position: t.y,
|
|
1509
|
+
viewportSize: e.height,
|
|
1510
|
+
scrollToOffset: J,
|
|
1511
|
+
containerId: F.value,
|
|
1512
|
+
isRtl: L.value
|
|
1513
|
+
};
|
|
1514
|
+
return {
|
|
1515
|
+
axis: "vertical",
|
|
1516
|
+
positionPercent: X.positionPercent.value,
|
|
1517
|
+
viewportPercent: X.viewportPercent.value,
|
|
1518
|
+
thumbSizePercent: X.thumbSizePercent.value,
|
|
1519
|
+
thumbPositionPercent: X.thumbPositionPercent.value,
|
|
1520
|
+
trackProps: X.trackProps.value,
|
|
1521
|
+
thumbProps: X.thumbProps.value,
|
|
1522
|
+
scrollbarProps: n,
|
|
1523
|
+
isDragging: X.isDragging.value
|
|
1524
|
+
};
|
|
1525
|
+
}), tt = computed(() => {
|
|
1526
|
+
if (_.direction === "vertical") return null;
|
|
1527
|
+
let { displayViewportSize: e, displayScrollOffset: t } = z.value;
|
|
1528
|
+
if (B.value <= e.width) return null;
|
|
1529
|
+
let n = {
|
|
1530
|
+
axis: "horizontal",
|
|
1531
|
+
totalSize: B.value,
|
|
1532
|
+
position: t.x,
|
|
1533
|
+
viewportSize: e.width,
|
|
1534
|
+
scrollToOffset: Y,
|
|
1535
|
+
containerId: F.value,
|
|
1536
|
+
isRtl: L.value
|
|
1537
|
+
};
|
|
1538
|
+
return {
|
|
1539
|
+
axis: "horizontal",
|
|
1540
|
+
positionPercent: Pe.positionPercent.value,
|
|
1541
|
+
viewportPercent: Pe.viewportPercent.value,
|
|
1542
|
+
thumbSizePercent: Pe.thumbSizePercent.value,
|
|
1543
|
+
thumbPositionPercent: Pe.thumbPositionPercent.value,
|
|
1544
|
+
trackProps: Pe.trackProps.value,
|
|
1545
|
+
thumbProps: Pe.thumbProps.value,
|
|
1546
|
+
scrollbarProps: n,
|
|
1547
|
+
isDragging: Pe.isDragging.value
|
|
1548
|
+
};
|
|
1549
|
+
}), nt = computed(() => {
|
|
1550
|
+
let e = _.direction === "horizontal", t = _.direction === "vertical", n = _.direction === "both", r = {
|
|
1551
|
+
inlineSize: t ? "100%" : `${Ae.value}px`,
|
|
1552
|
+
blockSize: e ? "100%" : `${je.value}px`
|
|
1553
|
+
};
|
|
1554
|
+
return ce.value || (r.display = "flex", r.flexDirection = e ? "row" : "column", (e || n) && _.columnGap && (r.columnGap = `${_.columnGap}px`), (t || n) && _.gap && (r.rowGap = `${_.gap}px`)), r;
|
|
1555
|
+
}), rt = computed(() => {
|
|
1556
|
+
let e = _.direction === "horizontal";
|
|
1557
|
+
return {
|
|
1558
|
+
display: e ? "inline-block" : "block",
|
|
1559
|
+
...e ? {
|
|
1560
|
+
blockSize: "100%",
|
|
1561
|
+
verticalAlign: "top"
|
|
1562
|
+
} : { inlineSize: "100%" }
|
|
1563
|
+
};
|
|
1564
|
+
}), it = computed(() => ({
|
|
1565
|
+
inlineSize: _.direction === "vertical" ? "1px" : `${Ae.value}px`,
|
|
1566
|
+
blockSize: _.direction === "horizontal" ? "1px" : `${je.value}px`
|
|
1567
|
+
}));
|
|
1568
|
+
function at(e) {
|
|
1569
|
+
let t = calculateItemStyle({
|
|
1570
|
+
containerTag: _.containerTag || "div",
|
|
1571
|
+
direction: _.direction,
|
|
1572
|
+
isHydrated: ce.value,
|
|
1573
|
+
item: e,
|
|
1574
|
+
itemSize: _.itemSize,
|
|
1575
|
+
paddingStartX: I.value.scrollPaddingStart.x,
|
|
1576
|
+
paddingStartY: I.value.scrollPaddingStart.y,
|
|
1577
|
+
isRtl: L.value
|
|
1578
|
+
});
|
|
1579
|
+
return !ce.value && _.direction === "both" && (t.display = "flex", _.columnGap && (t.columnGap = `${_.columnGap}px`)), t;
|
|
1580
|
+
}
|
|
1581
|
+
let ot = computed(() => _.debug), st = computed(() => _.containerTag === "table"), ct = computed(() => st.value ? "thead" : "div"), lt = computed(() => st.value ? "tfoot" : "div");
|
|
1582
|
+
return s({
|
|
1583
|
+
...toRefs(_),
|
|
1584
|
+
scrollDetails: z,
|
|
1585
|
+
columnRange: le,
|
|
1586
|
+
getColumnWidth: V,
|
|
1587
|
+
getRowHeight: fe,
|
|
1588
|
+
getRowOffset: Te,
|
|
1589
|
+
getColumnOffset: W,
|
|
1590
|
+
getItemOffset: ve,
|
|
1591
|
+
getItemSize: Ee,
|
|
1592
|
+
scrollToIndex: H,
|
|
1593
|
+
scrollToOffset: pe,
|
|
1594
|
+
refresh: Ie,
|
|
1595
|
+
stopProgrammaticScroll: () => {
|
|
1596
|
+
K(), qe();
|
|
1597
|
+
},
|
|
1598
|
+
updateDirection: ge,
|
|
1599
|
+
isRtl: L,
|
|
1600
|
+
isHydrated: ce,
|
|
1601
|
+
scaleX: q,
|
|
1602
|
+
scaleY: De,
|
|
1603
|
+
renderedWidth: B,
|
|
1604
|
+
renderedHeight: ue,
|
|
1605
|
+
componentOffset: ke,
|
|
1606
|
+
scrollbarPropsVertical: et,
|
|
1607
|
+
scrollbarPropsHorizontal: tt
|
|
1608
|
+
}), (t, s) => (openBlock(), createBlock(resolveDynamicComponent(o.containerTag), {
|
|
1609
|
+
id: F.value,
|
|
1610
|
+
ref_key: "hostRef",
|
|
1611
|
+
ref: A,
|
|
1612
|
+
class: normalizeClass(["virtual-scroll-container", [`virtual-scroll--${o.direction}`, {
|
|
1613
|
+
"virtual-scroll--hydrated": unref(ce),
|
|
1614
|
+
"virtual-scroll--window": unref(Oe),
|
|
1615
|
+
"virtual-scroll--table": st.value,
|
|
1616
|
+
"virtual-scroll--hide-scrollbar": Ne.value
|
|
1617
|
+
}]]),
|
|
1618
|
+
style: normalizeStyle($e.value),
|
|
1619
|
+
tabindex: "0",
|
|
1620
|
+
onKeydown: Qe,
|
|
1621
|
+
onPointerdown: Je,
|
|
1622
|
+
onPointermove: Ye,
|
|
1623
|
+
onPointerup: Xe,
|
|
1624
|
+
onPointercancel: Xe
|
|
1625
|
+
}, {
|
|
1626
|
+
default: withCtx(() => [
|
|
1627
|
+
Ne.value ? (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", {
|
|
1628
|
+
class: "virtual-scroll-scrollbar-viewport",
|
|
1629
|
+
style: normalizeStyle({
|
|
1630
|
+
inlineSize: `${unref(z).displayViewportSize.width}px`,
|
|
1631
|
+
blockSize: `${unref(z).displayViewportSize.height}px`,
|
|
1632
|
+
"--vsi-scrollbar-has-cross-gap": o.direction === "both" ? 1 : 0
|
|
1633
|
+
})
|
|
1634
|
+
}, [k.scrollbar && et.value ? renderSlot(t.$slots, "scrollbar", normalizeProps(mergeProps({ key: 0 }, et.value)), void 0, !0) : et.value ? (openBlock(), createBlock(VirtualScrollbar_default, normalizeProps(mergeProps({ key: 1 }, et.value.scrollbarProps)), null, 16)) : createCommentVNode("", !0), k.scrollbar && tt.value ? renderSlot(t.$slots, "scrollbar", normalizeProps(mergeProps({ key: 2 }, tt.value)), void 0, !0) : tt.value ? (openBlock(), createBlock(VirtualScrollbar_default, normalizeProps(mergeProps({ key: 3 }, tt.value.scrollbarProps)), null, 16)) : createCommentVNode("", !0)], 4)])) : createCommentVNode("", !0),
|
|
1635
|
+
k.header ? (openBlock(), createBlock(resolveDynamicComponent(ct.value), {
|
|
1636
|
+
key: 1,
|
|
1637
|
+
ref_key: "headerRef",
|
|
1638
|
+
ref: M,
|
|
1639
|
+
class: normalizeClass(["virtual-scroll-header", { "virtual-scroll--sticky": o.stickyHeader }])
|
|
1640
|
+
}, {
|
|
1641
|
+
default: withCtx(() => [renderSlot(t.$slots, "header", {}, void 0, !0)]),
|
|
1642
|
+
_: 3
|
|
1643
|
+
}, 8, ["class"])) : createCommentVNode("", !0),
|
|
1644
|
+
(openBlock(), createBlock(resolveDynamicComponent(o.wrapperTag), {
|
|
1645
|
+
ref_key: "wrapperRef",
|
|
1646
|
+
ref: j,
|
|
1647
|
+
class: "virtual-scroll-wrapper",
|
|
1648
|
+
style: normalizeStyle(nt.value)
|
|
1649
|
+
}, {
|
|
1650
|
+
default: withCtx(() => [st.value ? (openBlock(), createBlock(resolveDynamicComponent(o.itemTag), {
|
|
1651
|
+
key: 0,
|
|
1652
|
+
class: "virtual-scroll-spacer",
|
|
1653
|
+
style: normalizeStyle(it.value)
|
|
1654
|
+
}, {
|
|
1655
|
+
default: withCtx(() => [...s[0] ||= [createElementVNode("td", { style: {
|
|
1656
|
+
padding: "0",
|
|
1657
|
+
border: "none",
|
|
1658
|
+
"block-size": "inherit"
|
|
1659
|
+
} }, null, -1)]]),
|
|
1660
|
+
_: 1
|
|
1661
|
+
}, 8, ["style"])) : createCommentVNode("", !0), (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(R), (e) => (openBlock(), createBlock(resolveDynamicComponent(o.itemTag), {
|
|
1662
|
+
key: e.index,
|
|
1663
|
+
ref_for: !0,
|
|
1664
|
+
ref: (t) => ze(t, e.index),
|
|
1665
|
+
"data-index": e.index,
|
|
1666
|
+
class: normalizeClass(["virtual-scroll-item", {
|
|
1667
|
+
"virtual-scroll--sticky": e.isStickyActive,
|
|
1668
|
+
"virtual-scroll--debug": ot.value
|
|
1669
|
+
}]),
|
|
1670
|
+
style: normalizeStyle(at(e))
|
|
1671
|
+
}, {
|
|
1672
|
+
default: withCtx(() => [renderSlot(t.$slots, "item", {
|
|
1673
|
+
item: e.item,
|
|
1674
|
+
index: e.index,
|
|
1675
|
+
columnRange: Fe.value,
|
|
1676
|
+
getColumnWidth: unref(V),
|
|
1677
|
+
gap: _.gap,
|
|
1678
|
+
columnGap: _.columnGap,
|
|
1679
|
+
isSticky: e.isSticky,
|
|
1680
|
+
isStickyActive: e.isStickyActive,
|
|
1681
|
+
isStickyActiveX: e.isStickyActiveX,
|
|
1682
|
+
isStickyActiveY: e.isStickyActiveY,
|
|
1683
|
+
offset: e.offset
|
|
1684
|
+
}, void 0, !0), ot.value ? (openBlock(), createElementBlock("div", _hoisted_2, " #" + toDisplayString(e.index) + " (" + toDisplayString(Math.round(e.offset.x)) + ", " + toDisplayString(Math.round(e.offset.y)) + ") ", 1)) : createCommentVNode("", !0)]),
|
|
1685
|
+
_: 2
|
|
1686
|
+
}, 1032, [
|
|
1687
|
+
"data-index",
|
|
1688
|
+
"class",
|
|
1689
|
+
"style"
|
|
1690
|
+
]))), 128))]),
|
|
1691
|
+
_: 3
|
|
1692
|
+
}, 8, ["style"])),
|
|
1693
|
+
o.loading && k.loading ? (openBlock(), createElementBlock("div", {
|
|
1694
|
+
key: 2,
|
|
1695
|
+
class: "virtual-scroll-loading",
|
|
1696
|
+
style: normalizeStyle(rt.value)
|
|
1697
|
+
}, [renderSlot(t.$slots, "loading", {}, void 0, !0)], 4)) : createCommentVNode("", !0),
|
|
1698
|
+
k.footer ? (openBlock(), createBlock(resolveDynamicComponent(lt.value), {
|
|
1699
|
+
key: 3,
|
|
1700
|
+
ref_key: "footerRef",
|
|
1701
|
+
ref: N,
|
|
1702
|
+
class: normalizeClass(["virtual-scroll-footer", { "virtual-scroll--sticky": o.stickyFooter }])
|
|
1703
|
+
}, {
|
|
1704
|
+
default: withCtx(() => [renderSlot(t.$slots, "footer", {}, void 0, !0)]),
|
|
1705
|
+
_: 3
|
|
1706
|
+
}, 8, ["class"])) : createCommentVNode("", !0)
|
|
1707
|
+
]),
|
|
1708
|
+
_: 3
|
|
1709
|
+
}, 40, [
|
|
1710
|
+
"id",
|
|
1711
|
+
"class",
|
|
1712
|
+
"style"
|
|
1713
|
+
]));
|
|
1714
|
+
}
|
|
1715
|
+
}), [["__scopeId", "data-v-408dd72c"]]);
|
|
1716
|
+
export { BROWSER_MAX_SIZE, DEFAULT_BUFFER, DEFAULT_COLUMN_WIDTH, DEFAULT_ITEM_SIZE, EMPTY_SCROLL_DETAILS, FenwickTree, VirtualScroll_default as VirtualScroll, VirtualScrollbar_default as VirtualScrollbar, calculateColumnRange, calculateItemPosition, calculateItemStyle, calculateRange, calculateScrollTarget, calculateStickyItem, calculateTotalSize, displayToVirtual, findPrevStickyIndex, getPaddingX, getPaddingY, isBody, isElement, isItemVisible, isScrollToIndexOptions, isScrollableElement, isWindow, isWindowLike, scrollTo, useVirtualScroll, useVirtualScrollbar, virtualToDisplay };
|
|
1717
|
+
|
|
1718
|
+
//# sourceMappingURL=index.mjs.map
|