x-next 1.4.0 → 1.6.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 (144) hide show
  1. package/AI_USAGE.md +2 -2
  2. package/CHANGELOG.md +71 -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/dropdown/Dropdown.vue.d.ts +34 -4
  12. package/dist/components/dropdown/DropdownButton.vue.d.ts +37 -6
  13. package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +34 -4
  14. package/dist/components/dropdown/dropdown-panel.vue.d.ts +30 -0
  15. package/dist/components/dropdown/index.d.ts +212 -29
  16. package/dist/components/form/FormItem.vue.d.ts +3 -3
  17. package/dist/components/form/form-item-label.vue.d.ts +3 -3
  18. package/dist/components/form/index.d.ts +6 -6
  19. package/dist/components/form-select/Select.d.ts +3 -3
  20. package/dist/components/form-select/SelectDropdown.vue.d.ts +30 -0
  21. package/dist/components/form-select/index.d.ts +66 -6
  22. package/dist/components/form-slider/Slider.vue.d.ts +3 -3
  23. package/dist/components/form-slider/index.d.ts +6 -6
  24. package/dist/components/form-slider/slider-button.vue.d.ts +3 -3
  25. package/dist/components/heatmap/Heatmap.d.ts +311 -0
  26. package/dist/components/heatmap/helpers/matrix.d.ts +58 -0
  27. package/dist/components/heatmap/index.d.ts +372 -0
  28. package/dist/components/heatmap/interface.d.ts +57 -0
  29. package/dist/components/image/Image.vue.d.ts +3 -3
  30. package/dist/components/image/ImagePreview.vue.d.ts +3 -3
  31. package/dist/components/image/ImagePreviewAction.d.ts +3 -3
  32. package/dist/components/image/ImagePreviewGroup.vue.d.ts +3 -3
  33. package/dist/components/image/index.d.ts +24 -24
  34. package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
  35. package/dist/components/index.d.ts +2 -0
  36. package/dist/components/menu/sub-menu-pop.vue.d.ts +3 -3
  37. package/dist/components/network/Network.vue.d.ts +1 -1
  38. package/dist/components/network/index.d.ts +3 -3
  39. package/dist/components/network/utils.d.ts +2 -0
  40. package/dist/components/pagination/page-item-ellipsis.vue.d.ts +9 -0
  41. package/dist/components/pagination/page-jumper.vue.d.ts +6 -0
  42. package/dist/components/pagination/page-options.vue.d.ts +6 -6
  43. package/dist/components/popover/Popover.d.ts +1 -1
  44. package/dist/components/popover/index.d.ts +3 -3
  45. package/dist/components/popup/Popup.d.ts +1 -1
  46. package/dist/components/popup/index.d.ts +3 -3
  47. package/dist/components/skeleton/SkeletonShape.vue.d.ts +3 -3
  48. package/dist/components/skeleton/index.d.ts +6 -6
  49. package/dist/components/spin/Spin.d.ts +38 -0
  50. package/dist/components/spin/index.d.ts +30 -0
  51. package/dist/components/steps/context.d.ts +9 -0
  52. package/dist/components/table/Table.d.ts +1 -1
  53. package/dist/components/table/index.d.ts +3 -3
  54. package/dist/components/tabs/TabPane.vue.d.ts +2 -0
  55. package/dist/components/tabs/Tabs.d.ts +1 -1
  56. package/dist/components/tabs/index.d.ts +9 -3
  57. package/dist/components/tabs/interface.d.ts +4 -0
  58. package/dist/components/time-picker/TimePicker.vue.d.ts +3 -3
  59. package/dist/components/time-picker/index.d.ts +6 -6
  60. package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
  61. package/dist/components/tooltip/index.d.ts +3 -3
  62. package/dist/components/trigger/Trigger.d.ts +1 -1
  63. package/dist/components/trigger/index.d.ts +3 -3
  64. package/dist/components/watermark/Watermark.d.ts +1 -1
  65. package/dist/components/watermark/index.d.ts +3 -3
  66. package/dist/es/_styles/palette-aliases.js +8 -0
  67. package/dist/es/_utils/color.js +73 -0
  68. package/dist/es/components/button/Button.js +2 -2
  69. package/dist/es/components/color-picker/ColorPicker.js +239 -0
  70. package/dist/es/components/color-picker/gradient-slider.js +79 -0
  71. package/dist/es/components/color-picker/index.js +8 -0
  72. package/dist/es/components/color-picker/panel.js +307 -0
  73. package/dist/es/components/color-picker/sv-panel.js +99 -0
  74. package/dist/es/components/dropdown/Dropdown.vue2.js +11 -4
  75. package/dist/es/components/dropdown/DropdownButton.vue.js +8 -7
  76. package/dist/es/components/dropdown/DropdownButton.vue2.js +19 -17
  77. package/dist/es/components/dropdown/DropdownSubmenu.vue.js +18 -17
  78. package/dist/es/components/dropdown/dropdown-panel.vue.js +17 -17
  79. package/dist/es/components/form-input/Input.js +7 -7
  80. package/dist/es/components/form-input/InputPassword.vue2.js +2 -2
  81. package/dist/es/components/form-input/InputSearch.js +2 -2
  82. package/dist/es/components/form-input-number/InputNumber.js +12 -12
  83. package/dist/es/components/heatmap/Heatmap.js +334 -0
  84. package/dist/es/components/heatmap/helpers/matrix.js +106 -0
  85. package/dist/es/components/heatmap/index.js +8 -0
  86. package/dist/es/components/index.js +118 -114
  87. package/dist/es/components/menu/MenuSubMenu.js +50 -36
  88. package/dist/es/components/menu/sub-menu-pop.vue2.js +30 -30
  89. package/dist/es/components/network/Network.vue2.js +72 -72
  90. package/dist/es/components/network/utils.js +44 -35
  91. package/dist/es/components/pagination/Pagination.js +124 -112
  92. package/dist/es/components/pagination/page-item-ellipsis.vue.js +13 -12
  93. package/dist/es/components/pagination/page-item-ellipsis.vue2.js +19 -15
  94. package/dist/es/components/pagination/page-jumper.vue.js +13 -12
  95. package/dist/es/components/pagination/page-jumper.vue2.js +7 -4
  96. package/dist/es/components/pagination/page-options.vue.js +4 -3
  97. package/dist/es/components/pagination/page-options.vue2.js +17 -15
  98. package/dist/es/components/skeleton/Skeleton.vue.js +11 -9
  99. package/dist/es/components/skeleton/SkeletonLine.vue.js +9 -8
  100. package/dist/es/components/skeleton/SkeletonShape.vue.js +8 -7
  101. package/dist/es/components/spin/Spin.js +124 -60
  102. package/dist/es/components/steps/Step.vue2.js +51 -47
  103. package/dist/es/components/steps/Steps.vue2.js +22 -19
  104. package/dist/es/components/table/Table.js +3 -1
  105. package/dist/es/components/tabs/TabPane.vue.js +11 -9
  106. package/dist/es/components/tabs/TabPane.vue2.js +28 -24
  107. package/dist/es/components/tabs/tabs-nav.js +20 -18
  108. package/dist/es/components/tabs/tabs-tab.vue.js +10 -8
  109. package/dist/es/components/trigger/Trigger.js +19 -19
  110. package/dist/es/icons/_self/empty-better.js +25 -8
  111. package/dist/es/index.js +162 -158
  112. package/dist/es/locale/en-US.js +19 -2
  113. package/dist/es/locale/zh-CN.js +19 -2
  114. package/dist/es/style.css +1 -1
  115. package/dist/index.cjs +4 -4
  116. package/dist/index.umd.js +4 -4
  117. package/dist/locale/interface.d.ts +30 -0
  118. package/dist/style/base.css +1 -1
  119. package/dist/style/button.css +1 -1
  120. package/dist/style/color-picker.css +1 -0
  121. package/dist/style/color-picker.js +2 -0
  122. package/dist/style/date-picker.css +1 -1
  123. package/dist/style/dropdown.css +1 -1
  124. package/dist/style/empty.css +1 -1
  125. package/dist/style/form-checkbox.css +1 -1
  126. package/dist/style/form-input-tag.css +1 -1
  127. package/dist/style/form-input.css +1 -1
  128. package/dist/style/form-radio.css +1 -1
  129. package/dist/style/form-textarea.css +1 -1
  130. package/dist/style/form.css +1 -1
  131. package/dist/style/heatmap.css +1 -0
  132. package/dist/style/heatmap.js +2 -0
  133. package/dist/style/image.css +1 -1
  134. package/dist/style/menu.css +1 -1
  135. package/dist/style/pagination.css +1 -1
  136. package/dist/style/skeleton.css +1 -1
  137. package/dist/style/spin.css +1 -1
  138. package/dist/style/steps.css +1 -1
  139. package/dist/style/table.css +1 -1
  140. package/dist/style/tabs.css +1 -1
  141. package/dist/style.css +1 -1
  142. package/dist/types.d.ts +2 -0
  143. package/package.json +3 -2
  144. package/volar.d.ts +2 -0
