x-next 1.5.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 (171) hide show
  1. package/AI_USAGE.md +57 -4
  2. package/CHANGELOG.md +72 -0
  3. package/dist/_utils/color.d.ts +53 -0
  4. package/dist/components/color-picker/ColorPicker.d.ts +239 -0
  5. package/dist/components/color-picker/gradient-slider.d.ts +52 -0
  6. package/dist/components/color-picker/index.d.ts +238 -0
  7. package/dist/components/color-picker/panel.d.ts +721 -0
  8. package/dist/components/color-picker/sv-panel.d.ts +48 -0
  9. package/dist/components/date-picker/DatePicker.vue.d.ts +3 -3
  10. package/dist/components/date-picker/index.d.ts +6 -6
  11. package/dist/components/draggable/Draggable.d.ts +1 -1
  12. package/dist/components/draggable/index.d.ts +2 -2
  13. package/dist/components/drawer/index.d.ts +6 -6
  14. package/dist/components/drawer/src/Drawer.vue.d.ts +3 -3
  15. package/dist/components/dropdown/Dropdown.vue.d.ts +34 -4
  16. package/dist/components/dropdown/DropdownButton.vue.d.ts +35 -5
  17. package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +34 -4
  18. package/dist/components/dropdown/dropdown-panel.vue.d.ts +30 -0
  19. package/dist/components/dropdown/index.d.ts +209 -29
  20. package/dist/components/form/FormItem.vue.d.ts +12 -12
  21. package/dist/components/form/form-item-label.vue.d.ts +3 -3
  22. package/dist/components/form/index.d.ts +24 -24
  23. package/dist/components/form-select/Select.d.ts +3 -3
  24. package/dist/components/form-select/SelectDropdown.vue.d.ts +30 -0
  25. package/dist/components/form-select/index.d.ts +66 -6
  26. package/dist/components/form-slider/Slider.vue.d.ts +3 -3
  27. package/dist/components/form-slider/index.d.ts +6 -6
  28. package/dist/components/form-slider/slider-button.vue.d.ts +3 -3
  29. package/dist/components/grid/Row.vue.d.ts +3 -3
  30. package/dist/components/grid/index.d.ts +9 -9
  31. package/dist/components/heatmap/Heatmap.d.ts +311 -0
  32. package/dist/components/heatmap/helpers/matrix.d.ts +58 -0
  33. package/dist/components/heatmap/index.d.ts +372 -0
  34. package/dist/components/heatmap/interface.d.ts +57 -0
  35. package/dist/components/image/Image.vue.d.ts +125 -17
  36. package/dist/components/image/ImagePreview.vue.d.ts +97 -7
  37. package/dist/components/image/ImagePreviewAction.d.ts +3 -3
  38. package/dist/components/image/ImagePreviewGroup.vue.d.ts +100 -7
  39. package/dist/components/image/hooks/use-image-drag.d.ts +2 -2
  40. package/dist/components/image/index.d.ts +712 -124
  41. package/dist/components/image/interface.d.ts +9 -1
  42. package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
  43. package/dist/components/index.d.ts +3 -0
  44. package/dist/components/menu/sub-menu-pop.vue.d.ts +3 -3
  45. package/dist/components/network/Network.vue.d.ts +1 -1
  46. package/dist/components/network/index.d.ts +3 -3
  47. package/dist/components/network/utils.d.ts +2 -0
  48. package/dist/components/pagination/page-item-ellipsis.vue.d.ts +9 -0
  49. package/dist/components/pagination/page-jumper.vue.d.ts +6 -0
  50. package/dist/components/pagination/page-options.vue.d.ts +6 -6
  51. package/dist/components/popconfirm/src/popup.vue.d.ts +3 -3
  52. package/dist/components/popover/Popover.d.ts +1 -1
  53. package/dist/components/popover/index.d.ts +3 -3
  54. package/dist/components/popup/Popup.d.ts +1 -1
  55. package/dist/components/popup/index.d.ts +3 -3
  56. package/dist/components/skeleton/SkeletonShape.vue.d.ts +3 -3
  57. package/dist/components/skeleton/index.d.ts +6 -6
  58. package/dist/components/space/Space.d.ts +1 -1
  59. package/dist/components/space/index.d.ts +3 -3
  60. package/dist/components/spin/Spin.d.ts +38 -0
  61. package/dist/components/spin/index.d.ts +30 -0
  62. package/dist/components/table/Table.d.ts +1 -1
  63. package/dist/components/table/index.d.ts +3 -3
  64. package/dist/components/tabs/Tabs.d.ts +1 -1
  65. package/dist/components/tabs/index.d.ts +3 -3
  66. package/dist/components/time-picker/TimePicker.vue.d.ts +3 -3
  67. package/dist/components/time-picker/index.d.ts +6 -6
  68. package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
  69. package/dist/components/tooltip/index.d.ts +3 -3
  70. package/dist/components/trigger/Trigger.d.ts +1 -1
  71. package/dist/components/trigger/index.d.ts +3 -3
  72. package/dist/components/upload/Upload.d.ts +372 -0
  73. package/dist/components/upload/context.d.ts +28 -0
  74. package/dist/components/upload/index.d.ts +656 -0
  75. package/dist/components/upload/interface.d.ts +110 -0
  76. package/dist/components/upload/props.d.ts +321 -0
  77. package/dist/components/upload/upload-list-item.d.ts +15 -0
  78. package/dist/components/upload/upload-list.d.ts +11 -0
  79. package/dist/components/upload/upload-picture-item.d.ts +20 -0
  80. package/dist/components/upload/upload-trigger.d.ts +8 -0
  81. package/dist/components/upload/utils.d.ts +48 -0
  82. package/dist/components/watermark/Watermark.d.ts +1 -1
  83. package/dist/components/watermark/index.d.ts +3 -3
  84. package/dist/es/_styles/palette-aliases.js +10 -4
  85. package/dist/es/_utils/color.js +73 -0
  86. package/dist/es/components/button/Button.js +2 -2
  87. package/dist/es/components/color-picker/ColorPicker.js +239 -0
  88. package/dist/es/components/color-picker/gradient-slider.js +79 -0
  89. package/dist/es/components/color-picker/index.js +8 -0
  90. package/dist/es/components/color-picker/panel.js +307 -0
  91. package/dist/es/components/color-picker/sv-panel.js +99 -0
  92. package/dist/es/components/dropdown/dropdown-panel.vue.js +17 -17
  93. package/dist/es/components/form-input/Input.js +7 -7
  94. package/dist/es/components/form-input/InputPassword.vue2.js +2 -2
  95. package/dist/es/components/form-input/InputSearch.js +2 -2
  96. package/dist/es/components/form-input-number/InputNumber.js +12 -12
  97. package/dist/es/components/heatmap/Heatmap.js +334 -0
  98. package/dist/es/components/heatmap/helpers/matrix.js +106 -0
  99. package/dist/es/components/heatmap/index.js +8 -0
  100. package/dist/es/components/image/Image.vue.js +55 -45
  101. package/dist/es/components/image/Image.vue2.js +113 -92
  102. package/dist/es/components/image/ImagePreview.vue.js +66 -53
  103. package/dist/es/components/image/ImagePreview.vue2.js +219 -171
  104. package/dist/es/components/image/ImagePreviewAction.js +12 -15
  105. package/dist/es/components/image/ImagePreviewGroup.vue.js +21 -20
  106. package/dist/es/components/image/ImagePreviewGroup.vue2.js +45 -39
  107. package/dist/es/components/image/hooks/use-image-drag.js +16 -14
  108. package/dist/es/components/index.js +123 -117
  109. package/dist/es/components/menu/sub-menu-pop.vue2.js +12 -12
  110. package/dist/es/components/network/Network.vue2.js +72 -72
  111. package/dist/es/components/network/utils.js +44 -35
  112. package/dist/es/components/pagination/Pagination.js +113 -104
  113. package/dist/es/components/pagination/page-item-ellipsis.vue.js +13 -12
  114. package/dist/es/components/pagination/page-item-ellipsis.vue2.js +19 -15
  115. package/dist/es/components/pagination/page-jumper.vue.js +13 -12
  116. package/dist/es/components/pagination/page-jumper.vue2.js +7 -4
  117. package/dist/es/components/pagination/page-options.vue.js +4 -3
  118. package/dist/es/components/pagination/page-options.vue2.js +17 -15
  119. package/dist/es/components/skeleton/Skeleton.vue.js +11 -9
  120. package/dist/es/components/skeleton/SkeletonLine.vue.js +9 -8
  121. package/dist/es/components/skeleton/SkeletonShape.vue.js +8 -7
  122. package/dist/es/components/spin/Spin.js +124 -60
  123. package/dist/es/components/table/Table.js +3 -1
  124. package/dist/es/components/trigger/Trigger.js +19 -19
  125. package/dist/es/components/upload/Upload.js +420 -0
  126. package/dist/es/components/upload/context.js +4 -0
  127. package/dist/es/components/upload/index.js +8 -0
  128. package/dist/es/components/upload/props.js +321 -0
  129. package/dist/es/components/upload/upload-list-item.js +138 -0
  130. package/dist/es/components/upload/upload-list.js +48 -0
  131. package/dist/es/components/upload/upload-picture-item.js +109 -0
  132. package/dist/es/components/upload/upload-trigger.js +89 -0
  133. package/dist/es/components/upload/utils.js +195 -0
  134. package/dist/es/icons/_self/empty-better.js +25 -8
  135. package/dist/es/icons/_self/upload-icons.js +103 -0
  136. package/dist/es/index.js +168 -162
  137. package/dist/es/locale/en-US.js +39 -1
  138. package/dist/es/locale/zh-CN.js +39 -1
  139. package/dist/es/style.css +1 -1
  140. package/dist/icons/_self/upload-icons.d.ts +523 -0
  141. package/dist/index.cjs +4 -4
  142. package/dist/index.umd.js +4 -4
  143. package/dist/locale/interface.d.ts +60 -0
  144. package/dist/style/base.css +1 -1
  145. package/dist/style/button.css +1 -1
  146. package/dist/style/color-picker.css +1 -0
  147. package/dist/style/color-picker.js +2 -0
  148. package/dist/style/date-picker.css +1 -1
  149. package/dist/style/empty.css +1 -1
  150. package/dist/style/form-checkbox.css +1 -1
  151. package/dist/style/form-input-tag.css +1 -1
  152. package/dist/style/form-input.css +1 -1
  153. package/dist/style/form-radio.css +1 -1
  154. package/dist/style/form-textarea.css +1 -1
  155. package/dist/style/form.css +1 -1
  156. package/dist/style/heatmap.css +1 -0
  157. package/dist/style/heatmap.js +2 -0
  158. package/dist/style/image.css +1 -1
  159. package/dist/style/menu.css +1 -1
  160. package/dist/style/pagination.css +1 -1
  161. package/dist/style/skeleton.css +1 -1
  162. package/dist/style/spin.css +1 -1
  163. package/dist/style/steps.css +1 -1
  164. package/dist/style/table.css +1 -1
  165. package/dist/style/upload.css +1 -0
  166. package/dist/style/upload.js +2 -0
  167. package/dist/style.css +1 -1
  168. package/dist/types.d.ts +3 -0
  169. package/package.json +1 -1
  170. package/volar.d.ts +3 -0
  171. package/dist/es/_hooks/use-popup-overflow-hidden.js +0 -29
