virtua 0.50.2 → 0.50.4
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/lib/angular/VList.d.ts +7 -7
- package/lib/angular/Virtualizer.d.ts +11 -11
- package/lib/angular/WindowVirtualizer.d.ts +13 -9
- package/lib/angular/index.js +440 -434
- package/lib/angular/index.js.map +1 -1
- package/lib/core/index.cjs +342 -335
- package/lib/core/index.cjs.map +1 -1
- package/lib/core/index.d.ts +5 -2
- package/lib/core/index.js +326 -318
- package/lib/core/index.js.map +1 -1
- package/lib/core/layouts/types.d.ts +1 -0
- package/lib/core/observer.d.ts +1 -0
- package/lib/core/scroll-to.d.ts +1 -0
- package/lib/core/types.d.ts +1 -5
- package/lib/index.cjs +534 -532
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +496 -494
- package/lib/index.js.map +1 -1
- package/lib/solid/VList.d.ts +1 -1
- package/lib/solid/Virtualizer.d.ts +4 -0
- package/lib/solid/WindowVirtualizer.d.ts +4 -0
- package/lib/solid/index.cjs +366 -378
- package/lib/solid/index.cjs.map +1 -1
- package/lib/solid/index.js +373 -386
- package/lib/solid/index.js.map +1 -1
- package/lib/solid/index.jsx +383 -368
- package/lib/solid/index.jsx.map +1 -1
- package/lib/svelte/ListItem.svelte +2 -2
- package/lib/svelte/Virtualizer.svelte +22 -32
- package/lib/svelte/WindowVirtualizer.svelte +22 -21
- package/lib/svelte/WindowVirtualizer.type.d.ts +4 -0
- package/lib/svelte/utils.js.map +1 -1
- package/lib/vue/WindowVirtualizer.d.ts +4 -0
- package/lib/vue/index.cjs +366 -385
- package/lib/vue/index.cjs.map +1 -1
- package/lib/vue/index.js +342 -361
- package/lib/vue/index.js.map +1 -1
- package/package.json +30 -29
- /package/lib/core/{resizer.d.ts → driver.d.ts} +0 -0
- /package/lib/core/{scroller.d.ts → layouts/list.d.ts} +0 -0
package/lib/angular/index.js
CHANGED
|
@@ -1,200 +1,217 @@
|
|
|
1
1
|
import * as e from "@angular/core";
|
|
2
2
|
|
|
3
|
-
import { ApplicationRef as t, ChangeDetectionStrategy as i, DestroyRef as s, ElementRef as n,
|
|
3
|
+
import { ApplicationRef as t, ChangeDetectionStrategy as i, DestroyRef as s, ElementRef as n, InjectionToken as r, TemplateRef as o, afterNextRender as a, afterRenderEffect as l, computed as c, contentChild as u, effect as m, inject as h, input as p, output as f, signal as d, untracked as g, viewChild as S } from "@angular/core";
|
|
4
4
|
|
|
5
5
|
import { NgTemplateOutlet as y } from "@angular/common";
|
|
6
6
|
|
|
7
|
-
var {min:
|
|
7
|
+
var {min: v, max: z, abs: b, floor: N} = Math, P = (e, t, i) => v(i, z(t, e)), R = e => [ ...e ].sort((e, t) => e - t), $ = setTimeout, I = "function" == typeof queueMicrotask ? queueMicrotask : e => {
|
|
8
8
|
Promise.resolve().then(e);
|
|
9
|
-
},
|
|
9
|
+
}, x = () => {
|
|
10
10
|
let e;
|
|
11
11
|
return [ new Promise(t => {
|
|
12
12
|
e = t;
|
|
13
13
|
}), e ];
|
|
14
|
-
},
|
|
14
|
+
}, q = e => {
|
|
15
15
|
let t;
|
|
16
16
|
return () => (e && (t = e(), e = void 0), t);
|
|
17
|
-
}, k = (e, t, i) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}, $ = (e, t, i) => {
|
|
25
|
-
const s = -1 === e.t[t];
|
|
26
|
-
return e.t[t] = i, e.o = S(t, e.o), s;
|
|
27
|
-
}, F = (e, t) => {
|
|
28
|
-
if (!e.l) return 0;
|
|
29
|
-
if (e.o >= t) return e.u[t];
|
|
30
|
-
e.o < 0 && (e.u[0] = 0, e.o = 0);
|
|
31
|
-
let i = e.o, s = e.u[i];
|
|
32
|
-
for (;i < t; ) s += q(e, i), e.u[++i] = s;
|
|
33
|
-
return e.o = t, s;
|
|
34
|
-
}, T = (e, t, i = 0, s = e.l - 1) => {
|
|
35
|
-
let n = i;
|
|
36
|
-
for (;i <= s; ) {
|
|
37
|
-
const r = b((i + s) / 2);
|
|
38
|
-
F(e, r) <= t ? (n = r, i = r + 1) : s = r - 1;
|
|
39
|
-
}
|
|
40
|
-
return N(n, 0, e.l - 1);
|
|
41
|
-
}, w = (e, t, i) => {
|
|
42
|
-
const s = t - e.l;
|
|
43
|
-
return e.o = i ? -1 : S(t - 1, e.o), e.l = t, s > 0 ? (k(e.u, s), k(e.t, s, i),
|
|
44
|
-
e.i * s) : (e.u.splice(s), (i ? e.t.splice(0, -s) : e.t.splice(s)).reduce((t, i) => t - (-1 === i ? e.i : i), 0));
|
|
45
|
-
}, O = e => e.documentElement, C = e => e.ownerDocument, _ = e => e.defaultView, M = /*#__PURE__*/ x(() => !!/iP(hone|od|ad)/.test(navigator.userAgent) || "MacIntel" === navigator.platform && navigator.maxTouchPoints > 0), V = /*#__PURE__*/ x(() => "scrollBehavior" in O(document).style), K = (e, t = 40, i = 0, s, n = !1) => {
|
|
46
|
-
let r = !!i, o = 1, l = 0, a = 0, c = 0, u = 0, m = 0, h = 0, p = 0, f = 0, d = null, g = [ 0, r ? z(i - 1, 0) : -1 ], y = 0, b = !1;
|
|
47
|
-
const N = ((e, t, i) => ({
|
|
48
|
-
i: t,
|
|
49
|
-
t: i ? k(i.slice(0, S(e, i.length)), z(0, e - i.length)) : k([], e),
|
|
50
|
-
l: e,
|
|
51
|
-
o: -1,
|
|
52
|
-
u: k([], e + 1)
|
|
53
|
-
}))(e, s ? s[1] : t, s && s[0]), P = /* @__PURE__ */ new Set, R = () => c - a, x = () => R() + m + u, O = (e, t) => ((e, t, i, s) => {
|
|
54
|
-
if (s = S(s, e.l - 1), F(e, s) <= t) {
|
|
55
|
-
const n = T(e, i, s);
|
|
56
|
-
return [ T(e, t, s, n), n ];
|
|
57
|
-
}
|
|
58
|
-
{
|
|
59
|
-
const n = T(e, t, void 0, s);
|
|
60
|
-
return [ n, T(e, i, n) ];
|
|
61
|
-
}
|
|
62
|
-
})(N, e, t, g[0]), C = () => F(N, N.l), _ = (e, t) => {
|
|
63
|
-
const i = F(N, e) - m;
|
|
64
|
-
return t ? C() - i - V(e) : i;
|
|
65
|
-
}, V = e => q(N, e), K = (e, t = -1) => N.t[e] === t, E = e => {
|
|
66
|
-
e && (M() && 0 !== p || d && 1 === f ? m += e : u += e);
|
|
17
|
+
}, k = e => e.documentElement, F = e => e.ownerDocument, w = e => e.defaultView, O = /*#__PURE__*/ q(() => !!/iP(hone|od|ad)/.test(navigator.userAgent) || "MacIntel" === navigator.platform && navigator.maxTouchPoints > 0), T = /*#__PURE__*/ q(() => "scrollBehavior" in k(document).style), C = ({$getRange: e, $findIndex: t, $getItemOffset: i, $getItemSize: s, $setItemSize: n, $isSizeEqual: r, $getTotalSize: o, $getLength: a, $setLength: l, $estimateDefaultSize: c}, u = 0) => {
|
|
18
|
+
let m = !!c, h = !!u, p = 1, f = 0, d = 0, g = 0, S = 0, y = 0, N = 0, P = 0, R = 0, $ = null, I = [ 0, h ? z(u - 1, 0) : -1 ], x = 0, q = !1;
|
|
19
|
+
const k = /* @__PURE__ */ new Set, F = () => g - d, w = () => F() + y + S, T = (e, t) => {
|
|
20
|
+
const n = i(e) - y;
|
|
21
|
+
return t ? o() - n - s(e) : n;
|
|
22
|
+
}, C = e => {
|
|
23
|
+
e && (O() && 0 !== P || $ && 1 === R ? y += e : S += e);
|
|
67
24
|
};
|
|
68
25
|
return {
|
|
69
26
|
$dispose: () => {
|
|
70
|
-
|
|
27
|
+
k.clear();
|
|
71
28
|
},
|
|
72
|
-
$getStateVersion: () =>
|
|
73
|
-
$
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
d && (t = S(t, d[0]), i = z(i, d[1]));
|
|
29
|
+
$getStateVersion: () => p,
|
|
30
|
+
$getRange: (t = 200) => {
|
|
31
|
+
if (!q || h) return I;
|
|
32
|
+
let i, s;
|
|
33
|
+
if (N) [i, s] = I; else {
|
|
34
|
+
let n = z(0, w()), r = n + f;
|
|
35
|
+
m || (t = z(0, t), 1 !== P && (n -= t), 2 !== P && (r += t)), [i, s] = I = e(z(0, n), z(0, r)),
|
|
36
|
+
$ && (i = v(i, $[0]), s = z(s, $[1]));
|
|
81
37
|
}
|
|
82
|
-
return [ z(
|
|
38
|
+
return [ z(i, 0), v(s, a() - 1) ];
|
|
83
39
|
},
|
|
84
|
-
$findItemIndex: e =>
|
|
85
|
-
$isUnmeasuredItem:
|
|
86
|
-
$getItemOffset:
|
|
87
|
-
$getItemSize:
|
|
88
|
-
$getItemsLength:
|
|
89
|
-
$getScrollOffset: () =>
|
|
90
|
-
$isScrolling: () => 0 !==
|
|
91
|
-
$getViewportSize: () =>
|
|
92
|
-
$getStartSpacerSize: () =>
|
|
93
|
-
$getTotalSize:
|
|
94
|
-
|
|
40
|
+
$findItemIndex: e => t(e - d),
|
|
41
|
+
$isUnmeasuredItem: r,
|
|
42
|
+
$getItemOffset: T,
|
|
43
|
+
$getItemSize: s,
|
|
44
|
+
$getItemsLength: a,
|
|
45
|
+
$getScrollOffset: () => g,
|
|
46
|
+
$isScrolling: () => 0 !== P,
|
|
47
|
+
$getViewportSize: () => f,
|
|
48
|
+
$getStartSpacerSize: () => d,
|
|
49
|
+
$getTotalSize: o,
|
|
50
|
+
t: () => (N = S, S = 0, [ N, 2 === R ]),
|
|
95
51
|
$subscribe: (e, t) => {
|
|
96
52
|
const i = [ e, t ];
|
|
97
|
-
return
|
|
98
|
-
|
|
53
|
+
return k.add(i), () => {
|
|
54
|
+
k.delete(i);
|
|
99
55
|
};
|
|
100
56
|
},
|
|
101
|
-
$update: (
|
|
102
|
-
let
|
|
103
|
-
switch (
|
|
57
|
+
$update: (i, a) => {
|
|
58
|
+
let u, v, z = 0;
|
|
59
|
+
switch (i) {
|
|
104
60
|
case 1:
|
|
105
61
|
{
|
|
106
|
-
if (
|
|
107
|
-
const e =
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
e &&
|
|
111
|
-
const
|
|
112
|
-
|
|
62
|
+
if (a === g && 0 === R) break;
|
|
63
|
+
const e = N;
|
|
64
|
+
N = 0;
|
|
65
|
+
const t = a - g, i = b(t);
|
|
66
|
+
e && i < b(e) + 1 || 0 !== R || (P = t < 0 ? 2 : 1), h && (h = !1), g = a, z = 4;
|
|
67
|
+
const s = F();
|
|
68
|
+
s >= -f && s <= o() && (z += 1, v = i > f);
|
|
113
69
|
break;
|
|
114
70
|
}
|
|
115
71
|
|
|
116
72
|
case 2:
|
|
117
|
-
|
|
73
|
+
z = 8, 0 !== P && (u = !0, z += 1), P = 0, R = 0, $ = null;
|
|
118
74
|
break;
|
|
119
75
|
|
|
120
76
|
case 3:
|
|
121
77
|
{
|
|
122
|
-
const e =
|
|
78
|
+
const e = a.filter(([e, t]) => !r(e, t));
|
|
123
79
|
if (!e.length) break;
|
|
124
|
-
|
|
125
|
-
let
|
|
126
|
-
if (2 ===
|
|
127
|
-
const e =
|
|
128
|
-
|
|
80
|
+
C(e.reduce((e, [t, i]) => {
|
|
81
|
+
let n;
|
|
82
|
+
if (2 === R) n = !0; else if ($ && 1 === R) n = t < $[0]; else {
|
|
83
|
+
const e = F(), i = T(t), r = s(t);
|
|
84
|
+
n = 1 !== P && 0 === R ? i + r <= e : i < e && i + r < e + f;
|
|
129
85
|
}
|
|
130
|
-
return
|
|
86
|
+
return n && (e += i - s(t)), e;
|
|
131
87
|
}, 0));
|
|
132
88
|
for (const [t, i] of e) {
|
|
133
|
-
const e =
|
|
134
|
-
|
|
89
|
+
const e = s(t), r = n(t, i);
|
|
90
|
+
m && (x += r ? i : i - e);
|
|
135
91
|
}
|
|
136
|
-
|
|
137
|
-
let i = 0;
|
|
138
|
-
const s = [];
|
|
139
|
-
e.t.forEach((e, n) => {
|
|
140
|
-
-1 !== e && (s.push(e), n < t && i++);
|
|
141
|
-
}), e.o = -1;
|
|
142
|
-
const n = I(s), r = n.length, o = r / 2 | 0, l = r % 2 == 0 ? (n[o - 1] + n[o]) / 2 : n[o], a = e.i;
|
|
143
|
-
return ((e.i = l) - a) * z(t - i, 0);
|
|
144
|
-
})(N, T(N, x()))), n = !1), g = 3, s = !0;
|
|
92
|
+
m && f && x > f && (C(c(t(w()))), m = !1), z = 3, v = !0;
|
|
145
93
|
break;
|
|
146
94
|
}
|
|
147
95
|
|
|
148
96
|
case 4:
|
|
149
|
-
|
|
97
|
+
f !== a && (f || (q = v = !0), f = a, z = 3);
|
|
150
98
|
break;
|
|
151
99
|
|
|
152
100
|
case 5:
|
|
153
|
-
|
|
101
|
+
a[1] ? (C(l(a[0], !0)), R = 2, z = 1) : (l(a[0]), z = 1);
|
|
154
102
|
break;
|
|
155
103
|
|
|
156
104
|
case 6:
|
|
157
|
-
|
|
105
|
+
d = a;
|
|
158
106
|
break;
|
|
159
107
|
|
|
160
108
|
case 7:
|
|
161
|
-
|
|
109
|
+
R = 1;
|
|
162
110
|
break;
|
|
163
111
|
|
|
164
112
|
case 8:
|
|
165
|
-
|
|
113
|
+
$ = e(a, a + f), z = 1;
|
|
166
114
|
}
|
|
167
|
-
|
|
168
|
-
|
|
115
|
+
z && (p = 1 + (2147483647 & p), u && y && (S += y, y = 0), k.forEach(([e, t]) => {
|
|
116
|
+
z & e && t(v);
|
|
169
117
|
}));
|
|
170
118
|
}
|
|
171
119
|
};
|
|
172
|
-
},
|
|
120
|
+
}, M = (e, t, i, s = 0, n = t - 1) => {
|
|
121
|
+
let r = s;
|
|
122
|
+
for (;s <= n; ) {
|
|
123
|
+
const t = N((s + n) / 2);
|
|
124
|
+
e(t) <= i ? (r = t, s = t + 1) : n = t - 1;
|
|
125
|
+
}
|
|
126
|
+
return P(r, 0, t - 1);
|
|
127
|
+
}, _ = (e, t, i) => {
|
|
128
|
+
const s = i ? "unshift" : "push";
|
|
129
|
+
for (let i = 0; i < t; i++) e[s](-1);
|
|
130
|
+
return e;
|
|
131
|
+
}, K = (e, t, i) => {
|
|
132
|
+
let s = i && i[1] || t || 40, n = -1, r = 0;
|
|
133
|
+
const o = i && i[0], a = o ? _(o.slice(0, v(e, o.length)), z(0, e - o.length)) : _([], e), l = _([], e + 1), c = e => {
|
|
134
|
+
const t = a[e];
|
|
135
|
+
return -1 === t ? s : t;
|
|
136
|
+
}, u = t => {
|
|
137
|
+
if (!e) return 0;
|
|
138
|
+
if (n >= t) return l[t];
|
|
139
|
+
n < 0 && (l[0] = 0, n = 0);
|
|
140
|
+
let i = n, s = l[i];
|
|
141
|
+
for (;i < t; ) s += c(i), l[++i] = s;
|
|
142
|
+
return n = t, s;
|
|
143
|
+
};
|
|
144
|
+
return {
|
|
145
|
+
$getRange: (t, i) => {
|
|
146
|
+
let s, n;
|
|
147
|
+
return r = v(r, e - 1), u(r) <= t ? (n = M(u, e, i, r), s = M(u, e, t, r, n)) : (s = M(u, e, t, void 0, r),
|
|
148
|
+
n = M(u, e, i, s)), r = s, [ s, n ];
|
|
149
|
+
},
|
|
150
|
+
$findIndex: t => M(u, e, t),
|
|
151
|
+
$getItemOffset: u,
|
|
152
|
+
$getItemSize: c,
|
|
153
|
+
$setItemSize: (e, t) => {
|
|
154
|
+
const i = -1 === a[e];
|
|
155
|
+
return a[e] = t, n = v(e, n), i;
|
|
156
|
+
},
|
|
157
|
+
$isSizeEqual: (e, t = -1) => a[e] === t,
|
|
158
|
+
$getTotalSize: () => u(e),
|
|
159
|
+
$getLength: () => e,
|
|
160
|
+
$setLength: (t, i) => {
|
|
161
|
+
const r = t - e;
|
|
162
|
+
return n = i ? -1 : v(t - 1, n), e = t, r > 0 ? (_(l, r), _(a, r, i), s * r) : (l.splice(r),
|
|
163
|
+
(i ? a.splice(0, -r) : a.splice(r)).reduce((e, t) => e - (-1 === t ? s : t), 0));
|
|
164
|
+
},
|
|
165
|
+
$estimateDefaultSize: t ? void 0 : e => {
|
|
166
|
+
let t = 0;
|
|
167
|
+
const i = [];
|
|
168
|
+
a.forEach((s, n) => {
|
|
169
|
+
-1 !== s && (i.push(s), n < e && t++);
|
|
170
|
+
}), n = -1;
|
|
171
|
+
const r = R(i), o = r.length, l = o / 2 | 0, c = o % 2 == 0 ? (r[l - 1] + r[l]) / 2 : r[l], u = s;
|
|
172
|
+
return ((s = c) - u) * z(e - t, 0);
|
|
173
|
+
},
|
|
174
|
+
$snapshot: () => [ a.slice(), s ]
|
|
175
|
+
};
|
|
176
|
+
}, V = e => {
|
|
177
|
+
let t;
|
|
178
|
+
return {
|
|
179
|
+
i(i) {
|
|
180
|
+
(t || (t = new (w(F(i)).ResizeObserver)(e))).observe(i);
|
|
181
|
+
},
|
|
182
|
+
o(e) {
|
|
183
|
+
t.unobserve(e);
|
|
184
|
+
},
|
|
185
|
+
l() {
|
|
186
|
+
t && t.disconnect();
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}, E = (e, t) => t ? -e : e, L = (e, t, i, s, n, r) => {
|
|
173
190
|
const o = Date.now;
|
|
174
|
-
let
|
|
191
|
+
let a = 0, l = !1, c = !1, u = !1, m = !1;
|
|
175
192
|
const h = (() => {
|
|
176
193
|
let t;
|
|
177
194
|
const i = () => {
|
|
178
195
|
null != t && clearTimeout(t);
|
|
179
196
|
}, s = () => {
|
|
180
|
-
i(), t =
|
|
197
|
+
i(), t = $(() => {
|
|
181
198
|
t = null, (() => {
|
|
182
|
-
if (
|
|
199
|
+
if (l || c) return l = !1, void h();
|
|
183
200
|
u = !1, e.$update(2);
|
|
184
201
|
})();
|
|
185
202
|
}, 150);
|
|
186
203
|
};
|
|
187
|
-
return s.
|
|
204
|
+
return s.u = i, s;
|
|
188
205
|
})(), p = () => {
|
|
189
|
-
|
|
206
|
+
a = o(), u && (m = !0), r && e.$update(6, r()), e.$update(1, s()), h();
|
|
190
207
|
}, f = t => {
|
|
191
|
-
if (
|
|
192
|
-
const s = o() -
|
|
193
|
-
150 > s && 50 < s && (i ? t.deltaX : t.deltaY) && (
|
|
208
|
+
if (l || !e.$isScrolling() || t.ctrlKey) return;
|
|
209
|
+
const s = o() - a;
|
|
210
|
+
150 > s && 50 < s && (i ? t.deltaX : t.deltaY) && (l = !0);
|
|
194
211
|
}, d = () => {
|
|
195
212
|
c = !0, u = m = !1;
|
|
196
213
|
}, g = () => {
|
|
197
|
-
c = !1,
|
|
214
|
+
c = !1, O() && (u = !0);
|
|
198
215
|
};
|
|
199
216
|
return t.addEventListener("scroll", p), t.addEventListener("wheel", f, {
|
|
200
217
|
passive: !0
|
|
@@ -203,29 +220,29 @@ var {min: S, max: z, abs: v, floor: b} = Math, N = (e, t, i) => S(i, z(t, e)), I
|
|
|
203
220
|
}), t.addEventListener("touchend", g, {
|
|
204
221
|
passive: !0
|
|
205
222
|
}), {
|
|
206
|
-
|
|
223
|
+
l: () => {
|
|
207
224
|
t.removeEventListener("scroll", p), t.removeEventListener("wheel", f), t.removeEventListener("touchstart", d),
|
|
208
|
-
t.removeEventListener("touchend", g), h.
|
|
225
|
+
t.removeEventListener("touchend", g), h.u();
|
|
209
226
|
},
|
|
210
|
-
|
|
211
|
-
const [t, i] = e.
|
|
227
|
+
m: () => {
|
|
228
|
+
const [t, i] = e.t();
|
|
212
229
|
t && (n(t, i, m), m = !1, i && e.$getViewportSize() > e.$getTotalSize() && e.$update(1, s()));
|
|
213
230
|
}
|
|
214
231
|
};
|
|
215
|
-
},
|
|
232
|
+
}, D = (e, t, i) => {
|
|
216
233
|
let s;
|
|
217
234
|
return [ async (n, r) => {
|
|
218
235
|
if (!await t()) return;
|
|
219
236
|
s && s();
|
|
220
237
|
const o = () => {
|
|
221
|
-
const [t, i] =
|
|
238
|
+
const [t, i] = x();
|
|
222
239
|
return s = () => {
|
|
223
240
|
i(!1);
|
|
224
|
-
}, e.$getViewportSize() &&
|
|
241
|
+
}, e.$getViewportSize() && $(s, 150), [ t, e.$subscribe(2, () => {
|
|
225
242
|
i(!0);
|
|
226
243
|
}) ];
|
|
227
244
|
};
|
|
228
|
-
if (r &&
|
|
245
|
+
if (r && T()) e.$update(8, n()), I(async () => {
|
|
229
246
|
for (;;) {
|
|
230
247
|
let t = !0;
|
|
231
248
|
for (let [i, s] = e.$getRange(); i <= s; i++) if (e.$isUnmeasuredItem(i)) {
|
|
@@ -252,54 +269,53 @@ var {min: S, max: z, abs: v, floor: b} = Math, N = (e, t, i) => S(i, z(t, e)), I
|
|
|
252
269
|
}, () => {
|
|
253
270
|
s && s();
|
|
254
271
|
} ];
|
|
255
|
-
},
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
},
|
|
264
|
-
p() {
|
|
265
|
-
t && t.disconnect();
|
|
272
|
+
}, B = (e, t) => {
|
|
273
|
+
e.$scheduleScroll(() => t);
|
|
274
|
+
}, J = (e, t, i, {align: s, smooth: n, offset: r = 0} = {}) => {
|
|
275
|
+
if (i = P(i, 0, t.$getItemsLength() - 1), "nearest" === s) {
|
|
276
|
+
const e = t.$getItemOffset(i), n = t.$getScrollOffset();
|
|
277
|
+
if (e < n) s = "start"; else {
|
|
278
|
+
if (!(e + t.$getItemSize(i) > n + t.$getViewportSize())) return;
|
|
279
|
+
s = "end";
|
|
266
280
|
}
|
|
267
|
-
}
|
|
281
|
+
}
|
|
282
|
+
e.$scheduleScroll(() => r + e.$getBaseOffset() + t.$getItemOffset(i) + ("end" === s ? t.$getItemSize(i) - (t.$getViewportSize() - e.$getScrollbarSize()) : "center" === s ? (t.$getItemSize(i) - (t.$getViewportSize() - e.$getScrollbarSize())) / 2 : 0), n);
|
|
268
283
|
}, W = class t {
|
|
269
|
-
index=
|
|
270
|
-
offset=
|
|
271
|
-
hide=
|
|
272
|
-
horizontal=
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
284
|
+
index=p.required();
|
|
285
|
+
offset=p.required();
|
|
286
|
+
hide=p.required();
|
|
287
|
+
horizontal=p.required();
|
|
288
|
+
isSSR=p(!1);
|
|
289
|
+
resizer=p.required();
|
|
290
|
+
attrs=p();
|
|
291
|
+
style=c(() => {
|
|
292
|
+
const e = this.horizontal(), t = this.hide(), i = this.isSSR(), s = {
|
|
277
293
|
contain: "layout style",
|
|
278
|
-
position: "absolute",
|
|
294
|
+
position: t && i ? void 0 : "absolute",
|
|
279
295
|
[e ? "height" : "width"]: "100%",
|
|
280
296
|
[e ? "top" : "left"]: "0px",
|
|
281
297
|
[e ? "left" : "top"]: this.offset() + "px",
|
|
282
|
-
visibility:
|
|
298
|
+
visibility: !t || i ? void 0 : "hidden",
|
|
283
299
|
...this.attrs()?.style
|
|
284
300
|
};
|
|
285
|
-
return e && (
|
|
301
|
+
return e && (s.display = "inline-flex"), s;
|
|
286
302
|
});
|
|
287
303
|
constructor() {
|
|
288
|
-
const e =
|
|
304
|
+
const e = h(n).nativeElement;
|
|
289
305
|
let t;
|
|
290
306
|
l({
|
|
291
307
|
read: () => {
|
|
292
308
|
const i = this.index();
|
|
293
|
-
t && t(), t =
|
|
309
|
+
t && t(), t = g(this.resizer)(e, i);
|
|
294
310
|
}
|
|
295
311
|
});
|
|
296
312
|
let i = [];
|
|
297
|
-
|
|
313
|
+
m(() => {
|
|
298
314
|
const t = this.attrs();
|
|
299
315
|
for (const t of i) e.removeAttribute(t);
|
|
300
316
|
i = [];
|
|
301
317
|
for (const s in t) "style" !== s && "class" !== s && (e.setAttribute(s, t[s]), i.push(s));
|
|
302
|
-
}),
|
|
318
|
+
}), h(s).onDestroy(() => {
|
|
303
319
|
t && t();
|
|
304
320
|
});
|
|
305
321
|
}
|
|
@@ -346,6 +362,13 @@ var {min: S, max: z, abs: v, floor: b} = Math, N = (e, t, i) => S(i, z(t, e)), I
|
|
|
346
362
|
isRequired: !0,
|
|
347
363
|
transformFunction: null
|
|
348
364
|
},
|
|
365
|
+
isSSR: {
|
|
366
|
+
classPropertyName: "isSSR",
|
|
367
|
+
publicName: "isSSR",
|
|
368
|
+
isSignal: !0,
|
|
369
|
+
isRequired: !1,
|
|
370
|
+
transformFunction: null
|
|
371
|
+
},
|
|
349
372
|
resizer: {
|
|
350
373
|
classPropertyName: "resizer",
|
|
351
374
|
publicName: "resizer",
|
|
@@ -369,44 +392,49 @@ var {min: S, max: z, abs: v, floor: b} = Math, N = (e, t, i) => S(i, z(t, e)), I
|
|
|
369
392
|
},
|
|
370
393
|
ngImport: e
|
|
371
394
|
});
|
|
372
|
-
}, j = (e, t) => "_" + t, X = class i {
|
|
373
|
-
data=
|
|
374
|
-
getKey=
|
|
375
|
-
itemProps=
|
|
376
|
-
bufferSize=
|
|
377
|
-
scrollRef=
|
|
378
|
-
itemSize=
|
|
379
|
-
ssrCount=
|
|
380
|
-
shift=
|
|
381
|
-
horizontal=
|
|
382
|
-
keepMounted=
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
395
|
+
}, j = (e, t) => "_" + t, X = new r("virtua-item-template"), Y = class i {
|
|
396
|
+
data=p.required();
|
|
397
|
+
getKey=p(j);
|
|
398
|
+
itemProps=p();
|
|
399
|
+
bufferSize=p();
|
|
400
|
+
scrollRef=p();
|
|
401
|
+
itemSize=p();
|
|
402
|
+
ssrCount=p();
|
|
403
|
+
shift=p(!1);
|
|
404
|
+
horizontal=p(!1);
|
|
405
|
+
keepMounted=p();
|
|
406
|
+
cacheProp=p(void 0, {
|
|
407
|
+
alias: "cache"
|
|
408
|
+
});
|
|
409
|
+
startMargin=p(0);
|
|
410
|
+
scroll=f();
|
|
411
|
+
scrollEnd=f();
|
|
412
|
+
contentTemplate=u(o);
|
|
413
|
+
h=h(X, {
|
|
414
|
+
optional: !0
|
|
415
|
+
});
|
|
416
|
+
template=c(() => this.h?.() ?? this.contentTemplate());
|
|
417
|
+
p;
|
|
418
|
+
S;
|
|
419
|
+
driver;
|
|
420
|
+
v=h(n).nativeElement;
|
|
421
|
+
N=h(t);
|
|
422
|
+
P=d(void 0);
|
|
423
|
+
isSSR=d(!1);
|
|
424
|
+
R=c(() => {
|
|
425
|
+
this.P();
|
|
426
|
+
const e = this.data().length, [t, i] = this.p.$getRange(this.bufferSize()), s = this.keepMounted(), n = [];
|
|
399
427
|
if (s) {
|
|
400
428
|
const r = new Set(s);
|
|
401
429
|
for (let e = t; e <= i; e++) r.add(e);
|
|
402
|
-
for (const t of
|
|
430
|
+
for (const t of R([ ...r ])) t < e && n.push(t);
|
|
403
431
|
} else for (let s = t; s <= i; s++) s < e && n.push(s);
|
|
404
432
|
return n;
|
|
405
433
|
});
|
|
406
|
-
items=
|
|
407
|
-
this.
|
|
408
|
-
const e = this.
|
|
409
|
-
return this
|
|
434
|
+
items=c(() => {
|
|
435
|
+
this.P();
|
|
436
|
+
const e = this.p, t = this.data(), i = this.getKey(), s = this.itemProps(), n = this.driver.$isNegative();
|
|
437
|
+
return this.R().map(r => {
|
|
410
438
|
const o = t[r];
|
|
411
439
|
return {
|
|
412
440
|
key: i(o, r),
|
|
@@ -421,9 +449,9 @@ var {min: S, max: z, abs: v, floor: b} = Math, N = (e, t, i) => S(i, z(t, e)), I
|
|
|
421
449
|
};
|
|
422
450
|
});
|
|
423
451
|
});
|
|
424
|
-
containerStyle=
|
|
425
|
-
this.
|
|
426
|
-
const e = this.horizontal(), t = this.
|
|
452
|
+
containerStyle=c(() => {
|
|
453
|
+
this.P();
|
|
454
|
+
const e = this.horizontal(), t = this.p.$getTotalSize();
|
|
427
455
|
return {
|
|
428
456
|
display: "block",
|
|
429
457
|
contain: "size style",
|
|
@@ -432,132 +460,113 @@ var {min: S, max: z, abs: v, floor: b} = Math, N = (e, t, i) => S(i, z(t, e)), I
|
|
|
432
460
|
position: "relative",
|
|
433
461
|
width: e ? t + "px" : "100%",
|
|
434
462
|
height: e ? "100%" : t + "px",
|
|
435
|
-
"pointer-events": this.
|
|
463
|
+
"pointer-events": this.p.$isScrolling() ? "none" : void 0
|
|
436
464
|
};
|
|
437
465
|
});
|
|
438
466
|
constructor() {
|
|
439
|
-
|
|
467
|
+
m(() => {
|
|
440
468
|
const e = this.data().length;
|
|
441
|
-
this.
|
|
442
|
-
}),
|
|
469
|
+
this.p && e !== this.p.$getItemsLength() && this.p.$update(5, [ e, g(this.shift) ]);
|
|
470
|
+
}), m(() => {
|
|
443
471
|
const e = this.startMargin();
|
|
444
|
-
this.
|
|
445
|
-
}),
|
|
472
|
+
this.p && e !== this.p.$getStartSpacerSize() && this.p.$update(6, e);
|
|
473
|
+
}), a({
|
|
446
474
|
read: () => {
|
|
447
|
-
|
|
448
|
-
this.resizer.$observeRoot(e), this.P.$observe(this.R, e);
|
|
475
|
+
this.isSSR.set(!1), this.driver.$observe(this.v, this.scrollRef());
|
|
449
476
|
}
|
|
450
477
|
}), l({
|
|
451
478
|
read: () => {
|
|
452
|
-
this.
|
|
479
|
+
this.P(), this.driver.$fixScrollJump();
|
|
453
480
|
}
|
|
454
|
-
}),
|
|
455
|
-
this.
|
|
481
|
+
}), h(s).onDestroy(() => {
|
|
482
|
+
this.p?.$dispose(), this.driver?.$dispose();
|
|
456
483
|
});
|
|
457
484
|
}
|
|
458
485
|
ngOnInit() {
|
|
459
|
-
const e = this.itemSize(), t = this.
|
|
460
|
-
this.
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
null != e && r.push([ e, l[i] ]);
|
|
467
|
-
}
|
|
468
|
-
r.length && e.$update(3, r);
|
|
469
|
-
});
|
|
470
|
-
return {
|
|
471
|
-
$observeRoot(e) {
|
|
472
|
-
n.v(t = e);
|
|
473
|
-
},
|
|
474
|
-
$observeItem: (e, t) => (s.set(e, t), n.v(e), () => {
|
|
475
|
-
s.delete(e), n.N(e);
|
|
476
|
-
}),
|
|
477
|
-
$dispose: n.p
|
|
478
|
-
};
|
|
479
|
-
})(t), this.P = ((e, t) => {
|
|
480
|
-
let i, s, n = R(), r = !1;
|
|
481
|
-
const o = t ? "scrollLeft" : "scrollTop", l = t ? "overflowX" : "overflowY", [a, c] = B(e, () => n[0], (e, s) => {
|
|
482
|
-
e = D(e, r), s ? i.scrollTo({
|
|
486
|
+
const e = this.itemSize(), t = this.ssrCount();
|
|
487
|
+
this.isSSR.set(!!t);
|
|
488
|
+
const i = this.S = K(this.data().length, e, this.cacheProp()), s = this.p = C(i, t);
|
|
489
|
+
this.driver = ((e, t) => {
|
|
490
|
+
let i, s, n = x(), r = !1;
|
|
491
|
+
const o = t ? "scrollLeft" : "scrollTop", a = t ? "overflowX" : "overflowY", [l, c] = D(e, () => n[0], (e, s) => {
|
|
492
|
+
e = E(e, r), s ? i.scrollTo({
|
|
483
493
|
[t ? "left" : "top"]: e,
|
|
484
494
|
behavior: "smooth"
|
|
485
495
|
}) : i[o] = e;
|
|
496
|
+
}), u = t ? "width" : "height", m = /* @__PURE__ */ new WeakMap, h = V(t => {
|
|
497
|
+
const s = [];
|
|
498
|
+
for (const {target: n, contentRect: r} of t) if (n.offsetParent) if (n === i) e.$update(4, r[u]); else {
|
|
499
|
+
const e = m.get(n);
|
|
500
|
+
null != e && s.push([ e, r[u] ]);
|
|
501
|
+
}
|
|
502
|
+
s.length && e.$update(3, s);
|
|
486
503
|
});
|
|
487
504
|
return {
|
|
488
|
-
$observe(
|
|
489
|
-
i = u, t && (r = "rtl" === getComputedStyle(u).direction), s = L(e, u, t, () =>
|
|
505
|
+
$observe(l, u = l.parentElement) {
|
|
506
|
+
h.i(i = u), t && (r = "rtl" === getComputedStyle(u).direction), s = L(e, u, t, () => E(u[o], r), (t, i, s) => {
|
|
490
507
|
if (s) {
|
|
491
|
-
const e = u.style, t = e[
|
|
492
|
-
e[
|
|
493
|
-
e[
|
|
508
|
+
const e = u.style, t = e[a];
|
|
509
|
+
e[a] = "hidden", $(() => {
|
|
510
|
+
e[a] = t;
|
|
494
511
|
});
|
|
495
512
|
}
|
|
496
|
-
u[o] =
|
|
513
|
+
u[o] = E(e.$getScrollOffset() + t, r), i && c();
|
|
497
514
|
}), n[1](!0);
|
|
498
515
|
},
|
|
499
516
|
$dispose() {
|
|
500
|
-
s && s.
|
|
517
|
+
h.l(), s && s.l(), n[1](!1), n = x();
|
|
501
518
|
},
|
|
519
|
+
$observeItem: (e, t) => (m.set(e, t), h.i(e), () => {
|
|
520
|
+
m.delete(e), h.o(e);
|
|
521
|
+
}),
|
|
502
522
|
$isNegative: () => r,
|
|
503
|
-
$
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
$scrollBy(t) {
|
|
507
|
-
t += e.$getScrollOffset(), a(() => t);
|
|
523
|
+
$scheduleScroll: l,
|
|
524
|
+
$fixScrollJump() {
|
|
525
|
+
s && s.m();
|
|
508
526
|
},
|
|
509
|
-
$
|
|
510
|
-
|
|
511
|
-
const s = e.$getItemOffset(t), n = e.$getScrollOffset();
|
|
512
|
-
if (s < n) i = "start"; else {
|
|
513
|
-
if (!(s + e.$getItemSize(t) > n + e.$getViewportSize())) return;
|
|
514
|
-
i = "end";
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
a(() => n + e.$getStartSpacerSize() + e.$getItemOffset(t) + ("end" === i ? e.$getItemSize(t) - e.$getViewportSize() : "center" === i ? (e.$getItemSize(t) - e.$getViewportSize()) / 2 : 0), s);
|
|
518
|
-
},
|
|
519
|
-
$fixScrollJump: () => {
|
|
520
|
-
s && s.S();
|
|
521
|
-
}
|
|
527
|
+
$getBaseOffset: e.$getStartSpacerSize,
|
|
528
|
+
$getScrollbarSize: () => 0
|
|
522
529
|
};
|
|
523
|
-
})(
|
|
524
|
-
this.
|
|
525
|
-
}),
|
|
526
|
-
this.scroll.emit(
|
|
527
|
-
}),
|
|
530
|
+
})(s, this.horizontal()), s.$subscribe(1, e => {
|
|
531
|
+
this.P.set(s.$getStateVersion()), e && this.N.tick();
|
|
532
|
+
}), s.$subscribe(4, () => {
|
|
533
|
+
this.scroll.emit(s.$getScrollOffset());
|
|
534
|
+
}), s.$subscribe(8, () => {
|
|
528
535
|
this.scrollEnd.emit();
|
|
529
|
-
}), this.
|
|
536
|
+
}), this.P.set(s.$getStateVersion());
|
|
530
537
|
}
|
|
531
|
-
|
|
532
|
-
return this.
|
|
538
|
+
get cache() {
|
|
539
|
+
return this.S.$snapshot();
|
|
533
540
|
}
|
|
534
|
-
|
|
535
|
-
return this.
|
|
541
|
+
get scrollOffset() {
|
|
542
|
+
return this.p.$getScrollOffset();
|
|
536
543
|
}
|
|
537
|
-
|
|
538
|
-
return e = this.
|
|
544
|
+
get scrollSize() {
|
|
545
|
+
return e = this.p, z(e.$getTotalSize(), e.$getViewportSize());
|
|
539
546
|
var e;
|
|
540
547
|
}
|
|
541
|
-
|
|
542
|
-
return this.
|
|
548
|
+
get viewportSize() {
|
|
549
|
+
return this.p.$getViewportSize();
|
|
543
550
|
}
|
|
544
551
|
findItemIndex(e) {
|
|
545
|
-
return this.
|
|
552
|
+
return this.p.$findItemIndex(e);
|
|
546
553
|
}
|
|
547
554
|
getItemOffset(e) {
|
|
548
|
-
return this.
|
|
555
|
+
return this.p.$getItemOffset(e);
|
|
549
556
|
}
|
|
550
557
|
getItemSize(e) {
|
|
551
|
-
return this.
|
|
558
|
+
return this.p.$getItemSize(e);
|
|
552
559
|
}
|
|
553
560
|
scrollToIndex(e, t) {
|
|
554
|
-
this.
|
|
561
|
+
J(this.driver, this.p, e, t);
|
|
555
562
|
}
|
|
556
563
|
scrollTo(e) {
|
|
557
|
-
this.
|
|
564
|
+
B(this.driver, e);
|
|
558
565
|
}
|
|
559
566
|
scrollBy(e) {
|
|
560
|
-
|
|
567
|
+
((e, t, i) => {
|
|
568
|
+
B(e, i + t.$getScrollOffset());
|
|
569
|
+
})(this.driver, this.p, e);
|
|
561
570
|
}
|
|
562
571
|
static ɵfac=/*@__PURE__*/ e.ɵɵngDeclareFactory({
|
|
563
572
|
minVersion: "12.0.0",
|
|
@@ -644,8 +653,8 @@ var {min: S, max: z, abs: v, floor: b} = Math, N = (e, t, i) => S(i, z(t, e)), I
|
|
|
644
653
|
isRequired: !1,
|
|
645
654
|
transformFunction: null
|
|
646
655
|
},
|
|
647
|
-
|
|
648
|
-
classPropertyName: "
|
|
656
|
+
cacheProp: {
|
|
657
|
+
classPropertyName: "cacheProp",
|
|
649
658
|
publicName: "cache",
|
|
650
659
|
isSignal: !0,
|
|
651
660
|
isRequired: !1,
|
|
@@ -657,13 +666,6 @@ var {min: S, max: z, abs: v, floor: b} = Math, N = (e, t, i) => S(i, z(t, e)), I
|
|
|
657
666
|
isSignal: !0,
|
|
658
667
|
isRequired: !1,
|
|
659
668
|
transformFunction: null
|
|
660
|
-
},
|
|
661
|
-
itemTemplate: {
|
|
662
|
-
classPropertyName: "itemTemplate",
|
|
663
|
-
publicName: "itemTemplate",
|
|
664
|
-
isSignal: !0,
|
|
665
|
-
isRequired: !1,
|
|
666
|
-
transformFunction: null
|
|
667
669
|
}
|
|
668
670
|
},
|
|
669
671
|
outputs: {
|
|
@@ -678,19 +680,19 @@ var {min: S, max: z, abs: v, floor: b} = Math, N = (e, t, i) => S(i, z(t, e)), I
|
|
|
678
680
|
queries: [ {
|
|
679
681
|
propertyName: "contentTemplate",
|
|
680
682
|
first: !0,
|
|
681
|
-
predicate:
|
|
683
|
+
predicate: o,
|
|
682
684
|
emitDistinctChangesOnly: !1,
|
|
683
685
|
descendants: !0,
|
|
684
686
|
isSignal: !0
|
|
685
687
|
} ],
|
|
686
688
|
ngImport: e,
|
|
687
|
-
template: '\n @for (item of items(); track item.key) {\n <div\n virtuaListItem\n [index]="item.index"\n [offset]="item.offset"\n [hide]="item.hide"\n [attrs]="item.attrs"\n [horizontal]="horizontal()"\n [resizer]="
|
|
689
|
+
template: '\n @for (item of items(); track item.key) {\n <div\n virtuaListItem\n [index]="item.index"\n [offset]="item.offset"\n [hide]="item.hide"\n [attrs]="item.attrs"\n [horizontal]="horizontal()"\n [isSSR]="isSSR()"\n [resizer]="driver.$observeItem"\n >\n <ng-container\n [ngTemplateOutlet]="template()"\n [ngTemplateOutletContext]="{\n $implicit: item.data,\n index: item.index,\n }"\n />\n </div>\n }\n ',
|
|
688
690
|
isInline: !0,
|
|
689
691
|
dependencies: [ {
|
|
690
692
|
kind: "directive",
|
|
691
693
|
type: e.forwardRef(() => W),
|
|
692
694
|
selector: "div[virtuaListItem]",
|
|
693
|
-
inputs: [ "index", "offset", "hide", "horizontal", "resizer", "attrs" ]
|
|
695
|
+
inputs: [ "index", "offset", "hide", "horizontal", "isSSR", "resizer", "attrs" ]
|
|
694
696
|
}, {
|
|
695
697
|
kind: "directive",
|
|
696
698
|
type: e.forwardRef(() => y),
|
|
@@ -703,37 +705,39 @@ var {min: S, max: z, abs: v, floor: b} = Math, N = (e, t, i) => S(i, z(t, e)), I
|
|
|
703
705
|
|
|
704
706
|
i.OnPush;
|
|
705
707
|
|
|
706
|
-
var
|
|
707
|
-
data=
|
|
708
|
-
getKey=
|
|
709
|
-
itemProps=
|
|
710
|
-
bufferSize=
|
|
711
|
-
itemSize=
|
|
712
|
-
ssrCount=
|
|
713
|
-
shift=
|
|
714
|
-
horizontal=
|
|
715
|
-
keepMounted=
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
708
|
+
var Q = class t {
|
|
709
|
+
data=p.required();
|
|
710
|
+
getKey=p(j);
|
|
711
|
+
itemProps=p();
|
|
712
|
+
bufferSize=p();
|
|
713
|
+
itemSize=p();
|
|
714
|
+
ssrCount=p();
|
|
715
|
+
shift=p(!1);
|
|
716
|
+
horizontal=p(!1);
|
|
717
|
+
keepMounted=p();
|
|
718
|
+
cacheProp=p(void 0, {
|
|
719
|
+
alias: "cache"
|
|
720
|
+
});
|
|
721
|
+
scroll=f();
|
|
722
|
+
scrollEnd=f();
|
|
723
|
+
template=u.required(o);
|
|
724
|
+
virtualizer=S.required(Y);
|
|
725
|
+
v=h(n).nativeElement;
|
|
722
726
|
ngOnInit() {
|
|
723
|
-
const e = this.horizontal(), t = this.
|
|
727
|
+
const e = this.horizontal(), t = this.v;
|
|
724
728
|
t.setAttribute("style", `display:${e ? "inline-block" : "block"};${e ? "overflow-x" : "overflow-y"}:auto;contain:strict;width:100%;height:100%;` + (t.getAttribute("style") || ""));
|
|
725
729
|
}
|
|
726
|
-
|
|
727
|
-
return this.virtualizer().
|
|
730
|
+
get cache() {
|
|
731
|
+
return this.virtualizer().cache;
|
|
728
732
|
}
|
|
729
|
-
|
|
730
|
-
return this.virtualizer().
|
|
733
|
+
get scrollOffset() {
|
|
734
|
+
return this.virtualizer().scrollOffset;
|
|
731
735
|
}
|
|
732
|
-
|
|
733
|
-
return this.virtualizer().
|
|
736
|
+
get scrollSize() {
|
|
737
|
+
return this.virtualizer().scrollSize;
|
|
734
738
|
}
|
|
735
|
-
|
|
736
|
-
return this.virtualizer().
|
|
739
|
+
get viewportSize() {
|
|
740
|
+
return this.virtualizer().viewportSize;
|
|
737
741
|
}
|
|
738
742
|
findItemIndex(e) {
|
|
739
743
|
return this.virtualizer().findItemIndex(e);
|
|
@@ -831,8 +835,8 @@ var Y = class t {
|
|
|
831
835
|
isRequired: !1,
|
|
832
836
|
transformFunction: null
|
|
833
837
|
},
|
|
834
|
-
|
|
835
|
-
classPropertyName: "
|
|
838
|
+
cacheProp: {
|
|
839
|
+
classPropertyName: "cacheProp",
|
|
836
840
|
publicName: "cache",
|
|
837
841
|
isSignal: !0,
|
|
838
842
|
isRequired: !1,
|
|
@@ -846,7 +850,7 @@ var Y = class t {
|
|
|
846
850
|
queries: [ {
|
|
847
851
|
propertyName: "template",
|
|
848
852
|
first: !0,
|
|
849
|
-
predicate:
|
|
853
|
+
predicate: o,
|
|
850
854
|
emitDistinctChangesOnly: !1,
|
|
851
855
|
descendants: !0,
|
|
852
856
|
isSignal: !0
|
|
@@ -854,62 +858,70 @@ var Y = class t {
|
|
|
854
858
|
viewQueries: [ {
|
|
855
859
|
propertyName: "virtualizer",
|
|
856
860
|
first: !0,
|
|
857
|
-
predicate:
|
|
861
|
+
predicate: Y,
|
|
858
862
|
emitDistinctChangesOnly: !1,
|
|
859
863
|
descendants: !0,
|
|
860
864
|
isSignal: !0
|
|
861
865
|
} ],
|
|
862
866
|
ngImport: e,
|
|
863
|
-
template: '\n <div\n virtuaVirtualizer\n [data]="data()"\n [getKey]="getKey()"\n [itemProps]="itemProps()"\n [bufferSize]="bufferSize()"\n [itemSize]="itemSize()"\n [ssrCount]="ssrCount()"\n [shift]="shift()"\n [horizontal]="horizontal()"\n [keepMounted]="keepMounted()"\n [cache]="
|
|
867
|
+
template: '\n <div\n virtuaVirtualizer\n [data]="data()"\n [getKey]="getKey()"\n [itemProps]="itemProps()"\n [bufferSize]="bufferSize()"\n [itemSize]="itemSize()"\n [ssrCount]="ssrCount()"\n [shift]="shift()"\n [horizontal]="horizontal()"\n [keepMounted]="keepMounted()"\n [cache]="cacheProp()"\n (scroll)="scroll.emit($event)"\n (scrollEnd)="scrollEnd.emit()"\n ></div>\n ',
|
|
864
868
|
isInline: !0,
|
|
865
869
|
dependencies: [ {
|
|
866
870
|
kind: "directive",
|
|
867
|
-
type: e.forwardRef(() =>
|
|
871
|
+
type: e.forwardRef(() => Y),
|
|
868
872
|
selector: "virtua-virtualizer",
|
|
869
|
-
inputs: [ "data", "getKey", "itemProps", "bufferSize", "scrollRef", "itemSize", "ssrCount", "shift", "horizontal", "keepMounted", "cache", "startMargin"
|
|
873
|
+
inputs: [ "data", "getKey", "itemProps", "bufferSize", "scrollRef", "itemSize", "ssrCount", "shift", "horizontal", "keepMounted", "cache", "startMargin" ],
|
|
870
874
|
outputs: [ "scroll", "scrollEnd" ]
|
|
871
875
|
} ],
|
|
876
|
+
viewProviders: [ {
|
|
877
|
+
provide: X,
|
|
878
|
+
useFactory: () => h(t).template
|
|
879
|
+
} ],
|
|
872
880
|
changeDetection: e.ChangeDetectionStrategy.OnPush
|
|
873
881
|
});
|
|
874
882
|
};
|
|
875
883
|
|
|
876
884
|
i.OnPush;
|
|
877
885
|
|
|
878
|
-
var
|
|
879
|
-
data=
|
|
880
|
-
getKey=
|
|
881
|
-
bufferSize=
|
|
882
|
-
itemSize=
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
886
|
+
var U = class i {
|
|
887
|
+
data=p.required();
|
|
888
|
+
getKey=p(j);
|
|
889
|
+
bufferSize=p();
|
|
890
|
+
itemSize=p();
|
|
891
|
+
ssrCount=p();
|
|
892
|
+
shift=p(!1);
|
|
893
|
+
horizontal=p(!1);
|
|
894
|
+
cacheProp=p(void 0, {
|
|
895
|
+
alias: "cache"
|
|
896
|
+
});
|
|
897
|
+
scroll=f();
|
|
898
|
+
scrollEnd=f();
|
|
899
|
+
template=u.required(o);
|
|
900
|
+
p;
|
|
901
|
+
S;
|
|
902
|
+
driver;
|
|
903
|
+
v=h(n).nativeElement;
|
|
904
|
+
N=h(t);
|
|
905
|
+
P=d(void 0);
|
|
906
|
+
isSSR=d(!1);
|
|
907
|
+
items=c(() => {
|
|
908
|
+
this.P();
|
|
909
|
+
const e = this.p, t = this.data(), i = this.getKey(), s = this.driver.$isNegative(), [n, r] = e.$getRange(this.bufferSize()), o = [];
|
|
910
|
+
for (let a = n; a <= r && a < t.length; a++) {
|
|
911
|
+
const n = t[a];
|
|
900
912
|
o.push({
|
|
901
|
-
key: i(n,
|
|
902
|
-
index:
|
|
913
|
+
key: i(n, a),
|
|
914
|
+
index: a,
|
|
903
915
|
data: n,
|
|
904
|
-
offset: e.$getItemOffset(
|
|
905
|
-
hide: e.$isUnmeasuredItem(
|
|
916
|
+
offset: e.$getItemOffset(a, s),
|
|
917
|
+
hide: e.$isUnmeasuredItem(a)
|
|
906
918
|
});
|
|
907
919
|
}
|
|
908
920
|
return o;
|
|
909
921
|
});
|
|
910
|
-
containerStyle=
|
|
911
|
-
this.
|
|
912
|
-
const e = this.horizontal(), t = this.
|
|
922
|
+
containerStyle=c(() => {
|
|
923
|
+
this.P();
|
|
924
|
+
const e = this.horizontal(), t = this.p.$getTotalSize();
|
|
913
925
|
return {
|
|
914
926
|
display: "block",
|
|
915
927
|
contain: "size style",
|
|
@@ -918,129 +930,116 @@ var H = class i {
|
|
|
918
930
|
position: "relative",
|
|
919
931
|
width: e ? t + "px" : "100%",
|
|
920
932
|
height: e ? "100%" : t + "px",
|
|
921
|
-
"pointer-events": this.
|
|
933
|
+
"pointer-events": this.p.$isScrolling() ? "none" : void 0
|
|
922
934
|
};
|
|
923
935
|
});
|
|
924
936
|
constructor() {
|
|
925
|
-
|
|
937
|
+
m(() => {
|
|
926
938
|
const e = this.data().length;
|
|
927
|
-
this.
|
|
928
|
-
}),
|
|
939
|
+
this.p && e !== this.p.$getItemsLength() && this.p.$update(5, [ e, g(this.shift) ]);
|
|
940
|
+
}), a({
|
|
929
941
|
read: () => {
|
|
930
|
-
this.
|
|
942
|
+
this.isSSR.set(!1), this.driver.$observe(this.v);
|
|
931
943
|
}
|
|
932
944
|
}), l({
|
|
933
945
|
read: () => {
|
|
934
|
-
this.
|
|
946
|
+
this.P(), this.driver.$fixScrollJump();
|
|
935
947
|
}
|
|
936
|
-
}),
|
|
937
|
-
this.
|
|
948
|
+
}), h(s).onDestroy(() => {
|
|
949
|
+
this.p?.$dispose(), this.driver?.$dispose();
|
|
938
950
|
});
|
|
939
951
|
}
|
|
940
952
|
ngOnInit() {
|
|
941
|
-
const e = this.itemSize(), t = this.
|
|
942
|
-
this.
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
}
|
|
950
|
-
s.length && e.$update(3, s);
|
|
951
|
-
});
|
|
952
|
-
let o;
|
|
953
|
-
return {
|
|
954
|
-
$observeRoot(t) {
|
|
955
|
-
const i = _(C(t)), n = () => {
|
|
956
|
-
e.$update(4, i[s]);
|
|
957
|
-
};
|
|
958
|
-
i.addEventListener("resize", n), P(n), o = () => {
|
|
959
|
-
i.removeEventListener("resize", n);
|
|
960
|
-
};
|
|
961
|
-
},
|
|
962
|
-
$observeItem: (e, t) => (n.set(e, t), r.v(e), () => {
|
|
963
|
-
n.delete(e), r.N(e);
|
|
964
|
-
}),
|
|
965
|
-
$dispose() {
|
|
966
|
-
o && o(), r.p();
|
|
967
|
-
}
|
|
968
|
-
};
|
|
969
|
-
})(t, this.horizontal()), this.P = ((e, t) => {
|
|
970
|
-
let i, s, n = R(), r = !1;
|
|
971
|
-
const o = t ? "left" : "top", [l] = B(e, () => n[0], (e, t) => {
|
|
972
|
-
e = D(e, r);
|
|
973
|
-
const s = _(C(i));
|
|
953
|
+
const e = this.itemSize(), t = this.ssrCount();
|
|
954
|
+
this.isSSR.set(!!t);
|
|
955
|
+
const i = this.S = K(this.data().length, e, this.cacheProp()), s = this.p = C(i, t);
|
|
956
|
+
this.driver = ((e, t) => {
|
|
957
|
+
let i, s, n, r = x(), o = !1;
|
|
958
|
+
const a = t ? "left" : "top", [l] = D(e, () => r[0], (e, t) => {
|
|
959
|
+
e = E(e, o);
|
|
960
|
+
const s = w(F(i));
|
|
974
961
|
t ? s.scroll({
|
|
975
|
-
[
|
|
962
|
+
[a]: e,
|
|
976
963
|
behavior: "smooth"
|
|
977
964
|
}) : s.scroll({
|
|
978
|
-
[
|
|
965
|
+
[a]: e
|
|
979
966
|
});
|
|
980
|
-
}),
|
|
981
|
-
const
|
|
982
|
-
|
|
967
|
+
}), c = t ? "width" : "height", u = /* @__PURE__ */ new WeakMap, m = V(t => {
|
|
968
|
+
const i = [];
|
|
969
|
+
for (const {target: e, contentRect: s} of t) {
|
|
970
|
+
if (!e.offsetParent) continue;
|
|
971
|
+
const t = u.get(e);
|
|
972
|
+
null != t && i.push([ t, s[c] ]);
|
|
973
|
+
}
|
|
974
|
+
i.length && e.$update(3, i);
|
|
975
|
+
}), h = (e, t, i, s, n = 0) => {
|
|
976
|
+
const r = s ? "offsetLeft" : "offsetTop", a = n + (s && o ? i.innerWidth - e[r] - e.offsetWidth : e[r]), l = e.offsetParent;
|
|
977
|
+
return e !== t && l ? h(l, t, i, s, a) : a;
|
|
983
978
|
};
|
|
984
979
|
return {
|
|
985
980
|
$observe(l) {
|
|
986
981
|
i = l;
|
|
987
|
-
const c = t ? "scrollX" : "scrollY", u =
|
|
988
|
-
|
|
982
|
+
const c = t ? "scrollX" : "scrollY", u = F(l), m = w(u), p = () => {
|
|
983
|
+
e.$update(4, m[t ? "innerWidth" : "innerHeight"]);
|
|
984
|
+
};
|
|
985
|
+
m.addEventListener("resize", p), I(p), n = () => {
|
|
986
|
+
m.removeEventListener("resize", p);
|
|
987
|
+
}, t && (o = "rtl" === getComputedStyle(k(u)).direction), s = L(e, m, t, () => E(m[c], o), (t, i) => {
|
|
989
988
|
i ? m.scroll({
|
|
990
|
-
[
|
|
989
|
+
[a]: E(e.$getScrollOffset() + t, o)
|
|
991
990
|
}) : m.scrollBy({
|
|
992
|
-
[
|
|
991
|
+
[a]: E(t, o)
|
|
993
992
|
});
|
|
994
|
-
}, () =>
|
|
993
|
+
}, () => h(l, u.body, m, t)), r[1](!0);
|
|
995
994
|
},
|
|
996
995
|
$dispose() {
|
|
997
|
-
s && s.
|
|
996
|
+
n && n(), m.l(), s && s.l(), i = void 0, r[1](!1), r = x();
|
|
998
997
|
},
|
|
999
|
-
$
|
|
1000
|
-
|
|
1001
|
-
|
|
998
|
+
$observeItem: (e, t) => (u.set(e, t), m.i(e), () => {
|
|
999
|
+
u.delete(e), m.o(e);
|
|
1000
|
+
}),
|
|
1001
|
+
$isNegative: () => o,
|
|
1002
|
+
$scheduleScroll: l,
|
|
1003
|
+
$fixScrollJump() {
|
|
1004
|
+
s && s.m();
|
|
1002
1005
|
},
|
|
1003
|
-
$
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
const c = C(i), u = _(c), m = O(c), h = () => e.$getViewportSize() - (t ? m.clientWidth : m.clientHeight);
|
|
1013
|
-
l(() => o + a(i, c.body, u, t) + e.$getItemOffset(s) + ("end" === n ? e.$getItemSize(s) - (e.$getViewportSize() - h()) : "center" === n ? (e.$getItemSize(s) - (e.$getViewportSize() - h())) / 2 : 0), r);
|
|
1006
|
+
$getBaseOffset() {
|
|
1007
|
+
const e = F(i);
|
|
1008
|
+
return h(i, e.body, w(e), t);
|
|
1009
|
+
},
|
|
1010
|
+
$getScrollbarSize() {
|
|
1011
|
+
const s = k(F(i));
|
|
1012
|
+
return e.$getViewportSize() - (t ? s.clientWidth : s.clientHeight);
|
|
1014
1013
|
}
|
|
1015
1014
|
};
|
|
1016
|
-
})(
|
|
1017
|
-
this.
|
|
1018
|
-
}),
|
|
1015
|
+
})(s, this.horizontal()), s.$subscribe(1, e => {
|
|
1016
|
+
this.P.set(s.$getStateVersion()), e && this.N.tick();
|
|
1017
|
+
}), s.$subscribe(4, () => {
|
|
1019
1018
|
this.scroll.emit();
|
|
1020
|
-
}),
|
|
1019
|
+
}), s.$subscribe(8, () => {
|
|
1021
1020
|
this.scrollEnd.emit();
|
|
1022
|
-
}), this.
|
|
1021
|
+
}), this.P.set(s.$getStateVersion());
|
|
1023
1022
|
}
|
|
1024
|
-
|
|
1025
|
-
return this.
|
|
1023
|
+
get cache() {
|
|
1024
|
+
return this.S.$snapshot();
|
|
1026
1025
|
}
|
|
1027
|
-
|
|
1028
|
-
return this.
|
|
1026
|
+
get scrollOffset() {
|
|
1027
|
+
return this.p.$getScrollOffset();
|
|
1029
1028
|
}
|
|
1030
|
-
|
|
1031
|
-
return this.
|
|
1029
|
+
get viewportSize() {
|
|
1030
|
+
return this.p.$getViewportSize();
|
|
1032
1031
|
}
|
|
1033
1032
|
findItemIndex(e) {
|
|
1034
|
-
return this.
|
|
1033
|
+
return this.p.$findItemIndex(e);
|
|
1035
1034
|
}
|
|
1036
1035
|
getItemOffset(e) {
|
|
1037
|
-
return this.
|
|
1036
|
+
return this.p.$getItemOffset(e);
|
|
1038
1037
|
}
|
|
1039
1038
|
getItemSize(e) {
|
|
1040
|
-
return this.
|
|
1039
|
+
return this.p.$getItemSize(e);
|
|
1041
1040
|
}
|
|
1042
1041
|
scrollToIndex(e, t) {
|
|
1043
|
-
this.
|
|
1042
|
+
J(this.driver, this.p, e, t);
|
|
1044
1043
|
}
|
|
1045
1044
|
static ɵfac=/*@__PURE__*/ e.ɵɵngDeclareFactory({
|
|
1046
1045
|
minVersion: "12.0.0",
|
|
@@ -1085,6 +1084,13 @@ var H = class i {
|
|
|
1085
1084
|
isRequired: !1,
|
|
1086
1085
|
transformFunction: null
|
|
1087
1086
|
},
|
|
1087
|
+
ssrCount: {
|
|
1088
|
+
classPropertyName: "ssrCount",
|
|
1089
|
+
publicName: "ssrCount",
|
|
1090
|
+
isSignal: !0,
|
|
1091
|
+
isRequired: !1,
|
|
1092
|
+
transformFunction: null
|
|
1093
|
+
},
|
|
1088
1094
|
shift: {
|
|
1089
1095
|
classPropertyName: "shift",
|
|
1090
1096
|
publicName: "shift",
|
|
@@ -1099,8 +1105,8 @@ var H = class i {
|
|
|
1099
1105
|
isRequired: !1,
|
|
1100
1106
|
transformFunction: null
|
|
1101
1107
|
},
|
|
1102
|
-
|
|
1103
|
-
classPropertyName: "
|
|
1108
|
+
cacheProp: {
|
|
1109
|
+
classPropertyName: "cacheProp",
|
|
1104
1110
|
publicName: "cache",
|
|
1105
1111
|
isSignal: !0,
|
|
1106
1112
|
isRequired: !1,
|
|
@@ -1119,19 +1125,19 @@ var H = class i {
|
|
|
1119
1125
|
queries: [ {
|
|
1120
1126
|
propertyName: "template",
|
|
1121
1127
|
first: !0,
|
|
1122
|
-
predicate:
|
|
1128
|
+
predicate: o,
|
|
1123
1129
|
emitDistinctChangesOnly: !1,
|
|
1124
1130
|
descendants: !0,
|
|
1125
1131
|
isSignal: !0
|
|
1126
1132
|
} ],
|
|
1127
1133
|
ngImport: e,
|
|
1128
|
-
template: '\n @for (item of items(); track item.key) {\n <div\n virtuaListItem\n [index]="item.index"\n [offset]="item.offset"\n [hide]="item.hide"\n [horizontal]="horizontal()"\n [resizer]="
|
|
1134
|
+
template: '\n @for (item of items(); track item.key) {\n <div\n virtuaListItem\n [index]="item.index"\n [offset]="item.offset"\n [hide]="item.hide"\n [horizontal]="horizontal()"\n [isSSR]="isSSR()"\n [resizer]="driver.$observeItem"\n >\n <ng-container\n [ngTemplateOutlet]="template()"\n [ngTemplateOutletContext]="{\n $implicit: item.data,\n index: item.index,\n }"\n />\n </div>\n }\n ',
|
|
1129
1135
|
isInline: !0,
|
|
1130
1136
|
dependencies: [ {
|
|
1131
1137
|
kind: "directive",
|
|
1132
1138
|
type: e.forwardRef(() => W),
|
|
1133
1139
|
selector: "div[virtuaListItem]",
|
|
1134
|
-
inputs: [ "index", "offset", "hide", "horizontal", "resizer", "attrs" ]
|
|
1140
|
+
inputs: [ "index", "offset", "hide", "horizontal", "isSSR", "resizer", "attrs" ]
|
|
1135
1141
|
}, {
|
|
1136
1142
|
kind: "directive",
|
|
1137
1143
|
type: e.forwardRef(() => y),
|
|
@@ -1144,5 +1150,5 @@ var H = class i {
|
|
|
1144
1150
|
|
|
1145
1151
|
i.OnPush;
|
|
1146
1152
|
|
|
1147
|
-
export {
|
|
1153
|
+
export { Q as VList, Y as Virtualizer, U as WindowVirtualizer };
|
|
1148
1154
|
//# sourceMappingURL=index.js.map
|