x-next 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/AI_USAGE.md +57 -4
  2. package/CHANGELOG.md +36 -0
  3. package/dist/components/date-picker/DatePicker.vue.d.ts +3 -3
  4. package/dist/components/date-picker/index.d.ts +6 -6
  5. package/dist/components/draggable/Draggable.d.ts +1 -1
  6. package/dist/components/draggable/index.d.ts +2 -2
  7. package/dist/components/drawer/index.d.ts +6 -6
  8. package/dist/components/drawer/src/Drawer.vue.d.ts +3 -3
  9. package/dist/components/dropdown/Dropdown.vue.d.ts +4 -4
  10. package/dist/components/dropdown/DropdownButton.vue.d.ts +5 -5
  11. package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +4 -4
  12. package/dist/components/dropdown/index.d.ts +29 -29
  13. package/dist/components/form/FormItem.vue.d.ts +12 -12
  14. package/dist/components/form/form-item-label.vue.d.ts +3 -3
  15. package/dist/components/form/index.d.ts +24 -24
  16. package/dist/components/form-select/Select.d.ts +3 -3
  17. package/dist/components/form-select/index.d.ts +6 -6
  18. package/dist/components/form-slider/Slider.vue.d.ts +3 -3
  19. package/dist/components/form-slider/index.d.ts +6 -6
  20. package/dist/components/form-slider/slider-button.vue.d.ts +3 -3
  21. package/dist/components/grid/Row.vue.d.ts +3 -3
  22. package/dist/components/grid/index.d.ts +9 -9
  23. package/dist/components/image/Image.vue.d.ts +125 -17
  24. package/dist/components/image/ImagePreview.vue.d.ts +97 -7
  25. package/dist/components/image/ImagePreviewAction.d.ts +3 -3
  26. package/dist/components/image/ImagePreviewGroup.vue.d.ts +100 -7
  27. package/dist/components/image/hooks/use-image-drag.d.ts +2 -2
  28. package/dist/components/image/index.d.ts +712 -124
  29. package/dist/components/image/interface.d.ts +9 -1
  30. package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
  31. package/dist/components/index.d.ts +1 -0
  32. package/dist/components/menu/sub-menu-pop.vue.d.ts +3 -3
  33. package/dist/components/pagination/page-options.vue.d.ts +6 -6
  34. package/dist/components/popconfirm/src/popup.vue.d.ts +3 -3
  35. package/dist/components/popover/Popover.d.ts +1 -1
  36. package/dist/components/popover/index.d.ts +3 -3
  37. package/dist/components/popup/Popup.d.ts +1 -1
  38. package/dist/components/popup/index.d.ts +3 -3
  39. package/dist/components/space/Space.d.ts +1 -1
  40. package/dist/components/space/index.d.ts +3 -3
  41. package/dist/components/tabs/Tabs.d.ts +1 -1
  42. package/dist/components/tabs/index.d.ts +3 -3
  43. package/dist/components/time-picker/TimePicker.vue.d.ts +3 -3
  44. package/dist/components/time-picker/index.d.ts +6 -6
  45. package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
  46. package/dist/components/tooltip/index.d.ts +3 -3
  47. package/dist/components/trigger/Trigger.d.ts +1 -1
  48. package/dist/components/trigger/index.d.ts +3 -3
  49. package/dist/components/upload/Upload.d.ts +372 -0
  50. package/dist/components/upload/context.d.ts +28 -0
  51. package/dist/components/upload/index.d.ts +656 -0
  52. package/dist/components/upload/interface.d.ts +110 -0
  53. package/dist/components/upload/props.d.ts +321 -0
  54. package/dist/components/upload/upload-list-item.d.ts +15 -0
  55. package/dist/components/upload/upload-list.d.ts +11 -0
  56. package/dist/components/upload/upload-picture-item.d.ts +20 -0
  57. package/dist/components/upload/upload-trigger.d.ts +8 -0
  58. package/dist/components/upload/utils.d.ts +48 -0
  59. package/dist/es/_styles/palette-aliases.js +2 -4
  60. package/dist/es/components/image/Image.vue.js +55 -45
  61. package/dist/es/components/image/Image.vue2.js +113 -92
  62. package/dist/es/components/image/ImagePreview.vue.js +66 -53
  63. package/dist/es/components/image/ImagePreview.vue2.js +219 -171
  64. package/dist/es/components/image/ImagePreviewAction.js +12 -15
  65. package/dist/es/components/image/ImagePreviewGroup.vue.js +21 -20
  66. package/dist/es/components/image/ImagePreviewGroup.vue2.js +45 -39
  67. package/dist/es/components/image/hooks/use-image-drag.js +16 -14
  68. package/dist/es/components/index.js +33 -31
  69. package/dist/es/components/upload/Upload.js +420 -0
  70. package/dist/es/components/upload/context.js +4 -0
  71. package/dist/es/components/upload/index.js +8 -0
  72. package/dist/es/components/upload/props.js +321 -0
  73. package/dist/es/components/upload/upload-list-item.js +138 -0
  74. package/dist/es/components/upload/upload-list.js +48 -0
  75. package/dist/es/components/upload/upload-picture-item.js +109 -0
  76. package/dist/es/components/upload/upload-trigger.js +89 -0
  77. package/dist/es/components/upload/utils.js +195 -0
  78. package/dist/es/icons/_self/upload-icons.js +103 -0
  79. package/dist/es/index.js +40 -38
  80. package/dist/es/locale/en-US.js +22 -0
  81. package/dist/es/locale/zh-CN.js +22 -0
  82. package/dist/es/style.css +1 -1
  83. package/dist/icons/_self/upload-icons.d.ts +523 -0
  84. package/dist/index.cjs +4 -4
  85. package/dist/index.umd.js +4 -4
  86. package/dist/locale/interface.d.ts +32 -0
  87. package/dist/style/base.css +1 -1
  88. package/dist/style/image.css +1 -1
  89. package/dist/style/upload.css +1 -0
  90. package/dist/style/upload.js +2 -0
  91. package/dist/style.css +1 -1
  92. package/dist/types.d.ts +1 -0
  93. package/package.json +1 -1
  94. package/volar.d.ts +1 -0
  95. package/dist/es/_hooks/use-popup-overflow-hidden.js +0 -29
