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,609 +0,0 @@
1
- var P = Object.defineProperty;
2
- var I = (r) => {
3
- throw TypeError(r);
4
- };
5
- var W = (r, a, t) => a in r ? P(r, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[a] = t;
6
- var y = (r, a, t) => W(r, typeof a != "symbol" ? a + "" : a, t), O = (r, a, t) => a.has(r) || I("Cannot " + t);
7
- var e = (r, a, t) => (O(r, a, "read from private field"), t ? t.call(r) : a.get(r)), l = (r, a, t) => a.has(r) ? I("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(r) : a.set(r, t), v = (r, a, t, s) => (O(r, a, "write to private field"), s ? s.call(r, t) : a.set(r, t), t);
8
- import { F as G } from "../core/FormBase.js";
9
- import "./ea-input.js";
10
- import { s as K } from "../css/ea-select.style.js";
11
- import { E as N } from "../utils/Utils.js";
12
- import { E as Z } from "../utils/Variables.js";
13
- import { B as H } from "./Base.js";
14
- import { s as j } from "../css/ea-option.style.js";
15
- import { s as J } from "../css/ea-option-gropu.style.js";
16
- class z extends Event {
17
- constructor(a) {
18
- super("ea-visible-change", { bubbles: !0, composed: !0 }), this.detail = a;
19
- }
20
- }
21
- class Q extends Event {
22
- constructor(a) {
23
- super("ea-remove-tag", { bubbles: !0, composed: !0 }), this.detail = a;
24
- }
25
- }
26
- class X extends Event {
27
- constructor() {
28
- super("ea-clear", { bubbles: !0, composed: !0 });
29
- }
30
- }
31
- var E, o, w, k, q, S, f, n, m, L, B, T, F, M, D;
32
- class Y extends G {
33
- constructor() {
34
- super();
35
- /** @type {HTMLElement} */
36
- l(this, E);
37
- /** @type {HTMLElement} */
38
- l(this, o);
39
- /** @type {HTMLElement} */
40
- l(this, w);
41
- /** @type {HTMLElement} */
42
- l(this, k);
43
- /** @type {HTMLElement} */
44
- l(this, q);
45
- /** @type {HTMLElement} */
46
- l(this, S);
47
- /** @type {AbortController} */
48
- l(this, f, new AbortController());
49
- l(this, n, {
50
- /** @type {AbortController|null} */
51
- closeAbortController: null,
52
- /** @type {AbortController|null} */
53
- tagRemoveAbortController: null,
54
- /** @type {AbortController|null} */
55
- inputClearAbortController: null,
56
- /** @type {AbortController|null} */
57
- inputFilterAbortController: null
58
- });
59
- l(this, m, {
60
- isFocus: !1,
61
- isTagImport: !1
62
- });
63
- y(this, "state", this.properties({
64
- label: {
65
- type: String,
66
- default: "",
67
- observer: async (t) => {
68
- await customElements.whenDefined("ea-input"), e(this, o).setAttribute("label", t);
69
- }
70
- },
71
- name: {
72
- type: String,
73
- default: "",
74
- observer: (t) => {
75
- e(this, o).setAttribute("name", t);
76
- }
77
- },
78
- placeholder: {
79
- type: String,
80
- default: "",
81
- observer: async (t) => {
82
- await customElements.whenDefined("ea-input"), e(this, o).placeholder = t;
83
- }
84
- },
85
- disabled: {
86
- type: Boolean,
87
- default: !1,
88
- observer: (t) => {
89
- e(this, o).toggleAttribute("disabled", t), this.updateContainerClasslist();
90
- }
91
- },
92
- clearable: {
93
- type: Boolean,
94
- default: !1,
95
- observer: (t) => {
96
- var s;
97
- if ((s = e(this, n).inputClearAbortController) == null || s.abort(), this.updateContainerClasslist(), t) {
98
- const i = () => {
99
- const u = this.multiple ? [] : "";
100
- this.value = u, this.emit("change", {
101
- detail: { value: u },
102
- bubbles: !0,
103
- composed: !0
104
- }), this.dispatchEvent(new X());
105
- };
106
- e(this, n).inputClearAbortController = new AbortController(), e(this, S).addEventListener("click", i, {
107
- signal: e(this, n).inputClearAbortController.signal
108
- });
109
- }
110
- }
111
- },
112
- size: {
113
- type: Z,
114
- default: "",
115
- observer: (t) => {
116
- e(this, o).setAttribute("size", t), this.updateContainerClasslist();
117
- }
118
- },
119
- multiple: {
120
- type: Boolean,
121
- default: !1,
122
- observer: async (t) => {
123
- var h;
124
- (h = e(this, n).tagRemoveAbortController) == null || h.abort(), await customElements.whenDefined("ea-input");
125
- const s = e(this, o).shadowRoot.querySelector(".ea-input__inner"), i = e(this, o).shadowRoot.querySelector(".ea-input__prefix"), u = e(this, o).shadowRoot.querySelector(
126
- ".ea-input__original-wrapper"
127
- );
128
- t ? i.appendChild(u) : s.insertBefore(u, i.nextSibling), this.updateContainerClasslist(), t && (e(this, n).tagRemoveAbortController = new AbortController(), e(this, w).addEventListener(
129
- "ea-remove",
130
- e(this, D),
131
- {
132
- signal: e(this, n).tagRemoveAbortController.signal
133
- }
134
- ), e(this, m).isTagImport || (await import("./ea-tag.js"), await customElements.whenDefined("ea-tag"), e(this, m).isTagImport = !0));
135
- }
136
- },
137
- "collapse-tags": {
138
- type: Boolean,
139
- default: !1,
140
- observer: () => {
141
- }
142
- },
143
- "max-collapse-tags": {
144
- type: Number,
145
- default: 1,
146
- observer: () => {
147
- }
148
- },
149
- filterable: {
150
- type: Boolean,
151
- default: !1,
152
- observer: async (t) => {
153
- var g;
154
- const s = (c) => {
155
- const { value: d } = c.detail;
156
- typeof d == "string" && this.querySelectorAll("ea-option").forEach((p) => {
157
- p.style.display = p.innerText.includes(d) ? "block" : "none";
158
- });
159
- }, i = (c) => {
160
- var p;
161
- const { key: d } = c;
162
- d === "Backspace" && e(this, o).value === "" && (this.value = (p = this.value) == null ? void 0 : p.slice(0, this.value.length - 1));
163
- };
164
- (g = e(this, n).inputFilterAbortController) == null || g.abort(), e(this, o).toggleAttribute("readonly", !t), this.updateContainerClasslist(), await customElements.whenDefined("ea-input");
165
- const u = e(this, o).shadowRoot.querySelector(".ea-input__inner"), h = e(this, o).shadowRoot.querySelector(".ea-input__prefix"), b = e(this, o).shadowRoot.querySelector(
166
- ".ea-input__original-wrapper"
167
- );
168
- t && (e(this, n).inputFilterAbortController = new AbortController(), e(this, o).addEventListener("input", s, {
169
- signal: e(this, n).inputFilterAbortController.signal
170
- })), this.multiple && t ? (h.appendChild(b), e(this, o).addEventListener("keydown", i, {
171
- signal: e(this, n).inputFilterAbortController.signal
172
- })) : u.insertBefore(b, h.nextSibling);
173
- }
174
- }
175
- }));
176
- y(this, "propStates", this.properties({
177
- value: {
178
- props: !0,
179
- type: {
180
- Array: () => {
181
- var t;
182
- return this.multiple && Array.isArray((t = this.props) == null ? void 0 : t.value);
183
- },
184
- Number: () => {
185
- var t;
186
- return typeof ((t = this.props) == null ? void 0 : t.value) == "number";
187
- },
188
- Boolean: () => {
189
- var t;
190
- return typeof ((t = this.props) == null ? void 0 : t.value) == "boolean";
191
- },
192
- String: () => {
193
- var t;
194
- return typeof ((t = this.props) == null ? void 0 : t.value) == "string";
195
- }
196
- },
197
- default: "",
198
- observer: async (t) => {
199
- this.setValue(t), this.multiple ? (this.filterable ? e(this, o).focus() : e(this, o).value = (t == null ? void 0 : t.length) > 0 ? " " : "", e(this, T).call(this, t || [])) : this.filterable ? (e(this, o).value = "", e(this, o).setAttribute(
200
- "placeholder",
201
- (t == null ? void 0 : t.length) > 0 ? t : this.placeholder
202
- ), e(this, F).call(this, "")) : e(this, o).value = e(this, L).call(this, t), e(this, B).call(this, t), this.updateContainerClasslist(), t || this.querySelectorAll("ea-option").forEach((s) => {
203
- s.toggleAttribute("selected", !1);
204
- });
205
- }
206
- }
207
- }));
208
- /**
209
- * 获取当前选中值对应的标签
210
- * @param {string} value
211
- */
212
- l(this, L, (t) => {
213
- const s = [...this.querySelectorAll("ea-option")].find(
214
- (i) => i.value === t
215
- );
216
- return s ? s.textContent.trim() : t;
217
- });
218
- /**
219
- * 设置已选项样式
220
- * @param {string | number | boolean | string[] | number[] | boolean[]} selectedValue
221
- */
222
- l(this, B, (t) => {
223
- const s = this.querySelectorAll("ea-option");
224
- typeof t == "string" || typeof t == "number" || typeof t == "boolean" ? s.forEach((i) => {
225
- i.toggleAttribute("selected", i.value === t);
226
- }) : Array.isArray(t) && s.forEach((i) => {
227
- i.toggleAttribute(
228
- "selected",
229
- t.includes(i.value)
230
- );
231
- });
232
- });
233
- /**
234
- * 渲染已选项
235
- * @param {string[] | number[]} selectValue
236
- */
237
- l(this, T, (t) => {
238
- let s = "";
239
- const i = (h, b, g) => N.EaElement.h(
240
- "ea-tag",
241
- "ea-select__tag",
242
- {
243
- closable: h,
244
- "disable-transitions": !0,
245
- type: "info",
246
- "data-value": h ? g : null
247
- },
248
- b
249
- ), u = (h) => {
250
- let b = "";
251
- return h.forEach((g) => {
252
- const c = this.querySelector(`ea-option[value="${g}"]`);
253
- c && (c.toggleAttribute("selected", !0), b += i(!0, c.innerText, c.value));
254
- }), b;
255
- };
256
- if (e(this, w).innerHTML = "", this["collapse-tags"] && Array.isArray(t)) {
257
- const h = Math.max(0, Number(this["max-collapse-tags"]) || 1), b = Math.max(0, t.length - h);
258
- h > 0 && (s += u(t.slice(0, h))), b > 0 && (s += i(!1, `+${b}`, null));
259
- } else
260
- s += u(t);
261
- e(this, w).innerHTML = s;
262
- });
263
- /**
264
- * 处理过滤选项样式
265
- * @param {string} filterValue
266
- */
267
- l(this, F, (t) => {
268
- this.querySelectorAll("ea-option").forEach((s) => {
269
- this.filterMethod(s, t);
270
- });
271
- });
272
- /**
273
- * 下拉框折叠事件
274
- * @param {Event} e
275
- */
276
- l(this, M, async (t) => {
277
- var b, g;
278
- const s = t.target === e(this, o).shadowRoot ? e(this, o) : t.target;
279
- if ((b = e(this, n).closeAbortController) == null || b.abort(), (g = s.classList) != null && g.contains("ea-select__clear-icon") || s.closest("ea-tag"))
280
- return;
281
- const i = (c) => {
282
- c.stopImmediatePropagation();
283
- const d = c.target.closest("ea-option");
284
- if (!d || d.disabled) return;
285
- let p;
286
- this.multiple ? (Array.isArray(this.value) || (this.value = []), this.value.includes(d.value) ? p = this.value.filter((U) => U !== d.value) : p = [...this.value, d.value], this.value = p) : (p = d.value, this.value = p, this.hide()), this.emit("change", {
287
- detail: { value: p },
288
- bubbles: !0,
289
- composed: !0
290
- });
291
- }, u = (c) => {
292
- var d;
293
- this.contains(c.target) || (this.hide(), (d = e(this, n).closeAbortController) == null || d.abort());
294
- }, h = (c) => {
295
- var p;
296
- (/* @__PURE__ */ new Set(["Escape", "ArrowUp", "ArrowDown"])).has(c.key) && (c.preventDefault(), c.key === "Escape" && (this.hide(), (p = e(this, n).closeAbortController) == null || p.abort()));
297
- };
298
- e(this, m).isFocus = !0, this.updateContainerClasslist(), this.dispatchEvent(new z({ visible: !0 })), await N.sleep(100), e(this, n).closeAbortController = new AbortController(), this.addEventListener("ea-option-click", i, {
299
- signal: e(this, n).closeAbortController.signal
300
- }), document.addEventListener("click", u, {
301
- signal: e(this, n).closeAbortController.signal
302
- }), this.addEventListener("keydown", h, {
303
- signal: e(this, n).closeAbortController.signal
304
- });
305
- });
306
- /**
307
- * 移除选中标签事件
308
- * @param {Event} e
309
- */
310
- l(this, D, (t) => {
311
- const s = t.target, i = s.getAttribute("data-value"), u = this.value.filter((h) => h !== i);
312
- this.value = u, this.emit("change", {
313
- detail: { value: u },
314
- bubbles: !0,
315
- composed: !0
316
- }), this.dispatchEvent(
317
- new Q({ tag: s, tagValue: i })
318
- );
319
- });
320
- /**
321
- * 过滤选项
322
- * @param {import("../ea-option/index.js").EaOption} option
323
- * @param {string} query
324
- */
325
- y(this, "filterMethod", (t, s) => {
326
- var i;
327
- t.style.display = (i = t.innerText) != null && i.includes(s) ? "block" : "none";
328
- });
329
- /**
330
- * 显示下拉框
331
- */
332
- y(this, "show", () => {
333
- e(this, o).shadowRoot.dispatchEvent(new CustomEvent("click"));
334
- });
335
- /**
336
- * 隐藏下拉框
337
- */
338
- y(this, "hide", () => {
339
- e(this, m).isFocus = !1, this.updateContainerClasslist(), this.dispatchEvent(new z({ visible: !1 }));
340
- });
341
- this.stylesheet = K, this.$render();
342
- }
343
- static get observedAttributes() {
344
- return [
345
- ...super.observedAttributes,
346
- "name",
347
- "label",
348
- "value",
349
- "placeholder",
350
- "disabled",
351
- "clearable",
352
- "size",
353
- "multiple",
354
- "collapse-tags",
355
- "max-collapse-tags",
356
- "filterable"
357
- ];
358
- }
359
- /**
360
- * 获取 classlist 列表
361
- * @return {string} 属性值
362
- */
363
- updateContainerClasslist() {
364
- var i, u, h;
365
- const t = e(this, o).shadowRoot.querySelector(".ea-input"), s = this.computedClasslist(
366
- "ea-select",
367
- {
368
- ["--" + this.size]: this.size
369
- },
370
- {
371
- focus: e(this, m).isFocus,
372
- disabled: this.disabled,
373
- clearable: this.clearable && ((i = this.value) == null ? void 0 : i.length) > 0,
374
- multiple: this.multiple && ((u = this.value) == null ? void 0 : u.length) > 0 && Array.isArray(this.value),
375
- filterable: this.filterable,
376
- "has-value": ((h = this.value) == null ? void 0 : h.toString().length) > 0
377
- }
378
- );
379
- return t.classList.toggle("is-focus", e(this, m).isFocus), e(this, E).className = s, s;
380
- }
381
- $render() {
382
- this.shadowRoot.innerHTML = `
383
- <div class='ea-select' part='container' tabindex='-1'>
384
- <ea-input class="ea-select__input" part="input" readonly>
385
- <section slot="prefix" class="ea-select__tag-wrap" part="tag-wrap"></section>
386
- <ea-icon slot="suffix" class="ea-select__clear-icon" part="clear-icon" icon='icon-cancel'></ea-icon>
387
- <ea-icon slot="suffix" class="ea-select__dropdown-icon" part="dropdown-icon" icon='icon-angle-down'></ea-icon>
388
- </ea-input>
389
- <section class="ea-select__dropdown" part="dropdown">
390
- <slot></slot>
391
- </section>
392
- </div>
393
- `, v(this, E, this.shadowRoot.querySelector(".ea-select")), v(this, o, this.shadowRoot.querySelector(".ea-select__input")), v(this, w, this.shadowRoot.querySelector(".ea-select__tag-wrap")), v(this, k, this.shadowRoot.querySelector(".ea-select__dropdown")), v(this, q, this.shadowRoot.querySelector(
394
- ".ea-select__dropdown-icon"
395
- )), v(this, S, this.shadowRoot.querySelector(".ea-select__clear-icon"));
396
- }
397
- async connectedCallback() {
398
- var t;
399
- super.connectedCallback(), await customElements.whenDefined("ea-input"), await customElements.whenDefined("ea-option"), (t = e(this, f)) == null || t.abort(), v(this, f, new AbortController()), this.name || (this.name = Math.random().toString(36).substring(2, 15)), this.hasAttribute("value") && (this.value = this.getAttrString("value")), e(this, o).shadowRoot.addEventListener(
400
- "click",
401
- e(this, M),
402
- {
403
- signal: e(this, f).signal
404
- }
405
- ), e(this, o).addEventListener(
406
- "change",
407
- (s) => {
408
- s.stopImmediatePropagation(), this.show();
409
- },
410
- { signal: e(this, f).signal }
411
- ), this.addEventListener(
412
- "keydown",
413
- (s) => {
414
- s.key === "Enter" && e(this, o).shadowRoot.dispatchEvent(new CustomEvent("click"));
415
- },
416
- { signal: e(this, f).signal }
417
- );
418
- }
419
- $beforeUnmounted() {
420
- var t, s;
421
- (t = e(this, f)) == null || t.abort();
422
- for (const i in e(this, n))
423
- (s = e(this, n)[i]) == null || s.abort();
424
- }
425
- /**
426
- * 获取验证目标元素
427
- * @returns {HTMLElement}
428
- */
429
- get validationTarget() {
430
- return e(this, o);
431
- }
432
- /**
433
- * 更新表单验证状态
434
- * 根据 ea-select 的实际 value 进行验证,而不是内部 input 的显示值
435
- */
436
- updateValidity() {
437
- const t = this.multiple ? Array.isArray(this.value) && this.value.length > 0 : this.value !== "" && this.value != null;
438
- this.required && !t ? this.internals.setValidity(
439
- { valueMissing: !0 },
440
- "请选择一个选项",
441
- this
442
- ) : this.internals.setValidity({}, "", this);
443
- }
444
- /**
445
- * 检查表单字段的有效性
446
- * @returns {boolean}
447
- */
448
- checkValidity() {
449
- return this.updateValidity(), this.internals.validity.valid;
450
- }
451
- /**
452
- * 报告表单字段的有效性(显示验证提示)
453
- * @returns {boolean}
454
- */
455
- reportValidity() {
456
- return this.updateValidity(), this.internals.reportValidity();
457
- }
458
- }
459
- E = new WeakMap(), o = new WeakMap(), w = new WeakMap(), k = new WeakMap(), q = new WeakMap(), S = new WeakMap(), f = new WeakMap(), n = new WeakMap(), m = new WeakMap(), L = new WeakMap(), B = new WeakMap(), T = new WeakMap(), F = new WeakMap(), M = new WeakMap(), D = new WeakMap();
460
- window.customElements.get("ea-select") || window.customElements.define("ea-select", Y);
461
- class V extends Event {
462
- constructor(a) {
463
- super("ea-option-click", { bubbles: !0, composed: !0 }), this.detail = a;
464
- }
465
- }
466
- var _, C, R;
467
- class tt extends H {
468
- constructor() {
469
- super();
470
- /** @type {HTMLElement} */
471
- l(this, _);
472
- /** @type {AbortController} */
473
- l(this, C, new AbortController());
474
- y(this, "state", this.properties({
475
- value: {
476
- type: {
477
- Number: () => this.getAttrNumber("value", null),
478
- Boolean: () => N.Boolean.isBoolean(this.getAttrBoolean("value", null)),
479
- String: () => this.getAttrString("value", "") || !0
480
- },
481
- default: null,
482
- observer: () => {
483
- }
484
- },
485
- selected: {
486
- type: Boolean,
487
- default: !1,
488
- observer: () => {
489
- this.updateContainerClasslist();
490
- }
491
- },
492
- disabled: {
493
- type: Boolean,
494
- default: !1,
495
- observer: () => {
496
- this.setAttribute("tabindex", this.disabled ? "-1" : "0"), this.updateContainerClasslist();
497
- }
498
- }
499
- }));
500
- /**
501
- * 选项选择事件
502
- * @param {MouseEvent | KeyboardEvent} e
503
- */
504
- l(this, R, (t) => {
505
- t.preventDefault(), t.stopImmediatePropagation(), !this.disabled && this.dispatchEvent(
506
- new V({
507
- value: this.value,
508
- target: t.target
509
- })
510
- );
511
- });
512
- this.stylesheet = j, this.$render();
513
- }
514
- static get observedAttributes() {
515
- return [...super.observedAttributes, "value", "selected", "disabled"];
516
- }
517
- /**
518
- * 获取 classlist 列表
519
- * @return {string} 属性值
520
- */
521
- updateContainerClasslist() {
522
- const t = this.computedClasslist(
523
- "ea-option",
524
- {},
525
- {
526
- selected: this.selected,
527
- disabled: this.disabled
528
- }
529
- );
530
- return e(this, _).className = t, t;
531
- }
532
- $render() {
533
- this.shadowRoot.innerHTML = `
534
- <div class='ea-option' part='container'>
535
- <slot></slot>
536
- </div>
537
- `, v(this, _, this.shadowRoot.querySelector(".ea-option"));
538
- }
539
- connectedCallback() {
540
- var s;
541
- super.connectedCallback(), this.removeAttribute("tabindex"), (s = e(this, C)) == null || s.abort(), v(this, C, new AbortController());
542
- const t = (i) => {
543
- i.key === "Enter" && e(this, R).call(this, i);
544
- };
545
- this.addEventListener("click", e(this, R), {
546
- signal: e(this, C).signal
547
- }), this.addEventListener("keydown", t, {
548
- signal: e(this, C).signal
549
- });
550
- }
551
- $beforeUnmounted() {
552
- var t;
553
- (t = e(this, C)) == null || t.abort();
554
- }
555
- }
556
- _ = new WeakMap(), C = new WeakMap(), R = new WeakMap();
557
- window.customElements.get("ea-option") || window.customElements.define("ea-option", tt);
558
- var $, x, A;
559
- class et extends H {
560
- constructor() {
561
- super();
562
- /** @type {HTMLElement} */
563
- l(this, $);
564
- /** @type {HTMLSlotElement} */
565
- l(this, x);
566
- /** @type {AbortController} */
567
- l(this, A, new AbortController());
568
- y(this, "state", this.properties({
569
- label: {
570
- type: String,
571
- default: "",
572
- observer: (t) => {
573
- e(this, x).textContent = t;
574
- }
575
- }
576
- }));
577
- this.stylesheet = J, this.$render();
578
- }
579
- static get observedAttributes() {
580
- return [...super.observedAttributes, "label"];
581
- }
582
- $render() {
583
- this.shadowRoot.innerHTML = `
584
- <div class='ea-option-group' part='container'>
585
- <header class='ea-option-group__header' part='header'>
586
- <slot name='header'></slot>
587
- </header>
588
- <section class='ea-option-group__content' part='content'>
589
- <slot></slot>
590
- </section>
591
- </div>
592
- `, v(this, $, this.shadowRoot.querySelector(".ea-option-group")), v(this, x, this.shadowRoot.querySelector("slot[name='header']"));
593
- }
594
- connectedCallback() {
595
- var t;
596
- super.connectedCallback(), (t = e(this, A)) == null || t.abort(), v(this, A, new AbortController());
597
- }
598
- $beforeUnmounted() {
599
- var t;
600
- (t = e(this, A)) == null || t.abort();
601
- }
602
- }
603
- $ = new WeakMap(), x = new WeakMap(), A = new WeakMap();
604
- window.customElements.get("ea-option-group") || window.customElements.define("ea-option-group", et);
605
- export {
606
- tt as EaOption,
607
- et as EaOptionGroup,
608
- Y as EaSelect
609
- };