easy-component-ui 3.0.11 → 3.0.12

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 (40) hide show
  1. package/dist/components/Base.js +187 -186
  2. package/dist/components/ea-breadcrumb.js +33 -33
  3. package/dist/components/ea-calendar2.js +327 -329
  4. package/dist/components/ea-collapse.js +100 -80
  5. package/dist/components/ea-color-picker.js +199 -196
  6. package/dist/components/ea-countdown.js +77 -56
  7. package/dist/components/ea-descriptions.js +133 -70
  8. package/dist/components/ea-drawer.js +87 -70
  9. package/dist/components/ea-empty.js +31 -23
  10. package/dist/components/ea-menu.js +68 -52
  11. package/dist/components/ea-overlay.js +35 -29
  12. package/dist/components/ea-pagination.js +1 -0
  13. package/dist/components/ea-popconfirm.js +132 -77
  14. package/dist/components/ea-popper.js +9 -9
  15. package/dist/components/ea-progress.js +81 -64
  16. package/dist/components/ea-result.js +22 -22
  17. package/dist/components/ea-select.js +110 -99
  18. package/dist/components/ea-skeleton.js +99 -82
  19. package/dist/components/ea-statistic.js +72 -4
  20. package/dist/components/ea-steps.js +104 -70
  21. package/dist/components/ea-table.js +514 -397
  22. package/dist/components/ea-tag.js +37 -43
  23. package/dist/components/ea-timeline.js +10 -11
  24. package/dist/components/index.js +1 -1
  25. package/dist/css/ea-card.style.js +1 -1
  26. package/dist/css/ea-collapse-item.style.js +1 -1
  27. package/dist/css/ea-color-picker-panel.style.js +1 -1
  28. package/dist/css/ea-descriptions-item.style.js +2 -2
  29. package/dist/css/ea-descriptions.style.js +1 -1
  30. package/dist/css/ea-empty.style.js +1 -1
  31. package/dist/css/ea-progress.style.js +1 -1
  32. package/dist/css/ea-skeleton.style.js +1 -1
  33. package/dist/css/ea-step.style.js +1 -1
  34. package/dist/css/ea-table-column.style.js +4 -0
  35. package/dist/css/ea-table.style.js +1 -1
  36. package/dist/css/ea-timeline-item.style.js +1 -1
  37. package/dist/utils/Variables.js +5 -12
  38. package/dist/utils/parseTime.js +73 -0
  39. package/package.json +1 -1
  40. package/dist/components/ea-statistic2.js +0 -83