@@ -0,0 +1,307 @@
1
+ import { defineComponent as K, createVNode as o, Fragment as J, ref as z, watch as j, computed as b } from "vue";
2
+ import { getClassNameMixin as Q } from "../../_utils/config.js";
3
+ import { rgbToHsl as W, hslToRgb as X } from "../../_utils/palette.js";
4
+ import { formatColor as E, rgbToHsv as _, hsvToRgb as Y, toRgbaString as Z, toAlphaSliderColor as ee, parseColorAlpha as G, formatAlphaPercent as ae } from "../../_utils/color.js";
5
+ import le from "../form-input/Input.js";
6
+ import ne from "../form-input-number/InputNumber.js";
7
+ import te from "../button/Button.js";
8
+ import oe from "../../icons/default/check.js";
9
+ import se from "./sv-panel.js";
10
+ import re from "./gradient-slider.js";
11
+ const he = "linear-gradient(to right, red, yellow, lime, cyan, blue, magenta, red)", Ce = /* @__PURE__ */ K({
12
+ name: "ColorPickerPanel",
13
+ props: {
14
+ value: {
15
+ type: Object,
16
+ required: !0
17
+ },
18
+ modes: {
19
+ type: Array,
20
+ default: () => ["hex", "rgb", "hsl"]
21
+ },
22
+ showAlpha: {
23
+ type: Boolean,
24
+ default: !0
25
+ },
26
+ swatches: {
27
+ type: Array,
28
+ default: () => []
29
+ },
30
+ disabled: {
31
+ type: Boolean,
32
+ default: !1
33
+ },
34
+ showConfirm: {
35
+ type: Boolean,
36
+ default: !0
37
+ },
38
+ showClear: {
39
+ type: Boolean,
40
+ default: !0
41
+ },
42
+ /** 已本地化的文案,由外层 ColorPicker 注入,避免面板层再做一次 locale 注入 */
43
+ texts: {
44
+ type: Object,
45
+ default: () => ({
46
+ clear: "",
47
+ confirm: "",
48
+ hue: "",
49
+ alpha: "",
50
+ saturation: ""
51
+ })
52
+ }
53
+ },
54
+ emits: {
55
+ change: (a, h) => !0,
56
+ confirm: (a) => !0,
57
+ clear: () => !0,
58
+ close: () => !0
59
+ },
60
+ setup(a, {
61
+ emit: h
62
+ }) {
63
+ const y = Q("color-picker"), d = z(a.modes[0] ?? "hex"), u = z(_(a.value)), c = z(a.value.a);
64
+ j(() => a.value, (e) => {
65
+ const l = _(e);
66
+ (Math.abs(l.h - u.value.h) > 0.5 || Math.abs(l.s - u.value.s) > 0.5 || Math.abs(l.v - u.value.v) > 0.5) && (u.value = l), Math.abs(e.a - c.value) > 1e-3 && (c.value = e.a);
67
+ }), j(() => a.modes, (e) => {
68
+ e.length && !e.includes(d.value) && (d.value = e[0]);
69
+ });
70
+ const n = b(() => {
71
+ const [e, l, s] = Y(u.value);
72
+ return {
73
+ r: e,
74
+ g: l,
75
+ b: s,
76
+ a: a.showAlpha ? c.value : 1
77
+ };
78
+ }), m = (e, l) => h("change", e, l), H = (e) => {
79
+ u.value = e, m(n.value);
80
+ }, S = (e) => {
81
+ u.value = {
82
+ ...u.value,
83
+ h: e / 100 * 360
84
+ }, m(n.value);
85
+ }, B = (e) => {
86
+ c.value = e / 100, m(n.value);
87
+ }, I = b(() => `linear-gradient(to right, ${Z({
88
+ ...n.value,
89
+ a: 0
90
+ })}, ${ee(n.value)})`), k = b(() => E(n.value, "hex", a.showAlpha)), p = (e, l) => {
91
+ u.value = _(e), c.value = e.a, m({
92
+ ...e,
93
+ a: a.showAlpha ? e.a : 1
94
+ }, l);
95
+ }, P = (e) => {
96
+ const l = G(e);
97
+ l && p(l);
98
+ }, V = b(() => [Math.round(n.value.r), Math.round(n.value.g), Math.round(n.value.b)]), w = b(() => {
99
+ const {
100
+ h: e,
101
+ s: l,
102
+ l: s
103
+ } = W([Math.round(n.value.r), Math.round(n.value.g), Math.round(n.value.b)]);
104
+ return [Math.round(e), Math.round(l), Math.round(s)];
105
+ }), N = (e, l, s) => {
106
+ if (s === void 0) return;
107
+ if (e === "rgb") {
108
+ const i = {
109
+ ...n.value
110
+ };
111
+ l === 0 ? i.r = s : l === 1 ? i.g = s : i.b = s, p(i);
112
+ return;
113
+ }
114
+ const [T, U, A] = w.value, v = {
115
+ h: T,
116
+ s: U,
117
+ l: A
118
+ };
119
+ l === 0 ? v.h = s : l === 1 ? v.s = s : v.l = s;
120
+ const [f, r, M] = X(v);
121
+ p({
122
+ r: f,
123
+ g: r,
124
+ b: M,
125
+ a: n.value.a
126
+ });
127
+ }, R = b(() => E(n.value, "hex", a.showAlpha));
128
+ return {
129
+ className: y,
130
+ activeMode: d,
131
+ hsv: u,
132
+ alpha: c,
133
+ rgba: n,
134
+ hexValue: k,
135
+ rgbChannels: V,
136
+ hslChannels: w,
137
+ activeSwatch: R,
138
+ alphaBackground: I,
139
+ handleHsvChange: H,
140
+ handleHueChange: S,
141
+ handleAlphaChange: B,
142
+ handleHexInput: P,
143
+ handleChannelChange: N,
144
+ handleSwatchClick: (e, l) => {
145
+ const s = G(e);
146
+ s && p(s, l);
147
+ },
148
+ confirm: () => h("confirm", n.value),
149
+ clear: () => h("clear"),
150
+ close: () => h("close"),
151
+ formatAlphaPercent: ae,
152
+ HUE_GRADIENT: he,
153
+ Input: le,
154
+ InputNumber: ne,
155
+ Button: te,
156
+ IconCheck: oe,
157
+ SvPanel: se,
158
+ GradientSlider: re,
159
+ parseColorAlpha: G
160
+ };
161
+ },
162
+ render() {
163
+ const {
164
+ className: a,
165
+ activeMode: h,
166
+ hsv: y,
167
+ alpha: d,
168
+ rgba: u,
169
+ hexValue: c,
170
+ rgbChannels: n,
171
+ hslChannels: m,
172
+ activeSwatch: H,
173
+ alphaBackground: S,
174
+ handleHsvChange: B,
175
+ handleHueChange: I,
176
+ handleAlphaChange: k,
177
+ handleHexInput: p,
178
+ handleChannelChange: P,
179
+ handleSwatchClick: V,
180
+ confirm: w,
181
+ clear: N,
182
+ formatAlphaPercent: R,
183
+ HUE_GRADIENT: L,
184
+ Input: e,
185
+ InputNumber: l,
186
+ Button: s,
187
+ IconCheck: T,
188
+ SvPanel: U,
189
+ GradientSlider: A,
190
+ parseColorAlpha: v,
191
+ showAlpha: f,
192
+ disabled: r,
193
+ swatches: M,
194
+ showConfirm: i,
195
+ showClear: $,
196
+ modes: D,
197
+ texts: g
198
+ } = this, O = h === "rgb" ? n : m, q = h === "rgb" ? 255 : void 0;
199
+ return o("div", {
200
+ class: [a.element("panel"), {
201
+ [a.is("disabled")]: r
202
+ }],
203
+ onKeydown: (t) => {
204
+ t.key === "Escape" && (t.stopPropagation(), this.close());
205
+ }
206
+ }, [o("div", {
207
+ class: a.element("panel-body")
208
+ }, [o(U, {
209
+ value: y,
210
+ disabled: r,
211
+ onChange: B,
212
+ ariaLabel: g.saturation
213
+ }, null), o("div", {
214
+ class: a.element("sliders")
215
+ }, [o(A, {
216
+ value: y.h / 360 * 100,
217
+ background: L,
218
+ disabled: r,
219
+ ariaLabel: g.hue,
220
+ onChange: I
221
+ }, null), f && o(A, {
222
+ value: d * 100,
223
+ background: S,
224
+ disabled: r,
225
+ ariaLabel: g.alpha,
226
+ onChange: k
227
+ }, null)]), o("div", {
228
+ class: a.element("modes")
229
+ }, [D.map((t) => o("button", {
230
+ key: t,
231
+ type: "button",
232
+ class: [a.element("mode"), {
233
+ [a.is("active")]: h === t
234
+ }],
235
+ disabled: r,
236
+ onClick: () => {
237
+ this.activeMode = t;
238
+ }
239
+ }, [t.toUpperCase()]))]), o("div", {
240
+ class: a.element("inputs")
241
+ }, [h === "hex" ? o(e, {
242
+ size: "small",
243
+ disabled: r,
244
+ modelValue: c,
245
+ maxLength: 9,
246
+ "onUpdate:modelValue": (t) => p(t)
247
+ }, null) : o(J, null, [O.map((t, C) => o(l, {
248
+ key: `${h}-${C}`,
249
+ class: a.element("channel"),
250
+ size: "small",
251
+ hideButton: !0,
252
+ min: 0,
253
+ max: q,
254
+ precision: 0,
255
+ disabled: r,
256
+ modelValue: t,
257
+ "onUpdate:modelValue": (x) => P(h, C, x)
258
+ }, null)), f && o(l, {
259
+ class: a.element("channel"),
260
+ size: "small",
261
+ hideButton: !0,
262
+ min: 0,
263
+ max: 100,
264
+ precision: 0,
265
+ disabled: r,
266
+ modelValue: R(d),
267
+ "onUpdate:modelValue": (t) => {
268
+ t !== void 0 && k(t);
269
+ }
270
+ }, null)])]), M.length > 0 && o("div", {
271
+ class: a.element("swatches")
272
+ }, [M.map((t) => {
273
+ const C = v(t), x = C ? E(C, "hex", f) === H : !1;
274
+ return o("button", {
275
+ key: t,
276
+ type: "button",
277
+ class: [a.element("swatch"), {
278
+ [a.is("active")]: x
279
+ }],
280
+ style: {
281
+ backgroundColor: t
282
+ },
283
+ disabled: r,
284
+ onClick: (F) => V(t, F)
285
+ }, [x && o(T, null, null)]);
286
+ })])]), (i || $) && o("div", {
287
+ class: a.element("panel-footer")
288
+ }, [$ && o(s, {
289
+ size: "small",
290
+ type: "text",
291
+ disabled: r,
292
+ onClick: N
293
+ }, {
294
+ default: () => [g.clear]
295
+ }), i && o(s, {
296
+ size: "small",
297
+ type: "primary",
298
+ disabled: r,
299
+ onClick: w
300
+ }, {
301
+ default: () => [g.confirm]
302
+ })])]);
303
+ }
304
+ });
305
+ export {
306
+ Ce as default
307
+ };
@@ -0,0 +1,99 @@
1
+ import { defineComponent as $, ref as g, computed as d, watch as L, createVNode as s } from "vue";
2
+ import { getClassNameMixin as k } from "../../_utils/config.js";
3
+ import { hsvToRgb as C } from "../../_utils/color.js";
4
+ const E = /* @__PURE__ */ $({
5
+ name: "ColorPickerSvPanel",
6
+ props: {
7
+ /** h 0-360,s/v 0-100 */
8
+ value: {
9
+ type: Object,
10
+ required: !0
11
+ },
12
+ disabled: {
13
+ type: Boolean,
14
+ default: !1
15
+ },
16
+ /** 无障碍名称,由外层传入已本地化的文案 */
17
+ ariaLabel: {
18
+ type: String
19
+ }
20
+ },
21
+ emits: {
22
+ change: (e) => !0
23
+ },
24
+ setup(e, {
25
+ emit: v
26
+ }) {
27
+ const l = k("color-picker"), m = g(), i = g(!1), b = d(() => {
28
+ const [t, a, o] = C({
29
+ h: e.value.h,
30
+ s: 100,
31
+ v: 100
32
+ });
33
+ return `rgb(${t}, ${a}, ${o})`;
34
+ }), w = d(() => ({
35
+ backgroundColor: b.value
36
+ })), M = d(() => ({
37
+ left: `${e.value.s}%`,
38
+ top: `${100 - e.value.v}%`
39
+ })), h = (t, a) => {
40
+ const o = m.value;
41
+ if (!o || e.disabled) return;
42
+ const n = o.getBoundingClientRect();
43
+ if (!n.width || !n.height) return;
44
+ const u = Math.min(Math.max(t - n.left, 0), n.width), c = Math.min(Math.max(a - n.top, 0), n.height);
45
+ v("change", {
46
+ h: e.value.h,
47
+ s: u / n.width * 100,
48
+ v: (1 - c / n.height) * 100
49
+ });
50
+ }, f = (t) => {
51
+ h(t.clientX, t.clientY);
52
+ }, r = () => {
53
+ i.value = !1, document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", r);
54
+ }, y = (t) => {
55
+ e.disabled || (t.preventDefault(), i.value = !0, h(t.clientX, t.clientY), document.addEventListener("mousemove", f), document.addEventListener("mouseup", r));
56
+ }, x = (t) => {
57
+ if (e.disabled) return;
58
+ const a = t.shiftKey ? 10 : 1, n = {
59
+ ArrowLeft: [-a, 0],
60
+ ArrowRight: [a, 0],
61
+ ArrowUp: [0, a],
62
+ ArrowDown: [0, -a]
63
+ }[t.key];
64
+ if (!n) return;
65
+ t.preventDefault();
66
+ const u = Math.min(Math.max(e.value.s + n[0], 0), 100), c = Math.min(Math.max(e.value.v + n[1], 0), 100);
67
+ v("change", {
68
+ h: e.value.h,
69
+ s: u,
70
+ v: c
71
+ });
72
+ };
73
+ return L(() => e.disabled, (t) => {
74
+ t && r();
75
+ }), () => s("div", {
76
+ ref: m,
77
+ class: [l.element("sv"), {
78
+ [l.is("dragging")]: i.value
79
+ }],
80
+ style: w.value,
81
+ role: "slider",
82
+ "aria-label": e.ariaLabel,
83
+ "aria-valuetext": `${Math.round(e.value.s)}%, ${Math.round(e.value.v)}%`,
84
+ tabindex: e.disabled ? -1 : 0,
85
+ onMousedown: y,
86
+ onKeydown: x
87
+ }, [s("div", {
88
+ class: l.element("sv-white")
89
+ }, null), s("div", {
90
+ class: l.element("sv-black")
91
+ }, null), s("div", {
92
+ class: l.element("sv-handler"),
93
+ style: M.value
94
+ }, null)]);
95
+ }
96
+ });
97
+ export {
98
+ E as default
99
+ };
@@ -6,8 +6,8 @@ import { dropdownInjectionKey as O } from "./context.js";
6
6
  import { getClassNameMixin as P } from "../../_utils/config.js";
