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,12 +1,13 @@
1
- import { defineComponent as T, toRefs as q, reactive as b, computed as r, ref as D, watch as E, provide as F } from "vue";
1
+ import { defineComponent as q, toRefs as D, reactive as b, computed as r, ref as E, watch as F, provide as H } from "vue";
2
2
  import C from "../../_hooks/use-merge-state.js";
3
- import H from "./ImagePreview.vue.js";
4
- import { PreviewGroupInjectionKey as J } from "./context.js";
3
+ import J from "./ImagePreview.vue.js";
4
+ import { PreviewGroupInjectionKey as Q } from "./context.js";
5
5
  import { isArray as A, isUndefined as s } from "../../_utils/is.js";
6
- const $ = /* @__PURE__ */ T({
6
+ import { useLocale as W } from "../../locale/index.js";
7
+ const re = /* @__PURE__ */ q({
7
8
  name: "ImagePreviewGroup",
8
9
  components: {
9
- ImagePreview: H
10
+ ImagePreview: J
10
11
  },
11
12
  inheritAttrs: !1,
12
13
  props: {
@@ -120,21 +121,23 @@ const $ = /* @__PURE__ */ T({
120
121
  emit: m
121
122
  }) {
122
123
  const {
124
+ t: U
125
+ } = W(), {
123
126
  srcList: n,
124
- visible: U,
125
- defaultVisible: M,
126
- current: S,
127
+ visible: M,
128
+ defaultVisible: S,
129
+ current: L,
127
130
  defaultCurrent: N,
128
131
  infinite: w
129
- } = q(B), [h, O] = C(M.value, b({
130
- value: U
132
+ } = D(B), [h, O] = C(S.value, b({
133
+ value: M
131
134
  })), g = (e) => {
132
135
  e !== h.value && (m("visible-change", e), m("update:visible", e), O(e));
133
136
  }, k = r(() => new Map(A(n == null ? void 0 : n.value) ? n == null ? void 0 : n.value.map((e, t) => [t, {
134
137
  url: e,
135
138
  canPreview: !0
136
- }]) : [])), x = r(() => A(n == null ? void 0 : n.value)), c = D(/* @__PURE__ */ new Map()), f = r(() => x.value ? k.value : c.value), z = r(() => Array.from(c.value.keys())), d = r(() => Array.from(f.value.keys())), i = r(() => d.value.length);
137
- function L(e, t, u) {
139
+ }]) : [])), x = r(() => A(n == null ? void 0 : n.value)), c = E(/* @__PURE__ */ new Map()), f = r(() => x.value ? k.value : c.value), z = r(() => Array.from(c.value.keys())), d = r(() => Array.from(f.value.keys())), o = r(() => d.value.length);
140
+ function R(e, t, u) {
138
141
  return c.value.set(e, {
139
142
  url: t,
140
143
  canPreview: u
@@ -142,21 +145,21 @@ const $ = /* @__PURE__ */ T({
142
145
  c.value.delete(e);
143
146
  };
144
147
  }
145
- const [a, R] = C(N.value, b({
146
- value: S
148
+ const [a, _] = C(N.value, b({
149
+ value: L
147
150
  })), v = (e) => {
148
- e !== a.value && (m("change", e), m("update:current", e), R(e));
149
- }, _ = r(() => d.value[a.value]), j = (e) => {
151
+ e !== a.value && (m("change", e), m("update:current", e), _(e));
152
+ }, j = r(() => d.value[a.value]), G = (e) => {
150
153
  const t = d.value.indexOf(e);
151
154
  t >= 0 && t !== a.value && v(t);
152
- }, G = r(() => {
155
+ }, V = r(() => {
153
156
  var e;
154
- return (e = f.value.get(_.value)) == null ? void 0 : e.url;
157
+ return (e = f.value.get(j.value)) == null ? void 0 : e.url;
155
158
  });
156
- E(
157
- [i, a],
159
+ F(
160
+ [o, a],
158
161
  () => {
159
- if (i.value === 0) {
162
+ if (o.value === 0) {
160
163
  g(!1);
161
164
  return;
162
165
  }
@@ -164,64 +167,67 @@ const $ = /* @__PURE__ */ T({
164
167
  v(0);
165
168
  return;
166
169
  }
167
- a.value >= i.value && v(i.value - 1);
170
+ a.value >= o.value && v(o.value - 1);
168
171
  },
169
172
  // 自动收集模式须等子图片注册;显式列表在 setup 时即可检查边界。
170
173
  {
171
174
  immediate: x.value
172
175
  }
173
- ), F(J, b({
174
- registerImageUrl: L,
176
+ ), H(Q, b({
177
+ registerImageUrl: R,
175
178
  preview: (e) => {
176
179
  if (x.value) {
177
- const u = c.value.get(e), o = u != null && u.canPreview ? z.value.indexOf(e) : -1;
178
- o >= 0 && o < i.value && (v(o), g(!0));
180
+ const u = c.value.get(e), i = u != null && u.canPreview ? z.value.indexOf(e) : -1;
181
+ i >= 0 && i < o.value && (v(i), g(!0));
179
182
  return;
180
183
  }
181
184
  const t = f.value.get(e);
182
- t != null && t.canPreview && (j(e), g(!0));
185
+ t != null && t.canPreview && (G(e), g(!0));
183
186
  }
184
187
  }));
185
188
  const y = r(() => {
186
- const e = (u, o) => {
189
+ const e = (u, i) => {
187
190
  var p;
188
- for (let l = u; l <= o; l++) {
191
+ for (let l = u; l <= i; l++) {
189
192
  const P = d.value[l];
190
193
  if ((p = f.value.get(P)) != null && p.canPreview)
191
194
  return l;
192
195
  }
193
- }, t = e(a.value + 1, i.value - 1);
196
+ }, t = e(a.value + 1, o.value - 1);
194
197
  return s(t) && w.value ? e(0, a.value - 1) : t;
195
198
  }), I = r(() => {
196
- const e = (u, o) => {
199
+ const e = (u, i) => {
197
200
  var p;
198
- for (let l = u; l >= o; l--) {
201
+ for (let l = u; l >= i; l--) {
199
202
  const P = d.value[l];
200
203
  if ((p = f.value.get(P)) != null && p.canPreview)
201
204
  return l;
202
205
  }
203
206
  }, t = e(a.value - 1, 0);
204
- return s(t) && w.value ? e(i.value - 1, a.value + 1) : t;
205
- }), V = r(() => s(I.value) ? void 0 : () => {
207
+ return s(t) && w.value ? e(o.value - 1, a.value + 1) : t;
208
+ }), K = r(() => s(I.value) ? void 0 : () => {
206
209
  !s(I.value) && v(I.value);
207
- }), K = r(() => s(y.value) ? void 0 : () => {
210
+ }), T = r(() => s(y.value) ? void 0 : () => {
208
211
  !s(y.value) && v(y.value);
209
212
  });
210
213
  return {
214
+ t: U,
215
+ currentIndex: a,
216
+ imageCount: o,
211
217
  mergedVisible: h,
212
- currentUrl: G,
218
+ currentUrl: V,
213
219
  prevIndex: I,
214
220
  nextIndex: y,
215
221
  onClose() {
216
222
  g(!1);
217
223
  },
218
224
  groupArrowProps: b({
219
- onPrev: V,
220
- onNext: K
225
+ onPrev: K,
226
+ onNext: T
221
227
  })
222
228
  };
223
229
  }
224
230
  });
225
231
  export {
226
- $ as default
232
+ re as default
227
233
  };
@@ -2,39 +2,41 @@ import { toRefs as E, ref as x, watchEffect as R, watch as X, nextTick as Y } fr
2
2
  import { on as s, off as f } from "../../../_utils/dom.js";
3
3
  import h from "../utils/get-fix-translate.js";
4
4
  function B(D) {
5
- const { wrapperEl: v, imageEl: a, scale: n } = E(D), t = x([0, 0]), u = x(!1);
6
- let i = 0, c = 0, l = [0, 0];
5
+ const { wrapperEl: v, imageEl: l, scale: n } = E(D), t = x([0, 0]), o = x(!1);
6
+ let i = 0, c = 0, r = [0, 0];
7
7
  const T = () => {
8
- if (!v.value || !a.value) return;
9
- const e = v.value.getBoundingClientRect(), r = a.value.getBoundingClientRect(), [o, d] = h(
8
+ if (!v.value || !l.value) return;
9
+ const e = v.value.getBoundingClientRect(), a = l.value.getBoundingClientRect(), [u, d] = h(
10
10
  e,
11
- r,
11
+ a,
12
12
  t.value[0],
13
13
  t.value[1],
14
14
  n.value
15
15
  );
16
- (o !== t.value[0] || d !== t.value[1]) && (t.value = [o, d]);
16
+ (u !== t.value[0] || d !== t.value[1]) && (t.value = [u, d]);
17
17
  }, p = (e) => {
18
18
  e.preventDefault && e.preventDefault();
19
- const r = l[0] + (e.pageX - i) / n.value, o = l[1] + (e.pageY - c) / n.value;
20
- t.value = [r, o];
19
+ const a = r[0] + (e.pageX - i) / n.value, u = r[1] + (e.pageY - c) / n.value;
20
+ t.value = [a, u];
21
21
  }, g = (e) => {
22
- e.preventDefault && e.preventDefault(), u.value = !1, w();
22
+ e.preventDefault && e.preventDefault(), o.value = !1, w();
23
23
  }, m = (e) => {
24
- e.target === e.currentTarget && (e.preventDefault && e.preventDefault(), u.value = !0, i = e.pageX, c = e.pageY, l = [...t.value], s(window, "mousemove", p, !1), s(window, "mouseup", g, !1));
24
+ e.target === e.currentTarget && (e.preventDefault && e.preventDefault(), o.value = !0, i = e.pageX, c = e.pageY, r = [...t.value], s(window, "mousemove", p, !1), s(window, "mouseup", g, !1));
25
25
  };
26
26
  function w() {
27
27
  typeof window > "u" || (f(window, "mousemove", p, !1), f(window, "mouseup", g, !1));
28
28
  }
29
29
  return R((e) => {
30
- typeof window > "u" || (a.value && s(a.value, "mousedown", m), e(() => {
31
- a.value && f(a.value, "mousedown", m), w();
32
- }));
30
+ if (typeof window > "u") return;
31
+ const a = l.value;
32
+ a && s(a, "mousedown", m), e(() => {
33
+ a && f(a, "mousedown", m), o.value = !1, w();
34
+ });
33
35
  }), X([n], () => {
34
36
  Y(() => T());
35
37
  }), {
36
38
  translate: t,
37
- moving: u,
39
+ moving: o,
38
40
  resetTranslate() {
39
41
  t.value = [0, 0];
40
42
  }
@@ -11,8 +11,8 @@ import { Checkbox as M, CheckboxGroup as R } from "./form-checkbox/index.js";
11
11
  import { Input as B, InputGroup as E, InputPassword as _, InputSearch as N } from "./form-input/index.js";
12
12
  import { InputNumber as j } from "./form-input-number/index.js";
13
13
  import { InputTag as H } from "./form-input-tag/index.js";
14
- import { Radio as W, RadioGroup as z } from "./form-radio/index.js";
15
- import { Select as U, SelectDropdown as Y, SelectOption as Z, SelectOptionGroup as q } from "./form-select/index.js";
14
+ import { Radio as W, RadioGroup as U } from "./form-radio/index.js";
15
+ import { Select as Q, SelectDropdown as Y, SelectOption as Z, SelectOptionGroup as q } from "./form-select/index.js";
16
16
  import { Slider as V } from "./form-slider/index.js";
17
17
  import { Switch as $ } from "./form-switch/index.js";
18
18
  import { Textarea as ro } from "./form-textarea/index.js";
@@ -30,7 +30,7 @@ import { Notification as No } from "./notification/index.js";
30
30
  import { Pagination as jo } from "./pagination/index.js";
31
31
  import { Popconfirm as Ho } from "./popconfirm/index.js";
32
32
  import { Popover as Wo } from "./popover/index.js";
33
- import { Popup as Qo } from "./popup/index.js";
33
+ import { Popup as zo } from "./popup/index.js";
34
34
  import { Progress as Yo } from "./progress/index.js";
35
35
  import { Rate as qo } from "./rate/index.js";
36
36
  import { ResizeBox as Vo } from "./resize-box/index.js";
@@ -49,17 +49,18 @@ import { TimelineItem as Dr } from "./timeline-item/index.js";
49
49
  import { Tooltip as Gr } from "./tooltip/index.js";
50
50
  import { TrendChart as vr } from "./trend-chart/index.js";
51
51
  import { Trigger as Rr } from "./trigger/index.js";
52
- import { Watermark as Br } from "./watermark/index.js";
53
- import { TABLE_LOCALE_EN_US as _r, TABLE_LOCALE_ZH_CN as Nr, formatLocaleText as Or } from "./table/locale.js";
54
- import { default as Fr } from "./table/table-tbody.js";
55
- import { default as Kr } from "./table/table-td.js";
56
- import { default as zr } from "./table/table-th.js";
57
- import { default as Ur } from "./table/table-thead.js";
58
- import { default as Zr } from "./table/table-tr.js";
59
- import { configProviderInjectionKey as Jr } from "./config-provider/context.js";
60
- import { formInjectionKey as Xr, formItemInjectionKey as $r } from "./form/context.js";
61
- import { vDraggable as re } from "./draggable/directive.js";
62
- import { vWatermark as te } from "./watermark/directive.js";
52
+ import { Upload as Br } from "./upload/index.js";
53
+ import { Watermark as _r } from "./watermark/index.js";
54
+ import { TABLE_LOCALE_EN_US as Or, TABLE_LOCALE_ZH_CN as jr, formatLocaleText as Fr } from "./table/locale.js";
55
+ import { default as Kr } from "./table/table-tbody.js";
56
+ import { default as Ur } from "./table/table-td.js";
57
+ import { default as Qr } from "./table/table-th.js";
58
+ import { default as Zr } from "./table/table-thead.js";
59
+ import { default as Jr } from "./table/table-tr.js";
60
+ import { configProviderInjectionKey as Xr } from "./config-provider/context.js";
61
+ import { formInjectionKey as oe, formItemInjectionKey as re } from "./form/context.js";
62
+ import { vDraggable as te } from "./draggable/directive.js";
63
+ import { vWatermark as me } from "./watermark/directive.js";
63
64
  export {
64
65
  e as Alert,
65
66
  p as Button,
@@ -111,17 +112,17 @@ export {
111
112
  jo as Pagination,
112
113
  Ho as Popconfirm,
113
114
  Wo as Popover,
114
- Qo as Popup,
115
+ zo as Popup,
115
116
  Yo as Progress,
116
117
  w as QuarterPicker,
117
118
  W as Radio,
118
- z as RadioGroup,
119
+ U as RadioGroup,
119
120
  L as RangePicker,
120
121
  qo as Rate,
121
122
  Vo as ResizeBox,
122
123
  io as Row,
123
124
  $o as Scrollbar,
124
- U as Select,
125
+ Q as Select,
125
126
  Y as SelectDropdown,
126
127
  Z as SelectOption,
127
128
  q as SelectOptionGroup,
@@ -134,33 +135,34 @@ export {
134
135
  nr as Step,
135
136
  ir as Steps,
136
137
  $ as Switch,
137
- _r as TABLE_LOCALE_EN_US,
138
- Nr as TABLE_LOCALE_ZH_CN,
138
+ Or as TABLE_LOCALE_EN_US,
139
+ jr as TABLE_LOCALE_ZH_CN,
139
140
  Tr as TabPane,
140
141
  lr as Table,
141
142
  cr as TableColumn,
142
143
  Sr as Tabs,
143
144
  Pr as Tag,
144
- Fr as Tbody,
145
- Kr as Td,
145
+ Kr as Tbody,
146
+ Ur as Td,
146
147
  ro as Textarea,
147
- zr as Th,
148
- Ur as Thead,
148
+ Qr as Th,
149
+ Zr as Thead,
149
150
  kr as TimePicker,
150
151
  sr as TimeRangeSelector,
151
152
  Lr as Timeline,
152
153
  Dr as TimelineItem,
153
154
  Gr as Tooltip,
154
- Zr as Tr,
155
+ Jr as Tr,
155
156
  vr as TrendChart,
156
157
  Rr as Trigger,
157
- Br as Watermark,
158
+ Br as Upload,
159
+ _r as Watermark,
158
160
  C as WeekPicker,
159
161
  D as YearPicker,
160
- Jr as configProviderInjectionKey,
161
- Xr as formInjectionKey,
162
- $r as formItemInjectionKey,
163
- Or as formatLocaleText,
164
- re as vDraggable,
165
- te as vWatermark
162
+ Xr as configProviderInjectionKey,
163
+ oe as formInjectionKey,
164
+ re as formItemInjectionKey,
165
+ Fr as formatLocaleText,
166
+ te as vDraggable,
167
+ me as vWatermark
166
168
  };