easy-component-ui 3.0.12 → 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/package.json +308 -304
- package/dist/assets/icon.css +0 -1
- package/dist/components/Base.js +0 -873
- package/dist/components/ea-alert.js +0 -196
- package/dist/components/ea-avatar.js +0 -159
- 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 -265
- package/dist/components/ea-calendar.js +0 -10
- package/dist/components/ea-calendar2.js +0 -671
- package/dist/components/ea-card.js +0 -85
- 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 -891
- package/dist/components/ea-container.js +0 -177
- 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 -211
- package/dist/components/ea-dropdown.js +0 -228
- package/dist/components/ea-empty.js +0 -93
- package/dist/components/ea-icon.js +0 -68
- package/dist/components/ea-image-preview.js +0 -488
- package/dist/components/ea-image.js +0 -302
- 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 -125
- package/dist/components/ea-link.js +0 -101
- package/dist/components/ea-loading.js +0 -151
- package/dist/components/ea-menu.js +0 -433
- package/dist/components/ea-message-box.js +0 -624
- package/dist/components/ea-message.js +0 -251
- package/dist/components/ea-notification.js +0 -331
- package/dist/components/ea-overlay.js +0 -167
- 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 -123
- 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 -421
- package/dist/components/ea-space.js +0 -123
- package/dist/components/ea-splitter.js +0 -217
- 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 -1124
- 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 -514
- package/dist/components/ea-timeline.js +0 -185
- package/dist/components/ea-tooltip.js +0 -121
- 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 -61
- 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,251 +0,0 @@
|
|
|
1
|
-
var R = Object.defineProperty;
|
|
2
|
-
var T = (t) => {
|
|
3
|
-
throw TypeError(t);
|
|
4
|
-
};
|
|
5
|
-
var q = (t, s, e) => s in t ? R(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
6
|
-
var S = (t, s, e) => q(t, typeof s != "symbol" ? s + "" : s, e), _ = (t, s, e) => s.has(t) || T("Cannot " + e);
|
|
7
|
-
var i = (t, s, e) => (_(t, s, "read from private field"), e ? e.call(t) : s.get(t)), n = (t, s, e) => s.has(t) ? T("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), d = (t, s, e, a) => (_(t, s, "write to private field"), a ? a.call(t, e) : s.set(t, e), e);
|
|
8
|
-
import { B as U } from "./Base.js";
|
|
9
|
-
import { s as $ } from "../css/ea-message.style.js";
|
|
10
|
-
import { t as B } from "../utils/timeout.js";
|
|
11
|
-
var o, u, m, y, r, f, l, b, w;
|
|
12
|
-
class N extends U {
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
/** @type {HTMLElement} */
|
|
16
|
-
n(this, o);
|
|
17
|
-
/** @type {HTMLElement} */
|
|
18
|
-
n(this, u);
|
|
19
|
-
/** @type {HTMLElement} */
|
|
20
|
-
n(this, m);
|
|
21
|
-
/** @type {HTMLElement} */
|
|
22
|
-
n(this, y);
|
|
23
|
-
/** @type {AbortController} */
|
|
24
|
-
n(this, r);
|
|
25
|
-
n(this, f, {
|
|
26
|
-
dangerouslyUseHTMLString: !1
|
|
27
|
-
});
|
|
28
|
-
S(this, "state", this.properties({
|
|
29
|
-
type: {
|
|
30
|
-
type: ["primary", "success", "warning", "info", "error"],
|
|
31
|
-
default: "info",
|
|
32
|
-
observer: (e) => {
|
|
33
|
-
const a = {
|
|
34
|
-
success: "icon-ok-circled",
|
|
35
|
-
error: "icon-cancel-circled",
|
|
36
|
-
warning: "icon-attention-alt",
|
|
37
|
-
info: "icon-info",
|
|
38
|
-
primary: "icon-info"
|
|
39
|
-
};
|
|
40
|
-
i(this, u).icon = a[e], i(this, o).className = this.updateContainerClasslist();
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
visible: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: !1,
|
|
46
|
-
observer: async (e) => {
|
|
47
|
-
var a;
|
|
48
|
-
(a = i(this, r)) == null || a.abort(), d(this, r, new AbortController()), e ? (i(this, b).call(this), i(this, o).className = this.updateContainerClasslist(), i(this, l).call(this, "show"), i(this, o).offsetWidth, i(this, o).classList.add("ea-message--is-show"), i(this, o).addEventListener(
|
|
49
|
-
"transitionend",
|
|
50
|
-
() => {
|
|
51
|
-
i(this, l).call(this, "shown");
|
|
52
|
-
},
|
|
53
|
-
{ once: !0, signal: i(this, r).signal }
|
|
54
|
-
)) : (i(this, w).call(this), i(this, o).classList.add("ea-message--before-hide"), i(this, l).call(this, "hide"), i(this, o).addEventListener(
|
|
55
|
-
"transitionend",
|
|
56
|
-
() => {
|
|
57
|
-
i(this, o).className = this.updateContainerClasslist(), i(this, l).call(this, "hidden");
|
|
58
|
-
},
|
|
59
|
-
{ once: !0, signal: i(this, r).signal }
|
|
60
|
-
));
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
message: {
|
|
64
|
-
type: String,
|
|
65
|
-
default: "",
|
|
66
|
-
observer: (e) => {
|
|
67
|
-
this.dangerouslyUseHTMLString ? i(this, m).innerHTML = e : i(this, m).innerText = e;
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
showClose: {
|
|
71
|
-
type: Boolean,
|
|
72
|
-
default: !1,
|
|
73
|
-
observer: () => {
|
|
74
|
-
i(this, o).className = this.updateContainerClasslist();
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
placement: {
|
|
78
|
-
type: [
|
|
79
|
-
"top",
|
|
80
|
-
"top-left",
|
|
81
|
-
"top-right",
|
|
82
|
-
"bottom",
|
|
83
|
-
"bottom-left",
|
|
84
|
-
"bottom-right",
|
|
85
|
-
"middle"
|
|
86
|
-
],
|
|
87
|
-
default: "top",
|
|
88
|
-
observer: () => {
|
|
89
|
-
this.className = this.updateContainerClasslist();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}));
|
|
93
|
-
n(this, l, (e, a) => {
|
|
94
|
-
this.emit(e, {
|
|
95
|
-
detail: a,
|
|
96
|
-
bubbles: !0,
|
|
97
|
-
composed: !0
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
S(this, "close", () => {
|
|
101
|
-
this.visible = !1, i(this, l).call(this, "close");
|
|
102
|
-
});
|
|
103
|
-
n(this, b, () => {
|
|
104
|
-
const e = document.querySelectorAll(
|
|
105
|
-
`ea-message[placement="${this.placement}"]`
|
|
106
|
-
);
|
|
107
|
-
if (e.length <= 1) return;
|
|
108
|
-
const a = e[e.length - 2], c = a.style.getPropertyValue("--ea-message-y"), h = a.shadowRoot.querySelector(".ea-message").getBoundingClientRect();
|
|
109
|
-
this.style.setProperty(
|
|
110
|
-
"--ea-message-y",
|
|
111
|
-
`${Number(c.replace("px", "")) + h.height + 8}px`
|
|
112
|
-
);
|
|
113
|
-
});
|
|
114
|
-
n(this, w, () => {
|
|
115
|
-
const e = [
|
|
116
|
-
...document.querySelectorAll(`ea-message[placement="${this.placement}"]`)
|
|
117
|
-
], a = e.findIndex((h) => h === this), c = e.slice(a + 1), H = i(this, o).getBoundingClientRect().height;
|
|
118
|
-
c.forEach((h, A) => {
|
|
119
|
-
const x = Number(
|
|
120
|
-
h.style.getPropertyValue("--ea-message-y").replace("px", "")
|
|
121
|
-
);
|
|
122
|
-
h.style.setProperty("--ea-message-y", `${x - H - 8}px`);
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
this.stylesheet = $, this.$render();
|
|
126
|
-
}
|
|
127
|
-
// ------- dangerouslyUseHTMLString -------
|
|
128
|
-
// #region
|
|
129
|
-
get dangerouslyUseHTMLString() {
|
|
130
|
-
return i(this, f).dangerouslyUseHTMLString;
|
|
131
|
-
}
|
|
132
|
-
set dangerouslyUseHTMLString(e) {
|
|
133
|
-
i(this, f).dangerouslyUseHTMLString = e;
|
|
134
|
-
}
|
|
135
|
-
// #endregion
|
|
136
|
-
// ------- end -------
|
|
137
|
-
static get observedAttributes() {
|
|
138
|
-
return [
|
|
139
|
-
...super.observedAttributes,
|
|
140
|
-
"type",
|
|
141
|
-
"visible",
|
|
142
|
-
"message",
|
|
143
|
-
"showClose",
|
|
144
|
-
"placement"
|
|
145
|
-
];
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* 获取 classlist 列表
|
|
149
|
-
* @return {string} 属性值
|
|
150
|
-
*/
|
|
151
|
-
updateContainerClasslist() {
|
|
152
|
-
return this.computedClasslist("ea-message", {
|
|
153
|
-
"--visible": this.visible,
|
|
154
|
-
["--" + this.type]: this.type,
|
|
155
|
-
"--show-close": this.showClose,
|
|
156
|
-
["--" + this.placement]: this.placement
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
$render() {
|
|
160
|
-
this.shadowRoot.innerHTML = `
|
|
161
|
-
<div class="ea-message" part="container">
|
|
162
|
-
<ea-icon class="ea-message__icon" part="icon"></ea-icon>
|
|
163
|
-
<div class="ea-message__content" part="content-wrap"></div>
|
|
164
|
-
<ea-icon class="ea-message__icon-close" icon="icon-cancel" part="close-icon"></ea-icon>
|
|
165
|
-
</div>
|
|
166
|
-
`, d(this, o, this.shadowRoot.querySelector(".ea-message")), d(this, u, this.shadowRoot.querySelector(".ea-message__icon")), d(this, m, this.shadowRoot.querySelector(
|
|
167
|
-
".ea-message__content"
|
|
168
|
-
)), d(this, y, this.shadowRoot.querySelector(
|
|
169
|
-
".ea-message__icon-close"
|
|
170
|
-
));
|
|
171
|
-
}
|
|
172
|
-
connectedCallback() {
|
|
173
|
-
super.connectedCallback(), this.showClose && i(this, y).addEventListener("click", this.close);
|
|
174
|
-
}
|
|
175
|
-
$beforeUnmounted() {
|
|
176
|
-
var e;
|
|
177
|
-
(e = i(this, r)) == null || e.abort();
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
o = new WeakMap(), u = new WeakMap(), m = new WeakMap(), y = new WeakMap(), r = new WeakMap(), f = new WeakMap(), l = new WeakMap(), b = new WeakMap(), w = new WeakMap();
|
|
181
|
-
window.customElements.get("ea-message") || window.customElements.define("ea-message", N);
|
|
182
|
-
var C, v, E, M, L;
|
|
183
|
-
class g {
|
|
184
|
-
/**
|
|
185
|
-
* @param {EaMessageOptions} options
|
|
186
|
-
*/
|
|
187
|
-
constructor(s) {
|
|
188
|
-
n(this, C, ["dangerouslyUseHTMLString", "message", "placement", "type", "showClose", "duration", "offset"]);
|
|
189
|
-
n(this, v, (s) => {
|
|
190
|
-
const e = document.createElement("ea-message");
|
|
191
|
-
if (s instanceof String)
|
|
192
|
-
e.message = s;
|
|
193
|
-
else if (s instanceof Object)
|
|
194
|
-
for (const a in s)
|
|
195
|
-
e[a] = s[a];
|
|
196
|
-
else
|
|
197
|
-
console.warn("[EaMessage] TypeError: options must be a string or an object.");
|
|
198
|
-
return e;
|
|
199
|
-
});
|
|
200
|
-
n(this, E, (s, e = 3e3) => {
|
|
201
|
-
e <= 0 || B(() => {
|
|
202
|
-
s.visible = !1;
|
|
203
|
-
}, e);
|
|
204
|
-
});
|
|
205
|
-
n(this, M, (s, e) => {
|
|
206
|
-
if (e instanceof HTMLElement)
|
|
207
|
-
e.appendChild(s);
|
|
208
|
-
else {
|
|
209
|
-
const a = document.querySelector(e);
|
|
210
|
-
a ? a.appendChild(s) : document.body.appendChild(s);
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
n(this, L, (s, e) => {
|
|
214
|
-
s.addEventListener("hidden", (a) => {
|
|
215
|
-
e == null || e(a), s.remove();
|
|
216
|
-
}, { once: !0 });
|
|
217
|
-
});
|
|
218
|
-
this.options = i(this, C).reduce((a, c) => (s[c] && (a[c] = s[c]), a), {}), this.options.placement = this.options.placement || "top";
|
|
219
|
-
const e = i(this, v).call(this, this.options);
|
|
220
|
-
i(this, M).call(this, e, s.appendTo), i(this, E).call(this, e, s.duration), i(this, L).call(this, e, s.onClose), e.visible = !0;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
C = new WeakMap(), v = new WeakMap(), E = new WeakMap(), M = new WeakMap(), L = new WeakMap();
|
|
224
|
-
const p = (t) => {
|
|
225
|
-
new g(t);
|
|
226
|
-
};
|
|
227
|
-
p.primary = (t) => new g({
|
|
228
|
-
message: t,
|
|
229
|
-
type: "primary"
|
|
230
|
-
});
|
|
231
|
-
p.success = (t) => new g({
|
|
232
|
-
message: t,
|
|
233
|
-
type: "success"
|
|
234
|
-
});
|
|
235
|
-
p.warning = (t) => new g({
|
|
236
|
-
message: t,
|
|
237
|
-
type: "warning"
|
|
238
|
-
});
|
|
239
|
-
p.info = (t) => new g({
|
|
240
|
-
message: t,
|
|
241
|
-
type: "info"
|
|
242
|
-
});
|
|
243
|
-
p.error = (t) => new g({
|
|
244
|
-
message: t,
|
|
245
|
-
type: "error"
|
|
246
|
-
});
|
|
247
|
-
window.$message = p;
|
|
248
|
-
export {
|
|
249
|
-
p as EaMessage,
|
|
250
|
-
N as EaMessageElement
|
|
251
|
-
};
|
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
var $ = Object.defineProperty;
|
|
2
|
-
var I = (s) => {
|
|
3
|
-
throw TypeError(s);
|
|
4
|
-
};
|
|
5
|
-
var A = (s, i, t) => i in s ? $(s, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[i] = t;
|
|
6
|
-
var C = (s, i, t) => A(s, typeof i != "symbol" ? i + "" : i, t), R = (s, i, t) => i.has(s) || I("Cannot " + t);
|
|
7
|
-
var e = (s, i, t) => (R(s, i, "read from private field"), t ? t.call(s) : i.get(s)), n = (s, i, t) => i.has(s) ? I("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, t), c = (s, i, t, o) => (R(s, i, "write to private field"), o ? o.call(s, t) : i.set(s, t), t);
|
|
8
|
-
import { t as B } from "../utils/timeout.js";
|
|
9
|
-
import { E as q } from "../utils/Utils.js";
|
|
10
|
-
import { B as P } from "./Base.js";
|
|
11
|
-
import { s as k } 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: "icon-cancel",
|
|
31
|
-
appendTo: "body"
|
|
32
|
-
});
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
* @param {HTMLElement} el
|
|
36
|
-
* @param {EaNotificationOptions} options
|
|
37
|
-
* @returns
|
|
38
|
-
*/
|
|
39
|
-
n(this, L, (i) => {
|
|
40
|
-
const t = document.createElement("ea-notification");
|
|
41
|
-
for (const o in i) {
|
|
42
|
-
if (e(this, E).includes(o)) continue;
|
|
43
|
-
const p = i[o];
|
|
44
|
-
if (e(this, v).includes(o))
|
|
45
|
-
t[o] = p;
|
|
46
|
-
else {
|
|
47
|
-
const w = q.String.toLowerCamelCase(o);
|
|
48
|
-
t.setAttribute(w, p);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return t;
|
|
52
|
-
});
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
* @param {HTMLElement} el
|
|
56
|
-
* @param {HTMLElement | String} appendTo
|
|
57
|
-
* @returns
|
|
58
|
-
*/
|
|
59
|
-
n(this, S, (i, t) => {
|
|
60
|
-
if (!t) return document.body.appendChild(i);
|
|
61
|
-
if (t instanceof HTMLElement)
|
|
62
|
-
t.appendChild(i);
|
|
63
|
-
else if (typeof t == "string") {
|
|
64
|
-
const o = document.querySelector(t);
|
|
65
|
-
o ? o.appendChild(i) : document.body.appendChild(i);
|
|
66
|
-
} else
|
|
67
|
-
console.warn(
|
|
68
|
-
`[EaNotification] TypeError: ${t} 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, t = 3e3) => {
|
|
78
|
-
i.visible = !0, i.addEventListener("hidden", () => i.remove()), t > 0 && B(() => {
|
|
79
|
-
i.visible = !1;
|
|
80
|
-
}, t);
|
|
81
|
-
});
|
|
82
|
-
C(this, "close", () => {
|
|
83
|
-
this.instance.close();
|
|
84
|
-
});
|
|
85
|
-
i = Object.assign({}, e(this, _), i);
|
|
86
|
-
const t = e(this, L).call(this, i);
|
|
87
|
-
this.instance = t, e(this, S).call(this, t, i.appendTo), e(this, x).call(this, t, 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, l, b, f, h, N, T, H;
|
|
113
|
-
class V extends P {
|
|
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, l);
|
|
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: (t) => {
|
|
141
|
-
const o = {
|
|
142
|
-
success: "icon-ok-circled",
|
|
143
|
-
error: "icon-cancel-circled",
|
|
144
|
-
warning: "icon-attention-alt",
|
|
145
|
-
info: "icon-info",
|
|
146
|
-
primary: "icon-info"
|
|
147
|
-
};
|
|
148
|
-
e(this, y).icon = o[t], e(this, a).className = this.updateContainerClasslist();
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
title: {
|
|
152
|
-
type: String,
|
|
153
|
-
default: "",
|
|
154
|
-
observer: (t) => {
|
|
155
|
-
e(this, g).textContent = t;
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
visible: {
|
|
159
|
-
type: Boolean,
|
|
160
|
-
default: !1,
|
|
161
|
-
observer: async (t) => {
|
|
162
|
-
var o;
|
|
163
|
-
(o = e(this, l)) == null || o.abort(), c(this, l, new AbortController()), t ? (e(this, N).call(this), e(this, a).className = this.updateContainerClasslist(), e(this, h).call(this, "show"), e(this, a).offsetWidth, e(this, a).classList.add("is-show"), e(this, a).addEventListener(
|
|
164
|
-
"transitionend",
|
|
165
|
-
() => {
|
|
166
|
-
e(this, h).call(this, "shown");
|
|
167
|
-
},
|
|
168
|
-
{ once: !0, signal: e(this, l).signal }
|
|
169
|
-
)) : (e(this, T).call(this), e(this, a).classList.add("is-before-hide"), e(this, h).call(this, "hide"), e(this, a).addEventListener(
|
|
170
|
-
"transitionend",
|
|
171
|
-
() => {
|
|
172
|
-
e(this, a).className = this.updateContainerClasslist(), e(this, h).call(this, "hidden");
|
|
173
|
-
},
|
|
174
|
-
{ once: !0, signal: e(this, l).signal }
|
|
175
|
-
));
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
showClose: {
|
|
179
|
-
type: Boolean,
|
|
180
|
-
default: !1,
|
|
181
|
-
observer: (t) => {
|
|
182
|
-
e(this, a).className = this.updateContainerClasslist(), e(this, d).icon = this["close-icon"];
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
closeIcon: {
|
|
186
|
-
type: String,
|
|
187
|
-
default: "icon-cancel",
|
|
188
|
-
observer: (t) => {
|
|
189
|
-
this["show-close"] && (e(this, d).icon = t);
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
placement: {
|
|
193
|
-
type: ["top-right", "top-left", "bottom-right", "bottom-left"],
|
|
194
|
-
default: "top-right",
|
|
195
|
-
observer: (t) => {
|
|
196
|
-
e(this, a).className = this.updateContainerClasslist();
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
zIndex: {
|
|
200
|
-
type: Number,
|
|
201
|
-
default: 0,
|
|
202
|
-
observer: (t) => {
|
|
203
|
-
e(this, a).style.setProperty("--z-index", t);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}));
|
|
207
|
-
n(this, h, (t, o) => {
|
|
208
|
-
this.emit(t, {
|
|
209
|
-
detail: o,
|
|
210
|
-
bubbles: !0,
|
|
211
|
-
composed: !0
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
C(this, "close", () => {
|
|
215
|
-
this.visible = !1, e(this, h).call(this, "close");
|
|
216
|
-
});
|
|
217
|
-
n(this, N, () => {
|
|
218
|
-
const t = document.querySelectorAll(
|
|
219
|
-
`ea-notification[placement="${this.placement}"]`
|
|
220
|
-
);
|
|
221
|
-
if (t.length <= 1) return;
|
|
222
|
-
const o = t[t.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 t = [
|
|
230
|
-
...document.querySelectorAll(
|
|
231
|
-
`ea-notification[placement="${this.placement}"]`
|
|
232
|
-
)
|
|
233
|
-
], o = t.findIndex((u) => u === this), p = t.slice(o + 1), w = e(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 = k, this.$render();
|
|
248
|
-
}
|
|
249
|
-
// ------- dangerouslyUseHTMLString -------
|
|
250
|
-
// #region
|
|
251
|
-
get dangerouslyUseHTMLString() {
|
|
252
|
-
return e(this, f).dangerouslyUseHTMLString;
|
|
253
|
-
}
|
|
254
|
-
set dangerouslyUseHTMLString(t) {
|
|
255
|
-
e(this, f).dangerouslyUseHTMLString = t;
|
|
256
|
-
}
|
|
257
|
-
// #endregion
|
|
258
|
-
// ------- end -------
|
|
259
|
-
// ------- message -------
|
|
260
|
-
// #region
|
|
261
|
-
get message() {
|
|
262
|
-
return e(this, f).message;
|
|
263
|
-
}
|
|
264
|
-
set message(t) {
|
|
265
|
-
e(this, f).message = t, this.dangerouslyUseHTMLString ? e(this, m).innerHTML = t : e(this, m).innerText = t;
|
|
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" part='close-icon'></ea-icon>
|
|
303
|
-
</header>
|
|
304
|
-
<main class="ea-notification__main" part='main'> </main>
|
|
305
|
-
</div>
|
|
306
|
-
</div>
|
|
307
|
-
`, c(this, a, this.shadowRoot.querySelector(".ea-notification")), c(this, M, this.shadowRoot.querySelector(".ea-notification__header")), c(this, y, this.shadowRoot.querySelector(
|
|
308
|
-
".ea-notification__icon"
|
|
309
|
-
)), c(this, g, this.shadowRoot.querySelector(".ea-notification__title")), c(this, d, this.shadowRoot.querySelector(
|
|
310
|
-
".ea-notification__close-icon"
|
|
311
|
-
)), c(this, m, this.shadowRoot.querySelector(".ea-notification__main"));
|
|
312
|
-
}
|
|
313
|
-
connectedCallback() {
|
|
314
|
-
super.connectedCallback();
|
|
315
|
-
const t = new AbortController();
|
|
316
|
-
c(this, b, t), this["show-close"] && e(this, d).addEventListener("click", e(this, H), {
|
|
317
|
-
signal: t.signal
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
$beforeUnmounted() {
|
|
321
|
-
var t, o;
|
|
322
|
-
(t = e(this, l)) == null || t.abort(), (o = e(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(), l = 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
|
-
};
|