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.
Files changed (168) hide show
  1. package/package.json +308 -304
  2. package/dist/assets/icon.css +0 -1
  3. package/dist/components/Base.js +0 -873
  4. package/dist/components/ea-alert.js +0 -196
  5. package/dist/components/ea-avatar.js +0 -159
  6. package/dist/components/ea-backtop.js +0 -136
  7. package/dist/components/ea-badge.js +0 -144
  8. package/dist/components/ea-breadcrumb.js +0 -148
  9. package/dist/components/ea-button.js +0 -265
  10. package/dist/components/ea-calendar.js +0 -10
  11. package/dist/components/ea-calendar2.js +0 -671
  12. package/dist/components/ea-card.js +0 -85
  13. package/dist/components/ea-carousel.js +0 -415
  14. package/dist/components/ea-checkbox.js +0 -446
  15. package/dist/components/ea-collapse.js +0 -313
  16. package/dist/components/ea-color-picker.js +0 -891
  17. package/dist/components/ea-container.js +0 -177
  18. package/dist/components/ea-countdown.js +0 -142
  19. package/dist/components/ea-date-picker.js +0 -649
  20. package/dist/components/ea-descriptions.js +0 -474
  21. package/dist/components/ea-dialog.js +0 -249
  22. package/dist/components/ea-drawer.js +0 -211
  23. package/dist/components/ea-dropdown.js +0 -228
  24. package/dist/components/ea-empty.js +0 -93
  25. package/dist/components/ea-icon.js +0 -68
  26. package/dist/components/ea-image-preview.js +0 -488
  27. package/dist/components/ea-image.js +0 -302
  28. package/dist/components/ea-infinite-scroll.js +0 -109
  29. package/dist/components/ea-input-number.js +0 -367
  30. package/dist/components/ea-input.js +0 -588
  31. package/dist/components/ea-layout.js +0 -125
  32. package/dist/components/ea-link.js +0 -101
  33. package/dist/components/ea-loading.js +0 -151
  34. package/dist/components/ea-menu.js +0 -433
  35. package/dist/components/ea-message-box.js +0 -624
  36. package/dist/components/ea-message.js +0 -251
  37. package/dist/components/ea-notification.js +0 -331
  38. package/dist/components/ea-overlay.js +0 -167
  39. package/dist/components/ea-page-header.js +0 -108
  40. package/dist/components/ea-pagination.js +0 -481
  41. package/dist/components/ea-popconfirm.js +0 -275
  42. package/dist/components/ea-popover.js +0 -123
  43. package/dist/components/ea-popper.js +0 -203
  44. package/dist/components/ea-progress.js +0 -286
  45. package/dist/components/ea-radio.js +0 -364
  46. package/dist/components/ea-rate.js +0 -241
  47. package/dist/components/ea-result.js +0 -100
  48. package/dist/components/ea-scrollbar.js +0 -235
  49. package/dist/components/ea-segmented.js +0 -215
  50. package/dist/components/ea-select.js +0 -609
  51. package/dist/components/ea-skeleton.js +0 -263
  52. package/dist/components/ea-slider.js +0 -421
  53. package/dist/components/ea-space.js +0 -123
  54. package/dist/components/ea-splitter.js +0 -217
  55. package/dist/components/ea-statistic.js +0 -74
  56. package/dist/components/ea-steps.js +0 -346
  57. package/dist/components/ea-switch.js +0 -271
  58. package/dist/components/ea-table.js +0 -1124
  59. package/dist/components/ea-tabs.js +0 -501
  60. package/dist/components/ea-tag.js +0 -228
  61. package/dist/components/ea-text.js +0 -113
  62. package/dist/components/ea-time-picker.js +0 -514
  63. package/dist/components/ea-timeline.js +0 -185
  64. package/dist/components/ea-tooltip.js +0 -121
  65. package/dist/components/ea-tour.js +0 -544
  66. package/dist/components/ea-transfer.js +0 -949
  67. package/dist/components/ea-tree.js +0 -1125
  68. package/dist/components/index.js +0 -61
  69. package/dist/core/FormBase.js +0 -238
  70. package/dist/css/ea-alert.style.js +0 -4
  71. package/dist/css/ea-aside.style.js +0 -4
  72. package/dist/css/ea-avatar.style.js +0 -4
  73. package/dist/css/ea-backtop.style.js +0 -4
  74. package/dist/css/ea-badge.style.js +0 -4
  75. package/dist/css/ea-breadcrumb-item.style.js +0 -4
  76. package/dist/css/ea-breadcrumb.style.js +0 -4
  77. package/dist/css/ea-button-group.style.js +0 -4
  78. package/dist/css/ea-button.style.js +0 -4
  79. package/dist/css/ea-calendar.style.js +0 -4
  80. package/dist/css/ea-card.style.js +0 -4
  81. package/dist/css/ea-carousel-item.style.js +0 -4
  82. package/dist/css/ea-carousel.style.js +0 -4
  83. package/dist/css/ea-check-tag.style.js +0 -4
  84. package/dist/css/ea-checkbox-group.style.js +0 -4
  85. package/dist/css/ea-checkbox.style.js +0 -4
  86. package/dist/css/ea-col.style.js +0 -4
  87. package/dist/css/ea-collapse-item.style.js +0 -4
  88. package/dist/css/ea-collapse.style.js +0 -4
  89. package/dist/css/ea-color-picker-panel.style.js +0 -4
  90. package/dist/css/ea-color-picker.style.js +0 -4
  91. package/dist/css/ea-container.style.js +0 -4
  92. package/dist/css/ea-date-picker.style.js +0 -4
  93. package/dist/css/ea-descriptions-item.style.js +0 -4
  94. package/dist/css/ea-descriptions.style.js +0 -4
  95. package/dist/css/ea-dialog.style.js +0 -4
  96. package/dist/css/ea-drawer.style.js +0 -4
  97. package/dist/css/ea-dropdown-item.style.js +0 -4
  98. package/dist/css/ea-dropdown-menu.style.js +0 -4
  99. package/dist/css/ea-dropdown.style.js +0 -4
  100. package/dist/css/ea-empty.style.js +0 -4
  101. package/dist/css/ea-footer.style.js +0 -4
  102. package/dist/css/ea-header.style.js +0 -4
  103. package/dist/css/ea-icon.style.js +0 -4
  104. package/dist/css/ea-image-preview.style.js +0 -4
  105. package/dist/css/ea-image.style.js +0 -4
  106. package/dist/css/ea-infinite-scroll.style.js +0 -4
  107. package/dist/css/ea-input-number.style.js +0 -4
  108. package/dist/css/ea-input.style.js +0 -4
  109. package/dist/css/ea-link.style.js +0 -4
  110. package/dist/css/ea-main.style.js +0 -4
  111. package/dist/css/ea-menu-item-group.style.js +0 -4
  112. package/dist/css/ea-menu-item.style.js +0 -4
  113. package/dist/css/ea-menu.style.js +0 -4
  114. package/dist/css/ea-message-box.style.js +0 -4
  115. package/dist/css/ea-message.style.js +0 -4
  116. package/dist/css/ea-notification.style.js +0 -4
  117. package/dist/css/ea-option-gropu.style.js +0 -4
  118. package/dist/css/ea-option.style.js +0 -4
  119. package/dist/css/ea-overlay.style.js +0 -4
  120. package/dist/css/ea-page-header.style.js +0 -4
  121. package/dist/css/ea-pagination.style.js +0 -4
  122. package/dist/css/ea-popconfirm.style.js +0 -4
  123. package/dist/css/ea-popover.style.js +0 -4
  124. package/dist/css/ea-popper.style.js +0 -4
  125. package/dist/css/ea-progress.style.js +0 -4
  126. package/dist/css/ea-radio-group.style.js +0 -4
  127. package/dist/css/ea-radio.style.js +0 -4
  128. package/dist/css/ea-rate.style.js +0 -4
  129. package/dist/css/ea-result.style.js +0 -4
  130. package/dist/css/ea-row.style.js +0 -4
  131. package/dist/css/ea-scrollbar.style.js +0 -4
  132. package/dist/css/ea-segmented.style.js +0 -4
  133. package/dist/css/ea-select.style.js +0 -4
  134. package/dist/css/ea-skeleton-item.style.js +0 -4
  135. package/dist/css/ea-skeleton.style.js +0 -4
  136. package/dist/css/ea-slider.style.js +0 -4
  137. package/dist/css/ea-space.style.js +0 -4
  138. package/dist/css/ea-splitter-bar.style.js +0 -4
  139. package/dist/css/ea-splitter-panel.style.js +0 -4
  140. package/dist/css/ea-splitter.style.js +0 -4
  141. package/dist/css/ea-statistic.style.js +0 -4
  142. package/dist/css/ea-step.style.js +0 -4
  143. package/dist/css/ea-steps.style.js +0 -4
  144. package/dist/css/ea-sub-menu.style.js +0 -4
  145. package/dist/css/ea-switch.style.js +0 -4
  146. package/dist/css/ea-tab-panel.style.js +0 -4
  147. package/dist/css/ea-tab.style.js +0 -4
  148. package/dist/css/ea-table-column.style.js +0 -4
  149. package/dist/css/ea-table.style.js +0 -4
  150. package/dist/css/ea-tabs.style.js +0 -4
  151. package/dist/css/ea-tag.style.js +0 -4
  152. package/dist/css/ea-text.style.js +0 -4
  153. package/dist/css/ea-time-picker.style.js +0 -4
  154. package/dist/css/ea-timeline-item.style.js +0 -4
  155. package/dist/css/ea-timeline.style.js +0 -4
  156. package/dist/css/ea-tooltip.style.js +0 -4
  157. package/dist/css/ea-tour-step.style.js +0 -4
  158. package/dist/css/ea-tour.style.js +0 -4
  159. package/dist/css/ea-transfer.style.js +0 -5
  160. package/dist/css/ea-tree.style.js +0 -6
  161. package/dist/css/ea-ui-component.style.js +0 -4
  162. package/dist/favicon.ico +0 -0
  163. package/dist/utils/Color.js +0 -439
  164. package/dist/utils/I18nManager.js +0 -218
  165. package/dist/utils/Utils.js +0 -65
  166. package/dist/utils/Variables.js +0 -12
  167. package/dist/utils/parseTime.js +0 -73
  168. package/dist/utils/timeout.js +0 -9