7
7
  import T from "../../_container/render-function.js";
8
8
  import { useFirstElement as k } from "../../_hooks/use-first-element.js";
9
- import { mergeFirstChild as K } from "../../_utils/vue-eco.js";
10
- import { useDropdownKeyboard as x } from "./use-keyboard.js";
9
+ import { mergeFirstChild as x } from "../../_utils/vue-eco.js";
10
+ import { useDropdownKeyboard as K } from "./use-keyboard.js";
11
11
  const q = v({
12
12
  name: "Dropdown",
13
13
  components: {
@@ -153,14 +153,21 @@ const q = v({
153
153
  defaultPopupVisible: d,
154
154
  popupVisible: s,
155
155
  emit: t
156
- }), { children: l, firstElement: m } = k(), r = x(
156
+ }), { children: l, firstElement: m } = k(), r = K(
157
157
  a,
158
158
  p,
159
159
  m
160
160
  ), g = (o) => {
161
161
  var i;
162
- return l.value = ((i = n.default) == null ? void 0 : i.call(n)) ?? [], K(l.value, {
162
+ return l.value = ((i = n.default) == null ? void 0 : i.call(n)) ?? [], x(l.value, {
163
163
  ...o,
164
+ /*
165
+ * 根触发器补菜单语义。子菜单的触发器已在 DropdownSubmenu 上声明
166
+ * aria-haspopup/aria-expanded,根触发器此前没有,读屏无法得知
167
+ * 这是一个会展开菜单的按钮,也不知道展开状态。
168
+ */
169
+ "aria-haspopup": "menu",
170
+ "aria-expanded": a.value ? "true" : "false",
164
171
  onKeydown: (u) => {
165
172
  u.key !== "ArrowRight" && r.handleTriggerKeydown(u);
166
173
  },
@@ -1,13 +1,13 @@
1
1
  import d from "./DropdownButton.vue2.js";
2
- import { resolveComponent as n, openBlock as u, createBlock as c, normalizeClass as i, withCtx as o, createVNode as p, mergeProps as m, renderSlot as s } from "vue";
2
+ import { resolveComponent as n, openBlock as u, createBlock as c, normalizeClass as t, withCtx as o, createVNode as p, mergeProps as m, renderSlot as s } from "vue";
3
3
  import b from "../../_virtual/_plugin-vue_export-helper.js";
4
4
  function f(e, g, h, C, z, B) {
5
- const t = n("Button"), l = n("IconMore"), r = n("Dropdown"), a = n("ButtonGroup");
5
+ const i = n("Button"), l = n("IconMore"), r = n("Dropdown"), a = n("ButtonGroup");
6
6
  return u(), c(a, {
7
- class: i(e.className.element("button"))
7
+ class: t(e.className.element("button"))
8
8
  }, {
9
9
  default: o(() => [
10
- p(t, m({
10
+ p(i, m({
11
11
  size: e.size,
12
12
  type: e.type,
13
13
  disabled: e.disabled
@@ -30,11 +30,12 @@ function f(e, g, h, C, z, B) {
30
30
  s(e.$slots, "content")
31
31
  ]),
32
32
  default: o(() => [
33
- p(t, {
34
- class: i(e.className.element("button--trigger")),
33
+ p(i, {
34
+ class: t(e.className.element("button--trigger")),
35
35
  size: e.size,
36
36
  type: e.type,
37
37
  disabled: e.disabled,
38
+ "aria-label": e.t("common.more"),
38
39
  narrow: ""
39
40
  }, {
40
41
  prefix: o(() => [
@@ -43,7 +44,7 @@ function f(e, g, h, C, z, B) {
43
44
  ])
44
45
  ]),
45
46
  _: 3
46
- }, 8, ["class", "size", "type", "disabled"])
47
+ }, 8, ["class", "size", "type", "disabled", "aria-label"])
47
48
  ]),
48
49
  _: 3
49
50
  }, 8, ["popup-visible", "trigger", "position", "popup-container", "hide-on-select", "onSelect", "onPopupVisibleChange"])
@@ -1,16 +1,17 @@
1
- import { defineComponent as a, toRefs as s } from "vue";
2
- import d from "../../icons/_self/more-dot.js";
3
- import { ButtonGroup as c, Button as f } from "../button/index.js";
4
- import m from "./Dropdown.vue.js";
5
- import { useTrigger as b } from "../../_hooks/use-trigger.js";
6
- import { getClassNameMixin as g } from "../../_utils/config.js";
7
- const P = a({
1
+ import { defineComponent as s, toRefs as d } from "vue";
2
+ import c from "../../icons/_self/more-dot.js";
3
+ import { ButtonGroup as f, Button as m } from "../button/index.js";
4
+ import b from "./Dropdown.vue.js";
5
+ import { useTrigger as g } from "../../_hooks/use-trigger.js";
6
+ import { useLocale as y } from "../../locale/index.js";
7
+ import { getClassNameMixin as h } from "../../_utils/config.js";
8
+ const M = s({
8
9
  name: "DropdownButton",
9
10
  components: {
10
- IconMore: d,
11
- Button: f,
12
- ButtonGroup: c,
13
- Dropdown: m
11
+ IconMore: c,
12
+ Button: m,
13
+ ButtonGroup: f,
14
+ Dropdown: b
14
15
  },
15
16
  props: {
16
17
  /**
@@ -129,24 +130,25 @@ const P = a({
129
130
  * @binding {boolean} popupVisible
130
131
  */
131
132
  setup(e, { emit: t }) {
132
- const { defaultPopupVisible: p, popupVisible: i } = s(e), l = g("dropdown"), { computedPopupVisible: n, handlePopupVisibleChange: r } = b({
133
+ const { defaultPopupVisible: p, popupVisible: i } = d(e), l = h("dropdown"), { t: n } = y(), { computedPopupVisible: r, handlePopupVisibleChange: u } = g({
133
134
  defaultPopupVisible: p,
134
135
  popupVisible: i,
135
136
  emit: t
136
137
  });
137
138
  return {
138
139
  className: l,
139
- computedPopupVisible: n,
140
+ t: n,
141
+ computedPopupVisible: r,
140
142
  handleClick: (o) => {
141
143
  t("click", o);
142
144
  },
143
- handleSelect: (o, u) => {
144
- t("select", o, u);
145
+ handleSelect: (o, a) => {
146
+ t("select", o, a);
145
147
  },
146
- handlePopupVisibleChange: r
148
+ handlePopupVisibleChange: u
147
149
  };
148
150
  }
149
151
  });
150
152
  export {
151
- P as default
153
+ M as default
152
154
  };
@@ -1,24 +1,25 @@
1
- import u from "./DropdownSubmenu.vue2.js";
2
- import { resolveComponent as s, openBlock as f, createBlock as c, withCtx as e, createVNode as p, mergeProps as g, createSlots as r, renderSlot as n, normalizeClass as m } from "vue";
3
- import b from "../../_virtual/_plugin-vue_export-helper.js";
4
- function h(o, C, w, $, P, v) {
5
- const a = s("IconRight"), t = s("dropdown-option"), l = s("dropdown-panel"), d = s("Trigger");
6
- return f(), c(d, {
1
+ import f from "./DropdownSubmenu.vue2.js";
2
+ import { resolveComponent as s, openBlock as c, createBlock as g, withCtx as e, createVNode as p, mergeProps as m, createSlots as a, renderSlot as n, normalizeClass as b } from "vue";
3
+ import h from "../../_virtual/_plugin-vue_export-helper.js";
4
+ function C(o, w, $, P, v, V) {
5
+ var i;
6
+ const t = s("IconRight"), l = s("dropdown-option"), d = s("dropdown-panel"), u = s("Trigger");
7
+ return c(), g(u, {
7
8
  "popup-visible": o.computedPopupVisible,
8
9
  trigger: o.trigger,
9
10
  position: o.position,
10
- disabled: o.disabled,
11
+ disabled: o.disabled || !!((i = o.optionProps) != null && i.disabled),
11
12
  "popup-offset": 4,
12
13
  onPopupVisibleChange: o.handlePopupVisibleChange,
13
14
  onShow: o.handleShow
14
15
  }, {
15
16
  content: e(() => [
16
- p(l, {
17
+ p(d, {
17
18
  ref: "panelRef",
18
- class: m(o.className.block),
19
+ class: b(o.className.block),
19
20
  "close-on-arrow-left": "",
20
21
  onClose: o.handleClose
21
- }, r({
22
+ }, a({
22
23
  default: e(() => [
23
24
  n(o.$slots, "content")
24
25
  ]),
@@ -34,10 +35,10 @@ function h(o, C, w, $, P, v) {
34
35
  ]), 1032, ["class", "onClose"])
35
36
  ]),
36
37
  default: e(() => {
37
- var i;
38
+ var r;
38
39
  return [
39
- p(t, g({ ref: "optionRef" }, o.optionProps, {
40
- disabled: o.disabled || ((i = o.optionProps) == null ? void 0 : i.disabled),
40
+ p(l, m({ ref: "optionRef" }, o.optionProps, {
41
+ disabled: o.disabled || ((r = o.optionProps) == null ? void 0 : r.disabled),
41
42
  active: o.computedPopupVisible,
42
43
  "uninject-context": "",
43
44
  "aria-haspopup": "menu",
@@ -45,10 +46,10 @@ function h(o, C, w, $, P, v) {
45
46
  onKeydownCapture: o.handleTriggerKeydown,
46
47
  onFocusinCapture: o.handleTriggerFocus,
47
48
  onFocusoutCapture: o.handleTriggerFocus
48
- }), r({
49
+ }), a({
49
50
  suffix: e(() => [
50
51
  n(o.$slots, "suffix", {}, () => [
51
- p(a)
52
+ p(t)
52
53
  ])
53
54
  ]),
54
55
  default: e(() => [
@@ -69,7 +70,7 @@ function h(o, C, w, $, P, v) {
69
70
  _: 3
70
71
  }, 8, ["popup-visible", "trigger", "position", "disabled", "onPopupVisibleChange", "onShow"]);
71
72
  }
72
- const k = /* @__PURE__ */ b(u, [["render", h]]);
73
+ const y = /* @__PURE__ */ h(f, [["render", C]]);
73
74
  export {
74
- k as default
75
+ y as default
75
76
  };
@@ -1,36 +1,36 @@
1
1
  import c from "./dropdown-panel.vue2.js";
2
- import { resolveComponent as s, openBlock as o, createElementBlock as n, normalizeClass as l, createBlock as t, renderSlot as a, createVNode as y, normalizeStyle as f, withCtx as u, createElementVNode as k, createCommentVNode as N } from "vue";
3
- import $ from "../../_virtual/_plugin-vue_export-helper.js";
4
- function w(e, r, S, E, b, g) {
2
+ import { resolveComponent as s, openBlock as l, createElementBlock as n, normalizeClass as o, createBlock as t, renderSlot as a, createVNode as y, normalizeStyle as f, withCtx as u, createElementVNode as k, createCommentVNode as w } from "vue";
3
+ import N from "../../_virtual/_plugin-vue_export-helper.js";
4
+ function $(e, r, S, E, b, g) {
5
5
  const m = s("spin"), p = s("empty"), d = s("Scrollbar");
6
- return o(), n("div", {
6
+ return l(), n("div", {
7
7
  ref: "panelElement",
8
- class: l(e.cls),
8
+ class: o(e.cls),
9
9
  tabindex: "-1",
10
10
  onKeydown: r[0] || (r[0] = (...i) => e.handleKeydown && e.handleKeydown(...i))
11
11
  }, [
12
- e.loading ? (o(), t(m, {
12
+ e.loading ? (l(), t(m, {
13
13
  key: 0,
14
- class: l(e.className.element("loading")),
14
+ class: o(e.className.element("loading")),
15
15
  display: "block",
16
16
  tip: e.t("common.loading")
17
- }, null, 8, ["class", "tip"])) : e.isEmpty ? (o(), n("div", {
17
+ }, null, 8, ["class", "tip"])) : e.isEmpty ? (l(), n("div", {
18
18
  key: 1,
19
- class: l(e.className.element("empty"))
19
+ class: o(e.className.element("empty"))
20
20
  }, [
21
21
  a(e.$slots, "empty", {}, () => [
22
- y(p)
22
+ y(p, { component: "dropdown" })
23
23
  ])
24
- ], 2)) : (o(), t(d, {
24
+ ], 2)) : (l(), t(d, {
25
25
  key: 2,
26
26
  ref: "wrapperRef",
27
- class: l(e.className.element("list--wrapper")),
27
+ class: o(e.className.element("list--wrapper")),
28
28
  style: f(e.style),
29
29
  onScroll: e.handleScroll
30
30
  }, {
31
31
  default: u(() => [
32
32
  k("ul", {
33
- class: l(e.className.element("list")),
33
+ class: o(e.className.element("list")),
34
34
  role: "menu"
35
35
  }, [
36
36
  a(e.$slots, "default")
@@ -38,15 +38,15 @@ function w(e, r, S, E, b, g) {
38
38
  ]),
39
39
  _: 3
40
40
  }, 8, ["class", "style", "onScroll"])),
41
- e.$slots.footer && !e.loading && !e.isEmpty ? (o(), n("div", {
41
+ e.$slots.footer && !e.loading && !e.isEmpty ? (l(), n("div", {
42
42
  key: 3,
43
- class: l(e.className.element("footer"))
43
+ class: o(e.className.element("footer"))
44
44
  }, [
45
45
  a(e.$slots, "footer")
46
- ], 2)) : N("", !0)
46
+ ], 2)) : w("", !0)
47
47
  ], 34);
48
48
  }
49
- const B = /* @__PURE__ */ $(c, [["render", w]]);
49
+ const B = /* @__PURE__ */ N(c, [["render", $]]);
50
50
  export {
51
51
  B as default
52
52
  };