@@ -1,33 +1,36 @@
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
- import we from "./hooks/use-image-load-status.js";
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({
1
+ import { defineComponent as Se, toRefs as he, ref as g, onMounted as we, reactive as D, computed as y, watch as k, nextTick as ke, onBeforeUnmount as Ce, h as b } from "vue";
2
+ import Ie from "../../_hooks/use-merge-state.js";
3
+ import { useLocale as Re } from "../../locale/index.js";
4
+ import { getClassNameMixin as Te } from "../../_utils/config.js";
5
+ import { throttleByRaf as Oe } from "../../_utils/throttle-by-raf.js";
6
+ import { KEYBOARD_KEY as c } from "../../_utils/keyboard.js";
7
+ import { isServerRendering as m, on as ze, off as Ae } from "../../_utils/dom.js";
8
+ import Pe from "./preview-arrow.vue.js";
9
+ import Ee from "./preview-toolbar.vue.js";
10
+ import Ne from "./hooks/use-image-load-status.js";
11
+ import Be from "./hooks/use-image-drag.js";
12
+ import Le from "../../icons/animation/animation-loading.js";
13
+ import xe from "../../icons/default/close.js";
14
+ import De from "../../icons/default/close-circle-fill.js";
15
+ import _e from "../../icons/_self/zoom-out.js";
16
+ import Me from "../../icons/_self/zoom-in.js";
17
+ import Ve from "../../icons/_self/full-screen.js";
18
+ import Fe from "../../icons/_self/rotate-left.js";
19
+ import Ke from "../../icons/_self/rotate-right.js";
20
+ import Ue from "../../icons/_self/original-size.js";
21
+ import { useOverflow as We } from "../../_hooks/use-overflow.js";
22
+ import je from "../../_hooks/use-popup-container.js";
23
+ import Ze, { getScaleByRate as He, maxScale as Y, minScale as G } from "./utils/get-scale.js";
24
+ import Ye from "../../_hooks/use-popup-manager.js";
25
+ const _ = 90, bt = /* @__PURE__ */ Se({
25
26
  name: "ImagePreview",
27
+ inheritAttrs: !1,
26
28
  components: {
27
- PreviewArrow: ye,
28
- PreviewToolbar: be,
29
- IconLoading: Se,
30
- IconClose: he
29
+ PreviewArrow: Pe,
30
+ PreviewToolbar: Ee,
31
+ IconLoading: Le,
32
+ IconClose: xe,
33
+ IconImageClose: De
31
34
  },
32
35
  props: {
33
36
  renderToBody: {
@@ -152,215 +155,260 @@ const T = 90, lo = /* @__PURE__ */ re({
152
155
  * @slot actions
153
156
  * @version 2.17.0
154
157
  */
155
- setup(n, {
156
- emit: O
158
+ setup(r, {
159
+ attrs: X,
160
+ emit: M
157
161
  }) {
158
162
  const {
159
- t: r
160
- } = fe(), {
161
- src: D,
162
- popupContainer: _,
163
- visible: V,
164
- defaultVisible: K,
165
- maskClosable: M,
166
- actionsLayout: W,
167
- defaultScale: L,
168
- zoomRate: G
169
- } = se(n), s = m(), S = m(), A = m(!1);
170
- ue(() => {
171
- A.value = !0;
163
+ t: u
164
+ } = Re(), {
165
+ src: V,
166
+ popupContainer: q,
167
+ visible: J,
168
+ defaultVisible: Q,
169
+ maskClosable: $,
170
+ actionsLayout: ee,
171
+ defaultScale: F,
172
+ zoomRate: O
173
+ } = he(r), l = g(), f = g(), K = g(!1);
174
+ we(() => {
175
+ K.value = !0;
172
176
  });
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", {
177
+ const z = Te("image-preview"), [i, te] = Ie(Q.value, D({
178
+ value: J
179
+ })), oe = y(() => [z.block, {
180
+ [z.modifier("hide")]: !i.value
181
+ }]), ae = m ? void 0 : document.body, S = je(ae, D({
182
+ popupContainer: q
183
+ })), ie = y(() => !m && S.value === document.body), ne = y(() => m || !r.renderToBody || !S.value), {
184
+ zIndex: le,
185
+ isLastDialog: C,
186
+ close: re
187
+ } = Ye("dialog", {
182
188
  visible: i
183
- }), X = p(() => ({
184
- ...H.value ? {
185
- zIndex: j.value,
189
+ }), se = y(() => ({
190
+ ...ie.value ? {
191
+ zIndex: le.value,
186
192
  position: "fixed"
187
193
  } : {
188
194
  zIndex: "inherit",
189
195
  position: "absolute"
190
196
  }
191
197
  })), {
192
- isLoading: q,
193
- isLoaded: J,
194
- setLoadStatus: R
195
- } = we(), c = m(0), t = m(L.value), {
196
- translate: g,
197
- moving: Q,
198
- resetTranslate: $
199
- } = ke(k({
200
- wrapperEl: s,
201
- imageEl: S,
198
+ isLoading: ue,
199
+ isLoaded: d,
200
+ isError: ce,
201
+ setLoadStatus: A
202
+ } = Ne(), v = g(0), P = (e) => Number.isFinite(e) ? Math.max(G, Math.min(Y, e)) : 1, n = g(P(F.value)), {
203
+ translate: I,
204
+ moving: me,
205
+ resetTranslate: fe
206
+ } = Be(D({
207
+ wrapperEl: l,
208
+ imageEl: f,
202
209
  visible: i,
203
- scale: t
204
- })), y = m(!1);
205
- let I = null;
206
- const ee = () => {
207
- !y.value && (y.value = !0), I && clearTimeout(I), I = setTimeout(() => {
208
- y.value = !1;
210
+ scale: n
211
+ })), h = g(!1);
212
+ let p;
213
+ const E = () => {
214
+ p && clearTimeout(p), p = void 0, h.value = !1;
215
+ }, de = () => {
216
+ !h.value && (h.value = !0), p && clearTimeout(p), p = setTimeout(() => {
217
+ h.value = !1;
209
218
  }, 1e3);
210
- };
211
- Oe(k({
212
- container: u,
213
- hidden: i
214
- }));
215
- function oe() {
216
- c.value = 0, t.value = L.value, $();
219
+ }, {
220
+ setOverflowHidden: ve,
221
+ resetOverflow: U
222
+ } = We(S);
223
+ k(i, (e) => {
224
+ e ? ve() : U();
225
+ }, {
226
+ immediate: !0
227
+ });
228
+ function pe() {
229
+ v.value = 0, n.value = P(F.value), fe(), E();
217
230
  }
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);
220
- let a = !1;
231
+ const N = (e) => ee.value.includes(e), W = (e) => {
232
+ if (!i.value || !r.keyboard || !C()) return;
233
+ const t = e.target;
234
+ if (t && (t.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(t.tagName)) && e.key !== c.ESC) return;
235
+ let o = !1;
221
236
  switch (e.key) {
222
- case d.ESC:
223
- n.escToClose && (P(), a = !0);
237
+ case c.ESC:
238
+ r.escToClose && (x(), o = !0);
224
239
  break;
225
- case d.ARROW_LEFT:
226
- n.groupArrowProps.onPrev && (n.groupArrowProps.onPrev(), a = !0);
240
+ case c.ARROW_LEFT:
241
+ r.groupArrowProps.onPrev && (r.groupArrowProps.onPrev(), o = !0);
227
242
  break;
228
- case d.ARROW_RIGHT:
229
- n.groupArrowProps.onNext && (n.groupArrowProps.onNext(), a = !0);
243
+ case c.ARROW_RIGHT:
244
+ r.groupArrowProps.onNext && (r.groupArrowProps.onNext(), o = !0);
230
245
  break;
231
- case d.ARROW_UP:
232
- C("zoomIn") && !l && (w("zoomIn"), a = !0);
246
+ case c.ARROW_UP:
247
+ d.value && N("zoomIn") && (t == null ? void 0 : t.tagName) !== "BUTTON" && (t == null ? void 0 : t.tagName) !== "A" && (R("zoomIn"), o = !0);
233
248
  break;
234
- case d.ARROW_DOWN:
235
- C("zoomOut") && !l && (w("zoomOut"), a = !0);
249
+ case c.ARROW_DOWN:
250
+ d.value && N("zoomOut") && (t == null ? void 0 : t.tagName) !== "BUTTON" && (t == null ? void 0 : t.tagName) !== "A" && (R("zoomOut"), o = !0);
236
251
  break;
237
- case d.SPACE:
238
- C("originalSize") && !l && (v(1), a = !0);
252
+ case c.SPACE:
253
+ d.value && N("originalSize") && (t == null ? void 0 : t.tagName) !== "BUTTON" && (t == null ? void 0 : t.tagName) !== "A" && (w(1), o = !0);
239
254
  break;
240
255
  }
241
- a && (e.stopPropagation(), e.preventDefault());
242
- }, te = ve((e) => {
243
- if (e.preventDefault(), e.stopPropagation(), !n.wheelZoom) return;
244
- const l = (e.deltaY || e.deltaX) > 0 ? "zoomOut" : "zoomIn", a = Be(t.value, G.value, l);
245
- v(a);
256
+ o && (e.stopPropagation(), e.preventDefault());
257
+ }, B = Oe((e) => {
258
+ if (e.preventDefault(), e.stopPropagation(), !r.wheelZoom || !d.value || !i.value || !C()) return;
259
+ const a = (e.deltaY || e.deltaX) > 0 ? "zoomOut" : "zoomIn", o = Number.isFinite(O.value) && O.value > 1 ? O.value : 1.1, s = He(n.value, o, a);
260
+ w(s);
246
261
  });
247
- let b = !1;
248
- N(s, (e) => e == null ? void 0 : e.focus(), {
262
+ let L = null;
263
+ const j = () => {
264
+ const e = L;
265
+ L = null, e != null && e.isConnected && e.focus({
266
+ preventScroll: !0
267
+ });
268
+ };
269
+ k(i, (e) => {
270
+ e ? m || (L = document.activeElement) : (m || B.cancel(), E(), ke(j));
271
+ }, {
272
+ immediate: !0
273
+ }), k(l, (e) => {
274
+ e && C() && e.focus({
275
+ preventScroll: !0
276
+ });
277
+ }, {
249
278
  flush: "post"
279
+ }), k([i, () => r.keyboard, S], ([e, t, a], o, s) => {
280
+ !e || !t || !a || m || (ze(a, "keydown", W), s(() => Ae(a, "keydown", W)));
281
+ }, {
282
+ immediate: !0
250
283
  });
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));
284
+ const ge = (e) => {
285
+ var H;
286
+ if (e.key !== "Tab" || !C() || !l.value) return;
287
+ const t = Array.from(l.value.querySelectorAll("button:not([disabled]), a[href], input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]")).filter((T) => T.tabIndex >= 0 && !T.closest('[hidden], [inert], [aria-hidden="true"]') && getComputedStyle(T).display !== "none" && getComputedStyle(T).visibility !== "hidden"), a = t[0], o = t.at(-1), s = document.activeElement;
288
+ a ? t.includes(s) ? e.shiftKey && s === a ? (e.preventDefault(), o == null || o.focus({
289
+ preventScroll: !0
290
+ })) : !e.shiftKey && s === o && (e.preventDefault(), a.focus({
291
+ preventScroll: !0
292
+ })) : (e.preventDefault(), (H = e.shiftKey ? o : a) == null || H.focus({
293
+ preventScroll: !0
294
+ })) : (e.preventDefault(), l.value.focus({
295
+ preventScroll: !0
296
+ }));
255
297
  };
256
- N([D, i], () => {
257
- i.value ? (oe(), R("loading"), ae()) : E();
298
+ k([V, i], () => {
299
+ i.value && (pe(), A(V.value ? "loading" : "error"));
258
300
  }, {
259
301
  immediate: !0
260
302
  });
261
- function P() {
262
- i.value && (O("close"), O("update:visible", !1), U(!1));
303
+ function x() {
304
+ i.value && (M("close"), M("update:visible", !1), te(!1));
263
305
  }
264
- function ne(e) {
265
- var o;
266
- (o = s == null ? void 0 : s.value) == null || o.focus(), M.value && e.target === e.currentTarget && P();
306
+ function ye(e) {
307
+ var t;
308
+ (t = l == null ? void 0 : l.value) == null || t.focus(), $.value && e.target === e.currentTarget && x();
267
309
  }
268
- function v(e) {
269
- if (t.value !== e) {
270
- const o = t.value;
271
- g.value = [g.value[0] * o / e, g.value[1] * o / e], t.value = e, ee();
310
+ function w(e) {
311
+ if (e = P(e), n.value !== e) {
312
+ const t = n.value;
313
+ I.value = [I.value[0] * t / e, I.value[1] * t / e], n.value = e, de();
272
314
  }
273
315
  }
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);
316
+ function be() {
317
+ if (!l.value || !f.value || !d.value) return;
318
+ const e = l.value.getBoundingClientRect(), t = f.value.getBoundingClientRect(), a = e.height / (t.height / n.value), o = e.width / (t.width / n.value);
319
+ if (t.width <= 0 || t.height <= 0) return;
320
+ const s = Math.min(a, o);
321
+ w(s);
277
322
  }
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;
323
+ function Z(e) {
324
+ const a = e === "clockwise" ? (v.value + _) % 360 : v.value === 0 ? 360 - _ : v.value - _;
325
+ v.value = a;
281
326
  }
282
- function w(e) {
283
- const o = Ae(t.value, e);
284
- v(o);
327
+ function R(e) {
328
+ const t = Ze(n.value, e);
329
+ w(t);
285
330
  }
286
- return ce(() => {
287
- E();
331
+ return Ce(() => {
332
+ E(), m || B.cancel(), j(), re(), U();
288
333
  }), {
289
- t: r,
290
- className: h,
291
- classNames: Z,
292
- container: u,
293
- teleportDisabled: Y,
294
- wrapperStyles: X,
295
- scale: t,
296
- translate: g,
297
- rotate: c,
298
- moving: Q,
334
+ rootAttrs: y(() => Object.fromEntries(Object.entries(X).filter(([e]) => e !== "class" && e !== "style" && e !== "aria-label"))),
335
+ t: u,
336
+ className: z,
337
+ classNames: oe,
338
+ container: S,
339
+ teleportDisabled: ne,
340
+ wrapperStyles: se,
341
+ scale: n,
342
+ translate: I,
343
+ rotate: v,
344
+ moving: me,
299
345
  mergedVisible: i,
300
- isLoading: q,
301
- isLoaded: J,
302
- scaleValueVisible: y,
303
- refWrapper: s,
304
- refImage: S,
305
- mounted: A,
306
- onWheel: te,
307
- onMaskClick: ne,
308
- onCloseClick: P,
309
- onImgLoad() {
310
- R("loaded");
346
+ isLoading: ue,
347
+ isLoaded: d,
348
+ isError: ce,
349
+ scaleValueVisible: h,
350
+ refWrapper: l,
351
+ refImage: f,
352
+ mounted: K,
353
+ onWheel: B,
354
+ onMaskClick: ye,
355
+ onCloseClick: x,
356
+ onDialogKeydown: ge,
357
+ onImgLoad(e) {
358
+ e.target === f.value && A("loaded");
311
359
  },
312
- onImgError() {
313
- R("error");
360
+ onImgError(e) {
361
+ e.target === f.value && A("error");
314
362
  },
315
- actions: p(() => [
363
+ actions: y(() => [
316
364
  /** 满屏 */
317
365
  {
318
366
  key: "fullScreen",
319
- name: r("imagePreview.fullscreen"),
320
- content: () => f(Ce),
321
- onClick: () => le()
367
+ name: u("imagePreview.fullscreen"),
368
+ content: () => b(Ve),
369
+ onClick: () => be()
322
370
  },
323
371
  /** 顺时针旋转 */
324
372
  {
325
373
  key: "rotateRight",
326
- name: r("imagePreview.rotateRight"),
327
- content: () => f(ze),
328
- onClick: () => x("clockwise")
374
+ name: u("imagePreview.rotateRight"),
375
+ content: () => b(Ke),
376
+ onClick: () => Z("clockwise")
329
377
  },
330
378
  /** 逆时针旋转 */
331
379
  {
332
380
  key: "rotateLeft",
333
- name: r("imagePreview.rotateLeft"),
334
- content: () => f(Pe),
335
- onClick: () => x("counterclockwise")
381
+ name: u("imagePreview.rotateLeft"),
382
+ content: () => b(Fe),
383
+ onClick: () => Z("counterclockwise")
336
384
  },
337
385
  /** 放大 */
338
386
  {
339
387
  key: "zoomIn",
340
- name: r("imagePreview.zoomIn"),
341
- content: () => f(Ie),
342
- onClick: () => w("zoomIn"),
343
- disabled: t.value === Ee
388
+ name: u("imagePreview.zoomIn"),
389
+ content: () => b(Me),
390
+ onClick: () => R("zoomIn"),
391
+ disabled: n.value === Y
344
392
  },
345
393
  /** 缩小 */
346
394
  {
347
395
  key: "zoomOut",
348
- name: r("imagePreview.zoomOut"),
349
- content: () => f(Re),
350
- onClick: () => w("zoomOut"),
351
- disabled: t.value === xe
396
+ name: u("imagePreview.zoomOut"),
397
+ content: () => b(_e),
398
+ onClick: () => R("zoomOut"),
399
+ disabled: n.value === G
352
400
  },
353
401
  /** 缩放到100% */
354
402
  {
355
403
  key: "originalSize",
356
- name: r("imagePreview.originalSize"),
357
- content: () => f(Te),
358
- onClick: () => v(1)
404
+ name: u("imagePreview.originalSize"),
405
+ content: () => b(Ue),
406
+ onClick: () => w(1)
359
407
  }
360
408
  ])
361
409
  };
362
410
  }
363
411
  });
364
412
  export {
365
- lo as default
413
+ bt as default
366
414
  };
@@ -1,13 +1,13 @@
1
- import { defineComponent as d, createVNode as l, mergeProps as u, isVNode as f } from "vue";
1
+ import { defineComponent as u, createVNode as l, mergeProps as p, isVNode as f } from "vue";
2
2
  import { getClassNameMixin as b } from "../../_utils/config.js";
3
- import { Tooltip as p } from "../tooltip/index.js";
3
+ import { Tooltip as s } from "../tooltip/index.js";
4
4
  function g(e) {
5
5
  return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
6
6
  }
7
- const N = /* @__PURE__ */ d({
7
+ const N = /* @__PURE__ */ u({
8
8
  name: "ImagePreviewAction",
9
9
  components: {
10
- Tooltip: p
10
+ Tooltip: s
11
11
  },
12
12
  inheritAttrs: !1,
13
13
  props: {
@@ -28,7 +28,7 @@ const N = /* @__PURE__ */ d({
28
28
  },
29
29
  setup(e, {
30
30
  slots: o,
31
- attrs: s
31
+ attrs: m
32
32
  }) {
33
33
  const t = b("image-preview--toolbar-action");
34
34
  return () => {
@@ -38,21 +38,18 @@ const N = /* @__PURE__ */ d({
38
38
  disabled: i
39
39
  } = e, r = (c = o.default) == null ? void 0 : c.call(o);
40
40
  if (!r || !r.length) return null;
41
- const n = l("button", u({
41
+ const n = l("button", p(p(m, {
42
+ class: [t.block, i && t.modifier("disabled")],
43
+ onMousedown: (d) => d.preventDefault()
44
+ }), {
42
45
  type: "button",
43
46
  disabled: i,
44
47
  "aria-disabled": i,
45
- "aria-label": a,
46
- class: [`${t.block}`, {
47
- [t.modifier("disabled")]: i
48
- }],
49
- onMousedown: (m) => {
50
- m.preventDefault();
51
- }
52
- }, s), [l("span", {
48
+ "aria-label": a
49
+ }), [l("span", {
53
50
  class: t.element("content")
54
51
  }, [r])]);
55
- return a ? l(p, {
52
+ return a ? l(s, {
56
53
  class: t.element("tooltip"),
57
54
  content: a
58
55
  }, g(n) ? n : {
@@ -1,32 +1,33 @@
1
- import s from "./ImagePreviewGroup.vue2.js";
2
- import { resolveComponent as n, openBlock as a, createElementBlock as l, Fragment as t, renderSlot as e, createVNode as p, mergeProps as i, createSlots as m, withCtx as u } from "vue";
3
- import c from "../../_virtual/_plugin-vue_export-helper.js";
4
- function d(o, b, f, g, $, v) {
1
+ import a from "./ImagePreviewGroup.vue2.js";
2
+ import { resolveComponent as n, openBlock as l, createElementBlock as s, Fragment as t, renderSlot as o, createVNode as i, mergeProps as p, createSlots as m, withCtx as u } from "vue";
3
+ import d from "../../_virtual/_plugin-vue_export-helper.js";
4
+ function b(e, c, g, f, v, $) {
5
5
  const r = n("ImagePreview");
6
- return a(), l(t, null, [
7
- e(o.$slots, "default"),
8
- p(r, i({ ...o.$attrs, groupArrowProps: o.groupArrowProps }, {
6
+ return l(), s(t, null, [
7
+ o(e.$slots, "default"),
8
+ i(r, p({ ...e.$attrs, groupArrowProps: e.groupArrowProps }, {
9
9
  "in-group": "",
10
- src: o.currentUrl,
11
- visible: o.mergedVisible && !!o.currentUrl,
12
- "mask-closable": o.maskClosable,
13
- closable: o.closable,
14
- "actions-layout": o.actionsLayout,
15
- "popup-container": o.popupContainer,
16
- "render-to-body": o.renderToBody,
17
- onClose: o.onClose
10
+ src: e.currentUrl,
11
+ visible: e.mergedVisible && !!e.currentUrl,
12
+ "mask-closable": e.maskClosable,
13
+ closable: e.closable,
14
+ "actions-layout": e.actionsLayout,
15
+ "popup-container": e.popupContainer,
16
+ "render-to-body": e.renderToBody,
17
+ "aria-label": e.$attrs["aria-label"] || e.t("imagePreview.previewLabel", { index: e.currentIndex + 1, total: e.imageCount }),
18
+ onClose: e.onClose
18
19
  }), m({ _: 2 }, [
19
- o.$slots.actions ? {
20
+ e.$slots.actions ? {
20
21
  name: "actions",
21
22
  fn: u(() => [
22
- e(o.$slots, "actions", { url: o.currentUrl })
23
+ o(e.$slots, "actions", { url: e.currentUrl })
23
24
  ]),
24
25
  key: "0"
25
26
  } : void 0
26
- ]), 1040, ["src", "visible", "mask-closable", "closable", "actions-layout", "popup-container", "render-to-body", "onClose"])
27
+ ]), 1040, ["src", "visible", "mask-closable", "closable", "actions-layout", "popup-container", "render-to-body", "aria-label", "onClose"])
27
28
  ], 64);
28
29
  }
29
- const w = /* @__PURE__ */ c(s, [["render", d]]);
30
+ const P = /* @__PURE__ */ d(a, [["render", b]]);
30
31
  export {
31
- w as default
32
+ P as default
32
33
  };