easy-component-ui 3.0.14 → 3.0.15

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.
Files changed (167) hide show
  1. package/dist/assets/icon.css +1 -0
  2. package/dist/components/Base.js +941 -0
  3. package/dist/components/ea-alert.js +213 -0
  4. package/dist/components/ea-avatar.js +164 -0
  5. package/dist/components/ea-backtop.js +136 -0
  6. package/dist/components/ea-badge.js +144 -0
  7. package/dist/components/ea-breadcrumb.js +148 -0
  8. package/dist/components/ea-button.js +266 -0
  9. package/dist/components/ea-calendar.js +10 -0
  10. package/dist/components/ea-calendar2.js +673 -0
  11. package/dist/components/ea-card.js +121 -0
  12. package/dist/components/ea-carousel.js +415 -0
  13. package/dist/components/ea-checkbox.js +446 -0
  14. package/dist/components/ea-collapse.js +313 -0
  15. package/dist/components/ea-color-picker.js +888 -0
  16. package/dist/components/ea-container.js +206 -0
  17. package/dist/components/ea-countdown.js +142 -0
  18. package/dist/components/ea-date-picker.js +649 -0
  19. package/dist/components/ea-descriptions.js +474 -0
  20. package/dist/components/ea-dialog.js +249 -0
  21. package/dist/components/ea-drawer.js +216 -0
  22. package/dist/components/ea-dropdown.js +228 -0
  23. package/dist/components/ea-empty.js +93 -0
  24. package/dist/components/ea-icon.js +159 -0
  25. package/dist/components/ea-image-preview.js +532 -0
  26. package/dist/components/ea-image.js +327 -0
  27. package/dist/components/ea-infinite-scroll.js +109 -0
  28. package/dist/components/ea-input-number.js +367 -0
  29. package/dist/components/ea-input.js +588 -0
  30. package/dist/components/ea-layout.js +132 -0
  31. package/dist/components/ea-link.js +101 -0
  32. package/dist/components/ea-menu.js +433 -0
  33. package/dist/components/ea-message-box.js +624 -0
  34. package/dist/components/ea-message.js +313 -0
  35. package/dist/components/ea-notification.js +331 -0
  36. package/dist/components/ea-overlay.js +168 -0
  37. package/dist/components/ea-page-header.js +108 -0
  38. package/dist/components/ea-pagination.js +481 -0
  39. package/dist/components/ea-popconfirm.js +275 -0
  40. package/dist/components/ea-popover.js +147 -0
  41. package/dist/components/ea-popper.js +203 -0
  42. package/dist/components/ea-progress.js +286 -0
  43. package/dist/components/ea-radio.js +364 -0
  44. package/dist/components/ea-rate.js +241 -0
  45. package/dist/components/ea-result.js +100 -0
  46. package/dist/components/ea-scrollbar.js +235 -0
  47. package/dist/components/ea-segmented.js +215 -0
  48. package/dist/components/ea-select.js +609 -0
  49. package/dist/components/ea-skeleton.js +263 -0
  50. package/dist/components/ea-slider.js +430 -0
  51. package/dist/components/ea-space.js +123 -0
  52. package/dist/components/ea-splitter.js +233 -0
  53. package/dist/components/ea-statistic.js +74 -0
  54. package/dist/components/ea-steps.js +346 -0
  55. package/dist/components/ea-switch.js +271 -0
  56. package/dist/components/ea-table.js +1137 -0
  57. package/dist/components/ea-tabs.js +503 -0
  58. package/dist/components/ea-tag.js +228 -0
  59. package/dist/components/ea-text.js +113 -0
  60. package/dist/components/ea-time-picker.js +510 -0
  61. package/dist/components/ea-timeline.js +185 -0
  62. package/dist/components/ea-tooltip.js +161 -0
  63. package/dist/components/ea-tour.js +544 -0
  64. package/dist/components/ea-transfer.js +949 -0
  65. package/dist/components/ea-tree.js +1125 -0
  66. package/dist/components/index.js +60 -0
  67. package/dist/core/FormBase.js +238 -0
  68. package/dist/css/ea-alert.style.js +4 -0
  69. package/dist/css/ea-aside.style.js +4 -0
  70. package/dist/css/ea-avatar.style.js +4 -0
  71. package/dist/css/ea-backtop.style.js +4 -0
  72. package/dist/css/ea-badge.style.js +4 -0
  73. package/dist/css/ea-breadcrumb-item.style.js +4 -0
  74. package/dist/css/ea-breadcrumb.style.js +4 -0
  75. package/dist/css/ea-button-group.style.js +4 -0
  76. package/dist/css/ea-button.style.js +4 -0
  77. package/dist/css/ea-calendar.style.js +4 -0
  78. package/dist/css/ea-card.style.js +4 -0
  79. package/dist/css/ea-carousel-item.style.js +4 -0
  80. package/dist/css/ea-carousel.style.js +4 -0
  81. package/dist/css/ea-check-tag.style.js +4 -0
  82. package/dist/css/ea-checkbox-group.style.js +4 -0
  83. package/dist/css/ea-checkbox.style.js +4 -0
  84. package/dist/css/ea-col.style.js +4 -0
  85. package/dist/css/ea-collapse-item.style.js +4 -0
  86. package/dist/css/ea-collapse.style.js +4 -0
  87. package/dist/css/ea-color-picker-panel.style.js +4 -0
  88. package/dist/css/ea-color-picker.style.js +4 -0
  89. package/dist/css/ea-container.style.js +4 -0
  90. package/dist/css/ea-date-picker.style.js +4 -0
  91. package/dist/css/ea-descriptions-item.style.js +4 -0
  92. package/dist/css/ea-descriptions.style.js +4 -0
  93. package/dist/css/ea-dialog.style.js +4 -0
  94. package/dist/css/ea-drawer.style.js +4 -0
  95. package/dist/css/ea-dropdown-item.style.js +4 -0
  96. package/dist/css/ea-dropdown-menu.style.js +4 -0
  97. package/dist/css/ea-dropdown.style.js +4 -0
  98. package/dist/css/ea-empty.style.js +4 -0
  99. package/dist/css/ea-footer.style.js +4 -0
  100. package/dist/css/ea-header.style.js +4 -0
  101. package/dist/css/ea-icon.style.js +4 -0
  102. package/dist/css/ea-image-preview.style.js +4 -0
  103. package/dist/css/ea-image.style.js +4 -0
  104. package/dist/css/ea-infinite-scroll.style.js +4 -0
  105. package/dist/css/ea-input-number.style.js +4 -0
  106. package/dist/css/ea-input.style.js +4 -0
  107. package/dist/css/ea-link.style.js +4 -0
  108. package/dist/css/ea-main.style.js +4 -0
  109. package/dist/css/ea-menu-item-group.style.js +4 -0
  110. package/dist/css/ea-menu-item.style.js +4 -0
  111. package/dist/css/ea-menu.style.js +4 -0
  112. package/dist/css/ea-message-box.style.js +4 -0
  113. package/dist/css/ea-message.style.js +4 -0
  114. package/dist/css/ea-notification.style.js +4 -0
  115. package/dist/css/ea-option-gropu.style.js +4 -0
  116. package/dist/css/ea-option.style.js +4 -0
  117. package/dist/css/ea-overlay.style.js +4 -0
  118. package/dist/css/ea-page-header.style.js +4 -0
  119. package/dist/css/ea-pagination.style.js +4 -0
  120. package/dist/css/ea-popconfirm.style.js +4 -0
  121. package/dist/css/ea-popover.style.js +4 -0
  122. package/dist/css/ea-popper.style.js +4 -0
  123. package/dist/css/ea-progress.style.js +4 -0
  124. package/dist/css/ea-radio-group.style.js +4 -0
  125. package/dist/css/ea-radio.style.js +4 -0
  126. package/dist/css/ea-rate.style.js +4 -0
  127. package/dist/css/ea-result.style.js +4 -0
  128. package/dist/css/ea-row.style.js +4 -0
  129. package/dist/css/ea-scrollbar.style.js +4 -0
  130. package/dist/css/ea-segmented.style.js +4 -0
  131. package/dist/css/ea-select.style.js +4 -0
  132. package/dist/css/ea-skeleton-item.style.js +4 -0
  133. package/dist/css/ea-skeleton.style.js +4 -0
  134. package/dist/css/ea-slider.style.js +4 -0
  135. package/dist/css/ea-space.style.js +4 -0
  136. package/dist/css/ea-splitter-bar.style.js +4 -0
  137. package/dist/css/ea-splitter-panel.style.js +4 -0
  138. package/dist/css/ea-splitter.style.js +4 -0
  139. package/dist/css/ea-statistic.style.js +4 -0
  140. package/dist/css/ea-step.style.js +4 -0
  141. package/dist/css/ea-steps.style.js +4 -0
  142. package/dist/css/ea-sub-menu.style.js +4 -0
  143. package/dist/css/ea-switch.style.js +4 -0
  144. package/dist/css/ea-tab-panel.style.js +4 -0
  145. package/dist/css/ea-tab.style.js +4 -0
  146. package/dist/css/ea-table-column.style.js +4 -0
  147. package/dist/css/ea-table.style.js +4 -0
  148. package/dist/css/ea-tabs.style.js +4 -0
  149. package/dist/css/ea-tag.style.js +4 -0
  150. package/dist/css/ea-text.style.js +4 -0
  151. package/dist/css/ea-time-picker.style.js +4 -0
  152. package/dist/css/ea-timeline-item.style.js +4 -0
  153. package/dist/css/ea-timeline.style.js +4 -0
  154. package/dist/css/ea-tooltip.style.js +4 -0
  155. package/dist/css/ea-tour-step.style.js +4 -0
  156. package/dist/css/ea-tour.style.js +4 -0
  157. package/dist/css/ea-transfer.style.js +5 -0
  158. package/dist/css/ea-tree.style.js +6 -0
  159. package/dist/css/ea-ui-component.style.js +4 -0
  160. package/dist/favicon.ico +0 -0
  161. package/dist/utils/Color.js +439 -0
  162. package/dist/utils/I18nManager.js +218 -0
  163. package/dist/utils/Utils.js +65 -0
  164. package/dist/utils/Variables.js +12 -0
  165. package/dist/utils/parseTime.js +73 -0
  166. package/dist/utils/timeout.js +9 -0
  167. package/package.json +1 -1
