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,249 @@
1
+ var _ = Object.defineProperty;
2
+ var v = (t) => {
3
+ throw TypeError(t);
4
+ };
5
+ var S = (t, s, e) => s in t ? _(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
6
+ var u = (t, s, e) => S(t, typeof s != "symbol" ? s + "" : s, e), w = (t, s, e) => s.has(t) || v("Cannot " + e);
7
+ var o = (t, s, e) => (w(t, s, "read from private field"), e ? e.call(t) : s.get(t)), a = (t, s, e) => s.has(t) ? v("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), l = (t, s, e, d) => (w(t, s, "write to private field"), d ? d.call(t, e) : s.set(t, e), e);
8
+ import { EaOverlay as E } from "./ea-overlay.js";
9
+ import { s as B } from "../css/ea-dialog.style.js";
10
+ import { t as C } from "../utils/timeout.js";
11
+ var n, h, c, p, r, i, b, f, g;
12
+ class k extends E {
13
+ constructor() {
14
+ super();
15
+ /** @type {HTMLElement} */
16
+ a(this, n);
17
+ /** @type {HTMLElement} */
18
+ a(this, h);
19
+ /** @type {HTMLElement} */
20
+ a(this, c);
21
+ /** @type {HTMLElement} */
22
+ a(this, p);
23
+ /** @type {HTMLElement} */
24
+ a(this, r);
25
+ /** @type {AbortController} */
26
+ a(this, i);
27
+ u(this, "state", this.properties({
28
+ visible: {
29
+ type: Boolean,
30
+ default: !1,
31
+ observer: (e) => {
32
+ if (!e && this["before-close"] && this.status !== this.visible)
33
+ return o(this, f).call(this);
34
+ e ? C(() => {
35
+ this.focus();
36
+ }, 0) : C(() => {
37
+ this.blur();
38
+ }, 0), this.status = e;
39
+ }
40
+ },
41
+ title: {
42
+ type: String,
43
+ default: "",
44
+ observer: (e) => {
45
+ o(this, p) && (o(this, p).textContent = e);
46
+ }
47
+ },
48
+ width: {
49
+ type: String,
50
+ default: "50%",
51
+ observer: (e) => {
52
+ this.style.setProperty("--ea-overlay-content-width", e);
53
+ }
54
+ },
55
+ top: {
56
+ type: String,
57
+ default: "50%",
58
+ observer: (e) => {
59
+ this.style.setProperty("--ea-overlay-content-top", e);
60
+ }
61
+ },
62
+ center: {
63
+ type: Boolean,
64
+ default: !1,
65
+ observer: () => {
66
+ o(this, n).className = this.updateContainerClasslist();
67
+ }
68
+ },
69
+ fullscreen: {
70
+ type: Boolean,
71
+ default: !1,
72
+ observer: () => {
73
+ o(this, n).className = this.updateContainerClasslist();
74
+ }
75
+ },
76
+ "append-to-body": {
77
+ type: Boolean,
78
+ default: !1,
79
+ observer: () => {
80
+ }
81
+ },
82
+ "append-to": {
83
+ type: String,
84
+ default: "body",
85
+ observer: () => {
86
+ }
87
+ },
88
+ "show-close": {
89
+ type: Boolean,
90
+ default: !0,
91
+ observer: (e) => {
92
+ o(this, r).style.display = e ? "block" : "none";
93
+ }
94
+ },
95
+ "modal-penetrable": {
96
+ type: Boolean,
97
+ default: !1,
98
+ observer: () => {
99
+ }
100
+ },
101
+ draggable: {
102
+ type: Boolean,
103
+ default: !1,
104
+ observer: () => {
105
+ o(this, n).className = this.updateContainerClasslist();
106
+ }
107
+ }
108
+ }));
109
+ /**
110
+ * 通过 append-to 属性,将组件插入到指定元素中
111
+ */
112
+ a(this, b, () => {
113
+ this.getAttrString("append-to") && this["append-to"] ? document.querySelector(this["append-to"]).appendChild(this) : this["append-to-body"] && document.body.appendChild(this);
114
+ });
115
+ /**
116
+ * 重置 dialog 位置
117
+ */
118
+ u(this, "resetPosition", () => {
119
+ o(this, h).style.left = "var(--ea-overlay-content-left)", o(this, h).style.top = "var(--ea-overlay-content-top)";
120
+ });
121
+ /**
122
+ * 打开 dialog
123
+ */
124
+ u(this, "show", () => {
125
+ this.visible = !0;
126
+ });
127
+ /**
128
+ * 关闭 dialog
129
+ */
130
+ u(this, "hide", () => {
131
+ this.visible = !1;
132
+ });
133
+ /**
134
+ * 触发 before-close 事件
135
+ */
136
+ a(this, f, () => {
137
+ this["before-close"] ? this.emit("before-close", {
138
+ detail: {
139
+ done: () => this.status = !1
140
+ }
141
+ }) : this.status = !1;
142
+ });
143
+ a(this, g, (e) => {
144
+ if (!o(this, c).contains(e.target) || o(this, c) !== e.target)
145
+ return;
146
+ const d = new AbortController(), m = this.shadowRoot.querySelector(
147
+ ".ea-overlay__content"
148
+ );
149
+ window.addEventListener(
150
+ "mousemove",
151
+ (y) => {
152
+ m.style.left = y.clientX + "px", m.style.top = y.clientY + "px";
153
+ },
154
+ {
155
+ signal: d.signal
156
+ }
157
+ ), window.addEventListener(
158
+ "mouseup",
159
+ () => {
160
+ d.abort();
161
+ },
162
+ { signal: d.signal }
163
+ );
164
+ });
165
+ const e = this.shadowRoot.querySelector(".ea-overlay__content");
166
+ e.innerHTML = `
167
+ <div class='ea-dialog-main' part='container'>
168
+ <header class='ea-dialog-main__header' part='header'>
169
+ <slot name="header">
170
+ <span class='ea-dialog-main__title' part='title'></span>
171
+ <ea-icon class='ea-dialog-main__close-icon' name='xmark' part='close-icon'></ea-icon>
172
+ </slot>
173
+ </header>
174
+ <main class='ea-dialog-main__content' part='content'>
175
+ <slot></slot>
176
+ </main>
177
+ <footer class='ea-dialog-main__footer' part='footer'>
178
+ <slot name='footer'></slot>
179
+ </footer>
180
+ </div>
181
+ `, l(this, n, this.shadowRoot.querySelector(".ea-overlay")), l(this, h, e), l(this, c, this.shadowRoot.querySelector(".ea-dialog-main__header")), l(this, p, this.shadowRoot.querySelector(".ea-dialog-main__title")), l(this, r, this.shadowRoot.querySelector(
182
+ ".ea-dialog-main__close-icon"
183
+ )), o(this, b).call(this);
184
+ }
185
+ static get observedAttributes() {
186
+ return [
187
+ ...super.observedAttributes,
188
+ "visible",
189
+ "title",
190
+ "width",
191
+ "fullscreen",
192
+ "top",
193
+ "modal",
194
+ "center",
195
+ "append-to-body",
196
+ "append-to",
197
+ // "lock-scroll",
198
+ // "open-delay",
199
+ // "close-delay",
200
+ "close-on-click-modal",
201
+ "close-on-press-escape",
202
+ "show-close",
203
+ "close-icon",
204
+ "before-close",
205
+ // "destroy-on-close",
206
+ "z-index",
207
+ "modal-penetrable",
208
+ "draggable"
209
+ ];
210
+ }
211
+ /**
212
+ * 获取 classlist 列表
213
+ * @return {string} 属性值
214
+ */
215
+ updateContainerClasslist() {
216
+ return `${super.updateContainerClasslist()} ${this.computedClasslist(
217
+ "ea-dialog",
218
+ {
219
+ "--center": this.center,
220
+ "--draggable": this.draggable,
221
+ "--fullscreen": this.fullscreen
222
+ },
223
+ {
224
+ dialog: !0,
225
+ "modal-penetrable": this["modal-penetrable"] && !this.modal
226
+ }
227
+ )}`;
228
+ }
229
+ connectedCallback() {
230
+ l(this, i, new AbortController()), this["close-on-click-modal"] = this.getAttrBoolean(
231
+ "close-on-click-modal",
232
+ !0
233
+ ), this.setAttribute("role", "dialog"), super.connectedCallback(), this.assignedStyle(B), this.addEventListener("closed", this.hide, {
234
+ signal: o(this, i).signal
235
+ }), this["show-close"] && o(this, r) && o(this, r).addEventListener("click", o(this, f), {
236
+ signal: o(this, i).signal
237
+ }), this.draggable && !this.fullscreen && this.shadowRoot.addEventListener("mousedown", o(this, g), {
238
+ signal: o(this, i).signal
239
+ });
240
+ }
241
+ $beforeUnmounted() {
242
+ o(this, i).abort();
243
+ }
244
+ }
245
+ n = new WeakMap(), h = new WeakMap(), c = new WeakMap(), p = new WeakMap(), r = new WeakMap(), i = new WeakMap(), b = new WeakMap(), f = new WeakMap(), g = new WeakMap();
246
+ window.customElements.get("ea-dialog") || window.customElements.define("ea-dialog", k);
247
+ export {
248
+ k as EaDialog
249
+ };
@@ -0,0 +1,216 @@
1
+ var g = Object.defineProperty;
2
+ var _ = (s) => {
3
+ throw TypeError(s);
4
+ };
5
+ var S = (s, o, e) => o in s ? g(s, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[o] = e;
6
+ var C = (s, o, e) => S(s, typeof o != "symbol" ? o + "" : o, e), E = (s, o, e) => o.has(s) || _("Cannot " + e);
7
+ var t = (s, o, e) => (E(s, o, "read from private field"), e ? e.call(s) : o.get(s)), a = (s, o, e) => o.has(s) ? _("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(s) : o.set(s, e), l = (s, o, e, i) => (E(s, o, "write to private field"), i ? i.call(s, e) : o.set(s, e), e);
8
+ import { EaOverlay as k } from "./ea-overlay.js";
9
+ import { s as A } from "../css/ea-drawer.style.js";
10
+ import { E as q } from "../utils/Utils.js";
11
+ import { t as R } from "../utils/timeout.js";
12
+ var p, c, u, f, n, w, b, h, r, m, d, y;
13
+ class B extends k {
14
+ constructor() {
15
+ super();
16
+ /** @type {HTMLElement} */
17
+ a(this, p);
18
+ /** @type {HTMLElement} */
19
+ a(this, c);
20
+ /** @type {HTMLElement} */
21
+ a(this, u);
22
+ /** @type {HTMLElement} */
23
+ a(this, f);
24
+ /** @type {HTMLElement} */
25
+ a(this, n);
26
+ /** @type {HTMLElement} */
27
+ a(this, w);
28
+ /** @type {HTMLElement} */
29
+ a(this, b);
30
+ /** @type {AbortController} */
31
+ a(this, h);
32
+ a(this, r, {
33
+ /** @type {AbortController | null} */
34
+ showClose: null,
35
+ /** @type {AbortController | null} */
36
+ closeOnPressEscape: null
37
+ });
38
+ C(this, "state", this.properties({
39
+ direction: {
40
+ type: ["rtl", "ltr", "ttb", "btt"],
41
+ default: "rtl"
42
+ },
43
+ visible: {
44
+ type: Boolean,
45
+ default: !1,
46
+ repeatable: !0,
47
+ observer: (e) => {
48
+ if (!e && this.beforeClose && this.status !== this.visible) {
49
+ this.visible = !e, t(this, d).call(this);
50
+ return;
51
+ }
52
+ e && R(() => this.focus(), 0), (e || !this.beforeClose) && (this.status = e);
53
+ }
54
+ },
55
+ "with-header": {
56
+ type: Boolean,
57
+ default: !0,
58
+ observer: (e) => {
59
+ t(this, u).style.display = e ? "flex" : "none";
60
+ }
61
+ },
62
+ title: {
63
+ type: String,
64
+ default: "",
65
+ observer: (e) => {
66
+ this["with-header"] && (t(this, f).textContent = e);
67
+ }
68
+ },
69
+ showClose: {
70
+ type: Boolean,
71
+ default: !0,
72
+ observer: (e) => {
73
+ var i;
74
+ (i = t(this, r).showClose) == null || i.abort(), t(this, r).showClose = null, this["with-header"] && (t(this, n).style.display = e ? "block" : "none"), e && (t(this, r).showClose = new AbortController(), t(this, n).addEventListener("click", t(this, d), {
75
+ signal: t(this, r).showClose.signal
76
+ }));
77
+ }
78
+ },
79
+ size: {
80
+ type: String,
81
+ default: "30%",
82
+ observer: (e) => {
83
+ this.style.setProperty("--ea-drawer-size", e);
84
+ }
85
+ },
86
+ "append-to-body": {
87
+ type: Boolean,
88
+ default: !1
89
+ },
90
+ "close-on-press-escape": {
91
+ type: Boolean,
92
+ default: !0,
93
+ observer: (e) => {
94
+ var i;
95
+ (i = t(this, r).closeOnPressEscape) == null || i.abort(), t(this, r).closeOnPressEscape = null, e && (t(this, r).closeOnPressEscape = new AbortController(), document.addEventListener("keydown", t(this, y), {
96
+ signal: t(this, r).closeOnPressEscape.signal
97
+ }));
98
+ }
99
+ }
100
+ }));
101
+ C(this, "funcStates", this.properties({
102
+ beforeClose: {
103
+ rawFunction: !0,
104
+ props: !0,
105
+ type: Function,
106
+ default: null
107
+ }
108
+ }));
109
+ /**
110
+ * 初始化抽屉 DOM 结构
111
+ * @param {HTMLElement} container - 抽屉内容容器
112
+ */
113
+ a(this, m, (e) => {
114
+ e.innerHTML = `
115
+ <div class="ea-drawer-main" part="container">
116
+ <header class="ea-drawer-main__header" part="header">
117
+ <span class="ea-drawer-main__title" part="title">
118
+ <slot name="title"></slot>
119
+ </span>
120
+ <ea-icon class="ea-drawer-main__close-icon" name="xmark" part="close-icon"></ea-icon>
121
+ </header>
122
+ <main class="ea-drawer-main__content" part="content">
123
+ <slot></slot>
124
+ </main>
125
+ <footer class="ea-drawer-main__footer" part="footer">
126
+ <slot name="footer"></slot>
127
+ </footer>
128
+ </div>
129
+ `, l(this, p, this.shadowRoot.querySelector(".ea-overlay")), l(this, c, this.shadowRoot.querySelector(".ea-drawer-main")), l(this, u, this.shadowRoot.querySelector(".ea-drawer-main__header")), l(this, f, this.shadowRoot.querySelector(".ea-drawer-main__title")), l(this, n, this.shadowRoot.querySelector(
130
+ ".ea-drawer-main__close-icon"
131
+ )), l(this, w, this.shadowRoot.querySelector(".ea-drawer-main__content")), l(this, b, this.shadowRoot.querySelector(".ea-drawer-main__footer"));
132
+ });
133
+ /**
134
+ * 处理抽屉关闭前的回调
135
+ */
136
+ a(this, d, () => {
137
+ this.beforeClose ? this.beforeClose(() => {
138
+ this.status = !1, this.visible = !1;
139
+ }) : (this.status = !1, this.visible = !1);
140
+ });
141
+ /**
142
+ * 处理键盘事件
143
+ * @param {KeyboardEvent} e - 键盘事件对象
144
+ */
145
+ a(this, y, (e) => {
146
+ e.key === "Escape" && this.visible && t(this, d).call(this);
147
+ });
148
+ this["append-to-body"] && document.body.appendChild(this);
149
+ const e = this.shadowRoot.querySelector(
150
+ ".ea-overlay__content"
151
+ );
152
+ t(this, m).call(this, e);
153
+ }
154
+ static get observedAttributes() {
155
+ return q.Array.toLowerCamelCase([
156
+ ...super.observedAttributes,
157
+ "direction",
158
+ "visible",
159
+ "append-to-body",
160
+ "append-to",
161
+ "close-on-click-modal",
162
+ "close-on-press-escape",
163
+ "modal",
164
+ "show-close",
165
+ "size",
166
+ "title",
167
+ "with-header",
168
+ "z-index",
169
+ "header-aria-level"
170
+ ]);
171
+ }
172
+ /**
173
+ * 获取 classlist 列表
174
+ * @return {string} 属性值
175
+ */
176
+ updateContainerClasslist() {
177
+ const e = `${super.updateContainerClasslist()} ${this.computedClasslist(
178
+ "ea-drawer",
179
+ {
180
+ ["--" + this.direction]: this.direction
181
+ },
182
+ {
183
+ drawer: !0
184
+ }
185
+ )}`;
186
+ return t(this, p).className = e, e;
187
+ }
188
+ connectedCallback() {
189
+ var e, i;
190
+ (e = t(this, h)) == null || e.abort(), l(this, h, new AbortController()), t(this, c).ariaModal = !0, t(this, c).role = "dialog", this["close-on-click-modal"] = this.getAttrBoolean(
191
+ "close-on-click-modal",
192
+ !0
193
+ ), this.addEventListener(
194
+ "closed",
195
+ () => {
196
+ this.visible = !1;
197
+ },
198
+ {
199
+ signal: t(this, h).signal
200
+ }
201
+ ), this["show-close"] && ((i = t(this, r).showClose) == null || i.abort(), t(this, r).showClose = new AbortController(), t(this, n).addEventListener("click", t(this, d), {
202
+ signal: t(this, r).showClose.signal
203
+ })), super.connectedCallback(), this.assignedStyle(A);
204
+ }
205
+ $beforeUnmounted() {
206
+ var e, i;
207
+ (e = t(this, h)) == null || e.abort();
208
+ for (const v in t(this, r))
209
+ (i = t(this, r)[v]) == null || i.abort(), t(this, r)[v] = null;
210
+ }
211
+ }
212
+ p = new WeakMap(), c = new WeakMap(), u = new WeakMap(), f = new WeakMap(), n = new WeakMap(), w = new WeakMap(), b = new WeakMap(), h = new WeakMap(), r = new WeakMap(), m = new WeakMap(), d = new WeakMap(), y = new WeakMap();
213
+ window.customElements.get("ea-drawer") || window.customElements.define("ea-drawer", B);
214
+ export {
215
+ B as EaDrawer
216
+ };
@@ -0,0 +1,228 @@
1
+ var C = Object.defineProperty;
2
+ var g = (t) => {
3
+ throw TypeError(t);
4
+ };
5
+ var E = (t, s, e) => s in t ? C(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
6
+ var v = (t, s, e) => E(t, typeof s != "symbol" ? s + "" : s, e), w = (t, s, e) => s.has(t) || g("Cannot " + e);
7
+ var i = (t, s, e) => (w(t, s, "read from private field"), e ? e.call(t) : s.get(t)), o = (t, s, e) => s.has(t) ? g("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), h = (t, s, e, a) => (w(t, s, "write to private field"), a ? a.call(t, e) : s.set(t, e), e);
8
+ import { EaPopper as k } from "./ea-popper.js";
9
+ import { s as A } from "../css/ea-dropdown.style.js";
10
+ import { B as f } from "./Base.js";
11
+ import { s as y } from "../css/ea-dropdown-item.style.js";
12
+ import { s as L } from "../css/ea-dropdown-menu.style.js";
13
+ var d, n, l, m;
14
+ class x extends k {
15
+ constructor() {
16
+ super();
17
+ /** @type {HTMLElement} */
18
+ o(this, d);
19
+ /** @type {AbortController} */
20
+ o(this, n, new AbortController());
21
+ o(this, l, {
22
+ hasPlacement: !0
23
+ });
24
+ v(this, "state", this.properties({
25
+ trigger: {
26
+ type: ["click", "hover", "contextmenu"],
27
+ default: "hover",
28
+ observer: () => {
29
+ }
30
+ },
31
+ "hide-on-click": {
32
+ type: Boolean,
33
+ default: !0,
34
+ observer: () => {
35
+ }
36
+ },
37
+ size: {
38
+ type: ["small", "default", "large"],
39
+ default: "",
40
+ observer: () => {
41
+ }
42
+ }
43
+ }));
44
+ /**
45
+ * 触发事件
46
+ */
47
+ o(this, m, {
48
+ hover: () => {
49
+ let e = new AbortController();
50
+ this.addEventListener(
51
+ "mouseover",
52
+ () => {
53
+ e == null || e.abort(), e = new AbortController(), this.show(), this.addEventListener(
54
+ "mouseout",
55
+ () => {
56
+ this.hide();
57
+ },
58
+ { signal: e.signal, once: !0 }
59
+ ), this.status || e.abort();
60
+ },
61
+ { signal: i(this, n).signal }
62
+ );
63
+ },
64
+ click: () => {
65
+ i(this, d).addEventListener(
66
+ "click",
67
+ () => {
68
+ this.toggle();
69
+ },
70
+ { signal: i(this, n).signal }
71
+ );
72
+ },
73
+ contextmenu: () => {
74
+ let e = new AbortController();
75
+ const a = (b) => {
76
+ this.contains(b.target) || (e.abort(), this.hide());
77
+ }, p = (b) => {
78
+ b.preventDefault(), e == null || e.abort(), e = new AbortController(), this.toggle(), window.addEventListener("click", a, {
79
+ signal: e.signal,
80
+ once: !0
81
+ }), this.status || e.abort();
82
+ };
83
+ this.addEventListener("contextmenu", p, {
84
+ signal: i(this, n).signal
85
+ });
86
+ }
87
+ });
88
+ h(this, d, this.shadowRoot.querySelector('slot[name="reference"]')), this.getAttrString("placement") || (i(this, l).hasPlacement = !1);
89
+ }
90
+ static get observedAttributes() {
91
+ return [...super.observedAttributes, "trigger", "hide-on-click", "size"];
92
+ }
93
+ connectedCallback() {
94
+ super.connectedCallback(), this.assignedStyle(A), i(this, l).hasPlacement || (this.placement = "bottom"), i(this, m)[this.trigger](), this.addEventListener(
95
+ "ea-dropdown-item-click",
96
+ (e) => {
97
+ e.stopPropagation(), this["hide-on-click"] && this.hide();
98
+ },
99
+ { signal: i(this, n).signal }
100
+ );
101
+ }
102
+ $beforeUnmounted() {
103
+ i(this, n).abort();
104
+ }
105
+ }
106
+ d = new WeakMap(), n = new WeakMap(), l = new WeakMap(), m = new WeakMap();
107
+ window.customElements.get("ea-dropdown") || window.customElements.define("ea-dropdown", x);
108
+ var c, r, u;
109
+ class $ extends f {
110
+ constructor() {
111
+ super();
112
+ /** @type {HTMLElement} */
113
+ o(this, c);
114
+ /** @type {AbortController} */
115
+ o(this, r, new AbortController());
116
+ v(this, "state", this.properties({
117
+ divided: {
118
+ type: Boolean,
119
+ default: !1,
120
+ observer: () => {
121
+ this.updateContainerClasslist();
122
+ }
123
+ },
124
+ disabled: {
125
+ type: Boolean,
126
+ default: !1,
127
+ observer: (e) => {
128
+ this.toggleAttribute("aria-disabled", e), this.updateContainerClasslist();
129
+ }
130
+ },
131
+ command: {
132
+ type: String,
133
+ default: "",
134
+ observer: () => {
135
+ }
136
+ }
137
+ }));
138
+ /**
139
+ * 点击事件
140
+ * @param {Event} e
141
+ */
142
+ o(this, u, (e) => {
143
+ if (this.hasAttribute("disabled")) {
144
+ e.stopImmediatePropagation(), e.preventDefault();
145
+ return;
146
+ }
147
+ const a = () => {
148
+ this.emit("ea-dropdown-item-click", {
149
+ bubbles: !0
150
+ });
151
+ }, p = () => {
152
+ this.emit("command", {
153
+ detail: {
154
+ command: this.command
155
+ },
156
+ bubbles: !0
157
+ });
158
+ };
159
+ a(), this.command && p();
160
+ });
161
+ this.stylesheet = y, this.$render();
162
+ }
163
+ static get observedAttributes() {
164
+ return [...super.observedAttributes, "disabled", "divided", "command"];
165
+ }
166
+ /**
167
+ * 获取 classlist 列表
168
+ * @return {string} 属性值
169
+ */
170
+ updateContainerClasslist() {
171
+ const e = this.computedClasslist(
172
+ "ea-dropdown-item",
173
+ {
174
+ "--disabled": this.disabled
175
+ },
176
+ {
177
+ divided: this.divided
178
+ }
179
+ );
180
+ return i(this, c).className = e, e;
181
+ }
182
+ $render() {
183
+ this.shadowRoot.innerHTML = `
184
+ <div class='ea-dropdown-item' part='container'>
185
+ <div class='ea-dropdown-item__divider' part='divider'></div>
186
+ <div class='ea-dropdown-item__content' part='content'>
187
+ <slot></slot>
188
+ </div>
189
+ </div>
190
+ `, h(this, c, this.shadowRoot.querySelector(".ea-dropdown-item")), this.updateContainerClasslist();
191
+ }
192
+ connectedCallback() {
193
+ var e;
194
+ super.connectedCallback(), (e = i(this, r)) == null || e.abort(), h(this, r, new AbortController()), this.addEventListener("click", i(this, u), {
195
+ signal: i(this, r).signal
196
+ });
197
+ }
198
+ $beforeUnmounted() {
199
+ var e;
200
+ (e = i(this, r)) == null || e.abort();
201
+ }
202
+ }
203
+ c = new WeakMap(), r = new WeakMap(), u = new WeakMap();
204
+ window.customElements.get("ea-dropdown-item") || window.customElements.define("ea-dropdown-item", $);
205
+ class P extends f {
206
+ static get observedAttributes() {
207
+ return [...super.observedAttributes];
208
+ }
209
+ constructor() {
210
+ super(), this.stylesheet = L, this.$render();
211
+ }
212
+ $render() {
213
+ this.shadowRoot.innerHTML = `
214
+ <div class='ea-dropdown-menu' part='container'>
215
+ <slot></slot>
216
+ </div>
217
+ `;
218
+ }
219
+ connectedCallback() {
220
+ super.connectedCallback();
221
+ }
222
+ }
223
+ window.customElements.get("ea-dropdown-menu") || window.customElements.define("ea-dropdown-menu", P);
224
+ export {
225
+ x as EaDropdown,
226
+ $ as EaDropdownItem,
227
+ P as EaDropdownMenu
228
+ };