easy-component-ui 3.0.12 → 3.0.14
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/package.json +308 -304
- package/dist/assets/icon.css +0 -1
- package/dist/components/Base.js +0 -873
- package/dist/components/ea-alert.js +0 -196
- package/dist/components/ea-avatar.js +0 -159
- package/dist/components/ea-backtop.js +0 -136
- package/dist/components/ea-badge.js +0 -144
- package/dist/components/ea-breadcrumb.js +0 -148
- package/dist/components/ea-button.js +0 -265
- package/dist/components/ea-calendar.js +0 -10
- package/dist/components/ea-calendar2.js +0 -671
- package/dist/components/ea-card.js +0 -85
- package/dist/components/ea-carousel.js +0 -415
- package/dist/components/ea-checkbox.js +0 -446
- package/dist/components/ea-collapse.js +0 -313
- package/dist/components/ea-color-picker.js +0 -891
- package/dist/components/ea-container.js +0 -177
- package/dist/components/ea-countdown.js +0 -142
- package/dist/components/ea-date-picker.js +0 -649
- package/dist/components/ea-descriptions.js +0 -474
- package/dist/components/ea-dialog.js +0 -249
- package/dist/components/ea-drawer.js +0 -211
- package/dist/components/ea-dropdown.js +0 -228
- package/dist/components/ea-empty.js +0 -93
- package/dist/components/ea-icon.js +0 -68
- package/dist/components/ea-image-preview.js +0 -488
- package/dist/components/ea-image.js +0 -302
- package/dist/components/ea-infinite-scroll.js +0 -109
- package/dist/components/ea-input-number.js +0 -367
- package/dist/components/ea-input.js +0 -588
- package/dist/components/ea-layout.js +0 -125
- package/dist/components/ea-link.js +0 -101
- package/dist/components/ea-loading.js +0 -151
- package/dist/components/ea-menu.js +0 -433
- package/dist/components/ea-message-box.js +0 -624
- package/dist/components/ea-message.js +0 -251
- package/dist/components/ea-notification.js +0 -331
- package/dist/components/ea-overlay.js +0 -167
- package/dist/components/ea-page-header.js +0 -108
- package/dist/components/ea-pagination.js +0 -481
- package/dist/components/ea-popconfirm.js +0 -275
- package/dist/components/ea-popover.js +0 -123
- package/dist/components/ea-popper.js +0 -203
- package/dist/components/ea-progress.js +0 -286
- package/dist/components/ea-radio.js +0 -364
- package/dist/components/ea-rate.js +0 -241
- package/dist/components/ea-result.js +0 -100
- package/dist/components/ea-scrollbar.js +0 -235
- package/dist/components/ea-segmented.js +0 -215
- package/dist/components/ea-select.js +0 -609
- package/dist/components/ea-skeleton.js +0 -263
- package/dist/components/ea-slider.js +0 -421
- package/dist/components/ea-space.js +0 -123
- package/dist/components/ea-splitter.js +0 -217
- package/dist/components/ea-statistic.js +0 -74
- package/dist/components/ea-steps.js +0 -346
- package/dist/components/ea-switch.js +0 -271
- package/dist/components/ea-table.js +0 -1124
- package/dist/components/ea-tabs.js +0 -501
- package/dist/components/ea-tag.js +0 -228
- package/dist/components/ea-text.js +0 -113
- package/dist/components/ea-time-picker.js +0 -514
- package/dist/components/ea-timeline.js +0 -185
- package/dist/components/ea-tooltip.js +0 -121
- package/dist/components/ea-tour.js +0 -544
- package/dist/components/ea-transfer.js +0 -949
- package/dist/components/ea-tree.js +0 -1125
- package/dist/components/index.js +0 -61
- package/dist/core/FormBase.js +0 -238
- package/dist/css/ea-alert.style.js +0 -4
- package/dist/css/ea-aside.style.js +0 -4
- package/dist/css/ea-avatar.style.js +0 -4
- package/dist/css/ea-backtop.style.js +0 -4
- package/dist/css/ea-badge.style.js +0 -4
- package/dist/css/ea-breadcrumb-item.style.js +0 -4
- package/dist/css/ea-breadcrumb.style.js +0 -4
- package/dist/css/ea-button-group.style.js +0 -4
- package/dist/css/ea-button.style.js +0 -4
- package/dist/css/ea-calendar.style.js +0 -4
- package/dist/css/ea-card.style.js +0 -4
- package/dist/css/ea-carousel-item.style.js +0 -4
- package/dist/css/ea-carousel.style.js +0 -4
- package/dist/css/ea-check-tag.style.js +0 -4
- package/dist/css/ea-checkbox-group.style.js +0 -4
- package/dist/css/ea-checkbox.style.js +0 -4
- package/dist/css/ea-col.style.js +0 -4
- package/dist/css/ea-collapse-item.style.js +0 -4
- package/dist/css/ea-collapse.style.js +0 -4
- package/dist/css/ea-color-picker-panel.style.js +0 -4
- package/dist/css/ea-color-picker.style.js +0 -4
- package/dist/css/ea-container.style.js +0 -4
- package/dist/css/ea-date-picker.style.js +0 -4
- package/dist/css/ea-descriptions-item.style.js +0 -4
- package/dist/css/ea-descriptions.style.js +0 -4
- package/dist/css/ea-dialog.style.js +0 -4
- package/dist/css/ea-drawer.style.js +0 -4
- package/dist/css/ea-dropdown-item.style.js +0 -4
- package/dist/css/ea-dropdown-menu.style.js +0 -4
- package/dist/css/ea-dropdown.style.js +0 -4
- package/dist/css/ea-empty.style.js +0 -4
- package/dist/css/ea-footer.style.js +0 -4
- package/dist/css/ea-header.style.js +0 -4
- package/dist/css/ea-icon.style.js +0 -4
- package/dist/css/ea-image-preview.style.js +0 -4
- package/dist/css/ea-image.style.js +0 -4
- package/dist/css/ea-infinite-scroll.style.js +0 -4
- package/dist/css/ea-input-number.style.js +0 -4
- package/dist/css/ea-input.style.js +0 -4
- package/dist/css/ea-link.style.js +0 -4
- package/dist/css/ea-main.style.js +0 -4
- package/dist/css/ea-menu-item-group.style.js +0 -4
- package/dist/css/ea-menu-item.style.js +0 -4
- package/dist/css/ea-menu.style.js +0 -4
- package/dist/css/ea-message-box.style.js +0 -4
- package/dist/css/ea-message.style.js +0 -4
- package/dist/css/ea-notification.style.js +0 -4
- package/dist/css/ea-option-gropu.style.js +0 -4
- package/dist/css/ea-option.style.js +0 -4
- package/dist/css/ea-overlay.style.js +0 -4
- package/dist/css/ea-page-header.style.js +0 -4
- package/dist/css/ea-pagination.style.js +0 -4
- package/dist/css/ea-popconfirm.style.js +0 -4
- package/dist/css/ea-popover.style.js +0 -4
- package/dist/css/ea-popper.style.js +0 -4
- package/dist/css/ea-progress.style.js +0 -4
- package/dist/css/ea-radio-group.style.js +0 -4
- package/dist/css/ea-radio.style.js +0 -4
- package/dist/css/ea-rate.style.js +0 -4
- package/dist/css/ea-result.style.js +0 -4
- package/dist/css/ea-row.style.js +0 -4
- package/dist/css/ea-scrollbar.style.js +0 -4
- package/dist/css/ea-segmented.style.js +0 -4
- package/dist/css/ea-select.style.js +0 -4
- package/dist/css/ea-skeleton-item.style.js +0 -4
- package/dist/css/ea-skeleton.style.js +0 -4
- package/dist/css/ea-slider.style.js +0 -4
- package/dist/css/ea-space.style.js +0 -4
- package/dist/css/ea-splitter-bar.style.js +0 -4
- package/dist/css/ea-splitter-panel.style.js +0 -4
- package/dist/css/ea-splitter.style.js +0 -4
- package/dist/css/ea-statistic.style.js +0 -4
- package/dist/css/ea-step.style.js +0 -4
- package/dist/css/ea-steps.style.js +0 -4
- package/dist/css/ea-sub-menu.style.js +0 -4
- package/dist/css/ea-switch.style.js +0 -4
- package/dist/css/ea-tab-panel.style.js +0 -4
- package/dist/css/ea-tab.style.js +0 -4
- package/dist/css/ea-table-column.style.js +0 -4
- package/dist/css/ea-table.style.js +0 -4
- package/dist/css/ea-tabs.style.js +0 -4
- package/dist/css/ea-tag.style.js +0 -4
- package/dist/css/ea-text.style.js +0 -4
- package/dist/css/ea-time-picker.style.js +0 -4
- package/dist/css/ea-timeline-item.style.js +0 -4
- package/dist/css/ea-timeline.style.js +0 -4
- package/dist/css/ea-tooltip.style.js +0 -4
- package/dist/css/ea-tour-step.style.js +0 -4
- package/dist/css/ea-tour.style.js +0 -4
- package/dist/css/ea-transfer.style.js +0 -5
- package/dist/css/ea-tree.style.js +0 -6
- package/dist/css/ea-ui-component.style.js +0 -4
- package/dist/favicon.ico +0 -0
- package/dist/utils/Color.js +0 -439
- package/dist/utils/I18nManager.js +0 -218
- package/dist/utils/Utils.js +0 -65
- package/dist/utils/Variables.js +0 -12
- package/dist/utils/parseTime.js +0 -73
- package/dist/utils/timeout.js +0 -9
|
@@ -1,891 +0,0 @@
|
|
|
1
|
-
var Et = Object.defineProperty;
|
|
2
|
-
var ot = (h) => {
|
|
3
|
-
throw TypeError(h);
|
|
4
|
-
};
|
|
5
|
-
var xt = (h, n, e) => n in h ? Et(h, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[n] = e;
|
|
6
|
-
var T = (h, n, e) => xt(h, typeof n != "symbol" ? n + "" : n, e), tt = (h, n, e) => n.has(h) || ot("Cannot " + e);
|
|
7
|
-
var t = (h, n, e) => (tt(h, n, "read from private field"), e ? e.call(h) : n.get(h)), l = (h, n, e) => n.has(h) ? ot("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(h) : n.set(h, e), d = (h, n, e, i) => (tt(h, n, "write to private field"), i ? i.call(h, e) : n.set(h, e), e), a = (h, n, e) => (tt(h, n, "access private method"), e);
|
|
8
|
-
import { F as Mt } from "../core/FormBase.js";
|
|
9
|
-
import { n as rt } from "./ea-calendar2.js";
|
|
10
|
-
import { C as F } from "../utils/Color.js";
|
|
11
|
-
import { s as kt } from "../css/ea-color-picker.style.js";
|
|
12
|
-
import { E as $t } from "../utils/Variables.js";
|
|
13
|
-
import { B as At } from "./Base.js";
|
|
14
|
-
import { s as Pt } from "../css/ea-color-picker-panel.style.js";
|
|
15
|
-
import "./ea-input.js";
|
|
16
|
-
import { E as G } from "../utils/Utils.js";
|
|
17
|
-
import "./ea-popper.js";
|
|
18
|
-
import "./ea-button.js";
|
|
19
|
-
class Rt extends Event {
|
|
20
|
-
constructor(n) {
|
|
21
|
-
super("ea-active-change", {
|
|
22
|
-
bubbles: !0,
|
|
23
|
-
cancelable: !0,
|
|
24
|
-
composed: !0
|
|
25
|
-
}), this.detail = n;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
class qt extends Event {
|
|
29
|
-
constructor(n) {
|
|
30
|
-
super("ea-invalid-color", {
|
|
31
|
-
bubbles: !0,
|
|
32
|
-
composed: !0
|
|
33
|
-
}), this.detail = n;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
var W, A, m, P, M, R, J, k, L, g, B, y, v, s, o, lt, ht, nt, ct, et, D, ut, H, dt, pt, st, it, Z, vt, bt;
|
|
37
|
-
class Lt extends At {
|
|
38
|
-
constructor() {
|
|
39
|
-
super();
|
|
40
|
-
l(this, o);
|
|
41
|
-
/** @type {HTMLDivElement} */
|
|
42
|
-
l(this, W);
|
|
43
|
-
/** @type {HTMLDivElement} */
|
|
44
|
-
l(this, A);
|
|
45
|
-
/** @type {HTMLDivElement} */
|
|
46
|
-
l(this, m);
|
|
47
|
-
/** @type {HTMLDivElement} */
|
|
48
|
-
l(this, P);
|
|
49
|
-
/** @type {HTMLDivElement} */
|
|
50
|
-
l(this, M);
|
|
51
|
-
/** @type {HTMLDivElement} */
|
|
52
|
-
l(this, R);
|
|
53
|
-
/** @type {HTMLDivElement} */
|
|
54
|
-
l(this, J);
|
|
55
|
-
/** @type {HTMLDivElement} */
|
|
56
|
-
l(this, k);
|
|
57
|
-
/** @type {HTMLDivElement} */
|
|
58
|
-
l(this, L);
|
|
59
|
-
/** @type {HTMLInputElement} */
|
|
60
|
-
l(this, g);
|
|
61
|
-
/** @type {HTMLDivElement} */
|
|
62
|
-
l(this, B);
|
|
63
|
-
l(this, y, new AbortController());
|
|
64
|
-
l(this, v, {
|
|
65
|
-
/** @type {AbortController | null} 饱和度拖拽控制器 */
|
|
66
|
-
saturationMove: null,
|
|
67
|
-
/** @type {AbortController | null} 色调拖拽控制器 */
|
|
68
|
-
hueMove: null,
|
|
69
|
-
/** @type {AbortController | null} 透明度拖拽控制器 */
|
|
70
|
-
alphaMove: null
|
|
71
|
-
});
|
|
72
|
-
l(this, s, {
|
|
73
|
-
/** @type {boolean} 是否首次更新值 */
|
|
74
|
-
isFirstValueUpdate: !1,
|
|
75
|
-
/** @type {number} 色调值 (0-360) */
|
|
76
|
-
hue: 0,
|
|
77
|
-
/** @type {number} 饱和度值 (0-1) */
|
|
78
|
-
saturation: 1,
|
|
79
|
-
/** @type {number} 亮度值 (0-1) */
|
|
80
|
-
value: 1,
|
|
81
|
-
/** @type {number} 透明度值 (0-1) */
|
|
82
|
-
alpha: 1,
|
|
83
|
-
/** @type {import("@/utils/Color").Color} 当前颜色对象 */
|
|
84
|
-
color: new F(),
|
|
85
|
-
/** @type {boolean} 是否正在拖拽 */
|
|
86
|
-
isDragging: !1,
|
|
87
|
-
/** @type {string} 上一个验证通过的颜色值 */
|
|
88
|
-
lastValidValue: ""
|
|
89
|
-
});
|
|
90
|
-
T(this, "state", this.properties({
|
|
91
|
-
value: {
|
|
92
|
-
type: String,
|
|
93
|
-
default: "",
|
|
94
|
-
observer: (e) => {
|
|
95
|
-
t(this, s).lastValidValue = e, a(this, o, et).call(this), t(this, D).call(this), a(this, o, Z).call(this);
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
"color-format": {
|
|
99
|
-
type: ["hsl", "hsv", "hex", "rgb", "rgba"],
|
|
100
|
-
default: () => this.hasAttribute("show-alpha") ? "rgba" : "hex",
|
|
101
|
-
observer: (e) => {
|
|
102
|
-
this.value && (this.value = t(this, s).color.toString(e));
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
"show-alpha": {
|
|
106
|
-
type: Boolean,
|
|
107
|
-
default: !1,
|
|
108
|
-
observer: (e) => {
|
|
109
|
-
this.updateContainerClasslist();
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
disabled: {
|
|
113
|
-
type: Boolean,
|
|
114
|
-
default: !1,
|
|
115
|
-
observer: (e) => {
|
|
116
|
-
this.updateContainerClasslist();
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
border: {
|
|
120
|
-
type: Boolean,
|
|
121
|
-
default: !1,
|
|
122
|
-
observer: (e) => {
|
|
123
|
-
this.updateContainerClasslist();
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
clearable: {
|
|
127
|
-
type: Boolean,
|
|
128
|
-
default: !0,
|
|
129
|
-
observer: (e) => {
|
|
130
|
-
a(this, o, it).call(this);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}));
|
|
134
|
-
T(this, "propStates", this.properties({
|
|
135
|
-
predefine: {
|
|
136
|
-
props: !0,
|
|
137
|
-
type: Array,
|
|
138
|
-
default: [],
|
|
139
|
-
observer: (e) => {
|
|
140
|
-
a(this, o, dt).call(this, e);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}));
|
|
144
|
-
/**
|
|
145
|
-
* 更新饱和度面板的背景颜色
|
|
146
|
-
*/
|
|
147
|
-
l(this, D, () => {
|
|
148
|
-
const e = new F({
|
|
149
|
-
h: t(this, s).hue,
|
|
150
|
-
s: 1,
|
|
151
|
-
v: 1,
|
|
152
|
-
a: 1
|
|
153
|
-
});
|
|
154
|
-
this.style.setProperty(
|
|
155
|
-
"--ea-color-picker-panel-background-color",
|
|
156
|
-
e.toString(this["color-format"])
|
|
157
|
-
);
|
|
158
|
-
});
|
|
159
|
-
this.stylesheet = Pt, this.$render();
|
|
160
|
-
}
|
|
161
|
-
static get observedAttributes() {
|
|
162
|
-
return [
|
|
163
|
-
...super.observedAttributes,
|
|
164
|
-
"value",
|
|
165
|
-
"color-format",
|
|
166
|
-
"predefine",
|
|
167
|
-
"show-alpha",
|
|
168
|
-
"disabled",
|
|
169
|
-
"border",
|
|
170
|
-
"clearable"
|
|
171
|
-
];
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* 获取 classlist 列表
|
|
175
|
-
* @return {string} 属性值
|
|
176
|
-
*/
|
|
177
|
-
updateContainerClasslist() {
|
|
178
|
-
const e = this.computedClasslist(
|
|
179
|
-
this.ns.b("container"),
|
|
180
|
-
{},
|
|
181
|
-
{
|
|
182
|
-
disabled: this.disabled,
|
|
183
|
-
border: this.border,
|
|
184
|
-
"show-alpha": this["show-alpha"],
|
|
185
|
-
clearable: this.clearable
|
|
186
|
-
}
|
|
187
|
-
);
|
|
188
|
-
return t(this, W).className = e, e;
|
|
189
|
-
}
|
|
190
|
-
$render() {
|
|
191
|
-
const e = rt("color-picker-panel");
|
|
192
|
-
this.ns = e, this.shadowRoot.innerHTML = this.html(`
|
|
193
|
-
<div class="${e.b()}" part="container">
|
|
194
|
-
<div class="${e.e("wrapper")}" part="wrapper">
|
|
195
|
-
<div class="${e.e("svpanel")}" part="svpanel">
|
|
196
|
-
<div class="${e.e("cursor")} ${e.e("svpanel-cursor")}" part="svpanel-cursor"></div>
|
|
197
|
-
</div>
|
|
198
|
-
<div class="${e.e("hue-slider")} ${e.m("vertical")}" part="hue-slider">
|
|
199
|
-
<div class="${e.e("thumb")} ${e.e("hue-slider-thumb")}" part="hue-slider-thumb"></div>
|
|
200
|
-
</div>
|
|
201
|
-
</div>
|
|
202
|
-
<div class="${e.e("alpha-slider")}" part="alpha-slider">
|
|
203
|
-
<div class="${e.e("thumb")} ${e.e("alpha-slider-thumb")}" part="alpha-slider-thumb"></div>
|
|
204
|
-
</div>
|
|
205
|
-
<div class="${e.e("predefine")}" part="predefine">
|
|
206
|
-
<div class="${e.e("colors")}" part="predefine-colors"></div>
|
|
207
|
-
</div>
|
|
208
|
-
<div class="${e.e("footer")}" part="footer">
|
|
209
|
-
<div class="${e.e("text-display")}" part="text-display"></div>
|
|
210
|
-
<ea-input class="${e.e("color-input")}" part="color-input" type="text" size="small"></ea-input>
|
|
211
|
-
<section class="${e.e("append")}" part="append">
|
|
212
|
-
<slot name="footer"></slot>
|
|
213
|
-
</section>
|
|
214
|
-
</div>
|
|
215
|
-
</div>
|
|
216
|
-
`), d(this, W, this.shadowRoot.querySelector(e.cb())), d(this, A, this.shadowRoot.querySelector(e.ce("svpanel"))), d(this, m, this.shadowRoot.querySelector(
|
|
217
|
-
e.ce("svpanel-cursor")
|
|
218
|
-
)), d(this, P, this.shadowRoot.querySelector(e.ce("hue-slider"))), d(this, M, this.shadowRoot.querySelector(e.ce("hue-slider-thumb"))), d(this, R, this.shadowRoot.querySelector(e.ce("alpha-slider"))), d(this, J, this.shadowRoot.querySelector(
|
|
219
|
-
e.ce("alpha-slider-bar")
|
|
220
|
-
)), d(this, k, this.shadowRoot.querySelector(
|
|
221
|
-
e.ce("alpha-slider-thumb")
|
|
222
|
-
)), d(this, L, this.shadowRoot.querySelector(e.ce("predefine"))), d(this, g, this.shadowRoot.querySelector(e.ce("color-input"))), d(this, B, this.shadowRoot.querySelector(e.ce("text-display"))), this.updateContainerClasslist(), a(this, o, it).call(this);
|
|
223
|
-
}
|
|
224
|
-
connectedCallback() {
|
|
225
|
-
var e;
|
|
226
|
-
super.connectedCallback(), (e = t(this, y)) == null || e.abort(), d(this, y, new AbortController()), a(this, o, lt).call(this);
|
|
227
|
-
}
|
|
228
|
-
$beforeUnmounted() {
|
|
229
|
-
var e;
|
|
230
|
-
(e = t(this, y)) == null || e.abort();
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* 重置光标和滑块位置到初始状态
|
|
234
|
-
*/
|
|
235
|
-
resetCursorPosition() {
|
|
236
|
-
t(this, s).hue = 0, t(this, s).saturation = 1, t(this, s).value = 1, t(this, s).alpha = 1, t(this, s).isFirstValueUpdate = !1, t(this, m) && (t(this, m).style.left = "", t(this, m).style.top = ""), t(this, M) && (t(this, M).style.top = ""), t(this, k) && (t(this, k).style.left = ""), t(this, D).call(this);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
W = new WeakMap(), A = new WeakMap(), m = new WeakMap(), P = new WeakMap(), M = new WeakMap(), R = new WeakMap(), J = new WeakMap(), k = new WeakMap(), L = new WeakMap(), g = new WeakMap(), B = new WeakMap(), y = new WeakMap(), v = new WeakMap(), s = new WeakMap(), o = new WeakSet(), /**
|
|
240
|
-
* 绑定组件事件监听器
|
|
241
|
-
*/
|
|
242
|
-
lt = function() {
|
|
243
|
-
t(this, A).addEventListener(
|
|
244
|
-
"mousedown",
|
|
245
|
-
a(this, o, ht).bind(this),
|
|
246
|
-
{
|
|
247
|
-
signal: t(this, y).signal
|
|
248
|
-
}
|
|
249
|
-
), t(this, P).addEventListener("mousedown", a(this, o, nt).bind(this), {
|
|
250
|
-
signal: t(this, y).signal
|
|
251
|
-
}), t(this, R).addEventListener(
|
|
252
|
-
"mousedown",
|
|
253
|
-
a(this, o, ct).bind(this),
|
|
254
|
-
{
|
|
255
|
-
signal: t(this, y).signal
|
|
256
|
-
}
|
|
257
|
-
), t(this, g).addEventListener(
|
|
258
|
-
"change",
|
|
259
|
-
a(this, o, ut).bind(this),
|
|
260
|
-
{
|
|
261
|
-
signal: t(this, y).signal
|
|
262
|
-
}
|
|
263
|
-
), t(this, g).addEventListener(
|
|
264
|
-
"blur",
|
|
265
|
-
a(this, o, vt).bind(this),
|
|
266
|
-
{
|
|
267
|
-
signal: t(this, y).signal
|
|
268
|
-
}
|
|
269
|
-
), t(this, L) && t(this, L).addEventListener(
|
|
270
|
-
"click",
|
|
271
|
-
a(this, o, pt).bind(this),
|
|
272
|
-
{
|
|
273
|
-
signal: t(this, y).signal
|
|
274
|
-
}
|
|
275
|
-
);
|
|
276
|
-
}, /**
|
|
277
|
-
* 处理饱和度和值的更新
|
|
278
|
-
* @param {MouseEvent} e - 鼠标事件对象
|
|
279
|
-
*/
|
|
280
|
-
ht = function(e) {
|
|
281
|
-
var c, b;
|
|
282
|
-
if ((c = t(this, v).saturationMove) == null || c.abort(), (b = t(this, v).hueMove) == null || b.abort(), this.disabled) return;
|
|
283
|
-
e.preventDefault(), t(this, v).saturationMove = new AbortController(), t(this, s).isDragging = !0;
|
|
284
|
-
const i = (u) => {
|
|
285
|
-
const p = t(this, A).getBoundingClientRect(), E = Math.max(0, Math.min(u.clientX - p.left, p.width)), x = Math.max(0, Math.min(u.clientY - p.top, p.height)), V = E / p.width, Q = 1 - x / p.height;
|
|
286
|
-
t(this, s).saturation = V, t(this, s).value = Q, t(this, s).color.setValue({
|
|
287
|
-
h: t(this, s).hue,
|
|
288
|
-
s: V,
|
|
289
|
-
v: Q,
|
|
290
|
-
a: t(this, s).alpha
|
|
291
|
-
}), this.value = t(this, s).color.toString(this["color-format"]), a(this, o, H).call(this), t(this, m).style.left = V * p.width + "px", t(this, m).style.top = (1 - Q) * p.height + "px";
|
|
292
|
-
};
|
|
293
|
-
i(e), window.addEventListener("mousemove", i, {
|
|
294
|
-
signal: t(this, v).saturationMove.signal
|
|
295
|
-
}), window.addEventListener(
|
|
296
|
-
"mouseup",
|
|
297
|
-
() => {
|
|
298
|
-
var u;
|
|
299
|
-
(u = t(this, v).saturationMove) == null || u.abort(), t(this, s).isDragging = !1;
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
signal: t(this, v).saturationMove.signal
|
|
303
|
-
}
|
|
304
|
-
);
|
|
305
|
-
}, /**
|
|
306
|
-
* 处理色调的更新
|
|
307
|
-
* @param {MouseEvent} e - 鼠标事件对象
|
|
308
|
-
*/
|
|
309
|
-
nt = function(e) {
|
|
310
|
-
var c, b;
|
|
311
|
-
if ((c = t(this, v).hueMove) == null || c.abort(), (b = t(this, v).saturationMove) == null || b.abort(), this.disabled) return;
|
|
312
|
-
e.preventDefault(), t(this, v).hueMove = new AbortController(), t(this, s).isDragging = !0;
|
|
313
|
-
const i = (u) => {
|
|
314
|
-
const p = t(this, P).getBoundingClientRect(), x = (1 - Math.max(0.01, Math.min(u.clientY - p.top, p.height)) / p.height) * 360;
|
|
315
|
-
t(this, s).hue = x, t(this, s).color.setValue({
|
|
316
|
-
h: x,
|
|
317
|
-
s: t(this, s).saturation,
|
|
318
|
-
v: t(this, s).value,
|
|
319
|
-
a: t(this, s).alpha
|
|
320
|
-
}), this.value = t(this, s).color.toString(this["color-format"]), a(this, o, H).call(this), t(this, M).style.top = (1 - x / 360) * p.height + "px", t(this, D).call(this);
|
|
321
|
-
};
|
|
322
|
-
i(e), window.addEventListener("mousemove", i, {
|
|
323
|
-
signal: t(this, v).hueMove.signal
|
|
324
|
-
}), window.addEventListener(
|
|
325
|
-
"mouseup",
|
|
326
|
-
() => {
|
|
327
|
-
var u;
|
|
328
|
-
(u = t(this, v).hueMove) == null || u.abort(), t(this, s).isDragging = !1;
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
signal: t(this, v).hueMove.signal
|
|
332
|
-
}
|
|
333
|
-
);
|
|
334
|
-
}, /**
|
|
335
|
-
* 处理透明度的更新
|
|
336
|
-
* @param {MouseEvent} e - 鼠标事件对象
|
|
337
|
-
*/
|
|
338
|
-
ct = function(e) {
|
|
339
|
-
var c, b, u;
|
|
340
|
-
if ((c = t(this, v).alphaMove) == null || c.abort(), (b = t(this, v).saturationMove) == null || b.abort(), (u = t(this, v).hueMove) == null || u.abort(), this.disabled) return;
|
|
341
|
-
e.preventDefault(), t(this, v).alphaMove = new AbortController(), t(this, s).isDragging = !0;
|
|
342
|
-
const i = (p) => {
|
|
343
|
-
const E = t(this, R).getBoundingClientRect(), x = Math.max(0, Math.min(p.clientX - E.left, E.width)), V = Number((x / E.width).toFixed(2));
|
|
344
|
-
Math.abs(t(this, s).alpha - V) > 1e-3 && (t(this, s).alpha = V, t(this, s).color.setValue({
|
|
345
|
-
h: t(this, s).hue,
|
|
346
|
-
s: t(this, s).saturation,
|
|
347
|
-
v: t(this, s).value,
|
|
348
|
-
a: V
|
|
349
|
-
}), this.value = t(this, s).color.toString(this["color-format"]), a(this, o, H).call(this), t(this, k).style.left = V * E.width + "px");
|
|
350
|
-
};
|
|
351
|
-
i(e), window.addEventListener("mousemove", i, {
|
|
352
|
-
signal: t(this, v).alphaMove.signal
|
|
353
|
-
}), window.addEventListener(
|
|
354
|
-
"mouseup",
|
|
355
|
-
() => {
|
|
356
|
-
var p;
|
|
357
|
-
(p = t(this, v).alphaMove) == null || p.abort(), t(this, s).isDragging = !1;
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
signal: t(this, v).alphaMove.signal
|
|
361
|
-
}
|
|
362
|
-
);
|
|
363
|
-
}, /**
|
|
364
|
-
* 更新光标位置
|
|
365
|
-
*/
|
|
366
|
-
et = function() {
|
|
367
|
-
if (!t(this, s).isFirstValueUpdate) {
|
|
368
|
-
t(this, s).color.setValue(this.value);
|
|
369
|
-
const e = t(this, s).color.hsvStrToHsvObject(
|
|
370
|
-
t(this, s).color.toHsv(!0)
|
|
371
|
-
);
|
|
372
|
-
if (e) {
|
|
373
|
-
const i = parseInt(e.h), c = e.s, b = e.v, u = e.a ? parseFloat(e.a) : 1;
|
|
374
|
-
t(this, s).hue = i, t(this, s).saturation = c, t(this, s).value = b, t(this, s).alpha = u;
|
|
375
|
-
}
|
|
376
|
-
t(this, s).isFirstValueUpdate = !0;
|
|
377
|
-
}
|
|
378
|
-
if (t(this, m) && t(this, A)) {
|
|
379
|
-
const e = t(this, s).saturation, i = t(this, s).value, c = t(this, A).getBoundingClientRect(), b = G.CSS.px2num(
|
|
380
|
-
this.style.getPropertyValue("--ea-color-picker-panel-svpanel-width")
|
|
381
|
-
) || 280, u = G.CSS.px2num(
|
|
382
|
-
this.style.getPropertyValue("--ea-color-picker-panel-svpanel-height")
|
|
383
|
-
) || 180, p = Math.max(
|
|
384
|
-
0,
|
|
385
|
-
Math.min(c.width, b),
|
|
386
|
-
b
|
|
387
|
-
), E = Math.max(
|
|
388
|
-
0,
|
|
389
|
-
Math.min(c.height, u),
|
|
390
|
-
u
|
|
391
|
-
), x = e * p, V = (1 - i) * E;
|
|
392
|
-
t(this, m).style.left = x + "px", t(this, m).style.top = V + "px";
|
|
393
|
-
}
|
|
394
|
-
if (t(this, M) && t(this, P)) {
|
|
395
|
-
const e = t(this, s).hue, i = t(this, P).getBoundingClientRect(), c = G.CSS.px2num(
|
|
396
|
-
this.style.getPropertyValue(
|
|
397
|
-
"--ea-color-picker-panel-hue-slider-height"
|
|
398
|
-
)
|
|
399
|
-
) || 180, b = Math.max(0, Math.min(i.height, c), c), u = (1 - e / 360) * b;
|
|
400
|
-
t(this, M).style.top = u + "px";
|
|
401
|
-
}
|
|
402
|
-
if (t(this, k) && t(this, R)) {
|
|
403
|
-
const e = t(this, s).alpha, i = t(this, R).getBoundingClientRect(), c = G.CSS.px2num(
|
|
404
|
-
this.style.getPropertyValue(
|
|
405
|
-
"--ea-color-picker-panel-alpha-slider-width"
|
|
406
|
-
)
|
|
407
|
-
) || 280, b = Math.max(0, Math.min(i.width, c), c), u = e * b;
|
|
408
|
-
t(this, k).style.left = u + "px";
|
|
409
|
-
}
|
|
410
|
-
}, D = new WeakMap(), /**
|
|
411
|
-
* 处理颜色输入框变化事件
|
|
412
|
-
* @param {Event} e - 事件对象
|
|
413
|
-
*/
|
|
414
|
-
ut = function(e) {
|
|
415
|
-
const i = e.target.value;
|
|
416
|
-
try {
|
|
417
|
-
const c = new F(i);
|
|
418
|
-
this.value = c.toString(this["color-format"]), a(this, o, H).call(this);
|
|
419
|
-
} catch {
|
|
420
|
-
t(this, g).value = this.value;
|
|
421
|
-
}
|
|
422
|
-
}, /**
|
|
423
|
-
* 触发颜色变化事件
|
|
424
|
-
*/
|
|
425
|
-
H = function() {
|
|
426
|
-
this.dispatchEvent(
|
|
427
|
-
new CustomEvent("change", {
|
|
428
|
-
detail: {
|
|
429
|
-
value: this.value,
|
|
430
|
-
color: t(this, s).color
|
|
431
|
-
},
|
|
432
|
-
bubbles: !0,
|
|
433
|
-
composed: !0
|
|
434
|
-
})
|
|
435
|
-
), this.dispatchEvent(
|
|
436
|
-
new Rt({ value: this.value })
|
|
437
|
-
);
|
|
438
|
-
}, /**
|
|
439
|
-
* 渲染预设颜色列表
|
|
440
|
-
* @param {Array} list - 预设颜色列表
|
|
441
|
-
*/
|
|
442
|
-
dt = function(e) {
|
|
443
|
-
!e || e.length === 0 || (t(this, L).innerHTML = this.html(
|
|
444
|
-
e.map(
|
|
445
|
-
(i) => `
|
|
446
|
-
<div class="${this.ns.e("predefine-color")}"
|
|
447
|
-
part="predefine-color"
|
|
448
|
-
style="background-color: ${i}"
|
|
449
|
-
data-color="${i}"
|
|
450
|
-
></div>
|
|
451
|
-
`
|
|
452
|
-
).join("")
|
|
453
|
-
));
|
|
454
|
-
}, /**
|
|
455
|
-
* 处理预设颜色点击事件
|
|
456
|
-
* @param {MouseEvent} e - 鼠标事件对象
|
|
457
|
-
*/
|
|
458
|
-
pt = function(e) {
|
|
459
|
-
if (this.disabled) return;
|
|
460
|
-
const i = e.target.closest(this.ns.ce("predefine-color"));
|
|
461
|
-
if (!i) return;
|
|
462
|
-
const c = i.getAttribute("data-color");
|
|
463
|
-
c && a(this, o, st).call(this, c);
|
|
464
|
-
}, /**
|
|
465
|
-
* 根据颜色值更新所有相关状态
|
|
466
|
-
* @param {string} colorValue - 颜色值字符串
|
|
467
|
-
*/
|
|
468
|
-
st = function(e) {
|
|
469
|
-
a(this, o, Z).call(this), this.value = e, t(this, s).color.setValue(e);
|
|
470
|
-
const i = t(this, s).color.hsvStrToHsvObject(
|
|
471
|
-
t(this, s).color.toHsv(!0)
|
|
472
|
-
);
|
|
473
|
-
if (i) {
|
|
474
|
-
const c = parseInt(i.h), b = i.s, u = i.v, p = i.a ? parseFloat(i.a) : 1;
|
|
475
|
-
t(this, s).hue = c, t(this, s).saturation = b, t(this, s).value = u, t(this, s).alpha = p;
|
|
476
|
-
}
|
|
477
|
-
a(this, o, et).call(this), t(this, D).call(this), a(this, o, H).call(this);
|
|
478
|
-
}, /**
|
|
479
|
-
* 更新文字展示模式
|
|
480
|
-
*/
|
|
481
|
-
it = function() {
|
|
482
|
-
!t(this, g) || !t(this, B) || (a(this, o, Z).call(this), this.updateContainerClasslist());
|
|
483
|
-
}, /**
|
|
484
|
-
* 更新颜色输入框的值
|
|
485
|
-
*/
|
|
486
|
-
Z = function() {
|
|
487
|
-
this.clearable && t(this, g) ? t(this, g).setAttribute("value", this.value) : !this.clearable && t(this, B) && (t(this, B).textContent = this.value);
|
|
488
|
-
}, /**
|
|
489
|
-
* 处理颜色输入框blur事件
|
|
490
|
-
* @param {FocusEvent} e - 焦点事件对象
|
|
491
|
-
*/
|
|
492
|
-
vt = function(e) {
|
|
493
|
-
if (!t(this, g)) return;
|
|
494
|
-
const i = t(this, g).getAttribute("value") || "";
|
|
495
|
-
if (!i) {
|
|
496
|
-
this.value = "", t(this, s).lastValidValue = "";
|
|
497
|
-
return;
|
|
498
|
-
}
|
|
499
|
-
a(this, o, bt).call(this, i) ? (t(this, s).lastValidValue = i, a(this, o, st).call(this, i)) : (t(this, g).setAttribute("value", t(this, s).lastValidValue || ""), this.dispatchEvent(
|
|
500
|
-
new qt({ value: i })
|
|
501
|
-
));
|
|
502
|
-
}, /**
|
|
503
|
-
* 验证颜色格式是否合法
|
|
504
|
-
* @param {string} colorValue - 颜色值
|
|
505
|
-
* @returns {boolean} 是否合法
|
|
506
|
-
*/
|
|
507
|
-
bt = function(e) {
|
|
508
|
-
return F.isValidColor(e);
|
|
509
|
-
};
|
|
510
|
-
customElements.get("ea-color-picker-panel") || customElements.define("ea-color-picker-panel", Lt);
|
|
511
|
-
class Bt extends Event {
|
|
512
|
-
constructor() {
|
|
513
|
-
super("ea-clear", { bubbles: !0, composed: !0 });
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
var $, w, I, K, q, U, C, X, Y, _, S, f, N, r, ft, gt, mt, yt, wt, Ct, at, O, z, j, St, Vt;
|
|
517
|
-
class Dt extends Mt {
|
|
518
|
-
constructor() {
|
|
519
|
-
super();
|
|
520
|
-
l(this, r);
|
|
521
|
-
/** @type {HTMLDivElement} */
|
|
522
|
-
l(this, $);
|
|
523
|
-
/** @type {import("@/common/ea-popper").EaPopper} */
|
|
524
|
-
l(this, w);
|
|
525
|
-
/** @type {HTMLDivElement} */
|
|
526
|
-
l(this, I);
|
|
527
|
-
/** @type {HTMLDivElement} */
|
|
528
|
-
l(this, K);
|
|
529
|
-
/** @type {HTMLDivElement} */
|
|
530
|
-
l(this, q);
|
|
531
|
-
/** @type {import("@/components/ea-icon").EaIcon} */
|
|
532
|
-
l(this, U);
|
|
533
|
-
/** @type {import("@/components/ea-color-picker/components/ea-color-picker-panel").EaColorPickerPanel} */
|
|
534
|
-
l(this, C);
|
|
535
|
-
/** @type {HTMLLabelElement} */
|
|
536
|
-
l(this, X);
|
|
537
|
-
/** @type {import("@/components/ea-button").EaButton} */
|
|
538
|
-
l(this, Y);
|
|
539
|
-
/** @type {import("@/components/ea-button").EaButton} */
|
|
540
|
-
l(this, _);
|
|
541
|
-
l(this, S, new AbortController());
|
|
542
|
-
l(this, f, {
|
|
543
|
-
/** @type {boolean} 弹窗是否打开 */
|
|
544
|
-
isOpen: !1,
|
|
545
|
-
/** @type {import("@/utils/Color").Color} 当前颜色对象 */
|
|
546
|
-
color: new F(),
|
|
547
|
-
isPanelDefined: !1,
|
|
548
|
-
/** @type {string} 打开面板前的颜色值 */
|
|
549
|
-
previousValue: ""
|
|
550
|
-
});
|
|
551
|
-
l(this, N, {
|
|
552
|
-
/** @type {AbortController | null} 关闭弹窗的控制器 */
|
|
553
|
-
close: null
|
|
554
|
-
});
|
|
555
|
-
T(this, "state", this.properties({
|
|
556
|
-
label: {
|
|
557
|
-
type: String,
|
|
558
|
-
default: "",
|
|
559
|
-
observer: async (e) => {
|
|
560
|
-
t(this, X).textContent = e;
|
|
561
|
-
}
|
|
562
|
-
},
|
|
563
|
-
value: {
|
|
564
|
-
type: String,
|
|
565
|
-
default: "",
|
|
566
|
-
observer: (e) => {
|
|
567
|
-
a(this, r, z).call(this), a(this, r, j).call(this, e), t(this, C).setAttribute("value", e);
|
|
568
|
-
}
|
|
569
|
-
},
|
|
570
|
-
disabled: {
|
|
571
|
-
type: Boolean,
|
|
572
|
-
default: !1,
|
|
573
|
-
observer: (e) => {
|
|
574
|
-
this.updateContainerClasslist();
|
|
575
|
-
}
|
|
576
|
-
},
|
|
577
|
-
clearable: {
|
|
578
|
-
type: Boolean,
|
|
579
|
-
default: !1,
|
|
580
|
-
observer: (e) => {
|
|
581
|
-
this.updateContainerClasslist(), t(this, C).setAttribute("clearable", e);
|
|
582
|
-
}
|
|
583
|
-
},
|
|
584
|
-
size: {
|
|
585
|
-
type: $t,
|
|
586
|
-
default: "",
|
|
587
|
-
observer: (e) => {
|
|
588
|
-
this.updateContainerClasslist();
|
|
589
|
-
}
|
|
590
|
-
},
|
|
591
|
-
"color-format": {
|
|
592
|
-
type: ["hsl", "hsv", "hex", "rgb"],
|
|
593
|
-
default: "hex",
|
|
594
|
-
observer: (e) => {
|
|
595
|
-
t(this, C).setAttribute("color-format", e);
|
|
596
|
-
}
|
|
597
|
-
},
|
|
598
|
-
"show-alpha": {
|
|
599
|
-
type: Boolean,
|
|
600
|
-
default: !1,
|
|
601
|
-
observer: (e) => {
|
|
602
|
-
t(this, C).setAttribute("show-alpha", e);
|
|
603
|
-
}
|
|
604
|
-
},
|
|
605
|
-
tabindex: {
|
|
606
|
-
type: Number,
|
|
607
|
-
default: 0,
|
|
608
|
-
observer: (e) => {
|
|
609
|
-
}
|
|
610
|
-
},
|
|
611
|
-
required: {
|
|
612
|
-
type: Boolean,
|
|
613
|
-
default: !1
|
|
614
|
-
}
|
|
615
|
-
}));
|
|
616
|
-
T(this, "propState", this.properties({
|
|
617
|
-
predefine: {
|
|
618
|
-
props: !0,
|
|
619
|
-
type: Array,
|
|
620
|
-
default: [],
|
|
621
|
-
observer: async (e) => {
|
|
622
|
-
t(this, f).isPanelDefined || (await customElements.whenDefined("ea-color-picker-panel"), t(this, f).isPanelDefined = !0), t(this, C).predefine = e;
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
}));
|
|
626
|
-
T(this, "popperState", this.properties({
|
|
627
|
-
placement: {
|
|
628
|
-
type: [
|
|
629
|
-
"top",
|
|
630
|
-
"top-start",
|
|
631
|
-
"top-end",
|
|
632
|
-
"bottom",
|
|
633
|
-
"bottom-start",
|
|
634
|
-
"bottom-end",
|
|
635
|
-
"left",
|
|
636
|
-
"left-start",
|
|
637
|
-
"left-end",
|
|
638
|
-
"right",
|
|
639
|
-
"right-start",
|
|
640
|
-
"right-end"
|
|
641
|
-
],
|
|
642
|
-
default: "bottom",
|
|
643
|
-
observer: (e) => {
|
|
644
|
-
t(this, w).setAttribute("placement", e);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
}));
|
|
648
|
-
this.stylesheet = kt, this.$render();
|
|
649
|
-
}
|
|
650
|
-
static get observedAttributes() {
|
|
651
|
-
return [
|
|
652
|
-
...super.observedAttributes,
|
|
653
|
-
"label",
|
|
654
|
-
"value",
|
|
655
|
-
"disabled",
|
|
656
|
-
"clearable",
|
|
657
|
-
"size",
|
|
658
|
-
"color-format",
|
|
659
|
-
"predefine",
|
|
660
|
-
"tabindex",
|
|
661
|
-
"placement",
|
|
662
|
-
"show-alpha",
|
|
663
|
-
"required"
|
|
664
|
-
];
|
|
665
|
-
}
|
|
666
|
-
$render() {
|
|
667
|
-
const e = rt("color-picker");
|
|
668
|
-
this.ns = e, this.shadowRoot.innerHTML = this.html(`
|
|
669
|
-
<label class="${e.e("form-label")}" part="form-label"></label>
|
|
670
|
-
<div class="${e.b("container")}" part="container" tabindex="${this.tabindex}">
|
|
671
|
-
<ea-popper
|
|
672
|
-
class="${e.e("popper")}"
|
|
673
|
-
part="popper"
|
|
674
|
-
show-arrow="false"
|
|
675
|
-
>
|
|
676
|
-
<div class="${e.e("trigger")}" part="trigger" slot="reference">
|
|
677
|
-
<div class="${e.e("outer")}" part="outer">
|
|
678
|
-
<div class="${e.e("inner")}" part="inner"></div>
|
|
679
|
-
</div>
|
|
680
|
-
<div class="${e.e("icon-wrapper")}" part="icon-wrapper">
|
|
681
|
-
<ea-icon class="${e.e("icon", "status")}" part="status-icon" icon="icon-cancel"></ea-icon>
|
|
682
|
-
</div>
|
|
683
|
-
</div>
|
|
684
|
-
<ea-color-picker-panel class="${e.e("panel")}" part="panel">
|
|
685
|
-
<div slot="footer" class="${e.e("footer-actions")}" part="footer-actions">
|
|
686
|
-
<ea-button class="${e.e("clear-btn")}" part="clear-btn" plain text>clear</ea-button>
|
|
687
|
-
<ea-button class="${e.e("confirm-btn")}" part="confirm-btn" plain>ok</ea-button>
|
|
688
|
-
</div>
|
|
689
|
-
</ea-color-picker-panel>
|
|
690
|
-
</ea-popper>
|
|
691
|
-
</div>
|
|
692
|
-
`), d(this, X, this.shadowRoot.querySelector(e.ce("form-label"))), d(this, $, this.shadowRoot.querySelector(e.cb())), d(this, w, this.shadowRoot.querySelector(e.ce("popper"))), d(this, I, this.shadowRoot.querySelector(e.ce("trigger"))), d(this, K, this.shadowRoot.querySelector(e.ce("outer"))), d(this, q, this.shadowRoot.querySelector(e.ce("inner"))), d(this, U, this.shadowRoot.querySelector(e.ce("icon", "status"))), d(this, C, this.shadowRoot.querySelector(e.ce("panel"))), d(this, Y, this.shadowRoot.querySelector(this.ns.ce("clear-btn"))), d(this, _, this.shadowRoot.querySelector(this.ns.ce("confirm-btn"))), this.updateContainerClasslist();
|
|
693
|
-
}
|
|
694
|
-
connectedCallback() {
|
|
695
|
-
var e;
|
|
696
|
-
super.connectedCallback(), (e = t(this, S)) == null || e.abort(), d(this, S, new AbortController()), a(this, r, ft).call(this);
|
|
697
|
-
}
|
|
698
|
-
/**
|
|
699
|
-
* 获取 classlist 列表
|
|
700
|
-
* @return {string} 属性值
|
|
701
|
-
*/
|
|
702
|
-
updateContainerClasslist() {
|
|
703
|
-
const e = this.computedClasslist(
|
|
704
|
-
this.ns.b("container"),
|
|
705
|
-
{
|
|
706
|
-
["--" + this.size]: this.size
|
|
707
|
-
},
|
|
708
|
-
{
|
|
709
|
-
"has-value": this.value,
|
|
710
|
-
disabled: this.disabled
|
|
711
|
-
}
|
|
712
|
-
);
|
|
713
|
-
return t(this, $).className = e, e;
|
|
714
|
-
}
|
|
715
|
-
$beforeUnmounted() {
|
|
716
|
-
var e;
|
|
717
|
-
(e = t(this, S)) == null || e.abort();
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* 手动显示颜色选择器面板
|
|
721
|
-
*/
|
|
722
|
-
show() {
|
|
723
|
-
a(this, r, at).call(this);
|
|
724
|
-
}
|
|
725
|
-
/**
|
|
726
|
-
* 手动隐藏颜色选择器面板
|
|
727
|
-
*/
|
|
728
|
-
hide() {
|
|
729
|
-
a(this, r, O).call(this);
|
|
730
|
-
}
|
|
731
|
-
/**
|
|
732
|
-
* 使颜色选择器获得焦点
|
|
733
|
-
*/
|
|
734
|
-
focus() {
|
|
735
|
-
t(this, $) && t(this, $).focus();
|
|
736
|
-
}
|
|
737
|
-
/**
|
|
738
|
-
* 使颜色选择器失去焦点
|
|
739
|
-
*/
|
|
740
|
-
blur() {
|
|
741
|
-
t(this, $) && t(this, $).blur();
|
|
742
|
-
}
|
|
743
|
-
/**
|
|
744
|
-
* 获取验证目标元素
|
|
745
|
-
* @returns {HTMLElement}
|
|
746
|
-
*/
|
|
747
|
-
get validationTarget() {
|
|
748
|
-
return this;
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* 更新表单验证状态
|
|
752
|
-
*/
|
|
753
|
-
updateValidity() {
|
|
754
|
-
this.required && !this.value ? this.internals.setValidity(
|
|
755
|
-
{ valueMissing: !0 },
|
|
756
|
-
"请选择一个颜色",
|
|
757
|
-
this
|
|
758
|
-
) : this.internals.setValidity({}, "", this);
|
|
759
|
-
}
|
|
760
|
-
/**
|
|
761
|
-
* 检查表单字段的有效性
|
|
762
|
-
* @returns {boolean} 如果字段有效返回 true,否则返回 false
|
|
763
|
-
*/
|
|
764
|
-
checkValidity() {
|
|
765
|
-
return this.updateValidity(), this.internals.checkValidity();
|
|
766
|
-
}
|
|
767
|
-
/**
|
|
768
|
-
* 报告表单字段的有效性(显示验证提示)
|
|
769
|
-
* @returns {boolean} 如果字段有效返回 true,否则返回 false
|
|
770
|
-
*/
|
|
771
|
-
reportValidity() {
|
|
772
|
-
return this.updateValidity(), this.internals.reportValidity();
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
$ = new WeakMap(), w = new WeakMap(), I = new WeakMap(), K = new WeakMap(), q = new WeakMap(), U = new WeakMap(), C = new WeakMap(), X = new WeakMap(), Y = new WeakMap(), _ = new WeakMap(), S = new WeakMap(), f = new WeakMap(), N = new WeakMap(), r = new WeakSet(), /**
|
|
776
|
-
* 绑定组件事件监听器
|
|
777
|
-
*/
|
|
778
|
-
ft = function() {
|
|
779
|
-
!t(this, I) || !t(this, w) || (t(this, I).addEventListener("click", a(this, r, gt).bind(this), {
|
|
780
|
-
signal: t(this, S).signal
|
|
781
|
-
}), t(this, w).addEventListener("show", a(this, r, mt).bind(this), {
|
|
782
|
-
signal: t(this, S).signal
|
|
783
|
-
}), t(this, w).addEventListener("hide", a(this, r, yt).bind(this), {
|
|
784
|
-
signal: t(this, S).signal
|
|
785
|
-
}), t(this, C).addEventListener("change", a(this, r, wt).bind(this), {
|
|
786
|
-
signal: t(this, S).signal
|
|
787
|
-
}), t(this, Y).addEventListener("click", a(this, r, St).bind(this), {
|
|
788
|
-
signal: t(this, S).signal
|
|
789
|
-
}), t(this, _).addEventListener(
|
|
790
|
-
"click",
|
|
791
|
-
a(this, r, Vt).bind(this),
|
|
792
|
-
{
|
|
793
|
-
signal: t(this, S).signal
|
|
794
|
-
}
|
|
795
|
-
));
|
|
796
|
-
}, /**
|
|
797
|
-
* 处理触发器点击事件
|
|
798
|
-
* @param {MouseEvent} e - 鼠标事件对象
|
|
799
|
-
*/
|
|
800
|
-
gt = function(e) {
|
|
801
|
-
var i;
|
|
802
|
-
this.disabled || ((i = t(this, N).close) == null || i.abort(), t(this, N).close = new AbortController(), t(this, f).previousValue = this.value, a(this, r, at).call(this), document.addEventListener("click", a(this, r, Ct).bind(this), {
|
|
803
|
-
signal: t(this, N).close.signal
|
|
804
|
-
}));
|
|
805
|
-
}, /**
|
|
806
|
-
* 处理弹窗显示事件
|
|
807
|
-
*/
|
|
808
|
-
mt = function() {
|
|
809
|
-
t(this, f).isOpen = !0, this.updateContainerClasslist();
|
|
810
|
-
}, /**
|
|
811
|
-
* 处理弹窗隐藏事件
|
|
812
|
-
*/
|
|
813
|
-
yt = function() {
|
|
814
|
-
t(this, f).isOpen = !1, this.updateContainerClasslist(), t(this, f).previousValue !== void 0 && t(this, f).previousValue !== this.value && (this.value = t(this, f).previousValue, a(this, r, z).call(this), a(this, r, j).call(this));
|
|
815
|
-
}, /**
|
|
816
|
-
* 处理面板颜色变化事件
|
|
817
|
-
* @param {CustomEvent} e - 自定义事件对象
|
|
818
|
-
*/
|
|
819
|
-
wt = function(e) {
|
|
820
|
-
const { value: i } = e.detail;
|
|
821
|
-
this.value = i, a(this, r, z).call(this), a(this, r, j).call(this);
|
|
822
|
-
}, /**
|
|
823
|
-
* 处理文档点击事件(用于关闭弹窗)
|
|
824
|
-
* @param {MouseEvent} e - 鼠标事件对象
|
|
825
|
-
*/
|
|
826
|
-
Ct = function(e) {
|
|
827
|
-
t(this, f).isOpen && (!this.contains(e.target) || e.target !== this) && a(this, r, O).call(this);
|
|
828
|
-
}, /**
|
|
829
|
-
* 显示颜色选择器弹窗
|
|
830
|
-
*/
|
|
831
|
-
at = function() {
|
|
832
|
-
t(this, w) && t(this, w).show();
|
|
833
|
-
}, /**
|
|
834
|
-
* 隐藏颜色选择器弹窗
|
|
835
|
-
*/
|
|
836
|
-
O = function() {
|
|
837
|
-
t(this, w) && t(this, w).hide();
|
|
838
|
-
}, /**
|
|
839
|
-
* 更新触发元素的背景颜色
|
|
840
|
-
*/
|
|
841
|
-
z = function() {
|
|
842
|
-
if (t(this, q)) {
|
|
843
|
-
if (!this.value) {
|
|
844
|
-
t(this, q).style.setProperty(
|
|
845
|
-
"--ea-color-picker-inner-background-color",
|
|
846
|
-
"transparent"
|
|
847
|
-
);
|
|
848
|
-
return;
|
|
849
|
-
}
|
|
850
|
-
try {
|
|
851
|
-
const e = new F(this.value);
|
|
852
|
-
t(this, q).style.setProperty(
|
|
853
|
-
"--ea-color-picker-inner-background-color",
|
|
854
|
-
e.toRgb(!0)
|
|
855
|
-
);
|
|
856
|
-
} catch {
|
|
857
|
-
t(this, q).style.setProperty(
|
|
858
|
-
"--ea-color-picker-inner-background-color",
|
|
859
|
-
"transparent"
|
|
860
|
-
);
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
}, /**
|
|
864
|
-
* 更新状态图标
|
|
865
|
-
* @param {string} colorValue - 颜色值
|
|
866
|
-
*/
|
|
867
|
-
j = function(e = this.value) {
|
|
868
|
-
t(this, U) && t(this, U).setAttribute(
|
|
869
|
-
"icon",
|
|
870
|
-
e ? "icon-angle-down" : "icon-cancel"
|
|
871
|
-
);
|
|
872
|
-
}, /**
|
|
873
|
-
* 处理清除按钮点击事件
|
|
874
|
-
*/
|
|
875
|
-
St = function() {
|
|
876
|
-
var e, i;
|
|
877
|
-
this.value = "", t(this, C).style.setProperty(
|
|
878
|
-
"--ea-color-picker-panel-background-color",
|
|
879
|
-
"#ff0000"
|
|
880
|
-
), (i = (e = t(this, C)).resetCursorPosition) == null || i.call(e), a(this, r, z).call(this), a(this, r, j).call(this), this.emit("change", { detail: { value: "" } }), this.dispatchEvent(new Bt()), t(this, f).previousValue = "", a(this, r, O).call(this);
|
|
881
|
-
}, /**
|
|
882
|
-
* 处理确认按钮点击事件
|
|
883
|
-
*/
|
|
884
|
-
Vt = function() {
|
|
885
|
-
t(this, f).previousValue = this.value, a(this, r, O).call(this);
|
|
886
|
-
};
|
|
887
|
-
customElements.get("ea-color-picker") || customElements.define("ea-color-picker", Dt);
|
|
888
|
-
export {
|
|
889
|
-
Dt as EaColorPicker,
|
|
890
|
-
Lt as EaColorPickerPanel
|
|
891
|
-
};
|