easy-component-ui 3.0.5 → 3.0.7

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.
@@ -1,19 +1,19 @@
1
- var B = Object.defineProperty;
2
- var $ = (s) => {
3
- throw TypeError(s);
1
+ var P = Object.defineProperty;
2
+ var z = (i) => {
3
+ throw TypeError(i);
4
4
  };
5
- var P = (s, r, e) => r in s ? B(s, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[r] = e;
6
- var k = (s, r, e) => P(s, typeof r != "symbol" ? r + "" : r, e), H = (s, r, e) => r.has(s) || $("Cannot " + e);
7
- var t = (s, r, e) => (H(s, r, "read from private field"), e ? e.call(s) : r.get(s)), n = (s, r, e) => r.has(s) ? $("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(s) : r.set(s, e), v = (s, r, e, i) => (H(s, r, "write to private field"), i ? i.call(s, e) : r.set(s, e), e), p = (s, r, e) => (H(s, r, "access private method"), e);
8
- import { B as N } from "./Base.js";
9
- import { s as O } from "../css/ea-carousel-item.style.js";
10
- import { s as U } from "../css/ea-carousel.style.js";
11
- class j extends N {
5
+ var O = (i, o, e) => o in i ? P(i, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[o] = e;
6
+ var S = (i, o, e) => O(i, typeof o != "symbol" ? o + "" : o, e), $ = (i, o, e) => o.has(i) || z("Cannot " + e);
7
+ var t = (i, o, e) => ($(i, o, "read from private field"), e ? e.call(i) : o.get(i)), n = (i, o, e) => o.has(i) ? z("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(i) : o.set(i, e), v = (i, o, e, r) => ($(i, o, "write to private field"), r ? r.call(i, e) : o.set(i, e), e), c = (i, o, e) => ($(i, o, "access private method"), e);
8
+ import { B } from "./Base.js";
9
+ import { s as U } from "../css/ea-carousel-item.style.js";
10
+ import { s as j } from "../css/ea-carousel.style.js";
11
+ class W extends B {
12
12
  static get observedAttributes() {
13
13
  return [...super.observedAttributes];
14
14
  }
15
15
  constructor() {
16
- super(), this.stylesheet = O, this.$render();
16
+ super(), this.stylesheet = U, this.$render();
17
17
  }
18
18
  $render() {
19
19
  this.shadowRoot.innerHTML = `
@@ -26,30 +26,30 @@ class j extends N {
26
26
  super.connectedCallback();
27
27
  }
28
28
  }
29
- window.customElements.get("ea-carousel-item") || window.customElements.define("ea-carousel-item", j);
30
- var f, w, C, y, g, d, h, c, o, E, _, l, z, b, R, M, m, A, x, L, S, T, I;
31
- class W extends N {
29
+ window.customElements.get("ea-carousel-item") || window.customElements.define("ea-carousel-item", W);
30
+ var f, m, _, A, g, p, h, u, s, L, w, a, N, y, I, x, b, C, E, k, q, R, M, T;
31
+ class X extends B {
32
32
  constructor() {
33
33
  super();
34
- n(this, l);
34
+ n(this, a);
35
35
  /** @type {HTMLElement} */
36
36
  n(this, f);
37
37
  /** @type {HTMLElement} */
38
- n(this, w);
38
+ n(this, m);
39
39
  /** @type {HTMLElement} */
40
- n(this, C);
40
+ n(this, _);
41
41
  /** @type {HTMLElement} */
42
- n(this, y);
42
+ n(this, A);
43
43
  /** @type {HTMLElement} */
44
44
  n(this, g);
45
45
  /** @type {HTMLElement[]} */
46
- n(this, d, []);
46
+ n(this, p, []);
47
47
  /** @type {AbortController} */
48
48
  n(this, h);
49
- n(this, c, {
49
+ n(this, u, {
50
50
  triggerAbortControllers: new AbortController()
51
51
  });
52
- n(this, o, {
52
+ n(this, s, {
53
53
  prevIndex: 0,
54
54
  originLength: 0,
55
55
  timer: null,
@@ -57,7 +57,7 @@ class W extends N {
57
57
  isMouseEnter: !1,
58
58
  isEnd: !1
59
59
  });
60
- k(this, "state", this.properties({
60
+ S(this, "state", this.properties({
61
61
  height: {
62
62
  type: String,
63
63
  default: "100%",
@@ -75,12 +75,12 @@ class W extends N {
75
75
  index: {
76
76
  type: Number,
77
77
  default: 0,
78
- observer: (e, i) => {
79
- if (t(this, b).call(this, e), t(this, o).isEnd) return t(this, o).isEnd = !1;
80
- e < 0 ? (e = t(this, d).length - 1, i = 0, t(this, o).isEnd = !0) : e > t(this, d).length - 1 && (i = t(this, d).length - 1, e = 0, t(this, o).isEnd = !0), t(this, o).prevIndex = i, this.emit("change", {
78
+ observer: (e, r) => {
79
+ if (t(this, y).call(this, e), t(this, s).isEnd) return t(this, s).isEnd = !1;
80
+ e < 0 ? (e = t(this, p).length - 1, r = 0, t(this, s).isEnd = !0) : e > t(this, p).length - 1 && (r = t(this, p).length - 1, e = 0, t(this, s).isEnd = !0), t(this, s).prevIndex = r, this.emit("change", {
81
81
  detail: {
82
82
  current: e,
83
- prev: i
83
+ prev: r
84
84
  }
85
85
  });
86
86
  }
@@ -90,12 +90,12 @@ class W extends N {
90
90
  default: "hover",
91
91
  /** @param {'click' | 'hover'} newVal */
92
92
  observer: (e) => {
93
- var i;
94
- (i = t(this, c).triggerAbortControllers) == null || i.abort(), t(this, c).triggerAbortControllers = new AbortController(), t(this, g).addEventListener(
93
+ var r;
94
+ (r = t(this, u).triggerAbortControllers) == null || r.abort(), t(this, u).triggerAbortControllers = new AbortController(), t(this, g).addEventListener(
95
95
  e === "hover" ? "mouseover" : "click",
96
- t(this, L),
96
+ t(this, k),
97
97
  {
98
- signal: t(this, c).triggerAbortControllers.signal
98
+ signal: t(this, u).triggerAbortControllers.signal
99
99
  }
100
100
  );
101
101
  }
@@ -117,7 +117,7 @@ class W extends N {
117
117
  type: Boolean,
118
118
  default: !0,
119
119
  observer: (e) => {
120
- e ? p(this, l, m).call(this) : p(this, l, M).call(this);
120
+ e ? c(this, a, b).call(this) : c(this, a, x).call(this);
121
121
  }
122
122
  },
123
123
  loop: {
@@ -144,16 +144,16 @@ class W extends N {
144
144
  * 处理 index 溢出的情况
145
145
  * @return {number}
146
146
  */
147
- n(this, E, () => this.index === t(this, d).length ? 0 : this.index === -1 ? t(this, d).length - 1 : this.index);
147
+ n(this, L, () => this.index === t(this, p).length ? 0 : this.index === -1 ? t(this, p).length - 1 : this.index);
148
148
  /**
149
149
  * 渲染 轮播图指示器,为了避免vue组件缓存,所以在初始化和组件挂载时都进行渲染
150
150
  */
151
- n(this, _, () => {
151
+ n(this, w, () => {
152
152
  const e = Array.from(
153
153
  this.querySelectorAll("ea-carousel-item"),
154
- (i, a) => `<button class='ea-carousel__indicator' part='indicator' tabindex="1" data-index="${a}"></button>`
154
+ (r, l) => `<button class='ea-carousel__indicator' part='indicator' tabindex="1" data-index="${l}"></button>`
155
155
  ).join("");
156
- t(this, g).innerHTML = e, v(this, d, [
156
+ t(this, g).innerHTML = e, v(this, p, [
157
157
  ...t(this, g).querySelectorAll(".ea-carousel__indicator")
158
158
  ]);
159
159
  });
@@ -161,59 +161,59 @@ class W extends N {
161
161
  * 更新轮播图位置
162
162
  * @param {number} index
163
163
  */
164
- n(this, b, (e = 0) => {
165
- const { width: i, height: a } = t(this, f).getBoundingClientRect(), u = this.direction === "horizontal" ? "X" : "Y", q = this.direction === "horizontal" ? i : a;
164
+ n(this, y, (e = 0) => {
165
+ const { width: r, height: l } = t(this, f).getBoundingClientRect(), d = this.direction === "horizontal" ? "X" : "Y", H = this.direction === "horizontal" ? r : l;
166
166
  this.style.setProperty(
167
167
  "--ea-carousel-transform",
168
- `translate${u}(-${(e + 1) * q}px)`
169
- ), t(this, R).call(this);
168
+ `translate${d}(-${(e + 1) * H}px)`
169
+ ), t(this, I).call(this);
170
170
  });
171
171
  /**
172
172
  * 更新指示器位置
173
173
  */
174
- n(this, R, () => {
175
- t(this, d).forEach((e, i) => {
176
- e.classList.toggle("is-active", i === t(this, E).call(this));
174
+ n(this, I, () => {
175
+ t(this, p).forEach((e, r) => {
176
+ e.classList.toggle("is-active", r === t(this, L).call(this));
177
177
  });
178
178
  });
179
179
  /**
180
180
  * 开启轮播图过渡属性
181
181
  */
182
- n(this, A, () => {
182
+ n(this, C, () => {
183
183
  this.clientHeight, this.style.removeProperty("--ea-carousel-transition");
184
184
  });
185
185
  /**
186
186
  * 关闭轮播图过渡属性
187
187
  */
188
- n(this, x, () => {
188
+ n(this, E, () => {
189
189
  this.style.setProperty("--ea-carousel-transition", "none"), this.clientHeight;
190
190
  });
191
191
  /**
192
192
  * 指示器 处理事件,需要按照 `this.trigger` 来确定事件名
193
193
  * @param {MouseEvent} e
194
194
  */
195
- n(this, L, (e) => {
196
- const i = t(this, g).querySelectorAll(
195
+ n(this, k, (e) => {
196
+ const r = t(this, g).querySelectorAll(
197
197
  ".ea-carousel__indicator"
198
- ), a = e.target.closest(".ea-carousel__indicator");
199
- a && i.forEach((u, q) => {
200
- u.classList.toggle("is-active", u === a), u === a && (this.index = q);
198
+ ), l = e.target.closest(".ea-carousel__indicator");
199
+ l && r.forEach((d, H) => {
200
+ d.classList.toggle("is-active", d === l), d === l && (this.index = H);
201
201
  });
202
202
  });
203
203
  /**
204
204
  * 轮播图切换结束事件,即能确保轮播图在视觉上连续
205
205
  */
206
- n(this, S, () => {
207
- t(this, x).call(this), this.autoplay && !t(this, o).isMouseEnter && p(this, l, M).call(this), this.index = t(this, E).call(this), this.autoplay && !t(this, o).isMouseEnter && p(this, l, m).call(this), t(this, A).call(this), t(this, o).pause = !1;
206
+ n(this, q, () => {
207
+ t(this, E).call(this), this.autoplay && !t(this, s).isMouseEnter && c(this, a, x).call(this), this.index = t(this, L).call(this), this.autoplay && !t(this, s).isMouseEnter && c(this, a, b).call(this), t(this, C).call(this), t(this, s).pause = !1;
208
208
  });
209
209
  /**
210
210
  * 箭头显示事件
211
211
  */
212
- n(this, T, () => {
212
+ n(this, R, () => {
213
213
  const e = () => {
214
- t(this, o).isMouseEnter = !1, this["pause-on-hover"] && p(this, l, m).call(this), this.updateContainerClasslist();
214
+ t(this, s).isMouseEnter = !1, this["pause-on-hover"] && c(this, a, b).call(this), this.updateContainerClasslist();
215
215
  };
216
- t(this, o).isMouseEnter = !0, this["pause-on-hover"] && p(this, l, M).call(this), this.updateContainerClasslist(), t(this, f).addEventListener("mouseleave", e, {
216
+ t(this, s).isMouseEnter = !0, this["pause-on-hover"] && c(this, a, x).call(this), this.updateContainerClasslist(), t(this, f).addEventListener("mouseleave", e, {
217
217
  signal: t(this, h).signal,
218
218
  once: !0
219
219
  });
@@ -221,12 +221,12 @@ class W extends N {
221
221
  /**
222
222
  * 当窗口大小变化时,更新轮播图位置
223
223
  */
224
- n(this, I, () => {
224
+ n(this, M, () => {
225
225
  let e = null;
226
226
  return {
227
227
  listener: () => {
228
228
  clearTimeout(e), e = null, e = setTimeout(() => {
229
- t(this, b).call(this, this.index);
229
+ t(this, y).call(this, this.index);
230
230
  }, 100);
231
231
  },
232
232
  unsetHandler: () => {
@@ -234,19 +234,27 @@ class W extends N {
234
234
  }
235
235
  };
236
236
  });
237
+ /**
238
+ * 处理 slotchange 事件,当 slot 内容变化时重新渲染
239
+ */
240
+ n(this, T, () => {
241
+ t(this, E).call(this), c(this, a, x).call(this), t(this, s).prevIndex = 0, t(this, s).originLength = 0, t(this, s).pause = !1, t(this, s).isEnd = !1, this.index = 0, t(this, w).call(this), c(this, a, N).call(this), t(this, I).call(this), this.autoplay && c(this, a, b).call(this), queueMicrotask(() => {
242
+ t(this, C).call(this);
243
+ });
244
+ });
237
245
  /**
238
246
  * 上一张轮播图
239
247
  */
240
- k(this, "prev", () => {
241
- t(this, o).pause || (this.index--, t(this, o).pause = !0);
248
+ S(this, "prev", () => {
249
+ t(this, s).pause || (this.index--, t(this, s).pause = !0);
242
250
  });
243
251
  /**
244
252
  * 下一张轮播图
245
253
  */
246
- k(this, "next", () => {
247
- t(this, o).pause || (this.index++, t(this, o).pause = !0);
254
+ S(this, "next", () => {
255
+ t(this, s).pause || (this.index++, t(this, s).pause = !0);
248
256
  });
249
- this.stylesheet = U, this.$render();
257
+ this.stylesheet = j, this.$render();
250
258
  }
251
259
  static get observedAttributes() {
252
260
  return [
@@ -277,7 +285,7 @@ class W extends N {
277
285
  ["--" + this.direction]: this.direction
278
286
  },
279
287
  {
280
- ["arrow-" + this.arrow]: this.arrow === "always" || this.arrow === "never" || t(this, o).isMouseEnter,
288
+ ["arrow-" + this.arrow]: this.arrow === "always" || this.arrow === "never" || t(this, s).isMouseEnter,
281
289
  [this["indicator-position"] + "-indicator"]: this["indicator-position"]
282
290
  }
283
291
  );
@@ -299,76 +307,78 @@ class W extends N {
299
307
 
300
308
  </footer>
301
309
  </div>
302
- `, v(this, f, this.shadowRoot.querySelector(".ea-carousel")), v(this, w, this.shadowRoot.querySelector(".ea-carousel__content")), v(this, g, this.shadowRoot.querySelector(
310
+ `, v(this, f, this.shadowRoot.querySelector(".ea-carousel")), v(this, m, this.shadowRoot.querySelector(".ea-carousel__content")), v(this, g, this.shadowRoot.querySelector(
303
311
  ".ea-carousel__indicator-wrap"
304
- )), v(this, C, this.shadowRoot.querySelector(
312
+ )), v(this, _, this.shadowRoot.querySelector(
305
313
  ".ea-carousel__arrow.arrow-left"
306
- )), v(this, y, this.shadowRoot.querySelector(
314
+ )), v(this, A, this.shadowRoot.querySelector(
307
315
  ".ea-carousel__arrow.arrow-right"
308
- )), t(this, _).call(this), this.updateContainerClasslist();
316
+ )), t(this, w).call(this), this.updateContainerClasslist();
309
317
  }
310
318
  connectedCallback() {
311
- var e, i;
319
+ var e, r;
312
320
  super.connectedCallback(), (e = t(this, h)) == null || e.abort(), v(this, h, new AbortController());
313
- for (const a in t(this, c))
314
- (i = t(this, c)[a]) == null || i.abort(), t(this, c)[a] = new AbortController();
315
- t(this, x).call(this), t(this, _).call(this), p(this, l, z).call(this), this.autoplay && p(this, l, m).call(this), t(this, g).addEventListener(
321
+ for (const l in t(this, u))
322
+ (r = t(this, u)[l]) == null || r.abort(), t(this, u)[l] = new AbortController();
323
+ t(this, E).call(this), t(this, w).call(this), c(this, a, N).call(this), this.autoplay && c(this, a, b).call(this), t(this, g).addEventListener(
316
324
  this.trigger === "hover" ? "mouseover" : "click",
317
- t(this, L),
325
+ t(this, k),
318
326
  {
319
- signal: t(this, c).triggerAbortControllers.signal
327
+ signal: t(this, u).triggerAbortControllers.signal
320
328
  }
321
- ), t(this, w).addEventListener(
329
+ ), t(this, m).addEventListener(
322
330
  "transitionend",
323
- t(this, S),
331
+ t(this, q),
324
332
  { signal: t(this, h).signal }
325
- ), this.arrow !== "never" && this.direction !== "vertical" && (t(this, C).addEventListener("click", this.prev, {
333
+ ), this.arrow !== "never" && this.direction !== "vertical" && (t(this, _).addEventListener("click", this.prev, {
334
+ signal: t(this, h).signal
335
+ }), t(this, A).addEventListener("click", this.next, {
326
336
  signal: t(this, h).signal
327
- }), t(this, y).addEventListener("click", this.next, {
337
+ })), t(this, f).addEventListener("mouseenter", t(this, R), {
328
338
  signal: t(this, h).signal
329
- })), t(this, f).addEventListener("mouseenter", t(this, T), {
339
+ }), window.addEventListener("resize", t(this, M).call(this).listener, {
330
340
  signal: t(this, h).signal
331
- }), window.addEventListener("resize", t(this, I).call(this).listener, {
341
+ }), t(this, m).querySelector("slot").addEventListener("slotchange", t(this, T), {
332
342
  signal: t(this, h).signal
333
343
  }), queueMicrotask(() => {
334
- t(this, A).call(this);
344
+ t(this, C).call(this);
335
345
  });
336
346
  }
337
347
  $beforeUnmounted() {
338
- var e, i, a;
348
+ var e, r, l;
339
349
  (e = t(this, h)) == null || e.abort();
340
- for (const u in t(this, c))
341
- (i = t(this, c)[u]) == null || i.abort();
342
- (a = t(this, I).call(this)) == null || a.unsetHandler();
350
+ for (const d in t(this, u))
351
+ (r = t(this, u)[d]) == null || r.abort();
352
+ (l = t(this, M).call(this)) == null || l.unsetHandler();
343
353
  }
344
354
  }
345
- f = new WeakMap(), w = new WeakMap(), C = new WeakMap(), y = new WeakMap(), g = new WeakMap(), d = new WeakMap(), h = new WeakMap(), c = new WeakMap(), o = new WeakMap(), E = new WeakMap(), _ = new WeakMap(), l = new WeakSet(), /**
355
+ f = new WeakMap(), m = new WeakMap(), _ = new WeakMap(), A = new WeakMap(), g = new WeakMap(), p = new WeakMap(), h = new WeakMap(), u = new WeakMap(), s = new WeakMap(), L = new WeakMap(), w = new WeakMap(), a = new WeakSet(), /**
346
356
  * 初始化 `轮播图元素` 结构
347
357
  */
348
- z = function() {
358
+ N = function() {
349
359
  try {
350
- this.childNodes.forEach((u) => {
351
- u.tagName !== "EA-CAROUSEL-ITEM" && u.remove();
360
+ this.childNodes.forEach((d) => {
361
+ d.tagName !== "EA-CAROUSEL-ITEM" && d.remove();
352
362
  });
353
- const e = this.children, i = e[0].cloneNode(!0), a = e[e.length - 1].cloneNode(!0);
354
- t(this, o).originLength = e.length, this.insertBefore(a, this.firstChild), this.appendChild(i), queueMicrotask(() => {
355
- t(this, b).call(this);
363
+ const e = this.children, r = e[0].cloneNode(!0), l = e[e.length - 1].cloneNode(!0);
364
+ t(this, s).originLength = e.length, this.insertBefore(l, this.firstChild), this.appendChild(r), queueMicrotask(() => {
365
+ t(this, y).call(this);
356
366
  });
357
367
  } catch {
358
368
  }
359
- }, b = new WeakMap(), R = new WeakMap(), /**
369
+ }, y = new WeakMap(), I = new WeakMap(), /**
360
370
  * 清除轮播图自动播放
361
371
  */
362
- M = function() {
363
- t(this, o).timer && (clearInterval(t(this, o).timer), t(this, o).timer = null);
372
+ x = function() {
373
+ t(this, s).timer && (clearInterval(t(this, s).timer), t(this, s).timer = null);
364
374
  }, /**
365
375
  * 处理轮播图自动播放
366
376
  */
367
- m = function() {
368
- this.autoplay && (t(this, o).timer = setInterval(this.next, this.interval));
369
- }, A = new WeakMap(), x = new WeakMap(), L = new WeakMap(), S = new WeakMap(), T = new WeakMap(), I = new WeakMap();
370
- window.customElements.get("ea-carousel") || window.customElements.define("ea-carousel", W);
377
+ b = function() {
378
+ this.autoplay && (t(this, s).timer = setInterval(this.next, this.interval));
379
+ }, C = new WeakMap(), E = new WeakMap(), k = new WeakMap(), q = new WeakMap(), R = new WeakMap(), M = new WeakMap(), T = new WeakMap();
380
+ window.customElements.get("ea-carousel") || window.customElements.define("ea-carousel", X);
371
381
  export {
372
- W as EaCarousel,
373
- j as EaCarouselItem
382
+ X as EaCarousel,
383
+ W as EaCarouselItem
374
384
  };
@@ -1,19 +1,21 @@
1
- var h = Object.defineProperty;
2
- var r = (t) => {
1
+ var u = Object.defineProperty;
2
+ var d = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
- var u = (t, s, e) => s in t ? h(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
6
- var l = (t, s, e) => u(t, typeof s != "symbol" ? s + "" : s, e), o = (t, s, e) => s.has(t) || r("Cannot " + e);
7
- var n = (t, s, e) => (o(t, s, "read from private field"), e ? e.call(t) : s.get(t)), d = (t, s, e) => s.has(t) ? r("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), c = (t, s, e, a) => (o(t, s, "write to private field"), a ? a.call(t, e) : s.set(t, e), e);
8
- import { B as p } from "./Base.js";
9
- import { s as f } from "../css/ea-link.style.js";
10
- var i;
11
- class m extends p {
5
+ var p = (t, s, e) => s in t ? u(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
6
+ var c = (t, s, e) => p(t, typeof s != "symbol" ? s + "" : s, e), h = (t, s, e) => s.has(t) || d("Cannot " + e);
7
+ var a = (t, s, e) => (h(t, s, "read from private field"), e ? e.call(t) : s.get(t)), r = (t, s, e) => s.has(t) ? d("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), l = (t, s, e, o) => (h(t, s, "write to private field"), o ? o.call(t, e) : s.set(t, e), e);
8
+ import { B as m } from "./Base.js";
9
+ import { s as b } from "../css/ea-link.style.js";
10
+ var i, n;
11
+ class y extends m {
12
12
  constructor() {
13
13
  super();
14
14
  /** @type {HTMLAnchorElement} */
15
- d(this, i);
16
- /**
15
+ r(this, i);
16
+ /** @type {HTMLElement} */
17
+ r(this, n);
18
+ /**
17
19
  * @typedef {Object} LinkState
18
20
  * @property {string} type
19
21
  * @property {Boolean} disabled
@@ -22,46 +24,44 @@ class m extends p {
22
24
  * @property {string} icon
23
25
  */
24
26
  /** @type {LinkState} */
25
- l(this, "state", this.properties({
27
+ c(this, "state", this.properties({
26
28
  type: {
27
29
  type: ["normal", "primary", "success", "info", "warning", "danger"],
28
30
  default: "normal",
29
31
  observer: (e) => {
30
- n(this, i).className = this.updateContainerClasslist();
32
+ a(this, i).className = this.updateContainerClasslist();
31
33
  }
32
34
  },
33
35
  disabled: {
34
36
  type: Boolean,
35
37
  default: !1,
36
38
  observer: (e) => {
37
- n(this, i).className = this.updateContainerClasslist();
39
+ a(this, i).className = this.updateContainerClasslist();
38
40
  }
39
41
  },
40
42
  underline: {
41
43
  type: ["always", "hover", "never"],
42
44
  default: "",
43
45
  observer: (e) => {
44
- n(this, i).className = this.updateContainerClasslist();
46
+ a(this, i).className = this.updateContainerClasslist();
45
47
  }
46
48
  },
47
49
  href: {
48
50
  type: String,
49
51
  default: "",
50
52
  observer: (e) => {
51
- n(this, i).href = e;
53
+ a(this, i).href = e;
52
54
  }
53
55
  },
54
56
  icon: {
55
57
  type: String,
56
58
  default: "",
57
59
  observer: (e) => {
58
- if (!e) return;
59
- const a = document.createElement("ea-icon");
60
- a.icon = e, a.part = "icon", n(this, i).insertBefore(a, n(this, i).firstChild);
60
+ a(this, n).setAttribute("icon", e), a(this, i).className = this.updateContainerClasslist();
61
61
  }
62
62
  }
63
63
  }));
64
- this.stylesheet = f, this.$render();
64
+ this.stylesheet = b, this.$render();
65
65
  }
66
66
  static get observedAttributes() {
67
67
  return ["type", "disabled", "underline", "href", "icon"];
@@ -71,25 +71,31 @@ class m extends p {
71
71
  * @return {string} 属性值
72
72
  */
73
73
  updateContainerClasslist() {
74
- return this.computedClasslist("ea-link", {
75
- ["--" + this.type]: this.type,
76
- ["--underline-" + this.underline]: this.underline,
77
- "--disabled": this.disabled
78
- });
74
+ var e;
75
+ return this.computedClasslist(
76
+ "ea-link",
77
+ {
78
+ ["--" + this.type]: this.type,
79
+ ["--underline-" + this.underline]: this.underline,
80
+ "--disabled": this.disabled
81
+ },
82
+ { icon: (e = this.icon) == null ? void 0 : e.length }
83
+ );
79
84
  }
80
85
  $render() {
81
86
  this.shadowRoot.innerHTML = `
82
87
  <a class="ea-link" part="container" tabindex="-1">
88
+ <ea-icon class="ea-link__icon" part="icon"></ea-icon>
83
89
  <slot></slot>
84
90
  </a>
85
- `, c(this, i, this.shadowRoot.querySelector(".ea-link"));
91
+ `, l(this, i, this.shadowRoot.querySelector(".ea-link")), l(this, n, this.shadowRoot.querySelector(".ea-link__icon"));
86
92
  }
87
93
  connectedCallback() {
88
94
  super.connectedCallback();
89
95
  }
90
96
  }
91
- i = new WeakMap();
92
- window.customElements.get("ea-link") || window.customElements.define("ea-link", m);
97
+ i = new WeakMap(), n = new WeakMap();
98
+ window.customElements.get("ea-link") || window.customElements.define("ea-link", y);
93
99
  export {
94
- m as EaLink
100
+ y as EaLink
95
101
  };