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,275 @@
1
+ var F = Object.defineProperty;
2
+ var z = (n) => {
3
+ throw TypeError(n);
4
+ };
5
+ var j = (n, i, t) => i in n ? F(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t;
6
+ var H = (n, i, t) => j(n, typeof i != "symbol" ? i + "" : i, t), x = (n, i, t) => i.has(n) || z("Cannot " + t);
7
+ var e = (n, i, t) => (x(n, i, "read from private field"), t ? t.call(n) : i.get(n)), s = (n, i, t) => i.has(n) ? z("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(n) : i.set(n, t), a = (n, i, t, o) => (x(n, i, "write to private field"), o ? o.call(n, t) : i.set(n, t), t), M = (n, i, t) => (x(n, i, "access private method"), t);
8
+ import { EaPopper as D } from "./ea-popper.js";
9
+ import { s as G } from "../css/ea-popconfirm.style.js";
10
+ var v, p, f, B, L, d, u, m, $, C, b, y, h, c, S, _, U, g, w, q;
11
+ class J extends D {
12
+ constructor() {
13
+ super();
14
+ s(this, _);
15
+ /** @type {HTMLElement} */
16
+ s(this, v);
17
+ /** @type {HTMLElement} */
18
+ s(this, p);
19
+ /** @type {HTMLElement} */
20
+ s(this, f);
21
+ /** @type {HTMLElement} */
22
+ s(this, B);
23
+ /** @type {HTMLElement} */
24
+ s(this, L);
25
+ /** @type {HTMLElement} */
26
+ s(this, d);
27
+ /** @type {HTMLElement} */
28
+ s(this, u);
29
+ /** @type {HTMLElement} */
30
+ s(this, m);
31
+ /** @type {HTMLElement} */
32
+ s(this, $);
33
+ /** @type {HTMLElement} */
34
+ s(this, C);
35
+ /** @type {HTMLElement} */
36
+ s(this, b);
37
+ /** @type {HTMLElement} */
38
+ s(this, y);
39
+ /** @type {AbortController} */
40
+ s(this, h);
41
+ s(this, c, {
42
+ /** @type {AbortController | null} */
43
+ globalClose: null,
44
+ /** @type {AbortController | null} */
45
+ customActions: null
46
+ });
47
+ H(this, "state", this.properties({
48
+ title: {
49
+ type: String,
50
+ default: "",
51
+ observer: (t) => {
52
+ e(this, y).innerText = t;
53
+ }
54
+ },
55
+ visible: {
56
+ type: Boolean,
57
+ default: !1,
58
+ observer: (t) => {
59
+ this.status = t;
60
+ }
61
+ },
62
+ icon: {
63
+ type: String,
64
+ default: "circle-question",
65
+ observer: (t) => {
66
+ e(this, b).name = t;
67
+ }
68
+ },
69
+ "icon-color": {
70
+ type: String,
71
+ default: "rgb(255, 153, 0)",
72
+ observer: (t) => {
73
+ if (!CSS.supports("color", t))
74
+ return console.warn(
75
+ `[EaPopconfirm] The color value ${t} is not supported.`
76
+ );
77
+ this.style.setProperty("--ea-popconfirm-title-icon-color", t);
78
+ }
79
+ },
80
+ "hide-icon": {
81
+ type: Boolean,
82
+ default: !1,
83
+ observer: (t) => {
84
+ this.style.setProperty(
85
+ "--ea-popconfirm-title-icon-display",
86
+ t ? "none" : "block"
87
+ );
88
+ }
89
+ },
90
+ "confirm-button-text": {
91
+ type: String,
92
+ default: "确定",
93
+ observer: (t) => {
94
+ e(this, m).textContent = t;
95
+ }
96
+ },
97
+ "cancel-button-text": {
98
+ type: String,
99
+ default: "取消",
100
+ observer: (t) => {
101
+ e(this, u).textContent = t;
102
+ }
103
+ },
104
+ "confirm-button-type": {
105
+ type: ["normal", "primary", "success", "warning", "danger"],
106
+ default: "primary",
107
+ observer: (t) => {
108
+ e(this, m).type = t;
109
+ }
110
+ },
111
+ "cancel-button-type": {
112
+ type: ["normal", "primary", "success", "warning", "danger"],
113
+ default: "normal",
114
+ observer: (t) => {
115
+ e(this, u).type = t;
116
+ }
117
+ }
118
+ }));
119
+ /**
120
+ * 渲染title
121
+ * @returns {{
122
+ * titleContainer: HTMLElement,
123
+ * titleIcon: HTMLElement,
124
+ * titleContent: HTMLElement,
125
+ * }}
126
+ */
127
+ s(this, S, () => {
128
+ const t = document.createElement("section");
129
+ return t.classList.add("ea-popconfirm__title"), t.part = "title", t.innerHTML = `
130
+ ${this.icon ? `<ea-icon name="${this.icon}" part="icon"></ea-icon>` : ""}
131
+ <span class="ea-popconfirm__title-content" part="title-content">${this.title}</span>
132
+ `, e(this, p).appendChild(t), {
133
+ titleContainer: t,
134
+ titleIcon: t.querySelector("ea-icon"),
135
+ titleContent: t.querySelector(".ea-popconfirm__title-content")
136
+ };
137
+ });
138
+ /**
139
+ * 初始化关闭事件
140
+ * @param {HTMLElement} el
141
+ * @param {'cancel' | 'confirm'} closeEventName 关闭事件名称
142
+ */
143
+ s(this, g, (t, o) => {
144
+ t && t.addEventListener(
145
+ "click",
146
+ () => {
147
+ this.dispatchEvent(new CustomEvent(o)), this.hide();
148
+ },
149
+ { signal: e(this, h).signal }
150
+ );
151
+ });
152
+ /**
153
+ * 初始化触发事件
154
+ */
155
+ s(this, w, () => {
156
+ const t = e(this, f).querySelector(
157
+ 'slot[name="reference"]'
158
+ ), o = e(this, d).querySelector('slot[name="actions"]');
159
+ t.addEventListener(
160
+ "click",
161
+ () => {
162
+ this.open();
163
+ },
164
+ { signal: e(this, h).signal }
165
+ ), o.assignedElements().length ? e(this, q).call(this) : (e(this, g).call(this, e(this, u), "cancel"), e(this, g).call(this, e(this, m), "confirm"));
166
+ });
167
+ /**
168
+ * 初始化自定义 actions slot 的事件监听
169
+ */
170
+ s(this, q, () => {
171
+ var l;
172
+ const t = e(this, d).querySelector('slot[name="actions"]');
173
+ if (!t) return;
174
+ (l = e(this, c).customActions) == null || l.abort(), e(this, c).customActions = new AbortController();
175
+ const o = () => {
176
+ t.assignedElements().forEach((r) => {
177
+ var T, P, I, R;
178
+ const E = ((T = r.querySelector) == null ? void 0 : T.call(r, "[data-cancel]")) || ((P = r.matches) != null && P.call(r, "[data-cancel]") ? r : null), k = ((I = r.querySelector) == null ? void 0 : I.call(r, "[data-confirm]")) || ((R = r.matches) != null && R.call(r, "[data-confirm]") ? r : null);
179
+ E && E.addEventListener(
180
+ "click",
181
+ () => {
182
+ this.close(), this.dispatchEvent(new CustomEvent("cancel"));
183
+ },
184
+ { signal: e(this, c).customActions.signal }
185
+ ), k && k.addEventListener(
186
+ "click",
187
+ () => {
188
+ this.close(), this.dispatchEvent(new CustomEvent("confirm"));
189
+ },
190
+ { signal: e(this, c).customActions.signal }
191
+ );
192
+ });
193
+ };
194
+ t.addEventListener("slotchange", o, {
195
+ signal: e(this, c).customActions.signal
196
+ });
197
+ });
198
+ a(this, v, this.shadowRoot.querySelector(".ea-popper")), a(this, p, this.shadowRoot.querySelector(
199
+ ".ea-popper__original"
200
+ )), a(this, f, this.shadowRoot.querySelector(
201
+ ".ea-popper__reference"
202
+ ));
203
+ const { titleContainer: t, titleIcon: o, titleContent: l } = e(this, S).call(this), { footer: A, cancelButton: r, confirmButton: E } = M(this, _, U).call(this);
204
+ a(this, d, A), a(this, u, r), a(this, m, E), a(this, C, t), a(this, b, o), a(this, y, l);
205
+ }
206
+ static get observedAttributes() {
207
+ return [
208
+ ...super.observedAttributes,
209
+ "title",
210
+ "visible",
211
+ "icon",
212
+ "icon-color",
213
+ "hide-icon",
214
+ "confirm-button-text",
215
+ "cancel-button-text",
216
+ "confirm-button-type",
217
+ "cancel-button-type"
218
+ ];
219
+ }
220
+ /**
221
+ * 打开 popconfirm
222
+ * @public
223
+ */
224
+ open() {
225
+ var o;
226
+ const t = (l) => {
227
+ var r;
228
+ this.contains(l.target) || ((r = e(this, c).globalClose) == null || r.abort(), this.hide());
229
+ };
230
+ this.show(), (o = e(this, c).globalClose) == null || o.abort(), e(this, c).globalClose = new AbortController(), window.addEventListener("click", t, {
231
+ signal: e(this, c).globalClose.signal
232
+ });
233
+ }
234
+ /**
235
+ * 关闭 popconfirm
236
+ * @public
237
+ */
238
+ close() {
239
+ var t;
240
+ this.hide(), (t = e(this, c).globalClose) == null || t.abort();
241
+ }
242
+ connectedCallback() {
243
+ var t, o;
244
+ super.connectedCallback(), (t = e(this, h)) == null || t.abort(), a(this, h, new AbortController()), (o = e(this, p).querySelector("slot")) == null || o.remove(), this.assignedStyle(G), e(this, w).call(this);
245
+ }
246
+ $beforeUnmounted() {
247
+ var t, o;
248
+ super.$beforeUnmounted(), (t = e(this, h)) == null || t.abort();
249
+ for (const l in e(this, c))
250
+ (o = e(this, c)[l]) == null || o.abort();
251
+ }
252
+ }
253
+ v = new WeakMap(), p = new WeakMap(), f = new WeakMap(), B = new WeakMap(), L = new WeakMap(), d = new WeakMap(), u = new WeakMap(), m = new WeakMap(), $ = new WeakMap(), C = new WeakMap(), b = new WeakMap(), y = new WeakMap(), h = new WeakMap(), c = new WeakMap(), S = new WeakMap(), _ = new WeakSet(), /**
254
+ * 渲染footer
255
+ * @return {{
256
+ * footer: HTMLElement,
257
+ * cancelButton: HTMLElement,
258
+ * confirmButton: HTMLElement,
259
+ * }}
260
+ */
261
+ U = function() {
262
+ const t = `<slot name="actions">
263
+ <ea-button type="${this["cancel-button-type"]}" class="ea-popconfirm__cancel" size="small" part="cancel-button" text>${this["cancel-button-text"]}</ea-button>
264
+ <ea-button type="${this["confirm-button-type"]}" class="ea-popconfirm__confirm" part="confirm-button" size="small">${this["confirm-button-text"]}</ea-button>
265
+ </slot>`, o = document.createElement("footer");
266
+ return o.classList.add("ea-popconfirm__footer"), o.part = "footer", o.innerHTML = t, e(this, p).appendChild(o), {
267
+ footer: o,
268
+ cancelButton: o.querySelector(".ea-popconfirm__cancel"),
269
+ confirmButton: o.querySelector(".ea-popconfirm__confirm")
270
+ };
271
+ }, g = new WeakMap(), w = new WeakMap(), q = new WeakMap();
272
+ window.customElements.get("ea-popconfirm") || window.customElements.define("ea-popconfirm", J);
273
+ export {
274
+ J as EaPopconfirm
275
+ };
@@ -0,0 +1,147 @@
1
+ var x = Object.defineProperty;
2
+ var E = (t) => {
3
+ throw TypeError(t);
4
+ };
5
+ var S = (t, s, e) => s in t ? x(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
6
+ var w = (t, s, e) => S(t, typeof s != "symbol" ? s + "" : s, e), y = (t, s, e) => s.has(t) || E("Cannot " + e);
7
+ var o = (t, s, e) => (y(t, s, "read from private field"), e ? e.call(t) : s.get(t)), r = (t, s, e) => s.has(t) ? E("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), c = (t, s, e, i) => (y(t, s, "write to private field"), i ? i.call(t, e) : s.set(t, e), e);
8
+ import { EaPopper as L } from "./ea-popper.js";
9
+ import { s as _ } from "../css/ea-popover.style.js";
10
+ var u, l, v, a, h, d, f, p, g, m;
11
+ class k extends L {
12
+ constructor() {
13
+ super();
14
+ /** @type {HTMLElement} */
15
+ r(this, u);
16
+ /** @type {HTMLElement} */
17
+ r(this, l);
18
+ /** @type {HTMLElement} */
19
+ r(this, v);
20
+ /** @type {HTMLElement} */
21
+ r(this, a);
22
+ /** @type {HTMLElement} */
23
+ r(this, h);
24
+ /** @type {AbortController} */
25
+ r(this, d);
26
+ r(this, f);
27
+ w(this, "state", this.properties({
28
+ trigger: {
29
+ type: ["click", "focus", "hover", "contextmenu", "customized"],
30
+ default: "hover",
31
+ observer: (e) => {
32
+ }
33
+ },
34
+ visible: {
35
+ type: Boolean,
36
+ default: !1,
37
+ observer: (e) => {
38
+ this.status = e;
39
+ }
40
+ },
41
+ title: {
42
+ type: String,
43
+ default: "",
44
+ observer: (e) => {
45
+ if (o(this, a))
46
+ o(this, a).innerText = e;
47
+ else {
48
+ const i = document.createElement("div"), n = o(this, l).querySelector("slot");
49
+ i.classList.add("ea-popover__title"), i.part = "title", i.innerText = e, o(this, l).insertBefore(i, n), c(this, a, i);
50
+ }
51
+ }
52
+ },
53
+ content: {
54
+ type: String,
55
+ default: "",
56
+ observer: (e) => {
57
+ if (o(this, h))
58
+ o(this, h).innerText = e;
59
+ else {
60
+ const i = document.createElement("div"), n = o(this, l).querySelector("slot");
61
+ i.classList.add("ea-popover__content"), i.part = "content", i.innerText = e, o(this, l).appendChild(i), c(this, h, i), n.remove();
62
+ }
63
+ }
64
+ }
65
+ }));
66
+ r(this, p, {
67
+ hover: () => {
68
+ this.addEventListener(
69
+ "mouseover",
70
+ (e) => {
71
+ this.show(), this.addEventListener(
72
+ "mouseout",
73
+ (i) => {
74
+ this.hide();
75
+ },
76
+ { once: !0 }
77
+ );
78
+ },
79
+ { signal: o(this, d).signal }
80
+ );
81
+ },
82
+ click: () => {
83
+ this.addEventListener("click", () => {
84
+ this.toggle();
85
+ });
86
+ },
87
+ focus: () => {
88
+ this.addEventListener("focus", () => {
89
+ this.show(), this.addEventListener("blur", (e) => {
90
+ this.hide();
91
+ });
92
+ });
93
+ },
94
+ contextmenu: () => {
95
+ this.addEventListener("contextmenu", (e) => {
96
+ e.preventDefault();
97
+ const i = new AbortController();
98
+ this.show(), window.addEventListener(
99
+ "click",
100
+ (n) => {
101
+ this.contains(n.target) || (this.hide(), i.abort());
102
+ },
103
+ { signal: i.signal }
104
+ );
105
+ });
106
+ }
107
+ });
108
+ r(this, g, () => {
109
+ const e = new AbortController();
110
+ c(this, d, e), this.assignedStyle(_);
111
+ });
112
+ r(this, m, () => {
113
+ var i, n;
114
+ if (this.trigger === "customized") return;
115
+ const e = Object.keys(o(this, p)).find(
116
+ (b) => this.trigger === b
117
+ );
118
+ (n = (i = o(this, p))[e || "hover"]) == null || n.call(i), e || console.warn(`[EaPopper] trigger event ${this.trigger} is not exist`);
119
+ });
120
+ c(this, u, this.shadowRoot.querySelector(".ea-popper")), c(this, l, this.shadowRoot.querySelector(
121
+ ".ea-popper__original"
122
+ )), c(this, v, this.shadowRoot.querySelector(
123
+ ".ea-popper__reference"
124
+ ));
125
+ }
126
+ static get observedAttributes() {
127
+ return [
128
+ ...super.observedAttributes,
129
+ "trigger",
130
+ "title",
131
+ "content",
132
+ "visible"
133
+ ];
134
+ }
135
+ connectedCallback() {
136
+ super.connectedCallback(), o(this, g).call(this), o(this, m).call(this);
137
+ }
138
+ $beforeUnmounted() {
139
+ var e;
140
+ super.$beforeUnmounted(), (e = o(this, d)) == null || e.abort();
141
+ }
142
+ }
143
+ u = new WeakMap(), l = new WeakMap(), v = new WeakMap(), a = new WeakMap(), h = new WeakMap(), d = new WeakMap(), f = new WeakMap(), p = new WeakMap(), g = new WeakMap(), m = new WeakMap();
144
+ window.customElements.get("ea-popover") || window.customElements.define("ea-popover", k);
145
+ export {
146
+ k as EaPopover
147
+ };
@@ -0,0 +1,203 @@
1
+ var y = Object.defineProperty;
2
+ var m = (s) => {
3
+ throw TypeError(s);
4
+ };
5
+ var v = (s, t, e) => t in s ? y(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
6
+ var w = (s, t, e) => v(s, typeof t != "symbol" ? t + "" : t, e), g = (s, t, e) => t.has(s) || m("Cannot " + e);
7
+ var i = (s, t, e) => (g(s, t, "read from private field"), e ? e.call(s) : t.get(s)), l = (s, t, e) => t.has(s) ? m("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, e), c = (s, t, e, r) => (g(s, t, "write to private field"), r ? r.call(s, e) : t.set(s, e), e);
8
+ import { B as C } from "./Base.js";
9
+ import { s as x } from "../css/ea-popper.style.js";
10
+ const b = (s, t = 0) => {
11
+ const e = s.getBoundingClientRect();
12
+ return e.top >= t && e.left >= t && e.bottom <= window.innerHeight - t && e.right <= window.innerWidth - t;
13
+ }, B = (s, t) => {
14
+ const e = {
15
+ left: "right",
16
+ right: "left",
17
+ top: "bottom",
18
+ bottom: "top"
19
+ }, r = s.getBoundingClientRect(), n = {
20
+ top: r.top < 0 && t.includes("top"),
21
+ bottom: r.bottom > window.innerHeight && t.includes("bottom"),
22
+ left: r.left < 0 && t.includes("left"),
23
+ right: r.right > window.innerWidth && t.includes("right")
24
+ };
25
+ if (b(s)) return t;
26
+ for (const p in n)
27
+ if (n[p])
28
+ return t.replace(p, e[p]);
29
+ return t;
30
+ };
31
+ var o, a, f, h, u, d;
32
+ class R extends C {
33
+ constructor() {
34
+ super();
35
+ /** @type {HTMLElement} */
36
+ l(this, o);
37
+ /** @type {HTMLElement} */
38
+ l(this, a);
39
+ /** @type {HTMLElement} */
40
+ l(this, f);
41
+ /** @type {AbortController} */
42
+ l(this, h);
43
+ /** @type {Boolean} */
44
+ l(this, u);
45
+ w(this, "state", this.properties({
46
+ width: {
47
+ type: Number,
48
+ default: "150",
49
+ observer: (e) => {
50
+ i(this, a).style.setProperty(
51
+ "--ea-popper-width",
52
+ `${e}px`
53
+ );
54
+ }
55
+ },
56
+ placement: {
57
+ type: [
58
+ "top",
59
+ "top-start",
60
+ "top-end",
61
+ "bottom",
62
+ "bottom-start",
63
+ "bottom-end",
64
+ "left",
65
+ "left-start",
66
+ "left-end",
67
+ "right",
68
+ "right-start",
69
+ "right-end"
70
+ ],
71
+ default: "top",
72
+ observer: (e) => {
73
+ i(this, o).className = this.updateContainerClasslist();
74
+ }
75
+ },
76
+ "show-arrow": {
77
+ type: Boolean,
78
+ default: !0,
79
+ observer: (e) => {
80
+ i(this, o).className = this.updateContainerClasslist();
81
+ }
82
+ },
83
+ status: {
84
+ type: Boolean,
85
+ default: !1,
86
+ observer: async (e) => {
87
+ var r;
88
+ if ((r = i(this, h)) == null || r.abort(), c(this, h, new AbortController()), e) {
89
+ if (i(this, o).className = this.updateContainerClasslist(), i(this, d).call(this, "show"), this.flip) {
90
+ const n = i(this, a).getBoundingClientRect(), p = b(
91
+ this,
92
+ Math.max(n.width, n.height)
93
+ );
94
+ i(this, u) === this.placement ? this.placement = B(
95
+ i(this, a),
96
+ this.placement
97
+ ) : p && (this.placement = i(this, u));
98
+ }
99
+ i(this, o).offsetWidth, i(this, o).classList.add("ea-popper--is-show"), i(this, o).addEventListener(
100
+ "transitionend",
101
+ () => {
102
+ i(this, d).call(this, "shown");
103
+ },
104
+ { once: !0, signal: i(this, h).signal }
105
+ );
106
+ } else
107
+ i(this, o).classList.add("ea-popper--before-hide"), i(this, d).call(this, "hide"), i(this, o).addEventListener(
108
+ "transitionend",
109
+ () => {
110
+ i(this, o).className = this.updateContainerClasslist(), i(this, d).call(this, "hidden");
111
+ },
112
+ { once: !0, signal: i(this, h).signal }
113
+ );
114
+ }
115
+ },
116
+ offset: {
117
+ type: String,
118
+ default: "0 0",
119
+ observer: (e) => {
120
+ try {
121
+ let [r, n] = e.split(" ").map((p) => Number(p.trim()));
122
+ if (r && typeof n > "u")
123
+ n = r;
124
+ else if (!(r && n || `${r} ${n}` == "0 0"))
125
+ throw new RangeError(
126
+ `[ea-popper] Invalid offset value: ${e}, expected format: "x(Number) y(Number)"`
127
+ );
128
+ i(this, a).style.setProperty(
129
+ "--ea-popper-transform-x",
130
+ `${r}px`
131
+ ), i(this, a).style.setProperty(
132
+ "--ea-popper-transform-y",
133
+ `${n}px`
134
+ );
135
+ } catch (r) {
136
+ console.error(r);
137
+ }
138
+ }
139
+ },
140
+ flip: {
141
+ type: Boolean,
142
+ default: !0,
143
+ observer: (e) => {
144
+ }
145
+ }
146
+ }));
147
+ l(this, d, (e, r) => {
148
+ this.emit(e, {
149
+ detail: r,
150
+ bubbles: !0,
151
+ composed: !0
152
+ });
153
+ });
154
+ this.stylesheet = x, this.$render();
155
+ }
156
+ static get observedAttributes() {
157
+ return ["width", "placement", "show-arrow", "status", "offset", "filp"];
158
+ }
159
+ /**
160
+ * 获取 classlist 列表
161
+ * @return {string} 属性值
162
+ */
163
+ updateContainerClasslist() {
164
+ return this.computedClasslist("ea-popper", {
165
+ ["--" + this.placement]: this.placement,
166
+ "--show-arrow": this["show-arrow"],
167
+ "--show": this.status
168
+ });
169
+ }
170
+ $render() {
171
+ this.shadowRoot.innerHTML = `
172
+ <div class='ea-popper' part='container' tabindex='-1'>
173
+ <div class='ea-popper__reference' part='reference' tabindex='-1'>
174
+ <div class='ea-popper__original' part='original' tabindex='0'>
175
+ <slot></slot>
176
+ </div>
177
+ <slot name='reference'></slot>
178
+ </div>
179
+ </div>
180
+ `, c(this, o, this.shadowRoot.querySelector(".ea-popper")), c(this, a, this.shadowRoot.querySelector(
181
+ ".ea-popper__original"
182
+ )), c(this, f, this.shadowRoot.querySelector(
183
+ ".ea-popper__reference"
184
+ ));
185
+ }
186
+ show() {
187
+ this.status = !0;
188
+ }
189
+ hide() {
190
+ this.status = !1;
191
+ }
192
+ toggle() {
193
+ this.status = !this.status;
194
+ }
195
+ connectedCallback() {
196
+ super.connectedCallback(), this.placement = this.placement, c(this, u, this.placement);
197
+ }
198
+ }
199
+ o = new WeakMap(), a = new WeakMap(), f = new WeakMap(), h = new WeakMap(), u = new WeakMap(), d = new WeakMap();
200
+ window.customElements.get("ea-popper") || window.customElements.define("ea-popper", R);
201
+ export {
202
+ R as EaPopper
203
+ };