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,80 +1,91 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var U = Object.defineProperty;
|
|
2
|
+
var $ = (i) => {
|
|
3
|
+
throw TypeError(i);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
var k = (i, t, e) => t in i ? U(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
6
|
+
var T = (i, t, e) => k(i, typeof t != "symbol" ? t + "" : t, e), R = (i, t, e) => t.has(i) || $("Cannot " + e);
|
|
7
|
+
var s = (i, t, e) => (R(i, t, "read from private field"), e ? e.call(i) : t.get(i)), o = (i, t, e) => t.has(i) ? $("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), h = (i, t, e, n) => (R(i, t, "write to private field"), n ? n.call(i, e) : t.set(i, e), e);
|
|
8
|
+
import { n as A } from "./ea-calendar2.js";
|
|
9
|
+
import { B, h as P } from "./Base.js";
|
|
10
|
+
import { s as I } from "../css/ea-message.style.js";
|
|
11
|
+
import { t as N } from "../utils/timeout.js";
|
|
12
|
+
var r, u, m, f, d, a, b, l, C, w, v;
|
|
13
|
+
class j extends B {
|
|
13
14
|
constructor() {
|
|
14
15
|
super();
|
|
15
16
|
/** @type {HTMLElement} */
|
|
16
|
-
|
|
17
|
+
o(this, r);
|
|
17
18
|
/** @type {HTMLElement} */
|
|
18
|
-
|
|
19
|
+
o(this, u);
|
|
19
20
|
/** @type {HTMLElement} */
|
|
20
|
-
|
|
21
|
+
o(this, m);
|
|
21
22
|
/** @type {HTMLElement} */
|
|
22
|
-
|
|
23
|
+
o(this, f);
|
|
23
24
|
/** @type {AbortController} */
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
o(this, d);
|
|
26
|
+
/** @type {AbortController} */
|
|
27
|
+
o(this, a);
|
|
28
|
+
o(this, b, {
|
|
26
29
|
dangerouslyUseHTMLString: !1
|
|
27
30
|
});
|
|
28
|
-
|
|
31
|
+
T(this, "state", this.properties({
|
|
29
32
|
type: {
|
|
33
|
+
props: !0,
|
|
30
34
|
type: ["primary", "success", "warning", "info", "error"],
|
|
31
35
|
default: "info",
|
|
32
36
|
observer: (e) => {
|
|
33
|
-
const
|
|
34
|
-
success: "
|
|
35
|
-
error: "
|
|
36
|
-
warning: "
|
|
37
|
-
info: "
|
|
38
|
-
primary: "
|
|
37
|
+
const n = {
|
|
38
|
+
success: "circle-check",
|
|
39
|
+
error: "circle-xmark",
|
|
40
|
+
warning: "triangle-exclamation",
|
|
41
|
+
info: "circle-info",
|
|
42
|
+
primary: "circle-info"
|
|
39
43
|
};
|
|
40
|
-
|
|
44
|
+
s(this, u).name = n[e], this.updateContainerClasslist();
|
|
41
45
|
}
|
|
42
46
|
},
|
|
43
47
|
visible: {
|
|
48
|
+
props: !0,
|
|
44
49
|
type: Boolean,
|
|
45
50
|
default: !1,
|
|
46
51
|
observer: async (e) => {
|
|
47
|
-
var
|
|
48
|
-
(
|
|
52
|
+
var n;
|
|
53
|
+
(n = s(this, a)) == null || n.abort(), h(this, a, new AbortController()), e ? (s(this, w).call(this), this.updateContainerClasslist(), s(this, l).call(this, "show"), s(this, r).offsetWidth, s(this, r).classList.add(this.ns.m("is-show")), s(this, r).addEventListener(
|
|
49
54
|
"transitionend",
|
|
50
55
|
() => {
|
|
51
|
-
|
|
56
|
+
s(this, l).call(this, "shown");
|
|
52
57
|
},
|
|
53
|
-
{ once: !0, signal:
|
|
54
|
-
)) : (
|
|
58
|
+
{ once: !0, signal: s(this, a).signal }
|
|
59
|
+
)) : (s(this, v).call(this), s(this, r).classList.add(this.ns.m("before-hide")), s(this, l).call(this, "hide"), s(this, r).addEventListener(
|
|
55
60
|
"transitionend",
|
|
56
61
|
() => {
|
|
57
|
-
|
|
62
|
+
this.updateContainerClasslist(), s(this, l).call(this, "hidden");
|
|
58
63
|
},
|
|
59
|
-
{ once: !0, signal:
|
|
64
|
+
{ once: !0, signal: s(this, a).signal }
|
|
60
65
|
));
|
|
61
66
|
}
|
|
62
67
|
},
|
|
63
68
|
message: {
|
|
69
|
+
props: !0,
|
|
64
70
|
type: String,
|
|
65
71
|
default: "",
|
|
66
72
|
observer: (e) => {
|
|
67
|
-
this.dangerouslyUseHTMLString ?
|
|
73
|
+
this.dangerouslyUseHTMLString ? s(this, m).innerHTML = e : s(this, m).innerText = e;
|
|
68
74
|
}
|
|
69
75
|
},
|
|
70
76
|
showClose: {
|
|
77
|
+
props: !0,
|
|
71
78
|
type: Boolean,
|
|
72
79
|
default: !1,
|
|
73
|
-
observer: () => {
|
|
74
|
-
|
|
80
|
+
observer: (e) => {
|
|
81
|
+
var n;
|
|
82
|
+
this.updateContainerClasslist(), (n = s(this, d)) == null || n.abort(), e && (h(this, d, new AbortController()), s(this, f).addEventListener("click", s(this, C), {
|
|
83
|
+
signal: s(this, d).signal
|
|
84
|
+
}));
|
|
75
85
|
}
|
|
76
86
|
},
|
|
77
87
|
placement: {
|
|
88
|
+
props: !0,
|
|
78
89
|
type: [
|
|
79
90
|
"top",
|
|
80
91
|
"top-left",
|
|
@@ -86,166 +97,218 @@ class N extends U {
|
|
|
86
97
|
],
|
|
87
98
|
default: "top",
|
|
88
99
|
observer: () => {
|
|
89
|
-
this.
|
|
100
|
+
this.updateContainerClasslist();
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
icon: {
|
|
104
|
+
props: !0,
|
|
105
|
+
type: String,
|
|
106
|
+
default: "",
|
|
107
|
+
observer: (e) => {
|
|
108
|
+
s(this, u).name = e, this.updateContainerClasslist();
|
|
90
109
|
}
|
|
91
110
|
}
|
|
92
111
|
}));
|
|
93
|
-
|
|
112
|
+
/**
|
|
113
|
+
* 触发冒泡事件
|
|
114
|
+
* @param {string} customEventName - 自定义事件名称
|
|
115
|
+
* @param {string} detail - 事件详情
|
|
116
|
+
*/
|
|
117
|
+
o(this, l, (e, n) => {
|
|
94
118
|
this.emit(e, {
|
|
95
|
-
detail:
|
|
119
|
+
detail: n,
|
|
96
120
|
bubbles: !0,
|
|
97
121
|
composed: !0
|
|
98
122
|
});
|
|
99
123
|
});
|
|
100
|
-
|
|
101
|
-
|
|
124
|
+
/**
|
|
125
|
+
* 关闭消息(公共方法)
|
|
126
|
+
*/
|
|
127
|
+
T(this, "close", () => {
|
|
128
|
+
this.visible = !1, s(this, l).call(this, "close");
|
|
102
129
|
});
|
|
103
|
-
|
|
130
|
+
/**
|
|
131
|
+
* 关闭按钮点击事件处理
|
|
132
|
+
*/
|
|
133
|
+
o(this, C, () => {
|
|
134
|
+
this.close();
|
|
135
|
+
});
|
|
136
|
+
/**
|
|
137
|
+
* 初始化消息位置
|
|
138
|
+
*/
|
|
139
|
+
o(this, w, () => {
|
|
104
140
|
const e = document.querySelectorAll(
|
|
105
141
|
`ea-message[placement="${this.placement}"]`
|
|
106
142
|
);
|
|
107
143
|
if (e.length <= 1) return;
|
|
108
|
-
const
|
|
144
|
+
const n = e[e.length - 2], c = n.style.getPropertyValue("--ea-message-y"), p = n.shadowRoot.querySelector(this.ns.cb()).getBoundingClientRect();
|
|
109
145
|
this.style.setProperty(
|
|
110
146
|
"--ea-message-y",
|
|
111
|
-
`${Number(c.replace("px", "")) +
|
|
147
|
+
`${Number(c.replace("px", "")) + p.height + 8}px`
|
|
112
148
|
);
|
|
113
149
|
});
|
|
114
|
-
|
|
150
|
+
/**
|
|
151
|
+
* 隐藏消息
|
|
152
|
+
*/
|
|
153
|
+
o(this, v, () => {
|
|
115
154
|
const e = [
|
|
116
155
|
...document.querySelectorAll(`ea-message[placement="${this.placement}"]`)
|
|
117
|
-
],
|
|
118
|
-
c.forEach((
|
|
119
|
-
const
|
|
120
|
-
|
|
156
|
+
], n = e.findIndex((p) => p === this), c = e.slice(n + 1), x = s(this, r).getBoundingClientRect().height;
|
|
157
|
+
c.forEach((p) => {
|
|
158
|
+
const q = Number(
|
|
159
|
+
p.style.getPropertyValue("--ea-message-y").replace("px", "")
|
|
121
160
|
);
|
|
122
|
-
|
|
161
|
+
p.style.setProperty("--ea-message-y", `${q - x - 8}px`);
|
|
123
162
|
});
|
|
124
163
|
});
|
|
125
|
-
this.stylesheet =
|
|
164
|
+
this.stylesheet = I, this.$render();
|
|
126
165
|
}
|
|
127
166
|
// ------- dangerouslyUseHTMLString -------
|
|
128
167
|
// #region
|
|
129
168
|
get dangerouslyUseHTMLString() {
|
|
130
|
-
return
|
|
169
|
+
return s(this, b).dangerouslyUseHTMLString;
|
|
131
170
|
}
|
|
132
171
|
set dangerouslyUseHTMLString(e) {
|
|
133
|
-
|
|
172
|
+
s(this, b).dangerouslyUseHTMLString = e;
|
|
134
173
|
}
|
|
135
174
|
// #endregion
|
|
136
175
|
// ------- end -------
|
|
137
176
|
static get observedAttributes() {
|
|
138
|
-
return [
|
|
139
|
-
...super.observedAttributes,
|
|
140
|
-
"type",
|
|
141
|
-
"visible",
|
|
142
|
-
"message",
|
|
143
|
-
"showClose",
|
|
144
|
-
"placement"
|
|
145
|
-
];
|
|
177
|
+
return [...super.observedAttributes, "placement"];
|
|
146
178
|
}
|
|
147
179
|
/**
|
|
148
180
|
* 获取 classlist 列表
|
|
149
181
|
* @return {string} 属性值
|
|
150
182
|
*/
|
|
151
183
|
updateContainerClasslist() {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
184
|
+
const e = this.computedClasslist(
|
|
185
|
+
this.ns.b(),
|
|
186
|
+
{
|
|
187
|
+
["--" + this.type]: this.type,
|
|
188
|
+
["--" + this.placement]: this.placement,
|
|
189
|
+
"--visible": this.visible,
|
|
190
|
+
"--show-close": this.showClose
|
|
191
|
+
},
|
|
192
|
+
{}
|
|
193
|
+
);
|
|
194
|
+
return s(this, r) && (s(this, r).className = e), e;
|
|
158
195
|
}
|
|
159
196
|
$render() {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
<
|
|
164
|
-
<
|
|
197
|
+
const e = A("message");
|
|
198
|
+
this.ns = e, this.shadowRoot.innerHTML = P(`
|
|
199
|
+
<div class="${e.b()}" part="container">
|
|
200
|
+
<ea-icon class="${e.e("icon")}" part="icon"></ea-icon>
|
|
201
|
+
<div class="${e.e("content")}" part="content-wrap"></div>
|
|
202
|
+
<ea-icon class="${e.e("icon-close")}" name="xmark" part="close-icon"></ea-icon>
|
|
165
203
|
</div>
|
|
166
|
-
|
|
167
|
-
".ea-message__content"
|
|
168
|
-
)), d(this, y, this.shadowRoot.querySelector(
|
|
169
|
-
".ea-message__icon-close"
|
|
170
|
-
));
|
|
204
|
+
`), h(this, r, this.shadowRoot.querySelector(e.cb())), h(this, u, this.shadowRoot.querySelector(e.ce("icon"))), h(this, m, this.shadowRoot.querySelector(e.ce("content"))), h(this, f, this.shadowRoot.querySelector(e.ce("icon-close")));
|
|
171
205
|
}
|
|
172
206
|
connectedCallback() {
|
|
173
|
-
super.connectedCallback()
|
|
207
|
+
super.connectedCallback();
|
|
174
208
|
}
|
|
175
209
|
$beforeUnmounted() {
|
|
176
|
-
var e;
|
|
177
|
-
(e =
|
|
210
|
+
var e, n;
|
|
211
|
+
(e = s(this, d)) == null || e.abort(), (n = s(this, a)) == null || n.abort();
|
|
178
212
|
}
|
|
179
213
|
}
|
|
180
|
-
|
|
181
|
-
window.customElements.get("ea-message") || window.customElements.define("ea-message",
|
|
182
|
-
var
|
|
214
|
+
r = new WeakMap(), u = new WeakMap(), m = new WeakMap(), f = new WeakMap(), d = new WeakMap(), a = new WeakMap(), b = new WeakMap(), l = new WeakMap(), C = new WeakMap(), w = new WeakMap(), v = new WeakMap();
|
|
215
|
+
window.customElements.get("ea-message") || window.customElements.define("ea-message", j);
|
|
216
|
+
var E, M, L, S, H;
|
|
183
217
|
class g {
|
|
184
218
|
/**
|
|
185
219
|
* @param {EaMessageOptions} options
|
|
186
220
|
*/
|
|
187
|
-
constructor(
|
|
188
|
-
|
|
189
|
-
|
|
221
|
+
constructor(t) {
|
|
222
|
+
o(this, E, [
|
|
223
|
+
"dangerouslyUseHTMLString",
|
|
224
|
+
"message",
|
|
225
|
+
"placement",
|
|
226
|
+
"type",
|
|
227
|
+
"showClose",
|
|
228
|
+
"duration",
|
|
229
|
+
"offset",
|
|
230
|
+
"icon"
|
|
231
|
+
]);
|
|
232
|
+
/**
|
|
233
|
+
* 渲染消息实例
|
|
234
|
+
* @param {EaMessageOptions} options
|
|
235
|
+
* @return {HTMLElement}
|
|
236
|
+
*/
|
|
237
|
+
o(this, M, (t) => {
|
|
190
238
|
const e = document.createElement("ea-message");
|
|
191
|
-
if (
|
|
192
|
-
e.message =
|
|
193
|
-
else if (
|
|
194
|
-
for (const
|
|
195
|
-
e[
|
|
239
|
+
if (t instanceof String)
|
|
240
|
+
e.message = t;
|
|
241
|
+
else if (t instanceof Object)
|
|
242
|
+
for (const n in t)
|
|
243
|
+
e[n] = t[n];
|
|
196
244
|
else
|
|
197
|
-
console.warn(
|
|
245
|
+
console.warn(
|
|
246
|
+
"[EaMessage] TypeError: options must be a string or an object."
|
|
247
|
+
);
|
|
198
248
|
return e;
|
|
199
249
|
});
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
250
|
+
/**
|
|
251
|
+
* 处理 duration 属性
|
|
252
|
+
*/
|
|
253
|
+
o(this, L, (t, e = 3e3) => {
|
|
254
|
+
e <= 0 || N(() => {
|
|
255
|
+
t.visible = !1;
|
|
203
256
|
}, e);
|
|
204
257
|
});
|
|
205
|
-
|
|
258
|
+
/**
|
|
259
|
+
* 处理 appendTo 属性
|
|
260
|
+
*/
|
|
261
|
+
o(this, S, (t, e) => {
|
|
206
262
|
if (e instanceof HTMLElement)
|
|
207
|
-
e.appendChild(
|
|
263
|
+
e.appendChild(t);
|
|
208
264
|
else {
|
|
209
|
-
const
|
|
210
|
-
|
|
265
|
+
const n = document.querySelector(e);
|
|
266
|
+
n ? n.appendChild(t) : document.body.appendChild(t);
|
|
211
267
|
}
|
|
212
268
|
});
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
269
|
+
/**
|
|
270
|
+
* 处理 hide 属性
|
|
271
|
+
*/
|
|
272
|
+
o(this, H, (t, e) => {
|
|
273
|
+
t.addEventListener(
|
|
274
|
+
"hidden",
|
|
275
|
+
(n) => {
|
|
276
|
+
e == null || e(n), t.remove();
|
|
277
|
+
},
|
|
278
|
+
{ once: !0 }
|
|
279
|
+
);
|
|
217
280
|
});
|
|
218
|
-
this.options =
|
|
219
|
-
const e =
|
|
220
|
-
|
|
281
|
+
this.options = s(this, E).reduce((n, c) => (t[c] && (n[c] = t[c]), n), {}), this.options.placement = this.options.placement || "top";
|
|
282
|
+
const e = s(this, M).call(this, this.options);
|
|
283
|
+
s(this, S).call(this, e, t.appendTo), s(this, L).call(this, e, t.duration), s(this, H).call(this, e, t.onClose), e.visible = !0;
|
|
221
284
|
}
|
|
222
285
|
}
|
|
223
|
-
|
|
224
|
-
const
|
|
225
|
-
new g(
|
|
286
|
+
E = new WeakMap(), M = new WeakMap(), L = new WeakMap(), S = new WeakMap(), H = new WeakMap();
|
|
287
|
+
const y = (i) => {
|
|
288
|
+
new g(i);
|
|
226
289
|
};
|
|
227
|
-
|
|
228
|
-
message:
|
|
290
|
+
y.primary = (i) => new g({
|
|
291
|
+
message: i,
|
|
229
292
|
type: "primary"
|
|
230
293
|
});
|
|
231
|
-
|
|
232
|
-
message:
|
|
294
|
+
y.success = (i) => new g({
|
|
295
|
+
message: i,
|
|
233
296
|
type: "success"
|
|
234
297
|
});
|
|
235
|
-
|
|
236
|
-
message:
|
|
298
|
+
y.warning = (i) => new g({
|
|
299
|
+
message: i,
|
|
237
300
|
type: "warning"
|
|
238
301
|
});
|
|
239
|
-
|
|
240
|
-
message:
|
|
302
|
+
y.info = (i) => new g({
|
|
303
|
+
message: i,
|
|
241
304
|
type: "info"
|
|
242
305
|
});
|
|
243
|
-
|
|
244
|
-
message:
|
|
306
|
+
y.error = (i) => new g({
|
|
307
|
+
message: i,
|
|
245
308
|
type: "error"
|
|
246
309
|
});
|
|
247
|
-
window.$message =
|
|
310
|
+
window.$message = y;
|
|
248
311
|
export {
|
|
249
|
-
|
|
250
|
-
|
|
312
|
+
y as EaMessage,
|
|
313
|
+
j as EaMessageElement
|
|
251
314
|
};
|