easy-component-ui 3.0.13 → 3.0.14

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 (168) hide show
  1. package/README.md +162 -162
  2. package/package.json +8 -2
  3. package/dist/assets/icon.css +0 -1
  4. package/dist/components/Base.js +0 -874
  5. package/dist/components/ea-alert.js +0 -213
  6. package/dist/components/ea-avatar.js +0 -164
  7. package/dist/components/ea-backtop.js +0 -136
  8. package/dist/components/ea-badge.js +0 -144
  9. package/dist/components/ea-breadcrumb.js +0 -148
  10. package/dist/components/ea-button.js +0 -266
  11. package/dist/components/ea-calendar.js +0 -10
  12. package/dist/components/ea-calendar2.js +0 -673
  13. package/dist/components/ea-card.js +0 -121
  14. package/dist/components/ea-carousel.js +0 -415
  15. package/dist/components/ea-checkbox.js +0 -446
  16. package/dist/components/ea-collapse.js +0 -313
  17. package/dist/components/ea-color-picker.js +0 -888
  18. package/dist/components/ea-container.js +0 -206
  19. package/dist/components/ea-countdown.js +0 -142
  20. package/dist/components/ea-date-picker.js +0 -649
  21. package/dist/components/ea-descriptions.js +0 -474
  22. package/dist/components/ea-dialog.js +0 -249
  23. package/dist/components/ea-drawer.js +0 -216
  24. package/dist/components/ea-dropdown.js +0 -228
  25. package/dist/components/ea-empty.js +0 -93
  26. package/dist/components/ea-icon.js +0 -158
  27. package/dist/components/ea-image-preview.js +0 -532
  28. package/dist/components/ea-image.js +0 -327
  29. package/dist/components/ea-infinite-scroll.js +0 -109
  30. package/dist/components/ea-input-number.js +0 -367
  31. package/dist/components/ea-input.js +0 -588
  32. package/dist/components/ea-layout.js +0 -132
  33. package/dist/components/ea-link.js +0 -101
  34. package/dist/components/ea-menu.js +0 -433
  35. package/dist/components/ea-message-box.js +0 -624
  36. package/dist/components/ea-message.js +0 -314
  37. package/dist/components/ea-notification.js +0 -331
  38. package/dist/components/ea-overlay.js +0 -168
  39. package/dist/components/ea-page-header.js +0 -108
  40. package/dist/components/ea-pagination.js +0 -481
  41. package/dist/components/ea-popconfirm.js +0 -275
  42. package/dist/components/ea-popover.js +0 -147
  43. package/dist/components/ea-popper.js +0 -203
  44. package/dist/components/ea-progress.js +0 -286
  45. package/dist/components/ea-radio.js +0 -364
  46. package/dist/components/ea-rate.js +0 -241
  47. package/dist/components/ea-result.js +0 -100
  48. package/dist/components/ea-scrollbar.js +0 -235
  49. package/dist/components/ea-segmented.js +0 -215
  50. package/dist/components/ea-select.js +0 -609
  51. package/dist/components/ea-skeleton.js +0 -263
  52. package/dist/components/ea-slider.js +0 -430
  53. package/dist/components/ea-space.js +0 -123
  54. package/dist/components/ea-splitter.js +0 -233
  55. package/dist/components/ea-statistic.js +0 -74
  56. package/dist/components/ea-steps.js +0 -346
  57. package/dist/components/ea-switch.js +0 -271
  58. package/dist/components/ea-table.js +0 -1135
  59. package/dist/components/ea-tabs.js +0 -501
  60. package/dist/components/ea-tag.js +0 -228
  61. package/dist/components/ea-text.js +0 -113
  62. package/dist/components/ea-time-picker.js +0 -510
  63. package/dist/components/ea-timeline.js +0 -185
  64. package/dist/components/ea-tooltip.js +0 -161
  65. package/dist/components/ea-tour.js +0 -544
  66. package/dist/components/ea-transfer.js +0 -949
  67. package/dist/components/ea-tree.js +0 -1125
  68. package/dist/components/index.js +0 -60
  69. package/dist/core/FormBase.js +0 -238
  70. package/dist/css/ea-alert.style.js +0 -4
  71. package/dist/css/ea-aside.style.js +0 -4
  72. package/dist/css/ea-avatar.style.js +0 -4
  73. package/dist/css/ea-backtop.style.js +0 -4
  74. package/dist/css/ea-badge.style.js +0 -4
  75. package/dist/css/ea-breadcrumb-item.style.js +0 -4
  76. package/dist/css/ea-breadcrumb.style.js +0 -4
  77. package/dist/css/ea-button-group.style.js +0 -4
  78. package/dist/css/ea-button.style.js +0 -4
  79. package/dist/css/ea-calendar.style.js +0 -4
  80. package/dist/css/ea-card.style.js +0 -4
  81. package/dist/css/ea-carousel-item.style.js +0 -4
  82. package/dist/css/ea-carousel.style.js +0 -4
  83. package/dist/css/ea-check-tag.style.js +0 -4
  84. package/dist/css/ea-checkbox-group.style.js +0 -4
  85. package/dist/css/ea-checkbox.style.js +0 -4
  86. package/dist/css/ea-col.style.js +0 -4
  87. package/dist/css/ea-collapse-item.style.js +0 -4
  88. package/dist/css/ea-collapse.style.js +0 -4
  89. package/dist/css/ea-color-picker-panel.style.js +0 -4
  90. package/dist/css/ea-color-picker.style.js +0 -4
  91. package/dist/css/ea-container.style.js +0 -4
  92. package/dist/css/ea-date-picker.style.js +0 -4
  93. package/dist/css/ea-descriptions-item.style.js +0 -4
  94. package/dist/css/ea-descriptions.style.js +0 -4
  95. package/dist/css/ea-dialog.style.js +0 -4
  96. package/dist/css/ea-drawer.style.js +0 -4
  97. package/dist/css/ea-dropdown-item.style.js +0 -4
  98. package/dist/css/ea-dropdown-menu.style.js +0 -4
  99. package/dist/css/ea-dropdown.style.js +0 -4
  100. package/dist/css/ea-empty.style.js +0 -4
  101. package/dist/css/ea-footer.style.js +0 -4
  102. package/dist/css/ea-header.style.js +0 -4
  103. package/dist/css/ea-icon.style.js +0 -4
  104. package/dist/css/ea-image-preview.style.js +0 -4
  105. package/dist/css/ea-image.style.js +0 -4
  106. package/dist/css/ea-infinite-scroll.style.js +0 -4
  107. package/dist/css/ea-input-number.style.js +0 -4
  108. package/dist/css/ea-input.style.js +0 -4
  109. package/dist/css/ea-link.style.js +0 -4
  110. package/dist/css/ea-main.style.js +0 -4
  111. package/dist/css/ea-menu-item-group.style.js +0 -4
  112. package/dist/css/ea-menu-item.style.js +0 -4
  113. package/dist/css/ea-menu.style.js +0 -4
  114. package/dist/css/ea-message-box.style.js +0 -4
  115. package/dist/css/ea-message.style.js +0 -4
  116. package/dist/css/ea-notification.style.js +0 -4
  117. package/dist/css/ea-option-gropu.style.js +0 -4
  118. package/dist/css/ea-option.style.js +0 -4
  119. package/dist/css/ea-overlay.style.js +0 -4
  120. package/dist/css/ea-page-header.style.js +0 -4
  121. package/dist/css/ea-pagination.style.js +0 -4
  122. package/dist/css/ea-popconfirm.style.js +0 -4
  123. package/dist/css/ea-popover.style.js +0 -4
  124. package/dist/css/ea-popper.style.js +0 -4
  125. package/dist/css/ea-progress.style.js +0 -4
  126. package/dist/css/ea-radio-group.style.js +0 -4
  127. package/dist/css/ea-radio.style.js +0 -4
  128. package/dist/css/ea-rate.style.js +0 -4
  129. package/dist/css/ea-result.style.js +0 -4
  130. package/dist/css/ea-row.style.js +0 -4
  131. package/dist/css/ea-scrollbar.style.js +0 -4
  132. package/dist/css/ea-segmented.style.js +0 -4
  133. package/dist/css/ea-select.style.js +0 -4
  134. package/dist/css/ea-skeleton-item.style.js +0 -4
  135. package/dist/css/ea-skeleton.style.js +0 -4
  136. package/dist/css/ea-slider.style.js +0 -4
  137. package/dist/css/ea-space.style.js +0 -4
  138. package/dist/css/ea-splitter-bar.style.js +0 -4
  139. package/dist/css/ea-splitter-panel.style.js +0 -4
  140. package/dist/css/ea-splitter.style.js +0 -4
  141. package/dist/css/ea-statistic.style.js +0 -4
  142. package/dist/css/ea-step.style.js +0 -4
  143. package/dist/css/ea-steps.style.js +0 -4
  144. package/dist/css/ea-sub-menu.style.js +0 -4
  145. package/dist/css/ea-switch.style.js +0 -4
  146. package/dist/css/ea-tab-panel.style.js +0 -4
  147. package/dist/css/ea-tab.style.js +0 -4
  148. package/dist/css/ea-table-column.style.js +0 -4
  149. package/dist/css/ea-table.style.js +0 -4
  150. package/dist/css/ea-tabs.style.js +0 -4
  151. package/dist/css/ea-tag.style.js +0 -4
  152. package/dist/css/ea-text.style.js +0 -4
  153. package/dist/css/ea-time-picker.style.js +0 -4
  154. package/dist/css/ea-timeline-item.style.js +0 -4
  155. package/dist/css/ea-timeline.style.js +0 -4
  156. package/dist/css/ea-tooltip.style.js +0 -4
  157. package/dist/css/ea-tour-step.style.js +0 -4
  158. package/dist/css/ea-tour.style.js +0 -4
  159. package/dist/css/ea-transfer.style.js +0 -5
  160. package/dist/css/ea-tree.style.js +0 -6
  161. package/dist/css/ea-ui-component.style.js +0 -4
  162. package/dist/favicon.ico +0 -0
  163. package/dist/utils/Color.js +0 -439
  164. package/dist/utils/I18nManager.js +0 -218
  165. package/dist/utils/Utils.js +0 -65
  166. package/dist/utils/Variables.js +0 -12
  167. package/dist/utils/parseTime.js +0 -73
  168. package/dist/utils/timeout.js +0 -9
