x-next 1.14.0 → 1.16.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.
- package/AI_USAGE/catalog.md +4 -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 +30 -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 +3 -3
- package/AI_USAGE/components/line-chart.md +28 -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 +1 -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 +1 -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 +44 -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/tree-select-api.md +498 -0
- package/AI_USAGE/components/tree-select.md +744 -0
- 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/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 +1326 -5
- package/CHANGELOG.md +32 -0
- package/dist/_props/css.d.ts +2 -1
- package/dist/components/_components/input-label/input-label.d.ts +3 -0
- package/dist/components/bar-chart/BarChart.d.ts +1 -1
- package/dist/components/bar-chart/index.d.ts +3 -3
- package/dist/components/index.d.ts +1 -0
- package/dist/components/line-chart/LineChart.d.ts +1 -1
- package/dist/components/line-chart/index.d.ts +3 -3
- package/dist/components/line-chart/interface.d.ts +2 -2
- package/dist/components/tree-select/TreeNode.vue.d.ts +478 -0
- package/dist/components/tree-select/TreeSelect.d.ts +1549 -0
- package/dist/components/tree-select/TreeSelectDropdown.vue.d.ts +569 -0
- package/dist/components/tree-select/hooks/use-tree-select.d.ts +92 -0
- package/dist/components/tree-select/index.d.ts +3321 -0
- package/dist/components/tree-select/interface.d.ts +203 -0
- package/dist/components/tree-select/utils.d.ts +64 -0
- package/dist/es/_styles/palette-aliases.js +3 -0
- package/dist/es/components/_components/feedback-icon/index.vue2.js +10 -10
- package/dist/es/components/_components/input-label/input-label.js +69 -65
- package/dist/es/components/_components/select-view/select-view.js +1 -0
- package/dist/es/components/button/Button.js +9 -9
- package/dist/es/components/drawer/src/Drawer.vue.js +26 -26
- package/dist/es/components/form-switch/Switch.vue2.js +18 -18
- package/dist/es/components/image/Image.vue2.js +13 -13
- package/dist/es/components/image/ImagePreview.vue2.js +33 -33
- package/dist/es/components/index.js +55 -52
- package/dist/es/components/link/Link.vue2.js +12 -12
- package/dist/es/components/message/message.vue2.js +13 -13
- package/dist/es/components/spin/Spin.js +28 -28
- package/dist/es/components/tag/Tag.vue2.js +22 -22
- package/dist/es/components/timeline/src/Timeline.js +7 -7
- package/dist/es/components/tree-select/TreeNode.vue.js +91 -0
- package/dist/es/components/tree-select/TreeNode.vue2.js +162 -0
- package/dist/es/components/tree-select/TreeSelect.js +865 -0
- package/dist/es/components/tree-select/TreeSelectDropdown.vue.js +57 -0
- package/dist/es/components/tree-select/TreeSelectDropdown.vue2.js +79 -0
- package/dist/es/components/tree-select/hooks/use-tree-select.js +376 -0
- package/dist/es/components/tree-select/index.js +13 -0
- package/dist/es/components/tree-select/utils.js +181 -0
- package/dist/es/icons/animation/animation-loading.js +2 -2
- package/dist/es/index.js +71 -68
- 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/dependencies.json +10 -0
- package/dist/style/drawer.css +1 -1
- package/dist/style/table.css +1 -1
- package/dist/style/tree-select.css +1 -0
- package/dist/style/tree-select.js +8 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +2 -1
- package/volar.d.ts +2 -0
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import $ from "./Drawer.vue2.js";
|
|
2
|
-
import { resolveComponent as
|
|
2
|
+
import { resolveComponent as p, openBlock as r, createBlock as g, Teleport as N, withDirectives as f, createElementVNode as a, mergeProps as d, createVNode as t, Transition as b, withCtx as n, createElementBlock as k, withModifiers as S, normalizeClass as s, vShow as u, createCommentVNode as i, renderSlot as m, toDisplayString as y, normalizeStyle as T, createTextVNode as w } from "vue";
|
|
3
3
|
import B from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
4
|
const V = ["data-theme"], c = ["aria-modal"], O = ["id"], A = ["aria-label"];
|
|
5
5
|
function K(e, o, M, j, z, E) {
|
|
6
|
-
const h =
|
|
7
|
-
return
|
|
6
|
+
const h = p("Scrollbar"), C = p("Button"), v = p("Space");
|
|
7
|
+
return !e.destroyOnClosed || e.mergeVisible ? (r(), g(N, {
|
|
8
|
+
key: 0,
|
|
8
9
|
to: e.teleportContainer,
|
|
9
10
|
disabled: e.disabled || !e.teleportContainer
|
|
10
11
|
}, [
|
|
11
|
-
|
|
12
|
-
key: 0,
|
|
12
|
+
f(a("div", d({
|
|
13
13
|
ref: "drawerRef",
|
|
14
14
|
class: [e.className.block, e.isFixed ? "is-fixed" : "is-absolute", e.popupClass, e.$attrs.class],
|
|
15
15
|
style: [e.drawerStyle, e.$attrs.style],
|
|
16
16
|
"data-theme": e.popupThemeName
|
|
17
17
|
}, e.rootAttrs()), [
|
|
18
|
-
t(
|
|
18
|
+
t(b, {
|
|
19
19
|
name: "x-fade-in-standard",
|
|
20
20
|
appear: ""
|
|
21
21
|
}, {
|
|
22
22
|
default: n(() => [
|
|
23
|
-
e.mask ?
|
|
23
|
+
e.mask ? f((r(), k("div", {
|
|
24
24
|
key: 0,
|
|
25
25
|
class: s(e.className.element("mask")),
|
|
26
26
|
onClick: o[0] || (o[0] = S((...l) => e.handleMask && e.handleMask(...l), ["self"]))
|
|
@@ -30,14 +30,14 @@ function K(e, o, M, j, z, E) {
|
|
|
30
30
|
]),
|
|
31
31
|
_: 1
|
|
32
32
|
}),
|
|
33
|
-
t(
|
|
33
|
+
t(b, {
|
|
34
34
|
name: `x-slide-${e.placement}`,
|
|
35
35
|
appear: "",
|
|
36
36
|
onAfterEnter: e.afterEnter,
|
|
37
37
|
onAfterLeave: e.afterLeave
|
|
38
38
|
}, {
|
|
39
39
|
default: n(() => [
|
|
40
|
-
|
|
40
|
+
f(a("div", d({
|
|
41
41
|
ref: "containerRef",
|
|
42
42
|
role: "dialog",
|
|
43
43
|
"aria-modal": e.mask ? !0 : void 0,
|
|
@@ -47,40 +47,40 @@ function K(e, o, M, j, z, E) {
|
|
|
47
47
|
class: [e.className.element("container"), `is-${e.placement}`],
|
|
48
48
|
style: e.containerStyle
|
|
49
49
|
}), [
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
m(e.$slots, "fill", {}, () => [
|
|
51
|
+
a("div", {
|
|
52
52
|
id: e.titleId,
|
|
53
53
|
class: s([e.className.element("header")])
|
|
54
54
|
}, [
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
m(e.$slots, "title", {}, () => [
|
|
56
|
+
a("span", {
|
|
57
57
|
class: s([e.className.element("title")])
|
|
58
58
|
}, y(e.title), 3)
|
|
59
59
|
])
|
|
60
60
|
], 10, O),
|
|
61
|
-
|
|
61
|
+
a("div", {
|
|
62
62
|
class: s([e.className.element("body"), e.bodyClass]),
|
|
63
63
|
style: T(e.mergedBodyStyle)
|
|
64
64
|
}, [
|
|
65
|
-
t(h, { style: { overflow: "auto" } }, {
|
|
65
|
+
t(h, { style: { height: "100%", overflow: "auto" } }, {
|
|
66
66
|
default: n(() => [
|
|
67
|
-
|
|
67
|
+
m(e.$slots, "default")
|
|
68
68
|
]),
|
|
69
69
|
_: 3
|
|
70
70
|
})
|
|
71
71
|
], 6),
|
|
72
|
-
e.showFooter ? (
|
|
72
|
+
e.showFooter ? (r(), k("div", {
|
|
73
73
|
key: 0,
|
|
74
74
|
class: s([e.className.element("footer")])
|
|
75
75
|
}, [
|
|
76
|
-
|
|
76
|
+
m(e.$slots, "footer", {
|
|
77
77
|
ok: e.handleOk,
|
|
78
78
|
cancel: e.handleCancel,
|
|
79
79
|
loadingObj: e.loadingObj
|
|
80
80
|
}, () => [
|
|
81
81
|
t(v, { size: 12 }, {
|
|
82
82
|
default: n(() => [
|
|
83
|
-
t(C,
|
|
83
|
+
t(C, d({
|
|
84
84
|
type: "primary",
|
|
85
85
|
size: "small",
|
|
86
86
|
loading: e.okLoading || e.loadingObj.ok
|
|
@@ -90,7 +90,7 @@ function K(e, o, M, j, z, E) {
|
|
|
90
90
|
]),
|
|
91
91
|
_: 1
|
|
92
92
|
}, 16, ["loading", "onClick"]),
|
|
93
|
-
e.hideCancel ? i("", !0) : (
|
|
93
|
+
e.hideCancel ? i("", !0) : (r(), g(C, d({
|
|
94
94
|
key: 0,
|
|
95
95
|
loading: e.loadingObj.cancel,
|
|
96
96
|
size: "small"
|
|
@@ -106,7 +106,7 @@ function K(e, o, M, j, z, E) {
|
|
|
106
106
|
])
|
|
107
107
|
], 2)) : i("", !0)
|
|
108
108
|
]),
|
|
109
|
-
e.showClose ? (
|
|
109
|
+
e.showClose ? (r(), k("span", {
|
|
110
110
|
key: 0,
|
|
111
111
|
class: s([e.className.element("close-icon")]),
|
|
112
112
|
role: "button",
|
|
@@ -115,7 +115,7 @@ function K(e, o, M, j, z, E) {
|
|
|
115
115
|
onClick: o[1] || (o[1] = (l) => e.interceptClose("cancel", l)),
|
|
116
116
|
onKeydown: o[2] || (o[2] = (...l) => e.handleCloseIconKeydown && e.handleCloseIconKeydown(...l))
|
|
117
117
|
}, [...o[4] || (o[4] = [
|
|
118
|
-
|
|
118
|
+
a("svg", {
|
|
119
119
|
viewBox: "0 0 48 48",
|
|
120
120
|
fill: "none",
|
|
121
121
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -125,7 +125,7 @@ function K(e, o, M, j, z, E) {
|
|
|
125
125
|
"stroke-linecap": "butt",
|
|
126
126
|
"stroke-linejoin": "miter"
|
|
127
127
|
}, [
|
|
128
|
-
|
|
128
|
+
a("path", { d: "M9.857 9.858 24 24m0 0 14.142 14.142M24 24 38.142 9.858M24 24 9.857 38.142" })
|
|
129
129
|
], -1)
|
|
130
130
|
])], 42, A)) : i("", !0)
|
|
131
131
|
], 16, c), [
|
|
@@ -134,10 +134,10 @@ function K(e, o, M, j, z, E) {
|
|
|
134
134
|
]),
|
|
135
135
|
_: 3
|
|
136
136
|
}, 8, ["name", "onAfterEnter", "onAfterLeave"])
|
|
137
|
-
], 16, V)
|
|
137
|
+
], 16, V), [
|
|
138
138
|
[u, e.mergeVisible]
|
|
139
|
-
])
|
|
140
|
-
], 8, ["to", "disabled"]);
|
|
139
|
+
])
|
|
140
|
+
], 8, ["to", "disabled"])) : i("", !0);
|
|
141
141
|
}
|
|
142
142
|
const P = /* @__PURE__ */ B($, [["render", K]]);
|
|
143
143
|
export {
|
|
@@ -176,24 +176,24 @@ const ne = $({
|
|
|
176
176
|
* @en The icon on the button when closed
|
|
177
177
|
* @slot unchecked-icon
|
|
178
178
|
*/
|
|
179
|
-
setup(e, { emit: n, expose: b, slots:
|
|
179
|
+
setup(e, { emit: n, expose: b, slots: y, attrs: S }) {
|
|
180
180
|
const { disabled: w, size: x, modelValue: B } = q(e), c = Y("switch"), {
|
|
181
181
|
formItemCtx: z,
|
|
182
182
|
mergedDisabled: o,
|
|
183
|
-
mergedSize:
|
|
183
|
+
mergedSize: F,
|
|
184
184
|
eventHandlers: s
|
|
185
185
|
} = J({
|
|
186
186
|
disabled: w,
|
|
187
187
|
size: x
|
|
188
|
-
}),
|
|
188
|
+
}), N = O(z, () => S, { required: !1 }), { mergedSize: g } = P(F), d = k(e.defaultChecked ? e.checkedValue : e.uncheckedValue), a = r(
|
|
189
189
|
() => (e.modelValue ?? d.value) === e.checkedValue
|
|
190
190
|
), m = k(!1);
|
|
191
191
|
let v = !1;
|
|
192
192
|
H(() => {
|
|
193
193
|
v = !0;
|
|
194
194
|
});
|
|
195
|
-
const f = r(() => m.value || e.loading), h = k(),
|
|
196
|
-
() => e.type !== "line" &&
|
|
195
|
+
const f = r(() => m.value || e.loading), h = k(), R = r(
|
|
196
|
+
() => e.type !== "line" && g.value !== "mini" && (!!e.checkedText || !!e.uncheckedText || !!y.checked || !!y.unchecked)
|
|
197
197
|
), C = (t, l) => {
|
|
198
198
|
var u, i;
|
|
199
199
|
d.value = t ? e.checkedValue : e.uncheckedValue, n("update:modelValue", d.value), n("change", d.value, l), (i = (u = s.value) == null ? void 0 : u.onChange) == null || i.call(u, l);
|
|
@@ -211,29 +211,29 @@ const ne = $({
|
|
|
211
211
|
}
|
|
212
212
|
} else
|
|
213
213
|
C(t, l);
|
|
214
|
-
},
|
|
214
|
+
}, T = async (t) => {
|
|
215
215
|
const l = a.value ? e.uncheckedValue : e.checkedValue;
|
|
216
216
|
n("click", l, t), await V(!a.value, t);
|
|
217
|
-
},
|
|
217
|
+
}, A = async (t) => {
|
|
218
218
|
if (t.key !== "ArrowLeft" && t.key !== "Left" && t.key !== "ArrowRight" && t.key !== "Right")
|
|
219
219
|
return;
|
|
220
220
|
t.preventDefault();
|
|
221
221
|
const l = t.key === "ArrowRight" || t.key === "Right";
|
|
222
222
|
l !== a.value && await V(l, t);
|
|
223
|
-
},
|
|
223
|
+
}, _ = (t) => {
|
|
224
224
|
var l, u;
|
|
225
225
|
n("focus", t), (u = (l = s.value) == null ? void 0 : l.onFocus) == null || u.call(l, t);
|
|
226
|
-
},
|
|
226
|
+
}, I = (t) => {
|
|
227
227
|
var l, u;
|
|
228
228
|
n("blur", t), (u = (l = s.value) == null ? void 0 : l.onBlur) == null || u.call(l, t);
|
|
229
229
|
};
|
|
230
230
|
K(B, (t) => {
|
|
231
231
|
(Q(t) || W(t)) && (d.value = e.uncheckedValue);
|
|
232
232
|
});
|
|
233
|
-
const
|
|
233
|
+
const L = r(() => [
|
|
234
234
|
c.block,
|
|
235
235
|
c.modifier(`type-${e.type}`),
|
|
236
|
-
c.modifier(`size-${
|
|
236
|
+
c.modifier(`size-${g.value}`),
|
|
237
237
|
{
|
|
238
238
|
[c.modifier("checked")]: a.value,
|
|
239
239
|
[c.modifier("disabled")]: o.value,
|
|
@@ -261,19 +261,19 @@ const ne = $({
|
|
|
261
261
|
focus: M,
|
|
262
262
|
blur: U
|
|
263
263
|
}), {
|
|
264
|
-
formControlAttrs:
|
|
264
|
+
formControlAttrs: N,
|
|
265
265
|
className: c,
|
|
266
|
-
cls:
|
|
266
|
+
cls: L,
|
|
267
267
|
switchRef: h,
|
|
268
268
|
mergedDisabled: o,
|
|
269
269
|
buttonStyle: D,
|
|
270
270
|
computedCheck: a,
|
|
271
271
|
computedLoading: f,
|
|
272
|
-
showText:
|
|
273
|
-
handleClick:
|
|
274
|
-
handleKeydown:
|
|
275
|
-
handleFocus:
|
|
276
|
-
handleBlur:
|
|
272
|
+
showText: R,
|
|
273
|
+
handleClick: T,
|
|
274
|
+
handleKeydown: A,
|
|
275
|
+
handleFocus: _,
|
|
276
|
+
handleBlur: I
|
|
277
277
|
};
|
|
278
278
|
}
|
|
279
279
|
});
|
|
@@ -12,7 +12,7 @@ import { isBoolean as ne } from "../../_utils/is.js";
|
|
|
12
12
|
import { getClassNameMixin as ue } from "../../_utils/config.js";
|
|
13
13
|
import { useLocale as se } from "../../locale/index.js";
|
|
14
14
|
let ve = 0;
|
|
15
|
-
const
|
|
15
|
+
const Be = q({
|
|
16
16
|
name: "Image",
|
|
17
17
|
components: {
|
|
18
18
|
IconImageClose: $,
|
|
@@ -184,13 +184,13 @@ const Le = q({
|
|
|
184
184
|
previewVisible: N,
|
|
185
185
|
preview: h,
|
|
186
186
|
previewProps: b
|
|
187
|
-
} = H(o), t = J(le, void 0), { t: z } = se(), l = ue("image"), v = Q(), { isLoaded: S, isError: P, isLoading:
|
|
187
|
+
} = H(o), t = J(le, void 0), { t: z } = se(), l = ue("image"), v = Q(), { isLoaded: S, isError: P, isLoading: B, setLoadStatus: f } = ie(), m = i(() => ({
|
|
188
188
|
width: F(d == null ? void 0 : d.value),
|
|
189
189
|
height: F(p == null ? void 0 : p.value)
|
|
190
|
-
})),
|
|
190
|
+
})), E = i(() => o.fit ? { objectFit: o.fit } : {}), O = i(() => [
|
|
191
191
|
l.block,
|
|
192
192
|
{
|
|
193
|
-
[l.element("loading")]:
|
|
193
|
+
[l.element("loading")]: B.value,
|
|
194
194
|
[l.element("loading-error")]: P.value,
|
|
195
195
|
// isLoaded / showFooter 是 ref,这里必须解引用;
|
|
196
196
|
// 直接写对象引用会让条件恒为真,没有 footer 的图片也带上定位类
|
|
@@ -198,7 +198,7 @@ const Le = q({
|
|
|
198
198
|
[l.element("with-footer-outer")]: u.value && s.value === "outer"
|
|
199
199
|
},
|
|
200
200
|
c.class
|
|
201
|
-
]),
|
|
201
|
+
]), A = i(() => [
|
|
202
202
|
{
|
|
203
203
|
...m.value,
|
|
204
204
|
height: u.value && s.value === "outer" ? void 0 : m.value.height
|
|
@@ -206,7 +206,7 @@ const Le = q({
|
|
|
206
206
|
c.style
|
|
207
207
|
]), K = i(() => ({
|
|
208
208
|
height: u.value && s.value === "outer" ? m.value.height : void 0
|
|
209
|
-
})), u = i(() => w != null && w.value || y != null && y.value || j.extra ? ne(g.value) ? !g.value && S.value : g.value === "never" : !1), M = i(() => oe(c, ["class", "style", "src"])), [T,
|
|
209
|
+
})), u = i(() => w != null && w.value || y != null && y.value || j.extra ? ne(g.value) ? !g.value && S.value : g.value === "never" : !1), M = i(() => oe(c, ["class", "style", "src"])), [T, L] = ae(
|
|
210
210
|
k.value,
|
|
211
211
|
X({
|
|
212
212
|
value: N
|
|
@@ -243,27 +243,27 @@ const Le = q({
|
|
|
243
243
|
e.target === v.value && (f("error"), a("error", e));
|
|
244
244
|
}
|
|
245
245
|
function _() {
|
|
246
|
-
I.value && (t != null && t.preview ? t.preview(V) : (a("preview-visible-change", !0), a("update:previewVisible", !0),
|
|
246
|
+
I.value && (t != null && t.preview ? t.preview(V) : (a("preview-visible-change", !0), a("update:previewVisible", !0), L(!0)));
|
|
247
247
|
}
|
|
248
248
|
function G(e) {
|
|
249
249
|
!I.value || e.key !== "Enter" && e.key !== " " || (e.preventDefault(), _());
|
|
250
250
|
}
|
|
251
251
|
function R() {
|
|
252
|
-
a("preview-visible-change", !1), a("update:previewVisible", !1),
|
|
252
|
+
a("preview-visible-change", !1), a("update:previewVisible", !1), L(!1);
|
|
253
253
|
}
|
|
254
254
|
return {
|
|
255
255
|
t: z,
|
|
256
256
|
refImg: v,
|
|
257
257
|
className: l,
|
|
258
|
-
wrapperClassNames:
|
|
259
|
-
wrapperStyles:
|
|
258
|
+
wrapperClassNames: O,
|
|
259
|
+
wrapperStyles: A,
|
|
260
260
|
overlayStyles: K,
|
|
261
261
|
showFooter: u,
|
|
262
262
|
imgProps: M,
|
|
263
263
|
imgStyle: m,
|
|
264
264
|
isLoaded: S,
|
|
265
265
|
isError: P,
|
|
266
|
-
isLoading:
|
|
266
|
+
isLoading: B,
|
|
267
267
|
mergedPreviewVisible: T,
|
|
268
268
|
mergePreview: U,
|
|
269
269
|
canOpenPreview: I,
|
|
@@ -272,10 +272,10 @@ const Le = q({
|
|
|
272
272
|
onImgClick: _,
|
|
273
273
|
onImgKeydown: G,
|
|
274
274
|
onPreviewClose: R,
|
|
275
|
-
fitStyle:
|
|
275
|
+
fitStyle: E
|
|
276
276
|
};
|
|
277
277
|
}
|
|
278
278
|
});
|
|
279
279
|
export {
|
|
280
|
-
|
|
280
|
+
Be as default
|
|
281
281
|
};
|
|
@@ -4,8 +4,8 @@ import { useLocale as Re } from "../../locale/index.js";
|
|
|
4
4
|
import { getClassNameMixin as Te } from "../../_utils/config.js";
|
|
5
5
|
import { throttleByRaf as Oe } from "../../_utils/throttle-by-raf.js";
|
|
6
6
|
import { KEYBOARD_KEY as c } from "../../_utils/keyboard.js";
|
|
7
|
-
import { isServerRendering as m, on as ze, off as
|
|
8
|
-
import
|
|
7
|
+
import { isServerRendering as m, on as ze, off as Pe } from "../../_utils/dom.js";
|
|
8
|
+
import Ae from "./preview-arrow.vue.js";
|
|
9
9
|
import Ee from "./preview-toolbar.vue.js";
|
|
10
10
|
import Ne from "./hooks/use-image-load-status.js";
|
|
11
11
|
import Be from "./hooks/use-image-drag.js";
|
|
@@ -26,7 +26,7 @@ const _ = 90, bt = /* @__PURE__ */ Se({
|
|
|
26
26
|
name: "ImagePreview",
|
|
27
27
|
inheritAttrs: !1,
|
|
28
28
|
components: {
|
|
29
|
-
PreviewArrow:
|
|
29
|
+
PreviewArrow: Ae,
|
|
30
30
|
PreviewToolbar: Ee,
|
|
31
31
|
IconLoading: Le,
|
|
32
32
|
IconClose: xe,
|
|
@@ -170,7 +170,7 @@ const _ = 90, bt = /* @__PURE__ */ Se({
|
|
|
170
170
|
actionsLayout: ee,
|
|
171
171
|
defaultScale: F,
|
|
172
172
|
zoomRate: O
|
|
173
|
-
} = he(r),
|
|
173
|
+
} = he(r), n = g(), f = g(), K = g(!1);
|
|
174
174
|
we(() => {
|
|
175
175
|
K.value = !0;
|
|
176
176
|
});
|
|
@@ -180,15 +180,15 @@ const _ = 90, bt = /* @__PURE__ */ Se({
|
|
|
180
180
|
[z.modifier("hide")]: !i.value
|
|
181
181
|
}]), ae = m ? void 0 : document.body, S = je(ae, D({
|
|
182
182
|
popupContainer: q
|
|
183
|
-
})), ie = y(() => !m && S.value === document.body),
|
|
184
|
-
zIndex:
|
|
183
|
+
})), ie = y(() => !m && S.value === document.body), le = y(() => m || !r.renderToBody || !S.value), {
|
|
184
|
+
zIndex: ne,
|
|
185
185
|
isLastDialog: C,
|
|
186
186
|
close: re
|
|
187
187
|
} = Ye("dialog", {
|
|
188
188
|
visible: i
|
|
189
189
|
}), se = y(() => ({
|
|
190
190
|
...ie.value ? {
|
|
191
|
-
zIndex:
|
|
191
|
+
zIndex: ne.value,
|
|
192
192
|
position: "fixed"
|
|
193
193
|
} : {
|
|
194
194
|
zIndex: "inherit",
|
|
@@ -198,16 +198,16 @@ const _ = 90, bt = /* @__PURE__ */ Se({
|
|
|
198
198
|
isLoading: ue,
|
|
199
199
|
isLoaded: d,
|
|
200
200
|
isError: ce,
|
|
201
|
-
setLoadStatus:
|
|
202
|
-
} = Ne(), v = g(0),
|
|
201
|
+
setLoadStatus: P
|
|
202
|
+
} = Ne(), v = g(0), A = (e) => Number.isFinite(e) ? Math.max(G, Math.min(Y, e)) : 1, l = g(A(F.value)), {
|
|
203
203
|
translate: I,
|
|
204
204
|
moving: me,
|
|
205
205
|
resetTranslate: fe
|
|
206
206
|
} = Be(D({
|
|
207
|
-
wrapperEl:
|
|
207
|
+
wrapperEl: n,
|
|
208
208
|
imageEl: f,
|
|
209
209
|
visible: i,
|
|
210
|
-
scale:
|
|
210
|
+
scale: l
|
|
211
211
|
})), h = g(!1);
|
|
212
212
|
let p;
|
|
213
213
|
const E = () => {
|
|
@@ -226,7 +226,7 @@ const _ = 90, bt = /* @__PURE__ */ Se({
|
|
|
226
226
|
immediate: !0
|
|
227
227
|
});
|
|
228
228
|
function pe() {
|
|
229
|
-
v.value = 0,
|
|
229
|
+
v.value = 0, l.value = A(F.value), fe(), E();
|
|
230
230
|
}
|
|
231
231
|
const N = (e) => ee.value.includes(e), W = (e) => {
|
|
232
232
|
if (!i.value || !r.keyboard || !C()) return;
|
|
@@ -256,7 +256,7 @@ const _ = 90, bt = /* @__PURE__ */ Se({
|
|
|
256
256
|
o && (e.stopPropagation(), e.preventDefault());
|
|
257
257
|
}, B = Oe((e) => {
|
|
258
258
|
if (e.preventDefault(), e.stopPropagation(), !r.wheelZoom || !d.value || !i.value || !C()) return;
|
|
259
|
-
const a = (e.deltaY || e.deltaX) > 0 ? "zoomOut" : "zoomIn", o = Number.isFinite(O.value) && O.value > 1 ? O.value : 1.1, s = He(
|
|
259
|
+
const a = (e.deltaY || e.deltaX) > 0 ? "zoomOut" : "zoomIn", o = Number.isFinite(O.value) && O.value > 1 ? O.value : 1.1, s = He(l.value, o, a);
|
|
260
260
|
w(s);
|
|
261
261
|
});
|
|
262
262
|
let L = null;
|
|
@@ -270,33 +270,33 @@ const _ = 90, bt = /* @__PURE__ */ Se({
|
|
|
270
270
|
e ? m || (L = document.activeElement) : (m || B.cancel(), E(), ke(j));
|
|
271
271
|
}, {
|
|
272
272
|
immediate: !0
|
|
273
|
-
}), k(
|
|
273
|
+
}), k(n, (e) => {
|
|
274
274
|
e && C() && e.focus({
|
|
275
275
|
preventScroll: !0
|
|
276
276
|
});
|
|
277
277
|
}, {
|
|
278
278
|
flush: "post"
|
|
279
279
|
}), k([i, () => r.keyboard, S], ([e, t, a], o, s) => {
|
|
280
|
-
!e || !t || !a || m || (ze(a, "keydown", W), s(() =>
|
|
280
|
+
!e || !t || !a || m || (ze(a, "keydown", W), s(() => Pe(a, "keydown", W)));
|
|
281
281
|
}, {
|
|
282
282
|
immediate: !0
|
|
283
283
|
});
|
|
284
284
|
const ge = (e) => {
|
|
285
285
|
var H;
|
|
286
|
-
if (e.key !== "Tab" || !C() || !
|
|
287
|
-
const t = Array.from(
|
|
286
|
+
if (e.key !== "Tab" || !C() || !n.value) return;
|
|
287
|
+
const t = Array.from(n.value.querySelectorAll("button:not([disabled]), a[href], input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]")).filter((T) => T.tabIndex >= 0 && !T.closest('[hidden], [inert], [aria-hidden="true"]') && getComputedStyle(T).display !== "none" && getComputedStyle(T).visibility !== "hidden"), a = t[0], o = t.at(-1), s = document.activeElement;
|
|
288
288
|
a ? t.includes(s) ? e.shiftKey && s === a ? (e.preventDefault(), o == null || o.focus({
|
|
289
289
|
preventScroll: !0
|
|
290
290
|
})) : !e.shiftKey && s === o && (e.preventDefault(), a.focus({
|
|
291
291
|
preventScroll: !0
|
|
292
292
|
})) : (e.preventDefault(), (H = e.shiftKey ? o : a) == null || H.focus({
|
|
293
293
|
preventScroll: !0
|
|
294
|
-
})) : (e.preventDefault(),
|
|
294
|
+
})) : (e.preventDefault(), n.value.focus({
|
|
295
295
|
preventScroll: !0
|
|
296
296
|
}));
|
|
297
297
|
};
|
|
298
298
|
k([V, i], () => {
|
|
299
|
-
i.value && (pe(),
|
|
299
|
+
i.value && (pe(), P(V.value ? "loading" : "error"));
|
|
300
300
|
}, {
|
|
301
301
|
immediate: !0
|
|
302
302
|
});
|
|
@@ -305,17 +305,17 @@ const _ = 90, bt = /* @__PURE__ */ Se({
|
|
|
305
305
|
}
|
|
306
306
|
function ye(e) {
|
|
307
307
|
var t;
|
|
308
|
-
(t =
|
|
308
|
+
(t = n == null ? void 0 : n.value) == null || t.focus(), $.value && e.target === e.currentTarget && x();
|
|
309
309
|
}
|
|
310
310
|
function w(e) {
|
|
311
|
-
if (e =
|
|
312
|
-
const t =
|
|
313
|
-
I.value = [I.value[0] * t / e, I.value[1] * t / e],
|
|
311
|
+
if (e = A(e), l.value !== e) {
|
|
312
|
+
const t = l.value;
|
|
313
|
+
I.value = [I.value[0] * t / e, I.value[1] * t / e], l.value = e, de();
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
function be() {
|
|
317
|
-
if (!
|
|
318
|
-
const e =
|
|
317
|
+
if (!n.value || !f.value || !d.value) return;
|
|
318
|
+
const e = n.value.getBoundingClientRect(), t = f.value.getBoundingClientRect(), a = e.height / (t.height / l.value), o = e.width / (t.width / l.value);
|
|
319
319
|
if (t.width <= 0 || t.height <= 0) return;
|
|
320
320
|
const s = Math.min(a, o);
|
|
321
321
|
w(s);
|
|
@@ -325,7 +325,7 @@ const _ = 90, bt = /* @__PURE__ */ Se({
|
|
|
325
325
|
v.value = a;
|
|
326
326
|
}
|
|
327
327
|
function R(e) {
|
|
328
|
-
const t = Ze(
|
|
328
|
+
const t = Ze(l.value, e);
|
|
329
329
|
w(t);
|
|
330
330
|
}
|
|
331
331
|
return Ce(() => {
|
|
@@ -336,9 +336,9 @@ const _ = 90, bt = /* @__PURE__ */ Se({
|
|
|
336
336
|
className: z,
|
|
337
337
|
classNames: oe,
|
|
338
338
|
container: S,
|
|
339
|
-
teleportDisabled:
|
|
339
|
+
teleportDisabled: le,
|
|
340
340
|
wrapperStyles: se,
|
|
341
|
-
scale:
|
|
341
|
+
scale: l,
|
|
342
342
|
translate: I,
|
|
343
343
|
rotate: v,
|
|
344
344
|
moving: me,
|
|
@@ -347,7 +347,7 @@ const _ = 90, bt = /* @__PURE__ */ Se({
|
|
|
347
347
|
isLoaded: d,
|
|
348
348
|
isError: ce,
|
|
349
349
|
scaleValueVisible: h,
|
|
350
|
-
refWrapper:
|
|
350
|
+
refWrapper: n,
|
|
351
351
|
refImage: f,
|
|
352
352
|
mounted: K,
|
|
353
353
|
onWheel: B,
|
|
@@ -355,10 +355,10 @@ const _ = 90, bt = /* @__PURE__ */ Se({
|
|
|
355
355
|
onCloseClick: x,
|
|
356
356
|
onDialogKeydown: ge,
|
|
357
357
|
onImgLoad(e) {
|
|
358
|
-
e.target === f.value &&
|
|
358
|
+
e.target === f.value && P("loaded");
|
|
359
359
|
},
|
|
360
360
|
onImgError(e) {
|
|
361
|
-
e.target === f.value &&
|
|
361
|
+
e.target === f.value && P("error");
|
|
362
362
|
},
|
|
363
363
|
actions: y(() => [
|
|
364
364
|
/** 满屏 */
|
|
@@ -388,7 +388,7 @@ const _ = 90, bt = /* @__PURE__ */ Se({
|
|
|
388
388
|
name: u("imagePreview.zoomIn"),
|
|
389
389
|
content: () => b(Me),
|
|
390
390
|
onClick: () => R("zoomIn"),
|
|
391
|
-
disabled:
|
|
391
|
+
disabled: l.value === Y
|
|
392
392
|
},
|
|
393
393
|
/** 缩小 */
|
|
394
394
|
{
|
|
@@ -396,7 +396,7 @@ const _ = 90, bt = /* @__PURE__ */ Se({
|
|
|
396
396
|
name: u("imagePreview.zoomOut"),
|
|
397
397
|
content: () => b(_e),
|
|
398
398
|
onClick: () => R("zoomOut"),
|
|
399
|
-
disabled:
|
|
399
|
+
disabled: l.value === G
|
|
400
400
|
},
|
|
401
401
|
/** 缩放到100% */
|
|
402
402
|
{
|