easy-component-ui 3.0.13 → 3.0.15
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/components/Base.js +380 -313
- package/dist/components/ea-calendar2.js +159 -159
- package/dist/components/ea-icon.js +37 -36
- package/dist/components/ea-input.js +13 -13
- package/dist/components/ea-message.js +0 -1
- package/dist/components/ea-table.js +29 -27
- package/dist/components/ea-tabs.js +16 -14
- package/dist/core/FormBase.js +17 -17
- package/package.json +8 -2
|
@@ -13,7 +13,7 @@ class U extends Event {
|
|
|
13
13
|
super("ea-clear", { bubbles: !0, cancelable: !0, composed: !0 }), this.detail = o;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
var g, C, _, w,
|
|
16
|
+
var g, C, _, w, m, i, R, b, y, p, x, S, v, u, l, d, r, P, O, E, A, q, z, L, H, f;
|
|
17
17
|
class G extends I {
|
|
18
18
|
constructor() {
|
|
19
19
|
super();
|
|
@@ -26,7 +26,7 @@ class G extends I {
|
|
|
26
26
|
/** @type {HTMLElement} */
|
|
27
27
|
a(this, w);
|
|
28
28
|
/** @type {HTMLElement} */
|
|
29
|
-
a(this,
|
|
29
|
+
a(this, m);
|
|
30
30
|
/** @type {HTMLInputElement | HTMLTextAreaElement} */
|
|
31
31
|
a(this, i);
|
|
32
32
|
/** @type {HTMLElement} */
|
|
@@ -34,7 +34,7 @@ class G extends I {
|
|
|
34
34
|
/** @type {HTMLElement} */
|
|
35
35
|
a(this, b);
|
|
36
36
|
/** @type {HTMLElement} */
|
|
37
|
-
a(this,
|
|
37
|
+
a(this, y);
|
|
38
38
|
/** @type {HTMLElement} */
|
|
39
39
|
a(this, p);
|
|
40
40
|
/** @type {HTMLElement} */
|
|
@@ -137,16 +137,16 @@ class G extends I {
|
|
|
137
137
|
},
|
|
138
138
|
maxlength: {
|
|
139
139
|
type: Number,
|
|
140
|
-
default: 0,
|
|
140
|
+
default: void 0,
|
|
141
141
|
observer: async (t) => {
|
|
142
|
-
await e(this, r).isOriginalRenderedPromise, e(this, i).maxLength = t;
|
|
142
|
+
await e(this, r).isOriginalRenderedPromise, this.hasAttribute("maxlength") && (e(this, i).maxLength = t);
|
|
143
143
|
}
|
|
144
144
|
},
|
|
145
145
|
minlength: {
|
|
146
146
|
type: Number,
|
|
147
|
-
default: 0,
|
|
147
|
+
default: void 0,
|
|
148
148
|
observer: async (t) => {
|
|
149
|
-
await e(this, r).isOriginalRenderedPromise, e(this, i).minLength = t;
|
|
149
|
+
await e(this, r).isOriginalRenderedPromise, this.hasAttribute("minlength") && (e(this, i).minLength = t);
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
clearable: {
|
|
@@ -154,7 +154,7 @@ class G extends I {
|
|
|
154
154
|
default: !1,
|
|
155
155
|
observer: (t) => {
|
|
156
156
|
var s;
|
|
157
|
-
(s = e(this, l).clearableController) == null || s.abort(), this.updateContainerClasslist(), t && (e(this, l).clearableController = new AbortController(), e(this,
|
|
157
|
+
(s = e(this, l).clearableController) == null || s.abort(), this.updateContainerClasslist(), t && (e(this, l).clearableController = new AbortController(), e(this, y).addEventListener(
|
|
158
158
|
"click",
|
|
159
159
|
e(this, z),
|
|
160
160
|
{
|
|
@@ -167,7 +167,7 @@ class G extends I {
|
|
|
167
167
|
type: String,
|
|
168
168
|
default: "xmark",
|
|
169
169
|
observer: (t) => {
|
|
170
|
-
this.clearable && e(this,
|
|
170
|
+
this.clearable && e(this, y).setAttribute("name", t);
|
|
171
171
|
}
|
|
172
172
|
},
|
|
173
173
|
disabled: {
|
|
@@ -349,7 +349,7 @@ class G extends I {
|
|
|
349
349
|
*/
|
|
350
350
|
a(this, P, (t) => {
|
|
351
351
|
const s = this.id || Math.random().toString(36).substring(2, 7), c = t === "textarea" ? `<textarea id="${s}" class="ea-input__original" part="original"></textarea>` : `<input id="${s}" class="ea-input__original" type="${t}" part="original" />`;
|
|
352
|
-
e(this,
|
|
352
|
+
e(this, m).innerHTML = c, h(this, i, e(this, m).querySelector(".ea-input__original")), e(this, i).value = this.value, e(this, d).isOriginalRendered = !0;
|
|
353
353
|
});
|
|
354
354
|
/**
|
|
355
355
|
* 输入框内容发生改变时触发
|
|
@@ -510,9 +510,9 @@ class G extends I {
|
|
|
510
510
|
</div>
|
|
511
511
|
`, h(this, g, this.shadowRoot.querySelector(".ea-input")), h(this, v, this.shadowRoot.querySelector(".ea-input__form-label")), h(this, C, this.shadowRoot.querySelector(".ea-input__prepend")), h(this, _, this.shadowRoot.querySelector(".ea-input__inner")), h(this, w, this.shadowRoot.querySelector(
|
|
512
512
|
".ea-input__prefix slot[name='prefix']"
|
|
513
|
-
)), h(this,
|
|
513
|
+
)), h(this, m, this.shadowRoot.querySelector(
|
|
514
514
|
".ea-input__original-wrapper"
|
|
515
|
-
)), h(this, R, this.shadowRoot.querySelector(".ea-input__suffix")), h(this, b, this.shadowRoot.querySelector(".ea-input__suffix-icon")), h(this,
|
|
515
|
+
)), h(this, R, this.shadowRoot.querySelector(".ea-input__suffix")), h(this, b, this.shadowRoot.querySelector(".ea-input__suffix-icon")), h(this, y, this.shadowRoot.querySelector(".ea-input__clear-icon")), h(this, p, this.shadowRoot.querySelector(
|
|
516
516
|
".ea-input__show-password-icon"
|
|
517
517
|
)), h(this, x, this.shadowRoot.querySelector(".ea-input__word-count")), h(this, S, this.shadowRoot.querySelector(".ea-input__append"));
|
|
518
518
|
}
|
|
@@ -581,7 +581,7 @@ class G extends I {
|
|
|
581
581
|
return this.updateValidity(), this.internals.reportValidity();
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
|
-
g = new WeakMap(), C = new WeakMap(), _ = new WeakMap(), w = new WeakMap(),
|
|
584
|
+
g = new WeakMap(), C = new WeakMap(), _ = new WeakMap(), w = new WeakMap(), m = new WeakMap(), i = new WeakMap(), R = new WeakMap(), b = new WeakMap(), y = new WeakMap(), p = new WeakMap(), x = new WeakMap(), S = new WeakMap(), v = new WeakMap(), u = new WeakMap(), l = new WeakMap(), d = new WeakMap(), r = new WeakMap(), P = new WeakMap(), O = new WeakMap(), E = new WeakMap(), A = new WeakMap(), q = new WeakMap(), z = new WeakMap(), L = new WeakMap(), H = new WeakMap(), f = new WeakMap();
|
|
585
585
|
window.customElements.get("ea-input") || window.customElements.define("ea-input", G);
|
|
586
586
|
export {
|
|
587
587
|
G as EaInput
|
|
@@ -190,7 +190,7 @@ class Nt extends Event {
|
|
|
190
190
|
super("ea-template-cell-click", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
var f, T, w, H, I, F, g, k, h, B, K,
|
|
193
|
+
var f, T, w, H, I, F, g, k, h, B, K, $, P, W, j, U, M, z, L, G, J, O, Q, V, X, Y, Z, tt, et;
|
|
194
194
|
class Ht extends rt {
|
|
195
195
|
constructor() {
|
|
196
196
|
super();
|
|
@@ -384,17 +384,19 @@ class Ht extends rt {
|
|
|
384
384
|
for (const a in e(this, k))
|
|
385
385
|
(u = e(this, k)[a]) == null || u.abort(), e(this, k)[a] = new AbortController();
|
|
386
386
|
if (e(this, h).isDataRendered = !1, e(this, w).innerHTML = "", e(this, h).dataSource = /* @__PURE__ */ new WeakMap(), e(this, h).originData = t, l.forEach((a) => {
|
|
387
|
-
var
|
|
387
|
+
var A;
|
|
388
388
|
const b = n, { template: m } = a, d = document.createElement("td");
|
|
389
|
-
|
|
389
|
+
d.part = "tbody-td", d.className = "ea-table__td";
|
|
390
|
+
const v = a.fixed && a.fixed !== "false";
|
|
391
|
+
if (d.classList.toggle("is-fixed", v), d.classList.toggle(`fixed-${a.fixed}`, v), d.classList.toggle(
|
|
390
392
|
`ea-table__cell--align-${a.align}`,
|
|
391
393
|
a.align
|
|
392
394
|
), a.width && d.style.setProperty("--ea-table-cell-width", a.width), m) {
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
+
const D = m.content.cloneNode(!0);
|
|
396
|
+
D.querySelectorAll("*").forEach((nt) => {
|
|
395
397
|
nt.setAttribute("data-template-cell", "");
|
|
396
|
-
}), d.appendChild(
|
|
397
|
-
} else a.type ? d.innerHTML = (
|
|
398
|
+
}), d.appendChild(D);
|
|
399
|
+
} else a.type ? d.innerHTML = (A = c[a.type]) == null ? void 0 : A.call(c) : d.setAttribute("data-scope", a.prop);
|
|
398
400
|
b.appendChild(d);
|
|
399
401
|
}), t.forEach((a, b) => {
|
|
400
402
|
const m = n.cloneNode(!0);
|
|
@@ -409,7 +411,7 @@ class Ht extends rt {
|
|
|
409
411
|
d.textContent = this.indexMethod(b);
|
|
410
412
|
}
|
|
411
413
|
m.querySelectorAll("[data-scope]").forEach((d) => {
|
|
412
|
-
const v = d.getAttribute("data-scope"), A = l.find((
|
|
414
|
+
const v = d.getAttribute("data-scope"), A = l.find((D) => D.prop === v);
|
|
413
415
|
A ? d.textContent = a[A.prop] : v in a && (d.textContent = a[v]);
|
|
414
416
|
}), s.appendChild(m), e(this, h).dataSource.set(m, a), a && typeof a == "object" && e(this, h).dataIndex.set(a, m);
|
|
415
417
|
}), this["show-summary"] && typeof this.summaryMethod == "function") {
|
|
@@ -482,7 +484,7 @@ class Ht extends rt {
|
|
|
482
484
|
const i = e(this, h).dataIndex.get(t);
|
|
483
485
|
if (!i) return;
|
|
484
486
|
const c = `ea-checkbox[data-type="selection"]${n ? "" : ":not([disabled])"}`, u = i.querySelector(c);
|
|
485
|
-
u && (s ? u.toggleAttribute("checked", s) : u.toggleAttribute("checked", !u.checked), e(this, P).call(this), e(this,
|
|
487
|
+
u && (s ? u.toggleAttribute("checked", s) : u.toggleAttribute("checked", !u.checked), e(this, P).call(this), e(this, M).call(this));
|
|
486
488
|
});
|
|
487
489
|
/**
|
|
488
490
|
* 清空选择
|
|
@@ -492,13 +494,13 @@ class Ht extends rt {
|
|
|
492
494
|
...e(this, f).querySelectorAll('ea-checkbox[data-type="selection"]')
|
|
493
495
|
].forEach((s) => {
|
|
494
496
|
s.removeAttribute("checked"), s.removeAttribute("indeterminate");
|
|
495
|
-
}), e(this,
|
|
497
|
+
}), e(this, M).call(this);
|
|
496
498
|
});
|
|
497
499
|
/**
|
|
498
500
|
* 获取当前选中的行
|
|
499
501
|
* @returns {any[]}
|
|
500
502
|
*/
|
|
501
|
-
p(this,
|
|
503
|
+
p(this, $, () => [
|
|
502
504
|
...e(this, w).querySelectorAll(
|
|
503
505
|
'ea-checkbox[data-type="selection"][checked]'
|
|
504
506
|
)
|
|
@@ -534,8 +536,8 @@ class Ht extends rt {
|
|
|
534
536
|
const m = [];
|
|
535
537
|
for (let d = 0; d < a.length; d += b.length)
|
|
536
538
|
m.push(a.slice(d, d + b.length));
|
|
537
|
-
return m.reduce((d, v) => (v.forEach((A,
|
|
538
|
-
d[
|
|
539
|
+
return m.reduce((d, v) => (v.forEach((A, D) => {
|
|
540
|
+
d[D] = [...d[D], A];
|
|
539
541
|
}), d), Array(b.length).fill([]));
|
|
540
542
|
}, i = (a) => {
|
|
541
543
|
if (!a.length) return;
|
|
@@ -577,8 +579,8 @@ class Ht extends rt {
|
|
|
577
579
|
/**
|
|
578
580
|
* 派发选择改变事件
|
|
579
581
|
*/
|
|
580
|
-
p(this,
|
|
581
|
-
const t = e(this,
|
|
582
|
+
p(this, M, () => {
|
|
583
|
+
const t = e(this, $).call(this);
|
|
582
584
|
this.dispatchEvent(
|
|
583
585
|
new gt({
|
|
584
586
|
newSelection: t
|
|
@@ -811,17 +813,17 @@ class Ht extends rt {
|
|
|
811
813
|
t.target.toggleAttribute("checked", t.target.hasAttribute("checked")), l.forEach((c) => {
|
|
812
814
|
c.hasAttribute("disabled") || c.toggleAttribute("checked", s);
|
|
813
815
|
});
|
|
814
|
-
const i = e(this,
|
|
816
|
+
const i = e(this, $).call(this);
|
|
815
817
|
this.dispatchEvent(new mt({ selection: i }));
|
|
816
818
|
} else {
|
|
817
|
-
const l = e(this,
|
|
819
|
+
const l = e(this, $).call(this), i = e(this, h).dataSource.get(
|
|
818
820
|
t.target.closest('.ea-table__tr[part="tbody-tr"]')
|
|
819
821
|
);
|
|
820
822
|
e(this, P).call(this), this.dispatchEvent(
|
|
821
823
|
new ft({ selection: l, row: i })
|
|
822
824
|
);
|
|
823
825
|
}
|
|
824
|
-
e(this,
|
|
826
|
+
e(this, M).call(this);
|
|
825
827
|
});
|
|
826
828
|
this.stylesheet = ht, this.shadowRoot.innerHTML = this.html(`
|
|
827
829
|
<slot id='defaultSlot' part='default-slot'></slot>
|
|
@@ -922,9 +924,9 @@ class Ht extends rt {
|
|
|
922
924
|
e(this, h)[s] = null;
|
|
923
925
|
}
|
|
924
926
|
}
|
|
925
|
-
f = new WeakMap(), T = new WeakMap(), w = new WeakMap(), H = new WeakMap(), I = new WeakMap(), F = new WeakMap(), g = new WeakMap(), k = new WeakMap(), h = new WeakMap(), B = new WeakMap(), K = new WeakMap(),
|
|
927
|
+
f = new WeakMap(), T = new WeakMap(), w = new WeakMap(), H = new WeakMap(), I = new WeakMap(), F = new WeakMap(), g = new WeakMap(), k = new WeakMap(), h = new WeakMap(), B = new WeakMap(), K = new WeakMap(), $ = new WeakMap(), P = new WeakMap(), W = new WeakMap(), j = new WeakMap(), U = new WeakMap(), M = new WeakMap(), z = new WeakMap(), L = new WeakMap(), G = new WeakMap(), J = new WeakMap(), O = new WeakMap(), Q = new WeakMap(), V = new WeakMap(), X = new WeakMap(), Y = new WeakMap(), Z = new WeakMap(), tt = new WeakMap(), et = new WeakMap();
|
|
926
928
|
window.customElements.get("ea-table") || window.customElements.define("ea-table", Ht);
|
|
927
|
-
var R, q,
|
|
929
|
+
var R, q, N, st, y, _, lt;
|
|
928
930
|
class It extends rt {
|
|
929
931
|
constructor() {
|
|
930
932
|
super();
|
|
@@ -987,9 +989,9 @@ class It extends rt {
|
|
|
987
989
|
fixed: {
|
|
988
990
|
type: ["left", "right", "false"],
|
|
989
991
|
default: () => {
|
|
990
|
-
if (!this.hasAttribute("fixed")) return
|
|
992
|
+
if (!this.hasAttribute("fixed")) return "false";
|
|
991
993
|
const t = this.getAttribute("fixed");
|
|
992
|
-
return t === "false" || t === "null"
|
|
994
|
+
return t === "false" || t === "null" ? "false" : t === "" ? "left" : t || "left";
|
|
993
995
|
},
|
|
994
996
|
observer: () => {
|
|
995
997
|
S(this, y, _).call(this);
|
|
@@ -1034,12 +1036,12 @@ class It extends rt {
|
|
|
1034
1036
|
prop: this.prop,
|
|
1035
1037
|
type: this.type,
|
|
1036
1038
|
colspan: this.colspan,
|
|
1037
|
-
rowspan: c ? 1 : e(this, st).call(this, t) - e(this,
|
|
1039
|
+
rowspan: c ? 1 : e(this, st).call(this, t) - e(this, N).call(this, this, t) + 1,
|
|
1038
1040
|
align: this.align,
|
|
1039
1041
|
width: this.width,
|
|
1040
1042
|
sortable: this.sortable,
|
|
1041
1043
|
fixed: this.fixed,
|
|
1042
|
-
depth: e(this,
|
|
1044
|
+
depth: e(this, N).call(this, this, t),
|
|
1043
1045
|
props: [...this.attributes].filter(
|
|
1044
1046
|
(u) => !i.includes(u.name)
|
|
1045
1047
|
),
|
|
@@ -1058,7 +1060,7 @@ class It extends rt {
|
|
|
1058
1060
|
* @param {import("../ea-table/index.js").EaTable} root
|
|
1059
1061
|
* @returns {number}
|
|
1060
1062
|
*/
|
|
1061
|
-
p(this,
|
|
1063
|
+
p(this, N, (t, s) => {
|
|
1062
1064
|
let n = 0;
|
|
1063
1065
|
for (; t !== s; )
|
|
1064
1066
|
t = t.parentElement, n++;
|
|
@@ -1072,7 +1074,7 @@ class It extends rt {
|
|
|
1072
1074
|
p(this, st, (t) => {
|
|
1073
1075
|
let s = 0;
|
|
1074
1076
|
return t.querySelectorAll("ea-table-column").forEach((n) => {
|
|
1075
|
-
s = Math.max(s, e(this,
|
|
1077
|
+
s = Math.max(s, e(this, N).call(this, n, t));
|
|
1076
1078
|
}), s;
|
|
1077
1079
|
});
|
|
1078
1080
|
this.stylesheet = dt, this.$render();
|
|
@@ -1108,7 +1110,7 @@ class It extends rt {
|
|
|
1108
1110
|
e(this, q) && (e(this, q).disconnect(), C(this, q, null));
|
|
1109
1111
|
}
|
|
1110
1112
|
}
|
|
1111
|
-
R = new WeakMap(), q = new WeakMap(),
|
|
1113
|
+
R = new WeakMap(), q = new WeakMap(), N = new WeakMap(), st = new WeakMap(), y = new WeakSet(), /**
|
|
1112
1114
|
* 通知父组件更新
|
|
1113
1115
|
*/
|
|
1114
1116
|
_ = function() {
|
|
@@ -10,7 +10,7 @@ import { s as X } from "../css/ea-tab.style.js";
|
|
|
10
10
|
import { s as Y } from "../css/ea-tabs.style.js";
|
|
11
11
|
import { t as G } from "../utils/timeout.js";
|
|
12
12
|
import { s as Z } from "../css/ea-tab-panel.style.js";
|
|
13
|
-
var d,
|
|
13
|
+
var d, v, _, S, p, x;
|
|
14
14
|
class V extends U {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
@@ -32,7 +32,7 @@ class V extends U {
|
|
|
32
32
|
type: ["", "card", "border-card"],
|
|
33
33
|
default: () => {
|
|
34
34
|
var t;
|
|
35
|
-
return ((t = e(this, d,
|
|
35
|
+
return ((t = e(this, d, v)) == null ? void 0 : t.getAttribute("type")) || "";
|
|
36
36
|
},
|
|
37
37
|
observer: () => {
|
|
38
38
|
this.updateContainerClasslist();
|
|
@@ -56,7 +56,7 @@ class V extends U {
|
|
|
56
56
|
type: ["", "card", "border-card"],
|
|
57
57
|
default: () => {
|
|
58
58
|
var t;
|
|
59
|
-
return ((t = e(this, d,
|
|
59
|
+
return ((t = e(this, d, v)) == null ? void 0 : t.getAttribute("tab-position")) || "top";
|
|
60
60
|
},
|
|
61
61
|
observer: () => {
|
|
62
62
|
this.updateContainerClasslist();
|
|
@@ -109,13 +109,13 @@ class V extends U {
|
|
|
109
109
|
*/
|
|
110
110
|
updateContainerClasslist() {
|
|
111
111
|
var l, n, c;
|
|
112
|
-
let t = (l = e(this, d,
|
|
112
|
+
let t = (l = e(this, d, v)) == null ? void 0 : l.querySelectorAll("ea-tab");
|
|
113
113
|
t = (t == null ? void 0 : t.length) > 0 ? [...t] : [];
|
|
114
114
|
const s = this.computedClasslist(
|
|
115
115
|
"ea-tab",
|
|
116
116
|
{
|
|
117
|
-
["--" + this.type]: this.type === ((n = e(this, d,
|
|
118
|
-
["--" + this["tab-position"]]: this["tab-position"] === ((c = e(this, d,
|
|
117
|
+
["--" + this.type]: this.type === ((n = e(this, d, v)) == null ? void 0 : n.getAttribute("type")) || "",
|
|
118
|
+
["--" + this["tab-position"]]: this["tab-position"] === ((c = e(this, d, v)) == null ? void 0 : c.getAttribute("tab-position")) || "top"
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
121
|
disabled: this.disabled,
|
|
@@ -145,7 +145,7 @@ class V extends U {
|
|
|
145
145
|
e(this, p).abort();
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
d = new WeakSet(),
|
|
148
|
+
d = new WeakSet(), v = function() {
|
|
149
149
|
try {
|
|
150
150
|
return this.closest("ea-tabs");
|
|
151
151
|
} catch {
|
|
@@ -153,7 +153,7 @@ d = new WeakSet(), f = function() {
|
|
|
153
153
|
}
|
|
154
154
|
}, _ = new WeakMap(), S = new WeakMap(), p = new WeakMap(), x = new WeakMap();
|
|
155
155
|
window.customElements.get("ea-tab") || window.customElements.define("ea-tab", V);
|
|
156
|
-
var E, u,
|
|
156
|
+
var E, u, f, r, m, g, L, k, y, b, C, $, N, A, B, H, w, P, I, W, O;
|
|
157
157
|
class tt extends U {
|
|
158
158
|
constructor() {
|
|
159
159
|
super();
|
|
@@ -162,7 +162,7 @@ class tt extends U {
|
|
|
162
162
|
/** @type {HTMLElement} */
|
|
163
163
|
a(this, u);
|
|
164
164
|
/** @type {HTMLElement} */
|
|
165
|
-
a(this,
|
|
165
|
+
a(this, f);
|
|
166
166
|
/** @type {HTMLElement} */
|
|
167
167
|
a(this, r);
|
|
168
168
|
/** @type {HTMLSlotElement} */
|
|
@@ -281,7 +281,7 @@ class tt extends U {
|
|
|
281
281
|
* @param {"top" | "bottom" | "left" | "right"} tabPosition
|
|
282
282
|
*/
|
|
283
283
|
a(this, H, (t = this["tab-position"]) => {
|
|
284
|
-
t === "left" || t === "right" ? (e(this, u).setAttribute("name", "arrow-left"), e(this,
|
|
284
|
+
t === "left" || t === "right" ? (e(this, u).setAttribute("name", "arrow-left"), e(this, f).setAttribute("name", "arrow-right")) : (t === "top" || t === "bottom") && (e(this, u).setAttribute("name", "arrow-up"), e(this, f).setAttribute("name", "arrow-down"));
|
|
285
285
|
});
|
|
286
286
|
/**
|
|
287
287
|
* 当 tab slot 内容变化时触发
|
|
@@ -297,7 +297,9 @@ class tt extends U {
|
|
|
297
297
|
}), e(this, A).call(this, this.active), e(this, B).call(this, this.editable), this.updateContainerClasslist(), G(() => {
|
|
298
298
|
const s = [...this.querySelectorAll("ea-tab")].find(
|
|
299
299
|
(n) => n.hasAttribute("active")
|
|
300
|
-
)
|
|
300
|
+
);
|
|
301
|
+
if (!s) return;
|
|
302
|
+
const l = s.getBoundingClientRect();
|
|
301
303
|
e(this, r).scrollTo({
|
|
302
304
|
left: s.offsetLeft + l.width,
|
|
303
305
|
top: s.offsetTop + l.height,
|
|
@@ -397,7 +399,7 @@ class tt extends U {
|
|
|
397
399
|
<slot></slot>
|
|
398
400
|
</main>
|
|
399
401
|
</div>
|
|
400
|
-
`, h(this, E, this.shadowRoot.querySelector(".ea-tabs")), h(this, u, this.shadowRoot.querySelector(".ea-tabs__prev")), h(this,
|
|
402
|
+
`, h(this, E, this.shadowRoot.querySelector(".ea-tabs")), h(this, u, this.shadowRoot.querySelector(".ea-tabs__prev")), h(this, f, this.shadowRoot.querySelector(".ea-tabs__next")), h(this, r, this.shadowRoot.querySelector(".ea-tabs__nav")), h(this, m, this.shadowRoot.querySelector(
|
|
401
403
|
".ea-tabs__nav > slot[name=nav]"
|
|
402
404
|
)), h(this, g, this.shadowRoot.querySelector(".ea-tabs__line")), h(this, L, this.shadowRoot.querySelector(".ea-tabs__indicator")), h(this, k, this.shadowRoot.querySelector(".ea-tabs__content")), h(this, y, this.shadowRoot.querySelector(
|
|
403
405
|
".ea-tabs__content > slot"
|
|
@@ -413,7 +415,7 @@ class tt extends U {
|
|
|
413
415
|
signal: e(this, b).signal
|
|
414
416
|
}), e(this, u).addEventListener("click", e(this, I), {
|
|
415
417
|
signal: e(this, b).signal
|
|
416
|
-
}), e(this,
|
|
418
|
+
}), e(this, f).addEventListener("click", e(this, W), {
|
|
417
419
|
signal: e(this, b).signal
|
|
418
420
|
}), this.addEventListener("ea-tab-close-icon-click", e(this, O), {
|
|
419
421
|
signal: e(this, b).signal
|
|
@@ -428,7 +430,7 @@ class tt extends U {
|
|
|
428
430
|
(t = e(this, b)) == null || t.abort(), (s = e(this, C)) == null || s.unobserve();
|
|
429
431
|
}
|
|
430
432
|
}
|
|
431
|
-
E = new WeakMap(), u = new WeakMap(),
|
|
433
|
+
E = new WeakMap(), u = new WeakMap(), f = new WeakMap(), r = new WeakMap(), m = new WeakMap(), g = new WeakMap(), L = new WeakMap(), k = new WeakMap(), y = new WeakMap(), b = new WeakMap(), C = new WeakMap(), $ = new WeakMap(), N = new WeakMap(), A = new WeakMap(), B = new WeakMap(), H = new WeakMap(), w = new WeakMap(), P = new WeakMap(), I = new WeakMap(), W = new WeakMap(), O = new WeakMap();
|
|
432
434
|
window.customElements.get("ea-tabs") || window.customElements.define("ea-tabs", tt);
|
|
433
435
|
var z, J, R, M;
|
|
434
436
|
class et extends U {
|
package/dist/core/FormBase.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var m = Object.defineProperty;
|
|
2
|
+
var d = (i) => {
|
|
3
3
|
throw TypeError(i);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var r = (i, e, t) =>
|
|
7
|
-
var n = (i, e, t) => (u(i, e, "read from private field"), t ? t.call(i) : e.get(i)), h = (i, e, t) => e.has(i) ?
|
|
8
|
-
import { B as
|
|
5
|
+
var v = (i, e, t) => e in i ? m(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
6
|
+
var r = (i, e, t) => v(i, typeof e != "symbol" ? e + "" : e, t), u = (i, e, t) => e.has(i) || d("Cannot " + t);
|
|
7
|
+
var n = (i, e, t) => (u(i, e, "read from private field"), t ? t.call(i) : e.get(i)), h = (i, e, t) => e.has(i) ? d("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), f = (i, e, t, a) => (u(i, e, "write to private field"), a ? a.call(i, t) : e.set(i, t), t);
|
|
8
|
+
import { B as g } from "../components/Base.js";
|
|
9
9
|
var l;
|
|
10
|
-
class p extends
|
|
10
|
+
class p extends g {
|
|
11
11
|
constructor() {
|
|
12
12
|
super();
|
|
13
13
|
/** @type {AbortController} */
|
|
@@ -101,10 +101,10 @@ class p extends f {
|
|
|
101
101
|
}));
|
|
102
102
|
r(this, "getForm", () => this.internals.form);
|
|
103
103
|
r(this, "setValue", (t) => {
|
|
104
|
-
this.internals.setFormValue(t);
|
|
104
|
+
this.internals && typeof this.internals.setFormValue == "function" && this.internals.setFormValue(t);
|
|
105
105
|
});
|
|
106
106
|
r(this, "removeValue", () => {
|
|
107
|
-
this.internals.setFormValue(null);
|
|
107
|
+
this.internals && typeof this.internals.setFormValue == "function" && this.internals.setFormValue(null);
|
|
108
108
|
});
|
|
109
109
|
this.internals = this.attachInternals();
|
|
110
110
|
}
|
|
@@ -149,7 +149,7 @@ class p extends f {
|
|
|
149
149
|
this.setValidity(
|
|
150
150
|
a,
|
|
151
151
|
this["validation-message"] || t.validationMessage
|
|
152
|
-
), this.internals.reportValidity();
|
|
152
|
+
), this.internals && typeof this.internals.reportValidity == "function" && this.internals.reportValidity();
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
@@ -176,26 +176,26 @@ class p extends f {
|
|
|
176
176
|
* @param {object} flags - 验证状态标志
|
|
177
177
|
*/
|
|
178
178
|
setValidity(t = {}, a = "") {
|
|
179
|
-
var
|
|
180
|
-
const s = Object.values(t).some((
|
|
181
|
-
a ? t.customError = !0 : s && (a = ((
|
|
179
|
+
var o;
|
|
180
|
+
const s = Object.values(t).some((y) => y === !0);
|
|
181
|
+
a ? t.customError = !0 : s && (a = ((o = this.validationTarget) == null ? void 0 : o.validationMessage) || ""), this.internals && typeof this.internals.setValidity == "function" && this.internals.setValidity(t, a, this.validationTarget);
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
184
|
* 设置自定义验证错误消息
|
|
185
185
|
* @param {string} message - 自定义错误消息,空字符串表示清除错误
|
|
186
186
|
*/
|
|
187
187
|
setCustomValidity(t) {
|
|
188
|
-
this.tagName !== "EA-BUTTON" && (this.validationTarget && this.validationTarget !== this && typeof this.validationTarget.setCustomValidity == "function" && this.validationTarget.setCustomValidity(t), t ? this.internals.setValidity(
|
|
188
|
+
this.tagName !== "EA-BUTTON" && (this.validationTarget && this.validationTarget !== this && typeof this.validationTarget.setCustomValidity == "function" && this.validationTarget.setCustomValidity(t), this.internals && typeof this.internals.setValidity == "function" && (t ? this.internals.setValidity(
|
|
189
189
|
{ customError: !0 },
|
|
190
190
|
t,
|
|
191
191
|
this.validationTarget
|
|
192
|
-
) : this.internals.setValidity({}, "", this.validationTarget));
|
|
192
|
+
) : this.internals.setValidity({}, "", this.validationTarget)));
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
195
|
* 重置自定义验证错误消息
|
|
196
196
|
*/
|
|
197
197
|
resetCustomValidity() {
|
|
198
|
-
this.internals.setValidity({}, "", this.validationTarget), this.validationTarget && this.validationTarget !== this && typeof this.validationTarget.setCustomValidity == "function" && this.validationTarget.setCustomValidity("");
|
|
198
|
+
this.internals && typeof this.internals.setValidity == "function" && this.internals.setValidity({}, "", this.validationTarget), this.validationTarget && this.validationTarget !== this && typeof this.validationTarget.setCustomValidity == "function" && this.validationTarget.setCustomValidity("");
|
|
199
199
|
}
|
|
200
200
|
connectedCallback() {
|
|
201
201
|
super.connectedCallback();
|
|
@@ -210,7 +210,7 @@ class p extends f {
|
|
|
210
210
|
*/
|
|
211
211
|
formAssociatedCallback(t) {
|
|
212
212
|
var a;
|
|
213
|
-
t && ((a = n(this, l)) == null || a.abort(),
|
|
213
|
+
t && ((a = n(this, l)) == null || a.abort(), f(this, l, new AbortController()), t.addEventListener(
|
|
214
214
|
"submit",
|
|
215
215
|
(s) => {
|
|
216
216
|
this.setCustomValidity(""), this.updateValidity(), !this.checkValidity() && this.tagName !== "EA-BUTTON" && (s.preventDefault(), s.stopImmediatePropagation(), this.reportValidity());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easy-component-ui",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.15",
|
|
4
4
|
"description": "使用 WebComponent 编写的原生组件库",
|
|
5
5
|
"main": "dist/components/index.js",
|
|
6
6
|
"module": "dist/components/index.js",
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
"preview:doc": "set VITEPRESS_BASE=___EMPTY___&& xcopy .\\docs\\index.css .\\docs\\.vitepress\\public\\index.css /y >nul && vitepress build docs && xcopy .\\docs\\.vitepress\\public .\\docs\\.vitepress\\dist /s /e /y >nul && vitepress preview docs",
|
|
19
19
|
"preview": "vite preview",
|
|
20
20
|
"deploy": "gh-pages -d docs/.vitepress/dist",
|
|
21
|
+
"test": "vitest",
|
|
22
|
+
"test:run": "vitest run",
|
|
23
|
+
"test:coverage": "vitest run --coverage",
|
|
21
24
|
"lint": "eslint . --ext .js",
|
|
22
25
|
"lint:fix": "eslint . --ext .js --fix",
|
|
23
26
|
"format": "prettier --write \"**/*.{js,json,scss,css,md}\"",
|
|
@@ -77,6 +80,7 @@
|
|
|
77
80
|
"@commitlint/config-conventional": "^20.2.0",
|
|
78
81
|
"@eslint/js": "^9.39.2",
|
|
79
82
|
"@types/node": "^24.0.14",
|
|
83
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
80
84
|
"commitizen": "^4.3.1",
|
|
81
85
|
"cz-conventional-changelog": "^3.3.0",
|
|
82
86
|
"eslint": "^9.39.2",
|
|
@@ -87,6 +91,7 @@
|
|
|
87
91
|
"gh-pages": "^6.1.1",
|
|
88
92
|
"globals": "^16.5.0",
|
|
89
93
|
"husky": "^9.1.7",
|
|
94
|
+
"jsdom": "^29.0.1",
|
|
90
95
|
"nanoid": "^5.0.7",
|
|
91
96
|
"prettier": "^3.7.4",
|
|
92
97
|
"rollup-plugin-visualizer": "^6.0.3",
|
|
@@ -95,7 +100,8 @@
|
|
|
95
100
|
"scss": "^0.2.4",
|
|
96
101
|
"scss-loader": "^0.0.1",
|
|
97
102
|
"vite": "^5.4.1",
|
|
98
|
-
"vitepress": "^1.2.0"
|
|
103
|
+
"vitepress": "^1.2.0",
|
|
104
|
+
"vitest": "^4.1.0"
|
|
99
105
|
},
|
|
100
106
|
"dependencies": {
|
|
101
107
|
"@fortawesome/fontawesome-free": "^7.2.0",
|