easy-component-ui 3.0.12 → 3.0.13

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 (61) hide show
  1. package/README.md +162 -162
  2. package/dist/assets/icon.css +1 -1
  3. package/dist/components/Base.js +3 -2
  4. package/dist/components/ea-alert.js +71 -54
  5. package/dist/components/ea-avatar.js +42 -37
  6. package/dist/components/ea-button.js +53 -52
  7. package/dist/components/ea-calendar2.js +329 -327
  8. package/dist/components/ea-card.js +63 -27
  9. package/dist/components/ea-carousel.js +2 -2
  10. package/dist/components/ea-collapse.js +28 -28
  11. package/dist/components/ea-color-picker.js +63 -66
  12. package/dist/components/ea-container.js +90 -61
  13. package/dist/components/ea-date-picker.js +1 -1
  14. package/dist/components/ea-dialog.js +4 -4
  15. package/dist/components/ea-drawer.js +51 -46
  16. package/dist/components/ea-icon.js +122 -32
  17. package/dist/components/ea-image-preview.js +237 -193
  18. package/dist/components/ea-image.js +69 -44
  19. package/dist/components/ea-input-number.js +9 -9
  20. package/dist/components/ea-input.js +15 -15
  21. package/dist/components/ea-layout.js +10 -3
  22. package/dist/components/ea-link.js +1 -1
  23. package/dist/components/ea-menu.js +1 -1
  24. package/dist/components/ea-message-box.js +73 -73
  25. package/dist/components/ea-message.js +184 -121
  26. package/dist/components/ea-notification.js +80 -80
  27. package/dist/components/ea-overlay.js +20 -19
  28. package/dist/components/ea-page-header.js +5 -5
  29. package/dist/components/ea-pagination.js +5 -5
  30. package/dist/components/ea-popconfirm.js +3 -3
  31. package/dist/components/ea-popover.js +35 -11
  32. package/dist/components/ea-progress.js +28 -28
  33. package/dist/components/ea-rate.js +1 -1
  34. package/dist/components/ea-result.js +13 -13
  35. package/dist/components/ea-select.js +12 -12
  36. package/dist/components/ea-slider.js +88 -79
  37. package/dist/components/ea-splitter.js +34 -18
  38. package/dist/components/ea-steps.js +33 -33
  39. package/dist/components/ea-table.js +332 -321
  40. package/dist/components/ea-tabs.js +28 -28
  41. package/dist/components/ea-tag.js +6 -6
  42. package/dist/components/ea-time-picker.js +2 -6
  43. package/dist/components/ea-timeline.js +1 -1
  44. package/dist/components/ea-tooltip.js +63 -23
  45. package/dist/components/ea-tour.js +21 -21
  46. package/dist/components/ea-transfer.js +2 -2
  47. package/dist/components/ea-tree.js +1 -1
  48. package/dist/components/index.js +0 -1
  49. package/dist/css/ea-card.style.js +2 -2
  50. package/dist/css/ea-container.style.js +1 -1
  51. package/dist/css/ea-footer.style.js +1 -1
  52. package/dist/css/ea-progress.style.js +1 -1
  53. package/dist/css/ea-step.style.js +1 -1
  54. package/dist/css/ea-switch.style.js +1 -1
  55. package/dist/css/ea-tab.style.js +1 -1
  56. package/dist/css/ea-tabs.style.js +1 -1
  57. package/dist/css/ea-tag.style.js +1 -1
  58. package/dist/css/ea-time-picker.style.js +1 -1
  59. package/dist/utils/Variables.js +10 -10
  60. package/package.json +302 -304
  61. package/dist/components/ea-loading.js +0 -151
@@ -850,7 +850,7 @@ class Cn extends HTMLElement {
850
850
  }
851
851
  getAttrString(e, i) {
852
852
  const s = this.getAttribute(e);
853
- return s || i || "";
853
+ return !s || s === "null" ? i || "" : s;
854
854
  }
