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,588 @@
1
+ var B = Object.defineProperty;
2
+ var $ = (n) => {
3
+ throw TypeError(n);
4
+ };
5
+ var F = (n, o, t) => o in n ? B(n, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[o] = t;
6
+ var T = (n, o, t) => F(n, typeof o != "symbol" ? o + "" : o, t), k = (n, o, t) => o.has(n) || $("Cannot " + t);
7
+ var e = (n, o, t) => (k(n, o, "read from private field"), t ? t.call(n) : o.get(n)), a = (n, o, t) => o.has(n) ? $("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(n) : o.set(n, t), h = (n, o, t, s) => (k(n, o, "write to private field"), s ? s.call(n, t) : o.set(n, t), t);
8
+ import { F as I } from "../core/FormBase.js";
9
+ import { E as M } from "../utils/Utils.js";
10
+ import { s as V } from "../css/ea-input.style.js";
11
+ class U extends Event {
12
+ constructor(o) {
13
+ super("ea-clear", { bubbles: !0, cancelable: !0, composed: !0 }), this.detail = o;
14
+ }
15
+ }
16
+ var g, C, _, w, m, i, R, b, y, p, x, S, v, u, l, d, r, P, O, E, A, q, z, L, H, f;
17
+ class G extends I {
18
+ constructor() {
19
+ super();
20
+ /** @type {HTMLElement} */
21
+ a(this, g);
22
+ /** @type {HTMLElement} */
23
+ a(this, C);
24
+ /** @type {HTMLElement} */
25
+ a(this, _);
26
+ /** @type {HTMLElement} */
27
+ a(this, w);
28
+ /** @type {HTMLElement} */
29
+ a(this, m);
30
+ /** @type {HTMLInputElement | HTMLTextAreaElement} */
31
+ a(this, i);
32
+ /** @type {HTMLElement} */
33
+ a(this, R);
34
+ /** @type {HTMLElement} */
35
+ a(this, b);
36
+ /** @type {HTMLElement} */
37
+ a(this, y);
38
+ /** @type {HTMLElement} */
39
+ a(this, p);
40
+ /** @type {HTMLElement} */
41
+ a(this, x);
42
+ /** @type {HTMLElement} */
43
+ a(this, S);
44
+ /** @type {HTMLElement} */
45
+ a(this, v);
46
+ /** @type {AbortController} */
47
+ a(this, u);
48
+ a(this, l, {
49
+ /** @type {AbortController} */
50
+ clearableController: null,
51
+ /** @type {AbortController} */
52
+ showPasswordController: null,
53
+ /** @type {AbortController} */
54
+ autosizeController: null,
55
+ /** @type {AbortController} */
56
+ wordCountController: null
57
+ });
58
+ a(this, d, {
59
+ isFocus: !1,
60
+ isMouseenter: !1,
61
+ originTextareaHeight: 0,
62
+ isOriginalRendered: !1
63
+ });
64
+ a(this, r, {
65
+ isOriginalRenderedPromise: new Promise((t) => {
66
+ h(this, d, new Proxy(e(this, d), {
67
+ set: (s, c, N) => (c === "isOriginalRendered" && N && t(!0), Reflect.set(s, c, N))
68
+ }));
69
+ })
70
+ });
71
+ T(this, "state", this.properties({
72
+ label: {
73
+ type: String,
74
+ default: "",
75
+ observer: async (t) => {
76
+ await e(this, r).isOriginalRenderedPromise, e(this, v).textContent = t;
77
+ }
78
+ },
79
+ type: {
80
+ type: [
81
+ "textarea",
82
+ "text",
83
+ "button",
84
+ "checkbox",
85
+ "color",
86
+ "date",
87
+ "datetime-local",
88
+ "email",
89
+ "file",
90
+ "hidden",
91
+ "image",
92
+ "month",
93
+ "number",
94
+ "password",
95
+ "radio",
96
+ "range",
97
+ "reset",
98
+ "search",
99
+ "submit",
100
+ "tel",
101
+ "time",
102
+ "url",
103
+ "week"
104
+ ],
105
+ default: "text",
106
+ observer: async (t) => {
107
+ e(this, P).call(this, t), this.updateContainerClasslist();
108
+ }
109
+ },
110
+ size: {
111
+ type: ["large", "default", "small"],
112
+ default: "default",
113
+ observer: (t) => {
114
+ this.updateContainerClasslist();
115
+ }
116
+ },
117
+ value: {
118
+ type: String,
119
+ default: "",
120
+ observer: async (t) => {
121
+ await e(this, r).isOriginalRenderedPromise, t = typeof t == "string" && t === "" ? null : t, e(this, i).value = t, this.setValue(t), this.resetCustomValidity(), (this.clearable || this["show-password"]) && this.updateContainerClasslist();
122
+ }
123
+ },
124
+ required: {
125
+ type: Boolean,
126
+ default: !1,
127
+ observer: async (t) => {
128
+ await e(this, r).isOriginalRenderedPromise, e(this, i).required = t;
129
+ }
130
+ },
131
+ placeholder: {
132
+ type: String,
133
+ default: "",
134
+ observer: async (t) => {
135
+ await e(this, r).isOriginalRenderedPromise, e(this, i).placeholder = t;
136
+ }
137
+ },
138
+ maxlength: {
139
+ type: Number,
140
+ default: void 0,
141
+ observer: async (t) => {
142
+ await e(this, r).isOriginalRenderedPromise, this.hasAttribute("maxlength") && (e(this, i).maxLength = t);
143
+ }
144
+ },
145
+ minlength: {
146
+ type: Number,
147
+ default: void 0,
148
+ observer: async (t) => {
149
+ await e(this, r).isOriginalRenderedPromise, this.hasAttribute("minlength") && (e(this, i).minLength = t);
150
+ }
151
+ },
152
+ clearable: {
153
+ type: Boolean,
154
+ default: !1,
155
+ observer: (t) => {
156
+ var s;
157
+ (s = e(this, l).clearableController) == null || s.abort(), this.updateContainerClasslist(), t && (e(this, l).clearableController = new AbortController(), e(this, y).addEventListener(
158
+ "click",
159
+ e(this, z),
160
+ {
161
+ signal: e(this, l).clearableController.signal
162
+ }
163
+ ));
164
+ }
165
+ },
166
+ "clear-icon": {
167
+ type: String,
168
+ default: "xmark",
169
+ observer: (t) => {
170
+ this.clearable && e(this, y).setAttribute("name", t);
171
+ }
172
+ },
173
+ disabled: {
174
+ type: Boolean,
175
+ default: !1,
176
+ observer: async (t) => {
177
+ await e(this, r).isOriginalRenderedPromise, e(this, i).disabled = t, this.updateContainerClasslist();
178
+ }
179
+ },
180
+ "show-password": {
181
+ type: Boolean,
182
+ default: !1,
183
+ observer: (t) => {
184
+ var s;
185
+ this.type !== "textarea" && ((s = e(this, l).showPasswordController) == null || s.abort(), this.type === "text" ? e(this, p).name = "eye" : this.type === "password" && (e(this, p).name = "eye-slash"), t && (this.type === "password" || this.type === "text") && (e(this, l).showPasswordController = new AbortController(), e(this, p).addEventListener(
186
+ "click",
187
+ e(this, L),
188
+ {
189
+ signal: e(this, l).showPasswordController.signal
190
+ }
191
+ )), this.updateContainerClasslist());
192
+ }
193
+ },
194
+ "prefix-icon": {
195
+ type: String,
196
+ default: "",
197
+ observer: (t) => {
198
+ t && (e(this, w).innerHTML = `<ea-icon class="ea-input__prefix-icon" part="prefix-icon" name="${t}"></ea-icon>`);
199
+ }
200
+ },
201
+ "suffix-icon": {
202
+ type: String,
203
+ default: "",
204
+ observer: (t) => {
205
+ t && (e(this, b).innerHTML = `<ea-icon class="ea-input__suffix-icon" part="suffix-icon" name="${t}"></ea-icon>`);
206
+ }
207
+ },
208
+ "show-word-limit": {
209
+ type: Boolean,
210
+ default: !1,
211
+ observer: async (t) => {
212
+ var s;
213
+ this.type !== "textarea" && this.type !== "text" || (await e(this, r).isOriginalRenderedPromise, (s = e(this, l).wordCountController) == null || s.abort(), t && this.hasAttribute("maxlength") && (e(this, l).wordCountController = new AbortController(), e(this, f).call(this), e(this, i).addEventListener(
214
+ "input",
215
+ e(this, f),
216
+ {
217
+ signal: e(this, l).wordCountController.signal
218
+ }
219
+ )), this.updateContainerClasslist());
220
+ }
221
+ },
222
+ rows: {
223
+ type: Number,
224
+ default: 2,
225
+ observer: async (t) => {
226
+ this.type === "textarea" && (await e(this, r).isOriginalRenderedPromise, e(this, i).rows = t);
227
+ }
228
+ },
229
+ autosize: {
230
+ type: Boolean,
231
+ default: !1,
232
+ observer: async (t) => {
233
+ var s;
234
+ this.type === "textarea" && (await e(this, r).isOriginalRenderedPromise, (s = e(this, l).autosizeController) == null || s.abort(), e(this, i).clientHeight, e(this, d).originTextareaHeight = e(this, i).scrollHeight, t && (e(this, l).autosizeController = new AbortController(), e(this, i).addEventListener("input", e(this, H), {
235
+ signal: e(this, l).autosizeController.signal
236
+ })));
237
+ }
238
+ },
239
+ "min-rows": {
240
+ type: Number,
241
+ default: 0,
242
+ observer: async (t) => {
243
+ this.type === "textarea" && (await e(this, r).isOriginalRenderedPromise, e(this, i).minRows = t);
244
+ }
245
+ },
246
+ "max-rows": {
247
+ type: Number,
248
+ default: 0,
249
+ observer: async (t) => {
250
+ this.type === "textarea" && (await e(this, r).isOriginalRenderedPromise, e(this, i).maxRows = t);
251
+ }
252
+ },
253
+ autocomplete: {
254
+ type: String,
255
+ default: "off",
256
+ observer: async (t) => {
257
+ await e(this, r).isOriginalRenderedPromise, e(this, i).autocomplete = t;
258
+ }
259
+ },
260
+ name: {
261
+ type: String,
262
+ default: "",
263
+ observer: async (t) => {
264
+ await e(this, r).isOriginalRenderedPromise, e(this, i).name = t;
265
+ }
266
+ },
267
+ readonly: {
268
+ type: Boolean,
269
+ default: !1,
270
+ observer: async (t) => {
271
+ await e(this, r).isOriginalRenderedPromise, e(this, i).readOnly = t;
272
+ }
273
+ },
274
+ max: {
275
+ type: Number,
276
+ default: Number.MAX_SAFE_INTEGER,
277
+ observer: async (t) => {
278
+ await e(this, r).isOriginalRenderedPromise, e(this, i).max = t;
279
+ }
280
+ },
281
+ min: {
282
+ type: Number,
283
+ default: Number.MIN_SAFE_INTEGER,
284
+ observer: async (t) => {
285
+ await e(this, r).isOriginalRenderedPromise, e(this, i).min = t;
286
+ }
287
+ },
288
+ step: {
289
+ type: Number,
290
+ default: 1,
291
+ observer: async (t) => {
292
+ await e(this, r).isOriginalRenderedPromise, e(this, i).step = t;
293
+ }
294
+ },
295
+ pattern: {
296
+ type: String,
297
+ default: "",
298
+ observer: async (t) => {
299
+ await e(this, r).isOriginalRenderedPromise, e(this, i).pattern = t;
300
+ }
301
+ },
302
+ resize: {
303
+ type: ["none", "both", "horizontal", "vertical"],
304
+ default: "vertical",
305
+ observer: (t) => {
306
+ this.style.setProperty("--ea-input-resize", t);
307
+ }
308
+ },
309
+ autofocus: {
310
+ type: Boolean,
311
+ default: !1,
312
+ observer: async (t) => {
313
+ await e(this, r).isOriginalRenderedPromise, e(this, i).autofocus = t;
314
+ }
315
+ },
316
+ form: {
317
+ type: String,
318
+ default: "",
319
+ observer: async (t) => {
320
+ await e(this, r).isOriginalRenderedPromise, e(this, i).form = t;
321
+ }
322
+ },
323
+ "aria-label": {
324
+ type: String,
325
+ default: "",
326
+ observer: async (t) => {
327
+ await e(this, r).isOriginalRenderedPromise, e(this, i).setAttribute("aria-label", t);
328
+ }
329
+ },
330
+ tabindex: {
331
+ type: String,
332
+ default: "",
333
+ observer: async (t) => {
334
+ await e(this, r).isOriginalRenderedPromise, e(this, i).tabIndex = t;
335
+ }
336
+ },
337
+ inputmode: {
338
+ type: String,
339
+ default: "",
340
+ observer: async (t) => {
341
+ await e(this, r).isOriginalRenderedPromise, e(this, i).inputMode = t;
342
+ }
343
+ }
344
+ }));
345
+ /**
346
+ * 渲染函数,因为在 vue 环境下 constructor 中,有概率获取不到 type,所以渲染会出问题。
347
+ * 所以最后的办法就是 将与 original 相关的 js 逻辑,需要等待 original 渲染完成之后再执行。
348
+ * @param {String} type
349
+ */
350
+ a(this, P, (t) => {
351
+ const s = this.id || Math.random().toString(36).substring(2, 7), c = t === "textarea" ? `<textarea id="${s}" class="ea-input__original" part="original"></textarea>` : `<input id="${s}" class="ea-input__original" type="${t}" part="original" />`;
352
+ e(this, m).innerHTML = c, h(this, i, e(this, m).querySelector(".ea-input__original")), e(this, i).value = this.value, e(this, d).isOriginalRendered = !0;
353
+ });
354
+ /**
355
+ * 输入框内容发生改变时触发
356
+ * @param {FocusEvent} e 事件对象
357
+ */
358
+ a(this, O, (t) => {
359
+ e(this, d).isFocus = !0, this.updateContainerClasslist();
360
+ });
361
+ /**
362
+ * 输入框失去焦点时触发
363
+ * @param {FocusEvent} e 事件对象
364
+ */
365
+ a(this, E, (t) => {
366
+ e(this, d).isFocus = !1, this.updateContainerClasslist();
367
+ });
368
+ /**
369
+ * 输入框内容发生改变时触发
370
+ * @param {InputEvent} e 事件对象
371
+ */
372
+ a(this, A, (t) => {
373
+ const { value: s } = t.target;
374
+ this.value = s;
375
+ });
376
+ /**
377
+ * 初始化基本事件
378
+ */
379
+ a(this, q, () => {
380
+ e(this, i).addEventListener("focus", e(this, O), {
381
+ signal: e(this, u).signal
382
+ }), e(this, i).addEventListener("blur", e(this, E), {
383
+ signal: e(this, u).signal
384
+ }), e(this, i).addEventListener("input", e(this, A), {
385
+ signal: e(this, u).signal
386
+ });
387
+ });
388
+ /**
389
+ * 清空按钮点击时触发
390
+ */
391
+ a(this, z, () => {
392
+ const t = this.value;
393
+ this.clear(), this["show-word-limit"] && (this.type === "textarea" || this.type === "text") && e(this, f).call(this), this.focus(), this.dispatchEvent(new U({ oldValue: t }));
394
+ });
395
+ /**
396
+ * 显示密码按钮点击时触发
397
+ */
398
+ a(this, L, () => {
399
+ this.type === "password" ? (this.type = "text", e(this, p).name = "eye") : this.type === "text" && (this.type = "password", e(this, p).name = "eye-slash"), this.focus();
400
+ });
401
+ /**
402
+ * 自动调整高度
403
+ * @param {InputEvent} e
404
+ */
405
+ a(this, H, (t) => {
406
+ const s = e(this, d).originTextareaHeight / this.rows;
407
+ this["min-rows"] > 0 && e(this, i).scrollHeight < this["min-rows"] * s || this["max-rows"] > 0 && e(this, i).scrollHeight > this["max-rows"] * s || (e(this, i).style.height = `${e(this, d).originTextareaHeight}px`, e(this, i).scrollHeight, e(this, i).style.height = `${t.target.scrollHeight + 2}px`);
408
+ });
409
+ /**
410
+ * 当包含 show-word-limit 属性时,更新字数统计
411
+ */
412
+ a(this, f, () => {
413
+ e(this, x).textContent = `${e(this, i).value.length} / ${this.maxlength}`;
414
+ });
415
+ this.stylesheet = V, this.$render();
416
+ }
417
+ static get observedAttributes() {
418
+ return M.Array.toLowerCamelCase([
419
+ ...super.observedAttributes,
420
+ "label",
421
+ "type",
422
+ "disabled",
423
+ "value",
424
+ "size",
425
+ "placeholder",
426
+ "maxlength",
427
+ "minlength",
428
+ "clearable",
429
+ "clear-icon",
430
+ "show-password",
431
+ "disabled",
432
+ "prefix-icon",
433
+ "suffix-icon",
434
+ "show-word-limit",
435
+ "rows",
436
+ "autosize",
437
+ "min-rows",
438
+ "max-rows",
439
+ "autocomplete",
440
+ "name",
441
+ "readonly",
442
+ "max",
443
+ "min",
444
+ "step",
445
+ "resize",
446
+ "autofocus",
447
+ "form",
448
+ "aria-label",
449
+ "tabindex",
450
+ "inputmode"
451
+ ]);
452
+ }
453
+ /**
454
+ * 获取验证目标元素
455
+ * @returns {HTMLElement}
456
+ */
457
+ get validationTarget() {
458
+ return e(this, i);
459
+ }
460
+ /**
461
+ * 获取 classlist 列表
462
+ * @return {string} 属性值
463
+ */
464
+ updateContainerClasslist() {
465
+ const t = this.computedClasslist(
466
+ "ea-input",
467
+ {
468
+ ["--size-" + this.size]: this.type !== "textarea" && this.size !== "default",
469
+ "--has-prepend": this.type !== "textarea" && this.querySelector("[slot=prepend]"),
470
+ "--has-append": this.type !== "textarea" && this.querySelector("[slot=append]"),
471
+ "--textarea": this.type === "textarea",
472
+ "--show-password": this["show-password"] && this.value && this.type !== "textarea",
473
+ "--show-word-limit": this["show-word-limit"] && (this.type === "textarea" || this.type === "text")
474
+ },
475
+ {
476
+ focus: e(this, d).isFocus,
477
+ disabled: this.disabled,
478
+ clearable: this.clearable && this.value && this.type !== "textarea"
479
+ }
480
+ );
481
+ return e(this, g).className = t, t;
482
+ }
483
+ $render() {
484
+ this.shadowRoot.innerHTML = `
485
+ <label class="ea-input" part="container">
486
+ <span class="ea-input__form-label" part="label"></span>
487
+ <section class="ea-input__region" part="region">
488
+ <div class="ea-input__prepend" part="prepend">
489
+ <slot name="prepend"></slot>
490
+ </div>
491
+ <div class="ea-input__inner" part="inner">
492
+ <span class="ea-input__prefix" part="prefix">
493
+ <slot name="prefix"></slot>
494
+ </span>
495
+ <span class="ea-input__original-wrapper" part="original-wrapper">
496
+ </span>
497
+ <span class="ea-input__suffix" part="suffix">
498
+ <ea-icon class="ea-input__clear-icon" name="xmark" part="clear-icon"></ea-icon>
499
+ <ea-icon class="ea-input__show-password-icon" name="eye-slash" part="show-password-icon"></ea-icon>
500
+ <span class="ea-input__suffix-icon" part="suffix-icon">
501
+ <slot name="suffix"></slot>
502
+ </span>
503
+ <span class="ea-input__word-count" part="count"></span>
504
+ </span>
505
+ </div>
506
+ <div class="ea-input__append" part="append">
507
+ <slot name="append"></slot>
508
+ </div>
509
+ </section>
510
+ </div>
511
+ `, h(this, g, this.shadowRoot.querySelector(".ea-input")), h(this, v, this.shadowRoot.querySelector(".ea-input__form-label")), h(this, C, this.shadowRoot.querySelector(".ea-input__prepend")), h(this, _, this.shadowRoot.querySelector(".ea-input__inner")), h(this, w, this.shadowRoot.querySelector(
512
+ ".ea-input__prefix slot[name='prefix']"
513
+ )), h(this, m, this.shadowRoot.querySelector(
514
+ ".ea-input__original-wrapper"
515
+ )), h(this, R, this.shadowRoot.querySelector(".ea-input__suffix")), h(this, b, this.shadowRoot.querySelector(".ea-input__suffix-icon")), h(this, y, this.shadowRoot.querySelector(".ea-input__clear-icon")), h(this, p, this.shadowRoot.querySelector(
516
+ ".ea-input__show-password-icon"
517
+ )), h(this, x, this.shadowRoot.querySelector(".ea-input__word-count")), h(this, S, this.shadowRoot.querySelector(".ea-input__append"));
518
+ }
519
+ /**
520
+ * 获取焦点
521
+ */
522
+ focus() {
523
+ e(this, d).isFocus = !0, e(this, i).focus();
524
+ }
525
+ /**
526
+ * 失去焦点
527
+ */
528
+ blur() {
529
+ e(this, d).isFocus = !1, e(this, i).blur();
530
+ }
531
+ /**
532
+ * 清空输入框内容
533
+ */
534
+ clear() {
535
+ this.value = "", e(this, i).value = "", this["show-word-limit"] && this.maxlength && e(this, f).call(this);
536
+ }
537
+ /**
538
+ * 选中输入框内容
539
+ */
540
+ select() {
541
+ e(this, i).select();
542
+ }
543
+ connectedCallback() {
544
+ var t;
545
+ super.connectedCallback(), (t = e(this, u)) == null || t.abort(), h(this, u, new AbortController()), this.hasAttribute("type") || (this.type = this.type), this.updateContainerClasslist(), e(this, q).call(this);
546
+ }
547
+ $beforeUnmounted() {
548
+ var t, s;
549
+ (t = e(this, u)) == null || t.abort(), h(this, u, null);
550
+ for (const c in e(this, l))
551
+ (s = e(this, l)[c]) == null || s.abort(), e(this, l)[c] = null;
552
+ }
553
+ /**
554
+ * 更新表单验证状态
555
+ */
556
+ updateValidity() {
557
+ super.updateValidity();
558
+ const t = this.value || "";
559
+ this.minlength > 0 && t.length > 0 && t.length < this.minlength && (this.internals.setValidity(
560
+ { tooShort: !0 },
561
+ `请至少输入 ${this.minlength} 个字符`,
562
+ e(this, i)
563
+ ), this.internals.reportValidity()), this.maxlength > 0 && t.length > this.maxlength && (this.internals.setValidity(
564
+ { tooLong: !0 },
565
+ `请最多输入 ${this.maxlength} 个字符`,
566
+ e(this, i)
567
+ ), this.internals.reportValidity());
568
+ }
569
+ /**
570
+ * 检查表单字段的有效性
571
+ * @returns {boolean}
572
+ */
573
+ checkValidity() {
574
+ return this.updateValidity(), this.internals.validity.valid;
575
+ }
576
+ /**
577
+ * 报告表单字段的有效性(显示验证提示)
578
+ * @returns {boolean}
579
+ */
580
+ reportValidity() {
581
+ return this.updateValidity(), this.internals.reportValidity();
582
+ }
583
+ }
584
+ g = new WeakMap(), C = new WeakMap(), _ = new WeakMap(), w = new WeakMap(), m = new WeakMap(), i = new WeakMap(), R = new WeakMap(), b = new WeakMap(), y = new WeakMap(), p = new WeakMap(), x = new WeakMap(), S = new WeakMap(), v = new WeakMap(), u = new WeakMap(), l = new WeakMap(), d = new WeakMap(), r = new WeakMap(), P = new WeakMap(), O = new WeakMap(), E = new WeakMap(), A = new WeakMap(), q = new WeakMap(), z = new WeakMap(), L = new WeakMap(), H = new WeakMap(), f = new WeakMap();
585
+ window.customElements.get("ea-input") || window.customElements.define("ea-input", G);
586
+ export {
587
+ G as EaInput
588
+ };