@glhrmoura/vue-virtualize 0.1.2 → 0.1.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/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { shallowRef as xe, ref as L, toValue as l, watch as me, onBeforeUnmount as ge, computed as b, defineComponent as ee, openBlock as R, createBlock as j, resolveDynamicComponent as q, normalizeStyle as V, withCtx as Y, renderSlot as A, createElementBlock as C, Fragment as H, renderList as P, unref as B, mergeProps as te, createElementVNode as oe, toDisplayString as le, createTextVNode as pe } from "vue";
2
- function U(e) {
1
+ import { shallowRef as Me, ref as L, toValue as o, watch as ve, onBeforeUnmount as Se, computed as O, defineComponent as ie, openBlock as T, createBlock as q, resolveDynamicComponent as U, normalizeStyle as F, withCtx as Z, renderSlot as j, createElementBlock as V, Fragment as W, renderList as _, unref as K, mergeProps as ne, createElementVNode as le, toDisplayString as ue, createTextVNode as Re } from "vue";
2
+ function ee(e) {
3
3
  return !Number.isFinite(e) || e < 0 ? 0 : e;
4
4
  }
5
- class be {
5
+ class Te {
6
6
  sizes = /* @__PURE__ */ new Map();
7
7
  divergent = !1;
8
8
  get(t) {
@@ -30,32 +30,45 @@ class be {
30
30
  }
31
31
  }
32
32
  }
33
- function ve(e, t, i) {
33
+ function ze(e, t, i) {
34
34
  return Math.min(i, Math.max(t, e));
35
35
  }
36
- function Q(e, t, i) {
36
+ const Ee = 16777216;
37
+ function B(e, t, i) {
37
38
  const n = Math.max(0, t - Math.max(0, i));
38
- return ve(Number.isFinite(e) ? e : 0, 0, n);
39
+ return ze(Number.isFinite(e) ? e : 0, 0, n);
40
+ }
41
+ function G(e, t) {
42
+ const i = Math.max(0, Number.isFinite(e) ? e : 0), n = Math.min(i, Ee);
43
+ return t === void 0 || !Number.isFinite(t) || t <= 0 ? n : Math.min(n, t);
44
+ }
45
+ function Ce(e, t, i, n) {
46
+ const r = Math.max(0, t - Math.max(0, n)), s = Math.max(0, i - Math.max(0, n));
47
+ return r <= 0 ? 0 : s <= 0 || s >= r ? B(e, t, n) : Math.max(0, e) / s * r;
48
+ }
49
+ function ke(e, t, i, n) {
50
+ const r = Math.max(0, t - Math.max(0, n)), s = Math.max(0, i - Math.max(0, n));
51
+ return s <= 0 ? 0 : r <= 0 || s >= r ? B(e, t, n) : B(e, t, n) / r * s;
39
52
  }
40
- function Ie(e, t, i) {
53
+ function Ve(e, t, i) {
41
54
  if (e <= 0) return 0;
42
55
  let n = 0, r = e - 1, s = e - 1;
43
56
  for (; n <= r; ) {
44
- const f = n + r >>> 1;
45
- i(f) > t ? (s = f, r = f - 1) : n = f + 1;
57
+ const d = n + r >>> 1;
58
+ i(d) > t ? (s = d, r = d - 1) : n = d + 1;
46
59
  }
47
60
  return s;
48
61
  }
49
- function Oe(e, t, i) {
62
+ function Ae(e, t, i) {
50
63
  if (e <= 0) return 0;
51
64
  let n = 0, r = e - 1, s = 0;
52
65
  for (; n <= r; ) {
53
- const f = n + r >>> 1;
54
- i(f) < t ? (s = f, n = f + 1) : r = f - 1;
66
+ const d = n + r >>> 1;
67
+ i(d) < t ? (s = d, n = d + 1) : r = d - 1;
55
68
  }
56
69
  return s;
57
70
  }
58
- function Re(e) {
71
+ function $e(e) {
59
72
  const t = e.start + e.size;
60
73
  let i = e.align;
61
74
  if (i === "auto") {
@@ -65,7 +78,7 @@ function Re(e) {
65
78
  }
66
79
  return i === "center" ? e.start - (e.viewport - e.size) / 2 : i === "end" ? t - e.viewport : e.start;
67
80
  }
68
- class Te {
81
+ class Fe {
69
82
  count = 0;
70
83
  estimateSize = () => 0;
71
84
  overscan = 0;
@@ -77,14 +90,14 @@ class Te {
77
90
  viewportSize = 0;
78
91
  scrollOffset = 0;
79
92
  getItemKey = (t) => t;
80
- measurements = new be();
93
+ measurements = new Te();
81
94
  built = 0;
82
95
  offsets = [];
83
96
  laneCursor = [];
84
97
  laneEnd = [];
85
98
  setOptions(t) {
86
- const i = Math.max(1, Math.floor(t.lanes ?? 1)), n = t.gap ?? 0, r = t.paddingStart ?? 0, s = t.paddingEnd ?? 0, f = Math.max(0, Math.floor(t.count)), m = t.itemSize === void 0 || t.itemSize === null ? null : U(t.itemSize), y = this.itemSize, p = i !== this.lanes || n !== this.gap || r !== this.paddingStart || s !== this.paddingEnd || t.estimateSize !== this.estimateSize || m !== this.itemSize;
87
- this.count = f, this.lanes = i, this.gap = n, this.paddingStart = r, this.paddingEnd = s, this.overscan = Math.max(0, Math.floor(t.overscan ?? 0)), this.estimateSize = t.estimateSize, this.itemSize = m, this.getItemKey = t.getItemKey ?? ((v) => v), t.viewportSize !== void 0 && (this.viewportSize = Math.max(0, t.viewportSize)), m !== y && this.measurements.clear(), this.measurements.trim(this.count, this.itemSize), (p || this.built > this.count) && this.resetGeometry();
99
+ const i = Math.max(1, Math.floor(t.lanes ?? 1)), n = t.gap ?? 0, r = t.paddingStart ?? 0, s = t.paddingEnd ?? 0, d = Math.max(0, Math.floor(t.count)), p = t.itemSize === void 0 || t.itemSize === null ? null : ee(t.itemSize), w = this.itemSize, I = i !== this.lanes || n !== this.gap || r !== this.paddingStart || s !== this.paddingEnd || t.estimateSize !== this.estimateSize || p !== this.itemSize;
100
+ this.count = d, this.lanes = i, this.gap = n, this.paddingStart = r, this.paddingEnd = s, this.overscan = Math.max(0, Math.floor(t.overscan ?? 0)), this.estimateSize = t.estimateSize, this.itemSize = p, this.getItemKey = t.getItemKey ?? ((y) => y), t.viewportSize !== void 0 && (this.viewportSize = Math.max(0, t.viewportSize)), p !== w && this.measurements.clear(), this.measurements.trim(this.count, this.itemSize), (I || this.built > this.count) && this.resetGeometry();
88
101
  }
89
102
  setScrollOffset(t) {
90
103
  this.scrollOffset = Number.isFinite(t) ? t : 0;
@@ -97,7 +110,7 @@ class Te {
97
110
  }
98
111
  measure(t, i) {
99
112
  if (t < 0 || t >= this.count) return !1;
100
- const n = U(i), r = this.measurements.get(t);
113
+ const n = ee(i), r = this.measurements.get(t);
101
114
  if (r !== void 0 && Math.abs(r - n) < 0.5) return !1;
102
115
  const s = this.getItemSize(t);
103
116
  return this.measurements.set(t, n, this.itemSize), Math.abs(s - n) < 0.5 ? !1 : (this.resetGeometry(), !0);
@@ -107,7 +120,7 @@ class Te {
107
120
  }
108
121
  getItemSize(t) {
109
122
  const i = this.measurements.get(t);
110
- return i !== void 0 ? i : this.itemSize !== null ? this.itemSize : U(this.estimateSize(t));
123
+ return i !== void 0 ? i : this.itemSize !== null ? this.itemSize : ee(this.estimateSize(t));
111
124
  }
112
125
  getItemOffset(t) {
113
126
  if (t <= 0 || this.count <= 0) return this.paddingStart;
@@ -124,8 +137,8 @@ class Te {
124
137
  let i = this.paddingStart;
125
138
  const n = this.itemSize ?? 0;
126
139
  for (let r = 0; r < this.lanes && r < this.count; r += 1) {
127
- const s = this.laneLength(r), f = this.paddingStart + s * n + Math.max(0, s - 1) * this.gap;
128
- f > i && (i = f);
140
+ const s = this.laneLength(r), d = this.paddingStart + s * n + Math.max(0, s - 1) * this.gap;
141
+ d > i && (i = d);
129
142
  }
130
143
  return i + this.paddingEnd;
131
144
  }
@@ -139,26 +152,26 @@ class Te {
139
152
  }
140
153
  getVirtualItems() {
141
154
  if (this.count <= 0 || this.viewportSize <= 0) return [];
142
- const t = Q(this.scrollOffset, this.getTotalSize(), this.viewportSize), i = t + this.viewportSize, n = [];
155
+ const t = B(this.scrollOffset, this.getTotalSize(), this.viewportSize), i = t + this.viewportSize, n = [];
143
156
  for (let r = 0; r < this.lanes; r += 1) {
144
157
  const s = this.laneLength(r);
145
158
  if (s <= 0) continue;
146
- const f = Ie(s, t, (v) => {
147
- const w = this.ordinalIndex(r, v);
148
- return this.getItemOffset(w) + this.getItemSize(w);
149
- }), m = Oe(
159
+ const d = Ve(s, t, (y) => {
160
+ const b = this.ordinalIndex(r, y);
161
+ return this.getItemOffset(b) + this.getItemSize(b);
162
+ }), p = Ae(
150
163
  s,
151
164
  i,
152
- (v) => this.getItemOffset(this.ordinalIndex(r, v))
153
- ), y = Math.max(0, Math.min(f, m) - this.overscan), p = Math.min(s - 1, Math.max(f, m) + this.overscan);
154
- for (let v = y; v <= p; v += 1) {
155
- const w = this.ordinalIndex(r, v), E = this.getItemOffset(w), k = this.getItemSize(w);
165
+ (y) => this.getItemOffset(this.ordinalIndex(r, y))
166
+ ), w = Math.max(0, Math.min(d, p) - this.overscan), I = Math.min(s - 1, Math.max(d, p) + this.overscan);
167
+ for (let y = w; y <= I; y += 1) {
168
+ const b = this.ordinalIndex(r, y), E = this.getItemOffset(b), C = this.getItemSize(b);
156
169
  n.push({
157
- index: w,
158
- key: this.getItemKey(w),
170
+ index: b,
171
+ key: this.getItemKey(b),
159
172
  start: E,
160
- size: k,
161
- end: E + k,
173
+ size: C,
174
+ end: E + C,
162
175
  lane: r
163
176
  });
164
177
  }
@@ -167,14 +180,14 @@ class Te {
167
180
  }
168
181
  getOffsetForIndex(t, i = "auto") {
169
182
  if (this.count <= 0) return 0;
170
- const n = ve(t, 0, this.count - 1), r = this.getItemOffset(n), s = this.getItemSize(n), f = Re({
183
+ const n = ze(t, 0, this.count - 1), r = this.getItemOffset(n), s = this.getItemSize(n), d = $e({
171
184
  start: r,
172
185
  size: s,
173
186
  viewport: this.viewportSize,
174
187
  current: this.scrollOffset,
175
188
  align: i
176
189
  });
177
- return Q(f, this.getTotalSize(), this.viewportSize);
190
+ return B(d, this.getTotalSize(), this.viewportSize);
178
191
  }
179
192
  usesFixedPath() {
180
193
  return this.itemSize !== null && !this.measurements.hasDivergent;
@@ -199,13 +212,13 @@ class Te {
199
212
  this.built = 0, this.offsets = [], this.laneCursor = Array.from({ length: this.lanes }, () => this.paddingStart), this.laneEnd = Array.from({ length: this.lanes }, () => this.paddingStart);
200
213
  }
201
214
  }
202
- function W() {
215
+ function D() {
203
216
  return typeof window < "u" && typeof document < "u";
204
217
  }
205
- function Se(e) {
218
+ function ye(e) {
206
219
  return typeof Element > "u" ? null : e instanceof Element ? e : null;
207
220
  }
208
- function X(e, t, i, n) {
221
+ function Ke(e, t, i, n) {
209
222
  if (n === "smooth" && typeof e.scrollTo == "function") {
210
223
  e.scrollTo({
211
224
  top: i ? e.scrollTop : t,
@@ -216,19 +229,22 @@ function X(e, t, i, n) {
216
229
  }
217
230
  i ? e.scrollLeft = t : e.scrollTop = t;
218
231
  }
219
- function J(e, t) {
232
+ function ce(e, t) {
220
233
  return t ? e.scrollLeft : e.scrollTop;
221
234
  }
222
- function ue(e, t) {
235
+ function fe(e, t) {
223
236
  return t ? e.clientWidth : e.clientHeight;
224
237
  }
225
- function ce(e) {
238
+ function Le(e, t) {
239
+ return t ? e.scrollWidth : e.scrollHeight;
240
+ }
241
+ function de(e) {
226
242
  return typeof requestAnimationFrame == "function" ? requestAnimationFrame(e) : setTimeout(e, 0);
227
243
  }
228
- function fe(e) {
244
+ function he(e) {
229
245
  e && (typeof cancelAnimationFrame == "function" ? cancelAnimationFrame(e) : clearTimeout(e));
230
246
  }
231
- function Ee(e, t) {
247
+ function je(e, t) {
232
248
  if (e.length !== t.length) return !1;
233
249
  for (let i = 0; i < e.length; i += 1) {
234
250
  const n = e[i], r = t[i];
@@ -237,154 +253,176 @@ function Ee(e, t) {
237
253
  }
238
254
  return !0;
239
255
  }
240
- function Z(e) {
241
- const t = new Te(), i = xe([]), n = L(0), r = L(0), s = L(!1), f = (c) => e.estimateSize(c);
242
- let m = null, y = null, p = null, v = 0, w = 0, E = 0, k = l(e.revision);
243
- const o = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), a = [];
244
- function d() {
245
- const c = l(e.container);
246
- return typeof HTMLElement > "u" ? null : c instanceof HTMLElement ? c : null;
247
- }
256
+ function te(e) {
257
+ const t = new Fe(), i = Me([]), n = L(0), r = L(0), s = L(0), d = L(!1), p = (a) => e.estimateSize(a);
258
+ let w = null, I = null, y = null, b = 0, E = 0, C = 0, u = o(e.revision);
259
+ const c = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), l = [];
248
260
  function S() {
249
- return l(e.horizontal) ?? !1;
250
- }
251
- function K() {
252
- const c = l(e.initialRect);
253
- return c ? S() ? c.width : c.height : 0;
254
- }
255
- function M() {
256
- const c = l(e.revision);
257
- Object.is(c, k) || (k = c, t.clearMeasurements());
258
- const z = d(), x = z ? ue(z, S()) : 0, O = l(e.viewportInset) ?? 0, T = Math.max(0, (x > 0 ? x : K()) - O), F = l(e.itemSize);
261
+ const a = o(e.container);
262
+ return typeof HTMLElement > "u" ? null : a instanceof HTMLElement ? a : null;
263
+ }
264
+ function m() {
265
+ return o(e.horizontal) ?? !1;
266
+ }
267
+ function N() {
268
+ const a = o(e.initialRect);
269
+ return a ? m() ? a.width : a.height : 0;
270
+ }
271
+ function X(a, f) {
272
+ return a ? G(f, Le(a, m())) : G(f);
273
+ }
274
+ function P(a, f, g) {
275
+ return Ce(
276
+ ce(a, m()),
277
+ f,
278
+ X(a, f),
279
+ g
280
+ );
281
+ }
282
+ function v(a, f, g, R, M) {
283
+ Ke(
284
+ a,
285
+ ke(f, g, X(a, g), R),
286
+ m(),
287
+ M
288
+ );
289
+ }
290
+ function x() {
291
+ const a = o(e.revision);
292
+ Object.is(a, u) || (u = a, t.clearMeasurements());
293
+ const f = S(), g = f ? fe(f, m()) : 0, R = o(e.viewportInset) ?? 0, M = Math.max(0, (g > 0 ? g : N()) - R), A = o(e.itemSize);
259
294
  t.setOptions({
260
- count: l(e.count),
261
- estimateSize: f,
262
- overscan: l(e.overscan) ?? 5,
263
- gap: l(e.gap) ?? 0,
264
- paddingStart: l(e.paddingStart) ?? 0,
265
- paddingEnd: l(e.paddingEnd) ?? 0,
266
- lanes: l(e.lanes) ?? 1,
267
- itemSize: F ?? null,
295
+ count: o(e.count),
296
+ estimateSize: p,
297
+ overscan: o(e.overscan) ?? 5,
298
+ gap: o(e.gap) ?? 0,
299
+ paddingStart: o(e.paddingStart) ?? 0,
300
+ paddingEnd: o(e.paddingEnd) ?? 0,
301
+ lanes: o(e.lanes) ?? 1,
302
+ itemSize: A ?? null,
268
303
  getItemKey: e.getItemKey,
269
- viewportSize: T
304
+ viewportSize: M
270
305
  });
271
- const G = Math.max(0, t.getTotalSize() - T);
272
- t.getScrollOffset() > G && (t.setScrollOffset(G), z && J(z, S()) !== G && X(z, G, S(), "auto"));
273
- const re = t.getVirtualItems();
274
- Ee(i.value, re) || (i.value = re);
275
- const se = t.getTotalSize();
276
- n.value !== se && (n.value = se);
277
- const ae = t.getScrollOffset();
278
- r.value !== ae && (r.value = ae);
279
- }
280
- function _() {
281
- if (!W()) {
282
- M();
306
+ const $ = t.getTotalSize(), J = Math.max(0, $ - M);
307
+ t.getScrollOffset() > J && (t.setScrollOffset(J), f && v(f, J, $, M, "auto"));
308
+ const oe = t.getVirtualItems();
309
+ je(i.value, oe) || (i.value = oe), n.value !== $ && (n.value = $);
310
+ const Q = t.getScrollOffset();
311
+ r.value !== Q && (r.value = Q);
312
+ const ae = f ? Q - ce(f, m()) : 0;
313
+ s.value !== ae && (s.value = ae);
314
+ }
315
+ function z() {
316
+ if (!D()) {
317
+ x();
283
318
  return;
284
319
  }
285
- v || (v = ce(() => {
286
- v = 0, s.value = !0, M(), typeof window < "u" && (window.clearTimeout(E), E = window.setTimeout(() => {
287
- s.value = !1;
320
+ b || (b = de(() => {
321
+ b = 0, d.value = !0, x(), typeof window < "u" && (window.clearTimeout(C), C = window.setTimeout(() => {
322
+ d.value = !1;
288
323
  }, 150));
289
324
  }));
290
325
  }
291
- function h() {
292
- const c = d();
293
- c && (t.setScrollOffset(J(c, S())), _());
294
- }
295
- function I() {
296
- const c = d();
297
- if (c === m || (m && (m.removeEventListener("scroll", h), y?.disconnect(), y = null), m = c, !c || !W())) return;
298
- const z = S();
299
- t.getScrollOffset() > 0 ? X(c, t.getScrollOffset(), z, "auto") : t.setScrollOffset(J(c, z)), c.addEventListener("scroll", h, { passive: !0 }), typeof ResizeObserver < "u" && (y = new ResizeObserver(() => M()), y.observe(c));
300
- }
301
- function g() {
302
- return !W() || typeof ResizeObserver > "u" ? null : (p || (p = new ResizeObserver((c) => {
303
- const z = S();
304
- let x = !1;
305
- for (const O of c) {
306
- const T = o.get(O.target);
307
- if (T === void 0) continue;
308
- const F = O.borderBoxSize?.[0], G = z ? F?.inlineSize ?? O.contentRect.width : F?.blockSize ?? O.contentRect.height;
309
- G > 0 && t.measure(T, G) && (x = !0);
326
+ function k() {
327
+ const a = S();
328
+ if (!a) return;
329
+ const f = t.getViewportSize(), g = t.getTotalSize();
330
+ t.setScrollOffset(P(a, g, f)), z();
331
+ }
332
+ function Y() {
333
+ const a = S();
334
+ if (a === w || (w && (w.removeEventListener("scroll", k), I?.disconnect(), I = null), w = a, !a || !D())) return;
335
+ const f = t.getViewportSize(), g = t.getTotalSize();
336
+ t.getScrollOffset() > 0 ? v(a, t.getScrollOffset(), g, f, "auto") : t.setScrollOffset(P(a, g, f)), a.addEventListener("scroll", k, { passive: !0 }), typeof ResizeObserver < "u" && (I = new ResizeObserver(() => x()), I.observe(a));
337
+ }
338
+ function xe() {
339
+ return !D() || typeof ResizeObserver > "u" ? null : (y || (y = new ResizeObserver((a) => {
340
+ const f = m();
341
+ let g = !1;
342
+ for (const R of a) {
343
+ const M = c.get(R.target);
344
+ if (M === void 0) continue;
345
+ const A = R.borderBoxSize?.[0], $ = f ? A?.inlineSize ?? R.contentRect.width : A?.blockSize ?? R.contentRect.height;
346
+ $ > 0 && t.measure(M, $) && (g = !0);
310
347
  }
311
- x && M();
312
- })), p);
313
- }
314
- function $() {
315
- w = 0;
316
- const c = a.splice(0, a.length), z = S();
317
- let x = !1;
318
- for (const O of c) {
319
- if (!O.element.isConnected) continue;
320
- const T = O.element.getBoundingClientRect(), F = z ? T.width : T.height;
321
- F > 0 && t.measure(O.index, F) && (x = !0);
348
+ g && x();
349
+ })), y);
350
+ }
351
+ function pe() {
352
+ E = 0;
353
+ const a = l.splice(0, l.length), f = m();
354
+ let g = !1;
355
+ for (const R of a) {
356
+ if (!R.element.isConnected) continue;
357
+ const M = R.element.getBoundingClientRect(), A = f ? M.width : M.height;
358
+ A > 0 && t.measure(R.index, A) && (g = !0);
322
359
  }
323
- x && M();
360
+ g && x();
324
361
  }
325
- function D(c, z) {
326
- const x = Se(c), O = g(), T = u.get(z);
327
- T && T !== x && (O?.unobserve(T), o.delete(T), u.delete(z)), x && (u.set(z, x), o.set(x, z), O?.observe(x), a.push({ element: x, index: z }), !w && (w = ce($)));
362
+ function be(a, f) {
363
+ const g = ye(a), R = xe(), M = h.get(f);
364
+ M && M !== g && (R?.unobserve(M), c.delete(M), h.delete(f)), g && (h.set(f, g), c.set(g, f), R?.observe(g), l.push({ element: g, index: f }), !E && (E = de(pe)));
328
365
  }
329
- function ne(c, z = "auto") {
330
- const x = d(), O = x ? ue(x, S()) : 0, T = O > 0 ? O : t.getViewportSize(), F = Q(c, t.getTotalSize(), T);
331
- t.setScrollOffset(F), x && X(x, F, S(), z), M();
366
+ function se(a, f = "auto") {
367
+ const g = S(), R = g ? fe(g, m()) : 0, M = R > 0 ? R : t.getViewportSize(), A = t.getTotalSize(), $ = B(a, A, M);
368
+ t.setScrollOffset($), g && v(g, $, A, M, f), x();
332
369
  }
333
- function ye(c, z) {
334
- const x = t.getOffsetForIndex(c, z?.align ?? "auto");
335
- ne(x, z?.behavior ?? "auto");
370
+ function Ie(a, f) {
371
+ const g = t.getOffsetForIndex(a, f?.align ?? "auto");
372
+ se(g, f?.behavior ?? "auto");
336
373
  }
337
- function we(c, z) {
338
- t.measure(c, z) && M();
374
+ function Oe(a, f) {
375
+ t.measure(a, f) && x();
339
376
  }
340
- return M(), me(
377
+ return x(), ve(
341
378
  () => [
342
- l(e.count),
343
- l(e.overscan),
344
- l(e.gap),
345
- l(e.paddingStart),
346
- l(e.paddingEnd),
347
- l(e.lanes),
348
- l(e.horizontal),
349
- l(e.itemSize),
350
- l(e.viewportInset),
351
- l(e.revision),
352
- l(e.container),
353
- l(e.initialRect)?.width,
354
- l(e.initialRect)?.height
379
+ o(e.count),
380
+ o(e.overscan),
381
+ o(e.gap),
382
+ o(e.paddingStart),
383
+ o(e.paddingEnd),
384
+ o(e.lanes),
385
+ o(e.horizontal),
386
+ o(e.itemSize),
387
+ o(e.viewportInset),
388
+ o(e.revision),
389
+ o(e.container),
390
+ o(e.initialRect)?.width,
391
+ o(e.initialRect)?.height
355
392
  ],
356
393
  () => {
357
- I(), M();
394
+ Y(), x();
358
395
  },
359
396
  { flush: "post" }
360
- ), ge(() => {
361
- m && m.removeEventListener("scroll", h), y?.disconnect(), p?.disconnect(), fe(v), fe(w), typeof window < "u" && window.clearTimeout(E), o.clear(), u.clear(), a.length = 0;
397
+ ), Se(() => {
398
+ w && w.removeEventListener("scroll", k), I?.disconnect(), y?.disconnect(), he(b), he(E), typeof window < "u" && window.clearTimeout(C), c.clear(), h.clear(), l.length = 0;
362
399
  }), {
363
- virtualItems: b(() => i.value),
364
- totalSize: b(() => n.value),
365
- scrollOffset: b(() => r.value),
366
- isScrolling: b(() => s.value),
367
- scrollToIndex: ye,
368
- scrollToOffset: ne,
369
- measure: we,
370
- measureElement: D
400
+ virtualItems: O(() => i.value),
401
+ totalSize: O(() => n.value),
402
+ scrollOffset: O(() => r.value),
403
+ scrollAdjust: O(() => s.value),
404
+ isScrolling: O(() => d.value),
405
+ scrollToIndex: Ie,
406
+ scrollToOffset: se,
407
+ measure: Oe,
408
+ measureElement: be
371
409
  };
372
410
  }
373
- function Me(e, t, i) {
411
+ function Ge(e, t, i) {
374
412
  return typeof e == "function" ? e(t, i) : typeof e == "number" ? e : 48;
375
413
  }
376
- function ze(e) {
377
- const t = Z({
378
- count: () => l(e.items).length,
414
+ function we(e) {
415
+ const t = te({
416
+ count: () => o(e.items).length,
379
417
  estimateSize: (n) => {
380
- const r = l(e.items);
381
- return Me(e.estimateSize, n, r[n]);
418
+ const r = o(e.items);
419
+ return Ge(e.estimateSize, n, r[n]);
382
420
  },
383
421
  getItemKey: (n) => {
384
- const s = l(e.items)[n];
422
+ const s = o(e.items)[n];
385
423
  return e.getItemKey?.(s, n) ?? n;
386
424
  },
387
- itemSize: () => e.itemSize !== void 0 ? l(e.itemSize) : typeof e.estimateSize == "number" ? e.estimateSize : void 0,
425
+ itemSize: () => e.itemSize !== void 0 ? o(e.itemSize) : typeof e.estimateSize == "number" ? e.estimateSize : void 0,
388
426
  container: e.container,
389
427
  horizontal: e.horizontal,
390
428
  overscan: e.overscan,
@@ -396,8 +434,8 @@ function ze(e) {
396
434
  revision: e.revision
397
435
  });
398
436
  return {
399
- virtualItems: b(() => {
400
- const n = l(e.items);
437
+ virtualItems: O(() => {
438
+ const n = o(e.items);
401
439
  return t.virtualItems.value.map((r) => {
402
440
  const s = n[r.index];
403
441
  return {
@@ -409,6 +447,7 @@ function ze(e) {
409
447
  }),
410
448
  totalSize: t.totalSize,
411
449
  scrollOffset: t.scrollOffset,
450
+ scrollAdjust: t.scrollAdjust,
412
451
  isScrolling: t.isScrolling,
413
452
  scrollToIndex: t.scrollToIndex,
414
453
  scrollToOffset: t.scrollToOffset,
@@ -416,102 +455,104 @@ function ze(e) {
416
455
  measureElement: t.measureElement
417
456
  };
418
457
  }
419
- function de(e, t, i) {
458
+ function me(e, t, i) {
420
459
  return typeof e == "function" ? e(t) : typeof e == "number" ? e : i;
421
460
  }
422
- function ke(e) {
423
- const t = b(() => Math.max(1, Math.floor(l(e.columnCount) || 1))), i = b(() => Math.ceil(l(e.items).length / t.value)), n = /* @__PURE__ */ new Map(), r = Z({
461
+ function Ne(e) {
462
+ const t = O(() => Math.max(1, Math.floor(o(e.columnCount) || 1))), i = O(() => Math.ceil(o(e.items).length / t.value)), n = /* @__PURE__ */ new Map(), r = te({
424
463
  count: () => i.value,
425
- estimateSize: (o) => de(l(e.estimateRowSize), o, 48),
464
+ estimateSize: (u) => me(o(e.estimateRowSize), u, 48),
426
465
  itemSize: () => {
427
- const o = l(e.estimateRowSize);
428
- return typeof o == "number" ? o : void 0;
466
+ const u = o(e.estimateRowSize);
467
+ return typeof u == "number" ? u : void 0;
429
468
  },
430
- overscan: () => l(e.overscanRows) ?? l(e.overscan) ?? 2,
431
- gap: () => l(e.rowGap) ?? 0,
469
+ overscan: () => o(e.overscanRows) ?? o(e.overscan) ?? 2,
470
+ gap: () => o(e.rowGap) ?? 0,
432
471
  horizontal: !1,
433
472
  container: e.container,
434
473
  initialRect: e.initialRect,
435
474
  revision: e.revision
436
- }), s = Z({
475
+ }), s = te({
437
476
  count: () => t.value,
438
- estimateSize: (o) => de(l(e.estimateColumnSize), o, 160),
477
+ estimateSize: (u) => me(o(e.estimateColumnSize), u, 160),
439
478
  itemSize: () => {
440
- const o = l(e.estimateColumnSize);
441
- return typeof o == "number" ? o : void 0;
479
+ const u = o(e.estimateColumnSize);
480
+ return typeof u == "number" ? u : void 0;
442
481
  },
443
- overscan: () => l(e.overscanColumns) ?? l(e.overscan) ?? 1,
444
- gap: () => l(e.columnGap) ?? 0,
482
+ overscan: () => o(e.overscanColumns) ?? o(e.overscan) ?? 1,
483
+ gap: () => o(e.columnGap) ?? 0,
445
484
  horizontal: !0,
446
485
  container: e.container,
447
486
  initialRect: e.initialRect,
448
487
  revision: e.revision
449
- }), f = b(() => {
450
- const o = l(e.items), u = t.value, a = [];
451
- for (const d of r.virtualItems.value)
488
+ }), d = O(() => {
489
+ const u = o(e.items), c = t.value, h = [];
490
+ for (const l of r.virtualItems.value)
452
491
  for (const S of s.virtualItems.value) {
453
- const K = d.index * u + S.index;
454
- if (K >= o.length) continue;
455
- const M = o[K];
456
- a.push({
457
- index: K,
458
- key: e.getItemKey?.(M, K) ?? K,
459
- item: M,
460
- row: d,
492
+ const m = l.index * c + S.index;
493
+ if (m >= u.length) continue;
494
+ const N = u[m];
495
+ h.push({
496
+ index: m,
497
+ key: e.getItemKey?.(N, m) ?? m,
498
+ item: N,
499
+ row: l,
461
500
  column: S
462
501
  });
463
502
  }
464
- return a;
503
+ return h;
465
504
  });
466
- function m(o, u) {
467
- const a = l(e.items);
468
- if (!a.length) return;
469
- const d = Math.min(Math.max(o, 0), a.length - 1), S = t.value;
470
- r.scrollToIndex(Math.floor(d / S), u), s.scrollToIndex(d % S, u);
505
+ function p(u, c) {
506
+ const h = o(e.items);
507
+ if (!h.length) return;
508
+ const l = Math.min(Math.max(u, 0), h.length - 1), S = t.value;
509
+ r.scrollToIndex(Math.floor(l / S), c), s.scrollToIndex(l % S, c);
471
510
  }
472
- function y(o, u = "auto") {
473
- o.top !== void 0 && r.scrollToOffset(o.top, u), o.left !== void 0 && s.scrollToOffset(o.left, u);
511
+ function w(u, c = "auto") {
512
+ u.top !== void 0 && r.scrollToOffset(u.top, c), u.left !== void 0 && s.scrollToOffset(u.left, c);
474
513
  }
475
- function p(o, u) {
476
- const a = Math.max(n.get(o) ?? 0, u);
477
- a <= 0 || a === n.get(o) || (n.set(o, a), r.measure(o, a));
514
+ function I(u, c) {
515
+ const h = Math.max(n.get(u) ?? 0, c);
516
+ h <= 0 || h === n.get(u) || (n.set(u, h), r.measure(u, h));
478
517
  }
479
- let v = null;
480
- const w = /* @__PURE__ */ new Map();
518
+ let y = null;
519
+ const b = /* @__PURE__ */ new Map();
481
520
  function E() {
482
- return !W() || typeof ResizeObserver > "u" ? null : (v || (v = new ResizeObserver((o) => {
483
- for (const u of o) {
484
- const a = w.get(u.target);
485
- if (a === void 0) continue;
486
- const S = u.borderBoxSize?.[0]?.blockSize ?? u.contentRect.height;
487
- S > 0 && p(a, S);
521
+ return !D() || typeof ResizeObserver > "u" ? null : (y || (y = new ResizeObserver((u) => {
522
+ for (const c of u) {
523
+ const h = b.get(c.target);
524
+ if (h === void 0) continue;
525
+ const S = c.borderBoxSize?.[0]?.blockSize ?? c.contentRect.height;
526
+ S > 0 && I(h, S);
488
527
  }
489
- })), v);
528
+ })), y);
490
529
  }
491
- function k(o, u) {
492
- const a = Se(o), d = E();
493
- if (!a) return;
494
- w.set(a, u), d?.observe(a);
495
- const S = a.getBoundingClientRect().height;
496
- S > 0 && p(u, S);
530
+ function C(u, c) {
531
+ const h = ye(u), l = E();
532
+ if (!h) return;
533
+ b.set(h, c), l?.observe(h);
534
+ const S = h.getBoundingClientRect().height;
535
+ S > 0 && I(c, S);
497
536
  }
498
- return ge(() => {
499
- v?.disconnect(), w.clear();
537
+ return Se(() => {
538
+ y?.disconnect(), b.clear();
500
539
  }), {
501
540
  virtualRows: r.virtualItems,
502
541
  virtualColumns: s.virtualItems,
503
- virtualCells: f,
542
+ virtualCells: d,
504
543
  totalHeight: r.totalSize,
505
544
  totalWidth: s.totalSize,
506
- scrollToIndex: m,
507
- scrollToOffset: y,
508
- measureRow: p,
509
- measureRowElement: k,
545
+ scrollAdjustX: s.scrollAdjust,
546
+ scrollAdjustY: r.scrollAdjust,
547
+ scrollToIndex: p,
548
+ scrollToOffset: w,
549
+ measureRow: I,
550
+ measureRowElement: C,
510
551
  measureColumn: s.measure
511
552
  };
512
553
  }
513
- function Ce(e) {
514
- const t = ze({
554
+ function Be(e) {
555
+ const t = we({
515
556
  items: e.rows,
516
557
  estimateSize: e.estimateRowSize,
517
558
  container: e.container,
@@ -521,28 +562,29 @@ function Ce(e) {
521
562
  viewportInset: e.viewportInset,
522
563
  revision: e.revision,
523
564
  itemSize: e.itemSize
524
- }), i = b(() => {
525
- const s = l(e.columns);
526
- let f = 0;
527
- return s.map((m) => {
528
- const y = m.width ?? m.minWidth ?? 160, p = {
529
- ...m,
530
- start: f,
531
- size: y,
532
- end: f + y
565
+ }), i = O(() => {
566
+ const s = o(e.columns);
567
+ let d = 0;
568
+ return s.map((p) => {
569
+ const w = p.width ?? p.minWidth ?? 160, I = {
570
+ ...p,
571
+ start: d,
572
+ size: w,
573
+ end: d + w
533
574
  };
534
- return f += y, p;
575
+ return d += w, I;
535
576
  });
536
- }), n = b(() => {
577
+ }), n = O(() => {
537
578
  const s = i.value;
538
579
  return s.length ? s[s.length - 1]?.end ?? 0 : 0;
539
580
  });
540
581
  return {
541
- virtualRows: b(() => t.virtualItems.value),
582
+ virtualRows: O(() => t.virtualItems.value),
542
583
  columns: i,
543
584
  totalHeight: t.totalSize,
544
585
  totalWidth: n,
545
586
  scrollOffset: t.scrollOffset,
587
+ scrollAdjust: t.scrollAdjust,
546
588
  isScrolling: t.isScrolling,
547
589
  scrollToIndex: t.scrollToIndex,
548
590
  scrollToOffset: t.scrollToOffset,
@@ -550,11 +592,11 @@ function Ce(e) {
550
592
  measureElement: t.measureElement
551
593
  };
552
594
  }
553
- function he(e) {
595
+ function ge(e) {
554
596
  if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
555
597
  if (typeof e == "string" && e.trim()) return e;
556
598
  }
557
- function N(e) {
599
+ function H(e) {
558
600
  if (typeof e == "number" && Number.isFinite(e)) return e;
559
601
  if (typeof e != "string") return 0;
560
602
  const t = /^(-?\d+(?:\.\d+)?)px$/.exec(e.trim());
@@ -562,23 +604,24 @@ function N(e) {
562
604
  const i = Number(t[1]);
563
605
  return Number.isFinite(i) ? i : 0;
564
606
  }
565
- function ie(e) {
607
+ function re(e) {
566
608
  return {
567
609
  overflow: "auto",
568
610
  position: "relative",
569
- height: he(e.height) ?? (e.horizontal ? "100%" : void 0),
570
- width: he(e.width) ?? (e.horizontal ? void 0 : "100%"),
611
+ height: ge(e.height) ?? (e.horizontal ? "100%" : void 0),
612
+ width: ge(e.width) ?? (e.horizontal ? void 0 : "100%"),
571
613
  overflowAnchor: "none"
572
614
  };
573
615
  }
574
- function $e(e, t) {
616
+ function He(e, t) {
617
+ const i = G(e);
575
618
  return {
576
619
  position: "relative",
577
- width: t ? `${e}px` : "100%",
578
- height: t ? "100%" : `${e}px`
620
+ width: t ? `${i}px` : "100%",
621
+ height: t ? "100%" : `${i}px`
579
622
  };
580
623
  }
581
- function Fe(e, t) {
624
+ function Pe(e, t) {
582
625
  return {
583
626
  position: "absolute",
584
627
  top: 0,
@@ -588,7 +631,7 @@ function Fe(e, t) {
588
631
  transform: t ? `translateX(${e}px)` : `translateY(${e}px)`
589
632
  };
590
633
  }
591
- const Ae = /* @__PURE__ */ ee({
634
+ const Xe = /* @__PURE__ */ ie({
592
635
  __name: "VirtualList",
593
636
  props: {
594
637
  items: {},
@@ -607,11 +650,11 @@ const Ae = /* @__PURE__ */ ee({
607
650
  revision: {}
608
651
  },
609
652
  setup(e, { expose: t }) {
610
- const i = e, n = L(null), { virtualItems: r, totalSize: s, scrollToIndex: f, scrollToOffset: m, measure: y, measureElement: p } = ze({
653
+ const i = e, n = L(null), { virtualItems: r, totalSize: s, scrollAdjust: d, scrollToIndex: p, scrollToOffset: w, measure: I, measureElement: y } = we({
611
654
  items: () => i.items,
612
- estimateSize: (o, u) => {
613
- const a = i.estimateSize;
614
- return typeof a == "number" ? a : a(o, u);
655
+ estimateSize: (c, h) => {
656
+ const l = i.estimateSize;
657
+ return typeof l == "number" ? l : l(c, h);
615
658
  },
616
659
  itemSize: () => typeof i.estimateSize == "number" ? i.estimateSize : void 0,
617
660
  container: n,
@@ -620,72 +663,72 @@ const Ae = /* @__PURE__ */ ee({
620
663
  gap: () => i.gap,
621
664
  paddingStart: () => i.paddingStart,
622
665
  paddingEnd: () => i.paddingEnd,
623
- getItemKey: (o, u) => i.getItemKey?.(o, u) ?? u,
666
+ getItemKey: (c, h) => i.getItemKey?.(c, h) ?? h,
624
667
  initialRect: () => ({
625
- width: N(i.width),
626
- height: N(i.height)
668
+ width: H(i.width),
669
+ height: H(i.height)
627
670
  }),
628
671
  revision: () => i.revision
629
- }), v = b(
630
- () => ie({
672
+ }), b = O(
673
+ () => re({
631
674
  height: i.height,
632
675
  width: i.width,
633
676
  horizontal: i.horizontal
634
677
  })
635
- ), w = b(() => $e(s.value, i.horizontal));
636
- function E(o) {
637
- return Fe(o, i.horizontal);
678
+ ), E = O(() => He(s.value, i.horizontal));
679
+ function C(c) {
680
+ return Pe(c, i.horizontal);
638
681
  }
639
- function k(o) {
640
- return (u) => {
641
- p(u, o);
682
+ function u(c) {
683
+ return (h) => {
684
+ y(h, c);
642
685
  };
643
686
  }
644
687
  return t({
645
- scrollToIndex: f,
646
- scrollToOffset: m,
647
- measure: y
648
- }), (o, u) => (R(), j(q(e.tag), {
688
+ scrollToIndex: p,
689
+ scrollToOffset: w,
690
+ measure: I
691
+ }), (c, h) => (T(), q(U(e.tag), {
649
692
  ref_key: "container",
650
693
  ref: n,
651
694
  "data-virtual-container": "",
652
695
  role: "list",
653
- style: V(v.value)
696
+ style: F(b.value)
654
697
  }, {
655
- default: Y(() => [
656
- e.items.length ? (R(), C("div", {
698
+ default: Z(() => [
699
+ e.items.length ? (T(), V("div", {
657
700
  key: 1,
658
701
  "data-virtual-spacer": "",
659
- style: V(w.value)
702
+ style: F(E.value)
660
703
  }, [
661
- (R(!0), C(H, null, P(B(r), (a) => (R(), j(q(e.itemTag), te({
662
- key: a.key,
704
+ (T(!0), V(W, null, _(K(r), (l) => (T(), q(U(e.itemTag), ne({
705
+ key: l.key,
663
706
  ref_for: !0,
664
- ref: k(a.index),
707
+ ref: u(l.index),
665
708
  role: "listitem",
666
- "data-index": a.index,
667
- "data-key": String(a.key),
709
+ "data-index": l.index,
710
+ "data-key": String(l.key),
668
711
  "aria-setsize": e.items.length,
669
- "aria-posinset": a.index + 1,
670
- style: E(a.start)
712
+ "aria-posinset": l.index + 1,
713
+ style: C(l.start - K(d))
671
714
  }, { ref_for: !0 }, e.itemAttrs), {
672
- default: Y(() => [
673
- A(o.$slots, "default", {
674
- item: a.item,
675
- index: a.index,
676
- start: a.start,
677
- size: a.size,
678
- end: a.end
715
+ default: Z(() => [
716
+ j(c.$slots, "default", {
717
+ item: l.item,
718
+ index: l.index,
719
+ start: l.start,
720
+ size: l.size,
721
+ end: l.end
679
722
  })
680
723
  ]),
681
724
  _: 2
682
725
  }, 1040, ["data-index", "data-key", "aria-setsize", "aria-posinset", "style"]))), 128))
683
- ], 4)) : A(o.$slots, "empty", {}, void 0, void 0, 0)
726
+ ], 4)) : j(c.$slots, "empty", {}, void 0, void 0, 0)
684
727
  ]),
685
728
  _: 3
686
729
  }, 8, ["style"]));
687
730
  }
688
- }), Ve = ["data-index", "data-key"], Be = /* @__PURE__ */ ee({
731
+ }), We = ["data-index", "data-key"], Ye = /* @__PURE__ */ ie({
689
732
  __name: "VirtualGrid",
690
733
  props: {
691
734
  items: {},
@@ -708,12 +751,14 @@ const Ae = /* @__PURE__ */ ee({
708
751
  const i = e, n = L(null), {
709
752
  virtualCells: r,
710
753
  totalWidth: s,
711
- totalHeight: f,
712
- scrollToIndex: m,
754
+ totalHeight: d,
755
+ scrollAdjustX: p,
756
+ scrollAdjustY: w,
757
+ scrollToIndex: I,
713
758
  scrollToOffset: y,
714
- measureRow: p,
715
- measureRowElement: v
716
- } = ke({
759
+ measureRow: b,
760
+ measureRowElement: E
761
+ } = Ne({
717
762
  items: () => i.items,
718
763
  columnCount: () => i.columnCount,
719
764
  estimateRowSize: () => i.estimateRowSize,
@@ -724,78 +769,78 @@ const Ae = /* @__PURE__ */ ee({
724
769
  overscanColumns: () => i.overscanColumns,
725
770
  rowGap: () => i.rowGap,
726
771
  columnGap: () => i.columnGap,
727
- getItemKey: (u, a) => i.getItemKey?.(u, a) ?? a,
772
+ getItemKey: (l, S) => i.getItemKey?.(l, S) ?? S,
728
773
  initialRect: () => ({
729
- width: N(i.width),
730
- height: N(i.height)
774
+ width: H(i.width),
775
+ height: H(i.height)
731
776
  }),
732
777
  revision: () => i.revision
733
- }), w = b(
734
- () => ie({
778
+ }), C = O(
779
+ () => re({
735
780
  height: i.height,
736
781
  width: i.width,
737
782
  horizontal: !1
738
783
  })
739
- ), E = b(() => ({
784
+ ), u = O(() => ({
740
785
  position: "relative",
741
- width: `${s.value}px`,
742
- height: `${f.value}px`
786
+ width: `${G(s.value)}px`,
787
+ height: `${G(d.value)}px`
743
788
  }));
744
- function k(u) {
745
- return (a) => {
746
- v(a, u);
789
+ function c(l) {
790
+ return (S) => {
791
+ E(S, l);
747
792
  };
748
793
  }
749
- function o(u, a, d) {
794
+ function h(l, S, m) {
750
795
  return {
751
796
  position: "absolute",
752
797
  top: 0,
753
798
  left: 0,
754
- width: `${a}px`,
755
- transform: `translate(${u}px, ${d}px)`
799
+ width: `${S}px`,
800
+ transform: `translate(${l}px, ${m}px)`
756
801
  };
757
802
  }
758
803
  return t({
759
- scrollToIndex: m,
804
+ scrollToIndex: I,
760
805
  scrollToOffset: y,
761
- measureRow: p
762
- }), (u, a) => (R(), j(q(e.tag), {
806
+ measureRow: b
807
+ }), (l, S) => (T(), q(U(e.tag), {
763
808
  ref_key: "container",
764
809
  ref: n,
765
810
  "data-virtual-container": "",
766
811
  role: "grid",
767
- style: V(w.value)
812
+ style: F(C.value)
768
813
  }, {
769
- default: Y(() => [
770
- e.items.length ? (R(), C("div", {
814
+ default: Z(() => [
815
+ e.items.length ? (T(), V("div", {
771
816
  key: 1,
772
817
  "data-virtual-spacer": "",
773
- style: V(E.value)
818
+ style: F(u.value)
774
819
  }, [
775
- (R(!0), C(H, null, P(B(r), (d) => (R(), C("div", te({
776
- key: d.key,
820
+ (T(!0), V(W, null, _(K(r), (m) => (T(), V("div", ne({
821
+ key: m.key,
777
822
  ref_for: !0,
778
- ref: k(d.row.index),
823
+ ref: c(m.row.index),
779
824
  role: "gridcell",
780
- "data-index": d.index,
781
- "data-key": String(d.key),
782
- style: o(d.column.start, d.column.size, d.row.start)
825
+ "data-index": m.index,
826
+ "data-key": String(m.key),
827
+ style: h(m.column.start - K(p), m.column.size, m.row.start - K(w))
783
828
  }, { ref_for: !0 }, e.itemAttrs), [
784
- A(u.$slots, "default", {
785
- item: d.item,
786
- index: d.index,
787
- rowIndex: d.row.index,
788
- columnIndex: d.column.index,
789
- row: d.row,
790
- column: d.column
829
+ j(l.$slots, "default", {
830
+ item: m.item,
831
+ index: m.index,
832
+ rowIndex: m.row.index,
833
+ columnIndex: m.column.index,
834
+ row: m.row,
835
+ column: m.column
791
836
  })
792
- ], 16, Ve))), 128))
793
- ], 4)) : A(u.$slots, "empty", {}, void 0, void 0, 0)
837
+ ], 16, We))), 128))
838
+ ], 4)) : j(l.$slots, "empty", {}, void 0, void 0, 0)
794
839
  ]),
795
840
  _: 3
796
841
  }, 8, ["style"]));
797
842
  }
798
- }), Ke = ["data-index", "data-key", "aria-rowindex"], Ne = /* @__PURE__ */ ee({
843
+ }), _e = ["data-index", "data-key", "aria-rowindex"], qe = /* @__PURE__ */ ie({
799
844
  __name: "VirtualTable",
800
845
  props: {
801
846
  rows: {},
@@ -812,145 +857,146 @@ const Ae = /* @__PURE__ */ ee({
812
857
  },
813
858
  setup(e, { expose: t }) {
814
859
  const i = e, n = L(null), r = L(null), s = L(0), {
815
- virtualRows: f,
816
- columns: m,
817
- totalWidth: y,
818
- totalHeight: p,
819
- scrollToIndex: v,
820
- scrollToOffset: w,
821
- measure: E,
822
- measureElement: k
823
- } = Ce({
860
+ virtualRows: d,
861
+ columns: p,
862
+ totalWidth: w,
863
+ totalHeight: I,
864
+ scrollAdjust: y,
865
+ scrollToIndex: b,
866
+ scrollToOffset: E,
867
+ measure: C,
868
+ measureElement: u
869
+ } = Be({
824
870
  rows: () => i.rows,
825
871
  columns: () => i.columns,
826
- estimateRowSize: (h, I) => {
827
- const g = i.estimateRowSize;
828
- return typeof g == "number" ? g : g(h, I);
872
+ estimateRowSize: (v, x) => {
873
+ const z = i.estimateRowSize;
874
+ return typeof z == "number" ? z : z(v, x);
829
875
  },
830
876
  container: n,
831
877
  overscan: () => i.overscan,
832
- getRowKey: (h, I) => i.getRowKey?.(h, I) ?? I,
878
+ getRowKey: (v, x) => i.getRowKey?.(v, x) ?? x,
833
879
  initialRect: () => ({
834
- width: N(i.width),
835
- height: N(i.height)
880
+ width: H(i.width),
881
+ height: H(i.height)
836
882
  }),
837
883
  viewportInset: s,
838
884
  revision: () => i.revision,
839
885
  itemSize: () => typeof i.estimateRowSize == "number" ? i.estimateRowSize : void 0
840
886
  });
841
- me(r, (h, I, g) => {
842
- if (I === h && !h || !h || !W() || typeof ResizeObserver > "u") return;
843
- const $ = () => {
844
- s.value = h.getBoundingClientRect().height;
845
- }, D = new ResizeObserver($);
846
- D.observe(h), $(), g(() => D.disconnect());
887
+ ve(r, (v, x, z) => {
888
+ if (x === v && !v || !v || !D() || typeof ResizeObserver > "u") return;
889
+ const k = () => {
890
+ s.value = v.getBoundingClientRect().height;
891
+ }, Y = new ResizeObserver(k);
892
+ Y.observe(v), k(), z(() => Y.disconnect());
847
893
  });
848
- const o = b(
849
- () => ie({
894
+ const c = O(
895
+ () => re({
850
896
  height: i.height,
851
897
  width: i.width,
852
898
  horizontal: !1
853
899
  })
854
- ), u = b(() => ({
855
- minWidth: `${y.value}px`
856
- })), a = b(() => ({
900
+ ), h = O(() => ({
901
+ minWidth: `${w.value}px`
902
+ })), l = O(() => ({
857
903
  position: i.stickyHeader ? "sticky" : "relative",
858
904
  top: i.stickyHeader ? "0px" : void 0,
859
905
  zIndex: 1,
860
906
  display: "flex",
861
- width: `${y.value}px`
862
- })), d = b(() => ({
907
+ width: `${w.value}px`
908
+ })), S = O(() => ({
863
909
  position: "relative",
864
- height: `${p.value}px`,
865
- width: `${y.value}px`
910
+ height: `${G(I.value)}px`,
911
+ width: `${G(w.value)}px`
866
912
  }));
867
- function S(h) {
913
+ function m(v) {
868
914
  return {
869
- width: `${h.size}px`,
870
- minWidth: `${h.size}px`,
915
+ width: `${v.size}px`,
916
+ minWidth: `${v.size}px`,
871
917
  flex: "0 0 auto",
872
- textAlign: h.align ?? "left"
918
+ textAlign: v.align ?? "left"
873
919
  };
874
920
  }
875
- function K(h) {
921
+ function N(v) {
876
922
  return {
877
923
  position: "absolute",
878
924
  top: 0,
879
925
  left: 0,
880
926
  width: "100%",
881
927
  display: "flex",
882
- transform: `translateY(${h}px)`
928
+ transform: `translateY(${v}px)`
883
929
  };
884
930
  }
885
- function M(h) {
886
- return (I) => {
887
- k(I, h);
931
+ function X(v) {
932
+ return (x) => {
933
+ u(x, v);
888
934
  };
889
935
  }
890
- function _(h, I, g) {
891
- return I.accessor ? I.accessor(h, g) : h && typeof h == "object" && I.id in h ? h[I.id] : "";
936
+ function P(v, x, z) {
937
+ return x.accessor ? x.accessor(v, z) : v && typeof v == "object" && x.id in v ? v[x.id] : "";
892
938
  }
893
939
  return t({
894
- scrollToIndex: v,
895
- scrollToOffset: w,
896
- measure: E
897
- }), (h, I) => (R(), j(q(e.tag), {
940
+ scrollToIndex: b,
941
+ scrollToOffset: E,
942
+ measure: C
943
+ }), (v, x) => (T(), q(U(e.tag), {
898
944
  ref_key: "container",
899
945
  ref: n,
900
946
  "data-virtual-container": "",
901
947
  role: "table",
902
- style: V(o.value)
948
+ style: F(c.value)
903
949
  }, {
904
- default: Y(() => [
905
- oe("div", {
906
- style: V(u.value)
950
+ default: Z(() => [
951
+ le("div", {
952
+ style: F(h.value)
907
953
  }, [
908
- oe("div", {
954
+ le("div", {
909
955
  ref_key: "header",
910
956
  ref: r,
911
957
  role: "row",
912
- style: V(a.value)
958
+ style: F(l.value)
913
959
  }, [
914
- A(h.$slots, "header", { columns: B(m) }, () => [
915
- (R(!0), C(H, null, P(B(m), (g) => (R(), C("div", {
916
- key: g.id,
960
+ j(v.$slots, "header", { columns: K(p) }, () => [
961
+ (T(!0), V(W, null, _(K(p), (z) => (T(), V("div", {
962
+ key: z.id,
917
963
  role: "columnheader",
918
- style: V(S(g))
919
- }, le(g.header), 5))), 128))
964
+ style: F(m(z))
965
+ }, ue(z.header), 5))), 128))
920
966
  ])
921
967
  ], 4),
922
- e.rows.length ? (R(), C("div", {
968
+ e.rows.length ? (T(), V("div", {
923
969
  key: 1,
924
970
  "data-virtual-spacer": "",
925
971
  role: "rowgroup",
926
- style: V(d.value)
972
+ style: F(S.value)
927
973
  }, [
928
- (R(!0), C(H, null, P(B(f), (g) => (R(), C("div", te({
929
- key: g.key,
974
+ (T(!0), V(W, null, _(K(d), (z) => (T(), V("div", ne({
975
+ key: z.key,
930
976
  ref_for: !0,
931
- ref: M(g.index),
977
+ ref: X(z.index),
932
978
  role: "row",
933
- "data-index": g.index,
934
- "data-key": String(g.key),
935
- "aria-rowindex": g.index + 1,
936
- style: K(g.start)
979
+ "data-index": z.index,
980
+ "data-key": String(z.key),
981
+ "aria-rowindex": z.index + 1,
982
+ style: N(z.start - K(y))
937
983
  }, { ref_for: !0 }, e.rowAttrs), [
938
- (R(!0), C(H, null, P(B(m), ($) => (R(), C("div", {
939
- key: $.id,
984
+ (T(!0), V(W, null, _(K(p), (k) => (T(), V("div", {
985
+ key: k.id,
940
986
  role: "cell",
941
- style: V(S($))
987
+ style: F(m(k))
942
988
  }, [
943
- A(h.$slots, "cell", {
944
- row: g.item,
945
- column: $,
946
- rowIndex: g.index,
947
- value: _(g.item, $, g.index)
989
+ j(v.$slots, "cell", {
990
+ row: z.item,
991
+ column: k,
992
+ rowIndex: z.index,
993
+ value: P(z.item, k, z.index)
948
994
  }, () => [
949
- pe(le(_(g.item, $, g.index)), 1)
995
+ Re(ue(P(z.item, k, z.index)), 1)
950
996
  ])
951
997
  ], 4))), 128))
952
- ], 16, Ke))), 128))
953
- ], 4)) : A(h.$slots, "empty", {}, void 0, void 0, 0)
998
+ ], 16, _e))), 128))
999
+ ], 4)) : j(v.$slots, "empty", {}, void 0, void 0, 0)
954
1000
  ], 4)
955
1001
  ]),
956
1002
  _: 3
@@ -958,17 +1004,20 @@ const Ae = /* @__PURE__ */ ee({
958
1004
  }
959
1005
  });
960
1006
  export {
961
- be as MeasurementCache,
962
- Be as VirtualGrid,
963
- Ae as VirtualList,
964
- Ne as VirtualTable,
965
- Te as Virtualizer,
966
- Q as clampScrollOffset,
967
- U as normalizeSize,
968
- Re as resolveScrollOffset,
969
- ke as useVirtualGrid,
970
- ze as useVirtualList,
971
- Ce as useVirtualTable,
972
- Z as useVirtualizer
1007
+ Te as MeasurementCache,
1008
+ Ye as VirtualGrid,
1009
+ Xe as VirtualList,
1010
+ qe as VirtualTable,
1011
+ Fe as Virtualizer,
1012
+ B as clampScrollOffset,
1013
+ Ce as mapDomOffsetToVirtual,
1014
+ ke as mapVirtualOffsetToDom,
1015
+ ee as normalizeSize,
1016
+ $e as resolveScrollOffset,
1017
+ G as scrollContentSize,
1018
+ Ne as useVirtualGrid,
1019
+ we as useVirtualList,
1020
+ Be as useVirtualTable,
1021
+ te as useVirtualizer
973
1022
  };
974
1023
  //# sourceMappingURL=index.mjs.map