@@ -0,0 +1,624 @@
1
+ var $ = Object.defineProperty;
2
+ var O = (i) => {
3
+ throw TypeError(i);
4
+ };
5
+ var z = (i, s, e) => s in i ? $(i, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[s] = e;
6
+ var H = (i, s, e) => z(i, typeof s != "symbol" ? s + "" : s, e), I = (i, s, e) => s.has(i) || O("Cannot " + e);
7
+ var t = (i, s, e) => (I(i, s, "read from private field"), e ? e.call(i) : s.get(i)), a = (i, s, e) => s.has(i) ? O("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(i) : s.set(i, e), l = (i, s, e, n) => (I(i, s, "write to private field"), n ? n.call(i, e) : s.set(i, e), e);
8
+ import { EaOverlay as V } from "./ea-overlay.js";
9
+ import "./ea-input.js";
10
+ import { s as N } from "../css/ea-message-box.style.js";
11
+ import { t as K } from "../utils/timeout.js";
12
+ import { E as U } from "../utils/Utils.js";
13
+ var m, f, v, y, g, B, C, o, _, E, r, h, c, u, b, S, L, T, w, M;
14
+ class D extends V {
15
+ constructor() {
16
+ super(...arguments);
17
+ /** @type {HTMLElement} */
18
+ a(this, m);
19
+ /** @type {HTMLElement} */
20
+ a(this, f);
21
+ /** @type {HTMLElement} */
22
+ a(this, v);
23
+ /** @type {HTMLElement} */
24
+ a(this, y);
25
+ /** @type {HTMLElement} */
26
+ a(this, g);
27
+ /** @type {HTMLElement} */
28
+ a(this, B);
29
+ /** @type {HTMLElement} */
30
+ a(this, C);
31
+ /** @type {HTMLInputElement} */
32
+ a(this, o);
33
+ /** @type {HTMLElement} */
34
+ a(this, _);
35
+ /** @type {HTMLElement} */
36
+ a(this, E);
37
+ /** @type {HTMLElement} */
38
+ a(this, r);
39
+ /** @type {HTMLElement} */
40
+ a(this, h);
41
+ /** @type {AbortController} */
42
+ a(this, c);
43
+ a(this, u, {
44
+ inputPattern: null,
45
+ dangerouslyUseHTMLString: !1,
46
+ confirmButtonLoading: !1
47
+ });
48
+ H(this, "state", this.properties({
49
+ boxType: {
50
+ type: ["alert", "confirm", "prompt", "personalized"],
51
+ default: "personalized",
52
+ observer: async (e) => {
53
+ const n = this.shadowRoot.querySelector(
54
+ ".ea-overlay__content"
55
+ );
56
+ t(this, S).call(this, e, n), t(this, m).className = this.updateContainerClasslist();
57
+ }
58
+ },
59
+ visible: {
60
+ type: Boolean,
61
+ default: !1,
62
+ observer: async (e) => {
63
+ this.status = e, t(this, m).className = this.updateContainerClasslist();
64
+ }
65
+ },
66
+ title: {
67
+ type: String,
68
+ default: "",
69
+ observer: (e) => {
70
+ t(this, v).textContent = e;
71
+ }
72
+ },
73
+ message: {
74
+ type: String,
75
+ default: "",
76
+ observer: (e) => {
77
+ this.dangerouslyUseHTMLString ? t(this, C).innerHTML = e : t(this, C).textContent = e;
78
+ }
79
+ },
80
+ type: {
81
+ type: ["primary", "success", "info", "warning", "error"],
82
+ default: "",
83
+ observer: (e) => {
84
+ const n = {
85
+ primary: "circle-info",
86
+ success: "circle-check",
87
+ info: "circle-info",
88
+ warning: "triangle-exclamation",
89
+ error: "circle-xmark"
90
+ };
91
+ this.icon = n[e], t(this, m).className = this.updateContainerClasslist();
92
+ }
93
+ },
94
+ icon: {
95
+ type: String,
96
+ default: "",
97
+ observer: (e) => {
98
+ t(this, y) && (t(this, y).name = e);
99
+ }
100
+ },
101
+ closeIcon: {
102
+ type: String,
103
+ default: "xmark",
104
+ observer: (e) => {
105
+ t(this, g).name = e;
106
+ }
107
+ },
108
+ showClose: {
109
+ type: Boolean,
110
+ default: !0,
111
+ observer: (e) => {
112
+ t(this, g).style.display = e ? "block" : "none";
113
+ }
114
+ },
115
+ showCancelButton: {
116
+ type: Boolean,
117
+ default: !1,
118
+ observer: (e) => {
119
+ t(this, h) && (t(this, h).style.display = e ? "inline-block" : "none");
120
+ }
121
+ },
122
+ showConfirmButton: {
123
+ type: Boolean,
124
+ default: !0,
125
+ observer: (e) => {
126
+ t(this, r) && (t(this, r).style.display = e ? "inline-block" : "none");
127
+ }
128
+ },
129
+ confirmButtonText: {
130
+ type: String,
131
+ default: "OK",
132
+ observer: (e) => {
133
+ t(this, r).textContent = e;
134
+ }
135
+ },
136
+ closeOnPressEscape: {
137
+ type: Boolean,
138
+ default: !1,
139
+ observer: (e) => {
140
+ }
141
+ },
142
+ center: {
143
+ type: Boolean,
144
+ default: !1,
145
+ observer: (e) => {
146
+ t(this, m).className = this.updateContainerClasslist();
147
+ }
148
+ },
149
+ roundButton: {
150
+ type: Boolean,
151
+ default: !1,
152
+ observer: (e) => {
153
+ t(this, r) && t(this, r).setAttribute("round", e), t(this, h) && t(this, h).setAttribute("round", e);
154
+ }
155
+ },
156
+ buttonSize: {
157
+ type: ["small", "medium", "large"],
158
+ default: "medium",
159
+ observer: (e) => {
160
+ t(this, r) && t(this, r).setAttribute("size", e), t(this, h) && t(this, h).setAttribute("size", e);
161
+ }
162
+ },
163
+ showInput: {
164
+ type: Boolean,
165
+ default: !1,
166
+ observer: (e) => {
167
+ t(this, o).style.display = e ? "block" : "none";
168
+ }
169
+ },
170
+ inputPlaceholder: {
171
+ type: String,
172
+ default: "",
173
+ observer: (e) => {
174
+ t(this, o) && (t(this, o).placeholder = e);
175
+ }
176
+ },
177
+ inputType: {
178
+ type: String,
179
+ default: "text",
180
+ observer: (e) => {
181
+ t(this, o) && (t(this, o).type = e);
182
+ }
183
+ },
184
+ inputValue: {
185
+ type: String,
186
+ default: "",
187
+ observer: (e) => {
188
+ t(this, o) && (t(this, o).value = e);
189
+ }
190
+ },
191
+ inputErrorMessage: {
192
+ type: String,
193
+ default: "",
194
+ observer: (e) => {
195
+ t(this, o) && this.inputPattern && (t(this, _).textContent = e);
196
+ }
197
+ },
198
+ draggable: {
199
+ type: Boolean,
200
+ default: !1,
201
+ observer: (e) => {
202
+ t(this, m).className = this.updateContainerClasslist();
203
+ }
204
+ }
205
+ }));
206
+ /**
207
+ * 派发事件
208
+ * @param {string} customEventName 自定义事件名称
209
+ * @param {object} detail 自定义事件详情
210
+ */
211
+ a(this, b, (e, n) => {
212
+ this.emit(e, {
213
+ detail: n,
214
+ bubbles: !0,
215
+ composed: !0
216
+ });
217
+ });
218
+ a(this, S, (e, n) => {
219
+ n.innerHTML = `
220
+ <div class="ea-message-box-main" part="container">
221
+ <header class="ea-message-box-main__header" part="header">
222
+ <div class="ea-message-box-main__title-container" part="title-wrap">
223
+ <ea-icon class="ea-message-box-main__type-icon" part="type-icon"></ea-icon>
224
+ <span class="ea-message-box-main__title" part="title"></span>
225
+ </div>
226
+ <ea-icon class="ea-message-box-main__icon-close" name="xmark" part="close-icon"></ea-icon>
227
+ </header>
228
+ <main class="ea-message-box-main__content" part="content">
229
+ <div class="ea-message-box-main__description" part="description"></div>
230
+ <ea-input class="ea-message-box-main__input" part="input"></ea-input>
231
+ <div class="ea-message-box-main__invalid-message" part="invalid-message"></div>
232
+ </main>
233
+ <footer class="ea-message-box-main__footer" part="footer">
234
+ <ea-button class="ea-message-box-main__cancel-button" part="cancel-button">Cancel</ea-button>
235
+ <ea-button class="ea-message-box-main__confirm-button" type="primary" part="confirm-button">OK</ea-button>
236
+ </footer>
237
+ </div>
238
+ `, l(this, m, this.shadowRoot.querySelector(".ea-overlay")), l(this, f, this.shadowRoot.querySelector(
239
+ ".ea-message-box-main__header"
240
+ )), l(this, v, this.shadowRoot.querySelector(".ea-message-box-main__title")), l(this, y, this.shadowRoot.querySelector(
241
+ ".ea-message-box-main__type-icon"
242
+ )), l(this, g, this.shadowRoot.querySelector(
243
+ ".ea-message-box-main__icon-close"
244
+ )), l(this, B, this.shadowRoot.querySelector(
245
+ ".ea-message-box-main__content"
246
+ )), l(this, E, this.shadowRoot.querySelector(
247
+ ".ea-message-box-main__footer"
248
+ )), l(this, h, this.shadowRoot.querySelector(
249
+ ".ea-message-box-main__cancel-button"
250
+ )), l(this, r, this.shadowRoot.querySelector(
251
+ ".ea-message-box-main__confirm-button"
252
+ )), l(this, C, this.shadowRoot.querySelector(
253
+ ".ea-message-box-main__description"
254
+ )), l(this, o, this.shadowRoot.querySelector(".ea-message-box-main__input")), l(this, _, this.shadowRoot.querySelector(
255
+ ".ea-message-box-main__invalid-message"
256
+ )), t(this, o) && K(() => {
257
+ t(this, o).focus();
258
+ }, 0);
259
+ });
260
+ /**
261
+ * 处理带有匹配规则的输入框输入
262
+ * @returns {Promise<boolean>} Promise.
263
+ */
264
+ a(this, L, () => new Promise((e, n) => {
265
+ if (!t(this, o) || !this.inputPattern) return e(!0);
266
+ const d = this.inputPattern.test(t(this, o).value);
267
+ t(this, m).classList.toggle("is-invalid", !d), d ? e(!0) : n(
268
+ new Error(
269
+ `[EaMessageBox] ${this["input-error-message"] || "input pattern is not valid."}`
270
+ )
271
+ );
272
+ }));
273
+ /**
274
+ * 初始化确认事件
275
+ */
276
+ a(this, T, async () => {
277
+ var e;
278
+ try {
279
+ await t(this, L).call(this), (e = t(this, c)) == null || e.abort(), t(this, b).call(this, "confirm");
280
+ } catch {
281
+ }
282
+ });
283
+ /**
284
+ * 触发取消事件
285
+ */
286
+ a(this, w, () => {
287
+ this.distinguishCancelAndClose ? t(this, b).call(this, "message-close") : t(this, b).call(this, "cancel");
288
+ });
289
+ /**
290
+ * 初始化拖拽事件
291
+ */
292
+ a(this, M, (e) => {
293
+ if (!t(this, f).contains(e.target) || t(this, f) === e.target)
294
+ return;
295
+ const n = new AbortController(), d = this.shadowRoot.querySelector(
296
+ ".ea-overlay__content"
297
+ );
298
+ window.addEventListener(
299
+ "mousemove",
300
+ (x) => {
301
+ d.style.left = x.clientX + "px", d.style.top = x.clientY + "px";
302
+ },
303
+ {
304
+ signal: n.signal
305
+ }
306
+ ), window.addEventListener(
307
+ "mouseup",
308
+ () => {
309
+ n.abort();
310
+ },
311
+ { signal: n.signal }
312
+ );
313
+ });
314
+ }
315
+ // ------- inputPattern -------
316
+ // #region
317
+ get inputPattern() {
318
+ return t(this, u).inputPattern;
319
+ }
320
+ set inputPattern(e) {
321
+ t(this, u).inputPattern = e;
322
+ }
323
+ // #endregion
324
+ // ------- end -------
325
+ // ------- dangerouslyUseHTMLString -------
326
+ // #region
327
+ get dangerouslyUseHTMLString() {
328
+ return t(this, u).dangerouslyUseHTMLString;
329
+ }
330
+ set dangerouslyUseHTMLString(e) {
331
+ t(this, u).dangerouslyUseHTMLString = e;
332
+ }
333
+ // #endregion
334
+ // ------- end -------
335
+ // ------- confirmButtonLoading -------
336
+ // #region
337
+ get confirmButtonLoading() {
338
+ return t(this, u).confirmButtonLoading;
339
+ }
340
+ set confirmButtonLoading(e) {
341
+ t(this, u).confirmButtonLoading = e, t(this, r) && (t(this, o).disabled = e, t(this, r).loading = e);
342
+ }
343
+ // #endregion
344
+ // ------- end -------
345
+ // ------- distinguishCancelAndClose -------
346
+ // #region
347
+ get distinguishCancelAndClose() {
348
+ return t(this, u).distinguishCancelAndClose;
349
+ }
350
+ set distinguishCancelAndClose(e) {
351
+ t(this, u).distinguishCancelAndClose = e;
352
+ }
353
+ // #endregion
354
+ // ------- end -------
355
+ static get observedAttributes() {
356
+ return U.Array.toLowerCamelCase([
357
+ ...super.observedAttributes,
358
+ "boxType",
359
+ "visible",
360
+ "title",
361
+ "message",
362
+ "type",
363
+ "icon",
364
+ "showClose",
365
+ "closeIcon",
366
+ "showCancelButton",
367
+ "showConfirmButton",
368
+ "cancelButtonText",
369
+ "confirmButtonText",
370
+ "closeOnClickModal",
371
+ "center",
372
+ "roundButton",
373
+ "buttonSize",
374
+ "closeOnPressEscape",
375
+ "showInput",
376
+ "inputPlaceholder",
377
+ "inputType",
378
+ "inputValue",
379
+ // "inputPattern",
380
+ "inputErrorMessage",
381
+ "draggable"
382
+ ]);
383
+ }
384
+ /**
385
+ * 获取 classlist 列表
386
+ * @return {string} 属性值
387
+ */
388
+ updateContainerClasslist() {
389
+ var e;
390
+ return `${super.updateContainerClasslist()} ${this.computedClasslist(
391
+ "ea-message-box",
392
+ {
393
+ "--visible": this.visible,
394
+ "--center": this.center,
395
+ [`--${this.type}`]: this.type,
396
+ "--draggable": this.draggable
397
+ },
398
+ {
399
+ invalid: t(this, o) && ((e = t(this, o)) == null ? void 0 : e.invalid),
400
+ [`${this["box-type"]}-box`]: this["box-type"]
401
+ }
402
+ )}`;
403
+ }
404
+ connectedCallback() {
405
+ var e;
406
+ this.setAttribute("role", "dialog"), this["content-width"] = "100%", this["content-max-width"] = "420px", this["content-height"] = "auto", super.connectedCallback(), this.assignedStyle(N), (e = t(this, c)) == null || e.abort(), l(this, c, new AbortController()), t(this, r) && t(this, r).addEventListener("click", t(this, T), {
407
+ signal: t(this, c).signal
408
+ }), this["show-close"] && t(this, g).addEventListener(
409
+ "click",
410
+ t(this, w),
411
+ { signal: t(this, c).signal }
412
+ ), t(this, h) && t(this, h).addEventListener(
413
+ "click",
414
+ () => {
415
+ var n;
416
+ (n = t(this, c)) == null || n.abort(), t(this, b).call(this, "cancel");
417
+ },
418
+ { signal: t(this, c).signal }
419
+ ), this["close-on-press-escape"] && this.addEventListener(
420
+ "keydown",
421
+ (n) => {
422
+ n.key === "Escape" && t(this, w).call(this);
423
+ },
424
+ { signal: t(this, c).signal }
425
+ ), this.addEventListener("close", t(this, w), {
426
+ signal: t(this, c).signal
427
+ }), this.draggable && this.shadowRoot.addEventListener("mousedown", t(this, M), {
428
+ signal: t(this, c).signal
429
+ });
430
+ }
431
+ $beforeUnmounted() {
432
+ var e;
433
+ (e = t(this, c)) == null || e.abort();
434
+ }
435
+ }
436
+ m = new WeakMap(), f = new WeakMap(), v = new WeakMap(), y = new WeakMap(), g = new WeakMap(), B = new WeakMap(), C = new WeakMap(), o = new WeakMap(), _ = new WeakMap(), E = new WeakMap(), r = new WeakMap(), h = new WeakMap(), c = new WeakMap(), u = new WeakMap(), b = new WeakMap(), S = new WeakMap(), L = new WeakMap(), T = new WeakMap(), w = new WeakMap(), M = new WeakMap();
437
+ window.customElements.get("ea-message-box") || window.customElements.define("ea-message-box", D);
438
+ var P, k, A, q;
439
+ class X {
440
+ /**
441
+ *
442
+ * @param {MessageBoxOptions} options
443
+ */
444
+ constructor(s) {
445
+ /** @type {MessageBoxOptions} */
446
+ a(this, P, {
447
+ boxType: "personalized",
448
+ distinguishCancelAndClose: !1,
449
+ title: "",
450
+ dangerouslyUseHTMLString: !1,
451
+ message: "",
452
+ icon: "",
453
+ type: "primary",
454
+ closeIcon: "icon-cancel",
455
+ showClose: !0,
456
+ // lockScroll: true,
457
+ showCancelButton: !1,
458
+ showConfirmButton: !0,
459
+ confirmButtonLoading: !1,
460
+ cancelButtonText: "Cancel",
461
+ confirmButtonText: "OK",
462
+ closeOnClickModal: !0,
463
+ closeOnPressEscape: !1,
464
+ showInput: !1,
465
+ inputPlaceholder: "",
466
+ inputType: "text",
467
+ inputValue: "",
468
+ inputPattern: null,
469
+ // inputValidator: null,
470
+ inputErrorMessage: "",
471
+ center: !1,
472
+ draggable: !1,
473
+ roundButton: !1,
474
+ buttonSize: "medium",
475
+ appendTo: "body",
476
+ beforeClose: null
477
+ });
478
+ a(this, k, [
479
+ "inputPattern",
480
+ "inputValidator",
481
+ "beforeClose",
482
+ "confirmButtonLoading",
483
+ "dangerouslyUseHTMLString",
484
+ "distinguishCancelAndClose"
485
+ ]);
486
+ /**
487
+ * 元素添加
488
+ * @param {HTMLElement} el
489
+ * @param {String | HTMLElement} appendTo
490
+ */
491
+ a(this, A, (s, e) => {
492
+ if (e instanceof HTMLElement)
493
+ e.appendChild(s);
494
+ else {
495
+ const n = document.querySelector(e);
496
+ n ? n.appendChild(s) : document.body.appendChild(s);
497
+ }
498
+ });
499
+ /**
500
+ * 元素渲染
501
+ * @param {MessageBoxOptions} options
502
+ * @returns
503
+ */
504
+ a(this, q, (s) => {
505
+ const e = document.createElement("ea-message-box");
506
+ for (const n in s)
507
+ if (t(this, k).includes(n))
508
+ e[n] = s[n];
509
+ else {
510
+ const d = U.String.toLowerCamelCase(n);
511
+ e.setAttribute(d, s[n]);
512
+ }
513
+ return e;
514
+ });
515
+ s = Object.assign(
516
+ { boxType: s.boxType },
517
+ t(this, P),
518
+ s
519
+ );
520
+ const e = t(this, q).call(this, s);
521
+ this.instance = e, t(this, A).call(this, e, s.appendTo);
522
+ }
523
+ }
524
+ P = new WeakMap(), k = new WeakMap(), A = new WeakMap(), q = new WeakMap();
525
+ const p = (i) => {
526
+ const s = new AbortController(), e = new X(i).instance;
527
+ return e.visible = !0, e.addEventListener(
528
+ "closed",
529
+ () => {
530
+ e.remove(), s.abort();
531
+ },
532
+ { signal: s.signal }
533
+ ), new Promise((n, d) => {
534
+ e.addEventListener(
535
+ "confirm",
536
+ async (x) => {
537
+ if (i.beforeClose)
538
+ try {
539
+ await i.beforeClose(
540
+ "confirm",
541
+ e,
542
+ () => e.hide()
543
+ );
544
+ } catch {
545
+ }
546
+ else
547
+ e.hide();
548
+ n("confirm");
549
+ },
550
+ { signal: s.signal }
551
+ ), e.addEventListener(
552
+ "cancel",
553
+ async (x) => {
554
+ if (i.beforeClose)
555
+ try {
556
+ await i.beforeClose(
557
+ "cancel",
558
+ e,
559
+ () => e.hide()
560
+ );
561
+ } catch {
562
+ }
563
+ else
564
+ e.hide();
565
+ d("cancel");
566
+ },
567
+ { signal: s.signal }
568
+ ), e.addEventListener(
569
+ "message-close",
570
+ async (x) => {
571
+ if (i.beforeClose)
572
+ try {
573
+ await i.beforeClose(
574
+ "close",
575
+ e,
576
+ () => e.hide()
577
+ );
578
+ } catch {
579
+ }
580
+ else
581
+ e.hide();
582
+ d("close");
583
+ },
584
+ {
585
+ signal: s.signal
586
+ }
587
+ );
588
+ });
589
+ };
590
+ p.alert = (i = "", s = "", e = "") => p({
591
+ message: i,
592
+ title: s,
593
+ closeOnClickModal: !1,
594
+ showConfirmButton: !0,
595
+ boxType: "alert",
596
+ ...e
597
+ });
598
+ p.confirm = (i = "", s = "", e = "") => p({
599
+ message: i,
600
+ title: s,
601
+ showConfirmButton: !0,
602
+ showCancelButton: !0,
603
+ closeOnPressEscape: !0,
604
+ boxType: "confirm",
605
+ ...e
606
+ });
607
+ p.prompt = (i = "", s = "", e = "") => p({
608
+ message: i,
609
+ title: s,
610
+ showConfirmButton: !0,
611
+ showCancelButton: !0,
612
+ showInput: !0,
613
+ closeOnPressEscape: !0,
614
+ boxType: "prompt",
615
+ ...e
616
+ });
617
+ window.$alert = p.alert;
618
+ window.$confirm = p.confirm;
619
+ window.$prompt = p.prompt;
620
+ window.$msgbox = p;
621
+ export {
622
+ p as EaMessageBox,
623
+ D as EaMessageBoxElement
624
+ };