@@ -1,91 +1,101 @@
1
1
  import C from "./Image.vue2.js";
2
- import { resolveComponent as m, openBlock as n, createElementBlock as t, normalizeStyle as N, normalizeClass as o, createElementVNode as r, mergeProps as d, renderSlot as i, createVNode as p, toDisplayString as w, createCommentVNode as l, createBlock as g, createSlots as L, withCtx as v } from "vue";
2
+ import { resolveComponent as m, openBlock as i, createElementBlock as d, normalizeStyle as p, normalizeClass as o, mergeProps as t, renderSlot as l, createElementVNode as a, createVNode as g, toDisplayString as v, createCommentVNode as n, createBlock as y, createSlots as w, withCtx as P } from "vue";
3
3
  import u from "../../_virtual/_plugin-vue_export-helper.js";
4
- const $ = ["title", "alt"];
5
- function c(e, s, P, S, b, E) {
6
- const y = m("IconImageClose"), I = m("IconLoading"), f = m("ImageFooter"), k = m("ImagePreview");
7
- return n(), t("div", {
4
+ const N = ["title", "src", "alt", "role", "tabindex", "aria-label", "aria-haspopup"];
5
+ function L(e, r, $, S, E, V) {
6
+ const I = m("IconImageClose"), b = m("IconLoading"), f = m("ImageFooter"), k = m("ImagePreview");
7
+ return i(), d("div", {
8
8
  class: o(e.wrapperClassNames),
9
- style: N(e.wrapperStyles)
9
+ style: p(e.wrapperStyles)
10
10
  }, [
11
- r("img", d({
11
+ (i(), d("img", t({
12
12
  ref: "refImg",
13
+ key: e.src,
13
14
  class: e.className.element("img")
14
15
  }, e.imgProps, {
15
16
  style: { ...e.imgStyle, ...e.fitStyle },
16
17
  title: e.title,
17
- alt: e.alt,
18
- onLoad: s[0] || (s[0] = (...a) => e.onImgLoaded && e.onImgLoaded(...a)),
19
- onError: s[1] || (s[1] = (...a) => e.onImgLoadError && e.onImgLoadError(...a)),
20
- onClick: s[2] || (s[2] = (...a) => e.onImgClick && e.onImgClick(...a))
21
- }), null, 16, $),
22
- e.isLoaded ? l("", !0) : (n(), t("div", {
18
+ src: e.src || void 0,
19
+ alt: e.alt ?? e.description,
20
+ role: e.canOpenPreview ? "button" : e.imgProps.role,
21
+ tabindex: e.canOpenPreview ? e.imgProps.tabindex ?? 0 : e.imgProps.tabindex,
22
+ "aria-label": e.canOpenPreview ? e.imgProps["aria-label"] || e.alt || e.description || e.title || e.t("imagePreview.openLabel") : e.imgProps["aria-label"],
23
+ "aria-haspopup": e.canOpenPreview ? "dialog" : void 0,
24
+ onLoad: r[0] || (r[0] = (...s) => e.onImgLoaded && e.onImgLoaded(...s)),
25
+ onError: r[1] || (r[1] = (...s) => e.onImgLoadError && e.onImgLoadError(...s)),
26
+ onClick: r[2] || (r[2] = (...s) => e.onImgClick && e.onImgClick(...s)),
27
+ onKeydown: r[3] || (r[3] = (...s) => e.onImgKeydown && e.onImgKeydown(...s))
28
+ }), null, 16, N)),
29
+ e.isLoaded ? n("", !0) : (i(), d("div", {
23
30
  key: 0,
24
- class: o(e.className.element("overlay"))
31
+ class: o(e.className.element("overlay")),
32
+ style: p(e.overlayStyles)
25
33
  }, [
26
- e.isError ? i(e.$slots, "error", { key: 0 }, () => [
27
- r("div", {
34
+ e.isError ? l(e.$slots, "error", { key: 0 }, () => [
35
+ a("div", {
28
36
  class: o(e.className.element("error"))
29
37
  }, [
30
- r("div", {
38
+ a("div", {
31
39
  class: o(e.className.element("error-icon"))
32
40
  }, [
33
- i(e.$slots, "error-icon", {}, () => [
34
- p(y)
41
+ l(e.$slots, "error-icon", {}, () => [
42
+ g(I)
35
43
  ])
36
44
  ], 2),
37
- e.alt || e.description ? (n(), t("div", {
38
- key: 0,
45
+ a("div", {
39
46
  class: o(e.className.element("error-alt"))
40
- }, w(e.alt || e.description), 3)) : l("", !0)
47
+ }, v(e.alt || e.description || e.t("imagePreview.loadError")), 3)
41
48
  ], 2)
42
- ]) : l("", !0),
43
- e.isLoading && (e.showLoader || e.$slots.loader) ? i(e.$slots, "loader", { key: 1 }, () => [
44
- r("div", {
49
+ ]) : n("", !0),
50
+ e.isLoading && (e.showLoader || e.$slots.loader) ? l(e.$slots, "loader", { key: 1 }, () => [
51
+ a("div", {
45
52
  class: o([e.className.element("loader")])
46
53
  }, [
47
- r("div", {
54
+ a("div", {
48
55
  class: o(e.className.element("loader-spin"))
49
56
  }, [
50
- p(I),
51
- r("div", {
57
+ g(b),
58
+ a("div", {
52
59
  class: o(e.className.element("loader-spin-text"))
53
- }, " Loading ", 2)
60
+ }, v(e.t("imagePreview.loading")), 3)
54
61
  ], 2)
55
62
  ], 2)
56
- ]) : l("", !0)
57
- ], 2)),
58
- e.showFooter ? (n(), g(f, {
63
+ ]) : n("", !0)
64
+ ], 6)),
65
+ e.showFooter ? (i(), y(f, {
59
66
  key: 1,
60
67
  class: o(e.footerClass),
61
68
  "prefix-cls": e.className.block,
62
69
  title: e.title,
63
70
  description: e.description
64
- }, L({ _: 2 }, [
71
+ }, w({ _: 2 }, [
65
72
  e.$slots.extra ? {
66
73
  name: "extra",
67
- fn: v(() => [
68
- i(e.$slots, "extra")
74
+ fn: P(() => [
75
+ l(e.$slots, "extra")
69
76
  ]),
70
77
  key: "0"
71
78
  } : void 0
72
- ]), 1032, ["class", "prefix-cls", "title", "description"])) : l("", !0),
73
- e.isLoaded && e.mergePreview ? (n(), g(k, d({
79
+ ]), 1032, ["class", "prefix-cls", "title", "description"])) : n("", !0),
80
+ e.mergePreview && (e.isLoaded || e.mergedPreviewVisible) ? (i(), y(k, t({
74
81
  key: 2,
75
82
  src: e.src
76
83
  }, e.previewProps, {
77
84
  visible: e.mergedPreviewVisible,
78
85
  "render-to-body": e.renderToBody,
79
86
  onClose: e.onPreviewClose
80
- }), {
81
- actions: v(() => [
82
- i(e.$slots, "preview-actions")
83
- ]),
84
- _: 3
85
- }, 16, ["src", "visible", "render-to-body", "onClose"])) : l("", !0)
87
+ }), w({ _: 2 }, [
88
+ e.$slots["preview-actions"] ? {
89
+ name: "actions",
90
+ fn: P(() => [
91
+ l(e.$slots, "preview-actions")
92
+ ]),
93
+ key: "0"
94
+ } : void 0
95
+ ]), 1040, ["src", "visible", "render-to-body", "onClose"])) : n("", !0)
86
96
  ], 6);
87
97
  }
88
- const z = /* @__PURE__ */ u(C, [["render", c]]);
98
+ const K = /* @__PURE__ */ u(C, [["render", L]]);
89
99
  export {
90
- z as default
100
+ K as default
91
101
  };
@@ -1,24 +1,24 @@
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
- import W from "../../icons/default/close-circle-fill.js";
3
- import X from "../../icons/animation/animation-loading.js";
4
- import Y from "./image-footer.vue.js";
5
- import Z from "./ImagePreview.vue.js";
6
- import $ from "./hooks/use-image-load-status.js";
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
- import ie from "../../_hooks/use-merge-state.js";
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({
1
+ import { defineComponent as q, toRefs as H, inject as J, ref as Q, computed as i, reactive as X, watch as C, nextTick as Y, onBeforeUnmount as Z } from "vue";
2
+ import $ from "../../icons/default/close-circle-fill.js";
3
+ import ee from "../../icons/animation/animation-loading.js";
4
+ import te from "./image-footer.vue.js";
5
+ import re from "./ImagePreview.vue.js";
6
+ import ie from "./hooks/use-image-load-status.js";
7
+ import { normalizeImageSizeProp as F } from "./utils/index.js";
8
+ import { omit as oe } from "../../_utils/omit.js";
9
+ import ae from "../../_hooks/use-merge-state.js";
10
+ import { PreviewGroupInjectionKey as le } from "./context.js";
11
+ import { isBoolean as ne } from "../../_utils/is.js";
12
+ import { getClassNameMixin as ue } from "../../_utils/config.js";
13
+ import { useLocale as se } from "../../locale/index.js";
14
+ let ve = 0;
15
+ const Le = q({
16
16
  name: "Image",
17
17
  components: {
18
- IconImageClose: W,
19
- IconLoading: X,
20
- ImageFooter: Y,
21
- ImagePreview: Z
18
+ IconImageClose: $,
19
+ IconLoading: ee,
20
+ ImageFooter: te,
21
+ ImagePreview: re
22
22
  },
23
23
  inheritAttrs: !1,
24
24
  props: {
@@ -140,15 +140,17 @@ const be = K({
140
140
  type: [String, Array, Object]
141
141
  }
142
142
  },
143
- emits: [
143
+ emits: {
144
144
  /**
145
145
  * @zh 预览的打开和关闭事件
146
146
  * @en Preview opening and closing events
147
147
  * @param {boolean} visible
148
148
  */
149
- "preview-visible-change",
150
- "update:previewVisible"
151
- ],
149
+ "preview-visible-change": (o) => !0,
150
+ "update:previewVisible": (o) => !0,
151
+ load: (o) => !0,
152
+ error: (o) => !0
153
+ },
152
154
  /**
153
155
  * @zh 自定义错误状态的图标
154
156
  * @en Customize the icon of error content.
@@ -169,92 +171,111 @@ const be = K({
169
171
  * @en Extra content at the bottom
170
172
  * @slot extra
171
173
  */
172
- setup(s, { attrs: u, slots: C, emit: o }) {
174
+ setup(o, { attrs: c, slots: j, emit: a }) {
173
175
  const {
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
- r.block,
176
+ height: p,
177
+ width: d,
178
+ hideFooter: g,
179
+ title: w,
180
+ description: y,
181
+ src: n,
182
+ footerPosition: s,
183
+ defaultPreviewVisible: k,
184
+ previewVisible: N,
185
+ preview: h,
186
+ previewProps: b
187
+ } = H(o), t = J(le, void 0), { t: z } = se(), l = ue("image"), v = Q(), { isLoaded: S, isError: P, isLoading: L, setLoadStatus: f } = ie(), m = i(() => ({
188
+ width: F(d == null ? void 0 : d.value),
189
+ height: F(p == null ? void 0 : p.value)
190
+ })), A = i(() => o.fit ? { objectFit: o.fit } : {}), E = i(() => [
191
+ l.block,
190
192
  {
191
- [r.element("loading")]: h.value,
192
- [r.element("loading-error")]: I.value,
193
+ [l.element("loading")]: L.value,
194
+ [l.element("loading-error")]: P.value,
193
195
  // isLoaded / showFooter 是 ref,这里必须解引用;
194
196
  // 直接写对象引用会让条件恒为真,没有 footer 的图片也带上定位类
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
+ [l.element("with-footer-inner")]: u.value && s.value === "inner",
198
+ [l.element("with-footer-outer")]: u.value && s.value === "outer"
199
+ },
200
+ c.class
201
+ ]), O = i(() => [
202
+ {
203
+ ...m.value,
204
+ height: u.value && s.value === "outer" ? void 0 : m.value.height
197
205
  },
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
+ c.style
207
+ ]), K = i(() => ({
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, B] = ae(
210
+ k.value,
211
+ X({
212
+ value: N
206
213
  })
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
- });
211
- const L = le++;
212
- if (e) {
213
- let l;
214
- J(
214
+ ), U = i(() => !(t != null && t.preview) && h.value), I = i(() => h.value && S.value);
215
+ C(
216
+ n,
217
+ (e) => {
218
+ f(e ? "loading" : "error"), Y(() => {
219
+ const r = v.value;
220
+ r != null && r.complete && r.naturalWidth > 0 && e === o.src && f("loaded");
221
+ });
222
+ },
223
+ { immediate: !0, flush: "sync" }
224
+ );
225
+ const V = ve++;
226
+ if (t) {
227
+ let e;
228
+ C(
215
229
  [() => {
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);
230
+ var r;
231
+ return (((r = b == null ? void 0 : b.value) == null ? void 0 : r.src) ?? (n == null ? void 0 : n.value)) || "";
232
+ }, h],
233
+ ([r, W]) => {
234
+ e = t.registerImageUrl(V, r, W);
221
235
  },
222
236
  { immediate: !0 }
223
- ), Q(() => l == null ? void 0 : l());
237
+ ), Z(() => e == null ? void 0 : e());
224
238
  }
225
- function M() {
226
- y("loaded");
239
+ function x(e) {
240
+ e.target !== v.value || !n.value || (f("loaded"), a("load", e));
227
241
  }
228
- function O() {
229
- y("error");
242
+ function D(e) {
243
+ e.target === v.value && (f("error"), a("error", e));
230
244
  }
231
- function R() {
232
- c.value && (e != null && e.preview ? e.preview(L) : (o("preview-visible-change", !0), o("update:previewVisible", !0), B(!0)));
245
+ function _() {
246
+ I.value && (t != null && t.preview ? t.preview(V) : (a("preview-visible-change", !0), a("update:previewVisible", !0), B(!0)));
247
+ }
248
+ function G(e) {
249
+ !I.value || e.key !== "Enter" && e.key !== " " || (e.preventDefault(), _());
233
250
  }
234
- function U() {
235
- o("preview-visible-change", !1), o("update:previewVisible", !1), B(!1);
251
+ function R() {
252
+ a("preview-visible-change", !1), a("update:previewVisible", !1), B(!1);
236
253
  }
237
254
  return {
238
- refImg: w,
239
- className: r,
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,
252
- onImgClick: R,
253
- onPreviewClose: U,
254
- fitStyle: N
255
+ t: z,
256
+ refImg: v,
257
+ className: l,
258
+ wrapperClassNames: E,
259
+ wrapperStyles: O,
260
+ overlayStyles: K,
261
+ showFooter: u,
262
+ imgProps: M,
263
+ imgStyle: m,
264
+ isLoaded: S,
265
+ isError: P,
266
+ isLoading: L,
267
+ mergedPreviewVisible: T,
268
+ mergePreview: U,
269
+ canOpenPreview: I,
270
+ onImgLoaded: x,
271
+ onImgLoadError: D,
272
+ onImgClick: _,
273
+ onImgKeydown: G,
274
+ onPreviewClose: R,
275
+ fitStyle: A
255
276
  };
256
277
  }
257
278
  });
258
279
  export {
259
- be as default
280
+ Le as default
260
281
  };
@@ -1,105 +1,118 @@
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 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
- import V from "../../_virtual/_plugin-vue_export-helper.js";
4
- const M = ["aria-label"], S = ["src"], A = ["aria-label"];
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, {
1
+ import L from "./ImagePreview.vue2.js";
2
+ import { resolveComponent as i, openBlock as s, createBlock as d, Teleport as I, createElementVNode as m, mergeProps as g, createVNode as t, Transition as u, withCtx as p, withDirectives as $, normalizeClass as l, vShow as N, createElementBlock as n, withModifiers as E, normalizeStyle as y, createCommentVNode as r, toDisplayString as v, renderSlot as P, normalizeProps as V } from "vue";
3
+ import A from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const D = ["aria-label", "aria-busy"], M = ["src", "alt", "aria-hidden"], S = ["aria-label"];
5
+ function B(e, a, T, W, z, K) {
6
+ const b = i("IconLoading"), k = i("IconImageClose"), f = i("PreviewToolbar"), w = i("IconClose"), C = i("PreviewArrow");
7
+ return e.mounted ? (s(), d(I, {
8
8
  key: 0,
9
9
  to: e.container || "body",
10
10
  disabled: e.teleportDisabled
11
11
  }, [
12
- d("div", {
13
- class: s(e.classNames),
14
- style: p(e.wrapperStyles)
15
- }, [
16
- t(g, {
12
+ m("div", g(e.rootAttrs, {
13
+ class: [e.classNames, e.$attrs.class],
14
+ style: [e.wrapperStyles, e.$attrs.style]
15
+ }), [
16
+ t(u, {
17
17
  name: "image-fade",
18
18
  onBeforeEnter: a[0] || (a[0] = (o) => o.parentElement && (o.parentElement.style.display = "block")),
19
19
  onAfterLeave: a[1] || (a[1] = (o) => o.parentElement && (o.parentElement.style.display = ""))
20
20
  }, {
21
- default: u(() => [
22
- C(d("div", {
23
- class: s(e.className.element("mask"))
21
+ default: p(() => [
22
+ $(m("div", {
23
+ class: l(e.className.element("mask"))
24
24
  }, null, 2), [
25
- [L, e.mergedVisible]
25
+ [N, e.mergedVisible]
26
26
  ])
27
27
  ]),
28
28
  _: 1
29
29
  }),
30
- e.mergedVisible ? (l(), r("div", {
30
+ e.mergedVisible ? (s(), n("div", {
31
31
  key: 0,
32
32
  ref: "refWrapper",
33
33
  tabindex: "0",
34
34
  role: "dialog",
35
35
  "aria-modal": "true",
36
- "aria-label": e.t("imagePreview.previewLabel", { index: 1, total: 1 }),
37
- class: s(e.className.element("wrapper")),
36
+ "aria-label": e.$attrs["aria-label"] || e.t("imagePreview.previewLabel", { index: 1, total: 1 }),
37
+ "aria-busy": e.isLoading || void 0,
38
+ class: l(e.className.element("wrapper")),
38
39
  onClick: a[6] || (a[6] = (...o) => e.onMaskClick && e.onMaskClick(...o)),
39
- onWheel: a[7] || (a[7] = N((...o) => e.onWheel && e.onWheel(...o), ["prevent", "stop"]))
40
+ onWheel: a[7] || (a[7] = E((...o) => e.onWheel && e.onWheel(...o), ["prevent", "stop"])),
41
+ onKeydown: a[8] || (a[8] = (...o) => e.onDialogKeydown && e.onDialogKeydown(...o))
40
42
  }, [
41
- d("div", {
42
- class: s(e.className.element("img-container")),
43
- style: p({ transform: `scale(${e.scale}, ${e.scale})` }),
43
+ m("div", {
44
+ class: l(e.className.element("img-container")),
45
+ style: y({ transform: `scale(${e.scale}, ${e.scale})` }),
44
46
  onClick: a[4] || (a[4] = (...o) => e.onMaskClick && e.onMaskClick(...o))
45
47
  }, [
46
- (l(), r("img", {
48
+ (s(), n("img", {
47
49
  ref: "refImage",
48
50
  key: e.src,
49
51
  src: e.src,
50
- class: s([
52
+ alt: e.t("imagePreview.openLabel"),
53
+ "aria-hidden": !e.isLoaded || void 0,
54
+ class: l([
51
55
  e.className.element("img"),
52
56
  {
53
57
  [e.className.modifier("img-moving")]: e.moving
54
58
  }
55
59
  ]),
56
- style: p({
57
- transform: `translate(${e.translate[0]}px, ${e.translate[1]}px) rotate(${e.rotate}deg)`
60
+ style: y({
61
+ transform: `translate(${e.translate[0]}px, ${e.translate[1]}px) rotate(${e.rotate}deg)`,
62
+ visibility: e.isLoaded ? "visible" : "hidden"
58
63
  }),
59
64
  onLoad: a[2] || (a[2] = (...o) => e.onImgLoad && e.onImgLoad(...o)),
60
65
  onError: a[3] || (a[3] = (...o) => e.onImgError && e.onImgError(...o))
61
- }, null, 46, S))
66
+ }, null, 46, M))
62
67
  ], 6),
63
- e.isLoading ? (l(), r("div", {
68
+ e.isLoading ? (s(), n("div", {
64
69
  key: 0,
65
- class: s(e.className.element("loading"))
70
+ class: l(e.className.element("loading"))
66
71
  }, [
67
- t(k)
68
- ], 2)) : n("", !0),
69
- t(g, { name: "image-fade" }, {
70
- default: u(() => [
71
- e.scaleValueVisible ? (l(), r("div", {
72
+ t(b)
73
+ ], 2)) : r("", !0),
74
+ e.isError ? (s(), n("div", {
75
+ key: 1,
76
+ class: l(e.className.element("error")),
77
+ role: "status"
78
+ }, [
79
+ t(k),
80
+ m("span", null, v(e.t("imagePreview.loadError")), 1)
81
+ ], 2)) : r("", !0),
82
+ t(u, { name: "image-fade" }, {
83
+ default: p(() => [
84
+ e.scaleValueVisible ? (s(), n("div", {
72
85
  key: 0,
73
- class: s(e.className.element("scale-value"))
74
- }, E((e.scale * 100).toFixed(0)) + "% ", 3)) : n("", !0)
86
+ class: l(e.className.element("scale-value"))
87
+ }, v((e.scale * 100).toFixed(0)) + "% ", 3)) : r("", !0)
75
88
  ]),
76
89
  _: 1
77
90
  }),
78
- e.isLoaded && e.actionsLayout.length ? (l(), m(y, {
79
- key: 1,
91
+ e.isLoaded && (e.actionsLayout.length || e.$slots.actions) ? (s(), d(f, {
92
+ key: 2,
80
93
  actions: e.actions,
81
94
  "actions-layout": e.actionsLayout
82
95
  }, {
83
- default: u(() => [
84
- I(e.$slots, "actions")
96
+ default: p(() => [
97
+ P(e.$slots, "actions")
85
98
  ]),
86
99
  _: 3
87
- }, 8, ["actions", "actions-layout"])) : n("", !0),
88
- e.closable ? (l(), r("button", {
89
- key: 2,
100
+ }, 8, ["actions", "actions-layout"])) : r("", !0),
101
+ e.closable ? (s(), n("button", {
102
+ key: 3,
90
103
  type: "button",
91
- class: s(e.className.element("close-btn")),
104
+ class: l(e.className.element("close-btn")),
92
105
  "aria-label": e.t("imagePreview.closeLabel"),
93
106
  onClick: a[5] || (a[5] = (...o) => e.onCloseClick && e.onCloseClick(...o))
94
107
  }, [
95
- t(f)
96
- ], 10, A)) : n("", !0),
97
- e.inGroup ? (l(), m(v, P($({ key: 3 }, e.groupArrowProps)), null, 16)) : n("", !0)
98
- ], 42, M)) : n("", !0)
99
- ], 6)
100
- ], 8, ["to", "disabled"])) : n("", !0);
108
+ t(w)
109
+ ], 10, S)) : r("", !0),
110
+ e.inGroup ? (s(), d(C, V(g({ key: 4 }, e.groupArrowProps)), null, 16)) : r("", !0)
111
+ ], 42, D)) : r("", !0)
112
+ ], 16)
113
+ ], 8, ["to", "disabled"])) : r("", !0);
101
114
  }
102
- const j = /* @__PURE__ */ V(b, [["render", B]]);
115
+ const q = /* @__PURE__ */ A(L, [["render", B]]);
103
116
  export {
104
- j as default
117
+ q as default
105
118
  };