855
855
  getAttrDate(e, i) {
856
856
  let s = this.getAttrNumber(e);
@@ -869,5 +869,6 @@ class Cn extends HTMLElement {
869
869
  }
870
870
  B = new WeakMap();
871
871
  export {
872
- Cn as B
872
+ Cn as B,
873
+ Rn as h
873
874
  };
@@ -3,56 +3,58 @@ var y = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
5
  var C = (t, s, e) => s in t ? w(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
6
- var m = (t, s, e) => C(t, typeof s != "symbol" ? s + "" : s, e), _ = (t, s, e) => s.has(t) || y("Cannot " + e);
7
- var o = (t, s, e) => (_(t, s, "read from private field"), e ? e.call(t) : s.get(t)), i = (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, c) => (_(t, s, "write to private field"), c ? c.call(t, e) : s.set(t, e), e);
6
+ var _ = (t, s, e) => C(t, typeof s != "symbol" ? s + "" : s, e), v = (t, s, e) => s.has(t) || y("Cannot " + e);
7
+ var a = (t, s, e) => (v(t, s, "read from private field"), e ? e.call(t) : s.get(t)), i = (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, c) => (v(t, s, "write to private field"), c ? c.call(t, e) : s.set(t, e), e);
8
8
  import { B as g } from "./Base.js";
9
- import { s as S } from "../css/ea-alert.style.js";
9
+ import { s as x } from "../css/ea-alert.style.js";
10
10
  import { t as b } from "../utils/timeout.js";
11
- var a, h, f, p, d, l, n, u;
11
+ var l, d, u, m, p, f, n, o, h;
12
12
  class L extends g {
13
13
  constructor() {
14
14
  super();
15
15
  /** @type {HTMLElement} */
16
- i(this, a);
16
+ i(this, l);
17
17
  /** @type {HTMLElement} */
18
- i(this, h);
18
+ i(this, d);
19
19
  /** @type {HTMLElement} */
20
- i(this, f);
20
+ i(this, u);
21
+ /** @type {HTMLSlotElement} */
22
+ i(this, m);
21
23
  /** @type {HTMLElement} */
22
24
  i(this, p);
23
25
  /** @type {HTMLElement} */
24
- i(this, d);
26
+ i(this, f);
25
27
  /** @type {HTMLElement} */
26
- i(this, l);
27
- /** @type {AbortController} */
28
28
  i(this, n);
29
- m(this, "state", this.properties({
29
+ /** @type {AbortController} */
30
+ i(this, o);
31
+ _(this, "state", this.properties({
30
32
  title: {
31
33
  type: String,
32
34
  default: "",
33
35
  observer: (e) => {
34
- o(this, p).innerHTML = e || '<slot name="title"></slot>';
36
+ a(this, p).innerHTML = e;
35
37
  }
36
38
  },
37
39
  description: {
38
40
  type: String,
39
41
  default: "",
40
42
  observer: (e) => {
41
- o(this, d).innerHTML = e || "<slot></slot>";
43
+ a(this, f).innerHTML = e || "<slot></slot>";
42
44
  }
43
45
  },
44
46
  type: {
45
47
  type: ["primary", "info", "success", "warning", "error"],
46
48
  default: "info",
47
49
  observer: (e) => {
48
- o(this, a).className = this.updateContainerClasslist();
50
+ this.updateContainerClasslist();
49
51
  }
50
52
  },
51
53
  effect: {
52
54
  type: ["light", "dark"],
53
55
  default: "light",
54
56
  observer: (e) => {
55
- o(this, a).className = this.updateContainerClasslist();
57
+ this.updateContainerClasslist();
56
58
  }
57
59
  },
58
60
  "close-text": {
@@ -60,7 +62,7 @@ class L extends g {
60
62
  default: "",
61
63
  observer: (e) => {
62
64
  try {
63
- o(this, l).textContent = e;
65
+ a(this, n).textContent = e;
64
66
  } catch {
65
67
  }
66
68
  }
@@ -69,36 +71,39 @@ class L extends g {
69
71
  type: Boolean,
70
72
  default: !0,
71
73
  observer: (e) => {
72
- o(this, l).innerHTML = e ? this["close-text"] ? this["close-text"] : '<ea-icon class="ea-alert__close-icon" icon="icon-cancel" part="close-icon"></ea-icon>' : "";
74
+ var c;
75
+ (c = a(this, o)) == null || c.abort(), a(this, n).innerHTML = e ? this["close-text"] ? this["close-text"] : '<ea-icon class="ea-alert__close-icon" name="xmark" part="close-icon"></ea-icon>' : "", e && (r(this, o, new AbortController()), a(this, n).addEventListener("click", a(this, h), {
76
+ signal: a(this, o).signal
77
+ }));
73
78
  }
74
79
  },
75
80
  "show-icon": {
76
81
  type: Boolean,
77
82
  default: !1,
78
- observer: (e) => {
79
- const c = {
80
- primary: "info",
81
- success: "ok-circled",
82
- info: "info",
83
- warning: "attention-alt",
84
- error: "cancel-circled"
85
- }, v = this.querySelector("[slot=icon]");
86
- o(this, h).innerHTML = e && !v ? `<ea-icon class="ea-alert__icon" icon="icon-${c[this.type]}" part="icon"></ea-icon>` : '<slot name="icon"></slot>';
83
+ observer: () => {
84
+ const e = {
85
+ primary: "circle-info",
86
+ success: "circle-check",
87
+ info: "circle-info",
88
+ warning: "triangle-exclamation",
89
+ error: "circle-xmark"
90
+ };
91
+ a(this, d).innerHTML = `<ea-icon class="ea-alert__icon" name="${e[this.type]}" part="icon"></ea-icon>`;
87
92
  }
88
93
  },
89
94
  center: {
90
95
  type: Boolean,
91
96
  default: !1,
92
97
  observer: () => {
93
- o(this, a).className = this.updateContainerClasslist();
98
+ this.updateContainerClasslist();
94
99
  }
95
100
  },
96
101
  "show-after": {
97
102
  type: Number,
98
103
  default: 0,
99
104
  observer: (e) => {
100
- e = Math.abs(e), o(this, a).classList.toggle("ea-alert--hide", e > 0), b(() => {
101
- this.emit("open"), o(this, a).classList.remove("ea-alert--hide");
105
+ e = Math.abs(e), a(this, l).classList.toggle("ea-alert--hide", e > 0), b(() => {
106
+ this.emit("open"), a(this, l).classList.remove("ea-alert--hide");
102
107
  }, e);
103
108
  }
104
109
  },
@@ -112,26 +117,29 @@ class L extends g {
112
117
  type: Number,
113
118
  default: 0,
114
119
  observer: (e) => {
115
- e && this.isMounted && b(() => o(this, u).call(this), this["auto-close"]);
120
+ e && this.isMounted && b(() => a(this, h).call(this), this["auto-close"]);
116
121
  }
117
122
  }
118
123
  }));
119
- i(this, u, (e) => {
124
+ /**
125
+ * 关闭事件
126
+ */
127
+ i(this, h, () => {
120
128
  b(() => {
121
- o(this, n).abort(), o(this, a).classList.add("ea-alert--before-close"), o(this, a).addEventListener(
122
- "transitionend",
123
- () => {
124
- this.emit("close", {
125
- detail: {
126
- visible: !1
127
- }
128
- }), this.remove();
129
- },
130
- { once: !0 }
131
- );
129
+ a(this, l).classList.add("ea-alert--before-close");
130
+ const e = () => {
131
+ this.emit("close", {
132
+ detail: {
133
+ visible: !1
134
+ }
135
+ }), this.remove();
136
+ };
137
+ a(this, l).addEventListener("transitionend", e, {
138
+ once: !0
139
+ });
132
140
  }, this["hide-after"]);
133
141
  });
134
- this.$render(), this.stylesheet = S;
142
+ this.$render(), this.stylesheet = x;
135
143
  }
136
144
  static get observedAttributes() {
137
145
  return [
@@ -154,11 +162,12 @@ class L extends g {
154
162
  * @return {string} 属性值
155
163
  */
156
164
  updateContainerClasslist() {
157
- return this.computedClasslist("ea-alert", {
165
+ const e = this.computedClasslist("ea-alert", {
158
166
  ["--" + this.type]: this.type,
159
167
  ["--" + this.effect]: this.effect,
160
168
  "--center": this.center
161
169
  });
170
+ return a(this, l).className = e, e;
162
171
  }
163
172
  $render() {
164
173
  this.shadowRoot.innerHTML = `
@@ -167,29 +176,37 @@ class L extends g {
167
176
  <slot name='icon'></slot>
168
177
  </span>
169
178
  <div class="ea-alert__content" part='content-wrap'>
170
- <span class="ea-alert__title" part='title'></span>
179
+ <span class="ea-alert__title" part='title'>
180
+ <slot name="title"></slot>
181
+ </span>
171
182
  <p class="ea-alert__description" part='description'>
172
183
  <slot></slot>
173
184
  </p>
174
185
  <span class="ea-alert__close-btn" part="close-btn">
175
- ${this.closable ? this["close-text"] ? this["close-text"] : '<ea-icon class="ea-alert__close-icon" icon="icon-cancel" part="close-icon"></ea-icon>' : ""}
186
+ ${this.closable ? this["close-text"] ? this["close-text"] : '<ea-icon class="ea-alert__close-icon" name="xmark" part="close-icon"></ea-icon>' : ""}
176
187
  </span>
177
188
  </div>
178
189
  </div>
179
- `, r(this, a, this.shadowRoot.querySelector(".ea-alert")), r(this, h, this.shadowRoot.querySelector(".ea-alert__icon-wrap")), r(this, f, this.shadowRoot.querySelector(".ea-alert__content")), r(this, p, this.shadowRoot.querySelector(".ea-alert__title")), r(this, d, this.shadowRoot.querySelector(
180
- ".ea-alert__description"
181
- )), r(this, l, this.shadowRoot.querySelector(".ea-alert__close-btn"));
190
+ `, r(this, l, this.shadowRoot.querySelector(".ea-alert")), r(this, d, this.shadowRoot.querySelector(
191
+ ".ea-alert__icon-wrap slot[name=icon]"
192
+ )), r(this, u, this.shadowRoot.querySelector(".ea-alert__content")), r(this, p, this.shadowRoot.querySelector(
193
+ ".ea-alert__title slot[name=title]"
194
+ )), r(this, f, this.shadowRoot.querySelector(
195
+ ".ea-alert__description slot"
196
+ )), r(this, n, this.shadowRoot.querySelector(".ea-alert__close-btn"));
182
197
  }
183
198
  connectedCallback() {
184
- super.connectedCallback(), r(this, n, new AbortController()), this.closable && o(this, l).addEventListener("click", o(this, u), {
185
- signal: o(this, n).signal
186
- });
199
+ var e;
200
+ super.connectedCallback(), (e = a(this, o)) == null || e.abort(), this.closable && (r(this, o, new AbortController()), a(this, n).addEventListener("click", a(this, h), {
201
+ signal: a(this, o).signal
202
+ }));
187
203
  }
188
204
  $beforeUnmounted() {
189
- o(this, n).abort();
205
+ var e;
206
+ (e = a(this, o)) == null || e.abort();
190
207
  }
191
208
  }
192
- a = new WeakMap(), h = new WeakMap(), f = new WeakMap(), p = new WeakMap(), d = new WeakMap(), l = new WeakMap(), n = new WeakMap(), u = new WeakMap();
209
+ l = new WeakMap(), d = new WeakMap(), u = new WeakMap(), m = new WeakMap(), p = new WeakMap(), f = new WeakMap(), n = new WeakMap(), o = new WeakMap(), h = new WeakMap();
193
210
  window.customElements.get("ea-alert") || window.customElements.define("ea-alert", L);
194
211
  export {
195
212
  L as EaAlert
@@ -1,14 +1,14 @@
1
- var u = Object.defineProperty;
1
+ var m = Object.defineProperty;
2
2
  var v = (e) => {
3
3
  throw TypeError(e);
4
4
  };
5
- var g = (e, a, t) => a in e ? u(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t;
6
- var f = (e, a, t) => g(e, typeof a != "symbol" ? a + "" : a, t), p = (e, a, t) => a.has(e) || v("Cannot " + t);
7
- var r = (e, a, t) => (p(e, a, "read from private field"), t ? t.call(e) : a.get(e)), n = (e, a, t) => a.has(e) ? v("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(e) : a.set(e, t), h = (e, a, t, s) => (p(e, a, "write to private field"), s ? s.call(e, t) : a.set(e, t), t);
8
- import { B as m } from "./Base.js";
9
- import { E as w } from "../utils/Utils.js";
10
- import { s as y } from "../css/ea-avatar.style.js";
11
- const b = `
5
+ var g = (e, s, t) => s in e ? m(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), p = (e, s, t) => s.has(e) || v("Cannot " + t);
7
+ var r = (e, s, t) => (p(e, s, "read from private field"), t ? t.call(e) : s.get(e)), n = (e, s, t) => s.has(e) ? v("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), h = (e, s, t, a) => (p(e, s, "write to private field"), a ? a.call(e, t) : s.set(e, t), t);
8
+ import { B as y } from "./Base.js";
9
+ import { E as b } from "../utils/Utils.js";
10
+ import { s as w } from "../css/ea-avatar.style.js";
11
+ const u = `
12
12
  <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
13
13
  <defs>
14
14
  <clipPath id="a">
@@ -28,44 +28,44 @@ const b = `
28
28
  <path d="M55 45L40 70h5 30z" fill="#c0c4cc" />
29
29
  </svg>
30
30
  `;
31
- var i, l;
32
- class C extends m {
31
+ var o, i;
32
+ class C extends y {
33
33
  constructor() {
34
34
  super();
35
35
  /** @type {HTMLElement} */
36
- n(this, i);
36
+ n(this, o);
37
37
  /** @type {AbortController} */
38
- n(this, l);
38
+ n(this, i);
39
39
  f(this, "state", this.properties({
40
40
  icon: {
41
41
  type: String,
42
42
  default: "",
43
43
  observer: (t) => {
44
- r(this, i).innerHTML = `<ea-icon class="ea-avatar__icon" icon="${t}" part="icon-avatar"></ea-icon>`;
44
+ t ? r(this, o).innerHTML = `<ea-icon class="ea-avatar__icon" name="${t}" part="icon-avatar"></ea-icon>` : r(this, o).innerHTML = `<slot>${u}</slot>`;
45
45
  }
46
46
  },
47
47
  shape: {
48
48
  type: ["circle", "square"],
49
49
  default: "circle",
50
50
  observer: () => {
51
- r(this, i).className = this.updateContainerClasslist();
51
+ this.updateContainerClasslist();
52
52
  }
53
53
  },
54
54
  size: {
55
55
  type: String,
56
56
  default: "default",
57
57
  observer: (t) => {
58
- const s = w.Enum.hasEnum(
58
+ const a = b.Enum.hasEnum(
59
59
  ["default", "small", "large"],
60
60
  t
61
61
  ), c = CSS.supports("width", t);
62
- if (!s && !c)
62
+ if (!a && !c)
63
63
  return this.size = "default", console.warn(
64
64
  "[ea-avatar] Please set size to one of [default, small, large] or a valid CSS width value"
65
65
  );
66
66
  this.style.setProperty(
67
67
  "--ea-avatar-size",
68
- s ? `var(--ea-avatar-size-${t})` : t
68
+ a ? `var(--ea-avatar-size-${t})` : t
69
69
  );
70
70
  }
71
71
  },
@@ -74,23 +74,23 @@ class C extends m {
74
74
  default: "",
75
75
  observer: (t) => {
76
76
  var c;
77
- (c = r(this, l)) == null || c.abort(), h(this, l, new AbortController());
78
- const s = new Image();
79
- s.src = t, s.addEventListener(
77
+ (c = r(this, i)) == null || c.abort(), h(this, i, new AbortController());
78
+ const a = new Image();
79
+ a.src = t, a.addEventListener(
80
80
  "load",
81
81
  () => {
82
- var o;
83
- r(this, i).innerHTML = `<img class="ea-avatar__img" src="${t}" alt="${this.alt}" srcset="${this["src-set"]}" part="img-avatar" />`, (o = r(this, l)) == null || o.abort();
82
+ var l;
83
+ r(this, o).innerHTML = `<img class="ea-avatar__img" src="${t}" alt="${this.alt}" srcset="${this["src-set"]}" part="img-avatar" />`, (l = r(this, i)) == null || l.abort();
84
84
  },
85
- { signal: r(this, l).signal }
86
- ), s.addEventListener(
85
+ { signal: r(this, i).signal }
86
+ ), a.addEventListener(
87
87
  "error",
88
88
  () => {
89
89
  var d;
90
- const o = r(this, i).querySelector("slot");
91
- o && (o.innerHTML = S), this.emit("error"), (d = r(this, l)) == null || d.abort();
90
+ const l = r(this, o).querySelector("slot");
91
+ l && (l.innerHTML = S), this.emit("error"), (d = r(this, i)) == null || d.abort();
92
92
  },
93
- { signal: r(this, l).signal }
93
+ { signal: r(this, i).signal }
94
94
  );
95
95
  }
96
96
  },
@@ -98,16 +98,16 @@ class C extends m {
98
98
  type: String,
99
99
  default: "",
100
100
  observer: (t) => {
101
- const s = this.shadowRoot.querySelector(".ea-avatar__img");
102
- s && (s.srcset = t);
101
+ const a = this.shadowRoot.querySelector(".ea-avatar__img");
102
+ a && (a.srcset = t);
103
103
  }
104
104
  },
105
105
  alt: {
106
106
  type: String,
107
107
  default: "",
108
108
  observer: (t) => {
109
- const s = this.shadowRoot.querySelector(".ea-avatar__img");
110
- s && (s.alt = t);
109
+ const a = this.shadowRoot.querySelector(".ea-avatar__img");
110
+ a && (a.alt = t);
111
111
  }
112
112
  },
113
113
  fit: {
@@ -118,7 +118,7 @@ class C extends m {
118
118
  }
119
119
  }
120
120
  }));
121
- this.stylesheet = y, this.$render();
121
+ this.stylesheet = w, this.$render();
122
122
  }
123
123
  static get observedAttributes() {
124
124
  return [
@@ -137,22 +137,27 @@ class C extends m {
137
137
  * @return {string} 属性值
138
138
  */
139
139
  updateContainerClasslist() {
140
- return this.computedClasslist("ea-avatar", {
140
+ const t = this.computedClasslist("ea-avatar", {
141
141
  ["--" + this.shape]: this.shape
142
142
  });
143
+ return r(this, o).className = t, t;
143
144
  }
144
145
  $render() {
145
146
  this.shadowRoot.innerHTML = `
146
147
  <div class="ea-avatar" part='container'>
147
- <slot>${b}</slot>
148
+ <slot>${u}</slot>
148
149
  </div>
149
- `, h(this, i, this.shadowRoot.querySelector(".ea-avatar"));
150
+ `, h(this, o, this.shadowRoot.querySelector(".ea-avatar")), this.updateContainerClasslist();
150
151
  }
151
152
  connectedCallback() {
152
- super.connectedCallback(), r(this, i).className = this.updateContainerClasslist();
153
+ super.connectedCallback();
154
+ }
155
+ $beforeUnmounted() {
156
+ var t;
157
+ (t = r(this, i)) == null || t.abort();
153
158
  }
154
159
  }
155
- i = new WeakMap(), l = new WeakMap();
160
+ o = new WeakMap(), i = new WeakMap();
156
161
  window.customElements.get("ea-avatar") || window.customElements.define("ea-avatar", C);
157
162
  export {
158
163
  C as EaAvatar