@@ -1,72 +1,79 @@
1
- var _ = Object.defineProperty;
2
- var y = (t) => {
3
- throw TypeError(t);
1
+ var E = Object.defineProperty;
2
+ var v = (s) => {
3
+ throw TypeError(s);
4
4
  };
5
- var C = (t, s, e) => s in t ? _(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
6
- var b = (t, s, e) => C(t, typeof s != "symbol" ? s + "" : s, e), v = (t, s, e) => s.has(t) || y("Cannot " + e);
7
- var o = (t, s, e) => (v(t, s, "read from private field"), e ? e.call(t) : s.get(t)), a = (t, s, e) => s.has(t) ? y("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), r = (t, s, e, p) => (v(t, s, "write to private field"), p ? p.call(t, e) : s.set(t, e), e);
8
- import { EaOverlay as g } from "./ea-overlay.js";
9
- import { s as S } from "../css/ea-drawer.style.js";
10
- import { E } from "../utils/Utils.js";
11
- import { t as k } from "../utils/timeout.js";
12
- var i, u, l, h, c, n, f, w, m, d;
13
- class q extends g {
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
14
  constructor() {
15
15
  super();
16
- /** @type {AbortController} */
17
- a(this, i);
18
16
  /** @type {HTMLElement} */
19
- a(this, u);
17
+ r(this, f);
20
18
  /** @type {HTMLElement} */
21
- a(this, l);
19
+ r(this, h);
22
20
  /** @type {HTMLElement} */
23
- a(this, h);
21
+ r(this, p);
24
22
  /** @type {HTMLElement} */
25
- a(this, c);
23
+ r(this, u);
26
24
  /** @type {HTMLElement} */
27
- a(this, n);
25
+ r(this, d);
28
26
  /** @type {HTMLElement} */
29
- a(this, f);
27
+ r(this, w);
30
28
  /** @type {HTMLElement} */
31
- a(this, w);
32
- b(this, "state", this.properties({
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({
33
39
  direction: {
34
40
  type: ["rtl", "ltr", "ttb", "btt"],
35
- default: "rtl",
36
- observer: (e) => {
37
- }
41
+ default: "rtl"
38
42
  },
39
43
  visible: {
40
44
  type: Boolean,
41
45
  default: !1,
42
46
  repeatable: !0,
43
47
  observer: (e) => {
44
- if (!e && this["before-close"] && this.status !== this.visible)
45
- return o(this, d).call(this);
46
- e && k(() => {
47
- this.focus();
48
- }, 0), this.status = 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);
49
53
  }
50
54
  },
51
55
  "with-header": {
52
56
  type: Boolean,
53
57
  default: !0,
54
58
  observer: (e) => {
55
- o(this, h).style.display = e ? "flex" : "none";
59
+ t(this, p).style.display = e ? "flex" : "none";
56
60
  }
57
61
  },
58
62
  title: {
59
63
  type: String,
60
64
  default: "",
61
65
  observer: (e) => {
62
- this["with-header"] && (o(this, c).textContent = e);
66
+ this["with-header"] && (t(this, u).textContent = e);
63
67
  }
64
68
  },
65
69
  showClose: {
66
70
  type: Boolean,
67
71
  default: !0,
68
72
  observer: (e) => {
69
- this["with-header"] && (o(this, n).style.display = e ? "block" : "none");
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
+ }));
70
77
  }
71
78
  },
72
79
  size: {
@@ -78,19 +85,33 @@ class q extends g {
78
85
  },
79
86
  "append-to-body": {
80
87
  type: Boolean,
81
- default: !1,
82
- observer: (e) => {
83
- }
88
+ default: !1
84
89
  },
85
90
  "close-on-press-escape": {
86
91
  type: Boolean,
87
92
  default: !0,
88
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
+ }));
89
98
  }
90
99
  }
91
100
  }));
92
- a(this, m, (e, p) => {
93
- p.innerHTML = `
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 = `
94
115
  <div class="ea-drawer-main" part="container">
95
116
  <header class="ea-drawer-main__header" part="header">
96
117
  <span class="ea-drawer-main__title" part="title">
@@ -105,44 +126,47 @@ class q extends g {
105
126
  <slot name="footer"></slot>
106
127
  </footer>
107
128
  </div>
108
- `, r(this, u, this.shadowRoot.querySelector(".ea-overlay")), r(this, l, this.shadowRoot.querySelector(".ea-drawer-main")), r(this, h, this.shadowRoot.querySelector(".ea-drawer-main__header")), r(this, c, this.shadowRoot.querySelector(".ea-drawer-main__title")), r(this, n, this.shadowRoot.querySelector(
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(
109
130
  ".ea-drawer-main__close-icon"
110
- )), r(this, f, this.shadowRoot.querySelector(".ea-drawer-main__content")), r(this, w, this.shadowRoot.querySelector(".ea-drawer-main__footer"));
131
+ )), a(this, w, this.shadowRoot.querySelector(".ea-drawer-main__content")), a(this, b, this.shadowRoot.querySelector(".ea-drawer-main__footer"));
111
132
  });
112
- a(this, d, () => {
113
- this["before-close"] ? this.emit("before-close", {
114
- detail: {
115
- done: () => this.status = !1
116
- }
117
- }) : this.status = !1;
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);
118
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);
119
149
  const e = this.shadowRoot.querySelector(
120
150
  ".ea-overlay__content"
121
151
  );
122
- o(this, m).call(this, this.direction, e), this["append-to-body"] && document.body.appendChild(this);
152
+ t(this, m).call(this, e);
123
153
  }
124
154
  static get observedAttributes() {
125
- return E.Array.toLowerCamelCase([
155
+ return q.Array.toLowerCamelCase([
126
156
  ...super.observedAttributes,
127
157
  "direction",
128
158
  "visible",
129
159
  "append-to-body",
130
160
  "append-to",
131
- // "lock-scroll",
132
- "before-close",
133
161
  "close-on-click-modal",
134
162
  "close-on-press-escape",
135
- // "open-delay",
136
- // "close-delay",
137
- // "destroy-on-close",
138
163
  "modal",
139
- // "resizable",
140
164
  "show-close",
141
165
  "size",
142
166
  "title",
143
167
  "with-header",
144
168
  "z-index",
145
- "header-aria-level "
169
+ "header-aria-level"
146
170
  ]);
147
171
  }
148
172
  /**
@@ -161,7 +185,8 @@ class q extends g {
161
185
  )}`;
162
186
  }
163
187
  connectedCallback() {
164
- r(this, i, new AbortController()), o(this, l).ariaModal = !0, o(this, l).role = "dialog", this["close-on-click-modal"] = this.getAttrBoolean(
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(
165
190
  "close-on-click-modal",
166
191
  !0
167
192
  ), this.addEventListener(
@@ -170,25 +195,17 @@ class q extends g {
170
195
  this.visible = !1;
171
196
  },
172
197
  {
173
- signal: o(this, i).signal
198
+ signal: t(this, n).signal
174
199
  }
175
- ), this["show-close"] && o(this, n).addEventListener("click", o(this, d), {
176
- signal: o(this, i).signal
177
- }), this["close-on-press-escape"] && this.addEventListener(
178
- "keydown",
179
- (e) => {
180
- e.key === "Escape" && o(this, d).call(this);
181
- },
182
- { signal: o(this, i).signal }
183
- ), super.connectedCallback(), this.assignedStyle(S);
200
+ ), super.connectedCallback(), this.assignedStyle(k);
184
201
  }
185
202
  $beforeUnmounted() {
186
203
  var e;
187
- (e = o(this, i)) == null || e.abort();
204
+ (e = t(this, n)) == null || e.abort();
188
205
  }
189
206
  }
190
- i = new WeakMap(), u = new WeakMap(), l = new WeakMap(), h = new WeakMap(), c = new WeakMap(), n = new WeakMap(), f = new WeakMap(), w = new WeakMap(), m = new WeakMap(), d = new WeakMap();
191
- window.customElements.get("ea-drawer") || window.customElements.define("ea-drawer", q);
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);
192
209
  export {
193
- q as EaDrawer
210
+ R as EaDrawer
194
211
  };