@@ -1,624 +0,0 @@
1
- var U = Object.defineProperty;
2
- var O = (i) => {
3
- throw TypeError(i);
4
- };
5
- var z = (i, s, e) => s in i ? U(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)), o = (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 $ } from "../utils/Utils.js";
13
- var p, f, v, y, g, B, C, a, _, 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
- o(this, p);
19
- /** @type {HTMLElement} */
20
- o(this, f);
21
- /** @type {HTMLElement} */
22
- o(this, v);
23
- /** @type {HTMLElement} */
24
- o(this, y);
25
- /** @type {HTMLElement} */
26
- o(this, g);
27
- /** @type {HTMLElement} */
28
- o(this, B);
29
- /** @type {HTMLElement} */
30
- o(this, C);
31
- /** @type {HTMLInputElement} */
32
- o(this, a);
33
- /** @type {HTMLElement} */
34
- o(this, _);
35
- /** @type {HTMLElement} */
36
- o(this, E);
37
- /** @type {HTMLElement} */
38
- o(this, r);
39
- /** @type {HTMLElement} */
40
- o(this, h);
41
- /** @type {AbortController} */
42
- o(this, c);
43
- o(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, p).className = this.updateContainerClasslist();
57
- }
58
- },
59
- visible: {
60
- type: Boolean,
61
- default: !1,
62
- observer: async (e) => {
63
- this.status = e, t(this, p).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: "info",
86
- success: "ok-circled",
87
- info: "info",
88
- warning: "attention-alt",
89
- error: "cancel-circled"
90
- };
91
- this.icon = `icon-${n[e]}`, t(this, p).className = this.updateContainerClasslist();
92
- }
93
- },
94
- icon: {
95
- type: String,
96
- default: "",
97
- observer: (e) => {
98
- t(this, y) && (t(this, y).icon = e);
99
- }
100
- },
101
- closeIcon: {
102
- type: String,
103
- default: "icon-cancel",
104
- observer: (e) => {
105
- t(this, g).icon = 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, p).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, a).style.display = e ? "block" : "none";
168
- }
169
- },
170
- inputPlaceholder: {
171
- type: String,
172
- default: "",
173
- observer: (e) => {
174
- t(this, a) && (t(this, a).placeholder = e);
175
- }
176
- },
177
- inputType: {
178
- type: String,
179
- default: "text",
180
- observer: (e) => {
181
- t(this, a) && (t(this, a).type = e);
182
- }
183
- },
184
- inputValue: {
185
- type: String,
186
- default: "",
187
- observer: (e) => {
188
- t(this, a) && (t(this, a).value = e);
189
- }
190
- },
191
- inputErrorMessage: {
192
- type: String,
193
- default: "",
194
- observer: (e) => {
195
- t(this, a) && this.inputPattern && (t(this, _).textContent = e);
196
- }
197
- },
198
- draggable: {
199
- type: Boolean,
200
- default: !1,
201
- observer: (e) => {
202
- t(this, p).className = this.updateContainerClasslist();
203
- }
204
- }
205
- }));
206
- /**
207
- * 派发事件
208
- * @param {string} customEventName 自定义事件名称
209
- * @param {object} detail 自定义事件详情
210
- */
211
- o(this, b, (e, n) => {
212
- this.emit(e, {
213
- detail: n,
214
- bubbles: !0,
215
- composed: !0
216
- });
217
- });
218
- o(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" icon="icon-cancel" 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, p, 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, a, this.shadowRoot.querySelector(".ea-message-box-main__input")), l(this, _, this.shadowRoot.querySelector(
255
- ".ea-message-box-main__invalid-message"
256
- )), t(this, a) && K(() => {
257
- t(this, a).focus();
258
- }, 0);
259
- });
260
- /**
261
- * 处理带有匹配规则的输入框输入
262
- * @returns {Promise<boolean>} Promise.
263
- */
264
- o(this, L, () => new Promise((e, n) => {
265
- if (!t(this, a) || !this.inputPattern) return e(!0);
266
- const d = this.inputPattern.test(t(this, a).value);
267
- t(this, p).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
- o(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
- o(this, w, () => {
287
- this.distinguishCancelAndClose ? t(this, b).call(this, "message-close") : t(this, b).call(this, "cancel");
288
- });
289
- /**
290
- * 初始化拖拽事件
291
- */
292
- o(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, a).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 $.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, a) && ((e = t(this, a)) == 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
- p = new WeakMap(), f = new WeakMap(), v = new WeakMap(), y = new WeakMap(), g = new WeakMap(), B = new WeakMap(), C = new WeakMap(), a = 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, A, k, q;
439
- class X {
440
- /**
441
- *
442
- * @param {MessageBoxOptions} options
443
- */
444
- constructor(s) {
445
- /** @type {MessageBoxOptions} */
446
- o(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
- o(this, A, [
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
- o(this, k, (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
- o(this, q, (s) => {
505
- const e = document.createElement("ea-message-box");
506
- for (const n in s)
507
- if (t(this, A).includes(n))
508
- e[n] = s[n];
509
- else {
510
- const d = $.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, k).call(this, e, s.appendTo);
522
- }
523
- }
524
- P = new WeakMap(), A = new WeakMap(), k = new WeakMap(), q = new WeakMap();
525
- const m = (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
- m.alert = (i = "", s = "", e = "") => m({
591
- message: i,
592
- title: s,
593
- closeOnClickModal: !1,
594
- showConfirmButton: !0,
595
- boxType: "alert",
596
- ...e
597
- });
598
- m.confirm = (i = "", s = "", e = "") => m({
599
- message: i,
600
- title: s,
601
- showConfirmButton: !0,
602
- showCancelButton: !0,
603
- closeOnPressEscape: !0,
604
- boxType: "confirm",
605
- ...e
606
- });
607
- m.prompt = (i = "", s = "", e = "") => m({
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 = m.alert;
618
- window.$confirm = m.confirm;
619
- window.$prompt = m.prompt;
620
- window.$msgbox = m;
621
- export {
622
- m as EaMessageBox,
623
- D as EaMessageBoxElement
624
- };