easy-component-ui 3.0.5 → 3.0.7
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/dist/components/ea-button.js +93 -88
- package/dist/components/ea-carousel.js +109 -99
- package/dist/components/ea-link.js +35 -29
- package/dist/components/ea-space.js +45 -31
- package/dist/components/ea-text.js +49 -39
- package/dist/components/ea-tree.js +277 -240
- package/dist/css/ea-button.style.js +1 -1
- package/dist/css/ea-card.style.js +1 -1
- package/dist/css/ea-container.style.js +1 -1
- package/dist/css/ea-link.style.js +1 -1
- package/dist/css/ea-space.style.js +1 -1
- package/dist/css/ea-text.style.js +1 -1
- package/dist/css/ea-ui-component.style.js +1 -1
- package/package.json +2 -2
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var
|
|
1
|
+
var m = Object.defineProperty;
|
|
2
2
|
var n = (t) => {
|
|
3
3
|
throw TypeError(t);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
import { B as
|
|
9
|
-
import { s as
|
|
10
|
-
var
|
|
11
|
-
class v extends
|
|
5
|
+
var b = (t, s, e) => s in t ? m(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
6
|
+
var p = (t, s, e) => b(t, typeof s != "symbol" ? s + "" : s, e), c = (t, s, e) => s.has(t) || n("Cannot " + e);
|
|
7
|
+
var u = (t, s, e) => (c(t, s, "read from private field"), e ? e.call(t) : s.get(t)), d = (t, s, e) => s.has(t) ? n("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), h = (t, s, e, a) => (c(t, s, "write to private field"), a ? a.call(t, e) : s.set(t, e), e);
|
|
8
|
+
import { B as g } from "./Base.js";
|
|
9
|
+
import { s as y } from "../css/ea-space.style.js";
|
|
10
|
+
var r;
|
|
11
|
+
class v extends g {
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
14
14
|
/** @type {HTMLElement} */
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
d(this, r);
|
|
16
|
+
p(this, "state", this.properties({
|
|
17
17
|
wrap: {
|
|
18
18
|
type: Boolean,
|
|
19
19
|
default: !1,
|
|
@@ -22,18 +22,19 @@ class v extends y {
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
alignment: {
|
|
25
|
-
type:
|
|
25
|
+
type: ["", "center", "flex-start", "flex-end", "baseline", "stretch"],
|
|
26
26
|
default: "",
|
|
27
27
|
observer: (e) => {
|
|
28
|
-
if (!CSS.supports("align-items", e))
|
|
28
|
+
if (!CSS.supports("align-items", e))
|
|
29
|
+
return console.warn(`[ea-space] Invalid alignment value ${e}`);
|
|
29
30
|
this.style.setProperty("--ea-space-alignment", e);
|
|
30
31
|
}
|
|
31
32
|
},
|
|
32
33
|
direction: {
|
|
33
34
|
type: ["vertical", "horizontal"],
|
|
34
35
|
default: "horizontal",
|
|
35
|
-
observer: (
|
|
36
|
-
|
|
36
|
+
observer: () => {
|
|
37
|
+
this.updateContainerClasslist();
|
|
37
38
|
}
|
|
38
39
|
},
|
|
39
40
|
size: {
|
|
@@ -41,9 +42,10 @@ class v extends y {
|
|
|
41
42
|
default: "default",
|
|
42
43
|
observer: (e) => {
|
|
43
44
|
if (["large", "small", "default"].includes(e))
|
|
44
|
-
|
|
45
|
+
this.updateContainerClasslist();
|
|
45
46
|
else {
|
|
46
|
-
if (!CSS.supports("gap", e))
|
|
47
|
+
if (!CSS.supports("gap", e))
|
|
48
|
+
return console.warn("[ea-space] Invalid size value");
|
|
47
49
|
this.style.setProperty("--ea-space-gap", e);
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -52,11 +54,12 @@ class v extends y {
|
|
|
52
54
|
type: String,
|
|
53
55
|
default: "",
|
|
54
56
|
observer: (e) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
if (this.querySelectorAll('[part="spacer"]').forEach((i) => i.remove()), !e) return;
|
|
58
|
+
const o = [...this.children];
|
|
59
|
+
o.forEach((i, f) => {
|
|
60
|
+
if (f < o.length - 1) {
|
|
58
61
|
const l = document.createElement("span");
|
|
59
|
-
l.innerText = e, l.part = "spacer", this.insertBefore(l,
|
|
62
|
+
l.innerText = e, l.part = "spacer", this.insertBefore(l, i.nextSibling);
|
|
60
63
|
}
|
|
61
64
|
});
|
|
62
65
|
}
|
|
@@ -64,45 +67,56 @@ class v extends y {
|
|
|
64
67
|
fill: {
|
|
65
68
|
type: Boolean,
|
|
66
69
|
default: !1,
|
|
67
|
-
observer: (
|
|
68
|
-
|
|
70
|
+
observer: () => {
|
|
71
|
+
this.updateContainerClasslist();
|
|
69
72
|
}
|
|
70
73
|
},
|
|
71
74
|
"fill-ratio": {
|
|
72
75
|
type: Number,
|
|
73
76
|
default: 100,
|
|
74
77
|
observer: (e) => {
|
|
75
|
-
this.style.setProperty("--ea-space-fill-ratio", `${e}%`);
|
|
78
|
+
Number.isNaN(Number(e)) || this.toggleAttribute("fill", !0), this.style.setProperty("--ea-space-fill-ratio", `${e}%`);
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
}));
|
|
79
|
-
this.stylesheet =
|
|
82
|
+
this.stylesheet = y, this.$render();
|
|
80
83
|
}
|
|
81
84
|
static get observedAttributes() {
|
|
82
|
-
return [
|
|
85
|
+
return [
|
|
86
|
+
...super.observedAttributes,
|
|
87
|
+
"wrap",
|
|
88
|
+
"direction",
|
|
89
|
+
"size",
|
|
90
|
+
"spacer",
|
|
91
|
+
"alignment",
|
|
92
|
+
"fill",
|
|
93
|
+
"fill-ratio"
|
|
94
|
+
];
|
|
83
95
|
}
|
|
84
96
|
/**
|
|
85
97
|
* 获取 classlist 列表
|
|
86
98
|
* @return {string} 属性值
|
|
87
99
|
*/
|
|
88
100
|
updateContainerClasslist() {
|
|
89
|
-
|
|
101
|
+
const e = this.computedClasslist("ea-space", {
|
|
102
|
+
[`--${this.size}`]: !CSS.supports("gap", this.size),
|
|
90
103
|
["--" + this.direction]: this.direction,
|
|
91
104
|
"--fill": this.fill
|
|
92
105
|
});
|
|
106
|
+
return u(this, r).className = e, e;
|
|
93
107
|
}
|
|
94
108
|
$render() {
|
|
95
109
|
this.shadowRoot.innerHTML = `
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
110
|
+
<div class="ea-space" part="container">
|
|
111
|
+
<slot></slot>
|
|
112
|
+
</div>
|
|
113
|
+
`, h(this, r, this.shadowRoot.querySelector(".ea-space")), this.updateContainerClasslist();
|
|
100
114
|
}
|
|
101
115
|
connectedCallback() {
|
|
102
116
|
super.connectedCallback();
|
|
103
117
|
}
|
|
104
118
|
}
|
|
105
|
-
|
|
119
|
+
r = new WeakMap();
|
|
106
120
|
window.customElements.get("ea-space") || window.customElements.define("ea-space", v);
|
|
107
121
|
export {
|
|
108
122
|
v as EaSpace
|
|
@@ -1,29 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var y = Object.defineProperty;
|
|
2
|
+
var p = (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 w = (e, s, t) => s in e ? y(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
|
|
6
|
+
var u = (e, s, t) => w(e, typeof s != "symbol" ? s + "" : s, t), m = (e, s, t) => s.has(e) || p("Cannot " + t);
|
|
7
|
+
var i = (e, s, t) => (m(e, s, "read from private field"), t ? t.call(e) : s.get(e)), o = (e, s, t) => s.has(e) ? p("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), h = (e, s, t, l) => (m(e, s, "write to private field"), l ? l.call(e, t) : s.set(e, t), t);
|
|
8
|
+
import { B as f } from "./Base.js";
|
|
9
|
+
import { s as C } from "../css/ea-text.style.js";
|
|
10
|
+
var a, n, r;
|
|
11
|
+
class g extends f {
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
14
14
|
/** @type {HTMLElement} */
|
|
15
|
-
o(this,
|
|
16
|
-
|
|
15
|
+
o(this, a);
|
|
16
|
+
o(this, n, {
|
|
17
|
+
isOriginalRendered: !1
|
|
18
|
+
});
|
|
19
|
+
o(this, r, new Promise((t) => {
|
|
20
|
+
h(this, n, new Proxy(i(this, n), {
|
|
21
|
+
set: (l, d, c) => (d === "isOriginalRendered" && c && t(!0), Reflect.set(l, d, c))
|
|
22
|
+
}));
|
|
23
|
+
}));
|
|
24
|
+
/**
|
|
17
25
|
* @typedef {Object} State
|
|
18
26
|
* @property {string} title - 标题
|
|
19
27
|
* @property {string} type - 文本类型
|
|
20
28
|
* @property {string} size - 文本大小
|
|
21
29
|
* @property {boolean} truncated - 文本是否截断
|
|
22
30
|
* @property {number} line-clamp - 截断的行数
|
|
23
|
-
* @property {string} tag - 文本标签
|
|
31
|
+
* @property {string} tag - 文本标签
|
|
24
32
|
*/
|
|
25
33
|
/** @type {State} */
|
|
26
|
-
|
|
34
|
+
u(this, "state", this.properties({
|
|
27
35
|
title: {
|
|
28
36
|
type: String,
|
|
29
37
|
default: "",
|
|
@@ -33,39 +41,43 @@ class y extends u {
|
|
|
33
41
|
type: {
|
|
34
42
|
type: ["normal", "primary", "success", "warning", "danger", "info"],
|
|
35
43
|
default: "normal",
|
|
36
|
-
observer: (t) => {
|
|
37
|
-
|
|
44
|
+
observer: async (t) => {
|
|
45
|
+
await i(this, r), this.updateContainerClasslist();
|
|
38
46
|
}
|
|
39
47
|
},
|
|
40
48
|
size: {
|
|
41
49
|
type: ["large", "medium", "small"],
|
|
42
50
|
default: "medium",
|
|
43
|
-
observer: (t) => {
|
|
44
|
-
|
|
51
|
+
observer: async (t) => {
|
|
52
|
+
await i(this, r), this.updateContainerClasslist();
|
|
45
53
|
}
|
|
46
54
|
},
|
|
47
55
|
truncated: {
|
|
48
56
|
type: Boolean,
|
|
49
57
|
default: !1,
|
|
50
|
-
observer: (t) => {
|
|
51
|
-
this.title = this.innerText || "",
|
|
58
|
+
observer: async (t) => {
|
|
59
|
+
await i(this, r), this.title = this.innerText || "", this.updateContainerClasslist();
|
|
52
60
|
}
|
|
53
61
|
},
|
|
54
62
|
"line-clamp": {
|
|
55
63
|
type: Number,
|
|
56
64
|
default: 0,
|
|
57
|
-
observer: (t) => {
|
|
58
|
-
|
|
65
|
+
observer: async (t) => {
|
|
66
|
+
await i(this, r), i(this, a).style.setProperty("--ea-text-line-clamp", t), this.title = this.innerText || "", this.updateContainerClasslist();
|
|
59
67
|
}
|
|
60
68
|
},
|
|
61
69
|
tag: {
|
|
62
70
|
type: String,
|
|
63
71
|
default: "span",
|
|
64
72
|
observer: (t) => {
|
|
73
|
+
this.$render(), this.hasAttribute("line-clamp") && i(this, a).style.setProperty(
|
|
74
|
+
"--ea-text-line-clamp",
|
|
75
|
+
this["line-clamp"]
|
|
76
|
+
), (this.hasAttribute("truncated") || this.hasAttribute("line-clamp")) && (this.title = this.innerText || ""), this.updateContainerClasslist();
|
|
65
77
|
}
|
|
66
78
|
}
|
|
67
79
|
}));
|
|
68
|
-
this.
|
|
80
|
+
this.stylesheet = C;
|
|
69
81
|
}
|
|
70
82
|
static get observedAttributes() {
|
|
71
83
|
return ["title", "type", "size", "truncated", "line-clamp", "tag"];
|
|
@@ -75,29 +87,27 @@ class y extends u {
|
|
|
75
87
|
* @return {string} 属性值
|
|
76
88
|
*/
|
|
77
89
|
updateContainerClasslist() {
|
|
78
|
-
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
);
|
|
90
|
+
const t = this.computedClasslist("ea-text", {
|
|
91
|
+
["--" + this.type]: this.type,
|
|
92
|
+
["--" + this.size]: this.size,
|
|
93
|
+
"--truncated": this.truncated,
|
|
94
|
+
"--line-clamp": this["line-clamp"] > 0
|
|
95
|
+
});
|
|
96
|
+
return i(this, a).className = t, t;
|
|
87
97
|
}
|
|
88
98
|
$render() {
|
|
89
99
|
this.shadowRoot.innerHTML = `
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
100
|
+
<${this.tag} class="ea-text" part="container">
|
|
101
|
+
<slot></slot>
|
|
102
|
+
</${this.tag}>
|
|
103
|
+
`, h(this, a, this.shadowRoot.querySelector(".ea-text")), this.updateContainerClasslist(), i(this, n).isOriginalRendered = !0;
|
|
94
104
|
}
|
|
95
105
|
connectedCallback() {
|
|
96
|
-
super.connectedCallback(), this.$render()
|
|
106
|
+
super.connectedCallback(), this.$render();
|
|
97
107
|
}
|
|
98
108
|
}
|
|
99
|
-
|
|
100
|
-
window.customElements.get("ea-text") || window.customElements.define("ea-text",
|
|
109
|
+
a = new WeakMap(), n = new WeakMap(), r = new WeakMap();
|
|
110
|
+
window.customElements.get("ea-text") || window.customElements.define("ea-text", g);
|
|
101
111
|
export {
|
|
102
|
-
|
|
112
|
+
g as EaText
|
|
103
113
|
};
|