easy-component-ui 3.0.14 → 3.0.15
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.
- package/dist/assets/icon.css +1 -0
- package/dist/components/Base.js +941 -0
- package/dist/components/ea-alert.js +213 -0
- package/dist/components/ea-avatar.js +164 -0
- package/dist/components/ea-backtop.js +136 -0
- package/dist/components/ea-badge.js +144 -0
- package/dist/components/ea-breadcrumb.js +148 -0
- package/dist/components/ea-button.js +266 -0
- package/dist/components/ea-calendar.js +10 -0
- package/dist/components/ea-calendar2.js +673 -0
- package/dist/components/ea-card.js +121 -0
- package/dist/components/ea-carousel.js +415 -0
- package/dist/components/ea-checkbox.js +446 -0
- package/dist/components/ea-collapse.js +313 -0
- package/dist/components/ea-color-picker.js +888 -0
- package/dist/components/ea-container.js +206 -0
- package/dist/components/ea-countdown.js +142 -0
- package/dist/components/ea-date-picker.js +649 -0
- package/dist/components/ea-descriptions.js +474 -0
- package/dist/components/ea-dialog.js +249 -0
- package/dist/components/ea-drawer.js +216 -0
- package/dist/components/ea-dropdown.js +228 -0
- package/dist/components/ea-empty.js +93 -0
- package/dist/components/ea-icon.js +159 -0
- package/dist/components/ea-image-preview.js +532 -0
- package/dist/components/ea-image.js +327 -0
- package/dist/components/ea-infinite-scroll.js +109 -0
- package/dist/components/ea-input-number.js +367 -0
- package/dist/components/ea-input.js +588 -0
- package/dist/components/ea-layout.js +132 -0
- package/dist/components/ea-link.js +101 -0
- package/dist/components/ea-menu.js +433 -0
- package/dist/components/ea-message-box.js +624 -0
- package/dist/components/ea-message.js +313 -0
- package/dist/components/ea-notification.js +331 -0
- package/dist/components/ea-overlay.js +168 -0
- package/dist/components/ea-page-header.js +108 -0
- package/dist/components/ea-pagination.js +481 -0
- package/dist/components/ea-popconfirm.js +275 -0
- package/dist/components/ea-popover.js +147 -0
- package/dist/components/ea-popper.js +203 -0
- package/dist/components/ea-progress.js +286 -0
- package/dist/components/ea-radio.js +364 -0
- package/dist/components/ea-rate.js +241 -0
- package/dist/components/ea-result.js +100 -0
- package/dist/components/ea-scrollbar.js +235 -0
- package/dist/components/ea-segmented.js +215 -0
- package/dist/components/ea-select.js +609 -0
- package/dist/components/ea-skeleton.js +263 -0
- package/dist/components/ea-slider.js +430 -0
- package/dist/components/ea-space.js +123 -0
- package/dist/components/ea-splitter.js +233 -0
- package/dist/components/ea-statistic.js +74 -0
- package/dist/components/ea-steps.js +346 -0
- package/dist/components/ea-switch.js +271 -0
- package/dist/components/ea-table.js +1137 -0
- package/dist/components/ea-tabs.js +503 -0
- package/dist/components/ea-tag.js +228 -0
- package/dist/components/ea-text.js +113 -0
- package/dist/components/ea-time-picker.js +510 -0
- package/dist/components/ea-timeline.js +185 -0
- package/dist/components/ea-tooltip.js +161 -0
- package/dist/components/ea-tour.js +544 -0
- package/dist/components/ea-transfer.js +949 -0
- package/dist/components/ea-tree.js +1125 -0
- package/dist/components/index.js +60 -0
- package/dist/core/FormBase.js +238 -0
- package/dist/css/ea-alert.style.js +4 -0
- package/dist/css/ea-aside.style.js +4 -0
- package/dist/css/ea-avatar.style.js +4 -0
- package/dist/css/ea-backtop.style.js +4 -0
- package/dist/css/ea-badge.style.js +4 -0
- package/dist/css/ea-breadcrumb-item.style.js +4 -0
- package/dist/css/ea-breadcrumb.style.js +4 -0
- package/dist/css/ea-button-group.style.js +4 -0
- package/dist/css/ea-button.style.js +4 -0
- package/dist/css/ea-calendar.style.js +4 -0
- package/dist/css/ea-card.style.js +4 -0
- package/dist/css/ea-carousel-item.style.js +4 -0
- package/dist/css/ea-carousel.style.js +4 -0
- package/dist/css/ea-check-tag.style.js +4 -0
- package/dist/css/ea-checkbox-group.style.js +4 -0
- package/dist/css/ea-checkbox.style.js +4 -0
- package/dist/css/ea-col.style.js +4 -0
- package/dist/css/ea-collapse-item.style.js +4 -0
- package/dist/css/ea-collapse.style.js +4 -0
- package/dist/css/ea-color-picker-panel.style.js +4 -0
- package/dist/css/ea-color-picker.style.js +4 -0
- package/dist/css/ea-container.style.js +4 -0
- package/dist/css/ea-date-picker.style.js +4 -0
- package/dist/css/ea-descriptions-item.style.js +4 -0
- package/dist/css/ea-descriptions.style.js +4 -0
- package/dist/css/ea-dialog.style.js +4 -0
- package/dist/css/ea-drawer.style.js +4 -0
- package/dist/css/ea-dropdown-item.style.js +4 -0
- package/dist/css/ea-dropdown-menu.style.js +4 -0
- package/dist/css/ea-dropdown.style.js +4 -0
- package/dist/css/ea-empty.style.js +4 -0
- package/dist/css/ea-footer.style.js +4 -0
- package/dist/css/ea-header.style.js +4 -0
- package/dist/css/ea-icon.style.js +4 -0
- package/dist/css/ea-image-preview.style.js +4 -0
- package/dist/css/ea-image.style.js +4 -0
- package/dist/css/ea-infinite-scroll.style.js +4 -0
- package/dist/css/ea-input-number.style.js +4 -0
- package/dist/css/ea-input.style.js +4 -0
- package/dist/css/ea-link.style.js +4 -0
- package/dist/css/ea-main.style.js +4 -0
- package/dist/css/ea-menu-item-group.style.js +4 -0
- package/dist/css/ea-menu-item.style.js +4 -0
- package/dist/css/ea-menu.style.js +4 -0
- package/dist/css/ea-message-box.style.js +4 -0
- package/dist/css/ea-message.style.js +4 -0
- package/dist/css/ea-notification.style.js +4 -0
- package/dist/css/ea-option-gropu.style.js +4 -0
- package/dist/css/ea-option.style.js +4 -0
- package/dist/css/ea-overlay.style.js +4 -0
- package/dist/css/ea-page-header.style.js +4 -0
- package/dist/css/ea-pagination.style.js +4 -0
- package/dist/css/ea-popconfirm.style.js +4 -0
- package/dist/css/ea-popover.style.js +4 -0
- package/dist/css/ea-popper.style.js +4 -0
- package/dist/css/ea-progress.style.js +4 -0
- package/dist/css/ea-radio-group.style.js +4 -0
- package/dist/css/ea-radio.style.js +4 -0
- package/dist/css/ea-rate.style.js +4 -0
- package/dist/css/ea-result.style.js +4 -0
- package/dist/css/ea-row.style.js +4 -0
- package/dist/css/ea-scrollbar.style.js +4 -0
- package/dist/css/ea-segmented.style.js +4 -0
- package/dist/css/ea-select.style.js +4 -0
- package/dist/css/ea-skeleton-item.style.js +4 -0
- package/dist/css/ea-skeleton.style.js +4 -0
- package/dist/css/ea-slider.style.js +4 -0
- package/dist/css/ea-space.style.js +4 -0
- package/dist/css/ea-splitter-bar.style.js +4 -0
- package/dist/css/ea-splitter-panel.style.js +4 -0
- package/dist/css/ea-splitter.style.js +4 -0
- package/dist/css/ea-statistic.style.js +4 -0
- package/dist/css/ea-step.style.js +4 -0
- package/dist/css/ea-steps.style.js +4 -0
- package/dist/css/ea-sub-menu.style.js +4 -0
- package/dist/css/ea-switch.style.js +4 -0
- package/dist/css/ea-tab-panel.style.js +4 -0
- package/dist/css/ea-tab.style.js +4 -0
- package/dist/css/ea-table-column.style.js +4 -0
- package/dist/css/ea-table.style.js +4 -0
- package/dist/css/ea-tabs.style.js +4 -0
- package/dist/css/ea-tag.style.js +4 -0
- package/dist/css/ea-text.style.js +4 -0
- package/dist/css/ea-time-picker.style.js +4 -0
- package/dist/css/ea-timeline-item.style.js +4 -0
- package/dist/css/ea-timeline.style.js +4 -0
- package/dist/css/ea-tooltip.style.js +4 -0
- package/dist/css/ea-tour-step.style.js +4 -0
- package/dist/css/ea-tour.style.js +4 -0
- package/dist/css/ea-transfer.style.js +5 -0
- package/dist/css/ea-tree.style.js +6 -0
- package/dist/css/ea-ui-component.style.js +4 -0
- package/dist/favicon.ico +0 -0
- package/dist/utils/Color.js +439 -0
- package/dist/utils/I18nManager.js +218 -0
- package/dist/utils/Utils.js +65 -0
- package/dist/utils/Variables.js +12 -0
- package/dist/utils/parseTime.js +73 -0
- package/dist/utils/timeout.js +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
var C = Object.defineProperty;
|
|
2
|
+
var S = (s) => {
|
|
3
|
+
throw TypeError(s);
|
|
4
|
+
};
|
|
5
|
+
var N = (s, i, e) => i in s ? C(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), E = (s, i, e) => i.has(s) || S("Cannot " + e);
|
|
7
|
+
var t = (s, i, e) => (E(s, i, "read from private field"), e ? e.call(s) : i.get(s)), a = (s, i, e) => i.has(s) ? S("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, e), n = (s, i, e, o) => (E(s, i, "write to private field"), o ? o.call(s, e) : i.set(s, e), e);
|
|
8
|
+
import { B as A } from "./Base.js";
|
|
9
|
+
import { s as D } from "../css/ea-image.style.js";
|
|
10
|
+
var m, l, w, v, r, u, d, h, c, g;
|
|
11
|
+
class _ extends A {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
/** @type {HTMLElement} */
|
|
15
|
+
a(this, m);
|
|
16
|
+
/** @type {HTMLImageElement} */
|
|
17
|
+
a(this, l);
|
|
18
|
+
/** @type {HTMLElement} */
|
|
19
|
+
a(this, w);
|
|
20
|
+
/** @type {HTMLElement} */
|
|
21
|
+
a(this, v);
|
|
22
|
+
/** @type {EaImagePreview} */
|
|
23
|
+
a(this, r);
|
|
24
|
+
/** @type {HTMLSlotElement} */
|
|
25
|
+
a(this, u);
|
|
26
|
+
/** @type {HTMLSlotElement} */
|
|
27
|
+
a(this, d);
|
|
28
|
+
/** @type {AbortController} */
|
|
29
|
+
a(this, h);
|
|
30
|
+
a(this, c, {
|
|
31
|
+
/** @type {"loading" | "error" | "success"} */
|
|
32
|
+
imageStatus: "loading",
|
|
33
|
+
previewQueue: []
|
|
34
|
+
});
|
|
35
|
+
p(this, "state", this.properties({
|
|
36
|
+
src: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "",
|
|
39
|
+
observer: async (e) => {
|
|
40
|
+
const o = new Image();
|
|
41
|
+
if (this.updateContainerClasslist(), this.lazy) {
|
|
42
|
+
const f = new IntersectionObserver((b) => {
|
|
43
|
+
b[0].intersectionRatio <= 0 || (f.disconnect(), o.src = this.src);
|
|
44
|
+
});
|
|
45
|
+
f.observe(this);
|
|
46
|
+
} else
|
|
47
|
+
o.src = e;
|
|
48
|
+
o.onload = () => {
|
|
49
|
+
t(this, l).setAttribute("src", e), t(this, c).imageStatus = "success", this.updateContainerClasslist(), this.emit("load");
|
|
50
|
+
}, o.onerror = () => {
|
|
51
|
+
t(this, c).imageStatus = "error", this.updateContainerClasslist(), this.emit("error");
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
width: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "",
|
|
58
|
+
observer: (e) => {
|
|
59
|
+
if (!CSS.supports("width", e))
|
|
60
|
+
return console.warn(
|
|
61
|
+
`[EaImage] The width value ${e} is not supported.`
|
|
62
|
+
);
|
|
63
|
+
this.style.setProperty("--ea-image-width", e);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
height: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: "",
|
|
69
|
+
observer: (e) => {
|
|
70
|
+
if (!CSS.supports("height", e))
|
|
71
|
+
return console.warn(
|
|
72
|
+
`[EaImage] The height value ${e} is not supported.`
|
|
73
|
+
);
|
|
74
|
+
this.style.setProperty("--ea-image-height", e);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
fit: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: "",
|
|
80
|
+
observer: (e) => {
|
|
81
|
+
if (!CSS.supports("object-fit", e))
|
|
82
|
+
return console.warn(
|
|
83
|
+
`[EaImage] The object-fit value ${e} is not supported.`
|
|
84
|
+
);
|
|
85
|
+
this.style.setProperty("--ea-image-fit", e);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
alt: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: "",
|
|
91
|
+
observer: (e) => {
|
|
92
|
+
t(this, l).alt = e;
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
loading: {
|
|
96
|
+
type: ["lazy", "eager"],
|
|
97
|
+
default: "eager",
|
|
98
|
+
observer: (e) => {
|
|
99
|
+
t(this, l).setAttribute("loading", e);
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
referrerpolicy: {
|
|
103
|
+
type: String,
|
|
104
|
+
default: "",
|
|
105
|
+
observer: (e) => {
|
|
106
|
+
t(this, l).setAttribute("referrerpolicy", e);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
crossorigin: {
|
|
110
|
+
type: String,
|
|
111
|
+
default: "",
|
|
112
|
+
observer: (e) => {
|
|
113
|
+
t(this, l).setAttribute("sizes", e);
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
lazy: {
|
|
117
|
+
type: Boolean,
|
|
118
|
+
default: !1,
|
|
119
|
+
observer: () => {
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
preview: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: !1,
|
|
125
|
+
observer: async (e) => {
|
|
126
|
+
e && await import("./ea-image-preview.js");
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"hide-on-click-modal": {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
default: !1,
|
|
132
|
+
observer: async (e) => {
|
|
133
|
+
this.preview && (await customElements.whenDefined("ea-image-preview"), t(this, r)["hide-on-click-modal"] = e);
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"z-index": {
|
|
137
|
+
type: Number,
|
|
138
|
+
default: 2e3,
|
|
139
|
+
observer: async (e) => {
|
|
140
|
+
this.preview && (await customElements.whenDefined("ea-image-preview"), t(this, r)["z-index"] = e);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"initial-index": {
|
|
144
|
+
type: Number,
|
|
145
|
+
default: 0,
|
|
146
|
+
observer: async (e) => {
|
|
147
|
+
this.preview && (await customElements.whenDefined("ea-image-preview"), t(this, r)["initial-index"] = e);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"close-on-press-escape": {
|
|
151
|
+
type: Boolean,
|
|
152
|
+
default: !0,
|
|
153
|
+
observer: async (e) => {
|
|
154
|
+
this.preview && (await customElements.whenDefined("ea-image-preview"), t(this, r)["close-on-press-escape"] = e);
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
infinite: {
|
|
158
|
+
type: Boolean,
|
|
159
|
+
default: !0,
|
|
160
|
+
observer: async (e) => {
|
|
161
|
+
this.preview && (await customElements.whenDefined("ea-image-preview"), t(this, r).infinite = e);
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"zoom-rate": {
|
|
165
|
+
type: Number,
|
|
166
|
+
default: 1.2,
|
|
167
|
+
observer: async (e) => {
|
|
168
|
+
this.preview && (await customElements.whenDefined("ea-image-preview"), t(this, r)["zoom-rate"] = e);
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
scale: {
|
|
172
|
+
type: Number,
|
|
173
|
+
default: 1,
|
|
174
|
+
observer: async (e) => {
|
|
175
|
+
this.preview && (await customElements.whenDefined("ea-image-preview"), t(this, r).scale = e);
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"min-scale": {
|
|
179
|
+
type: Number,
|
|
180
|
+
default: 0.2,
|
|
181
|
+
observer: async (e) => {
|
|
182
|
+
this.preview && (await customElements.whenDefined("ea-image-preview"), t(this, r)["min-scale"] = e);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"max-scale": {
|
|
186
|
+
type: Number,
|
|
187
|
+
default: 7,
|
|
188
|
+
observer: async (e) => {
|
|
189
|
+
this.preview && (await customElements.whenDefined("ea-image-preview"), t(this, r)["max-scale"] = e);
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"show-progress": {
|
|
193
|
+
type: Boolean,
|
|
194
|
+
default: !1,
|
|
195
|
+
observer: async (e) => {
|
|
196
|
+
this.preview && (await customElements.whenDefined("ea-image-preview"), t(this, r)["show-progress"] = e);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}));
|
|
200
|
+
p(this, "propState", this.properties({
|
|
201
|
+
previewSrcList: {
|
|
202
|
+
props: !0,
|
|
203
|
+
type: Array,
|
|
204
|
+
default: () => [],
|
|
205
|
+
/** @param {String[]} newVal */
|
|
206
|
+
observer: async (e) => {
|
|
207
|
+
if (!this.preview)
|
|
208
|
+
return console.warn("[EaImage] Preview is not enabled.");
|
|
209
|
+
await customElements.whenDefined("ea-image-preview"), t(this, r).urlList = e;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}));
|
|
213
|
+
/**
|
|
214
|
+
* 处理 slotchange 事件,动态设置 slot 属性以传递给 ea-image-preview
|
|
215
|
+
* @param {HTMLSlotElement} slotElement
|
|
216
|
+
* @param {string} slotName
|
|
217
|
+
*/
|
|
218
|
+
a(this, g, (e, o) => {
|
|
219
|
+
e.assignedNodes({ flatten: !0 }).some(
|
|
220
|
+
(y) => y.nodeType === Node.ELEMENT_NODE || y.nodeType === Node.TEXT_NODE && y.textContent.trim()
|
|
221
|
+
) ? e.setAttribute("slot", o) : e.removeAttribute("slot");
|
|
222
|
+
});
|
|
223
|
+
/**
|
|
224
|
+
* 设置当前项
|
|
225
|
+
* @param {Number} index
|
|
226
|
+
*/
|
|
227
|
+
p(this, "setActiveItem", (e) => {
|
|
228
|
+
this.preview && t(this, r).setActiveItem(e);
|
|
229
|
+
});
|
|
230
|
+
/**
|
|
231
|
+
* 重置预览器的所有状态
|
|
232
|
+
*/
|
|
233
|
+
p(this, "reset", () => {
|
|
234
|
+
this.preview && t(this, r).reset();
|
|
235
|
+
});
|
|
236
|
+
/**
|
|
237
|
+
* 显示预览(ea-image-preview)
|
|
238
|
+
*/
|
|
239
|
+
p(this, "showPreview", () => {
|
|
240
|
+
t(this, r).visible = !0;
|
|
241
|
+
});
|
|
242
|
+
this.stylesheet = D, this.$render();
|
|
243
|
+
}
|
|
244
|
+
static get observedAttributes() {
|
|
245
|
+
return [
|
|
246
|
+
...super.observedAttributes,
|
|
247
|
+
"width",
|
|
248
|
+
"height",
|
|
249
|
+
"src",
|
|
250
|
+
"fit",
|
|
251
|
+
"alt",
|
|
252
|
+
"referrerpolicy",
|
|
253
|
+
"crossorigin",
|
|
254
|
+
"loading",
|
|
255
|
+
"lazy",
|
|
256
|
+
"preview",
|
|
257
|
+
"hide-on-click-modal",
|
|
258
|
+
"z-index",
|
|
259
|
+
"initial-index",
|
|
260
|
+
"close-on-press-escape",
|
|
261
|
+
"infinite",
|
|
262
|
+
"zoom-rate",
|
|
263
|
+
"scale",
|
|
264
|
+
"min-scale",
|
|
265
|
+
"max-scale",
|
|
266
|
+
"show-progress"
|
|
267
|
+
];
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* 获取 classlist 列表
|
|
271
|
+
* @return {string} 属性值
|
|
272
|
+
*/
|
|
273
|
+
updateContainerClasslist() {
|
|
274
|
+
const e = this.computedClasslist("ea-image", {
|
|
275
|
+
[`--${t(this, c).imageStatus}`]: t(this, c).imageStatus
|
|
276
|
+
});
|
|
277
|
+
return t(this, m).className = e, e;
|
|
278
|
+
}
|
|
279
|
+
$render() {
|
|
280
|
+
this.shadowRoot.innerHTML = `
|
|
281
|
+
<div class='ea-image' part='container'>
|
|
282
|
+
<img class='ea-image__image' part='image' />
|
|
283
|
+
<section class='ea-image__error' part='error'>
|
|
284
|
+
<slot name='error'>FAILED</slot>
|
|
285
|
+
</section>
|
|
286
|
+
<section class='ea-image__placeholder' part='placeholder'>
|
|
287
|
+
<slot name='placeholder'></slot>
|
|
288
|
+
</section>
|
|
289
|
+
</div>
|
|
290
|
+
<ea-image-preview class="ea-image-preview" part='preview'>
|
|
291
|
+
<slot name='progress'></slot>
|
|
292
|
+
<slot name='toolbar'></slot>
|
|
293
|
+
</ea-image-preview>
|
|
294
|
+
`, n(this, m, this.shadowRoot.querySelector(".ea-image")), n(this, l, this.shadowRoot.querySelector(".ea-image__image")), n(this, w, this.shadowRoot.querySelector(".ea-image__error")), n(this, v, this.shadowRoot.querySelector(".ea-image__placeholder")), n(this, r, this.shadowRoot.querySelector(".ea-image-preview")), n(this, u, this.shadowRoot.querySelector('slot[name="progress"]')), n(this, d, this.shadowRoot.querySelector('slot[name="toolbar"]'));
|
|
295
|
+
}
|
|
296
|
+
async connectedCallback() {
|
|
297
|
+
var e;
|
|
298
|
+
super.connectedCallback(), (e = t(this, h)) == null || e.abort(), n(this, h, new AbortController()), this.getAttribute("src") || this.setAttribute("src", ""), t(this, u).addEventListener(
|
|
299
|
+
"slotchange",
|
|
300
|
+
() => t(this, g).call(this, t(this, u), "progress"),
|
|
301
|
+
{
|
|
302
|
+
signal: t(this, h).signal
|
|
303
|
+
}
|
|
304
|
+
), t(this, d).addEventListener(
|
|
305
|
+
"slotchange",
|
|
306
|
+
() => t(this, g).call(this, t(this, d), "toolbar"),
|
|
307
|
+
{
|
|
308
|
+
signal: t(this, h).signal
|
|
309
|
+
}
|
|
310
|
+
), this.preview && (await customElements.whenDefined("ea-image-preview"), t(this, m).addEventListener(
|
|
311
|
+
"click",
|
|
312
|
+
() => {
|
|
313
|
+
this.showPreview();
|
|
314
|
+
},
|
|
315
|
+
{ signal: t(this, h).signal }
|
|
316
|
+
));
|
|
317
|
+
}
|
|
318
|
+
$beforeUnmounted() {
|
|
319
|
+
var e;
|
|
320
|
+
(e = t(this, h)) == null || e.abort();
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
m = new WeakMap(), l = new WeakMap(), w = new WeakMap(), v = new WeakMap(), r = new WeakMap(), u = new WeakMap(), d = new WeakMap(), h = new WeakMap(), c = new WeakMap(), g = new WeakMap();
|
|
324
|
+
window.customElements.get("ea-image") || window.customElements.define("ea-image", _);
|
|
325
|
+
export {
|
|
326
|
+
_ as EaImage
|
|
327
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var u = (t) => {
|
|
3
|
+
throw TypeError(t);
|
|
4
|
+
};
|
|
5
|
+
var m = (t, s, e) => s in t ? p(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
6
|
+
var b = (t, s, e) => m(t, typeof s != "symbol" ? s + "" : s, e), f = (t, s, e) => s.has(t) || u("Cannot " + e);
|
|
7
|
+
var i = (t, s, e) => (f(t, s, "read from private field"), e ? e.call(t) : s.get(t)), n = (t, s, e) => s.has(t) ? u("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), d = (t, s, e, c) => (f(t, s, "write to private field"), c ? c.call(t, e) : s.set(t, e), e);
|
|
8
|
+
import { B as v } from "./Base.js";
|
|
9
|
+
import { s as g } from "../css/ea-infinite-scroll.style.js";
|
|
10
|
+
var a, l, r, o;
|
|
11
|
+
class w extends v {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
/** @type {HTMLElement} */
|
|
15
|
+
n(this, a);
|
|
16
|
+
/** @type {HTMLElement} */
|
|
17
|
+
n(this, l);
|
|
18
|
+
/** @type {AbortController} */
|
|
19
|
+
n(this, r);
|
|
20
|
+
n(this, o, {
|
|
21
|
+
/** @type {IntersectionObserver | null} */
|
|
22
|
+
observer: null
|
|
23
|
+
});
|
|
24
|
+
b(this, "state", this.properties({
|
|
25
|
+
status: {
|
|
26
|
+
type: ["finished", "loading", "noMore"],
|
|
27
|
+
default: "finished",
|
|
28
|
+
/** @param {"loading" | "finished" | "noMore"} newVal */
|
|
29
|
+
observer: () => {
|
|
30
|
+
this.updateContainerClasslist();
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
distance: {
|
|
34
|
+
type: Number,
|
|
35
|
+
default: 0,
|
|
36
|
+
observer: () => {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
this.stylesheet = g, this.$render();
|
|
41
|
+
}
|
|
42
|
+
static get observedAttributes() {
|
|
43
|
+
return [...super.observedAttributes, "distance", "status"];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 获取 classlist 列表
|
|
47
|
+
* @return {string} 属性值
|
|
48
|
+
*/
|
|
49
|
+
updateContainerClasslist() {
|
|
50
|
+
const e = this.computedClasslist(
|
|
51
|
+
"ea-infinite-scroll",
|
|
52
|
+
{},
|
|
53
|
+
{
|
|
54
|
+
[this.status]: this.status
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
return i(this, a).className = e, e;
|
|
58
|
+
}
|
|
59
|
+
$render() {
|
|
60
|
+
this.shadowRoot.innerHTML = `
|
|
61
|
+
<section class='ea-infinite-scroll' part='container'>
|
|
62
|
+
<slot></slot>
|
|
63
|
+
<div class='ea-infinite-scroll__placeholder' part='placeholder'></div>
|
|
64
|
+
<section class='ea-infinite-scroll__loading' part='loading'>
|
|
65
|
+
<slot name='loading'></slot>
|
|
66
|
+
</section>
|
|
67
|
+
<section class='ea-infinite-scroll__noMore' part='noMore'>
|
|
68
|
+
<slot name='noMore'></slot>
|
|
69
|
+
</section>
|
|
70
|
+
</section>
|
|
71
|
+
`, d(this, a, this.shadowRoot.querySelector(".ea-infinite-scroll")), d(this, l, this.shadowRoot.querySelector(
|
|
72
|
+
".ea-infinite-scroll__placeholder"
|
|
73
|
+
));
|
|
74
|
+
}
|
|
75
|
+
connectedCallback() {
|
|
76
|
+
var e;
|
|
77
|
+
super.connectedCallback(), (e = i(this, r)) == null || e.abort(), d(this, r, new AbortController()), i(this, o).observer = new IntersectionObserver(
|
|
78
|
+
(c) => {
|
|
79
|
+
this.status === "finished" && c.forEach(async (h) => {
|
|
80
|
+
h.isIntersecting && (i(this, o).observer.unobserve(h.target), this.status = "loading", this.emit("loadmore", {
|
|
81
|
+
detail: {
|
|
82
|
+
finished: () => {
|
|
83
|
+
this.status = "finished", i(this, o).observer.observe(h.target);
|
|
84
|
+
},
|
|
85
|
+
noMore: () => {
|
|
86
|
+
this.status = "noMore", i(this, o).observer.observe(h.target);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
bubbles: !0
|
|
90
|
+
}));
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
rootMargin: this.distance + "px"
|
|
95
|
+
}
|
|
96
|
+
), i(this, o).observer.observe(i(this, l)), this.shadowRoot.addEventListener("slotchange", () => {
|
|
97
|
+
this.emit("slotchange", { bubbles: !0, composed: !0 });
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
$beforeUnmounted() {
|
|
101
|
+
var e;
|
|
102
|
+
(e = i(this, r)) == null || e.abort(), i(this, o).observer.disconnect();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
a = new WeakMap(), l = new WeakMap(), r = new WeakMap(), o = new WeakMap();
|
|
106
|
+
window.customElements.get("ea-infinite-scroll") || window.customElements.define("ea-infinite-scroll", w);
|
|
107
|
+
export {
|
|
108
|
+
w as EaInfiniteScroll
|
|
109
|
+
};
|