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,249 +0,0 @@
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 A 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' icon='icon-cancel' 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", A);
247
- export {
248
- A as EaDialog
249
- };
@@ -1,211 +0,0 @@
1
- var E = Object.defineProperty;
2
- var v = (s) => {
3
- throw TypeError(s);
4
- };
5
- var g = (s, o, e) => o in s ? E(s, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[o] = e;
6
- var C = (s, o, e) => g(s, typeof o != "symbol" ? o + "" : o, e), _ = (s, o, e) => o.has(s) || v("Cannot " + e);
7
- var t = (s, o, e) => (_(s, o, "read from private field"), e ? e.call(s) : o.get(s)), r = (s, o, e) => o.has(s) ? v("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(s) : o.set(s, e), a = (s, o, e, l) => (_(s, o, "write to private field"), l ? l.call(s, e) : o.set(s, e), e);
8
- import { EaOverlay as S } from "./ea-overlay.js";
9
- import { s as k } from "../css/ea-drawer.style.js";
10
- import { E as q } from "../utils/Utils.js";
11
- import { t as A } from "../utils/timeout.js";
12
- var f, h, p, u, d, w, b, n, i, m, c, y;
13
- class R extends S {
14
- constructor() {
15
- super();
16
- /** @type {HTMLElement} */
17
- r(this, f);
18
- /** @type {HTMLElement} */
19
- r(this, h);
20
- /** @type {HTMLElement} */
21
- r(this, p);
22
- /** @type {HTMLElement} */
23
- r(this, u);
24
- /** @type {HTMLElement} */
25
- r(this, d);
26
- /** @type {HTMLElement} */
27
- r(this, w);
28
- /** @type {HTMLElement} */
29
- r(this, b);
30
- /** @type {AbortController} */
31
- r(this, n);
32
- r(this, i, {
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, c).call(this);
50
- return;
51
- }
52
- e && A(() => 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, p).style.display = e ? "flex" : "none";
60
- }
61
- },
62
- title: {
63
- type: String,
64
- default: "",
65
- observer: (e) => {
66
- this["with-header"] && (t(this, u).textContent = e);
67
- }
68
- },
69
- showClose: {
70
- type: Boolean,
71
- default: !0,
72
- observer: (e) => {
73
- var l;
74
- (l = t(this, i).showClose) == null || l.abort(), t(this, i).showClose = null, this["with-header"] && (t(this, d).style.display = e ? "block" : "none"), e && (t(this, i).showClose = new AbortController(), t(this, d).addEventListener("click", t(this, c), {
75
- signal: t(this, i).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 l;
95
- (l = t(this, i).closeOnPressEscape) == null || l.abort(), t(this, i).closeOnPressEscape = null, e && (t(this, i).closeOnPressEscape = new AbortController(), document.addEventListener("keydown", t(this, y), {
96
- signal: t(this, i).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
- r(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" icon="icon-cancel" 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
- `, a(this, f, this.shadowRoot.querySelector(".ea-overlay")), a(this, h, this.shadowRoot.querySelector(".ea-drawer-main")), a(this, p, this.shadowRoot.querySelector(".ea-drawer-main__header")), a(this, u, this.shadowRoot.querySelector(".ea-drawer-main__title")), a(this, d, this.shadowRoot.querySelector(
130
- ".ea-drawer-main__close-icon"
131
- )), a(this, w, this.shadowRoot.querySelector(".ea-drawer-main__content")), a(this, b, this.shadowRoot.querySelector(".ea-drawer-main__footer"));
132
- });
133
- /**
134
- * 处理抽屉关闭前的回调
135
- */
136
- r(this, c, () => {
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
- r(this, y, (e) => {
146
- e.key === "Escape" && this.visible && t(this, c).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
- return `${super.updateContainerClasslist()} ${this.computedClasslist(
178
- "ea-drawer",
179
- {
180
- ["--" + this.direction]: this.direction
181
- },
182
- {
183
- drawer: !0
184
- }
185
- )}`;
186
- }
187
- connectedCallback() {
188
- var e;
189
- (e = t(this, n)) == null || e.abort(), a(this, n, new AbortController()), t(this, h).ariaModal = !0, t(this, h).role = "dialog", this["close-on-click-modal"] = this.getAttrBoolean(
190
- "close-on-click-modal",
191
- !0
192
- ), this.addEventListener(
193
- "closed",
194
- () => {
195
- this.visible = !1;
196
- },
197
- {
198
- signal: t(this, n).signal
199
- }
200
- ), super.connectedCallback(), this.assignedStyle(k);
201
- }
202
- $beforeUnmounted() {
203
- var e;
204
- (e = t(this, n)) == null || e.abort();
205
- }
206
- }
207
- f = new WeakMap(), h = new WeakMap(), p = new WeakMap(), u = new WeakMap(), d = new WeakMap(), w = new WeakMap(), b = new WeakMap(), n = new WeakMap(), i = new WeakMap(), m = new WeakMap(), c = new WeakMap(), y = new WeakMap();
208
- window.customElements.get("ea-drawer") || window.customElements.define("ea-drawer", R);
209
- export {
210
- R as EaDrawer
211
- };
@@ -1,228 +0,0 @@
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
- };