@vtable-guild/vtable-guild 2.4.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/css/style.css +12 -0
  2. package/css/tailwind3-utilities.css +12 -0
  3. package/dist/core/src/components/VTableGuildConfigProvider.d.ts.map +1 -1
  4. package/dist/core/src/components/VTableGuildConfigProvider.mjs +17 -12
  5. package/dist/core/src/components/VirtualList/VirtualList.d.ts +21 -0
  6. package/dist/core/src/components/VirtualList/VirtualList.d.ts.map +1 -1
  7. package/dist/core/src/components/VirtualList/VirtualList.mjs +201 -216
  8. package/dist/core/src/components/VirtualList/hooks/useHeights.d.ts +7 -1
  9. package/dist/core/src/components/VirtualList/hooks/useHeights.d.ts.map +1 -1
  10. package/dist/core/src/components/VirtualList/hooks/useHeights.mjs +29 -27
  11. package/dist/core/src/components/VirtualList/hooks/useScrollTo.d.ts +3 -1
  12. package/dist/core/src/components/VirtualList/hooks/useScrollTo.d.ts.map +1 -1
  13. package/dist/core/src/components/VirtualList/hooks/useScrollTo.mjs +57 -50
  14. package/dist/core/src/components/VirtualList/index.d.ts +1 -0
  15. package/dist/core/src/components/VirtualList/index.d.ts.map +1 -1
  16. package/dist/core/src/components/VirtualList/utils/PrefixSums.d.ts +50 -0
  17. package/dist/core/src/components/VirtualList/utils/PrefixSums.d.ts.map +1 -0
  18. package/dist/core/src/components/VirtualList/utils/PrefixSums.mjs +54 -0
  19. package/dist/core/src/components/VirtualList/utils/PrefixSums.test.d.ts +2 -0
  20. package/dist/core/src/components/VirtualList/utils/PrefixSums.test.d.ts.map +1 -0
  21. package/dist/core/src/composables/useTheme.d.ts +9 -1
  22. package/dist/core/src/composables/useTheme.d.ts.map +1 -1
  23. package/dist/core/src/composables/useTheme.mjs +83 -60
  24. package/dist/core/src/index.d.ts +9 -0
  25. package/dist/core/src/index.d.ts.map +1 -1
  26. package/dist/core/src/plugin/index.d.ts.map +1 -1
  27. package/dist/core/src/plugin/index.mjs +4 -3
  28. package/dist/core/src/utils/types.d.ts +3 -0
  29. package/dist/core/src/utils/types.d.ts.map +1 -1
  30. package/dist/css/style.css +12 -0
  31. package/dist/css/tailwind3-utilities.css +12 -0
  32. package/dist/index.full.mjs +3450 -3006
  33. package/dist/index.mjs +41 -37
  34. package/dist/table/src/components/ColGroup.d.ts.map +1 -1
  35. package/dist/table/src/components/ColGroup.mjs +11 -8
  36. package/dist/table/src/components/Table.d.ts +68 -6
  37. package/dist/table/src/components/Table.d.ts.map +1 -1
  38. package/dist/table/src/components/Table.mjs +361 -297
  39. package/dist/table/src/components/TableBody.d.ts.map +1 -1
  40. package/dist/table/src/components/TableBody.mjs +38 -37
  41. package/dist/table/src/components/TableCell.d.ts +23 -0
  42. package/dist/table/src/components/TableCell.d.ts.map +1 -1
  43. package/dist/table/src/components/TableCell.mjs +85 -60
  44. package/dist/table/src/components/TableHeaderCell.d.ts.map +1 -1
  45. package/dist/table/src/components/TableHeaderCell.mjs +177 -174
  46. package/dist/table/src/components/VTable.vue.mjs +10 -8
  47. package/dist/table/src/components/VTableCompatClass.test.d.ts +2 -0
  48. package/dist/table/src/components/VTableCompatClass.test.d.ts.map +1 -0
  49. package/dist/table/src/components/VirtualTableBody.d.ts +40 -0
  50. package/dist/table/src/components/VirtualTableBody.d.ts.map +1 -1
  51. package/dist/table/src/components/VirtualTableBody.mjs +158 -67
  52. package/dist/table/src/composables/index.d.ts +4 -0
  53. package/dist/table/src/composables/index.d.ts.map +1 -1
  54. package/dist/table/src/composables/useColumnMetrics.d.ts +39 -0
  55. package/dist/table/src/composables/useColumnMetrics.d.ts.map +1 -0
  56. package/dist/table/src/composables/useColumnMetrics.mjs +88 -0
  57. package/dist/table/src/composables/useColumnWindow.d.ts +90 -0
  58. package/dist/table/src/composables/useColumnWindow.d.ts.map +1 -0
  59. package/dist/table/src/composables/useColumnWindow.mjs +62 -0
  60. package/dist/table/src/composables/useColumnWindow.test.d.ts +2 -0
  61. package/dist/table/src/composables/useColumnWindow.test.d.ts.map +1 -0
  62. package/dist/table/src/composables/useColumns.d.ts +8 -0
  63. package/dist/table/src/composables/useColumns.d.ts.map +1 -1
  64. package/dist/table/src/composables/useColumns.mjs +46 -43
  65. package/dist/table/src/composables/useFixedColumnStyle.d.ts.map +1 -1
  66. package/dist/table/src/composables/useFixedColumnStyle.mjs +12 -11
  67. package/dist/table/src/composables/useSelection.d.ts.map +1 -1
  68. package/dist/table/src/composables/useSelection.mjs +93 -94
  69. package/dist/table/src/composables/useVirtual.d.ts +10 -0
  70. package/dist/table/src/composables/useVirtual.d.ts.map +1 -1
  71. package/dist/table/src/composables/useVirtual.mjs +15 -11
  72. package/dist/table/src/context.d.ts +7 -0
  73. package/dist/table/src/context.d.ts.map +1 -1
  74. package/dist/table/src/index.d.ts +2 -0
  75. package/dist/table/src/index.d.ts.map +1 -1
  76. package/dist/table/src/types/table.d.ts +25 -0
  77. package/dist/table/src/types/table.d.ts.map +1 -1
  78. package/dist/table/src/utils/compat.d.ts +9 -0
  79. package/dist/table/src/utils/compat.d.ts.map +1 -0
  80. package/dist/table/src/utils/compat.mjs +28 -0
  81. package/dist/theme/src/compat/antdv-table.d.ts +4 -0
  82. package/dist/theme/src/compat/antdv-table.d.ts.map +1 -0
  83. package/dist/theme/src/compat/antdv-table.mjs +51 -0
  84. package/dist/theme/src/index.d.ts +2 -0
  85. package/dist/theme/src/index.d.ts.map +1 -1
  86. package/dist/theme/src/presets/antdv/table.d.ts +3 -0
  87. package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
  88. package/dist/theme/src/presets/antdv/table.mjs +4 -1
  89. package/package.json +1 -1
  90. package/dist/core/src/components/VirtualList/hooks/useDiffItem.d.ts +0 -4
  91. package/dist/core/src/components/VirtualList/hooks/useDiffItem.d.ts.map +0 -1
  92. package/dist/core/src/components/VirtualList/hooks/useDiffItem.mjs +0 -16
  93. package/dist/core/src/components/VirtualList/utils/algorithmUtil.d.ts +0 -7
  94. package/dist/core/src/components/VirtualList/utils/algorithmUtil.d.ts.map +0 -1
  95. package/dist/core/src/components/VirtualList/utils/algorithmUtil.mjs +0 -22
