easy-component-ui 3.0.12 → 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 +3 -2
- package/dist/components/ea-alert.js +71 -54
- package/dist/components/ea-avatar.js +42 -37
- package/dist/components/ea-button.js +53 -52
- package/dist/components/ea-calendar2.js +329 -327
- package/dist/components/ea-card.js +63 -27
- package/dist/components/ea-carousel.js +2 -2
- package/dist/components/ea-collapse.js +28 -28
- package/dist/components/ea-color-picker.js +63 -66
- package/dist/components/ea-container.js +90 -61
- package/dist/components/ea-date-picker.js +1 -1
- package/dist/components/ea-dialog.js +4 -4
- package/dist/components/ea-drawer.js +51 -46
- 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 +1 -1
- 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 +20 -19
- package/dist/components/ea-page-header.js +5 -5
- package/dist/components/ea-pagination.js +5 -5
- package/dist/components/ea-popconfirm.js +3 -3
- package/dist/components/ea-popover.js +35 -11
- package/dist/components/ea-progress.js +28 -28
- package/dist/components/ea-rate.js +1 -1
- package/dist/components/ea-result.js +13 -13
- package/dist/components/ea-select.js +12 -12
- package/dist/components/ea-slider.js +88 -79
- package/dist/components/ea-splitter.js +34 -18
- package/dist/components/ea-steps.js +33 -33
- package/dist/components/ea-table.js +332 -321
- package/dist/components/ea-tabs.js +28 -28
- package/dist/components/ea-tag.js +6 -6
- package/dist/components/ea-time-picker.js +2 -6
- package/dist/components/ea-timeline.js +1 -1
- 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 +0 -1
- package/dist/css/ea-card.style.js +2 -2
- package/dist/css/ea-container.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-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-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/utils/Variables.js +10 -10
- package/package.json +302 -304
- package/dist/components/ea-loading.js +0 -151
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var b = Object.defineProperty;
|
|
2
|
+
var y = (e) => {
|
|
3
3
|
throw TypeError(e);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
import { B as
|
|
9
|
-
import { s as
|
|
10
|
-
var
|
|
11
|
-
class
|
|
5
|
+
var g = (e, s, t) => s in e ? b(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
|
|
6
|
+
var f = (e, s, t) => g(e, typeof s != "symbol" ? s + "" : s, t), v = (e, s, t) => s.has(e) || y("Cannot " + t);
|
|
7
|
+
var a = (e, s, t) => (v(e, s, "read from private field"), t ? t.call(e) : s.get(e)), o = (e, s, t) => s.has(e) ? y("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), h = (e, s, t, l) => (v(e, s, "write to private field"), l ? l.call(e, t) : s.set(e, t), t);
|
|
8
|
+
import { B as E } from "./Base.js";
|
|
9
|
+
import { s as _ } from "../css/ea-card.style.js";
|
|
10
|
+
var c, i, n, r, d, p;
|
|
11
|
+
class S extends E {
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
14
14
|
/** @type {HTMLElement} */
|
|
15
|
-
|
|
15
|
+
o(this, c);
|
|
16
16
|
/** @type {HTMLElement} */
|
|
17
|
-
|
|
17
|
+
o(this, i);
|
|
18
18
|
/** @type {HTMLElement} */
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
o(this, n);
|
|
20
|
+
/** @type {AbortController} */
|
|
21
|
+
o(this, r, null);
|
|
22
|
+
o(this, d, {
|
|
23
|
+
isHeaderEmpty: !0,
|
|
24
|
+
isFooterEmpty: !0
|
|
25
|
+
});
|
|
26
|
+
f(this, "state", this.properties({
|
|
21
27
|
shadow: {
|
|
22
28
|
type: ["always", "never", "hover"],
|
|
23
29
|
default: "always",
|
|
@@ -29,18 +35,31 @@ class w extends m {
|
|
|
29
35
|
type: String,
|
|
30
36
|
default: "",
|
|
31
37
|
observer: (t) => {
|
|
32
|
-
|
|
38
|
+
a(this, i).innerText = t;
|
|
33
39
|
}
|
|
34
40
|
},
|
|
35
41
|
footer: {
|
|
36
42
|
type: String,
|
|
37
43
|
default: "",
|
|
38
44
|
observer: (t) => {
|
|
39
|
-
|
|
45
|
+
a(this, n).innerText = t;
|
|
40
46
|
}
|
|
41
47
|
}
|
|
42
48
|
}));
|
|
43
|
-
|
|
49
|
+
/**
|
|
50
|
+
* 更新空状态
|
|
51
|
+
* @param {Event} e 事件
|
|
52
|
+
*/
|
|
53
|
+
o(this, p, (t) => {
|
|
54
|
+
const l = t.target;
|
|
55
|
+
let m = l.getAttribute("name") || "";
|
|
56
|
+
m = m.split("").map(
|
|
57
|
+
(u, C) => C === 0 ? u.toUpperCase() : u.toLowerCase()
|
|
58
|
+
).join("");
|
|
59
|
+
const w = l.assignedElements().length === 0;
|
|
60
|
+
a(this, d)[`is${m}Empty`] = w, this.updateContainerClasslist();
|
|
61
|
+
});
|
|
62
|
+
this.stylesheet = _, this.$render();
|
|
44
63
|
}
|
|
45
64
|
static get observedAttributes() {
|
|
46
65
|
return [...super.observedAttributes, "shadow", "header", "footer"];
|
|
@@ -50,10 +69,18 @@ class w extends m {
|
|
|
50
69
|
* @return {string} 属性值
|
|
51
70
|
*/
|
|
52
71
|
updateContainerClasslist() {
|
|
53
|
-
const t = this.computedClasslist(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
72
|
+
const t = this.computedClasslist(
|
|
73
|
+
"ea-card",
|
|
74
|
+
{
|
|
75
|
+
[`--${this.shadow}-shadow`]: this.shadow
|
|
76
|
+
},
|
|
77
|
+
// 因为在 vue 下,某些场景会出现 css 的 ::slotted 选择器无效,因此这里使用 js 来更新空状态
|
|
78
|
+
{
|
|
79
|
+
"header-empty": a(this, d).isHeaderEmpty,
|
|
80
|
+
"footer-empty": a(this, d).isFooterEmpty
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
return a(this, c).className = t, t;
|
|
57
84
|
}
|
|
58
85
|
$render() {
|
|
59
86
|
this.shadowRoot.innerHTML = `
|
|
@@ -68,18 +95,27 @@ class w extends m {
|
|
|
68
95
|
<slot name="footer"></slot>
|
|
69
96
|
</div>
|
|
70
97
|
</div>
|
|
71
|
-
`,
|
|
98
|
+
`, h(this, c, this.shadowRoot.querySelector(".ea-card")), h(this, i, this.shadowRoot.querySelector(
|
|
72
99
|
".ea-card__header > slot[name='header']"
|
|
73
|
-
)),
|
|
100
|
+
)), h(this, n, this.shadowRoot.querySelector(
|
|
74
101
|
".ea-card__footer > slot[name='footer']"
|
|
75
|
-
));
|
|
102
|
+
)), this.updateContainerClasslist();
|
|
76
103
|
}
|
|
77
104
|
connectedCallback() {
|
|
78
|
-
|
|
105
|
+
var t;
|
|
106
|
+
super.connectedCallback(), (t = a(this, r)) == null || t.abort(), h(this, r, new AbortController()), a(this, i).addEventListener("slotchange", a(this, p), {
|
|
107
|
+
signal: a(this, r).signal
|
|
108
|
+
}), a(this, n).addEventListener("slotchange", a(this, p), {
|
|
109
|
+
signal: a(this, r).signal
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
$beforeUnmounted() {
|
|
113
|
+
var t;
|
|
114
|
+
(t = a(this, r)) == null || t.abort();
|
|
79
115
|
}
|
|
80
116
|
}
|
|
81
|
-
|
|
82
|
-
window.customElements.get("ea-card") || window.customElements.define("ea-card",
|
|
117
|
+
c = new WeakMap(), i = new WeakMap(), n = new WeakMap(), r = new WeakMap(), d = new WeakMap(), p = new WeakMap();
|
|
118
|
+
window.customElements.get("ea-card") || window.customElements.define("ea-card", S);
|
|
83
119
|
export {
|
|
84
|
-
|
|
120
|
+
S as EaCard
|
|
85
121
|
};
|
|
@@ -299,10 +299,10 @@ class F extends N {
|
|
|
299
299
|
this.shadowRoot.innerHTML = `
|
|
300
300
|
<div class='ea-carousel' part='container'>
|
|
301
301
|
<button class="ea-carousel__arrow arrow-left" part="arrow-left">
|
|
302
|
-
<ea-icon
|
|
302
|
+
<ea-icon name="angle-left" part="arrow-left-icon"></ea-icon>
|
|
303
303
|
</button>
|
|
304
304
|
<button class="ea-carousel__arrow arrow-right" part="arrow-right">
|
|
305
|
-
<ea-icon
|
|
305
|
+
<ea-icon name="angle-right" part="arrow-right-icon"></ea-icon>
|
|
306
306
|
</button>
|
|
307
307
|
<ul class="ea-carousel__content" part="content">
|
|
308
308
|
<slot name="clone-last"></slot>
|
|
@@ -4,7 +4,7 @@ var x = (s) => {
|
|
|
4
4
|
};
|
|
5
5
|
var N = (s, i, t) => i in s ? k(s, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[i] = t;
|
|
6
6
|
var p = (s, i, t) => N(s, typeof i != "symbol" ? i + "" : i, t), R = (s, i, t) => i.has(s) || x("Cannot " + t);
|
|
7
|
-
var e = (s, i, t) => (R(s, i, "read from private field"), t ? t.call(s) : i.get(s)),
|
|
7
|
+
var e = (s, i, t) => (R(s, i, "read from private field"), t ? t.call(s) : i.get(s)), o = (s, i, t) => i.has(s) ? x("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, t), r = (s, i, t, a) => (R(s, i, "write to private field"), a ? a.call(s, t) : i.set(s, t), t);
|
|
8
8
|
import { B as $ } from "./Base.js";
|
|
9
9
|
import { s as B } from "../css/ea-collapse.style.js";
|
|
10
10
|
import { s as L } from "../css/ea-collapse-item.style.js";
|
|
@@ -13,9 +13,9 @@ class P extends $ {
|
|
|
13
13
|
constructor() {
|
|
14
14
|
super();
|
|
15
15
|
/** @type {HTMLElement} */
|
|
16
|
-
|
|
16
|
+
o(this, g);
|
|
17
17
|
/** @type {AbortController} */
|
|
18
|
-
|
|
18
|
+
o(this, c);
|
|
19
19
|
p(this, "state", this.properties({
|
|
20
20
|
accordion: {
|
|
21
21
|
type: Boolean,
|
|
@@ -38,8 +38,8 @@ class P extends $ {
|
|
|
38
38
|
type: ["left", "right"],
|
|
39
39
|
default: "right",
|
|
40
40
|
observer: (t) => {
|
|
41
|
-
this.querySelectorAll("ea-collapse-item").forEach((
|
|
42
|
-
|
|
41
|
+
this.querySelectorAll("ea-collapse-item").forEach((a) => {
|
|
42
|
+
a["expand-icon-position"] = t;
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -58,7 +58,7 @@ class P extends $ {
|
|
|
58
58
|
* 更新手风琴模式下的折叠状态
|
|
59
59
|
* @param {string} [activeName]
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
o(this, d, (t = this.active) => {
|
|
62
62
|
[...this.querySelectorAll("ea-collapse-item")].forEach(
|
|
63
63
|
(l) => l.toggleAttribute("active", l.getAttribute("name") === t)
|
|
64
64
|
);
|
|
@@ -67,7 +67,7 @@ class P extends $ {
|
|
|
67
67
|
* 更新普通模式下的折叠状态
|
|
68
68
|
* @param {string[]} [activeNames]
|
|
69
69
|
*/
|
|
70
|
-
|
|
70
|
+
o(this, y, (t = this.active) => {
|
|
71
71
|
[...this.querySelectorAll("ea-collapse-item")].forEach(
|
|
72
72
|
(l) => l.toggleAttribute(
|
|
73
73
|
"active",
|
|
@@ -79,20 +79,20 @@ class P extends $ {
|
|
|
79
79
|
* 折叠项点击事件处理
|
|
80
80
|
* @param {CustomEvent} e
|
|
81
81
|
*/
|
|
82
|
-
|
|
82
|
+
o(this, C, async (t) => {
|
|
83
83
|
t.preventDefault(), t.stopImmediatePropagation(), t.stopPropagation();
|
|
84
|
-
const { name:
|
|
84
|
+
const { name: a, el: l } = t.detail;
|
|
85
85
|
if (typeof this.beforeCollapse == "function")
|
|
86
86
|
try {
|
|
87
|
-
if (!await this.beforeCollapse({ name:
|
|
87
|
+
if (!await this.beforeCollapse({ name: a, el: l })) return;
|
|
88
88
|
} catch {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
if (this.accordion)
|
|
92
|
-
e(this, d).call(this,
|
|
92
|
+
e(this, d).call(this, a), this.active = a;
|
|
93
93
|
else
|
|
94
94
|
try {
|
|
95
|
-
this.active.includes(
|
|
95
|
+
this.active.includes(a) ? (this.active = this.active.filter((q) => q !== a), l.toggleAttribute("active", !1)) : (this.active = [...this.active, a], l.toggleAttribute("active", this.active.includes(a)));
|
|
96
96
|
} catch {
|
|
97
97
|
console.error(
|
|
98
98
|
`${this.tagName}: When 'accordion' is false, 'active' should be an Array type.`,
|
|
@@ -101,7 +101,7 @@ class P extends $ {
|
|
|
101
101
|
}
|
|
102
102
|
this.emit("change", {
|
|
103
103
|
detail: {
|
|
104
|
-
name:
|
|
104
|
+
name: a,
|
|
105
105
|
target: l,
|
|
106
106
|
active: this.active
|
|
107
107
|
},
|
|
@@ -111,9 +111,9 @@ class P extends $ {
|
|
|
111
111
|
/**
|
|
112
112
|
* 初始化折叠项的唯一标识及折叠状态
|
|
113
113
|
*/
|
|
114
|
-
|
|
115
|
-
[...this.querySelectorAll("ea-collapse-item")].forEach((
|
|
116
|
-
|
|
114
|
+
o(this, w, () => {
|
|
115
|
+
[...this.querySelectorAll("ea-collapse-item")].forEach((a, l) => {
|
|
116
|
+
a.getAttribute("name") || a.setAttribute("name", l);
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
119
|
/**
|
|
@@ -153,21 +153,21 @@ class H extends $ {
|
|
|
153
153
|
constructor() {
|
|
154
154
|
super();
|
|
155
155
|
/** @type {HTMLElement} */
|
|
156
|
-
|
|
156
|
+
o(this, h);
|
|
157
157
|
/** @type {HTMLElement} */
|
|
158
|
-
|
|
158
|
+
o(this, u);
|
|
159
159
|
/** @type {HTMLElement} */
|
|
160
|
-
|
|
160
|
+
o(this, A);
|
|
161
161
|
/** @type {HTMLSlotElement} */
|
|
162
|
-
|
|
162
|
+
o(this, m);
|
|
163
163
|
/** @type {HTMLElement} */
|
|
164
|
-
|
|
164
|
+
o(this, S);
|
|
165
165
|
/** @type {HTMLElement} */
|
|
166
|
-
|
|
166
|
+
o(this, b);
|
|
167
167
|
/** @type {HTMLSlotElement} */
|
|
168
|
-
|
|
168
|
+
o(this, v);
|
|
169
169
|
/** @type {AbortController} */
|
|
170
|
-
|
|
170
|
+
o(this, n);
|
|
171
171
|
p(this, "state", this.properties({
|
|
172
172
|
title: {
|
|
173
173
|
type: String,
|
|
@@ -208,7 +208,7 @@ class H extends $ {
|
|
|
208
208
|
* 更新折叠面板高度
|
|
209
209
|
* @param {boolean} isActive
|
|
210
210
|
*/
|
|
211
|
-
|
|
211
|
+
o(this, f, (t = this.active) => {
|
|
212
212
|
queueMicrotask(() => {
|
|
213
213
|
e(this, h).style.setProperty(
|
|
214
214
|
"--ea-collapse-item-content-height",
|
|
@@ -220,7 +220,7 @@ class H extends $ {
|
|
|
220
220
|
* 折叠面板 展开/收起 事件处理
|
|
221
221
|
* @param {Event} e
|
|
222
222
|
*/
|
|
223
|
-
|
|
223
|
+
o(this, _, (t) => {
|
|
224
224
|
t.preventDefault(), t.stopImmediatePropagation(), !this.disabled && this.emit("collapse-item-click", {
|
|
225
225
|
detail: {
|
|
226
226
|
name: this.name,
|
|
@@ -233,7 +233,7 @@ class H extends $ {
|
|
|
233
233
|
/**
|
|
234
234
|
* 插槽变化事件处理
|
|
235
235
|
*/
|
|
236
|
-
|
|
236
|
+
o(this, E, () => {
|
|
237
237
|
e(this, h).style.setProperty(
|
|
238
238
|
"--ea-collapse-item-content-height",
|
|
239
239
|
"auto"
|
|
@@ -276,7 +276,7 @@ class H extends $ {
|
|
|
276
276
|
</span>
|
|
277
277
|
<span class="ea-collapse-item__indicator" part="indicator">
|
|
278
278
|
<slot name="icon">
|
|
279
|
-
<ea-icon class="default-expand-icon"
|
|
279
|
+
<ea-icon class="default-expand-icon" name="angle-down" part="icon"></ea-icon>
|
|
280
280
|
</slot>
|
|
281
281
|
</span>
|
|
282
282
|
</div>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var
|
|
1
|
+
var xt = Object.defineProperty;
|
|
2
2
|
var ot = (h) => {
|
|
3
3
|
throw TypeError(h);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var T = (h, n, e) =>
|
|
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
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
|
|
8
|
+
import { F as kt } from "../core/FormBase.js";
|
|
9
9
|
import { n as rt } from "./ea-calendar2.js";
|
|
10
10
|
import { C as F } from "../utils/Color.js";
|
|
11
|
-
import { s as
|
|
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
14
|
import { s as Pt } from "../css/ea-color-picker-panel.style.js";
|
|
@@ -33,7 +33,7 @@ class qt extends Event {
|
|
|
33
33
|
}), this.detail = n;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
var W, A, m, P,
|
|
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();
|
|
@@ -47,13 +47,13 @@ class Lt extends At {
|
|
|
47
47
|
/** @type {HTMLDivElement} */
|
|
48
48
|
l(this, P);
|
|
49
49
|
/** @type {HTMLDivElement} */
|
|
50
|
-
l(this,
|
|
50
|
+
l(this, k);
|
|
51
51
|
/** @type {HTMLDivElement} */
|
|
52
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} */
|
|
@@ -215,9 +215,9 @@ class Lt extends At {
|
|
|
215
215
|
</div>
|
|
216
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
217
|
e.ce("svpanel-cursor")
|
|
218
|
-
)), d(this, P, this.shadowRoot.querySelector(e.ce("hue-slider"))), 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(
|
|
219
219
|
e.ce("alpha-slider-bar")
|
|
220
|
-
)), d(this,
|
|
220
|
+
)), d(this, M, this.shadowRoot.querySelector(
|
|
221
221
|
e.ce("alpha-slider-thumb")
|
|
222
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
223
|
}
|
|
@@ -233,10 +233,10 @@ class Lt extends At {
|
|
|
233
233
|
* 重置光标和滑块位置到初始状态
|
|
234
234
|
*/
|
|
235
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,
|
|
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);
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
W = new WeakMap(), A = new WeakMap(), m = new WeakMap(), P = 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(), /**
|
|
240
240
|
* 绑定组件事件监听器
|
|
241
241
|
*/
|
|
242
242
|
lt = function() {
|
|
@@ -250,13 +250,13 @@ lt = function() {
|
|
|
250
250
|
signal: t(this, y).signal
|
|
251
251
|
}), t(this, R).addEventListener(
|
|
252
252
|
"mousedown",
|
|
253
|
-
a(this, o,
|
|
253
|
+
a(this, o, ut).bind(this),
|
|
254
254
|
{
|
|
255
255
|
signal: t(this, y).signal
|
|
256
256
|
}
|
|
257
257
|
), t(this, g).addEventListener(
|
|
258
258
|
"change",
|
|
259
|
-
a(this, o,
|
|
259
|
+
a(this, o, ct).bind(this),
|
|
260
260
|
{
|
|
261
261
|
signal: t(this, y).signal
|
|
262
262
|
}
|
|
@@ -278,11 +278,11 @@ lt = function() {
|
|
|
278
278
|
* @param {MouseEvent} e - 鼠标事件对象
|
|
279
279
|
*/
|
|
280
280
|
ht = function(e) {
|
|
281
|
-
var
|
|
282
|
-
if ((
|
|
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;
|
|
283
283
|
e.preventDefault(), t(this, v).saturationMove = new AbortController(), t(this, s).isDragging = !0;
|
|
284
|
-
const i = (
|
|
285
|
-
const p = t(this, A).getBoundingClientRect(),
|
|
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
286
|
t(this, s).saturation = V, t(this, s).value = Q, t(this, s).color.setValue({
|
|
287
287
|
h: t(this, s).hue,
|
|
288
288
|
s: V,
|
|
@@ -295,8 +295,8 @@ ht = function(e) {
|
|
|
295
295
|
}), window.addEventListener(
|
|
296
296
|
"mouseup",
|
|
297
297
|
() => {
|
|
298
|
-
var
|
|
299
|
-
(
|
|
298
|
+
var c;
|
|
299
|
+
(c = t(this, v).saturationMove) == null || c.abort(), t(this, s).isDragging = !1;
|
|
300
300
|
},
|
|
301
301
|
{
|
|
302
302
|
signal: t(this, v).saturationMove.signal
|
|
@@ -307,25 +307,25 @@ ht = function(e) {
|
|
|
307
307
|
* @param {MouseEvent} e - 鼠标事件对象
|
|
308
308
|
*/
|
|
309
309
|
nt = function(e) {
|
|
310
|
-
var
|
|
311
|
-
if ((
|
|
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;
|
|
312
312
|
e.preventDefault(), t(this, v).hueMove = new AbortController(), t(this, s).isDragging = !0;
|
|
313
|
-
const i = (
|
|
314
|
-
const p = t(this, P).getBoundingClientRect(),
|
|
315
|
-
t(this, s).hue =
|
|
316
|
-
h:
|
|
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;
|
|
315
|
+
t(this, s).hue = E, t(this, s).color.setValue({
|
|
316
|
+
h: E,
|
|
317
317
|
s: t(this, s).saturation,
|
|
318
318
|
v: t(this, s).value,
|
|
319
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,
|
|
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);
|
|
321
321
|
};
|
|
322
322
|
i(e), window.addEventListener("mousemove", i, {
|
|
323
323
|
signal: t(this, v).hueMove.signal
|
|
324
324
|
}), window.addEventListener(
|
|
325
325
|
"mouseup",
|
|
326
326
|
() => {
|
|
327
|
-
var
|
|
328
|
-
(
|
|
327
|
+
var c;
|
|
328
|
+
(c = t(this, v).hueMove) == null || c.abort(), t(this, s).isDragging = !1;
|
|
329
329
|
},
|
|
330
330
|
{
|
|
331
331
|
signal: t(this, v).hueMove.signal
|
|
@@ -335,18 +335,18 @@ nt = function(e) {
|
|
|
335
335
|
* 处理透明度的更新
|
|
336
336
|
* @param {MouseEvent} e - 鼠标事件对象
|
|
337
337
|
*/
|
|
338
|
-
|
|
339
|
-
var
|
|
340
|
-
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;
|
|
341
341
|
e.preventDefault(), t(this, v).alphaMove = new AbortController(), t(this, s).isDragging = !0;
|
|
342
342
|
const i = (p) => {
|
|
343
|
-
const
|
|
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
344
|
Math.abs(t(this, s).alpha - V) > 1e-3 && (t(this, s).alpha = V, t(this, s).color.setValue({
|
|
345
345
|
h: t(this, s).hue,
|
|
346
346
|
s: t(this, s).saturation,
|
|
347
347
|
v: t(this, s).value,
|
|
348
348
|
a: V
|
|
349
|
-
}), this.value = t(this, s).color.toString(this["color-format"]), a(this, o, H).call(this), t(this,
|
|
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");
|
|
350
350
|
};
|
|
351
351
|
i(e), window.addEventListener("mousemove", i, {
|
|
352
352
|
signal: t(this, v).alphaMove.signal
|
|
@@ -370,52 +370,52 @@ et = function() {
|
|
|
370
370
|
t(this, s).color.toHsv(!0)
|
|
371
371
|
);
|
|
372
372
|
if (e) {
|
|
373
|
-
const i = parseInt(e.h),
|
|
374
|
-
t(this, s).hue = i, t(this, s).saturation =
|
|
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;
|
|
375
375
|
}
|
|
376
376
|
t(this, s).isFirstValueUpdate = !0;
|
|
377
377
|
}
|
|
378
378
|
if (t(this, m) && t(this, A)) {
|
|
379
|
-
const e = t(this, s).saturation, i = t(this, s).value,
|
|
379
|
+
const e = t(this, s).saturation, i = t(this, s).value, u = t(this, A).getBoundingClientRect(), b = G.CSS.px2num(
|
|
380
380
|
this.style.getPropertyValue("--ea-color-picker-panel-svpanel-width")
|
|
381
|
-
) || 280,
|
|
381
|
+
) || 280, c = G.CSS.px2num(
|
|
382
382
|
this.style.getPropertyValue("--ea-color-picker-panel-svpanel-height")
|
|
383
383
|
) || 180, p = Math.max(
|
|
384
384
|
0,
|
|
385
|
-
Math.min(
|
|
385
|
+
Math.min(u.width, b),
|
|
386
386
|
b
|
|
387
|
-
),
|
|
387
|
+
), x = Math.max(
|
|
388
388
|
0,
|
|
389
|
-
Math.min(
|
|
390
|
-
|
|
391
|
-
),
|
|
392
|
-
t(this, m).style.left =
|
|
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";
|
|
393
393
|
}
|
|
394
|
-
if (t(this,
|
|
395
|
-
const e = t(this, s).hue, i = t(this, P).getBoundingClientRect(),
|
|
394
|
+
if (t(this, k) && t(this, P)) {
|
|
395
|
+
const e = t(this, s).hue, i = t(this, P).getBoundingClientRect(), u = G.CSS.px2num(
|
|
396
396
|
this.style.getPropertyValue(
|
|
397
397
|
"--ea-color-picker-panel-hue-slider-height"
|
|
398
398
|
)
|
|
399
|
-
) || 180, b = Math.max(0, Math.min(i.height,
|
|
400
|
-
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";
|
|
401
401
|
}
|
|
402
|
-
if (t(this,
|
|
403
|
-
const e = t(this, s).alpha, i = t(this, R).getBoundingClientRect(),
|
|
402
|
+
if (t(this, M) && t(this, R)) {
|
|
403
|
+
const e = t(this, s).alpha, i = t(this, R).getBoundingClientRect(), u = G.CSS.px2num(
|
|
404
404
|
this.style.getPropertyValue(
|
|
405
405
|
"--ea-color-picker-panel-alpha-slider-width"
|
|
406
406
|
)
|
|
407
|
-
) || 280, b = Math.max(0, Math.min(i.width,
|
|
408
|
-
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";
|
|
409
409
|
}
|
|
410
410
|
}, D = new WeakMap(), /**
|
|
411
411
|
* 处理颜色输入框变化事件
|
|
412
412
|
* @param {Event} e - 事件对象
|
|
413
413
|
*/
|
|
414
|
-
|
|
414
|
+
ct = function(e) {
|
|
415
415
|
const i = e.target.value;
|
|
416
416
|
try {
|
|
417
|
-
const
|
|
418
|
-
this.value =
|
|
417
|
+
const u = new F(i);
|
|
418
|
+
this.value = u.toString(this["color-format"]), a(this, o, H).call(this);
|
|
419
419
|
} catch {
|
|
420
420
|
t(this, g).value = this.value;
|
|
421
421
|
}
|
|
@@ -459,8 +459,8 @@ pt = function(e) {
|
|
|
459
459
|
if (this.disabled) return;
|
|
460
460
|
const i = e.target.closest(this.ns.ce("predefine-color"));
|
|
461
461
|
if (!i) return;
|
|
462
|
-
const
|
|
463
|
-
|
|
462
|
+
const u = i.getAttribute("data-color");
|
|
463
|
+
u && a(this, o, st).call(this, u);
|
|
464
464
|
}, /**
|
|
465
465
|
* 根据颜色值更新所有相关状态
|
|
466
466
|
* @param {string} colorValue - 颜色值字符串
|
|
@@ -471,8 +471,8 @@ st = function(e) {
|
|
|
471
471
|
t(this, s).color.toHsv(!0)
|
|
472
472
|
);
|
|
473
473
|
if (i) {
|
|
474
|
-
const
|
|
475
|
-
t(this, s).hue =
|
|
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;
|
|
476
476
|
}
|
|
477
477
|
a(this, o, et).call(this), t(this, D).call(this), a(this, o, H).call(this);
|
|
478
478
|
}, /**
|
|
@@ -514,7 +514,7 @@ class Bt extends Event {
|
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
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
|
|
517
|
+
class Dt extends kt {
|
|
518
518
|
constructor() {
|
|
519
519
|
super();
|
|
520
520
|
l(this, r);
|
|
@@ -645,7 +645,7 @@ class Dt extends Mt {
|
|
|
645
645
|
}
|
|
646
646
|
}
|
|
647
647
|
}));
|
|
648
|
-
this.stylesheet =
|
|
648
|
+
this.stylesheet = Mt, this.$render();
|
|
649
649
|
}
|
|
650
650
|
static get observedAttributes() {
|
|
651
651
|
return [
|
|
@@ -678,7 +678,7 @@ class Dt extends Mt {
|
|
|
678
678
|
<div class="${e.e("inner")}" part="inner"></div>
|
|
679
679
|
</div>
|
|
680
680
|
<div class="${e.e("icon-wrapper")}" part="icon-wrapper">
|
|
681
|
-
<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>
|
|
682
682
|
</div>
|
|
683
683
|
</div>
|
|
684
684
|
<ea-color-picker-panel class="${e.e("panel")}" part="panel">
|
|
@@ -865,10 +865,7 @@ z = function() {
|
|
|
865
865
|
* @param {string} colorValue - 颜色值
|
|
866
866
|
*/
|
|
867
867
|
j = function(e = this.value) {
|
|
868
|
-
t(this, U) && t(this, U).setAttribute(
|
|
869
|
-
"icon",
|
|
870
|
-
e ? "icon-angle-down" : "icon-cancel"
|
|
871
|
-
);
|
|
868
|
+
t(this, U) && t(this, U).setAttribute("name", e ? "angle-down" : "xmark");
|
|
872
869
|
}, /**
|
|
873
870
|
* 处理清除按钮点击事件
|
|
874
871
|
*/
|