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.
- package/AI_USAGE/catalog.md +3 -2
- package/AI_USAGE/components/alert-api.md +1 -1
- package/AI_USAGE/components/alert.md +1 -1
- package/AI_USAGE/components/bar-chart-api.md +1 -1
- package/AI_USAGE/components/bar-chart.md +1 -1
- package/AI_USAGE/components/boxicons.md +1 -1
- package/AI_USAGE/components/button-api.md +1 -1
- package/AI_USAGE/components/button.md +1 -1
- package/AI_USAGE/components/charts.md +1 -1
- package/AI_USAGE/components/checkbox-api.md +1 -1
- package/AI_USAGE/components/checkbox.md +1 -1
- package/AI_USAGE/components/color-picker-api.md +1 -1
- package/AI_USAGE/components/color-picker.md +1 -1
- package/AI_USAGE/components/config-provider-api.md +1 -1
- package/AI_USAGE/components/config-provider.md +1 -1
- package/AI_USAGE/components/date-picker-api.md +1 -1
- package/AI_USAGE/components/date-picker.md +1 -1
- package/AI_USAGE/components/dialog-api.md +1 -1
- package/AI_USAGE/components/dialog.md +1 -1
- package/AI_USAGE/components/draggable-api.md +1 -1
- package/AI_USAGE/components/draggable.md +1 -1
- package/AI_USAGE/components/drawer-api.md +1 -1
- package/AI_USAGE/components/drawer.md +1 -1
- package/AI_USAGE/components/dropdown-api.md +1 -1
- package/AI_USAGE/components/dropdown.md +1 -1
- package/AI_USAGE/components/empty-api.md +1 -1
- package/AI_USAGE/components/empty.md +1 -1
- package/AI_USAGE/components/finicon.md +1 -1
- package/AI_USAGE/components/form-api.md +1 -1
- package/AI_USAGE/components/form.md +1 -1
- package/AI_USAGE/components/grid-api.md +1 -1
- package/AI_USAGE/components/grid.md +1 -1
- package/AI_USAGE/components/heatmap-api.md +1 -1
- package/AI_USAGE/components/heatmap.md +1 -1
- package/AI_USAGE/components/icon-api.md +1 -1
- package/AI_USAGE/components/icon.md +1 -1
- package/AI_USAGE/components/image-api.md +1 -1
- package/AI_USAGE/components/image.md +1 -1
- package/AI_USAGE/components/input-api.md +1 -1
- package/AI_USAGE/components/input-number-api.md +1 -1
- package/AI_USAGE/components/input-number.md +1 -1
- package/AI_USAGE/components/input-tag-api.md +1 -1
- package/AI_USAGE/components/input-tag.md +1 -1
- package/AI_USAGE/components/input.md +1 -1
- package/AI_USAGE/components/layout-api.md +1 -1
- package/AI_USAGE/components/layout.md +1 -1
- package/AI_USAGE/components/line-chart-api.md +1 -1
- package/AI_USAGE/components/line-chart.md +1 -1
- package/AI_USAGE/components/link-api.md +1 -1
- package/AI_USAGE/components/link.md +1 -1
- package/AI_USAGE/components/menu-api.md +1 -1
- package/AI_USAGE/components/menu.md +1 -1
- package/AI_USAGE/components/message-api.md +1 -1
- package/AI_USAGE/components/message-box-api.md +1 -1
- package/AI_USAGE/components/message-box.md +1 -1
- package/AI_USAGE/components/message.md +1 -1
- package/AI_USAGE/components/network-api.md +1 -1
- package/AI_USAGE/components/network.md +1 -1
- package/AI_USAGE/components/notification-api.md +1 -1
- package/AI_USAGE/components/notification.md +1 -1
- package/AI_USAGE/components/pagination-api.md +1 -1
- package/AI_USAGE/components/pagination.md +3 -1
- package/AI_USAGE/components/pie-chart-api.md +1 -1
- package/AI_USAGE/components/pie-chart.md +1 -1
- package/AI_USAGE/components/popconfirm-api.md +1 -1
- package/AI_USAGE/components/popconfirm.md +1 -1
- package/AI_USAGE/components/popover-api.md +1 -1
- package/AI_USAGE/components/popover.md +1 -1
- package/AI_USAGE/components/popup-api.md +1 -1
- package/AI_USAGE/components/popup.md +1 -1
- package/AI_USAGE/components/progress-api.md +1 -1
- package/AI_USAGE/components/progress.md +1 -1
- package/AI_USAGE/components/radio-api.md +1 -1
- package/AI_USAGE/components/radio.md +1 -1
- package/AI_USAGE/components/rate-api.md +1 -1
- package/AI_USAGE/components/rate.md +1 -1
- package/AI_USAGE/components/resize-box-api.md +1 -1
- package/AI_USAGE/components/resize-box.md +1 -1
- package/AI_USAGE/components/scrollbar-api.md +1 -1
- package/AI_USAGE/components/scrollbar.md +1 -1
- package/AI_USAGE/components/select-api.md +1 -1
- package/AI_USAGE/components/select.md +3 -1
- package/AI_USAGE/components/skeleton-api.md +1 -1
- package/AI_USAGE/components/skeleton.md +1 -1
- package/AI_USAGE/components/slider-api.md +1 -1
- package/AI_USAGE/components/slider.md +1 -1
- package/AI_USAGE/components/space-api.md +1 -1
- package/AI_USAGE/components/space.md +1 -1
- package/AI_USAGE/components/spin-api.md +1 -1
- package/AI_USAGE/components/spin.md +1 -1
- package/AI_USAGE/components/steps-api.md +1 -1
- package/AI_USAGE/components/steps.md +1 -1
- package/AI_USAGE/components/switch-api.md +1 -1
- package/AI_USAGE/components/switch.md +1 -1
- package/AI_USAGE/components/table-api.md +1 -1
- package/AI_USAGE/components/table.md +1 -1
- package/AI_USAGE/components/tabs-api.md +1 -1
- package/AI_USAGE/components/tabs.md +1 -1
- package/AI_USAGE/components/tag-api.md +1 -1
- package/AI_USAGE/components/tag.md +1 -1
- package/AI_USAGE/components/textarea-api.md +1 -1
- package/AI_USAGE/components/textarea.md +1 -1
- package/AI_USAGE/components/time-picker-api.md +1 -1
- package/AI_USAGE/components/time-picker.md +1 -1
- package/AI_USAGE/components/time-range-selector-api.md +1 -1
- package/AI_USAGE/components/time-range-selector.md +1 -1
- package/AI_USAGE/components/timeline-api.md +1 -1
- package/AI_USAGE/components/timeline.md +1 -1
- package/AI_USAGE/components/tooltip-api.md +1 -1
- package/AI_USAGE/components/tooltip.md +1 -1
- package/AI_USAGE/components/transfer-api.md +1 -1
- package/AI_USAGE/components/transfer.md +1 -1
- package/AI_USAGE/components/tree-select-api.md +1 -1
- package/AI_USAGE/components/tree-select.md +1 -1
- package/AI_USAGE/components/trend-chart-api.md +1 -1
- package/AI_USAGE/components/trend-chart.md +1 -1
- package/AI_USAGE/components/trigger-api.md +1 -1
- package/AI_USAGE/components/trigger.md +1 -1
- package/AI_USAGE/components/upload-api.md +1 -1
- package/AI_USAGE/components/upload.md +1 -1
- package/AI_USAGE/components/virtual-list-api.md +135 -0
- package/AI_USAGE/components/virtual-list.md +62 -0
- package/AI_USAGE/components/watermark-api.md +1 -1
- package/AI_USAGE/components/watermark.md +1 -1
- package/AI_USAGE/core.md +1 -1
- package/AI_USAGE/index.md +3 -2
- package/AI_USAGE/recipes/form-on-demand.md +1 -1
- package/AI_USAGE.md +184 -3
- package/CHANGELOG.md +29 -0
- package/dist/components/form-select/index.d.ts +3 -3
- package/dist/components/index.d.ts +1 -0
- package/dist/components/pagination/page-options.vue.d.ts +3 -3
- package/dist/components/table/index.d.ts +3 -3
- package/dist/components/transfer/index.d.ts +3 -3
- package/dist/components/tree-select/index.d.ts +3 -3
- package/dist/components/virtual-list-v2/index.d.ts +1052 -2
- package/dist/components/virtual-list-v2/interface.d.ts +6 -0
- package/dist/components/virtual-list-v2/virtual-list.vue.d.ts +32 -1
- package/dist/es/components/_components/input-label/input-label.js +26 -25
- package/dist/es/components/form-select/Select.js +1 -1
- package/dist/es/components/form-select/SelectDropdown.vue.js +34 -32
- package/dist/es/components/index.js +85 -83
- package/dist/es/components/resize-box/ResizeBox.vue2.js +84 -81
- package/dist/es/components/table/Table.js +1 -1
- package/dist/es/components/transfer/transfer-panel.js +1 -1
- package/dist/es/components/tree-select/TreeSelect.js +1 -1
- package/dist/es/components/virtual-list-v2/index.js +6 -2
- package/dist/es/components/virtual-list-v2/virtual-list.vue.js +18 -17
- package/dist/es/components/virtual-list-v2/virtual-list.vue2.js +97 -70
- package/dist/es/index.js +55 -53
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/style/base.css +1 -1
- package/dist/style/form-select.css +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +5 -5
- package/volar.d.ts +1 -0
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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
|
|
6
|
-
import { getClassNameMixin as
|
|
7
|
-
const
|
|
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
|
-
|
|
11
|
-
|
|
9
|
+
C,
|
|
10
|
+
W,
|
|
11
|
+
R
|
|
12
12
|
];
|
|
13
|
-
function
|
|
13
|
+
function G(o, a) {
|
|
14
14
|
if (o === 0) return 0;
|
|
15
|
-
const u = o -
|
|
15
|
+
const u = o - a;
|
|
16
16
|
return u <= 0 ? 0 : u;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return [
|
|
18
|
+
function _(o) {
|
|
19
|
+
return [W, R].indexOf(o) > -1;
|
|
20
20
|
}
|
|
21
|
-
const vt =
|
|
21
|
+
const vt = rt({
|
|
22
22
|
name: "ResizeBox",
|
|
23
23
|
components: {
|
|
24
|
-
ResizeTrigger:
|
|
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,
|
|
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:
|
|
127
|
-
const { height:
|
|
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:
|
|
130
|
+
value: q
|
|
131
131
|
})
|
|
132
|
-
), [p,
|
|
132
|
+
), [p, Y] = K(
|
|
133
133
|
null,
|
|
134
134
|
M({
|
|
135
|
-
value:
|
|
135
|
+
value: j
|
|
136
136
|
})
|
|
137
|
-
),
|
|
138
|
-
const { class: t, style: e, ...i } =
|
|
137
|
+
), S = st(), k = M({}), X = ct("resize-box"), Q = d(() => {
|
|
138
|
+
const { class: t, style: e, ...i } = a;
|
|
139
139
|
return i;
|
|
140
|
-
}),
|
|
141
|
-
() => s(
|
|
142
|
-
),
|
|
143
|
-
() => s(p.value) ?
|
|
144
|
-
), L =
|
|
145
|
-
...s(
|
|
146
|
-
...s(
|
|
147
|
-
...
|
|
148
|
-
})),
|
|
149
|
-
() =>
|
|
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
|
-
|
|
165
|
-
|
|
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
|
|
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
|
|
178
|
+
function c() {
|
|
175
179
|
var i;
|
|
176
180
|
const { left: t, right: e } = r.padding;
|
|
177
|
-
return s(
|
|
181
|
+
return s(v.value) ? v.value : G(((i = S.value) == null ? void 0 : i.clientWidth) || 0, t + e);
|
|
178
182
|
}
|
|
179
|
-
function
|
|
183
|
+
function l() {
|
|
180
184
|
var i;
|
|
181
185
|
const { top: t, bottom: e } = r.padding;
|
|
182
|
-
return s(
|
|
186
|
+
return s(y.value) ? y.value : G(((i = S.value) == null ? void 0 : i.clientHeight) || 0, t + e);
|
|
183
187
|
}
|
|
184
|
-
function
|
|
185
|
-
const i =
|
|
186
|
-
|
|
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
|
-
|
|
189
|
-
s(
|
|
190
|
-
}, { immediate: !0 }),
|
|
191
|
-
s(p.value) && s(t) && t !== p.value && (
|
|
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
|
|
194
|
-
const i =
|
|
195
|
-
|
|
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
|
|
198
|
-
|
|
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
|
|
204
|
+
function U(t) {
|
|
201
205
|
if (!r.moving) return;
|
|
202
|
-
const { startPageX: e, startPageY: i, startWidth: n, startHeight:
|
|
203
|
-
let
|
|
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 (
|
|
206
|
-
case _:
|
|
207
|
-
a = W(n - B), m(a, t);
|
|
208
|
-
break;
|
|
209
|
+
switch (ot) {
|
|
209
210
|
case z:
|
|
210
|
-
|
|
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
|
|
213
|
-
|
|
216
|
+
case W:
|
|
217
|
+
x = I(g - F), h(x, t);
|
|
214
218
|
break;
|
|
215
|
-
case
|
|
216
|
-
|
|
219
|
+
case R:
|
|
220
|
+
x = I(g + F), h(x, t);
|
|
217
221
|
break;
|
|
218
222
|
}
|
|
219
223
|
}
|
|
220
|
-
function
|
|
221
|
-
r.moving && (r.moving = !1,
|
|
224
|
+
function H(t) {
|
|
225
|
+
r.moving && (r.moving = !1, $(), u("movingEnd", t));
|
|
222
226
|
}
|
|
223
227
|
function et(t, e) {
|
|
224
|
-
var
|
|
225
|
-
e.preventDefault(), u("movingStart", e), r.moving = !0,
|
|
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 ===
|
|
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
|
-
|
|
236
|
-
|
|
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
|
|
239
|
-
|
|
241
|
+
return dt(() => {
|
|
242
|
+
$();
|
|
240
243
|
}), {
|
|
241
244
|
className: X,
|
|
242
|
-
classNames:
|
|
243
|
-
wrapperAttrs:
|
|
245
|
+
classNames: Z,
|
|
246
|
+
wrapperAttrs: Q,
|
|
244
247
|
styles: L,
|
|
245
|
-
mergedStyles:
|
|
246
|
-
wrapperRef:
|
|
248
|
+
mergedStyles: tt,
|
|
249
|
+
wrapperRef: S,
|
|
247
250
|
onMoveStart: et,
|
|
248
251
|
onTriggerKeydown: it,
|
|
249
|
-
isHorizontal:
|
|
250
|
-
allowDirections:
|
|
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/
|
|
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/
|
|
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/
|
|
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
|
|
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
|
-
|
|
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
|
|
3
|
-
import
|
|
4
|
-
function
|
|
5
|
-
const a =
|
|
6
|
-
return
|
|
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
|
-
(
|
|
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
|
-
(
|
|
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
|
-
(
|
|
27
|
-
key:
|
|
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
|
-
|
|
33
|
-
item:
|
|
34
|
-
index:
|
|
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
|
|
50
|
+
const I = /* @__PURE__ */ h(d, [["render", S]]);
|
|
50
51
|
export {
|
|
51
|
-
|
|
52
|
+
I as default
|
|
52
53
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useSize as
|
|
3
|
-
import
|
|
4
|
-
import { isObject as
|
|
5
|
-
import { getClassNameMixin as
|
|
6
|
-
import { Scrollbar as
|
|
7
|
-
import { useComponentRef as
|
|
8
|
-
import { useScrollbar as
|
|
9
|
-
const
|
|
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:
|
|
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: (
|
|
62
|
-
reachBottom: (
|
|
63
|
+
scroll: (o) => !0,
|
|
64
|
+
reachBottom: (o) => !0,
|
|
65
|
+
rangeChange: (o) => !0
|
|
63
66
|
},
|
|
64
|
-
setup(
|
|
65
|
-
const { data:
|
|
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
|
-
...
|
|
72
|
+
...o.component
|
|
70
73
|
} : {
|
|
71
|
-
container:
|
|
74
|
+
container: o.component,
|
|
72
75
|
list: "div",
|
|
73
76
|
content: "div"
|
|
74
|
-
}), { componentRef:
|
|
75
|
-
height:
|
|
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
|
-
})),
|
|
78
|
-
() =>
|
|
80
|
+
})), u = c(
|
|
81
|
+
() => i.value.map((l, n) => l[j.value] ?? n)
|
|
79
82
|
), {
|
|
80
|
-
frontPadding:
|
|
81
|
-
behindPadding:
|
|
82
|
-
start:
|
|
83
|
-
end:
|
|
84
|
-
getStartByScroll:
|
|
85
|
-
setItemSize:
|
|
86
|
-
hasItemSize:
|
|
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:
|
|
89
|
-
} =
|
|
90
|
-
dataKeys:
|
|
91
|
-
contentRef:
|
|
92
|
-
fixedSize:
|
|
93
|
-
estimatedSize:
|
|
94
|
-
buffer:
|
|
95
|
-
}),
|
|
96
|
-
|
|
97
|
-
|
|
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
|
|
100
|
-
const { scrollTop:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
})), m("scroll",
|
|
104
|
-
},
|
|
105
|
-
if (
|
|
106
|
-
if (
|
|
107
|
-
|
|
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:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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:
|
|
120
|
-
containerRef:
|
|
121
|
-
wrapperComRef:
|
|
122
|
-
displayScrollbar:
|
|
123
|
-
scrollbarProps:
|
|
124
|
-
contentRef:
|
|
125
|
-
frontPadding:
|
|
126
|
-
currentList:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
166
|
+
ce as default
|
|
140
167
|
};
|