@@ -1,213 +0,0 @@
1
- var w = Object.defineProperty;
2
- var y = (t) => {
3
- throw TypeError(t);
4
- };
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 _ = (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
- import { B as g } from "./Base.js";
9
- import { s as x } from "../css/ea-alert.style.js";
10
- import { t as b } from "../utils/timeout.js";
11
- var l, d, u, m, p, f, n, o, h;
12
- class L extends g {
13
- constructor() {
14
- super();
15
- /** @type {HTMLElement} */
16
- i(this, l);
17
- /** @type {HTMLElement} */
18
- i(this, d);
19
- /** @type {HTMLElement} */
20
- i(this, u);
21
- /** @type {HTMLSlotElement} */
22
- i(this, m);
23
- /** @type {HTMLElement} */
24
- i(this, p);
25
- /** @type {HTMLElement} */
26
- i(this, f);
27
- /** @type {HTMLElement} */
28
- i(this, n);
29
- /** @type {AbortController} */
30
- i(this, o);
31
- _(this, "state", this.properties({
32
- title: {
33
- type: String,
34
- default: "",
35
- observer: (e) => {
36
- a(this, p).innerHTML = e;
37
- }
38
- },
39
- description: {
40
- type: String,
41
- default: "",
42
- observer: (e) => {
43
- a(this, f).innerHTML = e || "<slot></slot>";
44
- }
45
- },
46
- type: {
47
- type: ["primary", "info", "success", "warning", "error"],
48
- default: "info",
49
- observer: (e) => {
50
- this.updateContainerClasslist();
51
- }
52
- },
53
- effect: {
54
- type: ["light", "dark"],
55
- default: "light",
56
- observer: (e) => {
57
- this.updateContainerClasslist();
58
- }
59
- },
60
- "close-text": {
61
- type: String,
62
- default: "",
63
- observer: (e) => {
64
- try {
65
- a(this, n).textContent = e;
66
- } catch {
67
- }
68
- }
69
- },
70
- closable: {
71
- type: Boolean,
72
- default: !0,
73
- observer: (e) => {
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
- }));
78
- }
79
- },
80
- "show-icon": {
81
- type: Boolean,
82
- default: !1,
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>`;
92
- }
93
- },
94
- center: {
95
- type: Boolean,
96
- default: !1,
97
- observer: () => {
98
- this.updateContainerClasslist();
99
- }
100
- },
101
- "show-after": {
102
- type: Number,
103
- default: 0,
104
- observer: (e) => {
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");
107
- }, e);
108
- }
109
- },
110
- "hide-after": {
111
- type: Number,
112
- default: 300,
113
- observer: (e) => {
114
- }
115
- },
116
- "auto-close": {
117
- type: Number,
118
- default: 0,
119
- observer: (e) => {
120
- e && this.isMounted && b(() => a(this, h).call(this), this["auto-close"]);
121
- }
122
- }
123
- }));
124
- /**
125
- * 关闭事件
126
- */
127
- i(this, h, () => {
128
- b(() => {
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
- });
140
- }, this["hide-after"]);
141
- });
142
- this.$render(), this.stylesheet = x;
143
- }
144
- static get observedAttributes() {
145
- return [
146
- "title",
147
- "description",
148
- "type",
149
- "effect",
150
- "closable",
151
- "close-text",
152
- "show-icon",
153
- "center",
154
- "description",
155
- "show-after",
156
- "hide-after",
157
- "auto-close"
158
- ];
159
- }
160
- /**
161
- * 获取 classlist 列表
162
- * @return {string} 属性值
163
- */
164
- updateContainerClasslist() {
165
- const e = this.computedClasslist("ea-alert", {
166
- ["--" + this.type]: this.type,
167
- ["--" + this.effect]: this.effect,
168
- "--center": this.center
169
- });
170
- return a(this, l).className = e, e;
171
- }
172
- $render() {
173
- this.shadowRoot.innerHTML = `
174
- <div class='ea-alert' part='container'>
175
- <span class="ea-alert__icon-wrap" part='icon-wrap'>
176
- <slot name='icon'></slot>
177
- </span>
178
- <div class="ea-alert__content" part='content-wrap'>
179
- <span class="ea-alert__title" part='title'>
180
- <slot name="title"></slot>
181
- </span>
182
- <p class="ea-alert__description" part='description'>
183
- <slot></slot>
184
- </p>
185
- <span class="ea-alert__close-btn" part="close-btn">
186
- ${this.closable ? this["close-text"] ? this["close-text"] : '<ea-icon class="ea-alert__close-icon" name="xmark" part="close-icon"></ea-icon>' : ""}
187
- </span>
188
- </div>
189
- </div>
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"));
197
- }
198
- connectedCallback() {
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
- }));
203
- }
204
- $beforeUnmounted() {
205
- var e;
206
- (e = a(this, o)) == null || e.abort();
207
- }
208
- }
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();
210
- window.customElements.get("ea-alert") || window.customElements.define("ea-alert", L);
211
- export {
212
- L as EaAlert
213
- };
@@ -1,164 +0,0 @@
1
- var m = Object.defineProperty;
2
- var v = (e) => {
3
- throw TypeError(e);
4
- };
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
- <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
13
- <defs>
14
- <clipPath id="a">
15
- <path d="M0 30h90v45H0z" />
16
- </clipPath>
17
- </defs>
18
- <path fill="#c0c4cc" d="M0 0h100v100H0z" />
19
- <circle cx="50" cy="35" r="15" fill="#fff" />
20
- <circle cx="50" cy="82.5" r="30" fill="#fff" clip-path="url(#a)" />
21
- </svg>
22
- `, S = `
23
- <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
24
- <path fill="#c0c4cc" d="M0 0h100v100H0z" />
25
- <path fill="#fff" d="M20 25h60v50H20z" />
26
- <circle r="7" cx="35" cy="40" fill="#c0c4cc" />
27
- <path d="M35 55L25 70h-5 30z" fill="#c0c4cc" />
28
- <path d="M55 45L40 70h5 30z" fill="#c0c4cc" />
29
- </svg>
30
- `;
31
- var o, i;
32
- class C extends y {
33
- constructor() {
34
- super();
35
- /** @type {HTMLElement} */
36
- n(this, o);
37
- /** @type {AbortController} */
38
- n(this, i);
39
- f(this, "state", this.properties({
40
- icon: {
41
- type: String,
42
- default: "",
43
- observer: (t) => {
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
- }
46
- },
47
- shape: {
48
- type: ["circle", "square"],
49
- default: "circle",
50
- observer: () => {
51
- this.updateContainerClasslist();
52
- }
53
- },
54
- size: {
55
- type: String,
56
- default: "default",
57
- observer: (t) => {
58
- const a = b.Enum.hasEnum(
59
- ["default", "small", "large"],
60
- t
61
- ), c = CSS.supports("width", t);
62
- if (!a && !c)
63
- return this.size = "default", console.warn(
64
- "[ea-avatar] Please set size to one of [default, small, large] or a valid CSS width value"
65
- );
66
- this.style.setProperty(
67
- "--ea-avatar-size",
68
- a ? `var(--ea-avatar-size-${t})` : t
69
- );
70
- }
71
- },
72
- src: {
73
- type: String,
74
- default: "",
75
- observer: (t) => {
76
- var c;
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
- "load",
81
- () => {
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
- },
85
- { signal: r(this, i).signal }
86
- ), a.addEventListener(
87
- "error",
88
- () => {
89
- var d;
90
- const l = r(this, o).querySelector("slot");
91
- l && (l.innerHTML = S), this.emit("error"), (d = r(this, i)) == null || d.abort();
92
- },
93
- { signal: r(this, i).signal }
94
- );
95
- }
96
- },
97
- "src-set": {
98
- type: String,
99
- default: "",
100
- observer: (t) => {
101
- const a = this.shadowRoot.querySelector(".ea-avatar__img");
102
- a && (a.srcset = t);
103
- }
104
- },
105
- alt: {
106
- type: String,
107
- default: "",
108
- observer: (t) => {
109
- const a = this.shadowRoot.querySelector(".ea-avatar__img");
110
- a && (a.alt = t);
111
- }
112
- },
113
- fit: {
114
- type: ["fill", "contain", "cover", "none", "scale-down"],
115
- default: "cover",
116
- observer: (t) => {
117
- this.style.setProperty("--ea-avatar-fit", t);
118
- }
119
- }
120
- }));
121
- this.stylesheet = w, this.$render();
122
- }
123
- static get observedAttributes() {
124
- return [
125
- ...super.observedAttributes,
126
- "icon",
127
- "shape",
128
- "size",
129
- "src",
130
- "src-set",
131
- "alt",
132
- "fit"
133
- ];
134
- }
135
- /**
136
- * 获取 classlist 列表
137
- * @return {string} 属性值
138
- */
139
- updateContainerClasslist() {
140
- const t = this.computedClasslist("ea-avatar", {
141
- ["--" + this.shape]: this.shape
142
- });
143
- return r(this, o).className = t, t;
144
- }
145
- $render() {
146
- this.shadowRoot.innerHTML = `
147
- <div class="ea-avatar" part='container'>
148
- <slot>${u}</slot>
149
- </div>
150
- `, h(this, o, this.shadowRoot.querySelector(".ea-avatar")), this.updateContainerClasslist();
151
- }
152
- connectedCallback() {
153
- super.connectedCallback();
154
- }
155
- $beforeUnmounted() {
156
- var t;
157
- (t = r(this, i)) == null || t.abort();
158
- }
159
- }
160
- o = new WeakMap(), i = new WeakMap();
161
- window.customElements.get("ea-avatar") || window.customElements.define("ea-avatar", C);
162
- export {
163
- C as EaAvatar
164
- };
@@ -1,136 +0,0 @@
1
- var m = Object.defineProperty;
2
- var p = (e) => {
3
- throw TypeError(e);
4
- };
5
- var v = (e, s, t) => s in e ? m(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
6
- var u = (e, s, t) => v(e, typeof s != "symbol" ? s + "" : s, t), g = (e, s, t) => s.has(e) || p("Cannot " + t);
7
- var o = (e, s, t) => (g(e, s, "read from private field"), t ? t.call(e) : s.get(e)), a = (e, s, t) => s.has(e) ? p("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), c = (e, s, t, i) => (g(e, s, "write to private field"), i ? i.call(e, t) : s.set(e, t), t);
8
- import { B as y } from "./Base.js";
9
- import { s as f } from "../css/ea-backtop.style.js";
10
- var r, l, n, h, d, b;
11
- class w extends y {
12
- constructor() {
13
- super();
14
- /** @type {HTMLElement} */
15
- a(this, r);
16
- /** @type {AbortController} */
17
- a(this, l);
18
- /** @type {AbortController} */
19
- a(this, n);
20
- u(this, "state", this.properties({
21
- target: {
22
- type: String,
23
- default: "window",
24
- observer: () => {
25
- }
26
- },
27
- "visibility-height": {
28
- type: Number,
29
- default: 200,
30
- observer: () => {
31
- }
32
- },
33
- right: {
34
- type: String,
35
- default: "40px",
36
- observer: (t) => {
37
- this.style.setProperty("--ea-backtop-right", t);
38
- }
39
- },
40
- bottom: {
41
- type: String,
42
- default: "40px",
43
- observer: (t) => {
44
- this.style.setProperty("--ea-backtop-bottom", t);
45
- }
46
- },
47
- smooth: {
48
- type: Boolean,
49
- default: !0,
50
- observer: () => {
51
- }
52
- }
53
- }));
54
- /**
55
- * 获取当前滚动位置
56
- * @return {number} 滚动位置
57
- */
58
- a(this, h, () => {
59
- const t = document.querySelector(this.target);
60
- return t ? t.scrollTop : window.scrollY;
61
- });
62
- /**
63
- * 点击事件处理
64
- */
65
- a(this, d, () => {
66
- (document.querySelector(this.target) || window).scrollTo({
67
- top: 0,
68
- behavior: this.smooth ? "smooth" : "auto"
69
- });
70
- });
71
- /**
72
- * 滚动事件处理
73
- */
74
- a(this, b, async () => {
75
- var i;
76
- o(this, h).call(this) > this["visibility-height"] ? (o(this, r).classList.add("before-enter"), o(this, r).offsetWidth, this.updateContainerClasslist()) : ((i = o(this, n)) == null || i.abort(), c(this, n, new AbortController()), o(this, r).classList.add("before-leave"), o(this, r).addEventListener(
77
- "transitionend",
78
- () => {
79
- this.updateContainerClasslist();
80
- },
81
- { once: !0, signal: o(this, n).signal }
82
- ));
83
- });
84
- this.stylesheet = f, this.$render();
85
- }
86
- static get observedAttributes() {
87
- return [
88
- ...super.observedAttributes,
89
- "target",
90
- "visibility-height",
91
- "right",
92
- "bottom",
93
- "smooth"
94
- ];
95
- }
96
- /**
97
- * 获取 classlist 列表
98
- * @return {string} 属性值
99
- */
100
- updateContainerClasslist() {
101
- const t = o(this, h).call(this), i = this.computedClasslist(
102
- "ea-backtop",
103
- {
104
- // ['--' + this.type]: this.type,
105
- },
106
- {
107
- visible: t > this["visibility-height"]
108
- }
109
- );
110
- return o(this, r).className = i, i;
111
- }
112
- $render() {
113
- this.shadowRoot.innerHTML = `
114
- <div class='ea-backtop' part='container'>
115
- <slot></slot>
116
- </div>
117
- `, c(this, r, this.shadowRoot.querySelector(".ea-backtop"));
118
- }
119
- connectedCallback() {
120
- var i;
121
- super.connectedCallback(), (i = o(this, l)) == null || i.abort(), c(this, l, new AbortController()), this.addEventListener("click", o(this, d), {
122
- signal: o(this, l).signal
123
- }), (document.querySelector(this.target) || window).addEventListener("scroll", o(this, b), {
124
- signal: o(this, l).signal
125
- });
126
- }
127
- $beforeUnmounted() {
128
- var t, i;
129
- (t = o(this, l)) == null || t.abort(), (i = o(this, n)) == null || i.abort();
130
- }
131
- }
132
- r = new WeakMap(), l = new WeakMap(), n = new WeakMap(), h = new WeakMap(), d = new WeakMap(), b = new WeakMap();
133
- window.customElements.get("ea-backtop") || window.customElements.define("ea-backtop", w);
134
- export {
135
- w as EaBacktop
136
- };
@@ -1,144 +0,0 @@
1
- var b = Object.defineProperty;
2
- var c = (t) => {
3
- throw TypeError(t);
4
- };
5
- var y = (t, s, e) => s in t ? b(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
6
- var p = (t, s, e) => y(t, typeof s != "symbol" ? s + "" : s, e), f = (t, s, e) => s.has(t) || c("Cannot " + e);
7
- var a = (t, s, e) => (f(t, s, "read from private field"), e ? e.call(t) : s.get(t)), u = (t, s, e) => s.has(t) ? c("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), h = (t, s, e, i) => (f(t, s, "write to private field"), i ? i.call(t, e) : s.set(t, e), e);
8
- import { B as v } from "./Base.js";
9
- import { s as g } from "../css/ea-badge.style.js";
10
- import { E as C } from "../utils/Utils.js";
11
- var o, r;
12
- class x extends v {
13
- constructor() {
14
- super();
15
- /** @type {HTMLElement} */
16
- u(this, o);
17
- /** @type {HTMLElement} */
18
- u(this, r);
19
- p(this, "state", this.properties({
20
- value: {
21
- type: String,
22
- default: "",
23
- observer: (e) => {
24
- if (this["is-dot"]) return;
25
- const i = this.shadowRoot.querySelector("[data-value]"), n = this.querySelector("[slot='content']"), l = () => !this["show-zero"] && Number(e) === 0 ? (a(this, o).className = this.updateContainerClasslist(), "") : C.Number.isNumber(e) && e > this.max ? `${this.max}+` : e;
26
- if (i)
27
- i.textContent = l();
28
- else if (n) {
29
- const d = document.createElement("template");
30
- if (n.querySelector("[data-value]")) {
31
- d.innerHTML = n.innerHTML;
32
- const m = d.content.querySelector("[data-value]");
33
- m.innerText = l();
34
- }
35
- a(this, r).innerHTML = d.innerHTML;
36
- } else
37
- a(this, r).textContent = l();
38
- }
39
- },
40
- max: {
41
- type: Number,
42
- default: 1 / 0,
43
- observer: () => {
44
- }
45
- },
46
- type: {
47
- type: ["primary", "success", "warning", "danger", "info"],
48
- default: "danger",
49
- observer: () => {
50
- a(this, o).className = this.updateContainerClasslist();
51
- }
52
- },
53
- color: {
54
- type: String,
55
- default: "",
56
- observer: (e) => {
57
- this.style.setProperty("--ea-badge-color", e);
58
- }
59
- },
60
- "is-dot": {
61
- type: Boolean,
62
- default: !1,
63
- observer: () => {
64
- a(this, o).className = this.updateContainerClasslist();
65
- }
66
- },
67
- "data-hidden": {
68
- type: Boolean,
69
- default: !1,
70
- observer: (e) => {
71
- a(this, r).ariaHidden = e, a(this, r).hidden = e, a(this, o).className = this.updateContainerClasslist();
72
- }
73
- },
74
- "offset-x": {
75
- type: Number,
76
- default: 0,
77
- observer: (e) => {
78
- this.style.setProperty("--ea-badge-offset-x", -e + "px");
79
- }
80
- },
81
- "offset-y": {
82
- type: Number,
83
- default: 0,
84
- observer: (e) => {
85
- this.style.setProperty("--ea-badge-offset-y", e + "px");
86
- }
87
- },
88
- "show-zero": {
89
- type: Boolean,
90
- default: !0,
91
- observer: () => {
92
- a(this, o).className = this.updateContainerClasslist();
93
- }
94
- }
95
- }));
96
- this.stylesheet = g, this.$render();
97
- }
98
- static get observedAttributes() {
99
- return [
100
- ...super.observedAttributes,
101
- "value",
102
- "max",
103
- "is-dot",
104
- "data-hidden",
105
- "type",
106
- "show-zero",
107
- "color",
108
- "offset-x",
109
- "offset-y"
110
- ];
111
- }
112
- /**
113
- * 获取 classlist 列表
114
- * @return {string} 属性值
115
- */
116
- updateContainerClasslist() {
117
- return this.computedClasslist(
118
- "ea-badge",
119
- {
120
- ["--" + this.type]: this.type
121
- },
122
- {
123
- dot: this["is-dot"],
124
- hidden: this["data-hidden"] || !this["show-zero"] && Number(this.value) === 0
125
- }
126
- );
127
- }
128
- $render() {
129
- this.shadowRoot.innerHTML = `
130
- <div class='ea-badge' part='container'>
131
- <sup class="ea-badge__content" part='content'></sup>
132
- <slot></slot>
133
- </div>
134
- `, h(this, o, this.shadowRoot.querySelector(".ea-badge")), h(this, r, this.shadowRoot.querySelector(".ea-badge__content"));
135
- }
136
- connectedCallback() {
137
- super.connectedCallback();
138
- }
139
- }
140
- o = new WeakMap(), r = new WeakMap();
141
- window.customElements.get("ea-badge") || window.customElements.define("ea-badge", x);
142
- export {
143
- x as EaBadge
144
- };