x-next 1.18.2 → 1.19.1

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 (159) hide show
  1. package/AI_USAGE/catalog.md +3 -2
  2. package/AI_USAGE/components/alert-api.md +1 -1
  3. package/AI_USAGE/components/alert.md +1 -1
  4. package/AI_USAGE/components/bar-chart-api.md +1 -1
  5. package/AI_USAGE/components/bar-chart.md +1 -1
  6. package/AI_USAGE/components/boxicons.md +1 -1
  7. package/AI_USAGE/components/button-api.md +1 -1
  8. package/AI_USAGE/components/button.md +1 -1
  9. package/AI_USAGE/components/charts.md +1 -1
  10. package/AI_USAGE/components/checkbox-api.md +1 -1
  11. package/AI_USAGE/components/checkbox.md +1 -1
  12. package/AI_USAGE/components/color-picker-api.md +1 -1
  13. package/AI_USAGE/components/color-picker.md +1 -1
  14. package/AI_USAGE/components/config-provider-api.md +1 -1
  15. package/AI_USAGE/components/config-provider.md +1 -1
  16. package/AI_USAGE/components/date-picker-api.md +1 -1
  17. package/AI_USAGE/components/date-picker.md +1 -1
  18. package/AI_USAGE/components/dialog-api.md +1 -1
  19. package/AI_USAGE/components/dialog.md +1 -1
  20. package/AI_USAGE/components/draggable-api.md +1 -1
  21. package/AI_USAGE/components/draggable.md +1 -1
  22. package/AI_USAGE/components/drawer-api.md +1 -1
  23. package/AI_USAGE/components/drawer.md +1 -1
  24. package/AI_USAGE/components/dropdown-api.md +1 -1
  25. package/AI_USAGE/components/dropdown.md +1 -1
  26. package/AI_USAGE/components/empty-api.md +1 -1
  27. package/AI_USAGE/components/empty.md +1 -1
  28. package/AI_USAGE/components/finicon.md +1 -1
  29. package/AI_USAGE/components/form-api.md +1 -1
  30. package/AI_USAGE/components/form.md +1 -1
  31. package/AI_USAGE/components/grid-api.md +1 -1
  32. package/AI_USAGE/components/grid.md +1 -1
  33. package/AI_USAGE/components/heatmap-api.md +1 -1
  34. package/AI_USAGE/components/heatmap.md +1 -1
  35. package/AI_USAGE/components/icon-api.md +1 -1
  36. package/AI_USAGE/components/icon.md +1 -1
  37. package/AI_USAGE/components/image-api.md +1 -1
  38. package/AI_USAGE/components/image.md +1 -1
  39. package/AI_USAGE/components/input-api.md +1 -1
  40. package/AI_USAGE/components/input-number-api.md +1 -1
  41. package/AI_USAGE/components/input-number.md +1 -1
  42. package/AI_USAGE/components/input-tag-api.md +1 -1
  43. package/AI_USAGE/components/input-tag.md +1 -1
  44. package/AI_USAGE/components/input.md +1 -1
  45. package/AI_USAGE/components/layout-api.md +1 -1
  46. package/AI_USAGE/components/layout.md +1 -1
  47. package/AI_USAGE/components/line-chart-api.md +1 -1
  48. package/AI_USAGE/components/line-chart.md +1 -1
  49. package/AI_USAGE/components/link-api.md +1 -1
  50. package/AI_USAGE/components/link.md +1 -1
  51. package/AI_USAGE/components/menu-api.md +1 -1
  52. package/AI_USAGE/components/menu.md +1 -1
  53. package/AI_USAGE/components/message-api.md +1 -1
  54. package/AI_USAGE/components/message-box-api.md +1 -1
  55. package/AI_USAGE/components/message-box.md +1 -1
  56. package/AI_USAGE/components/message.md +1 -1
  57. package/AI_USAGE/components/network-api.md +1 -1
  58. package/AI_USAGE/components/network.md +1 -1
  59. package/AI_USAGE/components/notification-api.md +1 -1
  60. package/AI_USAGE/components/notification.md +1 -1
  61. package/AI_USAGE/components/pagination-api.md +1 -1
  62. package/AI_USAGE/components/pagination.md +3 -1
  63. package/AI_USAGE/components/pie-chart-api.md +1 -1
  64. package/AI_USAGE/components/pie-chart.md +1 -1
  65. package/AI_USAGE/components/popconfirm-api.md +1 -1
  66. package/AI_USAGE/components/popconfirm.md +1 -1
  67. package/AI_USAGE/components/popover-api.md +1 -1
  68. package/AI_USAGE/components/popover.md +1 -1
  69. package/AI_USAGE/components/popup-api.md +1 -1
  70. package/AI_USAGE/components/popup.md +1 -1
  71. package/AI_USAGE/components/progress-api.md +1 -1
  72. package/AI_USAGE/components/progress.md +1 -1
  73. package/AI_USAGE/components/radio-api.md +1 -1
  74. package/AI_USAGE/components/radio.md +1 -1
  75. package/AI_USAGE/components/rate-api.md +1 -1
  76. package/AI_USAGE/components/rate.md +1 -1
  77. package/AI_USAGE/components/resize-box-api.md +1 -1
  78. package/AI_USAGE/components/resize-box.md +1 -1
  79. package/AI_USAGE/components/scrollbar-api.md +1 -1
  80. package/AI_USAGE/components/scrollbar.md +1 -1
  81. package/AI_USAGE/components/select-api.md +1 -1
  82. package/AI_USAGE/components/select.md +3 -1
  83. package/AI_USAGE/components/skeleton-api.md +1 -1
  84. package/AI_USAGE/components/skeleton.md +1 -1
  85. package/AI_USAGE/components/slider-api.md +1 -1
  86. package/AI_USAGE/components/slider.md +1 -1
  87. package/AI_USAGE/components/space-api.md +1 -1
  88. package/AI_USAGE/components/space.md +1 -1
  89. package/AI_USAGE/components/spin-api.md +1 -1
  90. package/AI_USAGE/components/spin.md +1 -1
  91. package/AI_USAGE/components/steps-api.md +1 -1
  92. package/AI_USAGE/components/steps.md +1 -1
  93. package/AI_USAGE/components/switch-api.md +1 -1
  94. package/AI_USAGE/components/switch.md +1 -1
  95. package/AI_USAGE/components/table-api.md +1 -1
  96. package/AI_USAGE/components/table.md +1 -1
  97. package/AI_USAGE/components/tabs-api.md +1 -1
  98. package/AI_USAGE/components/tabs.md +1 -1
  99. package/AI_USAGE/components/tag-api.md +1 -1
  100. package/AI_USAGE/components/tag.md +1 -1
  101. package/AI_USAGE/components/textarea-api.md +1 -1
  102. package/AI_USAGE/components/textarea.md +1 -1
  103. package/AI_USAGE/components/time-picker-api.md +1 -1
  104. package/AI_USAGE/components/time-picker.md +1 -1
  105. package/AI_USAGE/components/time-range-selector-api.md +1 -1
  106. package/AI_USAGE/components/time-range-selector.md +1 -1
  107. package/AI_USAGE/components/timeline-api.md +1 -1
  108. package/AI_USAGE/components/timeline.md +1 -1
  109. package/AI_USAGE/components/tooltip-api.md +1 -1
  110. package/AI_USAGE/components/tooltip.md +1 -1
  111. package/AI_USAGE/components/transfer-api.md +1 -1
  112. package/AI_USAGE/components/transfer.md +1 -1
  113. package/AI_USAGE/components/tree-select-api.md +1 -1
  114. package/AI_USAGE/components/tree-select.md +1 -1
  115. package/AI_USAGE/components/trend-chart-api.md +1 -1
  116. package/AI_USAGE/components/trend-chart.md +1 -1
  117. package/AI_USAGE/components/trigger-api.md +1 -1
  118. package/AI_USAGE/components/trigger.md +1 -1
  119. package/AI_USAGE/components/upload-api.md +1 -1
  120. package/AI_USAGE/components/upload.md +1 -1
  121. package/AI_USAGE/components/virtual-list-api.md +135 -0
  122. package/AI_USAGE/components/virtual-list.md +62 -0
  123. package/AI_USAGE/components/watermark-api.md +1 -1
  124. package/AI_USAGE/components/watermark.md +1 -1
  125. package/AI_USAGE/core.md +1 -1
  126. package/AI_USAGE/index.md +3 -2
  127. package/AI_USAGE/recipes/form-on-demand.md +1 -1
  128. package/AI_USAGE.md +184 -3
  129. package/CHANGELOG.md +29 -0
  130. package/dist/components/form-select/index.d.ts +3 -3
  131. package/dist/components/index.d.ts +1 -0
  132. package/dist/components/pagination/page-options.vue.d.ts +3 -3
  133. package/dist/components/table/index.d.ts +3 -3
  134. package/dist/components/transfer/index.d.ts +3 -3
  135. package/dist/components/tree-select/index.d.ts +3 -3
  136. package/dist/components/virtual-list-v2/index.d.ts +1052 -2
  137. package/dist/components/virtual-list-v2/interface.d.ts +6 -0
  138. package/dist/components/virtual-list-v2/virtual-list.vue.d.ts +32 -1
  139. package/dist/es/components/_components/input-label/input-label.js +26 -25
  140. package/dist/es/components/form-select/Select.js +1 -1
  141. package/dist/es/components/form-select/SelectDropdown.vue.js +34 -32
  142. package/dist/es/components/index.js +85 -83
  143. package/dist/es/components/resize-box/ResizeBox.vue2.js +84 -81
  144. package/dist/es/components/table/Table.js +1 -1
  145. package/dist/es/components/transfer/transfer-panel.js +1 -1
  146. package/dist/es/components/tree-select/TreeSelect.js +1 -1
  147. package/dist/es/components/virtual-list-v2/index.js +6 -2
  148. package/dist/es/components/virtual-list-v2/virtual-list.vue.js +18 -17
  149. package/dist/es/components/virtual-list-v2/virtual-list.vue2.js +97 -70
  150. package/dist/es/index.js +55 -53
  151. package/dist/es/style.css +1 -1
  152. package/dist/index.cjs +3 -3
  153. package/dist/index.umd.js +3 -3
  154. package/dist/style/base.css +1 -1
  155. package/dist/style/form-select.css +1 -1
  156. package/dist/style.css +1 -1
  157. package/dist/types.d.ts +1 -0
  158. package/package.json +5 -5
  159. package/volar.d.ts +1 -0
