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,72 +1,79 @@
1
- var _ = Object.defineProperty;
2
- var y = (t) => {
3
- throw TypeError(t);
1
+ var g = Object.defineProperty;
2
+ var _ = (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 S = (s, o, e) => o in s ? g(s, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[o] = e;
6
+ var C = (s, o, e) => S(s, typeof o != "symbol" ? o + "" : o, e), E = (s, o, e) => o.has(s) || _("Cannot " + e);
7
+ var t = (s, o, e) => (E(s, o, "read from private field"), e ? e.call(s) : o.get(s)), a = (s, o, e) => o.has(s) ? _("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(s) : o.set(s, e), l = (s, o, e, i) => (E(s, o, "write to private field"), i ? i.call(s, e) : o.set(s, e), e);
8
+ import { EaOverlay as k } from "./ea-overlay.js";
9
+ import { s as A } from "../css/ea-drawer.style.js";
10
+ import { E as q } from "../utils/Utils.js";
11
+ import { t as R } from "../utils/timeout.js";
12
+ var p, c, u, f, n, w, b, h, r, m, d, y;
13
+ class B extends k {
14
14
  constructor() {
15
15
  super();
16
- /** @type {AbortController} */
17
- a(this, i);
18
- /** @type {HTMLElement} */
19
- a(this, u);
20
16
  /** @type {HTMLElement} */
21
- a(this, l);
22
- /** @type {HTMLElement} */
23
- a(this, h);
17
+ a(this, p);
24
18
  /** @type {HTMLElement} */
25
19
  a(this, c);
26
20
  /** @type {HTMLElement} */
27
- a(this, n);
21
+ a(this, u);
28
22
  /** @type {HTMLElement} */
29
23
  a(this, f);
30
24
  /** @type {HTMLElement} */
25
+ a(this, n);
26
+ /** @type {HTMLElement} */
31
27
  a(this, w);
32
- b(this, "state", this.properties({
28
+ /** @type {HTMLElement} */
29
+ a(this, b);
30
+ /** @type {AbortController} */
31
+ a(this, h);
32
+ a(this, r, {
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, d).call(this);
50
+ return;
51
+ }
52
+ e && R(() => 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, u).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, f).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 i;
74
+ (i = t(this, r).showClose) == null || i.abort(), t(this, r).showClose = null, this["with-header"] && (t(this, n).style.display = e ? "block" : "none"), e && (t(this, r).showClose = new AbortController(), t(this, n).addEventListener("click", t(this, d), {
75
+ signal: t(this, r).showClose.signal
76
+ }));
70
77
  }
71
78
  },
72
79
  size: {
@@ -78,25 +85,39 @@ 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 i;
95
+ (i = t(this, r).closeOnPressEscape) == null || i.abort(), t(this, r).closeOnPressEscape = null, e && (t(this, r).closeOnPressEscape = new AbortController(), document.addEventListener("keydown", t(this, y), {
96
+ signal: t(this, r).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
+ a(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">
97
118
  <slot name="title"></slot>
98
119
  </span>
99
- <ea-icon class="ea-drawer-main__close-icon" icon="icon-cancel" part="close-icon"></ea-icon>
120
+ <ea-icon class="ea-drawer-main__close-icon" name="xmark" part="close-icon"></ea-icon>
100
121
  </header>
101
122
  <main class="ea-drawer-main__content" part="content">
102
123
  <slot></slot>
@@ -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
+ `, l(this, p, this.shadowRoot.querySelector(".ea-overlay")), l(this, c, this.shadowRoot.querySelector(".ea-drawer-main")), l(this, u, this.shadowRoot.querySelector(".ea-drawer-main__header")), l(this, f, this.shadowRoot.querySelector(".ea-drawer-main__title")), l(this, n, 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
+ )), l(this, w, this.shadowRoot.querySelector(".ea-drawer-main__content")), l(this, b, this.shadowRoot.querySelector(".ea-drawer-main__footer"));
111
132
  });
133
+ /**
134
+ * 处理抽屉关闭前的回调
135
+ */
112
136
  a(this, d, () => {
113
- this["before-close"] ? this.emit("before-close", {
114
- detail: {
115
- done: () => this.status = !1
116
- }
117
- }) : this.status = !1;
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
+ a(this, y, (e) => {
146
+ e.key === "Escape" && this.visible && t(this, d).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
  /**
@@ -150,7 +174,7 @@ class q extends g {
150
174
  * @return {string} 属性值
151
175
  */
152
176
  updateContainerClasslist() {
153
- return `${super.updateContainerClasslist()} ${this.computedClasslist(
177
+ const e = `${super.updateContainerClasslist()} ${this.computedClasslist(
154
178
  "ea-drawer",
155
179
  {
156
180
  ["--" + this.direction]: this.direction
@@ -159,9 +183,11 @@ class q extends g {
159
183
  drawer: !0
160
184
  }
161
185
  )}`;
186
+ return t(this, p).className = e, e;
162
187
  }
163
188
  connectedCallback() {
164
- r(this, i, new AbortController()), o(this, l).ariaModal = !0, o(this, l).role = "dialog", this["close-on-click-modal"] = this.getAttrBoolean(
189
+ var e, i;
190
+ (e = t(this, h)) == null || e.abort(), l(this, h, new AbortController()), t(this, c).ariaModal = !0, t(this, c).role = "dialog", this["close-on-click-modal"] = this.getAttrBoolean(
165
191
  "close-on-click-modal",
166
192
  !0
167
193
  ), this.addEventListener(
@@ -170,25 +196,21 @@ class q extends g {
170
196
  this.visible = !1;
171
197
  },
172
198
  {
173
- signal: o(this, i).signal
199
+ signal: t(this, h).signal
174
200
  }
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);
201
+ ), this["show-close"] && ((i = t(this, r).showClose) == null || i.abort(), t(this, r).showClose = new AbortController(), t(this, n).addEventListener("click", t(this, d), {
202
+ signal: t(this, r).showClose.signal
203
+ })), super.connectedCallback(), this.assignedStyle(A);
184
204
  }
185
205
  $beforeUnmounted() {
186
- var e;
187
- (e = o(this, i)) == null || e.abort();
206
+ var e, i;
207
+ (e = t(this, h)) == null || e.abort();
208
+ for (const v in t(this, r))
209
+ (i = t(this, r)[v]) == null || i.abort(), t(this, r)[v] = null;
188
210
  }
189
211
  }
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);
212
+ p = new WeakMap(), c = new WeakMap(), u = new WeakMap(), f = new WeakMap(), n = new WeakMap(), w = new WeakMap(), b = new WeakMap(), h = new WeakMap(), r = new WeakMap(), m = new WeakMap(), d = new WeakMap(), y = new WeakMap();
213
+ window.customElements.get("ea-drawer") || window.customElements.define("ea-drawer", B);
192
214
  export {
193
- q as EaDrawer
215
+ B as EaDrawer
194
216
  };
@@ -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
  };