easy-component-ui 3.0.13 → 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/README.md +162 -162
  2. package/package.json +8 -2
  3. package/dist/assets/icon.css +0 -1
  4. package/dist/components/Base.js +0 -874
  5. package/dist/components/ea-alert.js +0 -213
  6. package/dist/components/ea-avatar.js +0 -164
  7. package/dist/components/ea-backtop.js +0 -136
  8. package/dist/components/ea-badge.js +0 -144
  9. package/dist/components/ea-breadcrumb.js +0 -148
  10. package/dist/components/ea-button.js +0 -266
  11. package/dist/components/ea-calendar.js +0 -10
  12. package/dist/components/ea-calendar2.js +0 -673
  13. package/dist/components/ea-card.js +0 -121
  14. package/dist/components/ea-carousel.js +0 -415
  15. package/dist/components/ea-checkbox.js +0 -446
  16. package/dist/components/ea-collapse.js +0 -313
  17. package/dist/components/ea-color-picker.js +0 -888
  18. package/dist/components/ea-container.js +0 -206
  19. package/dist/components/ea-countdown.js +0 -142
  20. package/dist/components/ea-date-picker.js +0 -649
  21. package/dist/components/ea-descriptions.js +0 -474
  22. package/dist/components/ea-dialog.js +0 -249
  23. package/dist/components/ea-drawer.js +0 -216
  24. package/dist/components/ea-dropdown.js +0 -228
  25. package/dist/components/ea-empty.js +0 -93
  26. package/dist/components/ea-icon.js +0 -158
  27. package/dist/components/ea-image-preview.js +0 -532
  28. package/dist/components/ea-image.js +0 -327
  29. package/dist/components/ea-infinite-scroll.js +0 -109
  30. package/dist/components/ea-input-number.js +0 -367
  31. package/dist/components/ea-input.js +0 -588
  32. package/dist/components/ea-layout.js +0 -132
  33. package/dist/components/ea-link.js +0 -101
  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 -314
  37. package/dist/components/ea-notification.js +0 -331
  38. package/dist/components/ea-overlay.js +0 -168
  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 -147
  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 -430
  53. package/dist/components/ea-space.js +0 -123
  54. package/dist/components/ea-splitter.js +0 -233
  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 -1135
  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 -510
  63. package/dist/components/ea-timeline.js +0 -185
  64. package/dist/components/ea-tooltip.js +0 -161
  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 -60
  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,121 +0,0 @@
