x-next 1.1.0 → 1.2.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/CHANGELOG.md +26 -0
- package/dist/_hooks/use-form-item.d.ts +5 -0
- package/dist/_hooks/use-picker-focus.d.ts +17 -0
- package/dist/components/_components/feedback-icon/index.vue.d.ts +4 -4
- package/dist/components/_components/picker/input-range.vue.d.ts +10 -6
- package/dist/components/_components/picker/input.vue.d.ts +9 -5
- package/dist/components/alert/Alert.vue.d.ts +5 -5
- package/dist/components/alert/index.d.ts +10 -10
- package/dist/components/date-picker/DatePanel.vue.d.ts +5 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +36 -16
- package/dist/components/date-picker/index.d.ts +77 -33
- package/dist/components/dialog/Dialog.d.ts +1 -1
- package/dist/components/dialog/index.d.ts +3 -3
- package/dist/components/drawer/index.d.ts +3 -3
- package/dist/components/drawer/src/Drawer.vue.d.ts +1 -1
- package/dist/components/dropdown/Dropdown.vue.d.ts +3 -3
- package/dist/components/dropdown/DropdownButton.vue.d.ts +4 -4
- package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +4 -4
- package/dist/components/dropdown/index.d.ts +22 -22
- package/dist/components/form/FormItem.vue.d.ts +12 -4
- package/dist/components/form/context.d.ts +6 -0
- package/dist/components/form/form-item-label.vue.d.ts +4 -4
- package/dist/components/form/form-item-message.vue.d.ts +2 -0
- package/dist/components/form/index.d.ts +30 -8
- package/dist/components/form/interface.d.ts +2 -2
- package/dist/components/form-input/InputPassword.vue.d.ts +20 -2
- package/dist/components/form-input/index.d.ts +22 -4
- package/dist/components/form-select/Select.d.ts +3 -3
- package/dist/components/form-select/index.d.ts +6 -6
- package/dist/components/form-slider/Slider.vue.d.ts +10 -3
- package/dist/components/form-slider/index.d.ts +26 -6
- package/dist/components/form-slider/slider-button.vue.d.ts +4 -3
- package/dist/components/form-switch/Switch.vue.d.ts +2 -1
- package/dist/components/form-switch/index.d.ts +5 -2
- package/dist/components/form-textarea/Textarea.vue.d.ts +2 -2
- package/dist/components/form-textarea/index.d.ts +5 -5
- package/dist/components/image/Image.vue.d.ts +10 -9
- package/dist/components/image/ImagePreview.vue.d.ts +8 -7
- package/dist/components/image/ImagePreviewAction.d.ts +3 -3
- package/dist/components/image/ImagePreviewGroup.vue.d.ts +8 -7
- package/dist/components/image/index.d.ts +59 -52
- package/dist/components/image/preview-arrow.vue.d.ts +2 -2
- package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
- package/dist/components/layout/LayoutSidebar.vue.d.ts +2 -2
- package/dist/components/layout/index.d.ts +4 -4
- package/dist/components/link/Link.vue.d.ts +2 -2
- package/dist/components/link/index.d.ts +4 -4
- package/dist/components/menu/Menu.d.ts +2 -2
- package/dist/components/menu/base-menu.vue.d.ts +2 -2
- package/dist/components/menu/index.d.ts +4 -4
- package/dist/components/menu/sub-menu-pop.vue.d.ts +5 -5
- package/dist/components/message/index.d.ts +17 -17
- package/dist/components/message/message.vue.d.ts +8 -8
- package/dist/components/notification/Notification.d.ts +1 -1
- package/dist/components/notification/index.d.ts +3 -3
- package/dist/components/pagination/page-item-ellipsis.vue.d.ts +1 -1
- package/dist/components/pagination/page-item-step.vue.d.ts +2 -2
- package/dist/components/pagination/page-options.vue.d.ts +6 -6
- package/dist/components/popconfirm/src/popup.vue.d.ts +1 -1
- package/dist/components/popover/Popover.d.ts +1 -1
- package/dist/components/popover/index.d.ts +3 -3
- package/dist/components/popup/Popup.d.ts +1 -1
- package/dist/components/popup/index.d.ts +3 -3
- package/dist/components/progress/Progress.vue.d.ts +4 -4
- package/dist/components/progress/circle.vue.d.ts +2 -2
- package/dist/components/progress/index.d.ts +8 -8
- package/dist/components/progress/line.vue.d.ts +1 -1
- package/dist/components/progress/steps.vue.d.ts +1 -1
- package/dist/components/steps/Step.vue.d.ts +2 -2
- package/dist/components/steps/index.d.ts +4 -4
- package/dist/components/tabs/Tabs.d.ts +1 -1
- package/dist/components/tabs/index.d.ts +3 -3
- package/dist/components/tabs/tabs-tab.vue.d.ts +1 -1
- package/dist/components/tag/Tag.vue.d.ts +2 -2
- package/dist/components/tag/index.d.ts +4 -4
- package/dist/components/time-picker/TimeColumn.vue.d.ts +3 -0
- package/dist/components/time-picker/TimePanel.vue.d.ts +3 -0
- package/dist/components/time-picker/TimePicker.vue.d.ts +33 -17
- package/dist/components/time-picker/index.d.ts +73 -36
- package/dist/components/time-range-selector/TimeRangeSelector.vue.d.ts +8 -0
- package/dist/components/time-range-selector/index.d.ts +22 -0
- package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
- package/dist/components/tooltip/index.d.ts +3 -3
- package/dist/components/trigger/Trigger.d.ts +1 -1
- package/dist/components/trigger/index.d.ts +3 -3
- package/dist/es/_hooks/use-form-item.js +36 -10
- package/dist/es/_hooks/use-picker-focus.js +57 -0
- package/dist/es/_utils/constant.js +17 -5
- package/dist/es/components/_components/picker/input-range.vue.js +45 -55
- package/dist/es/components/_components/picker/input-range.vue2.js +105 -70
- package/dist/es/components/_components/picker/input.vue.js +22 -25
- package/dist/es/components/_components/picker/input.vue2.js +58 -43
- package/dist/es/components/_components/select-view/select-view.js +67 -66
- package/dist/es/components/date-picker/DatePanel.vue.js +102 -94
- package/dist/es/components/date-picker/DatePanel.vue2.js +97 -44
- package/dist/es/components/date-picker/DatePicker.vue.js +71 -58
- package/dist/es/components/date-picker/DatePicker.vue2.js +285 -231
- package/dist/es/components/dialog/Dialog.js +154 -132
- package/dist/es/components/form/Form.vue2.js +113 -101
- package/dist/es/components/form/FormItem.vue.js +26 -22
- package/dist/es/components/form/FormItem.vue2.js +162 -125
- package/dist/es/components/form/form-item-message.vue.js +31 -24
- package/dist/es/components/form/form-item-message.vue2.js +4 -2
- package/dist/es/components/form-checkbox/Checkbox.js +75 -71
- package/dist/es/components/form-checkbox/CheckboxGroup.js +43 -38
- package/dist/es/components/form-input/Input.js +83 -79
- package/dist/es/components/form-input/InputPassword.vue.js +19 -16
- package/dist/es/components/form-input/InputPassword.vue2.js +39 -29
- package/dist/es/components/form-input/InputSearch.js +47 -37
- package/dist/es/components/form-input-number/InputNumber.js +134 -133
- package/dist/es/components/form-input-tag/InputTag.js +173 -162
- package/dist/es/components/form-radio/Radio.js +74 -71
- package/dist/es/components/form-radio/RadioGroup.js +55 -49
- package/dist/es/components/form-select/Select.js +99 -98
- package/dist/es/components/form-slider/Slider.vue.js +28 -28
- package/dist/es/components/form-slider/Slider.vue2.js +139 -132
- package/dist/es/components/form-slider/slider-button.vue.js +6 -6
- package/dist/es/components/form-slider/slider-button.vue2.js +39 -34
- package/dist/es/components/form-switch/Switch.vue.js +9 -9
- package/dist/es/components/form-switch/Switch.vue2.js +81 -74
- package/dist/es/components/form-textarea/Textarea.vue2.js +123 -108
- package/dist/es/components/image/Image.vue2.js +77 -76
- package/dist/es/components/image/ImagePreview.vue.js +13 -12
- package/dist/es/components/image/ImagePreview.vue2.js +141 -136
- package/dist/es/components/image/ImagePreviewGroup.vue.js +1 -1
- package/dist/es/components/image/ImagePreviewGroup.vue2.js +82 -83
- package/dist/es/components/rate/Rate.js +106 -103
- package/dist/es/components/time-picker/TimeColumn.vue.js +34 -23
- package/dist/es/components/time-picker/TimeColumn.vue2.js +37 -28
- package/dist/es/components/time-picker/TimePicker.vue.js +83 -64
- package/dist/es/components/time-picker/TimePicker.vue2.js +192 -156
- package/dist/es/components/time-range-selector/TimeRangeSelector.vue.js +327 -193
- package/dist/es/locale/en-US.js +6 -0
- package/dist/es/locale/zh-CN.js +6 -0
- package/dist/es/style.css +1 -1
- package/dist/icons/_self/down.d.ts +1 -1
- package/dist/icons/_self/dropdown/more.d.ts +1 -1
- package/dist/icons/_self/empty-better.d.ts +1 -1
- package/dist/icons/_self/empty.d.ts +1 -1
- package/dist/icons/_self/eye-invisible.d.ts +1 -1
- package/dist/icons/_self/eye.d.ts +1 -1
- package/dist/icons/_self/full-screen.d.ts +1 -1
- package/dist/icons/_self/left.d.ts +1 -1
- package/dist/icons/_self/menu/down.d.ts +1 -1
- package/dist/icons/_self/minus.d.ts +1 -1
- package/dist/icons/_self/more-dot.d.ts +1 -1
- package/dist/icons/_self/next.d.ts +1 -1
- package/dist/icons/_self/original-size.d.ts +1 -1
- package/dist/icons/_self/plus.d.ts +1 -1
- package/dist/icons/_self/prev.d.ts +1 -1
- package/dist/icons/_self/question-message.d.ts +1 -1
- package/dist/icons/_self/right.d.ts +1 -1
- package/dist/icons/_self/rotate-left.d.ts +1 -1
- package/dist/icons/_self/rotate-right.d.ts +1 -1
- package/dist/icons/_self/search.d.ts +1 -1
- package/dist/icons/_self/up.d.ts +1 -1
- package/dist/icons/_self/zoom-in.d.ts +1 -1
- package/dist/icons/_self/zoom-out.d.ts +1 -1
- package/dist/icons/_ui/alone-left.d.ts +1 -1
- package/dist/icons/_ui/alone-margin-left.d.ts +1 -1
- package/dist/icons/_ui/alone-margin-right.d.ts +1 -1
- package/dist/icons/_ui/alone-right.d.ts +1 -1
- package/dist/icons/_ui/calendar.d.ts +1 -1
- package/dist/icons/_ui/time.d.ts +1 -1
- package/dist/icons/animation/animation-loading.d.ts +1 -1
- package/dist/icons/default/check-circle-fill.d.ts +1 -1
- package/dist/icons/default/check.d.ts +1 -1
- package/dist/icons/default/close-circle-fill.d.ts +1 -1
- package/dist/icons/default/close.d.ts +1 -1
- package/dist/icons/default/exclamation-circle-fill.d.ts +1 -1
- package/dist/icons/default/exclamation.d.ts +1 -1
- package/dist/icons/default/filter.d.ts +1 -1
- package/dist/icons/default/info-circle-fill.d.ts +1 -1
- package/dist/icons/default/link.d.ts +1 -1
- package/dist/icons/default/logo-simple.d.ts +1 -1
- package/dist/icons/default/minus-circle-fill.d.ts +1 -1
- package/dist/icons/icon.d.ts +2 -2
- package/dist/icons/index.d.ts +3 -3
- package/dist/index.cjs +4 -4
- package/dist/index.umd.js +4 -4
- package/dist/locale/interface.d.ts +6 -0
- package/dist/style/base.css +1 -1
- package/dist/style/date-picker.css +1 -1
- package/dist/style/form.css +1 -1
- package/dist/style/image.css +1 -1
- package/dist/style/time-range-selector.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as K, toRefs as T, inject as q, ref as x, computed as t, reactive as D, watchEffect as H, watch as J, onBeforeUnmount as Q } from "vue";
|
|
2
2
|
import W from "../../icons/default/close-circle-fill.js";
|
|
3
3
|
import X from "../../icons/animation/animation-loading.js";
|
|
4
4
|
import Y from "./image-footer.vue.js";
|
|
5
5
|
import Z from "./ImagePreview.vue.js";
|
|
6
6
|
import $ from "./hooks/use-image-load-status.js";
|
|
7
|
-
import { isServerRendering as
|
|
8
|
-
import { normalizeImageSizeProp as
|
|
9
|
-
import { omit as
|
|
7
|
+
import { isServerRendering as ee } from "../../_utils/dom.js";
|
|
8
|
+
import { normalizeImageSizeProp as V } from "./utils/index.js";
|
|
9
|
+
import { omit as te } from "../../_utils/omit.js";
|
|
10
10
|
import ie from "../../_hooks/use-merge-state.js";
|
|
11
|
-
import { PreviewGroupInjectionKey as
|
|
12
|
-
import { isBoolean as
|
|
13
|
-
import { getClassNameMixin as
|
|
14
|
-
let
|
|
15
|
-
const
|
|
11
|
+
import { PreviewGroupInjectionKey as re } from "./context.js";
|
|
12
|
+
import { isBoolean as oe } from "../../_utils/is.js";
|
|
13
|
+
import { getClassNameMixin as ae } from "../../_utils/config.js";
|
|
14
|
+
let le = 0;
|
|
15
|
+
const be = K({
|
|
16
16
|
name: "Image",
|
|
17
17
|
components: {
|
|
18
18
|
IconImageClose: W,
|
|
@@ -169,91 +169,92 @@ const Se = q({
|
|
|
169
169
|
* @en Extra content at the bottom
|
|
170
170
|
* @slot extra
|
|
171
171
|
*/
|
|
172
|
-
setup(
|
|
172
|
+
setup(s, { attrs: u, slots: C, emit: o }) {
|
|
173
173
|
const {
|
|
174
|
-
height:
|
|
175
|
-
width:
|
|
176
|
-
hideFooter:
|
|
177
|
-
title:
|
|
178
|
-
description:
|
|
179
|
-
src:
|
|
180
|
-
footerPosition:
|
|
181
|
-
defaultPreviewVisible:
|
|
182
|
-
previewVisible:
|
|
183
|
-
preview:
|
|
184
|
-
previewProps:
|
|
185
|
-
} =
|
|
186
|
-
width:
|
|
187
|
-
height:
|
|
188
|
-
})),
|
|
174
|
+
height: m,
|
|
175
|
+
width: f,
|
|
176
|
+
hideFooter: v,
|
|
177
|
+
title: p,
|
|
178
|
+
description: d,
|
|
179
|
+
src: i,
|
|
180
|
+
footerPosition: b,
|
|
181
|
+
defaultPreviewVisible: F,
|
|
182
|
+
previewVisible: j,
|
|
183
|
+
preview: c,
|
|
184
|
+
previewProps: g
|
|
185
|
+
} = T(s), e = q(re, void 0), r = ae("image"), w = x(), { isLoaded: a, isError: I, isLoading: h, setLoadStatus: y } = $(), P = t(() => ({
|
|
186
|
+
width: V(f == null ? void 0 : f.value),
|
|
187
|
+
height: V(m == null ? void 0 : m.value)
|
|
188
|
+
})), N = t(() => s.fit ? { objectFit: s.fit } : {}), z = t(() => [
|
|
189
189
|
r.block,
|
|
190
190
|
{
|
|
191
|
-
[r.element("loading")]:
|
|
192
|
-
[r.element("loading-error")]:
|
|
191
|
+
[r.element("loading")]: h.value,
|
|
192
|
+
[r.element("loading-error")]: I.value,
|
|
193
193
|
// isLoaded / showFooter 是 ref,这里必须解引用;
|
|
194
194
|
// 直接写对象引用会让条件恒为真,没有 footer 的图片也带上定位类
|
|
195
|
-
[r.element("with-footer-inner")]:
|
|
196
|
-
[r.element("with-footer-outer")]:
|
|
195
|
+
[r.element("with-footer-inner")]: a.value && S.value && b.value === "inner",
|
|
196
|
+
[r.element("with-footer-outer")]: a.value && S.value && b.value === "outer"
|
|
197
197
|
},
|
|
198
|
-
|
|
199
|
-
]),
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
]),
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
value:
|
|
198
|
+
u.class
|
|
199
|
+
]), A = t(() => [
|
|
200
|
+
P.value,
|
|
201
|
+
u.style
|
|
202
|
+
]), S = t(() => p != null && p.value || d != null && d.value || C.extra ? oe(v.value) ? !v.value && a.value : v.value === "never" : !1), E = t(() => te(u, ["class", "style"])), [_, B] = ie(
|
|
203
|
+
F.value,
|
|
204
|
+
D({
|
|
205
|
+
value: j
|
|
206
206
|
})
|
|
207
|
-
),
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
), k = t(() => !(e != null && e.preview) && c.value);
|
|
208
|
+
H(() => {
|
|
209
|
+
ee || !w.value || (w.value.src = i == null ? void 0 : i.value, y("loading"));
|
|
210
210
|
});
|
|
211
|
-
const L =
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
211
|
+
const L = le++;
|
|
212
|
+
if (e) {
|
|
213
|
+
let l;
|
|
214
|
+
J(
|
|
215
|
+
[() => {
|
|
216
|
+
var n;
|
|
217
|
+
return (((n = g == null ? void 0 : g.value) == null ? void 0 : n.src) ?? (i == null ? void 0 : i.value)) || "";
|
|
218
|
+
}, c],
|
|
219
|
+
([n, G]) => {
|
|
220
|
+
l = e.registerImageUrl(L, n, G);
|
|
221
|
+
},
|
|
222
|
+
{ immediate: !0 }
|
|
223
|
+
), Q(() => l == null ? void 0 : l());
|
|
224
|
+
}
|
|
225
|
+
function M() {
|
|
226
|
+
y("loaded");
|
|
226
227
|
}
|
|
227
|
-
function
|
|
228
|
-
|
|
228
|
+
function O() {
|
|
229
|
+
y("error");
|
|
229
230
|
}
|
|
230
231
|
function R() {
|
|
231
|
-
|
|
232
|
+
c.value && (e != null && e.preview ? e.preview(L) : (o("preview-visible-change", !0), o("update:previewVisible", !0), B(!0)));
|
|
232
233
|
}
|
|
233
|
-
function
|
|
234
|
-
|
|
234
|
+
function U() {
|
|
235
|
+
o("preview-visible-change", !1), o("update:previewVisible", !1), B(!1);
|
|
235
236
|
}
|
|
236
237
|
return {
|
|
237
|
-
refImg:
|
|
238
|
+
refImg: w,
|
|
238
239
|
className: r,
|
|
239
|
-
wrapperClassNames:
|
|
240
|
-
wrapperStyles:
|
|
241
|
-
showFooter:
|
|
242
|
-
imgProps:
|
|
243
|
-
imgStyle:
|
|
244
|
-
isLoaded:
|
|
245
|
-
isError:
|
|
246
|
-
isLoading:
|
|
247
|
-
mergedPreviewVisible:
|
|
248
|
-
mergePreview:
|
|
249
|
-
onImgLoaded:
|
|
250
|
-
onImgLoadError:
|
|
240
|
+
wrapperClassNames: z,
|
|
241
|
+
wrapperStyles: A,
|
|
242
|
+
showFooter: S,
|
|
243
|
+
imgProps: E,
|
|
244
|
+
imgStyle: P,
|
|
245
|
+
isLoaded: a,
|
|
246
|
+
isError: I,
|
|
247
|
+
isLoading: h,
|
|
248
|
+
mergedPreviewVisible: _,
|
|
249
|
+
mergePreview: k,
|
|
250
|
+
onImgLoaded: M,
|
|
251
|
+
onImgLoadError: O,
|
|
251
252
|
onImgClick: R,
|
|
252
|
-
onPreviewClose:
|
|
253
|
-
fitStyle:
|
|
253
|
+
onPreviewClose: U,
|
|
254
|
+
fitStyle: N
|
|
254
255
|
};
|
|
255
256
|
}
|
|
256
257
|
});
|
|
257
258
|
export {
|
|
258
|
-
|
|
259
|
+
be as default
|
|
259
260
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import b from "./ImagePreview.vue2.js";
|
|
2
|
-
import { resolveComponent as i, openBlock as l, createBlock as m, Teleport as w, createElementVNode as d, normalizeStyle as p, normalizeClass as s, createVNode as t, Transition as
|
|
2
|
+
import { resolveComponent as i, openBlock as l, createBlock as m, Teleport as w, createElementVNode as d, normalizeStyle as p, normalizeClass as s, createVNode as t, Transition as g, withCtx as u, withDirectives as C, vShow as L, createElementBlock as r, withModifiers as N, createCommentVNode as n, toDisplayString as E, renderSlot as I, normalizeProps as P, mergeProps as $ } from "vue";
|
|
3
3
|
import V from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
4
|
const M = ["aria-label"], S = ["src"], A = ["aria-label"];
|
|
5
|
-
function B(e, a, T, W,
|
|
6
|
-
const k = i("IconLoading"),
|
|
7
|
-
return l(), m(w, {
|
|
5
|
+
function B(e, a, T, W, z, D) {
|
|
6
|
+
const k = i("IconLoading"), y = i("PreviewToolbar"), f = i("IconClose"), v = i("PreviewArrow");
|
|
7
|
+
return e.mounted ? (l(), m(w, {
|
|
8
|
+
key: 0,
|
|
8
9
|
to: e.container || "body",
|
|
9
10
|
disabled: e.teleportDisabled
|
|
10
11
|
}, [
|
|
@@ -12,12 +13,12 @@ function B(e, a, T, W, c, z) {
|
|
|
12
13
|
class: s(e.classNames),
|
|
13
14
|
style: p(e.wrapperStyles)
|
|
14
15
|
}, [
|
|
15
|
-
t(
|
|
16
|
+
t(g, {
|
|
16
17
|
name: "image-fade",
|
|
17
18
|
onBeforeEnter: a[0] || (a[0] = (o) => o.parentElement && (o.parentElement.style.display = "block")),
|
|
18
19
|
onAfterLeave: a[1] || (a[1] = (o) => o.parentElement && (o.parentElement.style.display = ""))
|
|
19
20
|
}, {
|
|
20
|
-
default:
|
|
21
|
+
default: u(() => [
|
|
21
22
|
C(d("div", {
|
|
22
23
|
class: s(e.className.element("mask"))
|
|
23
24
|
}, null, 2), [
|
|
@@ -65,8 +66,8 @@ function B(e, a, T, W, c, z) {
|
|
|
65
66
|
}, [
|
|
66
67
|
t(k)
|
|
67
68
|
], 2)) : n("", !0),
|
|
68
|
-
t(
|
|
69
|
-
default:
|
|
69
|
+
t(g, { name: "image-fade" }, {
|
|
70
|
+
default: u(() => [
|
|
70
71
|
e.scaleValueVisible ? (l(), r("div", {
|
|
71
72
|
key: 0,
|
|
72
73
|
class: s(e.className.element("scale-value"))
|
|
@@ -74,12 +75,12 @@ function B(e, a, T, W, c, z) {
|
|
|
74
75
|
]),
|
|
75
76
|
_: 1
|
|
76
77
|
}),
|
|
77
|
-
e.isLoaded && e.actionsLayout.length ? (l(), m(
|
|
78
|
+
e.isLoaded && e.actionsLayout.length ? (l(), m(y, {
|
|
78
79
|
key: 1,
|
|
79
80
|
actions: e.actions,
|
|
80
81
|
"actions-layout": e.actionsLayout
|
|
81
82
|
}, {
|
|
82
|
-
default:
|
|
83
|
+
default: u(() => [
|
|
83
84
|
I(e.$slots, "actions")
|
|
84
85
|
]),
|
|
85
86
|
_: 3
|
|
@@ -91,12 +92,12 @@ function B(e, a, T, W, c, z) {
|
|
|
91
92
|
"aria-label": e.t("imagePreview.closeLabel"),
|
|
92
93
|
onClick: a[5] || (a[5] = (...o) => e.onCloseClick && e.onCloseClick(...o))
|
|
93
94
|
}, [
|
|
94
|
-
t(
|
|
95
|
+
t(f)
|
|
95
96
|
], 10, A)) : n("", !0),
|
|
96
97
|
e.inGroup ? (l(), m(v, P($({ key: 3 }, e.groupArrowProps)), null, 16)) : n("", !0)
|
|
97
98
|
], 42, M)) : n("", !0)
|
|
98
99
|
], 6)
|
|
99
|
-
], 8, ["to", "disabled"]);
|
|
100
|
+
], 8, ["to", "disabled"])) : n("", !0);
|
|
100
101
|
}
|
|
101
102
|
const j = /* @__PURE__ */ V(b, [["render", B]]);
|
|
102
103
|
export {
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useLocale as
|
|
4
|
-
import { getClassNameMixin as
|
|
5
|
-
import { throttleByRaf as
|
|
6
|
-
import { KEYBOARD_KEY as
|
|
7
|
-
import { isServerRendering as z, on as pe, off as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
1
|
+
import { defineComponent as re, toRefs as se, ref as m, onMounted as ue, reactive as k, computed as p, watch as N, onBeforeUnmount as ce, h as f } from "vue";
|
|
2
|
+
import me from "../../_hooks/use-merge-state.js";
|
|
3
|
+
import { useLocale as fe } from "../../locale/index.js";
|
|
4
|
+
import { getClassNameMixin as de } from "../../_utils/config.js";
|
|
5
|
+
import { throttleByRaf as ve } from "../../_utils/throttle-by-raf.js";
|
|
6
|
+
import { KEYBOARD_KEY as d } from "../../_utils/keyboard.js";
|
|
7
|
+
import { isServerRendering as z, on as pe, off as ge } from "../../_utils/dom.js";
|
|
8
|
+
import ye from "./preview-arrow.vue.js";
|
|
9
|
+
import be from "./preview-toolbar.vue.js";
|
|
10
10
|
import we from "./hooks/use-image-load-status.js";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
const T = 90,
|
|
11
|
+
import ke from "./hooks/use-image-drag.js";
|
|
12
|
+
import Se from "../../icons/animation/animation-loading.js";
|
|
13
|
+
import he from "../../icons/default/close.js";
|
|
14
|
+
import Re from "../../icons/_self/zoom-out.js";
|
|
15
|
+
import Ie from "../../icons/_self/zoom-in.js";
|
|
16
|
+
import Ce from "../../icons/_self/full-screen.js";
|
|
17
|
+
import Pe from "../../icons/_self/rotate-left.js";
|
|
18
|
+
import ze from "../../icons/_self/rotate-right.js";
|
|
19
|
+
import Te from "../../icons/_self/original-size.js";
|
|
20
|
+
import Oe from "../../_hooks/use-popup-overflow-hidden.js";
|
|
21
|
+
import Le from "../../_hooks/use-popup-container.js";
|
|
22
|
+
import Ae, { getScaleByRate as Be, maxScale as Ee, minScale as xe } from "./utils/get-scale.js";
|
|
23
|
+
import Ne from "../../_hooks/use-popup-manager.js";
|
|
24
|
+
const T = 90, lo = /* @__PURE__ */ re({
|
|
25
25
|
name: "ImagePreview",
|
|
26
26
|
components: {
|
|
27
|
-
PreviewArrow:
|
|
28
|
-
PreviewToolbar:
|
|
29
|
-
IconLoading:
|
|
30
|
-
IconClose:
|
|
27
|
+
PreviewArrow: ye,
|
|
28
|
+
PreviewToolbar: be,
|
|
29
|
+
IconLoading: Se,
|
|
30
|
+
IconClose: he
|
|
31
31
|
},
|
|
32
32
|
props: {
|
|
33
33
|
renderToBody: {
|
|
@@ -156,150 +156,155 @@ const T = 90, no = /* @__PURE__ */ le({
|
|
|
156
156
|
emit: O
|
|
157
157
|
}) {
|
|
158
158
|
const {
|
|
159
|
-
t:
|
|
160
|
-
} =
|
|
161
|
-
src:
|
|
162
|
-
popupContainer:
|
|
163
|
-
visible:
|
|
164
|
-
defaultVisible:
|
|
165
|
-
maskClosable:
|
|
166
|
-
actionsLayout:
|
|
159
|
+
t: r
|
|
160
|
+
} = fe(), {
|
|
161
|
+
src: D,
|
|
162
|
+
popupContainer: _,
|
|
163
|
+
visible: V,
|
|
164
|
+
defaultVisible: K,
|
|
165
|
+
maskClosable: M,
|
|
166
|
+
actionsLayout: W,
|
|
167
167
|
defaultScale: L,
|
|
168
|
-
zoomRate:
|
|
169
|
-
} =
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
})), Z =
|
|
176
|
-
|
|
177
|
-
} =
|
|
178
|
-
|
|
179
|
-
}), Y =
|
|
180
|
-
|
|
181
|
-
|
|
168
|
+
zoomRate: G
|
|
169
|
+
} = se(n), s = m(), S = m(), A = m(!1);
|
|
170
|
+
ue(() => {
|
|
171
|
+
A.value = !0;
|
|
172
|
+
});
|
|
173
|
+
const h = de("image-preview"), [i, U] = me(K.value, k({
|
|
174
|
+
value: V
|
|
175
|
+
})), Z = p(() => [h.block, {
|
|
176
|
+
[h.modifier("hide")]: !i.value
|
|
177
|
+
}]), F = z ? void 0 : document.body, u = Le(F, k({
|
|
178
|
+
popupContainer: _
|
|
179
|
+
})), H = p(() => !z && u.value === document.body), Y = p(() => z || !n.renderToBody || !u.value), {
|
|
180
|
+
zIndex: j
|
|
181
|
+
} = Ne("dialog", {
|
|
182
|
+
visible: i
|
|
183
|
+
}), X = p(() => ({
|
|
184
|
+
...H.value ? {
|
|
185
|
+
zIndex: j.value,
|
|
182
186
|
position: "fixed"
|
|
183
187
|
} : {
|
|
184
188
|
zIndex: "inherit",
|
|
185
189
|
position: "absolute"
|
|
186
190
|
}
|
|
187
191
|
})), {
|
|
188
|
-
isLoading:
|
|
189
|
-
isLoaded:
|
|
192
|
+
isLoading: q,
|
|
193
|
+
isLoaded: J,
|
|
190
194
|
setLoadStatus: R
|
|
191
|
-
} = we(), c =
|
|
195
|
+
} = we(), c = m(0), t = m(L.value), {
|
|
192
196
|
translate: g,
|
|
193
|
-
moving:
|
|
194
|
-
resetTranslate:
|
|
195
|
-
} =
|
|
196
|
-
wrapperEl:
|
|
197
|
+
moving: Q,
|
|
198
|
+
resetTranslate: $
|
|
199
|
+
} = ke(k({
|
|
200
|
+
wrapperEl: s,
|
|
197
201
|
imageEl: S,
|
|
198
|
-
visible:
|
|
202
|
+
visible: i,
|
|
199
203
|
scale: t
|
|
200
|
-
})), y =
|
|
204
|
+
})), y = m(!1);
|
|
201
205
|
let I = null;
|
|
202
|
-
const
|
|
206
|
+
const ee = () => {
|
|
203
207
|
!y.value && (y.value = !0), I && clearTimeout(I), I = setTimeout(() => {
|
|
204
208
|
y.value = !1;
|
|
205
209
|
}, 1e3);
|
|
206
210
|
};
|
|
207
|
-
|
|
211
|
+
Oe(k({
|
|
208
212
|
container: u,
|
|
209
|
-
hidden:
|
|
213
|
+
hidden: i
|
|
210
214
|
}));
|
|
211
|
-
function
|
|
212
|
-
c.value = 0, t.value = L.value,
|
|
215
|
+
function oe() {
|
|
216
|
+
c.value = 0, t.value = L.value, $();
|
|
213
217
|
}
|
|
214
|
-
const C = (e) =>
|
|
215
|
-
const o = e.target,
|
|
218
|
+
const C = (e) => W.value.includes(e), B = (e) => {
|
|
219
|
+
const o = e.target, l = o && ["BUTTON", "A", "INPUT", "TEXTAREA", "SELECT"].includes(o.tagName);
|
|
216
220
|
let a = !1;
|
|
217
221
|
switch (e.key) {
|
|
218
|
-
case
|
|
222
|
+
case d.ESC:
|
|
219
223
|
n.escToClose && (P(), a = !0);
|
|
220
224
|
break;
|
|
221
|
-
case
|
|
225
|
+
case d.ARROW_LEFT:
|
|
222
226
|
n.groupArrowProps.onPrev && (n.groupArrowProps.onPrev(), a = !0);
|
|
223
227
|
break;
|
|
224
|
-
case
|
|
228
|
+
case d.ARROW_RIGHT:
|
|
225
229
|
n.groupArrowProps.onNext && (n.groupArrowProps.onNext(), a = !0);
|
|
226
230
|
break;
|
|
227
|
-
case
|
|
228
|
-
C("zoomIn") && !
|
|
231
|
+
case d.ARROW_UP:
|
|
232
|
+
C("zoomIn") && !l && (w("zoomIn"), a = !0);
|
|
229
233
|
break;
|
|
230
|
-
case
|
|
231
|
-
C("zoomOut") && !
|
|
234
|
+
case d.ARROW_DOWN:
|
|
235
|
+
C("zoomOut") && !l && (w("zoomOut"), a = !0);
|
|
232
236
|
break;
|
|
233
|
-
case
|
|
234
|
-
C("originalSize") && !
|
|
237
|
+
case d.SPACE:
|
|
238
|
+
C("originalSize") && !l && (v(1), a = !0);
|
|
235
239
|
break;
|
|
236
240
|
}
|
|
237
241
|
a && (e.stopPropagation(), e.preventDefault());
|
|
238
|
-
},
|
|
242
|
+
}, te = ve((e) => {
|
|
239
243
|
if (e.preventDefault(), e.stopPropagation(), !n.wheelZoom) return;
|
|
240
|
-
const
|
|
241
|
-
|
|
244
|
+
const l = (e.deltaY || e.deltaX) > 0 ? "zoomOut" : "zoomIn", a = Be(t.value, G.value, l);
|
|
245
|
+
v(a);
|
|
246
|
+
});
|
|
247
|
+
let b = !1;
|
|
248
|
+
N(s, (e) => e == null ? void 0 : e.focus(), {
|
|
249
|
+
flush: "post"
|
|
242
250
|
});
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
(e = l == null ? void 0 : l.value) == null || e.focus();
|
|
248
|
-
}), n.keyboard && !w && (w = !0, pe(u.value, "keydown", A));
|
|
249
|
-
}, B = () => {
|
|
250
|
-
w && (w = !1, ve(u.value, "keydown", A));
|
|
251
|
+
const ae = () => {
|
|
252
|
+
n.keyboard && !b && (b = !0, pe(u.value, "keydown", B));
|
|
253
|
+
}, E = () => {
|
|
254
|
+
b && (b = !1, ge(u.value, "keydown", B));
|
|
251
255
|
};
|
|
252
|
-
|
|
253
|
-
|
|
256
|
+
N([D, i], () => {
|
|
257
|
+
i.value ? (oe(), R("loading"), ae()) : E();
|
|
254
258
|
}, {
|
|
255
259
|
immediate: !0
|
|
256
260
|
});
|
|
257
261
|
function P() {
|
|
258
|
-
|
|
262
|
+
i.value && (O("close"), O("update:visible", !1), U(!1));
|
|
259
263
|
}
|
|
260
|
-
function
|
|
264
|
+
function ne(e) {
|
|
261
265
|
var o;
|
|
262
|
-
(o =
|
|
266
|
+
(o = s == null ? void 0 : s.value) == null || o.focus(), M.value && e.target === e.currentTarget && P();
|
|
263
267
|
}
|
|
264
|
-
function
|
|
268
|
+
function v(e) {
|
|
265
269
|
if (t.value !== e) {
|
|
266
270
|
const o = t.value;
|
|
267
|
-
g.value = [g.value[0] * o / e, g.value[1] * o / e], t.value = e,
|
|
271
|
+
g.value = [g.value[0] * o / e, g.value[1] * o / e], t.value = e, ee();
|
|
268
272
|
}
|
|
269
273
|
}
|
|
270
|
-
function
|
|
271
|
-
const e =
|
|
272
|
-
|
|
274
|
+
function le() {
|
|
275
|
+
const e = s.value.getBoundingClientRect(), o = S.value.getBoundingClientRect(), l = e.height / (o.height / t.value), a = e.width / (o.width / t.value), ie = Math.max(l, a);
|
|
276
|
+
v(ie);
|
|
273
277
|
}
|
|
274
|
-
function
|
|
275
|
-
const
|
|
276
|
-
c.value =
|
|
278
|
+
function x(e) {
|
|
279
|
+
const l = e === "clockwise" ? (c.value + T) % 360 : c.value === 0 ? 360 - T : c.value - T;
|
|
280
|
+
c.value = l;
|
|
277
281
|
}
|
|
278
|
-
function
|
|
279
|
-
const o =
|
|
280
|
-
|
|
282
|
+
function w(e) {
|
|
283
|
+
const o = Ae(t.value, e);
|
|
284
|
+
v(o);
|
|
281
285
|
}
|
|
282
|
-
return
|
|
283
|
-
|
|
286
|
+
return ce(() => {
|
|
287
|
+
E();
|
|
284
288
|
}), {
|
|
285
|
-
t:
|
|
289
|
+
t: r,
|
|
286
290
|
className: h,
|
|
287
|
-
classNames:
|
|
291
|
+
classNames: Z,
|
|
288
292
|
container: u,
|
|
289
|
-
teleportDisabled:
|
|
290
|
-
wrapperStyles:
|
|
293
|
+
teleportDisabled: Y,
|
|
294
|
+
wrapperStyles: X,
|
|
291
295
|
scale: t,
|
|
292
296
|
translate: g,
|
|
293
297
|
rotate: c,
|
|
294
|
-
moving:
|
|
295
|
-
mergedVisible:
|
|
296
|
-
isLoading:
|
|
297
|
-
isLoaded:
|
|
298
|
+
moving: Q,
|
|
299
|
+
mergedVisible: i,
|
|
300
|
+
isLoading: q,
|
|
301
|
+
isLoaded: J,
|
|
298
302
|
scaleValueVisible: y,
|
|
299
|
-
refWrapper:
|
|
303
|
+
refWrapper: s,
|
|
300
304
|
refImage: S,
|
|
301
|
-
|
|
302
|
-
|
|
305
|
+
mounted: A,
|
|
306
|
+
onWheel: te,
|
|
307
|
+
onMaskClick: ne,
|
|
303
308
|
onCloseClick: P,
|
|
304
309
|
onImgLoad() {
|
|
305
310
|
R("loaded");
|
|
@@ -307,55 +312,55 @@ const T = 90, no = /* @__PURE__ */ le({
|
|
|
307
312
|
onImgError() {
|
|
308
313
|
R("error");
|
|
309
314
|
},
|
|
310
|
-
actions:
|
|
315
|
+
actions: p(() => [
|
|
311
316
|
/** 满屏 */
|
|
312
317
|
{
|
|
313
318
|
key: "fullScreen",
|
|
314
|
-
name:
|
|
315
|
-
content: () =>
|
|
316
|
-
onClick: () =>
|
|
319
|
+
name: r("imagePreview.fullscreen"),
|
|
320
|
+
content: () => f(Ce),
|
|
321
|
+
onClick: () => le()
|
|
317
322
|
},
|
|
318
323
|
/** 顺时针旋转 */
|
|
319
324
|
{
|
|
320
325
|
key: "rotateRight",
|
|
321
|
-
name:
|
|
322
|
-
content: () =>
|
|
323
|
-
onClick: () =>
|
|
326
|
+
name: r("imagePreview.rotateRight"),
|
|
327
|
+
content: () => f(ze),
|
|
328
|
+
onClick: () => x("clockwise")
|
|
324
329
|
},
|
|
325
330
|
/** 逆时针旋转 */
|
|
326
331
|
{
|
|
327
332
|
key: "rotateLeft",
|
|
328
|
-
name:
|
|
329
|
-
content: () =>
|
|
330
|
-
onClick: () =>
|
|
333
|
+
name: r("imagePreview.rotateLeft"),
|
|
334
|
+
content: () => f(Pe),
|
|
335
|
+
onClick: () => x("counterclockwise")
|
|
331
336
|
},
|
|
332
337
|
/** 放大 */
|
|
333
338
|
{
|
|
334
339
|
key: "zoomIn",
|
|
335
|
-
name:
|
|
336
|
-
content: () =>
|
|
337
|
-
onClick: () =>
|
|
338
|
-
disabled: t.value ===
|
|
340
|
+
name: r("imagePreview.zoomIn"),
|
|
341
|
+
content: () => f(Ie),
|
|
342
|
+
onClick: () => w("zoomIn"),
|
|
343
|
+
disabled: t.value === Ee
|
|
339
344
|
},
|
|
340
345
|
/** 缩小 */
|
|
341
346
|
{
|
|
342
347
|
key: "zoomOut",
|
|
343
|
-
name:
|
|
344
|
-
content: () =>
|
|
345
|
-
onClick: () =>
|
|
346
|
-
disabled: t.value ===
|
|
348
|
+
name: r("imagePreview.zoomOut"),
|
|
349
|
+
content: () => f(Re),
|
|
350
|
+
onClick: () => w("zoomOut"),
|
|
351
|
+
disabled: t.value === xe
|
|
347
352
|
},
|
|
348
353
|
/** 缩放到100% */
|
|
349
354
|
{
|
|
350
355
|
key: "originalSize",
|
|
351
|
-
name:
|
|
352
|
-
content: () =>
|
|
353
|
-
onClick: () =>
|
|
356
|
+
name: r("imagePreview.originalSize"),
|
|
357
|
+
content: () => f(Te),
|
|
358
|
+
onClick: () => v(1)
|
|
354
359
|
}
|
|
355
360
|
])
|
|
356
361
|
};
|
|
357
362
|
}
|
|
358
363
|
});
|
|
359
364
|
export {
|
|
360
|
-
|
|
365
|
+
lo as default
|
|
361
366
|
};
|
|
@@ -8,7 +8,7 @@ function d(o, b, f, g, $, v) {
|
|
|
8
8
|
p(r, i({ ...o.$attrs, groupArrowProps: o.groupArrowProps }, {
|
|
9
9
|
"in-group": "",
|
|
10
10
|
src: o.currentUrl,
|
|
11
|
-
visible: o.mergedVisible,
|
|
11
|
+
visible: o.mergedVisible && !!o.currentUrl,
|
|
12
12
|
"mask-closable": o.maskClosable,
|
|
13
13
|
closable: o.closable,
|
|
14
14
|
"actions-layout": o.actionsLayout,
|