x-next 1.1.0 → 1.3.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 (206) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/_hooks/use-form-item.d.ts +5 -0
  3. package/dist/_hooks/use-picker-focus.d.ts +17 -0
  4. package/dist/components/_components/feedback-icon/index.vue.d.ts +4 -4
  5. package/dist/components/_components/picker/input-range.vue.d.ts +10 -6
  6. package/dist/components/_components/picker/input.vue.d.ts +9 -5
  7. package/dist/components/alert/Alert.vue.d.ts +5 -5
  8. package/dist/components/alert/index.d.ts +10 -10
  9. package/dist/components/date-picker/DatePanel.vue.d.ts +5 -0
  10. package/dist/components/date-picker/DatePicker.vue.d.ts +36 -16
  11. package/dist/components/date-picker/index.d.ts +77 -33
  12. package/dist/components/dialog/Dialog.d.ts +1 -1
  13. package/dist/components/dialog/index.d.ts +3 -3
  14. package/dist/components/drawer/index.d.ts +3 -3
  15. package/dist/components/drawer/src/Drawer.vue.d.ts +1 -1
  16. package/dist/components/dropdown/Dropdown.vue.d.ts +30 -4
  17. package/dist/components/dropdown/DropdownButton.vue.d.ts +31 -5
  18. package/dist/components/dropdown/DropdownOption.vue.d.ts +2 -0
  19. package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +162 -5
  20. package/dist/components/dropdown/context.d.ts +14 -1
  21. package/dist/components/dropdown/dropdown-panel.vue.d.ts +7 -1
  22. package/dist/components/dropdown/index.d.ts +610 -28
  23. package/dist/components/dropdown/use-keyboard.d.ts +10 -0
  24. package/dist/components/form/FormItem.vue.d.ts +12 -4
  25. package/dist/components/form/context.d.ts +6 -0
  26. package/dist/components/form/form-item-label.vue.d.ts +4 -4
  27. package/dist/components/form/form-item-message.vue.d.ts +2 -0
  28. package/dist/components/form/index.d.ts +30 -8
  29. package/dist/components/form/interface.d.ts +2 -2
  30. package/dist/components/form-input/InputPassword.vue.d.ts +20 -2
  31. package/dist/components/form-input/index.d.ts +22 -4
  32. package/dist/components/form-select/Select.d.ts +3 -3
  33. package/dist/components/form-select/hooks/use-select.d.ts +2 -1
  34. package/dist/components/form-select/index.d.ts +6 -6
  35. package/dist/components/form-slider/Slider.vue.d.ts +10 -3
  36. package/dist/components/form-slider/index.d.ts +26 -6
  37. package/dist/components/form-slider/slider-button.vue.d.ts +4 -3
  38. package/dist/components/form-switch/Switch.vue.d.ts +2 -1
  39. package/dist/components/form-switch/index.d.ts +5 -2
  40. package/dist/components/form-textarea/Textarea.vue.d.ts +2 -2
  41. package/dist/components/form-textarea/index.d.ts +5 -5
  42. package/dist/components/image/Image.vue.d.ts +10 -9
  43. package/dist/components/image/ImagePreview.vue.d.ts +8 -7
  44. package/dist/components/image/ImagePreviewAction.d.ts +3 -3
  45. package/dist/components/image/ImagePreviewGroup.vue.d.ts +8 -7
  46. package/dist/components/image/index.d.ts +59 -52
  47. package/dist/components/image/preview-arrow.vue.d.ts +2 -2
  48. package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
  49. package/dist/components/layout/LayoutSidebar.vue.d.ts +2 -2
  50. package/dist/components/layout/index.d.ts +4 -4
  51. package/dist/components/link/Link.vue.d.ts +2 -2
  52. package/dist/components/link/index.d.ts +4 -4
  53. package/dist/components/menu/Menu.d.ts +2 -2
  54. package/dist/components/menu/base-menu.vue.d.ts +2 -2
  55. package/dist/components/menu/index.d.ts +4 -4
  56. package/dist/components/menu/sub-menu-pop.vue.d.ts +5 -5
  57. package/dist/components/message/index.d.ts +17 -17
  58. package/dist/components/message/message.vue.d.ts +8 -8
  59. package/dist/components/notification/Notification.d.ts +1 -1
  60. package/dist/components/notification/index.d.ts +3 -3
  61. package/dist/components/pagination/page-item-ellipsis.vue.d.ts +1 -1
  62. package/dist/components/pagination/page-item-step.vue.d.ts +2 -2
  63. package/dist/components/pagination/page-options.vue.d.ts +6 -6
  64. package/dist/components/popconfirm/src/popup.vue.d.ts +1 -1
  65. package/dist/components/popover/Popover.d.ts +1 -1
  66. package/dist/components/popover/index.d.ts +3 -3
  67. package/dist/components/popup/Popup.d.ts +1 -1
  68. package/dist/components/popup/index.d.ts +3 -3
  69. package/dist/components/progress/Progress.vue.d.ts +4 -4
  70. package/dist/components/progress/circle.vue.d.ts +2 -2
  71. package/dist/components/progress/index.d.ts +8 -8
  72. package/dist/components/progress/line.vue.d.ts +1 -1
  73. package/dist/components/progress/steps.vue.d.ts +1 -1
  74. package/dist/components/steps/Step.vue.d.ts +2 -2
  75. package/dist/components/steps/index.d.ts +4 -4
  76. package/dist/components/tabs/Tabs.d.ts +1 -1
  77. package/dist/components/tabs/index.d.ts +3 -3
  78. package/dist/components/tabs/tabs-tab.vue.d.ts +1 -1
  79. package/dist/components/tag/Tag.vue.d.ts +2 -2
  80. package/dist/components/tag/index.d.ts +4 -4
  81. package/dist/components/time-picker/TimeColumn.vue.d.ts +3 -0
  82. package/dist/components/time-picker/TimePanel.vue.d.ts +3 -0
  83. package/dist/components/time-picker/TimePicker.vue.d.ts +33 -17
  84. package/dist/components/time-picker/index.d.ts +73 -36
  85. package/dist/components/time-range-selector/TimeRangeSelector.vue.d.ts +8 -0
  86. package/dist/components/time-range-selector/index.d.ts +22 -0
  87. package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
  88. package/dist/components/tooltip/index.d.ts +3 -3
  89. package/dist/components/trigger/Trigger.d.ts +1 -1
  90. package/dist/components/trigger/index.d.ts +3 -3
  91. package/dist/es/_hooks/use-form-item.js +36 -10
  92. package/dist/es/_hooks/use-overflow.js +45 -40
  93. package/dist/es/_hooks/use-picker-focus.js +57 -0
  94. package/dist/es/_utils/constant.js +17 -5
  95. package/dist/es/components/_components/picker/input-range.vue.js +45 -55
  96. package/dist/es/components/_components/picker/input-range.vue2.js +105 -70
  97. package/dist/es/components/_components/picker/input.vue.js +22 -25
  98. package/dist/es/components/_components/picker/input.vue2.js +58 -43
  99. package/dist/es/components/_components/select-view/select-view.js +61 -66
  100. package/dist/es/components/date-picker/DatePanel.vue.js +102 -94
  101. package/dist/es/components/date-picker/DatePanel.vue2.js +97 -44
  102. package/dist/es/components/date-picker/DatePicker.vue.js +71 -58
  103. package/dist/es/components/date-picker/DatePicker.vue2.js +285 -231
  104. package/dist/es/components/dialog/Dialog.js +159 -128
  105. package/dist/es/components/dropdown/Dropdown.vue.js +18 -15
  106. package/dist/es/components/dropdown/Dropdown.vue2.js +52 -31
  107. package/dist/es/components/dropdown/DropdownOption.vue.js +22 -21
  108. package/dist/es/components/dropdown/DropdownOption.vue2.js +23 -19
  109. package/dist/es/components/dropdown/DropdownSubmenu.vue.js +49 -36
  110. package/dist/es/components/dropdown/DropdownSubmenu.vue2.js +45 -24
  111. package/dist/es/components/dropdown/context.js +3 -2
  112. package/dist/es/components/dropdown/dropdown-panel.vue.js +24 -21
  113. package/dist/es/components/dropdown/dropdown-panel.vue2.js +83 -31
  114. package/dist/es/components/dropdown/use-keyboard.js +45 -0
  115. package/dist/es/components/form/Form.vue2.js +113 -101
  116. package/dist/es/components/form/FormItem.vue.js +26 -22
  117. package/dist/es/components/form/FormItem.vue2.js +162 -125
  118. package/dist/es/components/form/form-item-message.vue.js +31 -24
  119. package/dist/es/components/form/form-item-message.vue2.js +4 -2
  120. package/dist/es/components/form-checkbox/Checkbox.js +80 -76
  121. package/dist/es/components/form-checkbox/CheckboxGroup.js +43 -38
  122. package/dist/es/components/form-input/Input.js +83 -79
  123. package/dist/es/components/form-input/InputPassword.vue.js +19 -16
  124. package/dist/es/components/form-input/InputPassword.vue2.js +39 -29
  125. package/dist/es/components/form-input/InputSearch.js +47 -37
  126. package/dist/es/components/form-input-number/InputNumber.js +134 -133
  127. package/dist/es/components/form-input-tag/InputTag.js +173 -162
  128. package/dist/es/components/form-radio/Radio.js +74 -71
  129. package/dist/es/components/form-radio/RadioGroup.js +55 -49
  130. package/dist/es/components/form-select/Select.js +116 -114
  131. package/dist/es/components/form-select/hooks/use-select.js +128 -128
  132. package/dist/es/components/form-slider/Slider.vue.js +28 -28
  133. package/dist/es/components/form-slider/Slider.vue2.js +139 -132
  134. package/dist/es/components/form-slider/slider-button.vue.js +6 -6
  135. package/dist/es/components/form-slider/slider-button.vue2.js +39 -34
  136. package/dist/es/components/form-switch/Switch.vue.js +9 -9
  137. package/dist/es/components/form-switch/Switch.vue2.js +81 -74
  138. package/dist/es/components/form-textarea/Textarea.vue2.js +123 -108
  139. package/dist/es/components/image/Image.vue2.js +77 -76
  140. package/dist/es/components/image/ImagePreview.vue.js +13 -12
  141. package/dist/es/components/image/ImagePreview.vue2.js +141 -136
  142. package/dist/es/components/image/ImagePreviewGroup.vue.js +1 -1
  143. package/dist/es/components/image/ImagePreviewGroup.vue2.js +82 -83
  144. package/dist/es/components/rate/Rate.js +106 -103
  145. package/dist/es/components/time-picker/TimeColumn.vue.js +34 -23
  146. package/dist/es/components/time-picker/TimeColumn.vue2.js +37 -28
  147. package/dist/es/components/time-picker/TimePicker.vue.js +83 -64
  148. package/dist/es/components/time-picker/TimePicker.vue2.js +192 -156
  149. package/dist/es/components/time-range-selector/TimeRangeSelector.vue.js +327 -193
  150. package/dist/es/locale/en-US.js +6 -0
  151. package/dist/es/locale/zh-CN.js +6 -0
  152. package/dist/es/style.css +1 -1
  153. package/dist/icons/_self/down.d.ts +1 -1
  154. package/dist/icons/_self/dropdown/more.d.ts +1 -1
  155. package/dist/icons/_self/empty-better.d.ts +1 -1
  156. package/dist/icons/_self/empty.d.ts +1 -1
  157. package/dist/icons/_self/eye-invisible.d.ts +1 -1
  158. package/dist/icons/_self/eye.d.ts +1 -1
  159. package/dist/icons/_self/full-screen.d.ts +1 -1
  160. package/dist/icons/_self/left.d.ts +1 -1
  161. package/dist/icons/_self/menu/down.d.ts +1 -1
  162. package/dist/icons/_self/minus.d.ts +1 -1
  163. package/dist/icons/_self/more-dot.d.ts +1 -1
  164. package/dist/icons/_self/next.d.ts +1 -1
  165. package/dist/icons/_self/original-size.d.ts +1 -1
  166. package/dist/icons/_self/plus.d.ts +1 -1
  167. package/dist/icons/_self/prev.d.ts +1 -1
  168. package/dist/icons/_self/question-message.d.ts +1 -1
  169. package/dist/icons/_self/right.d.ts +1 -1
  170. package/dist/icons/_self/rotate-left.d.ts +1 -1
  171. package/dist/icons/_self/rotate-right.d.ts +1 -1
  172. package/dist/icons/_self/search.d.ts +1 -1
  173. package/dist/icons/_self/up.d.ts +1 -1
  174. package/dist/icons/_self/zoom-in.d.ts +1 -1
  175. package/dist/icons/_self/zoom-out.d.ts +1 -1
  176. package/dist/icons/_ui/alone-left.d.ts +1 -1
  177. package/dist/icons/_ui/alone-margin-left.d.ts +1 -1
  178. package/dist/icons/_ui/alone-margin-right.d.ts +1 -1
  179. package/dist/icons/_ui/alone-right.d.ts +1 -1
  180. package/dist/icons/_ui/calendar.d.ts +1 -1
  181. package/dist/icons/_ui/time.d.ts +1 -1
  182. package/dist/icons/animation/animation-loading.d.ts +1 -1
  183. package/dist/icons/default/check-circle-fill.d.ts +1 -1
  184. package/dist/icons/default/check.d.ts +1 -1
  185. package/dist/icons/default/close-circle-fill.d.ts +1 -1
  186. package/dist/icons/default/close.d.ts +1 -1
  187. package/dist/icons/default/exclamation-circle-fill.d.ts +1 -1
  188. package/dist/icons/default/exclamation.d.ts +1 -1
  189. package/dist/icons/default/filter.d.ts +1 -1
  190. package/dist/icons/default/info-circle-fill.d.ts +1 -1
  191. package/dist/icons/default/link.d.ts +1 -1
  192. package/dist/icons/default/logo-simple.d.ts +1 -1
  193. package/dist/icons/default/minus-circle-fill.d.ts +1 -1
  194. package/dist/icons/icon.d.ts +2 -2
  195. package/dist/icons/index.d.ts +3 -3
  196. package/dist/index.cjs +4 -4
  197. package/dist/index.d.ts +1 -1
  198. package/dist/index.umd.js +4 -4
  199. package/dist/locale/interface.d.ts +6 -0
  200. package/dist/style/base.css +1 -1
  201. package/dist/style/date-picker.css +1 -1
  202. package/dist/style/form.css +1 -1
  203. package/dist/style/image.css +1 -1
  204. package/dist/style/time-range-selector.css +1 -1
  205. package/dist/style.css +1 -1
  206. package/package.json +2 -2
