easy-component-ui 3.0.11 → 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 (78) hide show
  1. package/README.md +162 -162
  2. package/dist/assets/icon.css +1 -1
  3. package/dist/components/Base.js +190 -188
  4. package/dist/components/ea-alert.js +71 -54
  5. package/dist/components/ea-avatar.js +42 -37
  6. package/dist/components/ea-breadcrumb.js +33 -33
  7. package/dist/components/ea-button.js +53 -52
  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 +93 -73
  11. package/dist/components/ea-color-picker.js +221 -221
  12. package/dist/components/ea-container.js +90 -61
  13. package/dist/components/ea-countdown.js +77 -56
  14. package/dist/components/ea-date-picker.js +1 -1
  15. package/dist/components/ea-descriptions.js +133 -70
  16. package/dist/components/ea-dialog.js +4 -4
  17. package/dist/components/ea-drawer.js +93 -71
  18. package/dist/components/ea-empty.js +31 -23
  19. package/dist/components/ea-icon.js +122 -32
  20. package/dist/components/ea-image-preview.js +237 -193
  21. package/dist/components/ea-image.js +69 -44
  22. package/dist/components/ea-input-number.js +9 -9
  23. package/dist/components/ea-input.js +15 -15
  24. package/dist/components/ea-layout.js +10 -3
  25. package/dist/components/ea-link.js +1 -1
  26. package/dist/components/ea-menu.js +69 -53
  27. package/dist/components/ea-message-box.js +73 -73
  28. package/dist/components/ea-message.js +184 -121
  29. package/dist/components/ea-notification.js +80 -80
  30. package/dist/components/ea-overlay.js +41 -34
  31. package/dist/components/ea-page-header.js +5 -5
  32. package/dist/components/ea-pagination.js +6 -5
  33. package/dist/components/ea-popconfirm.js +133 -78
  34. package/dist/components/ea-popover.js +35 -11
  35. package/dist/components/ea-popper.js +9 -9
  36. package/dist/components/ea-progress.js +88 -71
  37. package/dist/components/ea-rate.js +1 -1
  38. package/dist/components/ea-result.js +20 -20
  39. package/dist/components/ea-select.js +119 -108
  40. package/dist/components/ea-skeleton.js +99 -82
  41. package/dist/components/ea-slider.js +88 -79
  42. package/dist/components/ea-splitter.js +34 -18
  43. package/dist/components/ea-statistic.js +72 -4
  44. package/dist/components/ea-steps.js +108 -74
  45. package/dist/components/ea-table.js +562 -434
  46. package/dist/components/ea-tabs.js +28 -28
  47. package/dist/components/ea-tag.js +37 -43
  48. package/dist/components/ea-time-picker.js +2 -6
  49. package/dist/components/ea-timeline.js +11 -12
  50. package/dist/components/ea-tooltip.js +63 -23
  51. package/dist/components/ea-tour.js +21 -21
  52. package/dist/components/ea-transfer.js +2 -2
  53. package/dist/components/ea-tree.js +1 -1
  54. package/dist/components/index.js +1 -2
  55. package/dist/css/ea-card.style.js +2 -2
  56. package/dist/css/ea-collapse-item.style.js +1 -1
  57. package/dist/css/ea-color-picker-panel.style.js +1 -1
  58. package/dist/css/ea-container.style.js +1 -1
  59. package/dist/css/ea-descriptions-item.style.js +2 -2
  60. package/dist/css/ea-descriptions.style.js +1 -1
  61. package/dist/css/ea-empty.style.js +1 -1
  62. package/dist/css/ea-footer.style.js +1 -1
  63. package/dist/css/ea-progress.style.js +1 -1
  64. package/dist/css/ea-skeleton.style.js +1 -1
  65. package/dist/css/ea-step.style.js +1 -1
  66. package/dist/css/ea-switch.style.js +1 -1
  67. package/dist/css/ea-tab.style.js +1 -1
  68. package/dist/css/ea-table-column.style.js +4 -0
  69. package/dist/css/ea-table.style.js +1 -1
  70. package/dist/css/ea-tabs.style.js +1 -1
  71. package/dist/css/ea-tag.style.js +1 -1
  72. package/dist/css/ea-time-picker.style.js +1 -1
  73. package/dist/css/ea-timeline-item.style.js +1 -1
  74. package/dist/utils/Variables.js +10 -17
  75. package/dist/utils/parseTime.js +73 -0
  76. package/package.json +302 -304
  77. package/dist/components/ea-loading.js +0 -151
  78. package/dist/components/ea-statistic2.js +0 -83
