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