@@ -1,18 +1,18 @@
1
- import { defineComponent as q, toRefs as D, inject as H, ref as J, computed as i, reactive as Q, watchEffect as F } from "vue";
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 x } from "../../_utils/dom.js";
8
- import { normalizeImageSizeProp as j } from "./utils/index.js";
9
- import { omit as ee } from "../../_utils/omit.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
10
  import ie from "../../_hooks/use-merge-state.js";
11
- import { PreviewGroupInjectionKey as te } from "./context.js";
12
- import { isBoolean as re } from "../../_utils/is.js";
13
- import { getClassNameMixin as oe } from "../../_utils/config.js";
14
- let ae = 0;
15
- const Se = q({
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(a, { attrs: l, slots: N, emit: y }) {
172
+ setup(s, { attrs: u, slots: C, emit: o }) {
173
173
  const {
174
- height: n,
175
- width: s,
176
- hideFooter: m,
177
- title: u,
178
- description: f,
179
- src: t,
180
- footerPosition: S,
181
- defaultPreviewVisible: z,
182
- previewVisible: A,
183
- preview: v,
184
- previewProps: p
185
- } = D(a), e = H(te, void 0), r = oe("image"), c = J(), { isLoaded: o, isError: b, isLoading: I, setLoadStatus: d } = $(), h = i(() => ({
186
- width: j(s == null ? void 0 : s.value),
187
- height: j(n == null ? void 0 : n.value)
188
- })), E = i(() => a.fit ? { objectFit: a.fit } : {}), _ = i(() => [
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")]: I.value,
192
- [r.element("loading-error")]: b.value,
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")]: o.value && g.value && S.value === "inner",
196
- [r.element("with-footer-outer")]: o.value && g.value && S.value === "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
- l.class
199
- ]), k = i(() => [
200
- h.value,
201
- l.style
202
- ]), g = i(() => u != null && u.value || f != null && f.value || N.extra ? re(m.value) ? !m.value && o.value : m.value === "never" : !1), C = i(() => ee(l, ["class", "style"])), [M, P] = ie(
203
- z.value,
204
- Q({
205
- value: A
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
- ), O = i(() => !(e != null && e.preview) && v.value);
208
- F(() => {
209
- x || !c.value || (c.value.src = t == null ? void 0 : t.value, d("loading"));
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 = ae++;
212
- F((U) => {
213
- var B, V;
214
- const w = (V = e == null ? void 0 : e.registerImageUrl) == null ? void 0 : V.call(
215
- e,
216
- L,
217
- (((B = p == null ? void 0 : p.value) == null ? void 0 : B.src) ?? (t == null ? void 0 : t.value)) || "",
218
- v.value
219
- );
220
- U(() => {
221
- w == null || w();
222
- });
223
- });
224
- function G() {
225
- d("loaded");
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 K() {
228
- d("error");
228
+ function O() {
229
+ y("error");
229
230
  }
230
231
  function R() {
231
- v.value && (e != null && e.preview ? e.preview(L) : (y("preview-visible-change", !0), P(!0)));
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 T() {
234
- y("preview-visible-change", !1), P(!1);
234
+ function U() {
235
+ o("preview-visible-change", !1), o("update:previewVisible", !1), B(!1);
235
236
  }
236
237
  return {
237
- refImg: c,
238
+ refImg: w,
238
239
  className: r,
239
- wrapperClassNames: _,
240
- wrapperStyles: k,
241
- showFooter: g,
242
- imgProps: C,
243
- imgStyle: h,
244
- isLoaded: o,
245
- isError: b,
246
- isLoading: I,
247
- mergedPreviewVisible: M,
248
- mergePreview: O,
249
- onImgLoaded: G,
250
- onImgLoadError: K,
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: T,
253
- fitStyle: E
253
+ onPreviewClose: U,
254
+ fitStyle: N
254
255
  };
255
256
  }
256
257
  });
257
258
  export {
258
- Se as default
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 u, withCtx as g, 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";
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, c, z) {
6
- const k = i("IconLoading"), f = i("PreviewToolbar"), y = i("IconClose"), v = i("PreviewArrow");
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(u, {
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: g(() => [
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(u, { name: "image-fade" }, {
69
- default: g(() => [
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(f, {
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: g(() => [
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(y)
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 le, toRefs as ie, ref as p, reactive as k, computed as v, watch as re, onBeforeUnmount as se, h as m, nextTick as ue } from "vue";
2
- import ce from "../../_hooks/use-merge-state.js";
3
- import { useLocale as me } from "../../locale/index.js";
4
- import { getClassNameMixin as fe } from "../../_utils/config.js";
5
- import { throttleByRaf as de } from "../../_utils/throttle-by-raf.js";
6
- import { KEYBOARD_KEY as f } from "../../_utils/keyboard.js";
7
- import { isServerRendering as z, on as pe, off as ve } from "../../_utils/dom.js";
8
- import ge from "./preview-arrow.vue.js";
9
- import ye from "./preview-toolbar.vue.js";
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 be from "./hooks/use-image-drag.js";
12
- import ke from "../../icons/animation/animation-loading.js";
13
- import Se from "../../icons/default/close.js";
14
- import he from "../../icons/_self/zoom-out.js";
15
- import Re from "../../icons/_self/zoom-in.js";
16
- import Ie from "../../icons/_self/full-screen.js";
17
- import Ce from "../../icons/_self/rotate-left.js";
18
- import Pe from "../../icons/_self/rotate-right.js";
19
- import ze from "../../icons/_self/original-size.js";
20
- import Te from "../../_hooks/use-popup-overflow-hidden.js";
21
- import Oe from "../../_hooks/use-popup-container.js";
22
- import Le, { getScaleByRate as Ae, maxScale as Be, minScale as Ee } from "./utils/get-scale.js";
23
- import xe from "../../_hooks/use-popup-manager.js";
24
- const T = 90, no = /* @__PURE__ */ le({
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: ge,
28
- PreviewToolbar: ye,
29
- IconLoading: ke,
30
- IconClose: Se
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: s
160
- } = me(), {
161
- src: x,
162
- popupContainer: N,
163
- visible: D,
164
- defaultVisible: _,
165
- maskClosable: V,
166
- actionsLayout: K,
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: M
169
- } = ie(n), l = p(), S = p(), h = fe("image-preview"), [r, G] = ce(_.value, k({
170
- value: D
171
- })), U = v(() => [h.block, {
172
- [h.modifier("hide")]: !r.value
173
- }]), W = z ? void 0 : document.body, u = Oe(W, k({
174
- popupContainer: N
175
- })), Z = v(() => !z && u.value === document.body), F = v(() => z || !n.renderToBody || !u.value), {
176
- zIndex: H
177
- } = xe("dialog", {
178
- visible: r
179
- }), Y = v(() => ({
180
- ...Z.value ? {
181
- zIndex: H.value,
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: j,
189
- isLoaded: X,
192
+ isLoading: q,
193
+ isLoaded: J,
190
194
  setLoadStatus: R
191
- } = we(), c = p(0), t = p(L.value), {
195
+ } = we(), c = m(0), t = m(L.value), {
192
196
  translate: g,
193
- moving: q,
194
- resetTranslate: J
195
- } = be(k({
196
- wrapperEl: l,
197
+ moving: Q,
198
+ resetTranslate: $
199
+ } = ke(k({
200
+ wrapperEl: s,
197
201
  imageEl: S,
198
- visible: r,
202
+ visible: i,
199
203
  scale: t
200
- })), y = p(!1);
204
+ })), y = m(!1);
201
205
  let I = null;
202
- const Q = () => {
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
- Te(k({
211
+ Oe(k({
208
212
  container: u,
209
- hidden: r
213
+ hidden: i
210
214
  }));
211
- function $() {
212
- c.value = 0, t.value = L.value, J();
215
+ function oe() {
216
+ c.value = 0, t.value = L.value, $();
213
217
  }
214
- const C = (e) => K.value.includes(e), A = (e) => {
215
- const o = e.target, i = o && ["BUTTON", "A", "INPUT", "TEXTAREA", "SELECT"].includes(o.tagName);
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 f.ESC:
222
+ case d.ESC:
219
223
  n.escToClose && (P(), a = !0);
220
224
  break;
221
- case f.ARROW_LEFT:
225
+ case d.ARROW_LEFT:
222
226
  n.groupArrowProps.onPrev && (n.groupArrowProps.onPrev(), a = !0);
223
227
  break;
224
- case f.ARROW_RIGHT:
228
+ case d.ARROW_RIGHT:
225
229
  n.groupArrowProps.onNext && (n.groupArrowProps.onNext(), a = !0);
226
230
  break;
227
- case f.ARROW_UP:
228
- C("zoomIn") && !i && (b("zoomIn"), a = !0);
231
+ case d.ARROW_UP:
232
+ C("zoomIn") && !l && (w("zoomIn"), a = !0);
229
233
  break;
230
- case f.ARROW_DOWN:
231
- C("zoomOut") && !i && (b("zoomOut"), a = !0);
234
+ case d.ARROW_DOWN:
235
+ C("zoomOut") && !l && (w("zoomOut"), a = !0);
232
236
  break;
233
- case f.SPACE:
234
- C("originalSize") && !i && (d(1), a = !0);
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
- }, ee = de((e) => {
242
+ }, te = ve((e) => {
239
243
  if (e.preventDefault(), e.stopPropagation(), !n.wheelZoom) return;
240
- const i = (e.deltaY || e.deltaX) > 0 ? "zoomOut" : "zoomIn", a = Ae(t.value, M.value, i);
241
- d(a);
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
- let w = !1;
244
- const oe = () => {
245
- ue(() => {
246
- var e;
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
- re([x, r], () => {
253
- r.value ? ($(), R("loading"), oe()) : B();
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
- r.value && (O("close"), O("update:visible", !1), G(!1));
262
+ i.value && (O("close"), O("update:visible", !1), U(!1));
259
263
  }
260
- function te(e) {
264
+ function ne(e) {
261
265
  var o;
262
- (o = l == null ? void 0 : l.value) == null || o.focus(), V.value && e.target === e.currentTarget && P();
266
+ (o = s == null ? void 0 : s.value) == null || o.focus(), M.value && e.target === e.currentTarget && P();
263
267
  }
264
- function d(e) {
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, Q();
271
+ g.value = [g.value[0] * o / e, g.value[1] * o / e], t.value = e, ee();
268
272
  }
269
273
  }
270
- function ae() {
271
- const e = l.value.getBoundingClientRect(), o = S.value.getBoundingClientRect(), i = e.height / (o.height / t.value), a = e.width / (o.width / t.value), ne = Math.max(i, a);
272
- d(ne);
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 E(e) {
275
- const i = e === "clockwise" ? (c.value + T) % 360 : c.value === 0 ? 360 - T : c.value - T;
276
- c.value = i;
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 b(e) {
279
- const o = Le(t.value, e);
280
- d(o);
282
+ function w(e) {
283
+ const o = Ae(t.value, e);
284
+ v(o);
281
285
  }
282
- return se(() => {
283
- B();
286
+ return ce(() => {
287
+ E();
284
288
  }), {
285
- t: s,
289
+ t: r,
286
290
  className: h,
287
- classNames: U,
291
+ classNames: Z,
288
292
  container: u,
289
- teleportDisabled: F,
290
- wrapperStyles: Y,
293
+ teleportDisabled: Y,
294
+ wrapperStyles: X,
291
295
  scale: t,
292
296
  translate: g,
293
297
  rotate: c,
294
- moving: q,
295
- mergedVisible: r,
296
- isLoading: j,
297
- isLoaded: X,
298
+ moving: Q,
299
+ mergedVisible: i,
300
+ isLoading: q,
301
+ isLoaded: J,
298
302
  scaleValueVisible: y,
299
- refWrapper: l,
303
+ refWrapper: s,
300
304
  refImage: S,
301
- onWheel: ee,
302
- onMaskClick: te,
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: v(() => [
315
+ actions: p(() => [
311
316
  /** 满屏 */
312
317
  {
313
318
  key: "fullScreen",
314
- name: s("imagePreview.fullscreen"),
315
- content: () => m(Ie),
316
- onClick: () => ae()
319
+ name: r("imagePreview.fullscreen"),
320
+ content: () => f(Ce),
321
+ onClick: () => le()
317
322
  },
318
323
  /** 顺时针旋转 */
319
324
  {
320
325
  key: "rotateRight",
321
- name: s("imagePreview.rotateRight"),
322
- content: () => m(Pe),
323
- onClick: () => E("clockwise")
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: s("imagePreview.rotateLeft"),
329
- content: () => m(Ce),
330
- onClick: () => E("counterclockwise")
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: s("imagePreview.zoomIn"),
336
- content: () => m(Re),
337
- onClick: () => b("zoomIn"),
338
- disabled: t.value === Be
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: s("imagePreview.zoomOut"),
344
- content: () => m(he),
345
- onClick: () => b("zoomOut"),
346
- disabled: t.value === Ee
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: s("imagePreview.originalSize"),
352
- content: () => m(ze),
353
- onClick: () => d(1)
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
- no as default
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,