easy-component-ui 3.0.4 → 3.0.6
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 -89
- package/dist/components/ea-calendar2.js +329 -327
- package/dist/components/ea-link.js +35 -29
- package/dist/components/ea-text.js +46 -39
- package/dist/components/ea-tree.js +277 -240
- package/dist/css/ea-button.style.js +2 -2
- 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-text.style.js +1 -1
- package/package.json +6 -1
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var f = Object.defineProperty;
|
|
2
|
+
var p = (s) => {
|
|
3
|
+
throw TypeError(s);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var d = (
|
|
7
|
-
var
|
|
8
|
-
import { F as
|
|
9
|
-
import { s as
|
|
10
|
-
import { B as
|
|
11
|
-
import { s as
|
|
12
|
-
var a, n,
|
|
13
|
-
class
|
|
5
|
+
var y = (s, i, t) => i in s ? f(s, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[i] = t;
|
|
6
|
+
var d = (s, i, t) => y(s, typeof i != "symbol" ? i + "" : i, t), b = (s, i, t) => i.has(s) || p("Cannot " + t);
|
|
7
|
+
var e = (s, i, t) => (b(s, i, "read from private field"), t ? t.call(s) : i.get(s)), u = (s, i, t) => i.has(s) ? p("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, t), h = (s, i, t, o) => (b(s, i, "write to private field"), o ? o.call(s, t) : i.set(s, t), t);
|
|
8
|
+
import { F as C } from "../core/FormBase.js";
|
|
9
|
+
import { s as g } from "../css/ea-button.style.js";
|
|
10
|
+
import { B as v } from "./Base.js";
|
|
11
|
+
import { s as w } from "../css/ea-button-group.style.js";
|
|
12
|
+
var a, l, n, c;
|
|
13
|
+
class A extends C {
|
|
14
14
|
constructor() {
|
|
15
15
|
super();
|
|
16
16
|
/** @type {HTMLButtonElement | HTMLLinkElement} */
|
|
17
|
-
|
|
17
|
+
u(this, a);
|
|
18
|
+
/** @type {HTMLIconElement} */
|
|
19
|
+
u(this, l);
|
|
18
20
|
/** @type {AbortController} */
|
|
19
|
-
|
|
21
|
+
u(this, n);
|
|
20
22
|
/**
|
|
21
23
|
* @typedef {Object} state
|
|
22
24
|
* @property {boolean} disabled
|
|
@@ -30,113 +32,109 @@ class w extends y {
|
|
|
30
32
|
* @property {string} size
|
|
31
33
|
* @property {boolean} loading
|
|
32
34
|
* @property {string} icon
|
|
33
|
-
* @property {boolean} loading
|
|
34
35
|
*/
|
|
35
36
|
/** @type {state} */
|
|
36
37
|
d(this, "state", this.properties({
|
|
37
38
|
disabled: {
|
|
38
39
|
type: Boolean,
|
|
39
40
|
default: !1,
|
|
40
|
-
observer: (
|
|
41
|
-
|
|
41
|
+
observer: (t) => {
|
|
42
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
42
43
|
}
|
|
43
44
|
},
|
|
44
45
|
type: {
|
|
45
46
|
type: ["normal", "primary", "success", "warning", "danger"],
|
|
46
47
|
default: "normal",
|
|
47
|
-
observer: (
|
|
48
|
-
|
|
48
|
+
observer: (t) => {
|
|
49
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
52
|
text: {
|
|
52
53
|
type: Boolean,
|
|
53
54
|
default: !1,
|
|
54
|
-
observer: (
|
|
55
|
-
|
|
55
|
+
observer: (t) => {
|
|
56
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
56
57
|
}
|
|
57
58
|
},
|
|
58
59
|
plain: {
|
|
59
60
|
type: Boolean,
|
|
60
61
|
default: !1,
|
|
61
|
-
observer: (
|
|
62
|
-
|
|
62
|
+
observer: (t) => {
|
|
63
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
63
64
|
}
|
|
64
65
|
},
|
|
65
66
|
round: {
|
|
66
67
|
type: Boolean,
|
|
67
68
|
default: !1,
|
|
68
|
-
observer: (
|
|
69
|
-
|
|
69
|
+
observer: (t) => {
|
|
70
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
70
71
|
}
|
|
71
72
|
},
|
|
72
73
|
circle: {
|
|
73
74
|
type: Boolean,
|
|
74
75
|
default: !1,
|
|
75
|
-
observer: (
|
|
76
|
-
|
|
76
|
+
observer: (t) => {
|
|
77
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
77
78
|
}
|
|
78
79
|
},
|
|
79
80
|
link: {
|
|
80
81
|
type: Boolean,
|
|
81
82
|
default: !1,
|
|
82
|
-
observer: (
|
|
83
|
-
|
|
83
|
+
observer: (t) => {
|
|
84
|
+
this.$render(), e(this, a).href = this.getAttribute("href"), e(this, a).className = this.updateContainerClasslist();
|
|
84
85
|
}
|
|
85
86
|
},
|
|
86
87
|
href: {
|
|
87
88
|
type: String,
|
|
88
89
|
default: "",
|
|
89
|
-
observer: (
|
|
90
|
-
|
|
90
|
+
observer: (t) => {
|
|
91
|
+
e(this, a).className = this.updateContainerClasslist(), e(this, a).setAttribute("href", t);
|
|
91
92
|
}
|
|
92
93
|
},
|
|
93
94
|
size: {
|
|
94
95
|
type: ["small", "medium", "large"],
|
|
95
96
|
default: "medium",
|
|
96
|
-
observer: (
|
|
97
|
-
|
|
97
|
+
observer: (t) => {
|
|
98
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
98
99
|
}
|
|
99
100
|
},
|
|
100
101
|
loading: {
|
|
101
102
|
type: Boolean,
|
|
102
103
|
default: !1,
|
|
103
|
-
observer: (
|
|
104
|
-
var
|
|
105
|
-
if (
|
|
106
|
-
const
|
|
107
|
-
|
|
104
|
+
observer: (t) => {
|
|
105
|
+
var o;
|
|
106
|
+
if (t = t === "true" || t === !0, this.toggleAttribute("disabled", t), t) {
|
|
107
|
+
const r = document.createElement("ea-icon");
|
|
108
|
+
r.id = "ea-loading-icon", r.icon = "icon-cw animate-spin", r.size = this.size, r.part = "loading-icon", e(this, a).insertBefore(r, e(this, a).firstChild);
|
|
108
109
|
} else {
|
|
109
|
-
const
|
|
110
|
-
(
|
|
110
|
+
const r = (o = e(this, a)) == null ? void 0 : o.querySelectorAll("#ea-loading-icon");
|
|
111
|
+
(r == null ? void 0 : r.length) > 0 && (r == null || r.forEach((m) => m.remove()));
|
|
111
112
|
}
|
|
112
|
-
|
|
113
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
113
114
|
}
|
|
114
115
|
},
|
|
115
116
|
icon: {
|
|
116
117
|
type: String,
|
|
117
118
|
default: "",
|
|
118
|
-
observer: (
|
|
119
|
-
|
|
120
|
-
const r = document.createElement("ea-icon");
|
|
121
|
-
r.size = this.size, r.icon = e, r.part = "icon", s(this, a).insertBefore(r, s(this, a).firstChild);
|
|
122
|
-
}
|
|
119
|
+
observer: (t) => {
|
|
120
|
+
e(this, l).setAttribute("icon", t), e(this, l).setAttribute("size", this.size), e(this, a).className = this.updateContainerClasslist();
|
|
123
121
|
}
|
|
124
122
|
},
|
|
125
123
|
"button-type": {
|
|
126
124
|
type: ["button", "submit", "reset"],
|
|
127
125
|
default: "button",
|
|
128
|
-
observer: (
|
|
129
|
-
|
|
126
|
+
observer: (t) => {
|
|
127
|
+
e(this, a).type = t;
|
|
130
128
|
}
|
|
131
129
|
}
|
|
132
130
|
}));
|
|
133
131
|
/**
|
|
134
132
|
* @param {KeyboardEvent} e
|
|
135
133
|
*/
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
u(this, c, (t) => {
|
|
135
|
+
t.key === "Enter" && this.click();
|
|
138
136
|
});
|
|
139
|
-
this.stylesheet =
|
|
137
|
+
this.stylesheet = g, this.$render();
|
|
140
138
|
}
|
|
141
139
|
static get observedAttributes() {
|
|
142
140
|
return [
|
|
@@ -160,46 +158,52 @@ class w extends y {
|
|
|
160
158
|
* @return {string} 属性值
|
|
161
159
|
*/
|
|
162
160
|
updateContainerClasslist() {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
"
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
161
|
+
var t;
|
|
162
|
+
return this.computedClasslist(
|
|
163
|
+
"ea-button",
|
|
164
|
+
{
|
|
165
|
+
["--" + this.type]: this.type,
|
|
166
|
+
"--disabled": this.disabled || this.loading,
|
|
167
|
+
"--text": this.text || this.link,
|
|
168
|
+
"--plain": this.plain,
|
|
169
|
+
"--round": this.round,
|
|
170
|
+
"--circle": this.circle,
|
|
171
|
+
["--" + this.size]: this.size
|
|
172
|
+
},
|
|
173
|
+
{ icon: (t = this.icon) == null ? void 0 : t.length }
|
|
174
|
+
);
|
|
172
175
|
}
|
|
173
176
|
$render() {
|
|
174
|
-
const
|
|
177
|
+
const t = this.getAttrBoolean("link") ? "a" : "button";
|
|
175
178
|
this.shadowRoot.innerHTML = `
|
|
176
|
-
<${
|
|
179
|
+
<${t} class="ea-button" part="container" tabindex="-1">
|
|
180
|
+
<ea-icon class="ea-button__icon" part="icon"></ea-icon>
|
|
177
181
|
<slot></slot>
|
|
178
|
-
</${
|
|
179
|
-
`, h(this, a, this.shadowRoot.querySelector(".ea-button"));
|
|
182
|
+
</${t}>
|
|
183
|
+
`, h(this, a, this.shadowRoot.querySelector(".ea-button")), h(this, l, this.shadowRoot.querySelector(".ea-button__icon")), e(this, a).className = this.updateContainerClasslist();
|
|
180
184
|
}
|
|
181
185
|
connectedCallback() {
|
|
182
|
-
var
|
|
183
|
-
super.connectedCallback(), (
|
|
184
|
-
signal:
|
|
185
|
-
}), this.addEventListener("click", (
|
|
186
|
+
var t;
|
|
187
|
+
super.connectedCallback(), (t = e(this, n)) == null || t.abort(), h(this, n, new AbortController()), this.addEventListener("keypress", e(this, c), {
|
|
188
|
+
signal: e(this, n).signal
|
|
189
|
+
}), this.addEventListener("click", (o) => {
|
|
186
190
|
if (this["button-type"] === "submit") {
|
|
187
|
-
const
|
|
188
|
-
|
|
191
|
+
const r = this.getForm();
|
|
192
|
+
r && (o.preventDefault(), r.dispatchEvent(new Event("submit")));
|
|
189
193
|
} else if (this["button-type"] === "reset") {
|
|
190
|
-
const
|
|
191
|
-
|
|
194
|
+
const r = this.getForm();
|
|
195
|
+
r && (o.preventDefault(), r.reset());
|
|
192
196
|
}
|
|
193
|
-
})
|
|
197
|
+
});
|
|
194
198
|
}
|
|
195
199
|
$beforeUnmounted() {
|
|
196
|
-
var
|
|
197
|
-
(
|
|
200
|
+
var t;
|
|
201
|
+
(t = e(this, n)) == null || t.abort();
|
|
198
202
|
}
|
|
199
203
|
}
|
|
200
|
-
a = new WeakMap(), n = new WeakMap(),
|
|
201
|
-
window.customElements.get("ea-button") || window.customElements.define("ea-button",
|
|
202
|
-
class E extends
|
|
204
|
+
a = new WeakMap(), l = new WeakMap(), n = new WeakMap(), c = new WeakMap();
|
|
205
|
+
window.customElements.get("ea-button") || window.customElements.define("ea-button", A);
|
|
206
|
+
class E extends v {
|
|
203
207
|
constructor() {
|
|
204
208
|
super();
|
|
205
209
|
/**
|
|
@@ -213,32 +217,32 @@ class E extends g {
|
|
|
213
217
|
disabled: {
|
|
214
218
|
type: Boolean,
|
|
215
219
|
default: !1,
|
|
216
|
-
observer: (
|
|
217
|
-
this.querySelectorAll("ea-button").forEach((
|
|
218
|
-
|
|
220
|
+
observer: (t) => {
|
|
221
|
+
this.querySelectorAll("ea-button").forEach((o) => {
|
|
222
|
+
o.setAttribute("disabled", t);
|
|
219
223
|
});
|
|
220
224
|
}
|
|
221
225
|
},
|
|
222
226
|
size: {
|
|
223
227
|
type: ["small", "normal", "large"],
|
|
224
228
|
default: "normal",
|
|
225
|
-
observer: (
|
|
226
|
-
this.querySelectorAll("ea-button").forEach((
|
|
227
|
-
|
|
229
|
+
observer: (t) => {
|
|
230
|
+
this.querySelectorAll("ea-button").forEach((o) => {
|
|
231
|
+
o.setAttribute("size", t);
|
|
228
232
|
});
|
|
229
233
|
}
|
|
230
234
|
},
|
|
231
235
|
type: {
|
|
232
236
|
type: ["primary", "success", "warning", "danger", "normal"],
|
|
233
237
|
default: "normal",
|
|
234
|
-
observer: (
|
|
235
|
-
this.querySelectorAll("ea-button").forEach((
|
|
236
|
-
|
|
238
|
+
observer: (t) => {
|
|
239
|
+
this.querySelectorAll("ea-button").forEach((o) => {
|
|
240
|
+
o.setAttribute("type", t);
|
|
237
241
|
});
|
|
238
242
|
}
|
|
239
243
|
}
|
|
240
244
|
}));
|
|
241
|
-
this.stylesheet =
|
|
245
|
+
this.stylesheet = w, this.$render();
|
|
242
246
|
}
|
|
243
247
|
static get observedAttributes() {
|
|
244
248
|
return [...super.observedAttributes, "disabled", "size", "type"];
|
|
@@ -256,6 +260,6 @@ class E extends g {
|
|
|
256
260
|
}
|
|
257
261
|
window.customElements.get("ea-button-group") || window.customElements.define("ea-button-group", E);
|
|
258
262
|
export {
|
|
259
|
-
|
|
263
|
+
A as EaButton,
|
|
260
264
|
E as EaButtonGroup
|
|
261
265
|
};
|