@@ -1,27 +1,27 @@
1
- import { defineComponent as ot, toRefs as rt, reactive as M, ref as ut, computed as l, watch as K, onBeforeUnmount as st } from "vue";
2
- import dt from "../../_container/resize-trigger.vue.js";
3
- import V from "../../_hooks/use-merge-state.js";
1
+ import { defineComponent as rt, toRefs as ut, reactive as M, ref as st, computed as d, watch as D, onBeforeUnmount as dt } from "vue";
2
+ import at from "../../_container/resize-trigger.vue.js";
3
+ import K from "../../_hooks/use-merge-state.js";
4
4
  import { isNumber as s } from "../../_utils/is.js";
5
- import { off as D, on as E } from "../../_utils/dom.js";
6
- import { getClassNameMixin as at } from "../../_utils/config.js";
7
- const _ = "left", z = "right", k = "top", S = "bottom", ct = [
8
- _,
5
+ import { off as E, on as O } from "../../_utils/dom.js";
6
+ import { getClassNameMixin as ct } from "../../_utils/config.js";
7
+ const z = "left", C = "right", W = "top", R = "bottom", V = [
9
8
  z,
10
- k,
11
- S
9
+ C,
10
+ W,
11
+ R
12
12
  ];
13
- function R(o, h) {
13
+ function G(o, a) {
14
14
  if (o === 0) return 0;
15
- const u = o - h;
15
+ const u = o - a;
16
16
  return u <= 0 ? 0 : u;
17
17
  }
18
- function O(o) {
19
- return [k, S].indexOf(o) > -1;
18
+ function _(o) {
19
+ return [W, R].indexOf(o) > -1;
20
20
  }
21
- const vt = ot({
21
+ const vt = rt({
22
22
  name: "ResizeBox",
23
23
  components: {
24
- ResizeTrigger: dt
24
+ ResizeTrigger: at
25
25
  },
26
26
  inheritAttrs: !1,
27
27
  props: {
@@ -103,7 +103,7 @@ const vt = ot({
103
103
  * @param {{ width: number; height: number; }} size
104
104
  * @param {MouseEvent} ev
105
105
  */
106
- moving: (o, h) => !0,
106
+ moving: (o, a) => !0,
107
107
  /**
108
108
  * @zh 拖拽结束时触发
109
109
  * @en Triggered when the drag ends
@@ -123,30 +123,30 @@ const vt = ot({
123
123
  * @slot resize-trigger-icon
124
124
  * @binding {'left' | 'right' | 'top' | 'bottom'} direction
125
125
  */
126
- setup(o, { attrs: h, emit: u }) {
127
- const { height: G, width: j, directions: q } = rt(o), [f, C] = V(
126
+ setup(o, { attrs: a, emit: u }) {
127
+ const { height: j, width: q, directions: J } = ut(o), [m, P] = K(
128
128
  null,
129
129
  M({
130
- value: j
130
+ value: q
131
131
  })
132
- ), [p, P] = V(
132
+ ), [p, Y] = K(
133
133
  null,
134
134
  M({
135
- value: G
135
+ value: j
136
136
  })
137
- ), v = ut(), Y = M({}), X = at("resize-box"), J = l(() => {
138
- const { class: t, style: e, ...i } = h;
137
+ ), S = st(), k = M({}), X = ct("resize-box"), Q = d(() => {
138
+ const { class: t, style: e, ...i } = a;
139
139
  return i;
140
- }), Q = l(() => [X.block, h.class]), y = l(
141
- () => s(f.value) ? W(f.value) : f.value
142
- ), w = l(
143
- () => s(p.value) ? x(p.value) : p.value
144
- ), L = l(() => ({
145
- ...s(y.value) ? { width: `${y.value}px` } : {},
146
- ...s(w.value) ? { height: `${w.value}px` } : {},
147
- ...Y
148
- })), Z = l(() => [h.style, L.value]), tt = l(
149
- () => q.value.filter((t) => ct.includes(t))
140
+ }), Z = d(() => [X.block, a.class]), v = d(
141
+ () => s(m.value) ? N(m.value) : m.value
142
+ ), y = d(
143
+ () => s(p.value) ? I(p.value) : p.value
144
+ ), L = d(() => ({
145
+ ...s(v.value) ? { width: `${v.value}px` } : {},
146
+ ...s(y.value) ? { height: `${y.value}px` } : {},
147
+ ...k
148
+ })), tt = d(() => [a.style, L.value]), A = d(
149
+ () => J.value.filter((t) => V.includes(t))
150
150
  ), r = {
151
151
  direction: "",
152
152
  startPageX: 0,
@@ -161,93 +161,96 @@ const vt = ot({
161
161
  bottom: 0
162
162
  }
163
163
  };
164
- let H, I;
165
- function W(t) {
164
+ D(A, (t) => {
165
+ for (const e of V)
166
+ t.includes(e) || (r.padding[e] = 0, delete k[`padding-${e}`]);
167
+ });
168
+ let w, b;
169
+ function N(t) {
166
170
  return Math.min(o.maxWidth ?? Number.POSITIVE_INFINITY, Math.max(o.minWidth, t));
167
171
  }
168
- function x(t) {
172
+ function I(t) {
169
173
  return Math.min(
170
174
  o.maxHeight ?? Number.POSITIVE_INFINITY,
171
175
  Math.max(o.minHeight, t)
172
176
  );
173
177
  }
174
- function b() {
178
+ function c() {
175
179
  var i;
176
180
  const { left: t, right: e } = r.padding;
177
- return s(y.value) ? y.value : R(((i = v.value) == null ? void 0 : i.clientWidth) || 0, t + e);
181
+ return s(v.value) ? v.value : G(((i = S.value) == null ? void 0 : i.clientWidth) || 0, t + e);
178
182
  }
179
- function N() {
183
+ function l() {
180
184
  var i;
181
185
  const { top: t, bottom: e } = r.padding;
182
- return s(w.value) ? w.value : R(((i = v.value) == null ? void 0 : i.clientHeight) || 0, t + e);
186
+ return s(y.value) ? y.value : G(((i = S.value) == null ? void 0 : i.clientHeight) || 0, t + e);
183
187
  }
184
- function m(t, e) {
185
- const i = W(t);
186
- C(i), u("update:width", i), u("moving", { width: i, height: N() }, e);
188
+ function f(t, e) {
189
+ const i = N(t);
190
+ P(i), u("update:width", i), u("moving", { width: i, height: l() }, e);
187
191
  }
188
- K(y, (t) => {
189
- s(f.value) && s(t) && t !== f.value && (C(t), u("update:width", t));
190
- }, { immediate: !0 }), K(w, (t) => {
191
- s(p.value) && s(t) && t !== p.value && (P(t), u("update:height", t));
192
+ D(v, (t) => {
193
+ s(m.value) && s(t) && t !== m.value && (P(t), u("update:width", t));
194
+ }, { immediate: !0 }), D(y, (t) => {
195
+ s(p.value) && s(t) && t !== p.value && (Y(t), u("update:height", t));
192
196
  }, { immediate: !0 });
193
- function g(t, e) {
194
- const i = x(t);
195
- P(i), u("update:height", i), u("moving", { width: b(), height: i }, e);
197
+ function h(t, e) {
198
+ const i = I(t);
199
+ Y(i), u("update:height", i), u("moving", { width: c(), height: i }, e);
196
200
  }
197
- function U() {
198
- D(window, "mousemove", $), D(window, "mouseup", T), D(window, "contextmenu", T), H !== void 0 && typeof document < "u" && document.body && (document.body.style.cursor = H, H = void 0), I !== void 0 && typeof document < "u" && document.body && (document.body.style.userSelect = I, I = void 0);
201
+ function $() {
202
+ E(window, "mousemove", U), E(window, "mouseup", H), E(window, "contextmenu", H), w !== void 0 && typeof document < "u" && document.body && (document.body.style.cursor = w, w = void 0), b !== void 0 && typeof document < "u" && document.body && (document.body.style.userSelect = b, b = void 0);
199
203
  }
200
- function $(t) {
204
+ function U(t) {
201
205
  if (!r.moving) return;
202
- const { startPageX: e, startPageY: i, startWidth: n, startHeight: d, direction: A } = r;
203
- let a = n, c = d;
206
+ const { startPageX: e, startPageY: i, startWidth: n, startHeight: g, direction: ot } = r;
207
+ let T = n, x = g;
204
208
  const B = t.pageX - e, F = t.pageY - i;
205
- switch (A) {
206
- case _:
207
- a = W(n - B), m(a, t);
208
- break;
209
+ switch (ot) {
209
210
  case z:
210
- a = W(n + B), m(a, t);
211
+ T = N(n - B), f(T, t);
212
+ break;
213
+ case C:
214
+ T = N(n + B), f(T, t);
211
215
  break;
212
- case k:
213
- c = x(d - F), g(c, t);
216
+ case W:
217
+ x = I(g - F), h(x, t);
214
218
  break;
215
- case S:
216
- c = x(d + F), g(c, t);
219
+ case R:
220
+ x = I(g + F), h(x, t);
217
221
  break;
218
222
  }
219
223
  }
220
- function T(t) {
221
- r.moving && (r.moving = !1, U(), u("movingEnd", t));
224
+ function H(t) {
225
+ r.moving && (r.moving = !1, $(), u("movingEnd", t));
222
226
  }
223
227
  function et(t, e) {
224
- var a, c;
225
- e.preventDefault(), u("movingStart", e), r.moving = !0, H = typeof document < "u" ? document.body.style.cursor : "", I = typeof document < "u" ? document.body.style.userSelect : "", r.startPageX = e.pageX, r.startPageY = e.pageY, r.direction = t;
226
- const { top: i, left: n, right: d, bottom: A } = r.padding;
227
- r.startWidth = R(((a = v.value) == null ? void 0 : a.clientWidth) || 0, n + d), r.startHeight = R(((c = v.value) == null ? void 0 : c.clientHeight) || 0, i + A), E(window, "mousemove", $), E(window, "mouseup", T), E(window, "contextmenu", T), document.body.style.cursor = O(t) ? "row-resize" : "col-resize", document.body.style.userSelect = "none";
228
+ var i, n;
229
+ e.preventDefault(), (n = (i = e.currentTarget) == null ? void 0 : i.focus) == null || n.call(i, { preventScroll: !0 }), u("movingStart", e), r.moving = !0, w = typeof document < "u" ? document.body.style.cursor : "", b = typeof document < "u" ? document.body.style.userSelect : "", r.startPageX = e.pageX, r.startPageY = e.pageY, r.direction = t, r.startWidth = c(), r.startHeight = l(), O(window, "mousemove", U), O(window, "mouseup", H), O(window, "contextmenu", H), document.body.style.cursor = _(t) ? "row-resize" : "col-resize", document.body.style.userSelect = "none";
228
230
  }
229
231
  function it(t, e) {
230
232
  const i = e.shiftKey ? 1 : 10;
231
233
  let n = !1;
232
- t === _ ? e.key === "ArrowLeft" ? (m(b() + i, e), n = !0) : e.key === "ArrowRight" && (m(b() - i, e), n = !0) : t === z ? e.key === "ArrowRight" ? (m(b() + i, e), n = !0) : e.key === "ArrowLeft" && (m(b() - i, e), n = !0) : t === k ? e.key === "ArrowUp" ? (g(N() + i, e), n = !0) : e.key === "ArrowDown" && (g(N() - i, e), n = !0) : t === S && (e.key === "ArrowDown" ? (g(N() + i, e), n = !0) : e.key === "ArrowUp" && (g(N() - i, e), n = !0)), n && e.preventDefault();
234
+ t === z ? e.key === "ArrowLeft" ? (f(c() + i, e), n = !0) : e.key === "ArrowRight" && (f(c() - i, e), n = !0) : t === C ? e.key === "ArrowRight" ? (f(c() + i, e), n = !0) : e.key === "ArrowLeft" && (f(c() - i, e), n = !0) : t === W ? e.key === "ArrowUp" ? (h(l() + i, e), n = !0) : e.key === "ArrowDown" && (h(l() - i, e), n = !0) : t === R && (e.key === "ArrowDown" ? (h(l() + i, e), n = !0) : e.key === "ArrowUp" && (h(l() - i, e), n = !0)), n && e.preventDefault();
233
235
  }
234
236
  function nt(t, e) {
235
- const { width: i, height: n } = e.contentRect, d = O(t) ? n : i;
236
- r.padding[t] = d, Y[`padding-${t}`] = `${d}px`;
237
+ if (!A.value.includes(t)) return;
238
+ const { width: i, height: n } = e.contentRect, g = _(t) ? n : i;
239
+ r.padding[t] = g, k[`padding-${t}`] = `${g}px`;
237
240
  }
238
- return st(() => {
239
- U();
241
+ return dt(() => {
242
+ $();
240
243
  }), {
241
244
  className: X,
242
- classNames: Q,
243
- wrapperAttrs: J,
245
+ classNames: Z,
246
+ wrapperAttrs: Q,
244
247
  styles: L,
245
- mergedStyles: Z,
246
- wrapperRef: v,
248
+ mergedStyles: tt,
249
+ wrapperRef: S,
247
250
  onMoveStart: et,
248
251
  onTriggerKeydown: it,
249
- isHorizontal: O,
250
- allowDirections: tt,
252
+ isHorizontal: _,
253
+ allowDirections: A,
251
254
  onTiggerResize: nt
252
255
  };
253
256
  }
@@ -18,7 +18,7 @@ import Oa from "./table-th.js";
18
18
  import we from "./table-td.js";
19
19
  import Ia from "./table-operation-th.js";
20
20
  import Vt from "./table-operation-td.js";
21
- import Ha from "../virtual-list-v2/virtual-list.vue.js";
21
+ import { VirtualList as Ha } from "../virtual-list-v2/index.js";
22
22
  import qt from "../../_container/resize-observer.js";
23
23
  import { omit as Yt } from "../../_utils/omit.js";
24
24
  import { useDrag as ja } from "./hooks/use-drag.js";
@@ -5,7 +5,7 @@ import { Input as re } from "../form-input/index.js";
5
5
  import { Empty as ue } from "../empty/index.js";
6
6
  import { Spin as ie } from "../spin/index.js";
7
7
  import { Pagination as oe } from "../pagination/index.js";
8
- import ce from "../virtual-list-v2/virtual-list.vue.js";
8
+ import { VirtualList as ce } from "../virtual-list-v2/index.js";
9
9
  import { useLocale as se } from "../../locale/index.js";
10
10
  import { transferKey as S } from "./utils.js";
11
11
  function J(a) {
@@ -4,7 +4,7 @@ import { Trigger as _ } from "../trigger/index.js";
4
4
  import $ from "../_components/select-view/select-view.js";
5
5
  import na from "./TreeSelectDropdown.vue.js";
6
6
  import ua from "./TreeNode.vue.js";
7
- import ra from "../virtual-list-v2/virtual-list.vue.js";
7
+ import { VirtualList as ra } from "../virtual-list-v2/index.js";
8
8
  import { useFormItem as da } from "../../_hooks/use-form-item.js";
9
9
  import { useTrigger as ia } from "../../_hooks/use-trigger.js";
10
10
  import { useLocale as ca } from "../../locale/index.js";
@@ -1,4 +1,8 @@
1
- import r from "./virtual-list.vue.js";
1
+ import t from "./virtual-list.vue.js";
2
+ import { generateComponent as o } from "../../_utils/vue-eco.js";
3
+ import { getComponentPrefix as r } from "../../_utils/config.js";
4
+ const a = o(r("VirtualList"), t);
2
5
  export {
3
- r as default
6
+ a as VirtualList,
7
+ a as default
4
8
  };
@@ -1,41 +1,42 @@
1
1
  import d from "./virtual-list.vue2.js";
2
- import { resolveComponent as m, openBlock as t, createBlock as o, resolveDynamicComponent as r, mergeProps as s, withCtx as n, createElementBlock as p, Fragment as f, renderList as g, renderSlot as u } from "vue";
3
- import y from "../../_virtual/_plugin-vue_export-helper.js";
4
- function c(e, $, C, P, S, h) {
5
- const a = m("VirtualListItem");
6
- return t(), o(r(e.displayScrollbar ? "ScrollbarComponent" : e.mergedComponent.container), s({
2
+ import { resolveComponent as p, openBlock as o, createBlock as t, resolveDynamicComponent as s, mergeProps as r, withCtx as n, createElementBlock as m, Fragment as f, renderList as g, normalizeStyle as u, renderSlot as y } from "vue";
3
+ import h from "../../_virtual/_plugin-vue_export-helper.js";
4
+ function S(e, $, z, C, P, b) {
5
+ const a = p("VirtualListItem");
6
+ return o(), t(s(e.displayScrollbar ? "ScrollbarComponent" : e.mergedComponent.container), r({
7
7
  ref: "wrapperComRef",
8
8
  class: e.className.block,
9
9
  style: e.style
10
10
  }, e.scrollbarProps, { onScroll: e.onScroll }), {
11
11
  default: n(() => [
12
- (t(), o(r(e.mergedComponent.list), s(e.listAttrs, {
12
+ (o(), t(s(e.mergedComponent.list), r(e.listAttrs, {
13
13
  style: e.paddingPosition === "list" ? {
14
14
  paddingTop: `${e.frontPadding}px`,
15
15
  paddingBottom: `${e.behindPadding}px`
16
16
  } : {}
17
17
  }), {
18
18
  default: n(() => [
19
- (t(), o(r(e.mergedComponent.content), s({ ref: "contentRef" }, e.contentAttrs, {
20
- style: e.paddingPosition === "content" ? {
19
+ (o(), t(s(e.mergedComponent.content), r({ ref: "contentRef" }, e.contentAttrs, {
20
+ style: e.positioned ? { position: "relative", height: `${e.data.length * e.estimatedSize}px` } : e.paddingPosition === "content" ? {
21
21
  paddingTop: `${e.frontPadding}px`,
22
22
  paddingBottom: `${e.behindPadding}px`
23
23
  } : {}
24
24
  }), {
25
25
  default: n(() => [
26
- (t(!0), p(f, null, g(e.currentList, (i, l) => (t(), o(a, {
27
- key: i[e.itemKey] ?? e.start + l,
26
+ (o(!0), m(f, null, g(e.renderedItems, ({ item: l, index: i }) => (o(), t(a, {
27
+ key: l[e.itemKey] ?? i,
28
28
  "has-item-size": e.hasItemSize,
29
- "set-item-size": e.setItemSize
29
+ "set-item-size": e.setItemSize,
30
+ style: u(e.positioned ? { position: "absolute", top: `${i * e.estimatedSize}px`, width: "100%" } : void 0)
30
31
  }, {
31
32
  default: n(() => [
32
- u(e.$slots, "item", {
33
- item: i,
34
- index: e.start + l
33
+ y(e.$slots, "item", {
34
+ item: l,
35
+ index: i
35
36
  })
36
37
  ]),
37
38
  _: 2
38
- }, 1032, ["has-item-size", "set-item-size"]))), 128))
39
+ }, 1032, ["has-item-size", "set-item-size", "style"]))), 128))
39
40
  ]),
40
41
  _: 3
41
42
  }, 16, ["style"]))
@@ -46,7 +47,7 @@ function c(e, $, C, P, S, h) {
46
47
  _: 3
47
48
  }, 16, ["class", "style", "onScroll"]);
48
49
  }
49
- const B = /* @__PURE__ */ y(d, [["render", c]]);
50
+ const I = /* @__PURE__ */ h(d, [["render", S]]);
50
51
  export {
51
- B as default
52
+ I as default
52
53
  };
@@ -1,14 +1,14 @@
1
- import { defineComponent as K, toRefs as g, computed as i, ref as M, watch as V, nextTick as y } from "vue";
2
- import { useSize as $ } from "./hooks/use-size.js";
3
- import q from "./virtual-list-item.js";
4
- import { isObject as D, isNumber as S } from "../../_utils/is.js";
5
- import { getClassNameMixin as E } from "../../_utils/config.js";
6
- import { Scrollbar as F } from "../scrollbar-v2/index.js";
7
- import { useComponentRef as G } from "../../_hooks/use-component-ref.js";
8
- import { useScrollbar as J } from "../../_hooks/use-scrollbar.js";
9
- const le = K({
1
+ import { defineComponent as G, toRefs as R, computed as c, ref as J, watch as H, nextTick as S } from "vue";
2
+ import { useSize as Q } from "./hooks/use-size.js";
3
+ import U from "./virtual-list-item.js";
4
+ import { isObject as W, isNumber as N } from "../../_utils/is.js";
5
+ import { getClassNameMixin as X } from "../../_utils/config.js";
6
+ import { Scrollbar as Y } from "../scrollbar-v2/index.js";
7
+ import { useComponentRef as Z } from "../../_hooks/use-component-ref.js";
8
+ import { useScrollbar as ee } from "../../_hooks/use-scrollbar.js";
9
+ const ce = G({
10
10
  name: "VirtualList",
11
- components: { VirtualListItem: q, ScrollbarComponent: F },
11
+ components: { VirtualListItem: U, ScrollbarComponent: Y },
12
12
  props: {
13
13
  height: {
14
14
  type: [Number, String],
@@ -55,86 +55,113 @@ const le = K({
55
55
  scrollbar: {
56
56
  type: [Boolean, Object],
57
57
  default: !1
58
- }
58
+ },
59
+ preserveScroll: { type: Boolean, default: !1 },
60
+ pinnedKeys: { type: Array, default: void 0 }
59
61
  },
60
62
  emits: {
61
- scroll: (t) => !0,
62
- reachBottom: (t) => !0
63
+ scroll: (o) => !0,
64
+ reachBottom: (o) => !0,
65
+ rangeChange: (o) => !0
63
66
  },
64
- setup(t, { emit: m }) {
65
- const { data: a, itemKey: x, fixedSize: T, estimatedSize: R, buffer: d, height: c } = g(t), { displayScrollbar: z, scrollbarProps: N } = J(g(t).scrollbar), O = E("virtual-list"), C = i(() => D(t.component) ? {
67
+ setup(o, { emit: m, expose: B }) {
68
+ const { data: i, itemKey: j, fixedSize: K, estimatedSize: _, buffer: b, height: v } = R(o), { displayScrollbar: w, scrollbarProps: A } = ee(R(o).scrollbar), I = X("virtual-list"), P = c(() => W(o.component) ? {
66
69
  container: "div",
67
70
  list: "div",
68
71
  content: "div",
69
- ...t.component
72
+ ...o.component
70
73
  } : {
71
- container: t.component,
74
+ container: o.component,
72
75
  list: "div",
73
76
  content: "div"
74
- }), { componentRef: j, elementRef: o } = G("containerRef"), p = M(), B = i(() => ({
75
- height: S(c.value) ? `${c.value}px` : c.value,
77
+ }), { componentRef: k, elementRef: a } = Z("containerRef"), x = J(), L = c(() => ({
78
+ height: N(v.value) ? `${v.value}px` : v.value,
76
79
  overflow: "auto"
77
- })), s = i(
78
- () => a.value.map((e, l) => e[x.value] ?? l)
80
+ })), u = c(
81
+ () => i.value.map((l, n) => l[j.value] ?? n)
79
82
  ), {
80
- frontPadding: _,
81
- behindPadding: P,
82
- start: u,
83
- end: w,
84
- getStartByScroll: A,
85
- setItemSize: I,
86
- hasItemSize: L,
83
+ frontPadding: V,
84
+ behindPadding: q,
85
+ start: s,
86
+ end: h,
87
+ getStartByScroll: T,
88
+ setItemSize: $,
89
+ hasItemSize: D,
87
90
  setStart: f,
88
- getScrollOffset: v
89
- } = $({
90
- dataKeys: s,
91
- contentRef: p,
92
- fixedSize: T,
93
- estimatedSize: R,
94
- buffer: d
95
- }), k = i(() => t.threshold && a.value.length <= t.threshold ? a.value : a.value.slice(u.value, w.value));
96
- V(s, (e, l) => {
97
- e.length >= l.length && l.every((r, n) => e[n] === r) || (f(0), o.value && (o.value.scrollTop = 0));
91
+ getScrollOffset: O
92
+ } = Q({
93
+ dataKeys: u,
94
+ contentRef: x,
95
+ fixedSize: K,
96
+ estimatedSize: _,
97
+ buffer: b
98
+ }), p = c(() => o.threshold && i.value.length <= o.threshold ? i.value : i.value.slice(s.value, h.value)), z = c(() => o.fixedSize && o.pinnedKeys !== void 0), E = c(() => {
99
+ const l = o.threshold && i.value.length <= o.threshold ? 0 : s.value, n = p.value.map((e, r) => ({ item: e, index: l + r }));
100
+ if (z.value) {
101
+ const e = new Set(n.map((r) => r.index));
102
+ for (const r of o.pinnedKeys ?? []) {
103
+ const t = u.value.indexOf(r);
104
+ t >= 0 && !e.has(t) && (e.add(t), n.push({ item: i.value[t], index: t }));
105
+ }
106
+ n.sort((r, t) => r.index - t.index);
107
+ }
108
+ return n;
109
+ });
110
+ H([s, h], () => m("rangeChange", { start: s.value, end: h.value }), { immediate: !0 }), H(u, (l, n) => {
111
+ if (o.preserveScroll) {
112
+ S(() => {
113
+ if (a.value) {
114
+ const e = a.value;
115
+ e.scrollTop = Math.min(e.scrollTop, Math.max(0, e.scrollHeight - e.clientHeight)), f(T(e.scrollTop));
116
+ }
117
+ });
118
+ return;
119
+ }
120
+ l.length >= n.length && n.every((e, r) => l[r] === e) || (f(0), a.value && (a.value.scrollTop = 0));
98
121
  });
99
- const H = (e) => {
100
- const { scrollTop: l, scrollHeight: r, clientHeight: n } = e.target, b = A(l);
101
- b !== u.value && (f(b), y(() => {
102
- h(l);
103
- })), m("scroll", e), Math.floor(r - (l + n)) <= 0 && m("reachBottom", e);
104
- }, h = (e) => {
105
- if (o.value)
106
- if (S(e))
107
- o.value.scrollTop = e;
122
+ const F = (l) => {
123
+ const { scrollTop: n, scrollHeight: e, clientHeight: r } = l.target, t = T(n);
124
+ t !== s.value && (f(t), S(() => {
125
+ g(n);
126
+ })), m("scroll", l), Math.floor(e - (n + r)) <= 0 && m("reachBottom", l);
127
+ }, g = (l) => {
128
+ if (a.value)
129
+ if (N(l))
130
+ a.value.scrollTop = l;
108
131
  else {
109
- const { align: l = "top" } = e, r = e.index ?? s.value.indexOf(e.key ?? "");
110
- f(r - d.value), o.value.scrollTop = v(r), y(() => {
111
- if (o.value) {
112
- const n = v(r);
113
- n !== o.value.scrollTop && (o.value.scrollTop = n);
132
+ const { align: n = "top" } = l, e = l.index ?? u.value.indexOf(l.key ?? "");
133
+ if (e < 0 || !i.value.length) return;
134
+ const r = Math.min(Math.floor(e), i.value.length - 1), t = a.value, d = O(r), y = O(r + 1), C = n === "bottom" ? y - t.clientHeight : n === "auto" ? d < t.scrollTop ? d : y > t.scrollTop + t.clientHeight ? y - t.clientHeight : t.scrollTop : d;
135
+ f(r - b.value), a.value.scrollTop = Math.max(0, C), S(() => {
136
+ if (a.value) {
137
+ const M = Math.max(0, C);
138
+ M !== a.value.scrollTop && (a.value.scrollTop = M);
114
139
  }
115
140
  });
116
141
  }
117
142
  };
118
- return {
119
- className: O,
120
- containerRef: o,
121
- wrapperComRef: j,
122
- displayScrollbar: z,
123
- scrollbarProps: N,
124
- contentRef: p,
125
- frontPadding: _,
126
- currentList: k,
127
- behindPadding: P,
128
- onScroll: H,
129
- setItemSize: I,
130
- hasItemSize: L,
131
- start: u,
132
- scrollTo: h,
133
- style: B,
134
- mergedComponent: C
143
+ return B({ scrollTo: g, containerRef: a, currentList: p }), {
144
+ className: I,
145
+ containerRef: a,
146
+ wrapperComRef: k,
147
+ displayScrollbar: w,
148
+ scrollbarProps: A,
149
+ contentRef: x,
150
+ frontPadding: V,
151
+ currentList: p,
152
+ positioned: z,
153
+ renderedItems: E,
154
+ behindPadding: q,
155
+ onScroll: F,
156
+ setItemSize: $,
157
+ hasItemSize: D,
158
+ start: s,
159
+ scrollTo: g,
160
+ style: L,
161
+ mergedComponent: P
135
162
  };
136
163
  }
137
164
  });
138
165
  export {
139
- le as default
166
+ ce as default
140
167
  };