x-next 1.10.0 → 1.11.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_CODING.md +97 -0
- package/AI_USAGE/catalog.md +111 -0
- package/AI_USAGE/components/alert.md +33 -0
- package/AI_USAGE/components/bar-chart.md +46 -0
- package/AI_USAGE/components/button.md +35 -0
- package/AI_USAGE/components/checkbox.md +34 -0
- package/AI_USAGE/components/color-picker.md +36 -0
- package/AI_USAGE/components/config-provider.md +58 -0
- package/AI_USAGE/components/date-picker.md +34 -0
- package/AI_USAGE/components/dialog.md +37 -0
- package/AI_USAGE/components/dropdown.md +38 -0
- package/AI_USAGE/components/empty.md +30 -0
- package/AI_USAGE/components/input.md +32 -0
- package/AI_USAGE/components/line-chart.md +45 -0
- package/AI_USAGE/components/message-box.md +39 -0
- package/AI_USAGE/components/message.md +36 -0
- package/AI_USAGE/components/notification.md +37 -0
- package/AI_USAGE/components/pagination.md +32 -0
- package/AI_USAGE/components/pie-chart.md +55 -0
- package/AI_USAGE/components/popconfirm.md +33 -0
- package/AI_USAGE/components/popover.md +35 -0
- package/AI_USAGE/components/progress.md +32 -0
- package/AI_USAGE/components/radio.md +35 -0
- package/AI_USAGE/components/rate.md +30 -0
- package/AI_USAGE/components/select.md +38 -0
- package/AI_USAGE/components/slider.md +34 -0
- package/AI_USAGE/components/steps.md +33 -0
- package/AI_USAGE/components/switch.md +32 -0
- package/AI_USAGE/components/tabs.md +33 -0
- package/AI_USAGE/components/textarea.md +31 -0
- package/AI_USAGE/components/time-picker.md +34 -0
- package/AI_USAGE/components/upload.md +60 -0
- package/AI_USAGE/core.md +37 -0
- package/AI_USAGE/index.md +52 -0
- package/AI_USAGE/recipes/form-on-demand.md +42 -0
- package/AI_USAGE.md +173 -46
- package/CHANGELOG.md +36 -1
- package/README.md +15 -2
- package/dist/_container/resize-trigger.vue.d.ts +1 -1
- package/dist/_hooks/use-dialog-focus.d.ts +7 -0
- package/dist/_hooks/use-pointer-drag.d.ts +6 -0
- package/dist/_hooks/use-popup-close.d.ts +11 -0
- package/dist/_hooks/use-popup-theme.d.ts +5 -0
- package/dist/_utils/palette.d.ts +2 -0
- package/dist/components/_components/picker/input-range.vue.d.ts +1 -3
- package/dist/components/_components/picker/input.vue.d.ts +1 -3
- package/dist/components/_components/select-view/select-view.d.ts +9 -0
- package/dist/components/alert/Alert.vue.d.ts +1 -1
- package/dist/components/alert/index.d.ts +3 -3
- package/dist/components/bar-chart/BarChart.d.ts +3 -3
- package/dist/components/bar-chart/index.d.ts +9 -9
- package/dist/components/color-picker/ColorPicker.d.ts +2 -1
- package/dist/components/color-picker/index.d.ts +2 -0
- package/dist/components/color-picker/panel.d.ts +6 -0
- package/dist/components/config-provider/context.d.ts +7 -1
- package/dist/components/date-picker/DatePicker.vue.d.ts +9 -12
- package/dist/components/date-picker/index.d.ts +19 -27
- package/dist/components/drawer/index.d.ts +51 -9
- package/dist/components/drawer/src/Drawer.vue.d.ts +19 -4
- package/dist/components/dropdown/Dropdown.vue.d.ts +6 -3
- package/dist/components/dropdown/DropdownButton.vue.d.ts +6 -3
- package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +6 -3
- package/dist/components/dropdown/dropdown-panel.vue.d.ts +6 -3
- package/dist/components/dropdown/index.d.ts +36 -18
- package/dist/components/form-select/Select.d.ts +18 -5
- package/dist/components/form-select/SelectDropdown.vue.d.ts +6 -3
- package/dist/components/form-select/SelectOption.vue.d.ts +1 -0
- package/dist/components/form-select/SelectOptionGroup.vue.d.ts +1 -0
- package/dist/components/form-select/hooks/use-options.d.ts +1 -1
- package/dist/components/form-select/hooks/use-select.d.ts +1 -1
- package/dist/components/form-select/index.d.ts +57 -17
- package/dist/components/form-select/interface.d.ts +8 -0
- package/dist/components/form-slider/Slider.vue.d.ts +1 -1
- package/dist/components/form-slider/index.d.ts +3 -3
- package/dist/components/form-textarea/Textarea.vue.d.ts +2 -4
- package/dist/components/form-textarea/index.d.ts +6 -12
- package/dist/components/image/Image.vue.d.ts +2 -4
- package/dist/components/image/index.d.ts +6 -12
- package/dist/components/layout/LayoutSidebar.vue.d.ts +5 -5
- package/dist/components/layout/index.d.ts +10 -10
- package/dist/components/line-chart/LineChart.d.ts +3 -3
- package/dist/components/line-chart/index.d.ts +9 -9
- package/dist/components/menu/Menu.d.ts +6 -3
- package/dist/components/menu/base-menu.vue.d.ts +6 -3
- package/dist/components/menu/index.d.ts +12 -6
- package/dist/components/menu/sub-menu-pop.vue.d.ts +6 -3
- package/dist/components/network/Network.vue.d.ts +1 -1
- package/dist/components/network/index.d.ts +3 -3
- package/dist/components/pagination/page-options.vue.d.ts +60 -32
- package/dist/components/pie-chart/PieChart.d.ts +1 -1
- package/dist/components/pie-chart/index.d.ts +3 -3
- package/dist/components/resize-box/ResizeBox.vue.d.ts +2 -2
- package/dist/components/resize-box/index.d.ts +5 -5
- package/dist/components/scrollbar-v2/Scrollbar.vue.d.ts +2 -1
- package/dist/components/scrollbar-v2/index.d.ts +6 -3
- 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/TimeColumn.vue.d.ts +6 -3
- package/dist/components/time-picker/TimePanel.vue.d.ts +6 -3
- package/dist/components/time-picker/TimePicker.vue.d.ts +9 -12
- package/dist/components/time-picker/index.d.ts +19 -27
- package/dist/components/trend-chart/components/TrendChart.d.ts +5 -5
- package/dist/components/trend-chart/components/trend-chart-curve.d.ts +1 -1
- package/dist/components/trend-chart/index.d.ts +14 -14
- package/dist/components/trigger/interface.d.ts +2 -0
- package/dist/components/virtual-list-v2/virtual-list.vue.d.ts +7 -4
- package/dist/es/_hooks/use-dialog-focus.js +69 -0
- package/dist/es/_hooks/use-pointer-drag.js +18 -0
- package/dist/es/_hooks/use-popup-close.js +27 -0
- package/dist/es/_hooks/use-popup-manager.js +26 -24
- package/dist/es/_hooks/use-popup-theme.js +18 -0
- package/dist/es/_hooks/use-teleport-container.js +9 -10
- package/dist/es/_utils/palette.js +57 -52
- package/dist/es/components/_components/select-view/select-view.js +89 -78
- package/dist/es/components/button/Button.js +1 -1
- package/dist/es/components/color-picker/ColorPicker.js +131 -102
- package/dist/es/components/color-picker/gradient-slider.js +38 -40
- package/dist/es/components/color-picker/panel.js +221 -192
- package/dist/es/components/color-picker/sv-panel.js +51 -50
- package/dist/es/components/config-provider/ConfigProvider.js +58 -41
- package/dist/es/components/dialog/Dialog.js +133 -186
- package/dist/es/components/drawer/src/Drawer.vue.js +59 -51
- package/dist/es/components/drawer/src/Drawer.vue2.js +117 -107
- package/dist/es/components/form/FormItem.vue.js +12 -12
- package/dist/es/components/form-input-tag/InputTag.js +1 -1
- package/dist/es/components/form-select/Select.js +348 -300
- package/dist/es/components/form-select/SelectDropdown.vue.js +7 -7
- package/dist/es/components/form-select/SelectOption.vue.js +22 -17
- package/dist/es/components/form-select/SelectOption.vue2.js +59 -51
- package/dist/es/components/form-select/SelectOptionGroup.vue.js +17 -13
- package/dist/es/components/form-select/SelectOptionGroup.vue2.js +8 -5
- package/dist/es/components/form-select/hooks/use-options.js +40 -40
- package/dist/es/components/form-select/hooks/use-select.js +76 -71
- package/dist/es/components/form-switch/Switch.vue.js +24 -24
- package/dist/es/components/image/Image.vue.js +12 -12
- package/dist/es/components/link/Link.vue.js +6 -6
- package/dist/es/components/menu/sub-menu-inline.vue.js +11 -11
- package/dist/es/components/menu/sub-menu-pop.vue.js +12 -12
- package/dist/es/components/notification/Notification.js +59 -59
- package/dist/es/components/resize-box/ResizeBox.vue.js +19 -22
- package/dist/es/components/skeleton/Skeleton.vue.js +9 -9
- package/dist/es/components/tag/Tag.vue.js +7 -7
- package/dist/es/components/trigger/Trigger.js +171 -163
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/style/bar-chart.js +1 -0
- package/dist/style/base.css +1 -1
- package/dist/style/button.css +1 -1
- package/dist/style/color-picker.css +1 -1
- package/dist/style/color-picker.js +4 -0
- package/dist/style/date-picker.js +4 -0
- package/dist/style/dependencies.json +296 -0
- package/dist/style/dialog.js +2 -0
- package/dist/style/drawer.js +3 -0
- package/dist/style/dropdown.js +5 -0
- package/dist/style/form-checkbox.css +1 -1
- package/dist/style/form-input-number.js +2 -0
- package/dist/style/form-input.css +1 -1
- package/dist/style/form-input.js +1 -0
- package/dist/style/form-select.js +5 -0
- package/dist/style/form-slider.js +5 -0
- package/dist/style/form.js +3 -0
- package/dist/style/heatmap.js +1 -0
- package/dist/style/image.js +2 -0
- package/dist/style/layout.js +1 -0
- package/dist/style/line-chart.js +1 -0
- package/dist/style/menu.js +3 -0
- package/dist/style/message-box.js +3 -0
- package/dist/style/pagination.js +9 -0
- package/dist/style/pie-chart.js +1 -0
- package/dist/style/popconfirm.js +3 -0
- package/dist/style/popover.js +1 -0
- package/dist/style/popup.js +2 -0
- package/dist/style/table.js +12 -0
- package/dist/style/time-picker.js +3 -0
- package/dist/style/tooltip.js +1 -0
- package/dist/style/upload.js +4 -0
- package/dist/style.css +1 -1
- package/package.json +17 -7
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import ne from "
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
1
|
+
import { defineComponent as F, createVNode as o, Fragment as X, provide as J, ref as B, onMounted as Q, watch as D, computed as f } from "vue";
|
|
2
|
+
import { formItemInjectionKey as W } from "../form/context.js";
|
|
3
|
+
import { getTabbableElements as Y } from "../../_hooks/use-dialog-focus.js";
|
|
4
|
+
import { getClassNameMixin as Z } from "../../_utils/config.js";
|
|
5
|
+
import { rgbToHsl as ee, hslToRgb as ae } from "../../_utils/palette.js";
|
|
6
|
+
import { formatColor as _, rgbToHsv as $, hsvToRgb as le, toRgbaString as ne, toAlphaSliderColor as te, parseColorAlpha as j, formatAlphaPercent as oe } from "../../_utils/color.js";
|
|
7
|
+
import se from "../form-input/Input.js";
|
|
8
|
+
import re from "../form-input-number/InputNumber.js";
|
|
9
|
+
import ie from "../button/Button.js";
|
|
10
|
+
import ue from "../../icons/default/check.js";
|
|
11
|
+
import ce from "./sv-panel.js";
|
|
12
|
+
import he from "./gradient-slider.js";
|
|
13
|
+
const de = "linear-gradient(to right, red, yellow, lime, cyan, blue, magenta, red)", xe = /* @__PURE__ */ F({
|
|
12
14
|
name: "ColorPickerPanel",
|
|
13
15
|
props: {
|
|
16
|
+
id: String,
|
|
17
|
+
ariaLabel: String,
|
|
14
18
|
value: {
|
|
15
19
|
type: Object,
|
|
16
20
|
required: !0
|
|
@@ -52,256 +56,281 @@ const he = "linear-gradient(to right, red, yellow, lime, cyan, blue, magenta, re
|
|
|
52
56
|
}
|
|
53
57
|
},
|
|
54
58
|
emits: {
|
|
55
|
-
change: (
|
|
56
|
-
confirm: (
|
|
59
|
+
change: (l, r) => !0,
|
|
60
|
+
confirm: (l) => !0,
|
|
57
61
|
clear: () => !0,
|
|
58
62
|
close: () => !0
|
|
59
63
|
},
|
|
60
|
-
setup(
|
|
61
|
-
emit:
|
|
64
|
+
setup(l, {
|
|
65
|
+
emit: r,
|
|
66
|
+
expose: k
|
|
62
67
|
}) {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
const A = Z("color-picker");
|
|
69
|
+
J(W, {});
|
|
70
|
+
const M = B(), v = () => {
|
|
71
|
+
const e = M.value;
|
|
72
|
+
e && (Y(e)[0] ?? e).focus();
|
|
73
|
+
};
|
|
74
|
+
k({
|
|
75
|
+
focus: v
|
|
76
|
+
}), Q(() => {
|
|
77
|
+
var e, a;
|
|
78
|
+
((e = document.activeElement) == null ? void 0 : e.getAttribute("aria-controls")) === ((a = M.value) == null ? void 0 : a.id) && v();
|
|
79
|
+
});
|
|
80
|
+
const g = B(l.modes[0] ?? "hex"), u = B($(l.value)), h = B(l.value.a);
|
|
81
|
+
D(() => l.value, (e) => {
|
|
82
|
+
const a = $(e);
|
|
83
|
+
(Math.abs(a.h - u.value.h) > 0.5 || Math.abs(a.s - u.value.s) > 0.5 || Math.abs(a.v - u.value.v) > 0.5) && (u.value = a), Math.abs(e.a - h.value) > 1e-3 && (h.value = e.a);
|
|
84
|
+
}), D(() => l.modes, (e) => {
|
|
85
|
+
e.length && !e.includes(g.value) && (g.value = e[0]);
|
|
69
86
|
});
|
|
70
|
-
const
|
|
71
|
-
const [e,
|
|
87
|
+
const t = f(() => {
|
|
88
|
+
const [e, a, s] = le(u.value);
|
|
72
89
|
return {
|
|
73
90
|
r: e,
|
|
74
|
-
g:
|
|
91
|
+
g: a,
|
|
75
92
|
b: s,
|
|
76
|
-
a:
|
|
93
|
+
a: l.showAlpha ? h.value : 1
|
|
77
94
|
};
|
|
78
|
-
}), m = (e,
|
|
79
|
-
u.value = e, m(
|
|
80
|
-
},
|
|
95
|
+
}), m = (e, a) => r("change", e, a), P = (e) => {
|
|
96
|
+
u.value = e, m(t.value);
|
|
97
|
+
}, w = (e) => {
|
|
81
98
|
u.value = {
|
|
82
99
|
...u.value,
|
|
83
100
|
h: e / 100 * 360
|
|
84
|
-
}, m(
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
...
|
|
101
|
+
}, m(t.value);
|
|
102
|
+
}, R = (e) => {
|
|
103
|
+
h.value = e / 100, m(t.value);
|
|
104
|
+
}, V = f(() => `linear-gradient(to right, ${ne({
|
|
105
|
+
...t.value,
|
|
89
106
|
a: 0
|
|
90
|
-
})}, ${
|
|
91
|
-
u.value =
|
|
107
|
+
})}, ${te(t.value)})`), E = f(() => _(t.value, "hex", l.showAlpha)), p = (e, a) => {
|
|
108
|
+
u.value = $(e), h.value = e.a, m({
|
|
92
109
|
...e,
|
|
93
|
-
a:
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
},
|
|
110
|
+
a: l.showAlpha ? e.a : 1
|
|
111
|
+
}, a);
|
|
112
|
+
}, N = (e) => {
|
|
113
|
+
const a = j(e);
|
|
114
|
+
a && p(a);
|
|
115
|
+
}, L = f(() => [Math.round(t.value.r), Math.round(t.value.g), Math.round(t.value.b)]), x = f(() => {
|
|
99
116
|
const {
|
|
100
117
|
h: e,
|
|
101
|
-
s:
|
|
118
|
+
s: a,
|
|
102
119
|
l: s
|
|
103
|
-
} =
|
|
104
|
-
return [Math.round(e), Math.round(
|
|
105
|
-
}),
|
|
120
|
+
} = ee([Math.round(t.value.r), Math.round(t.value.g), Math.round(t.value.b)]);
|
|
121
|
+
return [Math.round(e), Math.round(a), Math.round(s)];
|
|
122
|
+
}), T = (e, a, s) => {
|
|
106
123
|
if (s === void 0) return;
|
|
107
124
|
if (e === "rgb") {
|
|
108
|
-
const
|
|
109
|
-
...
|
|
125
|
+
const c = {
|
|
126
|
+
...t.value
|
|
110
127
|
};
|
|
111
|
-
|
|
128
|
+
a === 0 ? c.r = s : a === 1 ? c.g = s : c.b = s, p(c);
|
|
112
129
|
return;
|
|
113
130
|
}
|
|
114
|
-
const [
|
|
115
|
-
h:
|
|
116
|
-
s:
|
|
117
|
-
l:
|
|
131
|
+
const [z, C, i] = x.value, d = {
|
|
132
|
+
h: z,
|
|
133
|
+
s: C,
|
|
134
|
+
l: i
|
|
118
135
|
};
|
|
119
|
-
|
|
120
|
-
const [
|
|
136
|
+
a === 0 ? d.h = s : a === 1 ? d.s = s : d.l = s;
|
|
137
|
+
const [H, I, G] = ae(d);
|
|
121
138
|
p({
|
|
122
|
-
r:
|
|
123
|
-
g:
|
|
124
|
-
b:
|
|
125
|
-
a:
|
|
139
|
+
r: H,
|
|
140
|
+
g: I,
|
|
141
|
+
b: G,
|
|
142
|
+
a: t.value.a
|
|
126
143
|
});
|
|
127
|
-
},
|
|
144
|
+
}, S = f(() => _(t.value, "hex", l.showAlpha));
|
|
128
145
|
return {
|
|
129
|
-
className:
|
|
130
|
-
|
|
146
|
+
className: A,
|
|
147
|
+
panelRef: M,
|
|
148
|
+
focus: v,
|
|
149
|
+
activeMode: g,
|
|
131
150
|
hsv: u,
|
|
132
|
-
alpha:
|
|
133
|
-
rgba:
|
|
134
|
-
hexValue:
|
|
135
|
-
rgbChannels:
|
|
136
|
-
hslChannels:
|
|
137
|
-
activeSwatch:
|
|
138
|
-
alphaBackground:
|
|
139
|
-
handleHsvChange:
|
|
140
|
-
handleHueChange:
|
|
141
|
-
handleAlphaChange:
|
|
142
|
-
handleHexInput:
|
|
143
|
-
handleChannelChange:
|
|
144
|
-
handleSwatchClick: (e,
|
|
145
|
-
const s =
|
|
146
|
-
s && p(s,
|
|
151
|
+
alpha: h,
|
|
152
|
+
rgba: t,
|
|
153
|
+
hexValue: E,
|
|
154
|
+
rgbChannels: L,
|
|
155
|
+
hslChannels: x,
|
|
156
|
+
activeSwatch: S,
|
|
157
|
+
alphaBackground: V,
|
|
158
|
+
handleHsvChange: P,
|
|
159
|
+
handleHueChange: w,
|
|
160
|
+
handleAlphaChange: R,
|
|
161
|
+
handleHexInput: N,
|
|
162
|
+
handleChannelChange: T,
|
|
163
|
+
handleSwatchClick: (e, a) => {
|
|
164
|
+
const s = j(e);
|
|
165
|
+
s && p(s, a);
|
|
147
166
|
},
|
|
148
|
-
confirm: () =>
|
|
149
|
-
clear: () =>
|
|
150
|
-
close: () =>
|
|
151
|
-
formatAlphaPercent:
|
|
152
|
-
HUE_GRADIENT:
|
|
153
|
-
Input:
|
|
154
|
-
InputNumber:
|
|
155
|
-
Button:
|
|
156
|
-
IconCheck:
|
|
157
|
-
SvPanel:
|
|
158
|
-
GradientSlider:
|
|
159
|
-
parseColorAlpha:
|
|
167
|
+
confirm: () => r("confirm", t.value),
|
|
168
|
+
clear: () => r("clear"),
|
|
169
|
+
close: () => r("close"),
|
|
170
|
+
formatAlphaPercent: oe,
|
|
171
|
+
HUE_GRADIENT: de,
|
|
172
|
+
Input: se,
|
|
173
|
+
InputNumber: re,
|
|
174
|
+
Button: ie,
|
|
175
|
+
IconCheck: ue,
|
|
176
|
+
SvPanel: ce,
|
|
177
|
+
GradientSlider: he,
|
|
178
|
+
parseColorAlpha: j
|
|
160
179
|
};
|
|
161
180
|
},
|
|
162
181
|
render() {
|
|
163
182
|
const {
|
|
164
|
-
className:
|
|
165
|
-
activeMode:
|
|
166
|
-
hsv:
|
|
167
|
-
alpha:
|
|
168
|
-
rgba:
|
|
169
|
-
hexValue:
|
|
170
|
-
rgbChannels:
|
|
171
|
-
hslChannels:
|
|
172
|
-
activeSwatch:
|
|
173
|
-
alphaBackground:
|
|
174
|
-
handleHsvChange:
|
|
175
|
-
handleHueChange:
|
|
176
|
-
handleAlphaChange:
|
|
177
|
-
handleHexInput:
|
|
178
|
-
handleChannelChange:
|
|
179
|
-
handleSwatchClick:
|
|
180
|
-
confirm:
|
|
183
|
+
className: l,
|
|
184
|
+
activeMode: r,
|
|
185
|
+
hsv: k,
|
|
186
|
+
alpha: A,
|
|
187
|
+
rgba: M,
|
|
188
|
+
hexValue: v,
|
|
189
|
+
rgbChannels: g,
|
|
190
|
+
hslChannels: u,
|
|
191
|
+
activeSwatch: h,
|
|
192
|
+
alphaBackground: t,
|
|
193
|
+
handleHsvChange: m,
|
|
194
|
+
handleHueChange: P,
|
|
195
|
+
handleAlphaChange: w,
|
|
196
|
+
handleHexInput: R,
|
|
197
|
+
handleChannelChange: V,
|
|
198
|
+
handleSwatchClick: E,
|
|
199
|
+
confirm: p,
|
|
181
200
|
clear: N,
|
|
182
|
-
formatAlphaPercent:
|
|
183
|
-
HUE_GRADIENT:
|
|
184
|
-
Input:
|
|
185
|
-
InputNumber:
|
|
186
|
-
Button:
|
|
187
|
-
IconCheck:
|
|
188
|
-
SvPanel:
|
|
189
|
-
GradientSlider:
|
|
190
|
-
parseColorAlpha:
|
|
191
|
-
showAlpha:
|
|
192
|
-
disabled:
|
|
193
|
-
swatches:
|
|
194
|
-
showConfirm:
|
|
195
|
-
showClear:
|
|
196
|
-
modes:
|
|
197
|
-
texts:
|
|
198
|
-
} = this,
|
|
201
|
+
formatAlphaPercent: L,
|
|
202
|
+
HUE_GRADIENT: x,
|
|
203
|
+
Input: T,
|
|
204
|
+
InputNumber: S,
|
|
205
|
+
Button: U,
|
|
206
|
+
IconCheck: e,
|
|
207
|
+
SvPanel: a,
|
|
208
|
+
GradientSlider: s,
|
|
209
|
+
parseColorAlpha: z,
|
|
210
|
+
showAlpha: C,
|
|
211
|
+
disabled: i,
|
|
212
|
+
swatches: d,
|
|
213
|
+
showConfirm: H,
|
|
214
|
+
showClear: I,
|
|
215
|
+
modes: G,
|
|
216
|
+
texts: c
|
|
217
|
+
} = this, K = r === "rgb" ? g : u, O = r === "rgb" ? 255 : void 0;
|
|
199
218
|
return o("div", {
|
|
200
|
-
|
|
201
|
-
|
|
219
|
+
ref: "panelRef",
|
|
220
|
+
id: this.id,
|
|
221
|
+
"aria-label": this.ariaLabel,
|
|
222
|
+
role: "dialog",
|
|
223
|
+
tabindex: -1,
|
|
224
|
+
class: [l.element("panel"), {
|
|
225
|
+
[l.is("disabled")]: i
|
|
202
226
|
}],
|
|
203
|
-
onKeydown: (
|
|
204
|
-
|
|
227
|
+
onKeydown: (n) => {
|
|
228
|
+
n.key === "Escape" && (n.stopPropagation(), this.close());
|
|
205
229
|
}
|
|
206
230
|
}, [o("div", {
|
|
207
|
-
class:
|
|
208
|
-
}, [o(
|
|
209
|
-
value:
|
|
210
|
-
disabled:
|
|
211
|
-
onChange:
|
|
212
|
-
ariaLabel:
|
|
231
|
+
class: l.element("panel-body")
|
|
232
|
+
}, [o(a, {
|
|
233
|
+
value: k,
|
|
234
|
+
disabled: i,
|
|
235
|
+
onChange: m,
|
|
236
|
+
ariaLabel: c.saturation
|
|
213
237
|
}, null), o("div", {
|
|
214
|
-
class:
|
|
215
|
-
}, [o(
|
|
216
|
-
value:
|
|
217
|
-
background:
|
|
218
|
-
disabled:
|
|
219
|
-
ariaLabel:
|
|
220
|
-
onChange:
|
|
221
|
-
}, null),
|
|
222
|
-
value:
|
|
223
|
-
background:
|
|
224
|
-
disabled:
|
|
225
|
-
ariaLabel:
|
|
226
|
-
onChange:
|
|
238
|
+
class: l.element("sliders")
|
|
239
|
+
}, [o(s, {
|
|
240
|
+
value: k.h / 360 * 100,
|
|
241
|
+
background: x,
|
|
242
|
+
disabled: i,
|
|
243
|
+
ariaLabel: c.hue,
|
|
244
|
+
onChange: P
|
|
245
|
+
}, null), C && o(s, {
|
|
246
|
+
value: A * 100,
|
|
247
|
+
background: t,
|
|
248
|
+
disabled: i,
|
|
249
|
+
ariaLabel: c.alpha,
|
|
250
|
+
onChange: w
|
|
227
251
|
}, null)]), o("div", {
|
|
228
|
-
class:
|
|
229
|
-
}, [
|
|
230
|
-
key:
|
|
252
|
+
class: l.element("modes")
|
|
253
|
+
}, [G.map((n) => o("button", {
|
|
254
|
+
key: n,
|
|
231
255
|
type: "button",
|
|
232
|
-
class: [
|
|
233
|
-
[
|
|
256
|
+
class: [l.element("mode"), {
|
|
257
|
+
[l.is("active")]: r === n
|
|
234
258
|
}],
|
|
235
|
-
disabled:
|
|
259
|
+
disabled: i,
|
|
236
260
|
onClick: () => {
|
|
237
|
-
this.activeMode =
|
|
261
|
+
this.activeMode = n;
|
|
238
262
|
}
|
|
239
|
-
}, [
|
|
240
|
-
class:
|
|
241
|
-
}, [
|
|
263
|
+
}, [n.toUpperCase()]))]), o("div", {
|
|
264
|
+
class: l.element("inputs")
|
|
265
|
+
}, [r === "hex" ? o(T, {
|
|
242
266
|
size: "small",
|
|
243
|
-
disabled:
|
|
244
|
-
modelValue:
|
|
267
|
+
disabled: i,
|
|
268
|
+
modelValue: v,
|
|
245
269
|
maxLength: 9,
|
|
246
|
-
"
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
270
|
+
"aria-label": "HEX",
|
|
271
|
+
"onUpdate:modelValue": (n) => R(n)
|
|
272
|
+
}, null) : o(X, null, [K.map((n, b) => o(S, {
|
|
273
|
+
key: `${r}-${b}`,
|
|
274
|
+
class: l.element("channel"),
|
|
250
275
|
size: "small",
|
|
251
276
|
hideButton: !0,
|
|
252
277
|
min: 0,
|
|
253
|
-
max:
|
|
278
|
+
max: O,
|
|
254
279
|
precision: 0,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
280
|
+
"aria-label": (r === "rgb" ? ["R", "G", "B"] : ["H", "S", "L"])[b],
|
|
281
|
+
disabled: i,
|
|
282
|
+
modelValue: n,
|
|
283
|
+
"onUpdate:modelValue": (y) => V(r, b, y)
|
|
284
|
+
}, null)), C && o(S, {
|
|
285
|
+
class: l.element("channel"),
|
|
260
286
|
size: "small",
|
|
261
287
|
hideButton: !0,
|
|
262
288
|
min: 0,
|
|
263
289
|
max: 100,
|
|
264
290
|
precision: 0,
|
|
265
|
-
disabled:
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
291
|
+
disabled: i,
|
|
292
|
+
"aria-label": c.alpha,
|
|
293
|
+
modelValue: L(A),
|
|
294
|
+
"onUpdate:modelValue": (n) => {
|
|
295
|
+
n !== void 0 && w(n);
|
|
269
296
|
}
|
|
270
|
-
}, null)])]),
|
|
271
|
-
class:
|
|
272
|
-
}, [
|
|
273
|
-
const
|
|
297
|
+
}, null)])]), d.length > 0 && o("div", {
|
|
298
|
+
class: l.element("swatches")
|
|
299
|
+
}, [d.map((n) => {
|
|
300
|
+
const b = z(n), y = b ? _(b, "hex", C) === h : !1;
|
|
274
301
|
return o("button", {
|
|
275
|
-
key:
|
|
302
|
+
key: n,
|
|
276
303
|
type: "button",
|
|
277
|
-
class: [
|
|
278
|
-
[
|
|
304
|
+
class: [l.element("swatch"), {
|
|
305
|
+
[l.is("active")]: y
|
|
279
306
|
}],
|
|
307
|
+
"aria-label": n,
|
|
308
|
+
"aria-pressed": y,
|
|
280
309
|
style: {
|
|
281
|
-
backgroundColor:
|
|
310
|
+
backgroundColor: n
|
|
282
311
|
},
|
|
283
|
-
disabled:
|
|
284
|
-
onClick: (
|
|
285
|
-
}, [
|
|
286
|
-
})])]), (
|
|
287
|
-
class:
|
|
288
|
-
}, [
|
|
312
|
+
disabled: i,
|
|
313
|
+
onClick: (q) => E(n, q)
|
|
314
|
+
}, [y && o(e, null, null)]);
|
|
315
|
+
})])]), (H || I) && o("div", {
|
|
316
|
+
class: l.element("panel-footer")
|
|
317
|
+
}, [I && o(U, {
|
|
289
318
|
size: "small",
|
|
290
319
|
type: "text",
|
|
291
|
-
disabled:
|
|
320
|
+
disabled: i,
|
|
292
321
|
onClick: N
|
|
293
322
|
}, {
|
|
294
|
-
default: () => [
|
|
295
|
-
}),
|
|
323
|
+
default: () => [c.clear]
|
|
324
|
+
}), H && o(U, {
|
|
296
325
|
size: "small",
|
|
297
326
|
type: "primary",
|
|
298
|
-
disabled:
|
|
299
|
-
onClick:
|
|
327
|
+
disabled: i,
|
|
328
|
+
onClick: p
|
|
300
329
|
}, {
|
|
301
|
-
default: () => [
|
|
330
|
+
default: () => [c.confirm]
|
|
302
331
|
})])]);
|
|
303
332
|
}
|
|
304
333
|
});
|
|
305
334
|
export {
|
|
306
|
-
|
|
335
|
+
xe as default
|
|
307
336
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as M, ref as y, computed as u, toRef as x, createVNode as r } from "vue";
|
|
2
|
+
import { usePointerDrag as $ } from "../../_hooks/use-pointer-drag.js";
|
|
2
3
|
import { getClassNameMixin as k } from "../../_utils/config.js";
|
|
3
4
|
import { hsvToRgb as C } from "../../_utils/color.js";
|
|
4
|
-
const
|
|
5
|
+
const D = /* @__PURE__ */ M({
|
|
5
6
|
name: "ColorPickerSvPanel",
|
|
6
7
|
props: {
|
|
7
8
|
/** h 0-360,s/v 0-100 */
|
|
@@ -22,78 +23,78 @@ const E = /* @__PURE__ */ $({
|
|
|
22
23
|
change: (e) => !0
|
|
23
24
|
},
|
|
24
25
|
setup(e, {
|
|
25
|
-
emit:
|
|
26
|
+
emit: d
|
|
26
27
|
}) {
|
|
27
|
-
const l = k("color-picker"),
|
|
28
|
-
const [
|
|
28
|
+
const l = k("color-picker"), c = y(), v = u(() => {
|
|
29
|
+
const [n, t, i] = C({
|
|
29
30
|
h: e.value.h,
|
|
30
31
|
s: 100,
|
|
31
32
|
v: 100
|
|
32
33
|
});
|
|
33
|
-
return `rgb(${
|
|
34
|
-
}),
|
|
35
|
-
backgroundColor:
|
|
36
|
-
})),
|
|
34
|
+
return `rgb(${n}, ${t}, ${i})`;
|
|
35
|
+
}), m = u(() => ({
|
|
36
|
+
backgroundColor: v.value
|
|
37
|
+
})), f = u(() => ({
|
|
37
38
|
left: `${e.value.s}%`,
|
|
38
39
|
top: `${100 - e.value.v}%`
|
|
39
|
-
})),
|
|
40
|
-
const
|
|
41
|
-
if (!
|
|
42
|
-
const
|
|
43
|
-
if (!
|
|
44
|
-
const
|
|
45
|
-
|
|
40
|
+
})), g = (n, t) => {
|
|
41
|
+
const i = c.value;
|
|
42
|
+
if (!i || e.disabled) return;
|
|
43
|
+
const a = i.getBoundingClientRect();
|
|
44
|
+
if (!a.width || !a.height) return;
|
|
45
|
+
const o = Math.min(Math.max(n - a.left, 0), a.width), s = Math.min(Math.max(t - a.top, 0), a.height);
|
|
46
|
+
d("change", {
|
|
46
47
|
h: e.value.h,
|
|
47
|
-
s:
|
|
48
|
-
v: (1 -
|
|
48
|
+
s: o / a.width * 100,
|
|
49
|
+
v: (1 - s / a.height) * 100
|
|
49
50
|
});
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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) => {
|
|
51
|
+
}, {
|
|
52
|
+
dragging: b,
|
|
53
|
+
start: h
|
|
54
|
+
} = $(x(e, "disabled"), g), w = (n) => {
|
|
57
55
|
if (e.disabled) return;
|
|
58
|
-
const
|
|
59
|
-
ArrowLeft: [-
|
|
60
|
-
ArrowRight: [
|
|
61
|
-
ArrowUp: [0,
|
|
62
|
-
ArrowDown: [0, -
|
|
63
|
-
}[
|
|
64
|
-
if (!
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
56
|
+
const t = n.shiftKey ? 10 : 1, a = {
|
|
57
|
+
ArrowLeft: [-t, 0],
|
|
58
|
+
ArrowRight: [t, 0],
|
|
59
|
+
ArrowUp: [0, t],
|
|
60
|
+
ArrowDown: [0, -t]
|
|
61
|
+
}[n.key];
|
|
62
|
+
if (!a) return;
|
|
63
|
+
n.preventDefault();
|
|
64
|
+
const o = Math.min(Math.max(e.value.s + a[0], 0), 100), s = Math.min(Math.max(e.value.v + a[1], 0), 100);
|
|
65
|
+
d("change", {
|
|
68
66
|
h: e.value.h,
|
|
69
|
-
s:
|
|
70
|
-
v:
|
|
67
|
+
s: o,
|
|
68
|
+
v: s
|
|
71
69
|
});
|
|
72
70
|
};
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
}), () => s("div", {
|
|
76
|
-
ref: m,
|
|
71
|
+
return () => r("div", {
|
|
72
|
+
ref: c,
|
|
77
73
|
class: [l.element("sv"), {
|
|
78
|
-
[l.is("dragging")]:
|
|
74
|
+
[l.is("dragging")]: b.value
|
|
79
75
|
}],
|
|
80
|
-
style:
|
|
76
|
+
style: m.value,
|
|
81
77
|
role: "slider",
|
|
82
78
|
"aria-label": e.ariaLabel,
|
|
79
|
+
"aria-valuemin": 0,
|
|
80
|
+
"aria-valuemax": 100,
|
|
81
|
+
"aria-valuenow": Math.round(e.value.s),
|
|
83
82
|
"aria-valuetext": `${Math.round(e.value.s)}%, ${Math.round(e.value.v)}%`,
|
|
83
|
+
"aria-disabled": e.disabled || void 0,
|
|
84
84
|
tabindex: e.disabled ? -1 : 0,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
onPointerdown: h,
|
|
86
|
+
onMousedown: h,
|
|
87
|
+
onKeydown: w
|
|
88
|
+
}, [r("div", {
|
|
88
89
|
class: l.element("sv-white")
|
|
89
|
-
}, null),
|
|
90
|
+
}, null), r("div", {
|
|
90
91
|
class: l.element("sv-black")
|
|
91
|
-
}, null),
|
|
92
|
+
}, null), r("div", {
|
|
92
93
|
class: l.element("sv-handler"),
|
|
93
|
-
style:
|
|
94
|
+
style: f.value
|
|
94
95
|
}, null)]);
|
|
95
96
|
}
|
|
96
97
|
});
|
|
97
98
|
export {
|
|
98
|
-
|
|
99
|
+
D as default
|
|
99
100
|
};
|