@@ -1,80 +1,91 @@
1
- var R = Object.defineProperty;
2
- var T = (t) => {
3
- throw TypeError(t);
1
+ var U = Object.defineProperty;
2
+ var $ = (i) => {
3
+ throw TypeError(i);
4
4
  };
5
- var q = (t, s, e) => s in t ? R(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
6
- var S = (t, s, e) => q(t, typeof s != "symbol" ? s + "" : s, e), _ = (t, s, e) => s.has(t) || T("Cannot " + e);
7
- var i = (t, s, e) => (_(t, s, "read from private field"), e ? e.call(t) : s.get(t)), n = (t, s, e) => s.has(t) ? T("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), d = (t, s, e, a) => (_(t, s, "write to private field"), a ? a.call(t, e) : s.set(t, e), e);
8
- import { B as U } from "./Base.js";
9
- import { s as $ } from "../css/ea-message.style.js";
10
- import { t as B } from "../utils/timeout.js";
11
- var o, u, m, y, r, f, l, b, w;
12
- class N extends U {
5
+ var k = (i, t, e) => t in i ? U(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
6
+ var T = (i, t, e) => k(i, typeof t != "symbol" ? t + "" : t, e), R = (i, t, e) => t.has(i) || $("Cannot " + e);
7
+ var s = (i, t, e) => (R(i, t, "read from private field"), e ? e.call(i) : t.get(i)), o = (i, t, e) => t.has(i) ? $("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), h = (i, t, e, n) => (R(i, t, "write to private field"), n ? n.call(i, e) : t.set(i, e), e);
8
+ import { n as A } from "./ea-calendar2.js";
9
+ import { B, h as P } from "./Base.js";
10
+ import { s as I } from "../css/ea-message.style.js";
11
+ import { t as N } from "../utils/timeout.js";
12
+ var r, u, m, f, d, a, b, l, C, w, v;
13
+ class j extends B {
13
14
  constructor() {
14
15
  super();
15
16
  /** @type {HTMLElement} */
16
- n(this, o);
17
+ o(this, r);
17
18
  /** @type {HTMLElement} */
18
- n(this, u);
19
+ o(this, u);
19
20
  /** @type {HTMLElement} */
20
- n(this, m);
21
+ o(this, m);
21
22
  /** @type {HTMLElement} */
22
- n(this, y);
23
+ o(this, f);
23
24
  /** @type {AbortController} */
24
- n(this, r);
25
- n(this, f, {
25
+ o(this, d);
26
+ /** @type {AbortController} */
27
+ o(this, a);
28
+ o(this, b, {
26
29
  dangerouslyUseHTMLString: !1
27
30
  });
28
- S(this, "state", this.properties({
31
+ T(this, "state", this.properties({
29
32
  type: {
33
+ props: !0,
30
34
  type: ["primary", "success", "warning", "info", "error"],
31
35
  default: "info",
32
36
  observer: (e) => {
33
- const a = {
34
- success: "icon-ok-circled",
35
- error: "icon-cancel-circled",
36
- warning: "icon-attention-alt",
37
- info: "icon-info",
38
- primary: "icon-info"
37
+ const n = {
38
+ success: "circle-check",
39
+ error: "circle-xmark",
40
+ warning: "triangle-exclamation",
41
+ info: "circle-info",
42
+ primary: "circle-info"
39
43
  };
40
- i(this, u).icon = a[e], i(this, o).className = this.updateContainerClasslist();
44
+ s(this, u).name = n[e], this.updateContainerClasslist();
41
45
  }
42
46
  },
43
47
  visible: {
48
+ props: !0,
44
49
  type: Boolean,
45
50
  default: !1,
46
51
  observer: async (e) => {
47
- var a;
48
- (a = i(this, r)) == null || a.abort(), d(this, r, new AbortController()), e ? (i(this, b).call(this), i(this, o).className = this.updateContainerClasslist(), i(this, l).call(this, "show"), i(this, o).offsetWidth, i(this, o).classList.add("ea-message--is-show"), i(this, o).addEventListener(
52
+ var n;
53
+ (n = s(this, a)) == null || n.abort(), h(this, a, new AbortController()), e ? (s(this, w).call(this), this.updateContainerClasslist(), s(this, l).call(this, "show"), s(this, r).offsetWidth, s(this, r).classList.add(this.ns.m("is-show")), s(this, r).addEventListener(
49
54
  "transitionend",
50
55
  () => {
51
- i(this, l).call(this, "shown");
56
+ s(this, l).call(this, "shown");
52
57
  },
53
- { once: !0, signal: i(this, r).signal }
54
- )) : (i(this, w).call(this), i(this, o).classList.add("ea-message--before-hide"), i(this, l).call(this, "hide"), i(this, o).addEventListener(
58
+ { once: !0, signal: s(this, a).signal }
59
+ )) : (s(this, v).call(this), s(this, r).classList.add(this.ns.m("before-hide")), s(this, l).call(this, "hide"), s(this, r).addEventListener(
55
60
  "transitionend",
56
61
  () => {
57
- i(this, o).className = this.updateContainerClasslist(), i(this, l).call(this, "hidden");
62
+ this.updateContainerClasslist(), s(this, l).call(this, "hidden");
58
63
  },
59
- { once: !0, signal: i(this, r).signal }
64
+ { once: !0, signal: s(this, a).signal }
60
65
  ));
61
66
  }
62
67
  },
63
68
  message: {
69
+ props: !0,
64
70
  type: String,
65
71
  default: "",
66
72
  observer: (e) => {
67
- this.dangerouslyUseHTMLString ? i(this, m).innerHTML = e : i(this, m).innerText = e;
73
+ this.dangerouslyUseHTMLString ? s(this, m).innerHTML = e : s(this, m).innerText = e;
68
74
  }
69
75
  },
70
76
  showClose: {
77
+ props: !0,
71
78
  type: Boolean,
72
79
  default: !1,
73
- observer: () => {
74
- i(this, o).className = this.updateContainerClasslist();
80
+ observer: (e) => {
81
+ var n;
82
+ this.updateContainerClasslist(), (n = s(this, d)) == null || n.abort(), e && (h(this, d, new AbortController()), s(this, f).addEventListener("click", s(this, C), {
83
+ signal: s(this, d).signal
84
+ }));
75
85
  }
76
86
  },
77
87
  placement: {
88
+ props: !0,
78
89
  type: [
79
90
  "top",
80
91
  "top-left",
@@ -86,166 +97,218 @@ class N extends U {
86
97
  ],
87
98
  default: "top",
88
99
  observer: () => {
89
- this.className = this.updateContainerClasslist();
100
+ this.updateContainerClasslist();
101
+ }
102
+ },
103
+ icon: {
104
+ props: !0,
105
+ type: String,
106
+ default: "",
107
+ observer: (e) => {
108
+ s(this, u).name = e, this.updateContainerClasslist();
90
109
  }
91
110
  }
92
111
  }));
93
- n(this, l, (e, a) => {
112
+ /**
113
+ * 触发冒泡事件
114
+ * @param {string} customEventName - 自定义事件名称
115
+ * @param {string} detail - 事件详情
116
+ */
117
+ o(this, l, (e, n) => {
94
118
  this.emit(e, {
95
- detail: a,
119
+ detail: n,
96
120
  bubbles: !0,
97
121
  composed: !0
98
122
  });
99
123
  });
100
- S(this, "close", () => {
101
- this.visible = !1, i(this, l).call(this, "close");
124
+ /**
125
+ * 关闭消息(公共方法)
126
+ */
127
+ T(this, "close", () => {
128
+ this.visible = !1, s(this, l).call(this, "close");
102
129
  });
103
- n(this, b, () => {
130
+ /**
131
+ * 关闭按钮点击事件处理
132
+ */
133
+ o(this, C, () => {
134
+ this.close();
135
+ });
136
+ /**
137
+ * 初始化消息位置
138
+ */
139
+ o(this, w, () => {
104
140
  const e = document.querySelectorAll(
105
141
  `ea-message[placement="${this.placement}"]`
106
142
  );
107
143
  if (e.length <= 1) return;
108
- const a = e[e.length - 2], c = a.style.getPropertyValue("--ea-message-y"), h = a.shadowRoot.querySelector(".ea-message").getBoundingClientRect();
144
+ const n = e[e.length - 2], c = n.style.getPropertyValue("--ea-message-y"), p = n.shadowRoot.querySelector(this.ns.cb()).getBoundingClientRect();
109
145
  this.style.setProperty(
110
146
  "--ea-message-y",
111
- `${Number(c.replace("px", "")) + h.height + 8}px`
147
+ `${Number(c.replace("px", "")) + p.height + 8}px`
112
148
  );
113
149
  });
114
- n(this, w, () => {
150
+ /**
151
+ * 隐藏消息
152
+ */
153
+ o(this, v, () => {
115
154
  const e = [
116
155
  ...document.querySelectorAll(`ea-message[placement="${this.placement}"]`)
117
- ], a = e.findIndex((h) => h === this), c = e.slice(a + 1), H = i(this, o).getBoundingClientRect().height;
118
- c.forEach((h, A) => {
119
- const x = Number(
120
- h.style.getPropertyValue("--ea-message-y").replace("px", "")
156
+ ], n = e.findIndex((p) => p === this), c = e.slice(n + 1), x = s(this, r).getBoundingClientRect().height;
157
+ c.forEach((p) => {
158
+ const q = Number(
159
+ p.style.getPropertyValue("--ea-message-y").replace("px", "")
121
160
  );
122
- h.style.setProperty("--ea-message-y", `${x - H - 8}px`);
161
+ p.style.setProperty("--ea-message-y", `${q - x - 8}px`);
123
162
  });
124
163
  });
125
- this.stylesheet = $, this.$render();
164
+ this.stylesheet = I, this.$render();
126
165
  }
127
166
  // ------- dangerouslyUseHTMLString -------
128
167
  // #region
129
168
  get dangerouslyUseHTMLString() {
130
- return i(this, f).dangerouslyUseHTMLString;
169
+ return s(this, b).dangerouslyUseHTMLString;
131
170
  }
132
171
  set dangerouslyUseHTMLString(e) {
133
- i(this, f).dangerouslyUseHTMLString = e;
172
+ s(this, b).dangerouslyUseHTMLString = e;
134
173
  }
135
174
  // #endregion
136
175
  // ------- end -------
137
176
  static get observedAttributes() {
138
- return [
139
- ...super.observedAttributes,
140
- "type",
141
- "visible",
142
- "message",
143
- "showClose",
144
- "placement"
145
- ];
177
+ return [...super.observedAttributes, "placement"];
146
178
  }
147
179
  /**
148
180
  * 获取 classlist 列表
149
181
  * @return {string} 属性值
150
182
  */
151
183
  updateContainerClasslist() {
152
- return this.computedClasslist("ea-message", {
153
- "--visible": this.visible,
154
- ["--" + this.type]: this.type,
155
- "--show-close": this.showClose,
156
- ["--" + this.placement]: this.placement
157
- });
184
+ const e = this.computedClasslist(
185
+ this.ns.b(),
186
+ {
187
+ ["--" + this.type]: this.type,
188
+ ["--" + this.placement]: this.placement,
189
+ "--visible": this.visible,
190
+ "--show-close": this.showClose
191
+ },
192
+ {}
193
+ );
194
+ return s(this, r) && (s(this, r).className = e), e;
158
195
  }
159
196
  $render() {
160
- this.shadowRoot.innerHTML = `
161
- <div class="ea-message" part="container">
162
- <ea-icon class="ea-message__icon" part="icon"></ea-icon>
163
- <div class="ea-message__content" part="content-wrap"></div>
164
- <ea-icon class="ea-message__icon-close" icon="icon-cancel" part="close-icon"></ea-icon>
197
+ const e = A("message");
198
+ this.ns = e, this.shadowRoot.innerHTML = P(`
199
+ <div class="${e.b()}" part="container">
200
+ <ea-icon class="${e.e("icon")}" part="icon"></ea-icon>
201
+ <div class="${e.e("content")}" part="content-wrap"></div>
202
+ <ea-icon class="${e.e("icon-close")}" name="xmark" part="close-icon"></ea-icon>
165
203
  </div>
166
- `, d(this, o, this.shadowRoot.querySelector(".ea-message")), d(this, u, this.shadowRoot.querySelector(".ea-message__icon")), d(this, m, this.shadowRoot.querySelector(
167
- ".ea-message__content"
168
- )), d(this, y, this.shadowRoot.querySelector(
169
- ".ea-message__icon-close"
170
- ));
204
+ `), h(this, r, this.shadowRoot.querySelector(e.cb())), h(this, u, this.shadowRoot.querySelector(e.ce("icon"))), h(this, m, this.shadowRoot.querySelector(e.ce("content"))), h(this, f, this.shadowRoot.querySelector(e.ce("icon-close")));
171
205
  }
172
206
  connectedCallback() {
173
- super.connectedCallback(), this.showClose && i(this, y).addEventListener("click", this.close);
207
+ super.connectedCallback();
174
208
  }
175
209
  $beforeUnmounted() {
176
- var e;
177
- (e = i(this, r)) == null || e.abort();
210
+ var e, n;
211
+ (e = s(this, d)) == null || e.abort(), (n = s(this, a)) == null || n.abort();
178
212
  }
179
213
  }
180
- o = new WeakMap(), u = new WeakMap(), m = new WeakMap(), y = new WeakMap(), r = new WeakMap(), f = new WeakMap(), l = new WeakMap(), b = new WeakMap(), w = new WeakMap();
181
- window.customElements.get("ea-message") || window.customElements.define("ea-message", N);
182
- var C, v, E, M, L;
214
+ r = new WeakMap(), u = new WeakMap(), m = new WeakMap(), f = new WeakMap(), d = new WeakMap(), a = new WeakMap(), b = new WeakMap(), l = new WeakMap(), C = new WeakMap(), w = new WeakMap(), v = new WeakMap();
215
+ window.customElements.get("ea-message") || window.customElements.define("ea-message", j);
216
+ var E, M, L, S, H;
183
217
  class g {
184
218
  /**
185
219
  * @param {EaMessageOptions} options
186
220
  */
187
- constructor(s) {
188
- n(this, C, ["dangerouslyUseHTMLString", "message", "placement", "type", "showClose", "duration", "offset"]);
189
- n(this, v, (s) => {
221
+ constructor(t) {
222
+ o(this, E, [
223
+ "dangerouslyUseHTMLString",
224
+ "message",
225
+ "placement",
226
+ "type",
227
+ "showClose",
228
+ "duration",
229
+ "offset",
230
+ "icon"
231
+ ]);
232
+ /**
233
+ * 渲染消息实例
234
+ * @param {EaMessageOptions} options
235
+ * @return {HTMLElement}
236
+ */
237
+ o(this, M, (t) => {
190
238
  const e = document.createElement("ea-message");
191
- if (s instanceof String)
192
- e.message = s;
193
- else if (s instanceof Object)
194
- for (const a in s)
195
- e[a] = s[a];
239
+ if (t instanceof String)
240
+ e.message = t;
241
+ else if (t instanceof Object)
242
+ for (const n in t)
243
+ e[n] = t[n];
196
244
  else
197
- console.warn("[EaMessage] TypeError: options must be a string or an object.");
245
+ console.warn(
246
+ "[EaMessage] TypeError: options must be a string or an object."
247
+ );
198
248
  return e;
199
249
  });
200
- n(this, E, (s, e = 3e3) => {
201
- e <= 0 || B(() => {
202
- s.visible = !1;
250
+ /**
251
+ * 处理 duration 属性
252
+ */
253
+ o(this, L, (t, e = 3e3) => {
254
+ e <= 0 || N(() => {
255
+ t.visible = !1;
203
256
  }, e);
204
257
  });
205
- n(this, M, (s, e) => {
258
+ /**
259
+ * 处理 appendTo 属性
260
+ */
261
+ o(this, S, (t, e) => {
206
262
  if (e instanceof HTMLElement)
207
- e.appendChild(s);
263
+ e.appendChild(t);
208
264
  else {
209
- const a = document.querySelector(e);
210
- a ? a.appendChild(s) : document.body.appendChild(s);
265
+ const n = document.querySelector(e);
266
+ n ? n.appendChild(t) : document.body.appendChild(t);
211
267
  }
212
268
  });
213
- n(this, L, (s, e) => {
214
- s.addEventListener("hidden", (a) => {
215
- e == null || e(a), s.remove();
216
- }, { once: !0 });
269
+ /**
270
+ * 处理 hide 属性
271
+ */
272
+ o(this, H, (t, e) => {
273
+ t.addEventListener(
274
+ "hidden",
275
+ (n) => {
276
+ e == null || e(n), t.remove();
277
+ },
278
+ { once: !0 }
279
+ );
217
280
  });
218
- this.options = i(this, C).reduce((a, c) => (s[c] && (a[c] = s[c]), a), {}), this.options.placement = this.options.placement || "top";
219
- const e = i(this, v).call(this, this.options);
220
- i(this, M).call(this, e, s.appendTo), i(this, E).call(this, e, s.duration), i(this, L).call(this, e, s.onClose), e.visible = !0;
281
+ this.options = s(this, E).reduce((n, c) => (t[c] && (n[c] = t[c]), n), {}), this.options.placement = this.options.placement || "top";
282
+ const e = s(this, M).call(this, this.options);
283
+ s(this, S).call(this, e, t.appendTo), s(this, L).call(this, e, t.duration), s(this, H).call(this, e, t.onClose), e.visible = !0;
221
284
  }
222
285
  }
223
- C = new WeakMap(), v = new WeakMap(), E = new WeakMap(), M = new WeakMap(), L = new WeakMap();
224
- const p = (t) => {
225
- new g(t);
286
+ E = new WeakMap(), M = new WeakMap(), L = new WeakMap(), S = new WeakMap(), H = new WeakMap();
287
+ const y = (i) => {
288
+ new g(i);
226
289
  };
227
- p.primary = (t) => new g({
228
- message: t,
290
+ y.primary = (i) => new g({
291
+ message: i,
229
292
  type: "primary"
230
293
  });
231
- p.success = (t) => new g({
232
- message: t,
294
+ y.success = (i) => new g({
295
+ message: i,
233
296
  type: "success"
234
297
  });
235
- p.warning = (t) => new g({
236
- message: t,
298
+ y.warning = (i) => new g({
299
+ message: i,
237
300
  type: "warning"
238
301
  });
239
- p.info = (t) => new g({
240
- message: t,
302
+ y.info = (i) => new g({
303
+ message: i,
241
304
  type: "info"
242
305
  });
243
- p.error = (t) => new g({
244
- message: t,
306
+ y.error = (i) => new g({
307
+ message: i,
245
308
  type: "error"
246
309
  });
247
- window.$message = p;
310
+ window.$message = y;
248
311
  export {
249
- p as EaMessage,
250
- N as EaMessageElement
312
+ y as EaMessage,
313
+ j as EaMessageElement
251
314
  };