@@ -1,56 +1,37 @@
1
- import He from "./Filler.mjs";
2
- import Me from "./hooks/useChildren.mjs";
3
- import be from "./hooks/useDiffItem.mjs";
4
- import Re from "./hooks/useFrameWheel.mjs";
5
- import { useGetSize as ze } from "./hooks/useGetSize.mjs";
6
- import Be from "./hooks/useHeights.mjs";
1
+ import Re from "./Filler.mjs";
2
+ import ze from "./hooks/useChildren.mjs";
3
+ import Be from "./hooks/useFrameWheel.mjs";
4
+ import { useGetSize as Ce } from "./hooks/useGetSize.mjs";
5
+ import we from "./hooks/useHeights.mjs";
7
6
  import Te from "./hooks/useMobileTouchMove.mjs";
8
- import we from "./hooks/useScrollDrag.mjs";
9
- import Ce from "./hooks/useScrollTo.mjs";
7
+ import Ve from "./hooks/useScrollDrag.mjs";
8
+ import Ie from "./hooks/useScrollTo.mjs";
10
9
  import oe from "./VirtualScrollBar.mjs";
11
- import { getSpinSize as ne } from "./utils/scrollbarUtil.mjs";
12
- import { defineComponent as Ie, computed as M, watch as B, shallowRef as U, ref as u, unref as Ve, toRaw as Ae, onBeforeUnmount as We, createVNode as P } from "vue";
13
- const ie = [], Le = {
10
+ import { getSpinSize as re } from "./utils/scrollbarUtil.mjs";
11
+ import { PrefixSums as Ae } from "./utils/PrefixSums.mjs";
12
+ import { defineComponent as We, computed as y, watch as b, shallowRef as _, ref as r, unref as ke, toRaw as Fe, onBeforeUnmount as Oe, createVNode as F } from "vue";
13
+ const ue = [], De = {
14
14
  overflowY: "auto",
15
15
  overflowAnchor: "none"
16
16
  };
17
- function Fe(t) {
18
- const s = {};
19
- for (const c of Object.keys(t))
20
- c.startsWith("on") || (s[c] = t[c]);
21
- return s;
22
- }
23
- function re(t, s) {
24
- let c = 0, T = t.length - 1, w = t.length;
25
- for (; c <= T; ) {
26
- const y = Math.floor((c + T) / 2);
27
- t[y] >= s ? (w = y, T = y - 1) : c = y + 1;
28
- }
29
- return w;
30
- }
31
17
  function Ke(t) {
32
- const {
33
- dataLength: s,
34
- offsetTop: c,
35
- height: T,
36
- itemHeight: w,
37
- getItemHeight: y
38
- } = t, f = new Array(s);
39
- let L = 0;
40
- for (let o = 0; o < s; o += 1)
41
- L += y(o) ?? w, f[o] = L;
42
- let b = re(f, c);
43
- b >= s && (b = 0);
44
- const x = c + T;
45
- let C = re(f, x + 1);
46
- return C >= s && (C = s - 1), C = Math.min(C + 1, s - 1), {
47
- scrollHeight: L,
48
- start: b,
49
- end: C,
50
- offset: b === 0 ? 0 : f[b - 1]
18
+ const m = {};
19
+ for (const h of Object.keys(t))
20
+ h.startsWith("on") || (m[h] = t[h]);
21
+ return m;
22
+ }
23
+ function Pe(t, m, h, L) {
24
+ let R = t.findIndex(h);
25
+ R >= m && (R = 0);
26
+ let H = t.findIndex(h + L + 1);
27
+ return H >= m && (H = m - 1), H = Math.min(H + 1, m - 1), {
28
+ scrollHeight: t.total,
29
+ start: R,
30
+ end: H,
31
+ offset: t.offsetOf(R)
51
32
  };
52
33
  }
53
- const qe = /* @__PURE__ */ Ie({
34
+ const Qe = /* @__PURE__ */ We({
54
35
  name: "VirtualList",
55
36
  props: {
56
37
  prefixCls: {
@@ -87,6 +68,10 @@ const qe = /* @__PURE__ */ Ie({
87
68
  type: Boolean,
88
69
  default: !0
89
70
  },
71
+ disableHeightMeasure: {
72
+ type: Boolean,
73
+ default: !1
74
+ },
90
75
  onScroll: Function,
91
76
  onVirtualScroll: Function,
92
77
  onVisibleChange: Function,
@@ -95,271 +80,272 @@ const qe = /* @__PURE__ */ Ie({
95
80
  },
96
81
  inheritAttrs: !1,
97
82
  setup(t, {
98
- expose: s,
99
- attrs: c,
100
- slots: T
83
+ expose: m,
84
+ attrs: h,
85
+ slots: L
101
86
  }) {
102
- const w = M(() => t.itemHeight);
103
- let y = t.itemKey;
104
- B(() => t.itemKey, (e) => {
105
- y = e;
87
+ const R = y(() => t.itemHeight);
88
+ let H = t.itemKey;
89
+ b(() => t.itemKey, (e) => {
90
+ H = e;
106
91
  });
107
- const f = (e) => {
108
- const l = y;
92
+ const V = (e) => {
93
+ const l = H;
109
94
  return typeof l == "function" ? l(e) : e?.[l];
110
- }, [L, b, x, C] = Be(f), o = U(t?.data || ie);
111
- B(() => t.data, () => {
112
- o.value = t?.data || ie;
95
+ }, [ce, q, z, se] = we(V, void 0, void 0, () => t.disableHeightMeasure), u = _(t?.data || ue);
96
+ b(() => t.data, () => {
97
+ u.value = t?.data || ue;
113
98
  });
114
- const F = M(() => !!(t.virtual !== !1 && t.height && t.itemHeight)), v = M(() => {
115
- const e = o.value;
116
- return F.value && e && (t.itemHeight * e.length > t.height || !!t.scrollWidth);
117
- }), R = u(), _ = u(), q = u(), k = u(!1), G = U(), J = U(), h = u(0), i = u(0), $ = u(!1), Q = u(0), Z = u(0), g = u(t.scrollWidth || 0), r = u(0), m = u(0), H = u(0), I = u(void 0);
118
- function V(e) {
99
+ const I = y(() => !!(t.virtual !== !1 && t.height && t.itemHeight)), c = y(() => {
100
+ const e = u.value;
101
+ return I.value && e && (t.itemHeight * e.length > t.height || !!t.scrollWidth);
102
+ }), x = r(), G = r(), J = r(), O = r(!1), Q = _(), Z = _(), s = r(0), n = r(0), N = r(!1), p = r(0), ee = r(0), d = r(t.scrollWidth || 0), o = r(0), f = r(0), S = r(0), B = r(void 0);
103
+ function C(e) {
119
104
  let l;
120
- typeof e == "function" ? l = e(h.value) : l = e;
121
- const a = r.value - t.height, n = Math.max(0, Math.min(l, a || 0));
122
- R.value && (R.value.scrollTop = n), h.value = n;
105
+ typeof e == "function" ? l = e(s.value) : l = e;
106
+ const a = o.value - t.height, i = Math.max(0, Math.min(l, a || 0));
107
+ x.value && (x.value.scrollTop = i), s.value = i;
123
108
  }
124
- B([v, F, h, o, C, () => t.height], () => {
125
- if (!F.value) {
126
- r.value = 0, m.value = 0, H.value = o.value.length - 1, I.value = void 0;
109
+ const A = new Ae();
110
+ b([c, I, s, u, se, () => t.height], ([, , , e, l], a) => {
111
+ if (!a)
112
+ A.markAllDirty();
113
+ else {
114
+ const [, , , M, X] = a;
115
+ e !== M ? A.markAllDirty() : l !== X && A.markDirtyFrom(f.value);
116
+ }
117
+ if (!I.value) {
118
+ o.value = 0, f.value = 0, S.value = u.value.length - 1, B.value = void 0;
127
119
  return;
128
120
  }
129
- if (!v.value) {
130
- r.value = _.value?.offsetHeight || 0, m.value = 0, H.value = o.value.length - 1, I.value = void 0;
121
+ if (!c.value) {
122
+ o.value = G.value?.offsetHeight || 0, f.value = 0, S.value = u.value.length - 1, B.value = void 0;
131
123
  return;
132
124
  }
133
125
  const {
134
- itemHeight: e,
135
- height: l
136
- } = t, a = o.value.length;
137
- if (!a) {
138
- r.value = 0, m.value = 0, H.value = -1, I.value = 0;
126
+ itemHeight: i,
127
+ height: P
128
+ } = t, T = u.value.length;
129
+ if (!T) {
130
+ o.value = 0, f.value = 0, S.value = -1, B.value = 0;
139
131
  return;
140
132
  }
141
- if (Ve(x.id) === 0) {
142
- const z = e, ye = l, X = Math.max(0, Math.floor(h.value / z)), xe = X * z;
143
- let Y = X + Math.ceil(ye / z);
144
- Y = Math.min(Y + 1, a - 1), r.value = a * z, m.value = X, H.value = Y, I.value = xe;
133
+ if (ke(z.id) === 0) {
134
+ const M = i, X = P, Y = Math.max(0, Math.floor(s.value / M)), be = Y * M;
135
+ let U = Y + Math.ceil(X / M);
136
+ U = Math.min(U + 1, T - 1), o.value = T * M, f.value = Y, S.value = U, B.value = be;
145
137
  return;
146
138
  }
147
- const n = Ae(o.value), W = Ke({
148
- dataLength: a,
149
- offsetTop: h.value,
150
- height: l,
151
- itemHeight: e,
152
- getItemHeight(z) {
153
- return x.get(f(n[z]));
154
- }
155
- });
156
- r.value = W.scrollHeight, m.value = W.start, H.value = W.end, I.value = W.offset;
139
+ const Me = Fe(u.value);
140
+ A.sync(T, (M) => z.get(V(Me[M])), i);
141
+ const j = Pe(A, T, s.value, P);
142
+ o.value = j.scrollHeight, f.value = j.start, S.value = j.end, B.value = j.offset;
157
143
  }, {
158
144
  immediate: !0
159
- }), B(r, () => {
160
- const e = x.getRecord();
145
+ }), b(o, () => {
146
+ const e = z.getRecord();
161
147
  if (e.size === 1) {
162
- const l = Array.from(e.keys())[0], a = e.get(l), n = o.value[m.value];
163
- if (n && a === void 0 && f(n) === l) {
164
- const W = x.get(l) - t.itemHeight;
165
- V((z) => z + W);
148
+ const l = Array.from(e.keys())[0], a = e.get(l), i = u.value[f.value];
149
+ if (i && a === void 0 && V(i) === l) {
150
+ const P = z.get(l) - t.itemHeight;
151
+ C((T) => T + P);
166
152
  }
167
153
  }
168
- if (F.value && t.height) {
169
- const l = Math.max(0, r.value - t.height);
170
- h.value > l && V(l);
154
+ if (I.value && t.height) {
155
+ const l = Math.max(0, o.value - t.height);
156
+ s.value > l && C(l);
171
157
  }
172
- x.resetRecord();
158
+ z.resetRecord();
173
159
  });
174
- const S = u({
160
+ const g = r({
175
161
  width: 0,
176
162
  height: t.height || 0
177
163
  });
178
- let A = null, K = null;
179
- const ue = (e) => {
180
- K !== e && (A && K && A.unobserve(K), K = e, e && (A || (A = new ResizeObserver((l) => {
164
+ let w = null, W = null;
165
+ const ve = (e) => {
166
+ W !== e && (w && W && w.unobserve(W), W = e, e && (w || (w = new ResizeObserver((l) => {
181
167
  const a = l[0];
182
168
  if (a) {
183
- const n = a.target;
184
- S.value = {
185
- width: n.offsetWidth,
186
- height: n.offsetHeight
187
- }, g.value = t.scrollWidth ?? n.offsetWidth;
169
+ const i = a.target;
170
+ g.value = {
171
+ width: i.offsetWidth,
172
+ height: i.offsetHeight
173
+ }, d.value = t.scrollWidth ?? i.offsetWidth;
188
174
  }
189
- })), A.observe(e)));
175
+ })), w.observe(e)));
190
176
  };
191
- We(() => {
192
- A?.disconnect(), A = null, K = null;
177
+ Oe(() => {
178
+ w?.disconnect(), w = null, W = null;
193
179
  });
194
- const d = M(() => t.direction === "rtl"), D = () => ({
195
- x: d.value ? -i.value : i.value,
196
- y: h.value
197
- }), E = u(D()), j = (e) => {
180
+ const v = y(() => t.direction === "rtl"), $ = () => ({
181
+ x: v.value ? -n.value : n.value,
182
+ y: s.value
183
+ }), E = r($()), D = (e) => {
198
184
  if (t.onVirtualScroll) {
199
185
  const l = {
200
- ...D(),
186
+ ...$(),
201
187
  ...e
202
188
  };
203
189
  (E.value.x !== l.x || E.value.y !== l.y) && (t.onVirtualScroll(l), E.value = l);
204
190
  }
205
- }, O = M(() => Math.max(0, (g.value || 0) - S.value.width)), ce = M(() => h.value === 0), se = M(() => h.value + t.height >= r.value), ve = M(() => i.value === 0), he = M(() => i.value >= O.value), N = (e) => Math.max(0, Math.min(e, O.value)), p = () => {
206
- G.value?.delayHidden(), J.value?.delayHidden();
207
- }, [fe] = Re(v, ce, se, ve, he, O.value > 0, (e, l) => {
191
+ }, k = y(() => Math.max(0, (d.value || 0) - g.value.width)), fe = y(() => s.value === 0), he = y(() => s.value + t.height >= o.value), de = y(() => n.value === 0), ge = y(() => n.value >= k.value), K = (e) => Math.max(0, Math.min(e, k.value)), te = () => {
192
+ Q.value?.delayHidden(), Z.value?.delayHidden();
193
+ }, [me] = Be(c, fe, he, de, ge, k.value > 0, (e, l) => {
208
194
  if (l) {
209
- const a = N(d.value ? i.value - e : i.value + e);
210
- i.value = a, j({
211
- x: d.value ? -a : a
195
+ const a = K(v.value ? n.value - e : n.value + e);
196
+ n.value = a, D({
197
+ x: v.value ? -a : a
212
198
  });
213
199
  } else
214
- V((a) => a + e);
200
+ C((a) => a + e);
215
201
  });
216
- Te(v, R, (e, l) => {
202
+ Te(c, x, (e, l) => {
217
203
  if (e) {
218
- const a = N(d.value ? i.value - l : i.value + l);
219
- return i.value = a, j({
220
- x: d.value ? -a : a
204
+ const a = K(v.value ? n.value - l : n.value + l);
205
+ return n.value = a, D({
206
+ x: v.value ? -a : a
221
207
  }), !0;
222
208
  } else
223
- return V((a) => a + l), !0;
224
- }), we(v, R, (e) => {
225
- V((l) => l + e);
209
+ return C((a) => a + l), !0;
210
+ }), Ve(c, x, (e) => {
211
+ C((l) => l + e);
226
212
  });
227
- const ee = (e, l) => {
228
- l ? (i.value = e, j({
229
- x: d.value ? -e : e
230
- })) : V(e);
231
- }, te = () => {
232
- $.value = !0;
233
- }, le = () => {
234
- $.value = !1;
213
+ const le = (e, l) => {
214
+ l ? (n.value = e, D({
215
+ x: v.value ? -e : e
216
+ })) : C(e);
217
+ }, ae = () => {
218
+ N.value = !0;
219
+ }, ie = () => {
220
+ N.value = !1;
235
221
  };
236
- be(o, f), B([() => t.height, r, v, () => S.value.height], () => {
237
- v.value && t.height && r.value && (Q.value = ne(S.value.height, r.value));
222
+ b([() => t.height, o, c, () => g.value.height], () => {
223
+ c.value && t.height && o.value && (p.value = re(g.value.height, o.value));
238
224
  }, {
239
225
  immediate: !0
240
- }), B([() => S.value.width, g], () => {
241
- v.value && g.value && (Z.value = ne(S.value.width, g.value));
226
+ }), b([() => g.value.width, d], () => {
227
+ c.value && d.value && (ee.value = re(g.value.width, d.value));
242
228
  }, {
243
229
  immediate: !0
244
- }), B(() => t.scrollWidth, (e) => {
245
- g.value = e ?? S.value.width, i.value = N(i.value);
230
+ }), b(() => t.scrollWidth, (e) => {
231
+ d.value = e ?? g.value.width, n.value = K(n.value);
246
232
  }, {
247
233
  immediate: !0
248
234
  });
249
- function de(e) {
235
+ function Se(e) {
250
236
  const l = e.currentTarget.scrollTop;
251
- !F.value || !v.value ? h.value = l : l !== h.value && V(l), t.onScroll?.(e), j();
237
+ !I.value || !c.value ? s.value = l : l !== s.value && C(l), t.onScroll?.(e), D();
252
238
  }
253
- const [ae, ge] = Ce(R, o, x, w, f, () => b(!0), (e) => {
254
- const l = ge(), a = Math.max(r.value, l) - t.height, n = Math.max(0, Math.min(e, a || 0));
255
- R.value && (R.value.scrollTop = n), h.value = n;
256
- }, p);
257
- s({
258
- nativeElement: q,
259
- getScrollInfo: D,
260
- getHorizontalRange: () => O.value,
239
+ const [ne, ye] = Ie(x, u, z, R, V, () => q(!0), (e) => {
240
+ const l = ye(), a = Math.max(o.value, l) - t.height, i = Math.max(0, Math.min(e, a || 0));
241
+ x.value && (x.value.scrollTop = i), s.value = i;
242
+ }, te, () => t.disableHeightMeasure);
243
+ m({
244
+ nativeElement: J,
245
+ getScrollInfo: $,
246
+ getHorizontalRange: () => k.value,
261
247
  scrollTo: (e) => {
262
248
  function l(a) {
263
249
  return a && typeof a == "object" && ("left" in a || "top" in a);
264
250
  }
265
- l(e) ? (e.left !== void 0 && (i.value = N(e.left)), ae(e.top)) : ae(e);
251
+ l(e) ? (e.left !== void 0 && (n.value = K(e.left)), ne(e.top)) : ne(e);
266
252
  }
267
- }), B([m, H, o], () => {
253
+ }), b([f, S, u], () => {
268
254
  if (t.onVisibleChange) {
269
- const e = o.value.slice(m.value, H.value + 1);
270
- t.onVisibleChange(e, o.value);
255
+ const e = u.value.slice(f.value, S.value + 1);
256
+ t.onVisibleChange(e, u.value);
271
257
  }
272
258
  }, {
273
259
  flush: "post"
274
260
  });
275
- const me = ze(o, f, x, w), Se = Me(o, m, H, g, i, L, (e, l, a) => T.default?.({
261
+ const He = Ce(u, V, z, R), xe = ze(u, f, S, d, n, ce, (e, l, a) => L.default?.({
276
262
  item: e,
277
263
  index: l,
278
264
  ...a
279
265
  }), {
280
- getKey: f
266
+ getKey: V
281
267
  });
282
268
  return () => {
283
269
  const e = {};
284
- t.height && (e[t.fullHeight ? "height" : "maxHeight"] = `${t.height}px`, Object.assign(e, Le), v.value && (e.overflowY = "hidden", O.value > 0 && (e.overflowX = "hidden"), $.value && (e.pointerEvents = "none")));
270
+ t.height && (e[t.fullHeight ? "height" : "maxHeight"] = `${t.height}px`, Object.assign(e, De), c.value && (e.overflowY = "hidden", k.value > 0 && (e.overflowX = "hidden"), N.value && (e.pointerEvents = "none")));
285
271
  const l = t.extraRender?.({
286
- start: m.value,
287
- end: H.value,
288
- virtual: v.value,
289
- offsetX: i.value,
290
- offsetY: I.value || 0,
291
- rtl: d.value,
292
- getSize: me
272
+ start: f.value,
273
+ end: S.value,
274
+ virtual: c.value,
275
+ offsetX: n.value,
276
+ offsetY: B.value || 0,
277
+ rtl: v.value,
278
+ getSize: He
293
279
  }), a = t.component;
294
- return P("div", {
295
- ref: q,
296
- ...Fe(c),
280
+ return F("div", {
281
+ ref: J,
282
+ ...Ke(h),
297
283
  style: {
298
284
  position: "relative",
299
- ...c.style
285
+ ...h.style
300
286
  },
301
- dir: d.value ? "rtl" : void 0,
287
+ dir: v.value ? "rtl" : void 0,
302
288
  class: [t.prefixCls, {
303
- [`${t.prefixCls}-rtl`]: d.value
304
- }, c.class],
289
+ [`${t.prefixCls}-rtl`]: v.value
290
+ }, h.class],
305
291
  onMouseenter: () => {
306
- k.value = !0;
292
+ O.value = !0;
307
293
  },
308
294
  onMouseleave: () => {
309
- k.value = !1;
295
+ O.value = !1;
310
296
  }
311
- }, [P(a, {
297
+ }, [F(a, {
312
298
  class: `${t.prefixCls}-holder`,
313
299
  style: e,
314
- ref: (n) => {
315
- R.value = n?.$el ?? n, ue(n?.$el ?? n);
300
+ ref: (i) => {
301
+ x.value = i?.$el ?? i, ve(i?.$el ?? i);
316
302
  },
317
- onScroll: de,
318
- onWheel: fe,
319
- onMouseenter: p
303
+ onScroll: Se,
304
+ onWheel: me,
305
+ onMouseenter: te
320
306
  }, {
321
- default: () => [P(He, {
307
+ default: () => [F(Re, {
322
308
  prefixCls: t.prefixCls,
323
- height: r.value,
324
- offsetX: i.value,
325
- offsetY: I.value,
326
- scrollWidth: g.value,
327
- onInnerResize: b,
328
- ref: _,
309
+ height: o.value,
310
+ offsetX: n.value,
311
+ offsetY: B.value,
312
+ scrollWidth: d.value,
313
+ onInnerResize: q,
314
+ ref: G,
329
315
  innerProps: t.innerProps,
330
- rtl: d.value,
316
+ rtl: v.value,
331
317
  extra: l
332
318
  }, {
333
- default: () => [Se.value]
319
+ default: () => [xe.value]
334
320
  })]
335
- }), v.value && r.value > (t.height || 0) && P(oe, {
336
- ref: G,
321
+ }), c.value && o.value > (t.height || 0) && F(oe, {
322
+ ref: Q,
337
323
  prefixCls: t.prefixCls,
338
- scrollOffset: h.value,
339
- scrollRange: r.value,
340
- rtl: d.value,
341
- onScroll: ee,
342
- onStartMove: te,
343
- onStopMove: le,
344
- spinSize: Q.value,
345
- containerSize: S.value.height,
346
- active: k.value,
324
+ scrollOffset: s.value,
325
+ scrollRange: o.value,
326
+ rtl: v.value,
327
+ onScroll: le,
328
+ onStartMove: ae,
329
+ onStopMove: ie,
330
+ spinSize: p.value,
331
+ containerSize: g.value.height,
332
+ active: O.value,
347
333
  showScrollBar: t.showScrollBar,
348
334
  style: t.styles?.verticalScrollBar,
349
335
  thumbStyle: t.styles?.verticalScrollBarThumb
350
- }), v.value && g.value > S.value.width && P(oe, {
351
- ref: J,
336
+ }), c.value && d.value > g.value.width && F(oe, {
337
+ ref: Z,
352
338
  prefixCls: t.prefixCls,
353
- scrollOffset: i.value,
354
- scrollRange: g.value,
355
- rtl: d.value,
356
- onScroll: ee,
357
- onStartMove: te,
358
- onStopMove: le,
359
- spinSize: Z.value,
360
- containerSize: S.value.width,
339
+ scrollOffset: n.value,
340
+ scrollRange: d.value,
341
+ rtl: v.value,
342
+ onScroll: le,
343
+ onStartMove: ae,
344
+ onStopMove: ie,
345
+ spinSize: ee.value,
346
+ containerSize: g.value.width,
361
347
  horizontal: !0,
362
- active: k.value,
348
+ active: O.value,
363
349
  showScrollBar: t.showScrollBar,
364
350
  style: t.styles?.horizontalScrollBar,
365
351
  thumbStyle: t.styles?.horizontalScrollBarThumb
@@ -368,6 +354,5 @@ const qe = /* @__PURE__ */ Ie({
368
354
  }
369
355
  });
370
356
  export {
371
- qe as default,
372
- Ke as getMeasuredVisibleRange
357
+ Qe as default
373
358
  };
@@ -1,7 +1,13 @@
1
1
  import { default as CacheMap } from '../utils/CacheMap';
2
2
  import { Key } from '../interface';
3
3
  import { ref } from 'vue';
4
- export default function useHeights(getKey: (item: any) => Key, onItemAdd?: (item: any) => void, onItemRemove?: (item: any) => void): [
4
+ /**
5
+ * @param disabled 定高快路径开关。返回 true 时**完全不测量**:
6
+ * 不注册 ResizeObserver、不读 offsetHeight/getComputedStyle、不写 CacheMap。
7
+ * 于是 `heights.id` 恒为 0,VirtualList 的可视区计算永远走 O(1) 的估算分支,
8
+ * 不再每次滚动重建整表前缀和。代价是行高必须真的等于声明值(调用方负责校验)。
9
+ */
10
+ export default function useHeights(getKey: (item: any) => Key, onItemAdd?: (item: any) => void, onItemRemove?: (item: any) => void, disabled?: () => boolean): [
5
11
  setInstanceRef: (item: any, instance: HTMLElement | null) => void,
6
12
  collectHeight: (sync?: boolean) => void,
7
13
  heights: CacheMap,
@@ -1 +1 @@
1
- {"version":3,"file":"useHeights.d.ts","sourceRoot":"","sources":["../../../../../../../core/src/components/VirtualList/hooks/useHeights.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,mBAAmB,CAAA;AACxC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAwB,GAAG,EAAE,MAAM,KAAK,CAAA;AAa/C,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,EAC1B,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,EAC/B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GACjC;IACD,cAAc,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI;IACjE,aAAa,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI;IACvC,OAAO,EAAE,QAAQ;IACjB,WAAW,EAAE,UAAU,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;CAC5C,CA0FA"}
1
+ {"version":3,"file":"useHeights.d.ts","sourceRoot":"","sources":["../../../../../../../core/src/components/VirtualList/hooks/useHeights.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,mBAAmB,CAAA;AACxC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAwB,GAAG,EAAE,MAAM,KAAK,CAAA;AAa/C;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,EAC1B,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,EAC/B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,EAClC,QAAQ,CAAC,EAAE,MAAM,OAAO,GACvB;IACD,cAAc,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI;IACjE,aAAa,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI;IACvC,OAAO,EAAE,QAAQ;IACjB,WAAW,EAAE,UAAU,CAAC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;CAC5C,CA8FA"}