1
- var b = Object.defineProperty;
2
- var y = (e) => {
3
- throw TypeError(e);
4
- };
5
- var g = (e, s, t) => s in e ? b(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
6
- var f = (e, s, t) => g(e, typeof s != "symbol" ? s + "" : s, t), v = (e, s, t) => s.has(e) || y("Cannot " + t);
7
- var a = (e, s, t) => (v(e, s, "read from private field"), t ? t.call(e) : s.get(e)), o = (e, s, t) => s.has(e) ? y("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), h = (e, s, t, l) => (v(e, s, "write to private field"), l ? l.call(e, t) : s.set(e, t), t);
8
- import { B as E } from "./Base.js";
9
- import { s as _ } from "../css/ea-card.style.js";
10
- var c, i, n, r, d, p;
11
- class S extends E {
12
- constructor() {
13
- super();
14
- /** @type {HTMLElement} */
15
- o(this, c);
16
- /** @type {HTMLElement} */
17
- o(this, i);
18
- /** @type {HTMLElement} */
19
- o(this, n);
20
- /** @type {AbortController} */
21
- o(this, r, null);
22
- o(this, d, {
23
- isHeaderEmpty: !0,
24
- isFooterEmpty: !0
25
- });
26
- f(this, "state", this.properties({
27
- shadow: {
28
- type: ["always", "never", "hover"],
29
- default: "always",
30
- observer: () => {
31
- this.updateContainerClasslist();
32
- }
33
- },
34
- header: {
35
- type: String,
36
- default: "",
37
- observer: (t) => {
38
- a(this, i).innerText = t;
39
- }
40
- },
41
- footer: {
42
- type: String,
43
- default: "",
44
- observer: (t) => {
45
- a(this, n).innerText = t;
46
- }
47
- }
48
- }));
49
- /**
50
- * 更新空状态
51
- * @param {Event} e 事件
52
- */
53
- o(this, p, (t) => {
54
- const l = t.target;
55
- let m = l.getAttribute("name") || "";
56
- m = m.split("").map(
57
- (u, C) => C === 0 ? u.toUpperCase() : u.toLowerCase()
58
- ).join("");
59
- const w = l.assignedElements().length === 0;
60
- a(this, d)[`is${m}Empty`] = w, this.updateContainerClasslist();
61
- });
62
- this.stylesheet = _, this.$render();
63
- }
64
- static get observedAttributes() {
65
- return [...super.observedAttributes, "shadow", "header", "footer"];
66
- }
67
- /**
68
- * 获取 classlist 列表
69
- * @return {string} 属性值
70
- */
71
- updateContainerClasslist() {
72
- const t = this.computedClasslist(
73
- "ea-card",
74
- {
75
- [`--${this.shadow}-shadow`]: this.shadow
76
- },
77
- // 因为在 vue 下,某些场景会出现 css 的 ::slotted 选择器无效,因此这里使用 js 来更新空状态
78
- {
79
- "header-empty": a(this, d).isHeaderEmpty,
80
- "footer-empty": a(this, d).isFooterEmpty
81
- }
82
- );
83
- return a(this, c).className = t, t;
84
- }
85
- $render() {
86
- this.shadowRoot.innerHTML = `
87
- <div class="ea-card" part="container">
88
- <div class="ea-card__header" part="header">
89
- <slot name="header"></slot>
90
- </div>
91
- <div class="ea-card__content" part="content">
92
- <slot></slot>
93
- </div>
94
- <div class="ea-card__footer" part="footer">
95
- <slot name="footer"></slot>
96
- </div>
97
- </div>
98
- `, h(this, c, this.shadowRoot.querySelector(".ea-card")), h(this, i, this.shadowRoot.querySelector(
99
- ".ea-card__header > slot[name='header']"
100
- )), h(this, n, this.shadowRoot.querySelector(
101
- ".ea-card__footer > slot[name='footer']"
102
- )), this.updateContainerClasslist();
103
- }
104
- connectedCallback() {
105
- var t;
106
- super.connectedCallback(), (t = a(this, r)) == null || t.abort(), h(this, r, new AbortController()), a(this, i).addEventListener("slotchange", a(this, p), {
107
- signal: a(this, r).signal
108
- }), a(this, n).addEventListener("slotchange", a(this, p), {
109
- signal: a(this, r).signal
110
- });
111
- }
112
- $beforeUnmounted() {
113
- var t;
114
- (t = a(this, r)) == null || t.abort();
115
- }
116
- }
117
- c = new WeakMap(), i = new WeakMap(), n = new WeakMap(), r = new WeakMap(), d = new WeakMap(), p = new WeakMap();
118
- window.customElements.get("ea-card") || window.customElements.define("ea-card", S);
119
- export {
120
- S as EaCard
121
- };
@@ -1,415 +0,0 @@
1
- var j = Object.defineProperty;
2
- var B = (r) => {
3
- throw TypeError(r);
4
- };
5
- var D = (r, n, e) => n in r ? j(r, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[n] = e;
6
- var T = (r, n, e) => D(r, typeof n != "symbol" ? n + "" : n, e), $ = (r, n, e) => n.has(r) || B("Cannot " + e);
7
- var t = (r, n, e) => ($(r, n, "read from private field"), e ? e.call(r) : n.get(r)), a = (r, n, e) => n.has(r) ? B("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(r) : n.set(r, e), g = (r, n, e, s) => ($(r, n, "write to private field"), s ? s.call(r, e) : n.set(r, e), e), h = (r, n, e) => ($(r, n, "access private method"), e);
8
- import { B as N } from "./Base.js";
9
- import { s as W } from "../css/ea-carousel-item.style.js";
10
- import { s as X } from "../css/ea-carousel.style.js";
11
- class Y extends N {
12
- static get observedAttributes() {
13
- return [...super.observedAttributes];
14
- }
15
- constructor() {
16
- super(), this.stylesheet = W, this.$render();
17
- }
18
- $render() {
19
- this.shadowRoot.innerHTML = `
20
- <div class='ea-carousel-item' part='container'>
21
- <slot></slot>
22
- </div>
23
- `;
24
- }
25
- connectedCallback() {
26
- super.connectedCallback();
27
- }
28
- }
29
- window.customElements.get("ea-carousel-item") || window.customElements.define("ea-carousel-item", Y);
30
- var b, w, _, S, f, p, u, d, v, i, q, E, o, z, O, U, A, I, m, C, x, L, M, H, P, k, R;
31
- class F extends N {
32
- constructor() {
33
- super();
34
- a(this, o);
35
- /** @type {HTMLElement} */
36
- a(this, b);
37
- /** @type {HTMLElement} */
38
- a(this, w);
39
- /** @type {HTMLElement} */
40
- a(this, _);
41
- /** @type {HTMLElement} */
42
- a(this, S);
43
- /** @type {HTMLElement} */
44
- a(this, f);
45
- /** @type {HTMLElement[]} */
46
- a(this, p, []);
47
- /** @type {AbortController} */
48
- a(this, u);
49
- a(this, d, {
50
- triggerAbortControllers: new AbortController()
51
- });
52
- /** @type {MutationObserver | null} */
53
- a(this, v, null);
54
- a(this, i, {
55
- prevIndex: 0,
56
- originLength: 0,
57
- timer: null,
58
- pause: !1,
59
- isMouseEnter: !1,
60
- isEnd: !1,
61
- isProcessingSlotChange: !1
62
- });
63
- T(this, "state", this.properties({
64
- height: {
65
- type: String,
66
- default: "100%",
67
- observer: (e) => {
68
- this.style.setProperty("--ea-carousel-height", e);
69
- }
70
- },
71
- direction: {
72
- type: ["horizontal", "vertical"],
73
- default: "horizontal",
74
- observer: () => {
75
- this.updateContainerClasslist();
76
- }
77
- },
78
- index: {
79
- type: Number,
80
- default: 0,
81
- observer: (e, s) => {
82
- if (t(this, A).call(this, e), t(this, i).isEnd) return t(this, i).isEnd = !1;
83
- e < 0 ? (e = t(this, p).length - 1, s = 0, t(this, i).isEnd = !0) : e > t(this, p).length - 1 && (s = t(this, p).length - 1, e = 0, t(this, i).isEnd = !0), t(this, i).prevIndex = s, this.emit("change", {
84
- detail: {
85
- current: e,
86
- prev: s
87
- }
88
- });
89
- }
90
- },
91
- trigger: {
92
- type: ["click", "hover"],
93
- default: "hover",
94
- /** @param {'click' | 'hover'} newVal */
95
- observer: (e) => {
96
- var s;
97
- (s = t(this, d).triggerAbortControllers) == null || s.abort(), t(this, d).triggerAbortControllers = new AbortController(), t(this, f).addEventListener(
98
- e === "hover" ? "mouseover" : "click",
99
- t(this, M),
100
- {
101
- signal: t(this, d).triggerAbortControllers.signal
102
- }
103
- );
104
- }
105
- },
106
- interval: {
107
- type: Number,
108
- default: 3e3,
109
- observer: () => {
110
- h(this, o, m).call(this), this.autoplay && h(this, o, C).call(this);
111
- }
112
- },
113
- arrow: {
114
- type: ["never", "always", "hover"],
115
- default: "hover",
116
- observer: () => {
117
- this.updateContainerClasslist();
118
- }
119
- },
120
- autoplay: {
121
- type: Boolean,
122
- default: !0,
123
- observer: (e) => {
124
- h(this, o, m).call(this), e && h(this, o, C).call(this);
125
- }
126
- },
127
- loop: {
128
- type: Boolean,
129
- default: !0,
130
- observer: () => {
131
- }
132
- },
133
- "pause-on-hover": {
134
- type: Boolean,
135
- default: !0,
136
- observer: () => {
137
- }
138
- },
139
- "indicator-position": {
140
- type: ["", "none", "outside"],
141
- default: "",
142
- observer: () => {
143
- this.updateContainerClasslist();
144
- }
145
- }
146
- }));
147
- /**
148
- * 处理 index 溢出的情况
149
- * @return {number}
150
- */
151
- a(this, q, () => this.index === t(this, p).length ? 0 : this.index === -1 ? t(this, p).length - 1 : this.index);
152
- /**
153
- * 渲染 轮播图指示器,为了避免vue组件缓存,所以在初始化和组件挂载时都进行渲染
154
- */
155
- a(this, E, () => {
156
- const e = Array.from(
157
- this.querySelectorAll("ea-carousel-item:not([slot])"),
158
- (s, l) => `<button class='ea-carousel__indicator' part='indicator' tabindex="1" data-index="${l}"></button>`
159
- ).join("");
160
- t(this, f).innerHTML = e, g(this, p, [
161
- ...t(this, f).querySelectorAll(".ea-carousel__indicator")
162
- ]);
163
- });
164
- /**
165
- * 更新轮播图位置
166
- * @param {number} index
167
- */
168
- a(this, A, (e = 0) => {
169
- const { width: s, height: l } = t(this, b).getBoundingClientRect(), c = this.direction === "horizontal" ? "X" : "Y", y = this.direction === "horizontal" ? s : l;
170
- this.style.setProperty(
171
- "--ea-carousel-transform",
172
- `translate${c}(-${(e + 1) * y}px)`
173
- ), t(this, I).call(this);
174
- });
175
- /**
176
- * 更新指示器位置
177
- */
178
- a(this, I, () => {
179
- t(this, p).forEach((e, s) => {
180
- e.classList.toggle("is-active", s === t(this, q).call(this));
181
- });
182
- });
183
- /**
184
- * 开启轮播图过渡属性
185
- */
186
- a(this, x, () => {
187
- this.clientHeight, this.style.removeProperty("--ea-carousel-transition");
188
- });
189
- /**
190
- * 关闭轮播图过渡属性
191
- */
192
- a(this, L, () => {
193
- this.style.setProperty("--ea-carousel-transition", "none"), this.clientHeight;
194
- });
195
- /**
196
- * 指示器 处理事件,需要按照 `this.trigger` 来确定事件名
197
- * @param {MouseEvent} e
198
- */
199
- a(this, M, (e) => {
200
- const s = t(this, f).querySelectorAll(
201
- ".ea-carousel__indicator"
202
- ), l = e.target.closest(".ea-carousel__indicator");
203
- l && s.forEach((c, y) => {
204
- c.classList.toggle("is-active", c === l), c === l && (this.index = y);
205
- });
206
- });
207
- /**
208
- * 轮播图切换结束事件,即能确保轮播图在视觉上连续
209
- */
210
- a(this, H, () => {
211
- t(this, L).call(this), h(this, o, m).call(this), this.index = t(this, q).call(this), this.autoplay && !t(this, i).isMouseEnter && h(this, o, C).call(this), t(this, x).call(this), t(this, i).pause = !1;
212
- });
213
- /**
214
- * 箭头显示事件
215
- */
216
- a(this, P, () => {
217
- const e = () => {
218
- t(this, i).isMouseEnter = !1, this["pause-on-hover"] && h(this, o, C).call(this), this.updateContainerClasslist();
219
- };
220
- t(this, i).isMouseEnter = !0, this["pause-on-hover"] && h(this, o, m).call(this), this.updateContainerClasslist(), t(this, b).addEventListener("mouseleave", e, {
221
- signal: t(this, u).signal,
222
- once: !0
223
- });
224
- });
225
- /**
226
- * 当窗口大小变化时,更新轮播图位置
227
- */
228
- a(this, k, () => {
229
- let e = null;
230
- return {
231
- listener: () => {
232
- clearTimeout(e), e = null, e = setTimeout(() => {
233
- t(this, A).call(this, this.index);
234
- }, 100);
235
- },
236
- unsetHandler: () => {
237
- clearTimeout(e), e = null;
238
- }
239
- };
240
- });
241
- /**
242
- * 处理 slotchange 事件,当 slot 内容变化时重新渲染
243
- */
244
- a(this, R, () => {
245
- t(this, i).isProcessingSlotChange || (t(this, i).isProcessingSlotChange = !0, t(this, L).call(this), h(this, o, m).call(this), t(this, i).prevIndex = 0, t(this, i).originLength = 0, t(this, i).pause = !1, t(this, i).isEnd = !1, this.index = 0, t(this, E).call(this), h(this, o, z).call(this), t(this, I).call(this), this.autoplay && h(this, o, C).call(this), queueMicrotask(() => {
246
- t(this, x).call(this), t(this, i).isProcessingSlotChange = !1;
247
- }));
248
- });
249
- /**
250
- * 上一张轮播图
251
- */
252
- T(this, "prev", () => {
253
- t(this, i).pause || (this.index--, t(this, i).pause = !0);
254
- });
255
- /**
256
- * 下一张轮播图
257
- */
258
- T(this, "next", () => {
259
- t(this, i).pause || (this.index++, t(this, i).pause = !0);
260
- });
261
- this.stylesheet = X, this.$render();
262
- }
263
- static get observedAttributes() {
264
- return [
265
- ...super.observedAttributes,
266
- "height",
267
- "index",
268
- "trigger",
269
- "autoplay",
270
- "interval",
271
- "indicator-position",
272
- "arrow",
273
- // "type",
274
- // "card-scale",
275
- "loop",
276
- "direction",
277
- "pause-on-hover"
278
- // "motion-blur",
279
- ];
280
- }
281
- /**
282
- * 获取 classlist 列表
283
- * @return {string} 属性值
284
- */
285
- updateContainerClasslist() {
286
- const e = this.computedClasslist(
287
- "ea-carousel",
288
- {
289
- ["--" + this.direction]: this.direction
290
- },
291
- {
292
- ["arrow-" + this.arrow]: this.arrow === "always" || this.arrow === "never" || t(this, i).isMouseEnter,
293
- [this["indicator-position"] + "-indicator"]: this["indicator-position"]
294
- }
295
- );
296
- return t(this, b).className = e, e;
297
- }
298
- $render() {
299
- this.shadowRoot.innerHTML = `
300
- <div class='ea-carousel' part='container'>
301
- <button class="ea-carousel__arrow arrow-left" part="arrow-left">
302
- <ea-icon name="angle-left" part="arrow-left-icon"></ea-icon>
303
- </button>
304
- <button class="ea-carousel__arrow arrow-right" part="arrow-right">
305
- <ea-icon name="angle-right" part="arrow-right-icon"></ea-icon>
306
- </button>
307
- <ul class="ea-carousel__content" part="content">
308
- <slot name="clone-last"></slot>
309
- <slot></slot>
310
- <slot name="clone-first"></slot>
311
- </ul>
312
- <footer class="ea-carousel__indicator-wrap" part="indicator-wrap">
313
-
314
- </footer>
315
- </div>
316
- `, g(this, b, this.shadowRoot.querySelector(".ea-carousel")), g(this, w, this.shadowRoot.querySelector(".ea-carousel__content")), g(this, f, this.shadowRoot.querySelector(
317
- ".ea-carousel__indicator-wrap"
318
- )), g(this, _, this.shadowRoot.querySelector(
319
- ".ea-carousel__arrow.arrow-left"
320
- )), g(this, S, this.shadowRoot.querySelector(
321
- ".ea-carousel__arrow.arrow-right"
322
- )), t(this, E).call(this), this.updateContainerClasslist();
323
- }
324
- connectedCallback() {
325
- var e, s;
326
- super.connectedCallback(), (e = t(this, u)) == null || e.abort(), g(this, u, new AbortController());
327
- for (const l in t(this, d))
328
- (s = t(this, d)[l]) == null || s.abort(), t(this, d)[l] = new AbortController();
329
- t(this, L).call(this), h(this, o, m).call(this), t(this, E).call(this), h(this, o, z).call(this), this.autoplay && h(this, o, C).call(this), t(this, f).addEventListener(
330
- this.trigger === "hover" ? "mouseover" : "click",
331
- t(this, M),
332
- {
333
- signal: t(this, d).triggerAbortControllers.signal
334
- }
335
- ), t(this, w).addEventListener(
336
- "transitionend",
337
- t(this, H),
338
- { signal: t(this, u).signal }
339
- ), this.arrow !== "never" && this.direction !== "vertical" && (t(this, _).addEventListener("click", this.prev, {
340
- signal: t(this, u).signal
341
- }), t(this, S).addEventListener("click", this.next, {
342
- signal: t(this, u).signal
343
- })), t(this, b).addEventListener("mouseenter", t(this, P), {
344
- signal: t(this, u).signal
345
- }), window.addEventListener("resize", t(this, k).call(this).listener, {
346
- signal: t(this, u).signal
347
- }), t(this, w).querySelector("slot:not([name])").addEventListener("slotchange", t(this, R), {
348
- signal: t(this, u).signal
349
- }), queueMicrotask(() => {
350
- t(this, x).call(this);
351
- });
352
- }
353
- $beforeUnmounted() {
354
- var e, s, l, c;
355
- (e = t(this, u)) == null || e.abort();
356
- for (const y in t(this, d))
357
- (s = t(this, d)[y]) == null || s.abort();
358
- (l = t(this, k).call(this)) == null || l.unsetHandler(), (c = t(this, v)) == null || c.disconnect(), g(this, v, null);
359
- }
360
- }
361
- b = new WeakMap(), w = new WeakMap(), _ = new WeakMap(), S = new WeakMap(), f = new WeakMap(), p = new WeakMap(), u = new WeakMap(), d = new WeakMap(), v = new WeakMap(), i = new WeakMap(), q = new WeakMap(), E = new WeakMap(), o = new WeakSet(), /**
362
- * 初始化 `轮播图元素` 结构
363
- */
364
- z = function() {
365
- try {
366
- const e = this.querySelectorAll("ea-carousel-item:not([slot])");
367
- if (e.length === 0) return;
368
- t(this, i).originLength = e.length, this.querySelectorAll(
369
- 'ea-carousel-item[slot^="clone-"]'
370
- ).forEach((y) => y.remove());
371
- const l = e[0].cloneNode(!0), c = e[e.length - 1].cloneNode(!0);
372
- l.setAttribute("slot", "clone-first"), c.setAttribute("slot", "clone-last"), this.appendChild(l), this.appendChild(c), h(this, o, O).call(this), queueMicrotask(() => {
373
- t(this, A).call(this);
374
- });
375
- } catch {
376
- }
377
- }, /**
378
- * 设置 MutationObserver 监听 item 内容变化
379
- */
380
- O = function() {
381
- t(this, v) && t(this, v).disconnect(), g(this, v, new MutationObserver((s) => {
382
- s.some((c) => c.type === "childList" && c.target.closest("ea-carousel-item:not([slot])")) && h(this, o, U).call(this);
383
- })), this.querySelectorAll("ea-carousel-item:not([slot])").forEach((s) => {
384
- t(this, v).observe(s, {
385
- childList: !0,
386
- subtree: !0,
387
- characterData: !0
388
- });
389
- });
390
- }, /**
391
- * 同步克隆节点的内容
392
- */
393
- U = function() {
394
- const e = this.querySelectorAll("ea-carousel-item:not([slot])");
395
- if (e.length === 0) return;
396
- const s = this.querySelector(
397
- 'ea-carousel-item[slot="clone-first"]'
398
- ), l = this.querySelector('ea-carousel-item[slot="clone-last"]');
399
- s && e[0] && (s.innerHTML = e[0].innerHTML), l && e[e.length - 1] && (l.innerHTML = e[e.length - 1].innerHTML);
400
- }, A = new WeakMap(), I = new WeakMap(), /**
401
- * 清除轮播图自动播放
402
- */
403
- m = function() {
404
- t(this, i).timer && (clearInterval(t(this, i).timer), t(this, i).timer = null);
405
- }, /**
406
- * 处理轮播图自动播放
407
- */
408
- C = function() {
409
- this.autoplay && (h(this, o, m).call(this), t(this, i).timer = setInterval(this.next, this.interval));
410
- }, x = new WeakMap(), L = new WeakMap(), M = new WeakMap(), H = new WeakMap(), P = new WeakMap(), k = new WeakMap(), R = new WeakMap();
411
- window.customElements.get("ea-carousel") || window.customElements.define("ea-carousel", F);
412
- export {
413
- F as EaCarousel,
414
- Y as EaCarouselItem
415
- };