@@ -1,36 +1,40 @@
1
- var y = Object.defineProperty;
2
- var m = (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 ? y(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
6
- var c = (t, s, e) => u(t, typeof s != "symbol" ? s + "" : s, e), h = (t, s, e) => s.has(t) || m("Cannot " + e);
7
- var n = (t, s, e) => (h(t, s, "read from private field"), e ? e.call(t) : s.get(t)), o = (t, s, e) => s.has(t) ? m("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), a = (t, s, e, d) => (h(t, s, "write to private field"), d ? d.call(t, e) : s.set(t, e), e);
8
- import { B as g } from "./Base.js";
9
- import { s as v } from "../css/ea-empty.style.js";
10
- const _ = `
5
+ var g = (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) => g(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), p = (t, s, e, m) => (h(t, s, "write to private field"), m ? m.call(t, e) : s.set(t, e), e);
8
+ import { B as v } from "./Base.js";
9
+ import { s as _ } from "../css/ea-empty.style.js";
10
+ const y = `
11
11
  <svg viewBox="25 30 50 50" xmlns="http://www.w3.org/2000/svg">
12
12
  <path d="M30 50v21.5a2 2 0 0 0 1 1h39a2 2 0 0 0 1-1V50H61a10 10 0 0 1-20 0h-6.5z" class="front" part="default-image-front" />
13
13
  <path d="M30.5 50.5L34 39h32.5l4 11.5" fill="none" class="border" part="default-image-border" />
14
14
  </svg>
15
15
  `;
16
- var p, i, r, l;
17
- class b extends g {
16
+ var l, i, o, n;
17
+ class f extends v {
18
18
  constructor() {
19
19
  super();
20
20
  /** @type {HTMLElement} */
21
- o(this, p);
21
+ r(this, l);
22
22
  /** @type {HTMLElement} */
23
- o(this, i);
23
+ r(this, i);
24
24
  /** @type {HTMLElement} */
25
- o(this, r);
25
+ r(this, o);
26
26
  /** @type {HTMLElement} */
27
- o(this, l);
27
+ r(this, n);
28
28
  c(this, "state", this.properties({
29
29
  image: {
30
30
  type: String,
31
31
  default: "",
32
32
  observer: (e) => {
33
- n(this, i).innerHTML = `<img class="ea-empty__image" src="${e}" alt="empty image" part="image" />`;
33
+ e ? a(this, i).innerHTML = this.html(`
34
+ <img class="ea-empty__image" src="${e}" alt="empty image" part="image" />
35
+ `) : a(this, i).innerHTML = this.html(`
36
+ <section class="ea-empty__default">${y}</section>
37
+ `);
34
38
  }
35
39
  },
36
40
  "image-size": {
@@ -48,21 +52,21 @@ class b extends g {
48
52
  type: String,
49
53
  default: "",
50
54
  observer: (e) => {
51
- n(this, r).textContent = e;
55
+ e ? a(this, o).textContent = e : a(this, o).innerText = "No Data";
52
56
  }
53
57
  }
54
58
  }));
55
- this.stylesheet = v, this.$render();
59
+ this.stylesheet = _, this.$render();
56
60
  }
57
61
  static get observedAttributes() {
58
62
  return [...super.observedAttributes, "image", "image-size", "description"];
59
63
  }
60
64
  $render() {
61
- this.shadowRoot.innerHTML = `
65
+ this.shadowRoot.innerHTML = this.html(`
62
66
  <div class='ea-empty' part='container'>
63
67
  <div class="ea-empty__placeholder" part="placeholder">
64
68
  <slot name="image">
65
- <section class="ea-empty__default">${_}</section>
69
+ <section class="ea-empty__default">${y}</section>
66
70
  </slot>
67
71
  </div>
68
72
  <div class="ea-empty__description" part="description">
@@ -72,14 +76,18 @@ class b extends g {
72
76
  <slot></slot>
73
77
  </div>
74
78
  </div>
75
- `, a(this, p, this.shadowRoot.querySelector(".ea-empty")), a(this, i, this.shadowRoot.querySelector(".ea-empty__placeholder")), a(this, r, this.shadowRoot.querySelector(".ea-empty__description")), a(this, l, this.shadowRoot.querySelector(".ea-empty__bottom"));
79
+ `), p(this, l, this.shadowRoot.querySelector(".ea-empty")), p(this, i, this.shadowRoot.querySelector(
80
+ ".ea-empty__placeholder slot[name='image']"
81
+ )), p(this, o, this.shadowRoot.querySelector(
82
+ ".ea-empty__description slot[name='description']"
83
+ )), p(this, n, this.shadowRoot.querySelector(".ea-empty__bottom"));
76
84
  }
77
85
  connectedCallback() {
78
86
  super.connectedCallback();
79
87
  }
80
88
  }
81
- p = new WeakMap(), i = new WeakMap(), r = new WeakMap(), l = new WeakMap();
82
- window.customElements.get("ea-empty") || window.customElements.define("ea-empty", b);
89
+ l = new WeakMap(), i = new WeakMap(), o = new WeakMap(), n = new WeakMap();
90
+ window.customElements.get("ea-empty") || window.customElements.define("ea-empty", f);
83
91
  export {
84
- b as EaEmpty
92
+ f as EaEmpty
85
93
  };
@@ -1,17 +1,17 @@
1
- var B = Object.defineProperty;
2
- var q = (s) => {
1
+ var I = Object.defineProperty;
2
+ var R = (s) => {
3
3
  throw TypeError(s);
4
4
  };
5
- var I = (s, i, e) => i in s ? B(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
6
- var p = (s, i, e) => I(s, typeof i != "symbol" ? i + "" : i, e), R = (s, i, e) => i.has(s) || q("Cannot " + e);
7
- var t = (s, i, e) => (R(s, i, "read from private field"), e ? e.call(s) : i.get(s)), r = (s, i, e) => i.has(s) ? q("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, e), a = (s, i, e, o) => (R(s, i, "write to private field"), o ? o.call(s, e) : i.set(s, e), e);
8
- import { B as _ } from "./Base.js";
9
- import { s as N } from "../css/ea-menu.style.js";
10
- import { s as P } from "../css/ea-menu-item.style.js";
11
- import { s as T } from "../css/ea-menu-item-group.style.js";
12
- import { s as U } from "../css/ea-sub-menu.style.js";
13
- var u, c, A, v, E;
14
- class z extends _ {
5
+ var N = (s, i, e) => i in s ? I(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
6
+ var p = (s, i, e) => N(s, typeof i != "symbol" ? i + "" : i, e), H = (s, i, e) => i.has(s) || R("Cannot " + e);
7
+ var t = (s, i, e) => (H(s, i, "read from private field"), e ? e.call(s) : i.get(s)), r = (s, i, e) => i.has(s) ? R("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, e), a = (s, i, e, o) => (H(s, i, "write to private field"), o ? o.call(s, e) : i.set(s, e), e);
8
+ import { B as q } from "./Base.js";
9
+ import { s as P } from "../css/ea-menu.style.js";
10
+ import { s as T } from "../css/ea-menu-item.style.js";
11
+ import { s as U } from "../css/ea-menu-item-group.style.js";
12
+ import { s as z } from "../css/ea-sub-menu.style.js";
13
+ var u, c, E, v, x;
14
+ class D extends q {
15
15
  constructor() {
16
16
  super();
17
17
  /** @type {HTMLElement} */
@@ -23,7 +23,7 @@ class z extends _ {
23
23
  type: ["horizontal", "vertical"],
24
24
  default: "vertical",
25
25
  observer: (e) => {
26
- t(this, A).call(this, e), this.updateContainerClasslist();
26
+ t(this, E).call(this, e), this.updateContainerClasslist();
27
27
  }
28
28
  },
29
29
  "background-color": {
@@ -69,7 +69,7 @@ class z extends _ {
69
69
  * 更新子菜单模式
70
70
  * @param {string} mode
71
71
  */
72
- r(this, A, (e) => {
72
+ r(this, E, (e) => {
73
73
  this.querySelectorAll("ea-sub-menu").forEach((o) => {
74
74
  o.setAttribute("mode", e);
75
75
  });
@@ -81,7 +81,7 @@ class z extends _ {
81
81
  r(this, v, (e) => {
82
82
  const o = [...this.querySelectorAll("ea-menu-item")], l = [...this.querySelectorAll("ea-sub-menu")], b = e.target.closest("ea-menu-item");
83
83
  if (e.target.closest("ea-sub-menu") || b) {
84
- const L = (H) => H.removeAttribute("active");
84
+ const L = (B) => B.removeAttribute("active");
85
85
  o.forEach(L), l.forEach(L);
86
86
  }
87
87
  b && (b.toggleAttribute("active", !0), this.emit("select", {
@@ -94,13 +94,13 @@ class z extends _ {
94
94
  /**
95
95
  * 初始化默认激活项
96
96
  */
97
- r(this, E, () => {
97
+ r(this, x, () => {
98
98
  const e = this.querySelector(
99
99
  `ea-menu-item[index="${this["default-active"]}"]`
100
100
  );
101
101
  e && e.click();
102
102
  });
103
- this.stylesheet = N, this.$render();
103
+ this.stylesheet = P, this.$render();
104
104
  }
105
105
  static get observedAttributes() {
106
106
  return [
@@ -140,16 +140,16 @@ class z extends _ {
140
140
  signal: t(this, c).signal
141
141
  }), this.addEventListener("ea-sub-menu-click", t(this, v), {
142
142
  signal: t(this, c).signal
143
- }), t(this, E).call(this);
143
+ }), t(this, x).call(this);
144
144
  }
145
145
  $beforeUnmounted() {
146
146
  t(this, c).abort();
147
147
  }
148
148
  }
149
- u = new WeakMap(), c = new WeakMap(), A = new WeakMap(), v = new WeakMap(), E = new WeakMap();
150
- window.customElements.get("ea-menu") || window.customElements.define("ea-menu", z);
149
+ u = new WeakMap(), c = new WeakMap(), E = new WeakMap(), v = new WeakMap(), x = new WeakMap();
150
+ window.customElements.get("ea-menu") || window.customElements.define("ea-menu", D);
151
151
  var f;
152
- class D extends _ {
152
+ class G extends q {
153
153
  constructor() {
154
154
  super();
155
155
  /** @type {HTMLElement} */
@@ -176,7 +176,7 @@ class D extends _ {
176
176
  }
177
177
  }
178
178
  }));
179
- this.stylesheet = P, this.$render();
179
+ this.stylesheet = T, this.$render();
180
180
  }
181
181
  static get observedAttributes() {
182
182
  return [...super.observedAttributes, "index", "disabled", "active"];
@@ -208,17 +208,17 @@ class D extends _ {
208
208
  }
209
209
  }
210
210
  f = new WeakMap();
211
- window.customElements.get("ea-menu-item") || window.customElements.define("ea-menu-item", D);
212
- var x, C, S;
213
- class G extends _ {
211
+ window.customElements.get("ea-menu-item") || window.customElements.define("ea-menu-item", G);
212
+ var S, C, $;
213
+ class V extends q {
214
214
  constructor() {
215
215
  super();
216
216
  /** @type {HTMLElement} */
217
- r(this, x);
217
+ r(this, S);
218
218
  /** @type {HTMLSlotElement} */
219
219
  r(this, C);
220
220
  /** @type {AbortController} */
221
- r(this, S, new AbortController());
221
+ r(this, $, new AbortController());
222
222
  p(this, "state", this.properties({
223
223
  title: {
224
224
  type: String,
@@ -228,7 +228,7 @@ class G extends _ {
228
228
  }
229
229
  }
230
230
  }));
231
- this.stylesheet = T, this.$render();
231
+ this.stylesheet = U, this.$render();
232
232
  }
233
233
  static get observedAttributes() {
234
234
  return [...super.observedAttributes, "title"];
@@ -243,25 +243,27 @@ class G extends _ {
243
243
  <slot></slot>
244
244
  </div>
245
245
  </div>
246
- `, a(this, x, this.shadowRoot.querySelector(".ea-menu-item-group")), a(this, C, this.shadowRoot.querySelector("slot[name='title']"));
246
+ `, a(this, S, this.shadowRoot.querySelector(".ea-menu-item-group")), a(this, C, this.shadowRoot.querySelector("slot[name='title']"));
247
247
  }
248
248
  connectedCallback() {
249
249
  super.connectedCallback();
250
250
  }
251
251
  $beforeUnmounted() {
252
- t(this, S).abort();
252
+ t(this, $).abort();
253
253
  }
254
254
  }
255
- x = new WeakMap(), C = new WeakMap(), S = new WeakMap();
256
- window.customElements.get("ea-menu-item-group") || window.customElements.define("ea-menu-item-group", G);
257
- var g, y, n, m, h, d, $, k, M, w;
258
- class V extends _ {
255
+ S = new WeakMap(), C = new WeakMap(), $ = new WeakMap();
256
+ window.customElements.get("ea-menu-item-group") || window.customElements.define("ea-menu-item-group", V);
257
+ var g, y, w, n, m, h, d, k, M, _, A;
258
+ class j extends q {
259
259
  constructor() {
260
260
  super();
261
261
  /** @type {HTMLElement} */
262
262
  r(this, g);
263
263
  /** @type {HTMLElement} */
264
264
  r(this, y);
265
+ /** @type {HTMLSlotElement} */
266
+ r(this, w);
265
267
  /** @type {HTMLElement} */
266
268
  r(this, n);
267
269
  /** @type {AbortController} */
@@ -303,7 +305,14 @@ class V extends _ {
303
305
  type: ["horizontal", "vertical"],
304
306
  default: "vertical",
305
307
  observer: (e) => {
306
- t(this, w).call(this, e), this.updateContainerClasslist();
308
+ t(this, A).call(this, e), this.updateContainerClasslist();
309
+ }
310
+ },
311
+ label: {
312
+ type: String,
313
+ default: "",
314
+ observer: (e) => {
315
+ t(this, w).textContent = e;
307
316
  }
308
317
  }
309
318
  }));
@@ -311,7 +320,7 @@ class V extends _ {
311
320
  * 菜单项点击事件
312
321
  * @param {MouseEvent} e
313
322
  */
314
- r(this, $, (e) => {
323
+ r(this, k, (e) => {
315
324
  e.stopImmediatePropagation(), e.preventDefault();
316
325
  const o = e.target.closest("ea-menu-item"), l = this.closest("ea-sub-menu") === this ? this.parentElement.closest("ea-sub-menu") : this.closest("ea-sub-menu");
317
326
  o && (this.emit("ea-sub-menu-click", {
@@ -323,7 +332,7 @@ class V extends _ {
323
332
  * 鼠标悬停事件
324
333
  * @param {MouseEvent} e
325
334
  */
326
- r(this, k, () => {
335
+ r(this, M, () => {
327
336
  var o;
328
337
  (o = t(this, h)) == null || o.abort(), a(this, h, new AbortController()), this.open = !0;
329
338
  const e = () => {
@@ -337,7 +346,7 @@ class V extends _ {
337
346
  /**
338
347
  * 垂直菜单折叠事件
339
348
  */
340
- r(this, M, () => {
349
+ r(this, _, () => {
341
350
  this.open = !this.open, this.open || (t(this, n).style.setProperty("--ea-sub-menu-transition", "none"), t(this, n).offsetHeight, t(this, n).style.height = `${t(this, n).scrollHeight}px`, t(this, n).offsetHeight, t(this, n).style.removeProperty("--ea-sub-menu-transition")), t(this, n).style.height = `${this.open ? t(this, n).scrollHeight : 0}px`, t(this, n).addEventListener(
342
351
  "transitionend",
343
352
  () => {
@@ -350,18 +359,25 @@ class V extends _ {
350
359
  * 菜单模式切换
351
360
  * @param {string} [mode]
352
361
  */
353
- r(this, w, (e = this.mode) => {
362
+ r(this, A, (e = this.mode) => {
354
363
  var o;
355
- (o = t(this, d)) == null || o.abort(), a(this, d, new AbortController()), e === "vertical" ? t(this, y).addEventListener("click", t(this, M), {
364
+ (o = t(this, d)) == null || o.abort(), a(this, d, new AbortController()), e === "vertical" ? t(this, y).addEventListener("click", t(this, _), {
356
365
  signal: t(this, d).signal
357
- }) : this.addEventListener("mouseenter", t(this, k), {
366
+ }) : this.addEventListener("mouseenter", t(this, M), {
358
367
  signal: t(this, d).signal
359
368
  });
360
369
  });
361
- this.stylesheet = U, this.$render();
370
+ this.stylesheet = z, this.$render();
362
371
  }
363
372
  static get observedAttributes() {
364
- return [...super.observedAttributes, "active", "index", "disabled", "mode"];
373
+ return [
374
+ ...super.observedAttributes,
375
+ "active",
376
+ "index",
377
+ "disabled",
378
+ "mode",
379
+ "label"
380
+ ];
365
381
  }
366
382
  /**
367
383
  * 获取 classlist 列表
@@ -394,24 +410,24 @@ class V extends _ {
394
410
  <slot></slot>
395
411
  </ul>
396
412
  </div>
397
- `, a(this, g, this.shadowRoot.querySelector(".ea-sub-menu")), a(this, y, this.shadowRoot.querySelector(".ea-sub-menu__title")), a(this, n, this.shadowRoot.querySelector(".ea-sub-menu__content")), this.updateContainerClasslist();
413
+ `, a(this, g, this.shadowRoot.querySelector(".ea-sub-menu")), a(this, y, this.shadowRoot.querySelector(".ea-sub-menu__title")), a(this, w, this.shadowRoot.querySelector("slot[name='title']")), a(this, n, this.shadowRoot.querySelector(".ea-sub-menu__content")), this.updateContainerClasslist();
398
414
  }
399
415
  connectedCallback() {
400
416
  var e;
401
- super.connectedCallback(), (e = t(this, m)) == null || e.abort(), a(this, m, new AbortController()), this.addEventListener("click", t(this, $), {
417
+ super.connectedCallback(), (e = t(this, m)) == null || e.abort(), a(this, m, new AbortController()), this.addEventListener("click", t(this, k), {
402
418
  signal: t(this, m).signal
403
- }), t(this, w).call(this), this.updateContainerClasslist();
419
+ }), t(this, A).call(this), this.updateContainerClasslist();
404
420
  }
405
421
  $beforeUnmounted() {
406
422
  var e, o, l;
407
423
  (e = t(this, m)) == null || e.abort(), (o = t(this, h)) == null || o.abort(), (l = t(this, d)) == null || l.abort();
408
424
  }
409
425
  }
410
- g = new WeakMap(), y = new WeakMap(), n = new WeakMap(), m = new WeakMap(), h = new WeakMap(), d = new WeakMap(), $ = new WeakMap(), k = new WeakMap(), M = new WeakMap(), w = new WeakMap();
411
- window.customElements.get("ea-sub-menu") || window.customElements.define("ea-sub-menu", V);
426
+ g = new WeakMap(), y = new WeakMap(), w = new WeakMap(), n = new WeakMap(), m = new WeakMap(), h = new WeakMap(), d = new WeakMap(), k = new WeakMap(), M = new WeakMap(), _ = new WeakMap(), A = new WeakMap();
427
+ window.customElements.get("ea-sub-menu") || window.customElements.define("ea-sub-menu", j);
412
428
  export {
413
- z as EaMenu,
414
- D as EaMenuItem,
415
- G as EaMenuItemGroup,
416
- V as EaSubMenu
429
+ D as EaMenu,
430
+ G as EaMenuItem,
431
+ V as EaMenuItemGroup,
432
+ j as EaSubMenu
417
433
  };