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.
- package/AI_USAGE.md +57 -4
- package/CHANGELOG.md +72 -0
- package/dist/_utils/color.d.ts +53 -0
- package/dist/components/color-picker/ColorPicker.d.ts +239 -0
- package/dist/components/color-picker/gradient-slider.d.ts +52 -0
- package/dist/components/color-picker/index.d.ts +238 -0
- package/dist/components/color-picker/panel.d.ts +721 -0
- package/dist/components/color-picker/sv-panel.d.ts +48 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +3 -3
- package/dist/components/date-picker/index.d.ts +6 -6
- package/dist/components/draggable/Draggable.d.ts +1 -1
- package/dist/components/draggable/index.d.ts +2 -2
- package/dist/components/drawer/index.d.ts +6 -6
- package/dist/components/drawer/src/Drawer.vue.d.ts +3 -3
- package/dist/components/dropdown/Dropdown.vue.d.ts +34 -4
- package/dist/components/dropdown/DropdownButton.vue.d.ts +35 -5
- package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +34 -4
- package/dist/components/dropdown/dropdown-panel.vue.d.ts +30 -0
- package/dist/components/dropdown/index.d.ts +209 -29
- package/dist/components/form/FormItem.vue.d.ts +12 -12
- package/dist/components/form/form-item-label.vue.d.ts +3 -3
- package/dist/components/form/index.d.ts +24 -24
- package/dist/components/form-select/Select.d.ts +3 -3
- package/dist/components/form-select/SelectDropdown.vue.d.ts +30 -0
- package/dist/components/form-select/index.d.ts +66 -6
- package/dist/components/form-slider/Slider.vue.d.ts +3 -3
- package/dist/components/form-slider/index.d.ts +6 -6
- package/dist/components/form-slider/slider-button.vue.d.ts +3 -3
- package/dist/components/grid/Row.vue.d.ts +3 -3
- package/dist/components/grid/index.d.ts +9 -9
- package/dist/components/heatmap/Heatmap.d.ts +311 -0
- package/dist/components/heatmap/helpers/matrix.d.ts +58 -0
- package/dist/components/heatmap/index.d.ts +372 -0
- package/dist/components/heatmap/interface.d.ts +57 -0
- package/dist/components/image/Image.vue.d.ts +125 -17
- package/dist/components/image/ImagePreview.vue.d.ts +97 -7
- package/dist/components/image/ImagePreviewAction.d.ts +3 -3
- package/dist/components/image/ImagePreviewGroup.vue.d.ts +100 -7
- package/dist/components/image/hooks/use-image-drag.d.ts +2 -2
- package/dist/components/image/index.d.ts +712 -124
- package/dist/components/image/interface.d.ts +9 -1
- package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
- package/dist/components/index.d.ts +3 -0
- package/dist/components/menu/sub-menu-pop.vue.d.ts +3 -3
- package/dist/components/network/Network.vue.d.ts +1 -1
- package/dist/components/network/index.d.ts +3 -3
- package/dist/components/network/utils.d.ts +2 -0
- package/dist/components/pagination/page-item-ellipsis.vue.d.ts +9 -0
- package/dist/components/pagination/page-jumper.vue.d.ts +6 -0
- package/dist/components/pagination/page-options.vue.d.ts +6 -6
- package/dist/components/popconfirm/src/popup.vue.d.ts +3 -3
- package/dist/components/popover/Popover.d.ts +1 -1
- package/dist/components/popover/index.d.ts +3 -3
- package/dist/components/popup/Popup.d.ts +1 -1
- package/dist/components/popup/index.d.ts +3 -3
- package/dist/components/skeleton/SkeletonShape.vue.d.ts +3 -3
- package/dist/components/skeleton/index.d.ts +6 -6
- package/dist/components/space/Space.d.ts +1 -1
- package/dist/components/space/index.d.ts +3 -3
- package/dist/components/spin/Spin.d.ts +38 -0
- package/dist/components/spin/index.d.ts +30 -0
- package/dist/components/table/Table.d.ts +1 -1
- package/dist/components/table/index.d.ts +3 -3
- package/dist/components/tabs/Tabs.d.ts +1 -1
- package/dist/components/tabs/index.d.ts +3 -3
- package/dist/components/time-picker/TimePicker.vue.d.ts +3 -3
- package/dist/components/time-picker/index.d.ts +6 -6
- package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
- package/dist/components/tooltip/index.d.ts +3 -3
- package/dist/components/trigger/Trigger.d.ts +1 -1
- package/dist/components/trigger/index.d.ts +3 -3
- package/dist/components/upload/Upload.d.ts +372 -0
- package/dist/components/upload/context.d.ts +28 -0
- package/dist/components/upload/index.d.ts +656 -0
- package/dist/components/upload/interface.d.ts +110 -0
- package/dist/components/upload/props.d.ts +321 -0
- package/dist/components/upload/upload-list-item.d.ts +15 -0
- package/dist/components/upload/upload-list.d.ts +11 -0
- package/dist/components/upload/upload-picture-item.d.ts +20 -0
- package/dist/components/upload/upload-trigger.d.ts +8 -0
- package/dist/components/upload/utils.d.ts +48 -0
- package/dist/components/watermark/Watermark.d.ts +1 -1
- package/dist/components/watermark/index.d.ts +3 -3
- package/dist/es/_styles/palette-aliases.js +10 -4
- package/dist/es/_utils/color.js +73 -0
- package/dist/es/components/button/Button.js +2 -2
- package/dist/es/components/color-picker/ColorPicker.js +239 -0
- package/dist/es/components/color-picker/gradient-slider.js +79 -0
- package/dist/es/components/color-picker/index.js +8 -0
- package/dist/es/components/color-picker/panel.js +307 -0
- package/dist/es/components/color-picker/sv-panel.js +99 -0
- package/dist/es/components/dropdown/dropdown-panel.vue.js +17 -17
- package/dist/es/components/form-input/Input.js +7 -7
- package/dist/es/components/form-input/InputPassword.vue2.js +2 -2
- package/dist/es/components/form-input/InputSearch.js +2 -2
- package/dist/es/components/form-input-number/InputNumber.js +12 -12
- package/dist/es/components/heatmap/Heatmap.js +334 -0
- package/dist/es/components/heatmap/helpers/matrix.js +106 -0
- package/dist/es/components/heatmap/index.js +8 -0
- package/dist/es/components/image/Image.vue.js +55 -45
- package/dist/es/components/image/Image.vue2.js +113 -92
- package/dist/es/components/image/ImagePreview.vue.js +66 -53
- package/dist/es/components/image/ImagePreview.vue2.js +219 -171
- package/dist/es/components/image/ImagePreviewAction.js +12 -15
- package/dist/es/components/image/ImagePreviewGroup.vue.js +21 -20
- package/dist/es/components/image/ImagePreviewGroup.vue2.js +45 -39
- package/dist/es/components/image/hooks/use-image-drag.js +16 -14
- package/dist/es/components/index.js +123 -117
- package/dist/es/components/menu/sub-menu-pop.vue2.js +12 -12
- package/dist/es/components/network/Network.vue2.js +72 -72
- package/dist/es/components/network/utils.js +44 -35
- package/dist/es/components/pagination/Pagination.js +113 -104
- package/dist/es/components/pagination/page-item-ellipsis.vue.js +13 -12
- package/dist/es/components/pagination/page-item-ellipsis.vue2.js +19 -15
- package/dist/es/components/pagination/page-jumper.vue.js +13 -12
- package/dist/es/components/pagination/page-jumper.vue2.js +7 -4
- package/dist/es/components/pagination/page-options.vue.js +4 -3
- package/dist/es/components/pagination/page-options.vue2.js +17 -15
- package/dist/es/components/skeleton/Skeleton.vue.js +11 -9
- package/dist/es/components/skeleton/SkeletonLine.vue.js +9 -8
- package/dist/es/components/skeleton/SkeletonShape.vue.js +8 -7
- package/dist/es/components/spin/Spin.js +124 -60
- package/dist/es/components/table/Table.js +3 -1
- package/dist/es/components/trigger/Trigger.js +19 -19
- package/dist/es/components/upload/Upload.js +420 -0
- package/dist/es/components/upload/context.js +4 -0
- package/dist/es/components/upload/index.js +8 -0
- package/dist/es/components/upload/props.js +321 -0
- package/dist/es/components/upload/upload-list-item.js +138 -0
- package/dist/es/components/upload/upload-list.js +48 -0
- package/dist/es/components/upload/upload-picture-item.js +109 -0
- package/dist/es/components/upload/upload-trigger.js +89 -0
- package/dist/es/components/upload/utils.js +195 -0
- package/dist/es/icons/_self/empty-better.js +25 -8
- package/dist/es/icons/_self/upload-icons.js +103 -0
- package/dist/es/index.js +168 -162
- package/dist/es/locale/en-US.js +39 -1
- package/dist/es/locale/zh-CN.js +39 -1
- package/dist/es/style.css +1 -1
- package/dist/icons/_self/upload-icons.d.ts +523 -0
- package/dist/index.cjs +4 -4
- package/dist/index.umd.js +4 -4
- package/dist/locale/interface.d.ts +60 -0
- package/dist/style/base.css +1 -1
- package/dist/style/button.css +1 -1
- package/dist/style/color-picker.css +1 -0
- package/dist/style/color-picker.js +2 -0
- package/dist/style/date-picker.css +1 -1
- package/dist/style/empty.css +1 -1
- package/dist/style/form-checkbox.css +1 -1
- package/dist/style/form-input-tag.css +1 -1
- package/dist/style/form-input.css +1 -1
- package/dist/style/form-radio.css +1 -1
- package/dist/style/form-textarea.css +1 -1
- package/dist/style/form.css +1 -1
- package/dist/style/heatmap.css +1 -0
- package/dist/style/heatmap.js +2 -0
- package/dist/style/image.css +1 -1
- package/dist/style/menu.css +1 -1
- package/dist/style/pagination.css +1 -1
- package/dist/style/skeleton.css +1 -1
- package/dist/style/spin.css +1 -1
- package/dist/style/steps.css +1 -1
- package/dist/style/table.css +1 -1
- package/dist/style/upload.css +1 -0
- package/dist/style/upload.js +2 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
- package/volar.d.ts +3 -0
- package/dist/es/_hooks/use-popup-overflow-hidden.js +0 -29
|
@@ -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
|
+
};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import c from "./dropdown-panel.vue2.js";
|
|
2
|
-
import { resolveComponent as s, openBlock as
|
|
3
|
-
import
|
|
4
|
-
function
|
|
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
|
|
6
|
+
return l(), n("div", {
|
|
7
7
|
ref: "panelElement",
|
|
8
|
-
class:
|
|
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 ? (
|
|
12
|
+
e.loading ? (l(), t(m, {
|
|
13
13
|
key: 0,
|
|
14
|
-
class:
|
|
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 ? (
|
|
17
|
+
}, null, 8, ["class", "tip"])) : e.isEmpty ? (l(), n("div", {
|
|
18
18
|
key: 1,
|
|
19
|
-
class:
|
|
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)) : (
|
|
24
|
+
], 2)) : (l(), t(d, {
|
|
25
25
|
key: 2,
|
|
26
26
|
ref: "wrapperRef",
|
|
27
|
-
class:
|
|
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:
|
|
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 ? (
|
|
41
|
+
e.$slots.footer && !e.loading && !e.isEmpty ? (l(), n("div", {
|
|
42
42
|
key: 3,
|
|
43
|
-
class:
|
|
43
|
+
class: o(e.className.element("footer"))
|
|
44
44
|
}, [
|
|
45
45
|
a(e.$slots, "footer")
|
|
46
|
-
], 2)) :
|
|
46
|
+
], 2)) : w("", !0)
|
|
47
47
|
], 34);
|
|
48
48
|
}
|
|
49
|
-
const B = /* @__PURE__ */
|
|
49
|
+
const B = /* @__PURE__ */ N(c, [["render", $]]);
|
|
50
50
|
export {
|
|
51
51
|
B as default
|
|
52
52
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as ce, toRefs as de, ref as h, computed as r, watch as fe, createVNode as i, mergeProps as F, createTextVNode as me, nextTick as ve } from "vue";
|
|
2
|
-
import { INPUT_EVENTS as
|
|
2
|
+
import { INPUT_EVENTS as _ } from "../../_utils/constant.js";
|
|
3
3
|
import pe from "../_components/feedback-icon/index.vue.js";
|
|
4
4
|
import { Enter as he } from "../../_utils/keycode.js";
|
|
5
5
|
import ge from "../_components/icon-hover/index.vue.js";
|
|
@@ -229,7 +229,7 @@ const Ke = /* @__PURE__ */ ce({
|
|
|
229
229
|
var n, a;
|
|
230
230
|
I.value = !1, k(c.value, e), s("blur", e), (a = (n = v.value) == null ? void 0 : n.onBlur) == null || a.call(n, e);
|
|
231
231
|
}, E = (e) => {
|
|
232
|
-
var L,
|
|
232
|
+
var L, R;
|
|
233
233
|
const {
|
|
234
234
|
value: n,
|
|
235
235
|
selectionStart: a,
|
|
@@ -240,7 +240,7 @@ const Ke = /* @__PURE__ */ ce({
|
|
|
240
240
|
b();
|
|
241
241
|
return;
|
|
242
242
|
}
|
|
243
|
-
S(n), s("input", n, e), (
|
|
243
|
+
S(n), s("input", n, e), (R = (L = v.value) == null ? void 0 : L.onInput) == null || R.call(L, e), b();
|
|
244
244
|
} else
|
|
245
245
|
x.value = !0, A.value = c.value + (e.data ?? "");
|
|
246
246
|
}, b = () => {
|
|
@@ -265,7 +265,7 @@ const Ke = /* @__PURE__ */ ce({
|
|
|
265
265
|
}, ae = (e) => {
|
|
266
266
|
const n = e.key || e.code;
|
|
267
267
|
!x.value && n === he.key && (k(c.value, e), s("pressEnter", e));
|
|
268
|
-
}, M = r(() => j(j(m,
|
|
268
|
+
}, M = r(() => j(j(m, _), ["class", "style"])), le = r(() => xe(m, _)), ue = r(() => [l.element("outer"), m.class, l.element(`outer-size-${N.value}`), {
|
|
269
269
|
[l.element("outer-has-suffix")]: !!u.suffix,
|
|
270
270
|
[l.element("outer-disabled")]: g.value
|
|
271
271
|
}]), oe = (e) => [l.element("wrapper"), !e && m.class, {
|
|
@@ -280,7 +280,7 @@ const Ke = /* @__PURE__ */ ce({
|
|
|
280
280
|
...ie.value
|
|
281
281
|
};
|
|
282
282
|
return T.value && (e["aria-invalid"] = !0), e;
|
|
283
|
-
}),
|
|
283
|
+
}), O = (e) => {
|
|
284
284
|
var n;
|
|
285
285
|
return i("span", F({
|
|
286
286
|
class: oe(e),
|
|
@@ -330,9 +330,9 @@ const Ke = /* @__PURE__ */ ce({
|
|
|
330
330
|
style: m.style
|
|
331
331
|
}, M.value), [u.prepend && i("span", {
|
|
332
332
|
class: l.element("prepend")
|
|
333
|
-
}, [u.prepend()]),
|
|
333
|
+
}, [u.prepend()]), O(!0), u.append && i("span", {
|
|
334
334
|
class: l.element("append")
|
|
335
|
-
}, [u.append()])]) :
|
|
335
|
+
}, [u.append()])]) : O()
|
|
336
336
|
};
|
|
337
337
|
},
|
|
338
338
|
methods: {
|
|
@@ -5,7 +5,7 @@ import h from "../../icons/default/eye-invisible.js";
|
|
|
5
5
|
import g from "../../_hooks/use-merge-state.js";
|
|
6
6
|
import { useLocale as B } from "../../locale/index.js";
|
|
7
7
|
import R from "./Input.js";
|
|
8
|
-
import { useFormItem as
|
|
8
|
+
import { useFormItem as E } from "../../_hooks/use-form-item.js";
|
|
9
9
|
const M = d({
|
|
10
10
|
name: "InputPassword",
|
|
11
11
|
components: {
|
|
@@ -59,7 +59,7 @@ const M = d({
|
|
|
59
59
|
"update:visibility"
|
|
60
60
|
],
|
|
61
61
|
setup(e, { emit: o }) {
|
|
62
|
-
const { visibility: l, defaultVisibility: a, disabled: n } = c(e), r = v(), { t: u } = B(), { mergedDisabled: s } =
|
|
62
|
+
const { visibility: l, defaultVisibility: a, disabled: n } = c(e), r = v(), { t: u } = B(), { mergedDisabled: s } = E({ disabled: n }), f = () => {
|
|
63
63
|
s.value || m(!i.value);
|
|
64
64
|
}, [i, p] = g(
|
|
65
65
|
a.value,
|
|
@@ -7,7 +7,7 @@ import { Button as P } from "../button/index.js";
|
|
|
7
7
|
import k from "./Input.js";
|
|
8
8
|
import { useSize as T } from "../../_hooks/use-size.js";
|
|
9
9
|
import { useFormItem as N } from "../../_hooks/use-form-item.js";
|
|
10
|
-
import { getClassNameMixin as
|
|
10
|
+
import { getClassNameMixin as F } from "../../_utils/config.js";
|
|
11
11
|
const E = /* @__PURE__ */ x({
|
|
12
12
|
name: "InputSearch",
|
|
13
13
|
props: {
|
|
@@ -76,7 +76,7 @@ const E = /* @__PURE__ */ x({
|
|
|
76
76
|
const {
|
|
77
77
|
size: s,
|
|
78
78
|
disabled: b
|
|
79
|
-
} = S(e), i =
|
|
79
|
+
} = S(e), i = F("input-search"), {
|
|
80
80
|
t: p
|
|
81
81
|
} = I(), {
|
|
82
82
|
mergedSize: g,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as J, toRefs as Q, ref as V, computed as D, watch as E, onUnmounted as X, createVNode as o, Fragment as Z } from "vue";
|
|
2
2
|
import O from "../../node_modules/.pnpm/number-precision@1.6.0/node_modules/number-precision/build/index.es.js";
|
|
3
3
|
import { isNumber as s, isUndefined as ee } from "../../_utils/is.js";
|
|
4
4
|
import ne from "../../icons/default/up.js";
|
|
5
5
|
import ue from "../../icons/default/down.js";
|
|
6
6
|
import te from "../../icons/default/plus.js";
|
|
7
7
|
import ae from "../../icons/default/minus.js";
|
|
8
|
-
import
|
|
8
|
+
import _ from "../button/Button.js";
|
|
9
9
|
import { Input as le } from "../form-input/index.js";
|
|
10
10
|
import { useFormItem as ie } from "../../_hooks/use-form-item.js";
|
|
11
11
|
import { useSize as re } from "../../_hooks/use-size.js";
|
|
@@ -13,7 +13,7 @@ import { getKeyDownHandler as de, KEYBOARD_KEY as A } from "../../_utils/keyboar
|
|
|
13
13
|
import { getClassNameMixin as oe } from "../../_utils/config.js";
|
|
14
14
|
const fe = 800, me = 150;
|
|
15
15
|
O.enableBoundaryChecking(!1);
|
|
16
|
-
const Ie = /* @__PURE__ */
|
|
16
|
+
const Ie = /* @__PURE__ */ J({
|
|
17
17
|
name: "InputNumber",
|
|
18
18
|
props: {
|
|
19
19
|
/**
|
|
@@ -232,7 +232,7 @@ const Ie = /* @__PURE__ */ G({
|
|
|
232
232
|
const {
|
|
233
233
|
size: F,
|
|
234
234
|
disabled: P
|
|
235
|
-
} =
|
|
235
|
+
} = Q(n), d = oe("input-number"), B = V(), {
|
|
236
236
|
mergedSize: $,
|
|
237
237
|
mergedDisabled: v,
|
|
238
238
|
eventHandlers: I
|
|
@@ -272,7 +272,7 @@ const Ie = /* @__PURE__ */ G({
|
|
|
272
272
|
const e = R(l.value), u = w(e);
|
|
273
273
|
(e !== l.value || f.value !== u) && (f.value = u), i("update:modelValue", e);
|
|
274
274
|
};
|
|
275
|
-
|
|
275
|
+
E(() => [n.max, n.min], () => {
|
|
276
276
|
z(), M(l.value);
|
|
277
277
|
});
|
|
278
278
|
const N = (e, u) => {
|
|
@@ -295,8 +295,8 @@ const Ie = /* @__PURE__ */ G({
|
|
|
295
295
|
x = window.setTimeout(c, fe);
|
|
296
296
|
}
|
|
297
297
|
}, k = (e, u) => {
|
|
298
|
-
var t, r, c,
|
|
299
|
-
e = e.trim().replace(/。/g, "."), e = ((t = n.parser) == null ? void 0 : t.call(n, e)) ?? e, (s(Number(e)) || /^(\.|-)$/.test(e)) && (f.value = ((r = n.formatter) == null ? void 0 : r.call(n, e)) ?? e, M(l.value), i("input", l.value, f.value, u), n.modelEvent === "input" && (i("update:modelValue", l.value), i("change", l.value, u), (
|
|
298
|
+
var t, r, c, p;
|
|
299
|
+
e = e.trim().replace(/。/g, "."), e = ((t = n.parser) == null ? void 0 : t.call(n, e)) ?? e, (s(Number(e)) || /^(\.|-)$/.test(e)) && (f.value = ((r = n.formatter) == null ? void 0 : r.call(n, e)) ?? e, M(l.value), i("input", l.value, f.value, u), n.modelEvent === "input" && (i("update:modelValue", l.value), i("change", l.value, u), (p = (c = I.value) == null ? void 0 : c.onChange) == null || p.call(c, u)));
|
|
300
300
|
}, T = (e) => {
|
|
301
301
|
i("focus", e);
|
|
302
302
|
}, K = (e, u) => {
|
|
@@ -313,7 +313,7 @@ const Ie = /* @__PURE__ */ G({
|
|
|
313
313
|
}]])), Y = (e) => {
|
|
314
314
|
i("keydown", e), e.defaultPrevented || W(e);
|
|
315
315
|
};
|
|
316
|
-
|
|
316
|
+
E(() => n.modelValue, (e) => {
|
|
317
317
|
e !== l.value && (f.value = w(e), M(e));
|
|
318
318
|
});
|
|
319
319
|
const q = () => {
|
|
@@ -345,7 +345,7 @@ const Ie = /* @__PURE__ */ G({
|
|
|
345
345
|
}, [a.minus ? (t = a.minus) == null ? void 0 : t.call(a) : o(ue, null, null)])])]);
|
|
346
346
|
}, L = D(() => [d.block, d.modifier(`mode-${n.mode}`), d.modifier(`size-${g.value}`), {
|
|
347
347
|
[d.modifier("readonly")]: n.readOnly
|
|
348
|
-
}]), j = () => o(
|
|
348
|
+
}]), j = () => o(_, {
|
|
349
349
|
size: g.value,
|
|
350
350
|
shape: "square",
|
|
351
351
|
narrow: !0,
|
|
@@ -357,7 +357,7 @@ const Ie = /* @__PURE__ */ G({
|
|
|
357
357
|
onMouseleave: m
|
|
358
358
|
}, {
|
|
359
359
|
icon: () => o(ae, null, null)
|
|
360
|
-
}),
|
|
360
|
+
}), G = () => o(_, {
|
|
361
361
|
size: g.value,
|
|
362
362
|
shape: "square",
|
|
363
363
|
narrow: !0,
|
|
@@ -370,7 +370,7 @@ const Ie = /* @__PURE__ */ G({
|
|
|
370
370
|
}, {
|
|
371
371
|
icon: () => o(te, null, null)
|
|
372
372
|
});
|
|
373
|
-
return
|
|
373
|
+
return X(m), {
|
|
374
374
|
inputRef: B,
|
|
375
375
|
render: () => {
|
|
376
376
|
const e = n.mode === "embed" ? {
|
|
@@ -382,7 +382,7 @@ const Ie = /* @__PURE__ */ G({
|
|
|
382
382
|
prepend: n.hideButton ? a.prepend : j,
|
|
383
383
|
prefix: a.prefix,
|
|
384
384
|
suffix: a.suffix,
|
|
385
|
-
append: n.hideButton ? a.append :
|
|
385
|
+
append: n.hideButton ? a.append : G
|
|
386
386
|
};
|
|
387
387
|
return o(le, {
|
|
388
388
|
key: `input-number-${n.mode}`,
|