easy-component-ui 3.0.13 → 3.0.14
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/package.json +8 -2
- package/dist/assets/icon.css +0 -1
- package/dist/components/Base.js +0 -874
- package/dist/components/ea-alert.js +0 -213
- package/dist/components/ea-avatar.js +0 -164
- package/dist/components/ea-backtop.js +0 -136
- package/dist/components/ea-badge.js +0 -144
- package/dist/components/ea-breadcrumb.js +0 -148
- package/dist/components/ea-button.js +0 -266
- package/dist/components/ea-calendar.js +0 -10
- package/dist/components/ea-calendar2.js +0 -673
- package/dist/components/ea-card.js +0 -121
- package/dist/components/ea-carousel.js +0 -415
- package/dist/components/ea-checkbox.js +0 -446
- package/dist/components/ea-collapse.js +0 -313
- package/dist/components/ea-color-picker.js +0 -888
- package/dist/components/ea-container.js +0 -206
- package/dist/components/ea-countdown.js +0 -142
- package/dist/components/ea-date-picker.js +0 -649
- package/dist/components/ea-descriptions.js +0 -474
- package/dist/components/ea-dialog.js +0 -249
- package/dist/components/ea-drawer.js +0 -216
- package/dist/components/ea-dropdown.js +0 -228
- package/dist/components/ea-empty.js +0 -93
- package/dist/components/ea-icon.js +0 -158
- package/dist/components/ea-image-preview.js +0 -532
- package/dist/components/ea-image.js +0 -327
- package/dist/components/ea-infinite-scroll.js +0 -109
- package/dist/components/ea-input-number.js +0 -367
- package/dist/components/ea-input.js +0 -588
- package/dist/components/ea-layout.js +0 -132
- package/dist/components/ea-link.js +0 -101
- package/dist/components/ea-menu.js +0 -433
- package/dist/components/ea-message-box.js +0 -624
- package/dist/components/ea-message.js +0 -314
- package/dist/components/ea-notification.js +0 -331
- package/dist/components/ea-overlay.js +0 -168
- package/dist/components/ea-page-header.js +0 -108
- package/dist/components/ea-pagination.js +0 -481
- package/dist/components/ea-popconfirm.js +0 -275
- package/dist/components/ea-popover.js +0 -147
- package/dist/components/ea-popper.js +0 -203
- package/dist/components/ea-progress.js +0 -286
- package/dist/components/ea-radio.js +0 -364
- package/dist/components/ea-rate.js +0 -241
- package/dist/components/ea-result.js +0 -100
- package/dist/components/ea-scrollbar.js +0 -235
- package/dist/components/ea-segmented.js +0 -215
- package/dist/components/ea-select.js +0 -609
- package/dist/components/ea-skeleton.js +0 -263
- package/dist/components/ea-slider.js +0 -430
- package/dist/components/ea-space.js +0 -123
- package/dist/components/ea-splitter.js +0 -233
- package/dist/components/ea-statistic.js +0 -74
- package/dist/components/ea-steps.js +0 -346
- package/dist/components/ea-switch.js +0 -271
- package/dist/components/ea-table.js +0 -1135
- package/dist/components/ea-tabs.js +0 -501
- package/dist/components/ea-tag.js +0 -228
- package/dist/components/ea-text.js +0 -113
- package/dist/components/ea-time-picker.js +0 -510
- package/dist/components/ea-timeline.js +0 -185
- package/dist/components/ea-tooltip.js +0 -161
- package/dist/components/ea-tour.js +0 -544
- package/dist/components/ea-transfer.js +0 -949
- package/dist/components/ea-tree.js +0 -1125
- package/dist/components/index.js +0 -60
- package/dist/core/FormBase.js +0 -238
- package/dist/css/ea-alert.style.js +0 -4
- package/dist/css/ea-aside.style.js +0 -4
- package/dist/css/ea-avatar.style.js +0 -4
- package/dist/css/ea-backtop.style.js +0 -4
- package/dist/css/ea-badge.style.js +0 -4
- package/dist/css/ea-breadcrumb-item.style.js +0 -4
- package/dist/css/ea-breadcrumb.style.js +0 -4
- package/dist/css/ea-button-group.style.js +0 -4
- package/dist/css/ea-button.style.js +0 -4
- package/dist/css/ea-calendar.style.js +0 -4
- package/dist/css/ea-card.style.js +0 -4
- package/dist/css/ea-carousel-item.style.js +0 -4
- package/dist/css/ea-carousel.style.js +0 -4
- package/dist/css/ea-check-tag.style.js +0 -4
- package/dist/css/ea-checkbox-group.style.js +0 -4
- package/dist/css/ea-checkbox.style.js +0 -4
- package/dist/css/ea-col.style.js +0 -4
- package/dist/css/ea-collapse-item.style.js +0 -4
- package/dist/css/ea-collapse.style.js +0 -4
- package/dist/css/ea-color-picker-panel.style.js +0 -4
- package/dist/css/ea-color-picker.style.js +0 -4
- package/dist/css/ea-container.style.js +0 -4
- package/dist/css/ea-date-picker.style.js +0 -4
- package/dist/css/ea-descriptions-item.style.js +0 -4
- package/dist/css/ea-descriptions.style.js +0 -4
- package/dist/css/ea-dialog.style.js +0 -4
- package/dist/css/ea-drawer.style.js +0 -4
- package/dist/css/ea-dropdown-item.style.js +0 -4
- package/dist/css/ea-dropdown-menu.style.js +0 -4
- package/dist/css/ea-dropdown.style.js +0 -4
- package/dist/css/ea-empty.style.js +0 -4
- package/dist/css/ea-footer.style.js +0 -4
- package/dist/css/ea-header.style.js +0 -4
- package/dist/css/ea-icon.style.js +0 -4
- package/dist/css/ea-image-preview.style.js +0 -4
- package/dist/css/ea-image.style.js +0 -4
- package/dist/css/ea-infinite-scroll.style.js +0 -4
- package/dist/css/ea-input-number.style.js +0 -4
- package/dist/css/ea-input.style.js +0 -4
- package/dist/css/ea-link.style.js +0 -4
- package/dist/css/ea-main.style.js +0 -4
- package/dist/css/ea-menu-item-group.style.js +0 -4
- package/dist/css/ea-menu-item.style.js +0 -4
- package/dist/css/ea-menu.style.js +0 -4
- package/dist/css/ea-message-box.style.js +0 -4
- package/dist/css/ea-message.style.js +0 -4
- package/dist/css/ea-notification.style.js +0 -4
- package/dist/css/ea-option-gropu.style.js +0 -4
- package/dist/css/ea-option.style.js +0 -4
- package/dist/css/ea-overlay.style.js +0 -4
- package/dist/css/ea-page-header.style.js +0 -4
- package/dist/css/ea-pagination.style.js +0 -4
- package/dist/css/ea-popconfirm.style.js +0 -4
- package/dist/css/ea-popover.style.js +0 -4
- package/dist/css/ea-popper.style.js +0 -4
- package/dist/css/ea-progress.style.js +0 -4
- package/dist/css/ea-radio-group.style.js +0 -4
- package/dist/css/ea-radio.style.js +0 -4
- package/dist/css/ea-rate.style.js +0 -4
- package/dist/css/ea-result.style.js +0 -4
- package/dist/css/ea-row.style.js +0 -4
- package/dist/css/ea-scrollbar.style.js +0 -4
- package/dist/css/ea-segmented.style.js +0 -4
- package/dist/css/ea-select.style.js +0 -4
- package/dist/css/ea-skeleton-item.style.js +0 -4
- package/dist/css/ea-skeleton.style.js +0 -4
- package/dist/css/ea-slider.style.js +0 -4
- package/dist/css/ea-space.style.js +0 -4
- package/dist/css/ea-splitter-bar.style.js +0 -4
- package/dist/css/ea-splitter-panel.style.js +0 -4
- package/dist/css/ea-splitter.style.js +0 -4
- package/dist/css/ea-statistic.style.js +0 -4
- package/dist/css/ea-step.style.js +0 -4
- package/dist/css/ea-steps.style.js +0 -4
- package/dist/css/ea-sub-menu.style.js +0 -4
- package/dist/css/ea-switch.style.js +0 -4
- package/dist/css/ea-tab-panel.style.js +0 -4
- package/dist/css/ea-tab.style.js +0 -4
- package/dist/css/ea-table-column.style.js +0 -4
- package/dist/css/ea-table.style.js +0 -4
- package/dist/css/ea-tabs.style.js +0 -4
- package/dist/css/ea-tag.style.js +0 -4
- package/dist/css/ea-text.style.js +0 -4
- package/dist/css/ea-time-picker.style.js +0 -4
- package/dist/css/ea-timeline-item.style.js +0 -4
- package/dist/css/ea-timeline.style.js +0 -4
- package/dist/css/ea-tooltip.style.js +0 -4
- package/dist/css/ea-tour-step.style.js +0 -4
- package/dist/css/ea-tour.style.js +0 -4
- package/dist/css/ea-transfer.style.js +0 -5
- package/dist/css/ea-tree.style.js +0 -6
- package/dist/css/ea-ui-component.style.js +0 -4
- package/dist/favicon.ico +0 -0
- package/dist/utils/Color.js +0 -439
- package/dist/utils/I18nManager.js +0 -218
- package/dist/utils/Utils.js +0 -65
- package/dist/utils/Variables.js +0 -12
- package/dist/utils/parseTime.js +0 -73
- package/dist/utils/timeout.js +0 -9
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
var U = Object.defineProperty;
|
|
2
|
-
var $ = (i) => {
|
|
3
|
-
throw TypeError(i);
|
|
4
|
-
};
|
|
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 {
|
|
14
|
-
constructor() {
|
|
15
|
-
super();
|
|
16
|
-
/** @type {HTMLElement} */
|
|
17
|
-
o(this, r);
|
|
18
|
-
/** @type {HTMLElement} */
|
|
19
|
-
o(this, u);
|
|
20
|
-
/** @type {HTMLElement} */
|
|
21
|
-
o(this, m);
|
|
22
|
-
/** @type {HTMLElement} */
|
|
23
|
-
o(this, f);
|
|
24
|
-
/** @type {AbortController} */
|
|
25
|
-
o(this, d);
|
|
26
|
-
/** @type {AbortController} */
|
|
27
|
-
o(this, a);
|
|
28
|
-
o(this, b, {
|
|
29
|
-
dangerouslyUseHTMLString: !1
|
|
30
|
-
});
|
|
31
|
-
T(this, "state", this.properties({
|
|
32
|
-
type: {
|
|
33
|
-
props: !0,
|
|
34
|
-
type: ["primary", "success", "warning", "info", "error"],
|
|
35
|
-
default: "info",
|
|
36
|
-
observer: (e) => {
|
|
37
|
-
const n = {
|
|
38
|
-
success: "circle-check",
|
|
39
|
-
error: "circle-xmark",
|
|
40
|
-
warning: "triangle-exclamation",
|
|
41
|
-
info: "circle-info",
|
|
42
|
-
primary: "circle-info"
|
|
43
|
-
};
|
|
44
|
-
s(this, u).name = n[e], this.updateContainerClasslist();
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
visible: {
|
|
48
|
-
props: !0,
|
|
49
|
-
type: Boolean,
|
|
50
|
-
default: !1,
|
|
51
|
-
observer: async (e) => {
|
|
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(
|
|
54
|
-
"transitionend",
|
|
55
|
-
() => {
|
|
56
|
-
s(this, l).call(this, "shown");
|
|
57
|
-
},
|
|
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(
|
|
60
|
-
"transitionend",
|
|
61
|
-
() => {
|
|
62
|
-
this.updateContainerClasslist(), s(this, l).call(this, "hidden");
|
|
63
|
-
},
|
|
64
|
-
{ once: !0, signal: s(this, a).signal }
|
|
65
|
-
));
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
message: {
|
|
69
|
-
props: !0,
|
|
70
|
-
type: String,
|
|
71
|
-
default: "",
|
|
72
|
-
observer: (e) => {
|
|
73
|
-
this.dangerouslyUseHTMLString ? s(this, m).innerHTML = e : s(this, m).innerText = e;
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
showClose: {
|
|
77
|
-
props: !0,
|
|
78
|
-
type: Boolean,
|
|
79
|
-
default: !1,
|
|
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
|
-
}));
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
placement: {
|
|
88
|
-
props: !0,
|
|
89
|
-
type: [
|
|
90
|
-
"top",
|
|
91
|
-
"top-left",
|
|
92
|
-
"top-right",
|
|
93
|
-
"bottom",
|
|
94
|
-
"bottom-left",
|
|
95
|
-
"bottom-right",
|
|
96
|
-
"middle"
|
|
97
|
-
],
|
|
98
|
-
default: "top",
|
|
99
|
-
observer: () => {
|
|
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();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}));
|
|
112
|
-
/**
|
|
113
|
-
* 触发冒泡事件
|
|
114
|
-
* @param {string} customEventName - 自定义事件名称
|
|
115
|
-
* @param {string} detail - 事件详情
|
|
116
|
-
*/
|
|
117
|
-
o(this, l, (e, n) => {
|
|
118
|
-
this.emit(e, {
|
|
119
|
-
detail: n,
|
|
120
|
-
bubbles: !0,
|
|
121
|
-
composed: !0
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
/**
|
|
125
|
-
* 关闭消息(公共方法)
|
|
126
|
-
*/
|
|
127
|
-
T(this, "close", () => {
|
|
128
|
-
this.visible = !1, s(this, l).call(this, "close");
|
|
129
|
-
});
|
|
130
|
-
/**
|
|
131
|
-
* 关闭按钮点击事件处理
|
|
132
|
-
*/
|
|
133
|
-
o(this, C, () => {
|
|
134
|
-
this.close();
|
|
135
|
-
});
|
|
136
|
-
/**
|
|
137
|
-
* 初始化消息位置
|
|
138
|
-
*/
|
|
139
|
-
o(this, w, () => {
|
|
140
|
-
const e = document.querySelectorAll(
|
|
141
|
-
`ea-message[placement="${this.placement}"]`
|
|
142
|
-
);
|
|
143
|
-
if (e.length <= 1) return;
|
|
144
|
-
const n = e[e.length - 2], c = n.style.getPropertyValue("--ea-message-y"), p = n.shadowRoot.querySelector(this.ns.cb()).getBoundingClientRect();
|
|
145
|
-
this.style.setProperty(
|
|
146
|
-
"--ea-message-y",
|
|
147
|
-
`${Number(c.replace("px", "")) + p.height + 8}px`
|
|
148
|
-
);
|
|
149
|
-
});
|
|
150
|
-
/**
|
|
151
|
-
* 隐藏消息
|
|
152
|
-
*/
|
|
153
|
-
o(this, v, () => {
|
|
154
|
-
const e = [
|
|
155
|
-
...document.querySelectorAll(`ea-message[placement="${this.placement}"]`)
|
|
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", "")
|
|
160
|
-
);
|
|
161
|
-
p.style.setProperty("--ea-message-y", `${q - x - 8}px`);
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
this.stylesheet = I, this.$render();
|
|
165
|
-
}
|
|
166
|
-
// ------- dangerouslyUseHTMLString -------
|
|
167
|
-
// #region
|
|
168
|
-
get dangerouslyUseHTMLString() {
|
|
169
|
-
return s(this, b).dangerouslyUseHTMLString;
|
|
170
|
-
}
|
|
171
|
-
set dangerouslyUseHTMLString(e) {
|
|
172
|
-
s(this, b).dangerouslyUseHTMLString = e;
|
|
173
|
-
}
|
|
174
|
-
// #endregion
|
|
175
|
-
// ------- end -------
|
|
176
|
-
static get observedAttributes() {
|
|
177
|
-
return [...super.observedAttributes, "placement"];
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* 获取 classlist 列表
|
|
181
|
-
* @return {string} 属性值
|
|
182
|
-
*/
|
|
183
|
-
updateContainerClasslist() {
|
|
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;
|
|
195
|
-
}
|
|
196
|
-
$render() {
|
|
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>
|
|
203
|
-
</div>
|
|
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")));
|
|
205
|
-
}
|
|
206
|
-
connectedCallback() {
|
|
207
|
-
super.connectedCallback();
|
|
208
|
-
}
|
|
209
|
-
$beforeUnmounted() {
|
|
210
|
-
var e, n;
|
|
211
|
-
(e = s(this, d)) == null || e.abort(), (n = s(this, a)) == null || n.abort();
|
|
212
|
-
}
|
|
213
|
-
}
|
|
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;
|
|
217
|
-
class g {
|
|
218
|
-
/**
|
|
219
|
-
* @param {EaMessageOptions} options
|
|
220
|
-
*/
|
|
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) => {
|
|
238
|
-
const e = document.createElement("ea-message");
|
|
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];
|
|
244
|
-
else
|
|
245
|
-
console.warn(
|
|
246
|
-
"[EaMessage] TypeError: options must be a string or an object."
|
|
247
|
-
);
|
|
248
|
-
return e;
|
|
249
|
-
});
|
|
250
|
-
/**
|
|
251
|
-
* 处理 duration 属性
|
|
252
|
-
*/
|
|
253
|
-
o(this, L, (t, e = 3e3) => {
|
|
254
|
-
e <= 0 || N(() => {
|
|
255
|
-
t.visible = !1;
|
|
256
|
-
}, e);
|
|
257
|
-
});
|
|
258
|
-
/**
|
|
259
|
-
* 处理 appendTo 属性
|
|
260
|
-
*/
|
|
261
|
-
o(this, S, (t, e) => {
|
|
262
|
-
if (e instanceof HTMLElement)
|
|
263
|
-
e.appendChild(t);
|
|
264
|
-
else {
|
|
265
|
-
const n = document.querySelector(e);
|
|
266
|
-
n ? n.appendChild(t) : document.body.appendChild(t);
|
|
267
|
-
}
|
|
268
|
-
});
|
|
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
|
-
);
|
|
280
|
-
});
|
|
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;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
E = new WeakMap(), M = new WeakMap(), L = new WeakMap(), S = new WeakMap(), H = new WeakMap();
|
|
287
|
-
const y = (i) => {
|
|
288
|
-
new g(i);
|
|
289
|
-
};
|
|
290
|
-
y.primary = (i) => new g({
|
|
291
|
-
message: i,
|
|
292
|
-
type: "primary"
|
|
293
|
-
});
|
|
294
|
-
y.success = (i) => new g({
|
|
295
|
-
message: i,
|
|
296
|
-
type: "success"
|
|
297
|
-
});
|
|
298
|
-
y.warning = (i) => new g({
|
|
299
|
-
message: i,
|
|
300
|
-
type: "warning"
|
|
301
|
-
});
|
|
302
|
-
y.info = (i) => new g({
|
|
303
|
-
message: i,
|
|
304
|
-
type: "info"
|
|
305
|
-
});
|
|
306
|
-
y.error = (i) => new g({
|
|
307
|
-
message: i,
|
|
308
|
-
type: "error"
|
|
309
|
-
});
|
|
310
|
-
window.$message = y;
|
|
311
|
-
export {
|
|
312
|
-
y as EaMessage,
|
|
313
|
-
j as EaMessageElement
|
|
314
|
-
};
|
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
var k = Object.defineProperty;
|
|
2
|
-
var I = (s) => {
|
|
3
|
-
throw TypeError(s);
|
|
4
|
-
};
|
|
5
|
-
var $ = (s, i, e) => i in s ? k(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
|
|
6
|
-
var C = (s, i, e) => $(s, typeof i != "symbol" ? i + "" : i, e), R = (s, i, e) => i.has(s) || I("Cannot " + e);
|
|
7
|
-
var t = (s, i, e) => (R(s, i, "read from private field"), e ? e.call(s) : i.get(s)), n = (s, i, e) => i.has(s) ? I("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, e), l = (s, i, e, o) => (R(s, i, "write to private field"), o ? o.call(s, e) : i.set(s, e), e);
|
|
8
|
-
import { t as A } from "../utils/timeout.js";
|
|
9
|
-
import { E as q } from "../utils/Utils.js";
|
|
10
|
-
import { B } from "./Base.js";
|
|
11
|
-
import { s as P } from "../css/ea-notification.style.js";
|
|
12
|
-
var v, E, _, L, S, x;
|
|
13
|
-
class z {
|
|
14
|
-
/**
|
|
15
|
-
* @param {EaNotificationOptions} options
|
|
16
|
-
*/
|
|
17
|
-
constructor(i) {
|
|
18
|
-
n(this, v, ["dangerouslyUseHTMLString", "message"]);
|
|
19
|
-
n(this, E, ["appendTo"]);
|
|
20
|
-
n(this, _, {
|
|
21
|
-
title: "",
|
|
22
|
-
dangerouslyUseHTMLString: !1,
|
|
23
|
-
message: "",
|
|
24
|
-
icon: "",
|
|
25
|
-
type: "info",
|
|
26
|
-
duration: 3e3,
|
|
27
|
-
placement: "top-right",
|
|
28
|
-
zIndex: 0,
|
|
29
|
-
showClose: !0,
|
|
30
|
-
closeIcon: "xmark",
|
|
31
|
-
appendTo: "body"
|
|
32
|
-
});
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
* @param {HTMLElement} el
|
|
36
|
-
* @param {EaNotificationOptions} options
|
|
37
|
-
* @returns
|
|
38
|
-
*/
|
|
39
|
-
n(this, L, (i) => {
|
|
40
|
-
const e = document.createElement("ea-notification");
|
|
41
|
-
for (const o in i) {
|
|
42
|
-
if (t(this, E).includes(o)) continue;
|
|
43
|
-
const p = i[o];
|
|
44
|
-
if (t(this, v).includes(o))
|
|
45
|
-
e[o] = p;
|
|
46
|
-
else {
|
|
47
|
-
const w = q.String.toLowerCamelCase(o);
|
|
48
|
-
e.setAttribute(w, p);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return e;
|
|
52
|
-
});
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
* @param {HTMLElement} el
|
|
56
|
-
* @param {HTMLElement | String} appendTo
|
|
57
|
-
* @returns
|
|
58
|
-
*/
|
|
59
|
-
n(this, S, (i, e) => {
|
|
60
|
-
if (!e) return document.body.appendChild(i);
|
|
61
|
-
if (e instanceof HTMLElement)
|
|
62
|
-
e.appendChild(i);
|
|
63
|
-
else if (typeof e == "string") {
|
|
64
|
-
const o = document.querySelector(e);
|
|
65
|
-
o ? o.appendChild(i) : document.body.appendChild(i);
|
|
66
|
-
} else
|
|
67
|
-
console.warn(
|
|
68
|
-
`[EaNotification] TypeError: ${e} is not a valid element or selector.`
|
|
69
|
-
);
|
|
70
|
-
});
|
|
71
|
-
/**
|
|
72
|
-
*
|
|
73
|
-
* @param {HTMLElement} el
|
|
74
|
-
* @param {number} duration
|
|
75
|
-
* @returns
|
|
76
|
-
*/
|
|
77
|
-
n(this, x, (i, e = 3e3) => {
|
|
78
|
-
i.visible = !0, i.addEventListener("hidden", () => i.remove()), e > 0 && A(() => {
|
|
79
|
-
i.visible = !1;
|
|
80
|
-
}, e);
|
|
81
|
-
});
|
|
82
|
-
C(this, "close", () => {
|
|
83
|
-
this.instance.close();
|
|
84
|
-
});
|
|
85
|
-
i = Object.assign({}, t(this, _), i);
|
|
86
|
-
const e = t(this, L).call(this, i);
|
|
87
|
-
this.instance = e, t(this, S).call(this, e, i.appendTo), t(this, x).call(this, e, i.duration);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
v = new WeakMap(), E = new WeakMap(), _ = new WeakMap(), L = new WeakMap(), S = new WeakMap(), x = new WeakMap();
|
|
91
|
-
const r = (s) => new z(s);
|
|
92
|
-
r.primary = (s) => r({
|
|
93
|
-
...s,
|
|
94
|
-
type: "primary"
|
|
95
|
-
});
|
|
96
|
-
r.success = (s) => r({
|
|
97
|
-
...s,
|
|
98
|
-
type: "success"
|
|
99
|
-
});
|
|
100
|
-
r.warning = (s) => r({
|
|
101
|
-
...s,
|
|
102
|
-
type: "warning"
|
|
103
|
-
});
|
|
104
|
-
r.info = (s) => r({
|
|
105
|
-
...s,
|
|
106
|
-
type: "info"
|
|
107
|
-
});
|
|
108
|
-
r.error = (s) => r({
|
|
109
|
-
...s,
|
|
110
|
-
type: "error"
|
|
111
|
-
});
|
|
112
|
-
var a, M, y, g, d, m, c, b, f, h, N, T, H;
|
|
113
|
-
class V extends B {
|
|
114
|
-
constructor() {
|
|
115
|
-
super();
|
|
116
|
-
/** @type {HTMLElement} */
|
|
117
|
-
n(this, a);
|
|
118
|
-
/** @type {HTMLElement} */
|
|
119
|
-
n(this, M);
|
|
120
|
-
/** @type {HTMLElement} */
|
|
121
|
-
n(this, y);
|
|
122
|
-
/** @type {HTMLElement} */
|
|
123
|
-
n(this, g);
|
|
124
|
-
/** @type {HTMLElement} */
|
|
125
|
-
n(this, d);
|
|
126
|
-
/** @type {HTMLElement} */
|
|
127
|
-
n(this, m);
|
|
128
|
-
/** @type {AbortController} */
|
|
129
|
-
n(this, c);
|
|
130
|
-
/** @type {AbortController} */
|
|
131
|
-
n(this, b);
|
|
132
|
-
n(this, f, {
|
|
133
|
-
dangerouslyUseHTMLString: !1,
|
|
134
|
-
message: ""
|
|
135
|
-
});
|
|
136
|
-
C(this, "state", this.properties({
|
|
137
|
-
type: {
|
|
138
|
-
type: ["primary", "success", "warning", "info", "error"],
|
|
139
|
-
default: "info",
|
|
140
|
-
observer: (e) => {
|
|
141
|
-
const o = {
|
|
142
|
-
success: "circle-check",
|
|
143
|
-
error: "circle-xmark",
|
|
144
|
-
warning: "triangle-exclamation",
|
|
145
|
-
info: "circle-info",
|
|
146
|
-
primary: "circle-info"
|
|
147
|
-
};
|
|
148
|
-
t(this, y).name = o[e], t(this, a).className = this.updateContainerClasslist();
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
title: {
|
|
152
|
-
type: String,
|
|
153
|
-
default: "",
|
|
154
|
-
observer: (e) => {
|
|
155
|
-
t(this, g).textContent = e;
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
visible: {
|
|
159
|
-
type: Boolean,
|
|
160
|
-
default: !1,
|
|
161
|
-
observer: async (e) => {
|
|
162
|
-
var o;
|
|
163
|
-
(o = t(this, c)) == null || o.abort(), l(this, c, new AbortController()), e ? (t(this, N).call(this), t(this, a).className = this.updateContainerClasslist(), t(this, h).call(this, "show"), t(this, a).offsetWidth, t(this, a).classList.add("is-show"), t(this, a).addEventListener(
|
|
164
|
-
"transitionend",
|
|
165
|
-
() => {
|
|
166
|
-
t(this, h).call(this, "shown");
|
|
167
|
-
},
|
|
168
|
-
{ once: !0, signal: t(this, c).signal }
|
|
169
|
-
)) : (t(this, T).call(this), t(this, a).classList.add("is-before-hide"), t(this, h).call(this, "hide"), t(this, a).addEventListener(
|
|
170
|
-
"transitionend",
|
|
171
|
-
() => {
|
|
172
|
-
t(this, a).className = this.updateContainerClasslist(), t(this, h).call(this, "hidden");
|
|
173
|
-
},
|
|
174
|
-
{ once: !0, signal: t(this, c).signal }
|
|
175
|
-
));
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
showClose: {
|
|
179
|
-
type: Boolean,
|
|
180
|
-
default: !1,
|
|
181
|
-
observer: (e) => {
|
|
182
|
-
t(this, a).className = this.updateContainerClasslist(), t(this, d).name = this["close-icon"];
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
closeIcon: {
|
|
186
|
-
type: String,
|
|
187
|
-
default: "xmark",
|
|
188
|
-
observer: (e) => {
|
|
189
|
-
this["show-close"] && (t(this, d).name = e);
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
placement: {
|
|
193
|
-
type: ["top-right", "top-left", "bottom-right", "bottom-left"],
|
|
194
|
-
default: "top-right",
|
|
195
|
-
observer: (e) => {
|
|
196
|
-
t(this, a).className = this.updateContainerClasslist();
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
zIndex: {
|
|
200
|
-
type: Number,
|
|
201
|
-
default: 0,
|
|
202
|
-
observer: (e) => {
|
|
203
|
-
t(this, a).style.setProperty("--z-index", e);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}));
|
|
207
|
-
n(this, h, (e, o) => {
|
|
208
|
-
this.emit(e, {
|
|
209
|
-
detail: o,
|
|
210
|
-
bubbles: !0,
|
|
211
|
-
composed: !0
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
C(this, "close", () => {
|
|
215
|
-
this.visible = !1, t(this, h).call(this, "close");
|
|
216
|
-
});
|
|
217
|
-
n(this, N, () => {
|
|
218
|
-
const e = document.querySelectorAll(
|
|
219
|
-
`ea-notification[placement="${this.placement}"]`
|
|
220
|
-
);
|
|
221
|
-
if (e.length <= 1) return;
|
|
222
|
-
const o = e[e.length - 2], p = o.style.getPropertyValue("--ea-notification-y"), u = o.shadowRoot.querySelector(".ea-notification").getBoundingClientRect();
|
|
223
|
-
this.style.setProperty(
|
|
224
|
-
"--ea-notification-y",
|
|
225
|
-
`${Number(p.replace("px", "")) + u.height + 8}px`
|
|
226
|
-
);
|
|
227
|
-
});
|
|
228
|
-
n(this, T, () => {
|
|
229
|
-
const e = [
|
|
230
|
-
...document.querySelectorAll(
|
|
231
|
-
`ea-notification[placement="${this.placement}"]`
|
|
232
|
-
)
|
|
233
|
-
], o = e.findIndex((u) => u === this), p = e.slice(o + 1), w = t(this, a).getBoundingClientRect().height;
|
|
234
|
-
p.forEach((u, O) => {
|
|
235
|
-
const U = Number(
|
|
236
|
-
u.style.getPropertyValue("--ea-notification-y").replace("px", "")
|
|
237
|
-
);
|
|
238
|
-
u.style.setProperty(
|
|
239
|
-
"--ea-notification-y",
|
|
240
|
-
`${U - w - 8}px`
|
|
241
|
-
);
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
n(this, H, () => {
|
|
245
|
-
this.visible = !1;
|
|
246
|
-
});
|
|
247
|
-
this.stylesheet = P, this.$render();
|
|
248
|
-
}
|
|
249
|
-
// ------- dangerouslyUseHTMLString -------
|
|
250
|
-
// #region
|
|
251
|
-
get dangerouslyUseHTMLString() {
|
|
252
|
-
return t(this, f).dangerouslyUseHTMLString;
|
|
253
|
-
}
|
|
254
|
-
set dangerouslyUseHTMLString(e) {
|
|
255
|
-
t(this, f).dangerouslyUseHTMLString = e;
|
|
256
|
-
}
|
|
257
|
-
// #endregion
|
|
258
|
-
// ------- end -------
|
|
259
|
-
// ------- message -------
|
|
260
|
-
// #region
|
|
261
|
-
get message() {
|
|
262
|
-
return t(this, f).message;
|
|
263
|
-
}
|
|
264
|
-
set message(e) {
|
|
265
|
-
t(this, f).message = e, this.dangerouslyUseHTMLString ? t(this, m).innerHTML = e : t(this, m).innerText = e;
|
|
266
|
-
}
|
|
267
|
-
// #endregion
|
|
268
|
-
// ------- end -------
|
|
269
|
-
static get observedAttributes() {
|
|
270
|
-
return q.Array.toLowerCamelCase([
|
|
271
|
-
"visible",
|
|
272
|
-
"title",
|
|
273
|
-
"message",
|
|
274
|
-
"type",
|
|
275
|
-
"icon",
|
|
276
|
-
"duration",
|
|
277
|
-
"placement",
|
|
278
|
-
"showClose",
|
|
279
|
-
"zIndex",
|
|
280
|
-
"closeIcon"
|
|
281
|
-
]);
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* 获取 classlist 列表
|
|
285
|
-
* @return {string} 属性值
|
|
286
|
-
*/
|
|
287
|
-
updateContainerClasslist() {
|
|
288
|
-
return this.computedClasslist("ea-notification", {
|
|
289
|
-
"--visible": this.visible,
|
|
290
|
-
["--" + this.type]: this.type,
|
|
291
|
-
"--show-close": this["show-close"],
|
|
292
|
-
["--" + this.placement]: this.placement
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
$render() {
|
|
296
|
-
this.shadowRoot.innerHTML = `
|
|
297
|
-
<div class="ea-notification" part='container'>
|
|
298
|
-
<ea-icon class="ea-notification__icon" part="icon"></ea-icon>
|
|
299
|
-
<div class="ea-notification__content">
|
|
300
|
-
<header class="ea-notification__header" part='header'>
|
|
301
|
-
<h2 class="ea-notification__title" part="title"> </h2>
|
|
302
|
-
<ea-icon class="ea-notification__close-icon" name="xmark" part='close-icon'></ea-icon>
|
|
303
|
-
</header>
|
|
304
|
-
<main class="ea-notification__main" part='main'> </main>
|
|
305
|
-
</div>
|
|
306
|
-
</div>
|
|
307
|
-
`, l(this, a, this.shadowRoot.querySelector(".ea-notification")), l(this, M, this.shadowRoot.querySelector(".ea-notification__header")), l(this, y, this.shadowRoot.querySelector(
|
|
308
|
-
".ea-notification__icon"
|
|
309
|
-
)), l(this, g, this.shadowRoot.querySelector(".ea-notification__title")), l(this, d, this.shadowRoot.querySelector(
|
|
310
|
-
".ea-notification__close-icon"
|
|
311
|
-
)), l(this, m, this.shadowRoot.querySelector(".ea-notification__main"));
|
|
312
|
-
}
|
|
313
|
-
connectedCallback() {
|
|
314
|
-
super.connectedCallback();
|
|
315
|
-
const e = new AbortController();
|
|
316
|
-
l(this, b, e), this["show-close"] && t(this, d).addEventListener("click", t(this, H), {
|
|
317
|
-
signal: e.signal
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
$beforeUnmounted() {
|
|
321
|
-
var e, o;
|
|
322
|
-
(e = t(this, c)) == null || e.abort(), (o = t(this, b)) == null || o.abort();
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
a = new WeakMap(), M = new WeakMap(), y = new WeakMap(), g = new WeakMap(), d = new WeakMap(), m = new WeakMap(), c = new WeakMap(), b = new WeakMap(), f = new WeakMap(), h = new WeakMap(), N = new WeakMap(), T = new WeakMap(), H = new WeakMap();
|
|
326
|
-
window.customElements.get("ea-notification") || window.customElements.define("ea-notification", V);
|
|
327
|
-
window.$notify = r;
|
|
328
|
-
export {
|
|
329
|
-
r as EaNotification,
|
|
330
|
-
V as EaNotificationElement
|
|
331
|
-
};
|