easy-component-ui 3.0.5 → 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 -88
- 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 +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-text.style.js +1 -1
- package/package.json +2 -2
|
@@ -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
|
|
@@ -36,106 +38,103 @@ class w extends y {
|
|
|
36
38
|
disabled: {
|
|
37
39
|
type: Boolean,
|
|
38
40
|
default: !1,
|
|
39
|
-
observer: (
|
|
40
|
-
|
|
41
|
+
observer: (t) => {
|
|
42
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
41
43
|
}
|
|
42
44
|
},
|
|
43
45
|
type: {
|
|
44
46
|
type: ["normal", "primary", "success", "warning", "danger"],
|
|
45
47
|
default: "normal",
|
|
46
|
-
observer: (
|
|
47
|
-
|
|
48
|
+
observer: (t) => {
|
|
49
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
48
50
|
}
|
|
49
51
|
},
|
|
50
52
|
text: {
|
|
51
53
|
type: Boolean,
|
|
52
54
|
default: !1,
|
|
53
|
-
observer: (
|
|
54
|
-
|
|
55
|
+
observer: (t) => {
|
|
56
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
55
57
|
}
|
|
56
58
|
},
|
|
57
59
|
plain: {
|
|
58
60
|
type: Boolean,
|
|
59
61
|
default: !1,
|
|
60
|
-
observer: (
|
|
61
|
-
|
|
62
|
+
observer: (t) => {
|
|
63
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
62
64
|
}
|
|
63
65
|
},
|
|
64
66
|
round: {
|
|
65
67
|
type: Boolean,
|
|
66
68
|
default: !1,
|
|
67
|
-
observer: (
|
|
68
|
-
|
|
69
|
+
observer: (t) => {
|
|
70
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
69
71
|
}
|
|
70
72
|
},
|
|
71
73
|
circle: {
|
|
72
74
|
type: Boolean,
|
|
73
75
|
default: !1,
|
|
74
|
-
observer: (
|
|
75
|
-
|
|
76
|
+
observer: (t) => {
|
|
77
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
76
78
|
}
|
|
77
79
|
},
|
|
78
80
|
link: {
|
|
79
81
|
type: Boolean,
|
|
80
82
|
default: !1,
|
|
81
|
-
observer: (
|
|
82
|
-
|
|
83
|
+
observer: (t) => {
|
|
84
|
+
this.$render(), e(this, a).href = this.getAttribute("href"), e(this, a).className = this.updateContainerClasslist();
|
|
83
85
|
}
|
|
84
86
|
},
|
|
85
87
|
href: {
|
|
86
88
|
type: String,
|
|
87
89
|
default: "",
|
|
88
|
-
observer: (
|
|
89
|
-
|
|
90
|
+
observer: (t) => {
|
|
91
|
+
e(this, a).className = this.updateContainerClasslist(), e(this, a).setAttribute("href", t);
|
|
90
92
|
}
|
|
91
93
|
},
|
|
92
94
|
size: {
|
|
93
95
|
type: ["small", "medium", "large"],
|
|
94
96
|
default: "medium",
|
|
95
|
-
observer: (
|
|
96
|
-
|
|
97
|
+
observer: (t) => {
|
|
98
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
97
99
|
}
|
|
98
100
|
},
|
|
99
101
|
loading: {
|
|
100
102
|
type: Boolean,
|
|
101
103
|
default: !1,
|
|
102
|
-
observer: (
|
|
103
|
-
var
|
|
104
|
-
if (
|
|
105
|
-
const
|
|
106
|
-
|
|
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);
|
|
107
109
|
} else {
|
|
108
|
-
const
|
|
109
|
-
(
|
|
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()));
|
|
110
112
|
}
|
|
111
|
-
|
|
113
|
+
e(this, a).className = this.updateContainerClasslist();
|
|
112
114
|
}
|
|
113
115
|
},
|
|
114
116
|
icon: {
|
|
115
117
|
type: String,
|
|
116
118
|
default: "",
|
|
117
|
-
observer: (
|
|
118
|
-
|
|
119
|
-
const r = document.createElement("ea-icon");
|
|
120
|
-
r.size = this.size, r.icon = e, r.part = "icon", s(this, a).insertBefore(r, s(this, a).firstChild);
|
|
121
|
-
}
|
|
119
|
+
observer: (t) => {
|
|
120
|
+
e(this, l).setAttribute("icon", t), e(this, l).setAttribute("size", this.size), e(this, a).className = this.updateContainerClasslist();
|
|
122
121
|
}
|
|
123
122
|
},
|
|
124
123
|
"button-type": {
|
|
125
124
|
type: ["button", "submit", "reset"],
|
|
126
125
|
default: "button",
|
|
127
|
-
observer: (
|
|
128
|
-
|
|
126
|
+
observer: (t) => {
|
|
127
|
+
e(this, a).type = t;
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
130
|
}));
|
|
132
131
|
/**
|
|
133
132
|
* @param {KeyboardEvent} e
|
|
134
133
|
*/
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
u(this, c, (t) => {
|
|
135
|
+
t.key === "Enter" && this.click();
|
|
137
136
|
});
|
|
138
|
-
this.stylesheet =
|
|
137
|
+
this.stylesheet = g, this.$render();
|
|
139
138
|
}
|
|
140
139
|
static get observedAttributes() {
|
|
141
140
|
return [
|
|
@@ -159,46 +158,52 @@ class w extends y {
|
|
|
159
158
|
* @return {string} 属性值
|
|
160
159
|
*/
|
|
161
160
|
updateContainerClasslist() {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
"
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|
+
);
|
|
171
175
|
}
|
|
172
176
|
$render() {
|
|
173
|
-
const
|
|
177
|
+
const t = this.getAttrBoolean("link") ? "a" : "button";
|
|
174
178
|
this.shadowRoot.innerHTML = `
|
|
175
|
-
<${
|
|
179
|
+
<${t} class="ea-button" part="container" tabindex="-1">
|
|
180
|
+
<ea-icon class="ea-button__icon" part="icon"></ea-icon>
|
|
176
181
|
<slot></slot>
|
|
177
|
-
</${
|
|
178
|
-
`, 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();
|
|
179
184
|
}
|
|
180
185
|
connectedCallback() {
|
|
181
|
-
var
|
|
182
|
-
super.connectedCallback(), (
|
|
183
|
-
signal:
|
|
184
|
-
}), 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) => {
|
|
185
190
|
if (this["button-type"] === "submit") {
|
|
186
|
-
const
|
|
187
|
-
|
|
191
|
+
const r = this.getForm();
|
|
192
|
+
r && (o.preventDefault(), r.dispatchEvent(new Event("submit")));
|
|
188
193
|
} else if (this["button-type"] === "reset") {
|
|
189
|
-
const
|
|
190
|
-
|
|
194
|
+
const r = this.getForm();
|
|
195
|
+
r && (o.preventDefault(), r.reset());
|
|
191
196
|
}
|
|
192
|
-
})
|
|
197
|
+
});
|
|
193
198
|
}
|
|
194
199
|
$beforeUnmounted() {
|
|
195
|
-
var
|
|
196
|
-
(
|
|
200
|
+
var t;
|
|
201
|
+
(t = e(this, n)) == null || t.abort();
|
|
197
202
|
}
|
|
198
203
|
}
|
|
199
|
-
a = new WeakMap(), n = new WeakMap(),
|
|
200
|
-
window.customElements.get("ea-button") || window.customElements.define("ea-button",
|
|
201
|
-
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 {
|
|
202
207
|
constructor() {
|
|
203
208
|
super();
|
|
204
209
|
/**
|
|
@@ -212,32 +217,32 @@ class E extends g {
|
|
|
212
217
|
disabled: {
|
|
213
218
|
type: Boolean,
|
|
214
219
|
default: !1,
|
|
215
|
-
observer: (
|
|
216
|
-
this.querySelectorAll("ea-button").forEach((
|
|
217
|
-
|
|
220
|
+
observer: (t) => {
|
|
221
|
+
this.querySelectorAll("ea-button").forEach((o) => {
|
|
222
|
+
o.setAttribute("disabled", t);
|
|
218
223
|
});
|
|
219
224
|
}
|
|
220
225
|
},
|
|
221
226
|
size: {
|
|
222
227
|
type: ["small", "normal", "large"],
|
|
223
228
|
default: "normal",
|
|
224
|
-
observer: (
|
|
225
|
-
this.querySelectorAll("ea-button").forEach((
|
|
226
|
-
|
|
229
|
+
observer: (t) => {
|
|
230
|
+
this.querySelectorAll("ea-button").forEach((o) => {
|
|
231
|
+
o.setAttribute("size", t);
|
|
227
232
|
});
|
|
228
233
|
}
|
|
229
234
|
},
|
|
230
235
|
type: {
|
|
231
236
|
type: ["primary", "success", "warning", "danger", "normal"],
|
|
232
237
|
default: "normal",
|
|
233
|
-
observer: (
|
|
234
|
-
this.querySelectorAll("ea-button").forEach((
|
|
235
|
-
|
|
238
|
+
observer: (t) => {
|
|
239
|
+
this.querySelectorAll("ea-button").forEach((o) => {
|
|
240
|
+
o.setAttribute("type", t);
|
|
236
241
|
});
|
|
237
242
|
}
|
|
238
243
|
}
|
|
239
244
|
}));
|
|
240
|
-
this.stylesheet =
|
|
245
|
+
this.stylesheet = w, this.$render();
|
|
241
246
|
}
|
|
242
247
|
static get observedAttributes() {
|
|
243
248
|
return [...super.observedAttributes, "disabled", "size", "type"];
|
|
@@ -255,6 +260,6 @@ class E extends g {
|
|
|
255
260
|
}
|
|
256
261
|
window.customElements.get("ea-button-group") || window.customElements.define("ea-button-group", E);
|
|
257
262
|
export {
|
|
258
|
-
|
|
263
|
+
A as EaButton,
|
|
259
264
|
E as EaButtonGroup
|
|
260
265
|
};
|