easy-component-ui 3.0.12 → 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.
- package/package.json +308 -304
- package/dist/assets/icon.css +0 -1
- package/dist/components/Base.js +0 -873
- package/dist/components/ea-alert.js +0 -196
- package/dist/components/ea-avatar.js +0 -159
- package/dist/components/ea-backtop.js +0 -136
- package/dist/components/ea-badge.js +0 -144
- package/dist/components/ea-breadcrumb.js +0 -148
- package/dist/components/ea-button.js +0 -265
- package/dist/components/ea-calendar.js +0 -10
- package/dist/components/ea-calendar2.js +0 -671
- package/dist/components/ea-card.js +0 -85
- package/dist/components/ea-carousel.js +0 -415
- package/dist/components/ea-checkbox.js +0 -446
- package/dist/components/ea-collapse.js +0 -313
- package/dist/components/ea-color-picker.js +0 -891
- package/dist/components/ea-container.js +0 -177
- package/dist/components/ea-countdown.js +0 -142
- package/dist/components/ea-date-picker.js +0 -649
- package/dist/components/ea-descriptions.js +0 -474
- package/dist/components/ea-dialog.js +0 -249
- package/dist/components/ea-drawer.js +0 -211
- package/dist/components/ea-dropdown.js +0 -228
- package/dist/components/ea-empty.js +0 -93
- package/dist/components/ea-icon.js +0 -68
- package/dist/components/ea-image-preview.js +0 -488
- package/dist/components/ea-image.js +0 -302
- package/dist/components/ea-infinite-scroll.js +0 -109
- package/dist/components/ea-input-number.js +0 -367
- package/dist/components/ea-input.js +0 -588
- package/dist/components/ea-layout.js +0 -125
- package/dist/components/ea-link.js +0 -101
- package/dist/components/ea-loading.js +0 -151
- package/dist/components/ea-menu.js +0 -433
- package/dist/components/ea-message-box.js +0 -624
- package/dist/components/ea-message.js +0 -251
- package/dist/components/ea-notification.js +0 -331
- package/dist/components/ea-overlay.js +0 -167
- package/dist/components/ea-page-header.js +0 -108
- package/dist/components/ea-pagination.js +0 -481
- package/dist/components/ea-popconfirm.js +0 -275
- package/dist/components/ea-popover.js +0 -123
- package/dist/components/ea-popper.js +0 -203
- package/dist/components/ea-progress.js +0 -286
- package/dist/components/ea-radio.js +0 -364
- package/dist/components/ea-rate.js +0 -241
- package/dist/components/ea-result.js +0 -100
- package/dist/components/ea-scrollbar.js +0 -235
- package/dist/components/ea-segmented.js +0 -215
- package/dist/components/ea-select.js +0 -609
- package/dist/components/ea-skeleton.js +0 -263
- package/dist/components/ea-slider.js +0 -421
- package/dist/components/ea-space.js +0 -123
- package/dist/components/ea-splitter.js +0 -217
- package/dist/components/ea-statistic.js +0 -74
- package/dist/components/ea-steps.js +0 -346
- package/dist/components/ea-switch.js +0 -271
- package/dist/components/ea-table.js +0 -1124
- package/dist/components/ea-tabs.js +0 -501
- package/dist/components/ea-tag.js +0 -228
- package/dist/components/ea-text.js +0 -113
- package/dist/components/ea-time-picker.js +0 -514
- package/dist/components/ea-timeline.js +0 -185
- package/dist/components/ea-tooltip.js +0 -121
- package/dist/components/ea-tour.js +0 -544
- package/dist/components/ea-transfer.js +0 -949
- package/dist/components/ea-tree.js +0 -1125
- package/dist/components/index.js +0 -61
- package/dist/core/FormBase.js +0 -238
- package/dist/css/ea-alert.style.js +0 -4
- package/dist/css/ea-aside.style.js +0 -4
- package/dist/css/ea-avatar.style.js +0 -4
- package/dist/css/ea-backtop.style.js +0 -4
- package/dist/css/ea-badge.style.js +0 -4
- package/dist/css/ea-breadcrumb-item.style.js +0 -4
- package/dist/css/ea-breadcrumb.style.js +0 -4
- package/dist/css/ea-button-group.style.js +0 -4
- package/dist/css/ea-button.style.js +0 -4
- package/dist/css/ea-calendar.style.js +0 -4
- package/dist/css/ea-card.style.js +0 -4
- package/dist/css/ea-carousel-item.style.js +0 -4
- package/dist/css/ea-carousel.style.js +0 -4
- package/dist/css/ea-check-tag.style.js +0 -4
- package/dist/css/ea-checkbox-group.style.js +0 -4
- package/dist/css/ea-checkbox.style.js +0 -4
- package/dist/css/ea-col.style.js +0 -4
- package/dist/css/ea-collapse-item.style.js +0 -4
- package/dist/css/ea-collapse.style.js +0 -4
- package/dist/css/ea-color-picker-panel.style.js +0 -4
- package/dist/css/ea-color-picker.style.js +0 -4
- package/dist/css/ea-container.style.js +0 -4
- package/dist/css/ea-date-picker.style.js +0 -4
- package/dist/css/ea-descriptions-item.style.js +0 -4
- package/dist/css/ea-descriptions.style.js +0 -4
- package/dist/css/ea-dialog.style.js +0 -4
- package/dist/css/ea-drawer.style.js +0 -4
- package/dist/css/ea-dropdown-item.style.js +0 -4
- package/dist/css/ea-dropdown-menu.style.js +0 -4
- package/dist/css/ea-dropdown.style.js +0 -4
- package/dist/css/ea-empty.style.js +0 -4
- package/dist/css/ea-footer.style.js +0 -4
- package/dist/css/ea-header.style.js +0 -4
- package/dist/css/ea-icon.style.js +0 -4
- package/dist/css/ea-image-preview.style.js +0 -4
- package/dist/css/ea-image.style.js +0 -4
- package/dist/css/ea-infinite-scroll.style.js +0 -4
- package/dist/css/ea-input-number.style.js +0 -4
- package/dist/css/ea-input.style.js +0 -4
- package/dist/css/ea-link.style.js +0 -4
- package/dist/css/ea-main.style.js +0 -4
- package/dist/css/ea-menu-item-group.style.js +0 -4
- package/dist/css/ea-menu-item.style.js +0 -4
- package/dist/css/ea-menu.style.js +0 -4
- package/dist/css/ea-message-box.style.js +0 -4
- package/dist/css/ea-message.style.js +0 -4
- package/dist/css/ea-notification.style.js +0 -4
- package/dist/css/ea-option-gropu.style.js +0 -4
- package/dist/css/ea-option.style.js +0 -4
- package/dist/css/ea-overlay.style.js +0 -4
- package/dist/css/ea-page-header.style.js +0 -4
- package/dist/css/ea-pagination.style.js +0 -4
- package/dist/css/ea-popconfirm.style.js +0 -4
- package/dist/css/ea-popover.style.js +0 -4
- package/dist/css/ea-popper.style.js +0 -4
- package/dist/css/ea-progress.style.js +0 -4
- package/dist/css/ea-radio-group.style.js +0 -4
- package/dist/css/ea-radio.style.js +0 -4
- package/dist/css/ea-rate.style.js +0 -4
- package/dist/css/ea-result.style.js +0 -4
- package/dist/css/ea-row.style.js +0 -4
- package/dist/css/ea-scrollbar.style.js +0 -4
- package/dist/css/ea-segmented.style.js +0 -4
- package/dist/css/ea-select.style.js +0 -4
- package/dist/css/ea-skeleton-item.style.js +0 -4
- package/dist/css/ea-skeleton.style.js +0 -4
- package/dist/css/ea-slider.style.js +0 -4
- package/dist/css/ea-space.style.js +0 -4
- package/dist/css/ea-splitter-bar.style.js +0 -4
- package/dist/css/ea-splitter-panel.style.js +0 -4
- package/dist/css/ea-splitter.style.js +0 -4
- package/dist/css/ea-statistic.style.js +0 -4
- package/dist/css/ea-step.style.js +0 -4
- package/dist/css/ea-steps.style.js +0 -4
- package/dist/css/ea-sub-menu.style.js +0 -4
- package/dist/css/ea-switch.style.js +0 -4
- package/dist/css/ea-tab-panel.style.js +0 -4
- package/dist/css/ea-tab.style.js +0 -4
- package/dist/css/ea-table-column.style.js +0 -4
- package/dist/css/ea-table.style.js +0 -4
- package/dist/css/ea-tabs.style.js +0 -4
- package/dist/css/ea-tag.style.js +0 -4
- package/dist/css/ea-text.style.js +0 -4
- package/dist/css/ea-time-picker.style.js +0 -4
- package/dist/css/ea-timeline-item.style.js +0 -4
- package/dist/css/ea-timeline.style.js +0 -4
- package/dist/css/ea-tooltip.style.js +0 -4
- package/dist/css/ea-tour-step.style.js +0 -4
- package/dist/css/ea-tour.style.js +0 -4
- package/dist/css/ea-transfer.style.js +0 -5
- package/dist/css/ea-tree.style.js +0 -6
- package/dist/css/ea-ui-component.style.js +0 -4
- package/dist/favicon.ico +0 -0
- package/dist/utils/Color.js +0 -439
- package/dist/utils/I18nManager.js +0 -218
- package/dist/utils/Utils.js +0 -65
- package/dist/utils/Variables.js +0 -12
- package/dist/utils/parseTime.js +0 -73
- package/dist/utils/timeout.js +0 -9
|
@@ -1,488 +0,0 @@
|
|
|
1
|
-
var J = Object.defineProperty;
|
|
2
|
-
var Z = (l) => {
|
|
3
|
-
throw TypeError(l);
|
|
4
|
-
};
|
|
5
|
-
var K = (l, c, t) => c in l ? J(l, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[c] = t;
|
|
6
|
-
var L = (l, c, t) => K(l, typeof c != "symbol" ? c + "" : c, t), j = (l, c, t) => c.has(l) || Z("Cannot " + t);
|
|
7
|
-
var e = (l, c, t) => (j(l, c, "read from private field"), t ? t.call(l) : c.get(l)), i = (l, c, t) => c.has(l) ? Z("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(l) : c.set(l, t), h = (l, c, t, a) => (j(l, c, "write to private field"), a ? a.call(l, t) : c.set(l, t), t);
|
|
8
|
-
import { EaOverlay as Q } from "./ea-overlay.js";
|
|
9
|
-
import { E as W } from "../utils/Utils.js";
|
|
10
|
-
import "./ea-image.js";
|
|
11
|
-
import { s as V } from "../css/ea-image-preview.style.js";
|
|
12
|
-
var m, M, k, S, C, d, T, q, R, z, A, I, N, P, U, v, p, b, f, n, X, x, _, E, $, B, D, H;
|
|
13
|
-
class ee extends Q {
|
|
14
|
-
constructor() {
|
|
15
|
-
super();
|
|
16
|
-
/** @type {HTMLElement} */
|
|
17
|
-
i(this, m);
|
|
18
|
-
/** @type {HTMLElement} */
|
|
19
|
-
i(this, M);
|
|
20
|
-
/** @type {HTMLElement} */
|
|
21
|
-
i(this, k);
|
|
22
|
-
/** @type {HTMLElement} */
|
|
23
|
-
i(this, S);
|
|
24
|
-
/** @type {HTMLElement} */
|
|
25
|
-
i(this, C);
|
|
26
|
-
/** @type {HTMLElement} */
|
|
27
|
-
i(this, d);
|
|
28
|
-
/** @type {HTMLElement} */
|
|
29
|
-
i(this, T);
|
|
30
|
-
/** @type {HTMLElement} */
|
|
31
|
-
i(this, q);
|
|
32
|
-
/** @type {HTMLElement} */
|
|
33
|
-
i(this, R);
|
|
34
|
-
/** @type {HTMLElement} */
|
|
35
|
-
i(this, z);
|
|
36
|
-
/** @type {HTMLElement} */
|
|
37
|
-
i(this, A);
|
|
38
|
-
/** @type {HTMLElement} */
|
|
39
|
-
i(this, I);
|
|
40
|
-
/** @type {HTMLElement} */
|
|
41
|
-
i(this, N);
|
|
42
|
-
/** @type {HTMLElement} */
|
|
43
|
-
i(this, P);
|
|
44
|
-
/** @type {HTMLElement} */
|
|
45
|
-
i(this, U);
|
|
46
|
-
/** @type {AbortController} */
|
|
47
|
-
i(this, v);
|
|
48
|
-
/** @type {AbortController} */
|
|
49
|
-
i(this, p);
|
|
50
|
-
/** @type {AbortController} */
|
|
51
|
-
i(this, b);
|
|
52
|
-
/** @type {AbortController} */
|
|
53
|
-
i(this, f);
|
|
54
|
-
i(this, n, {
|
|
55
|
-
urlList: [],
|
|
56
|
-
/** @type {"loading" | "success" | "error"} */
|
|
57
|
-
status: "loading",
|
|
58
|
-
dirtyUpdate: !1,
|
|
59
|
-
isUrlListInit: !1,
|
|
60
|
-
position: {
|
|
61
|
-
x: 0,
|
|
62
|
-
y: 0
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
L(this, "state", this.properties({
|
|
66
|
-
visible: {
|
|
67
|
-
type: Boolean,
|
|
68
|
-
default: !1,
|
|
69
|
-
observer: (t) => {
|
|
70
|
-
this.status = t;
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
"initial-index": {
|
|
74
|
-
type: Number,
|
|
75
|
-
default: 0,
|
|
76
|
-
observer: (t) => {
|
|
77
|
-
this.index = t;
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
index: {
|
|
81
|
-
type: Number,
|
|
82
|
-
default: () => this["initial-index"],
|
|
83
|
-
observer: (t, a) => {
|
|
84
|
-
var s;
|
|
85
|
-
if (e(this, n).dirtyUpdate) return e(this, n).dirtyUpdate = !1;
|
|
86
|
-
if (this.infinite) {
|
|
87
|
-
if (!this.urlList.length) return;
|
|
88
|
-
const r = e(this, n).urlList.length - 1;
|
|
89
|
-
if (t > r) return this.index = 0;
|
|
90
|
-
if (t < 0) return this.index = r;
|
|
91
|
-
} else if (t < 0 || t > e(this, n).urlList.length - 1)
|
|
92
|
-
return e(this, n).dirtyUpdate = !0, this.index = a;
|
|
93
|
-
const o = e(this, n).urlList[t];
|
|
94
|
-
if (e(this, d).innerHTML = "", o) {
|
|
95
|
-
(s = e(this, v)) == null || s.abort(), h(this, v, new AbortController()), e(this, d).innerHTML = W.EaElement.h(
|
|
96
|
-
"ea-image",
|
|
97
|
-
"ea-image-preview__img",
|
|
98
|
-
{
|
|
99
|
-
src: o,
|
|
100
|
-
fit: "contain"
|
|
101
|
-
},
|
|
102
|
-
`
|
|
103
|
-
<slot name="viewer-error" slot="error"></slot>
|
|
104
|
-
`
|
|
105
|
-
);
|
|
106
|
-
const r = e(this, d).querySelector(".ea-image-preview__img"), g = () => {
|
|
107
|
-
e(this, n).status = "error", this.classList.remove(
|
|
108
|
-
"ea-image-preview--success",
|
|
109
|
-
"ea-image-preview--loading"
|
|
110
|
-
), e(this, m).classList.add("ea-image-preview--error"), this.emit("error"), e(this, v).abort();
|
|
111
|
-
}, u = () => {
|
|
112
|
-
e(this, n).status = "success", e(this, m).classList.remove(
|
|
113
|
-
"ea-image-preview--error",
|
|
114
|
-
"ea-image-preview--loading"
|
|
115
|
-
), e(this, m).classList.add("ea-image-preview--success"), e(this, v).abort();
|
|
116
|
-
};
|
|
117
|
-
e(this, $).call(this, t + 1, e(this, n).urlList.length), r.addEventListener("error", g, {
|
|
118
|
-
once: !0,
|
|
119
|
-
signal: e(this, v).signal
|
|
120
|
-
}), r.addEventListener("load", u, {
|
|
121
|
-
once: !0,
|
|
122
|
-
signal: e(this, v).signal
|
|
123
|
-
}), this.visible && e(this, n).isUrlListInit && this.emit("switch", {
|
|
124
|
-
detail: {
|
|
125
|
-
index: t,
|
|
126
|
-
url: o,
|
|
127
|
-
imgTarget: r
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
infinite: {
|
|
134
|
-
type: Boolean,
|
|
135
|
-
default: !0,
|
|
136
|
-
observer: () => {
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
"append-to-body": {
|
|
140
|
-
type: Boolean,
|
|
141
|
-
default: !1,
|
|
142
|
-
observer: () => {
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
zoom: {
|
|
146
|
-
type: Number,
|
|
147
|
-
default: 1,
|
|
148
|
-
observer: () => {
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
"zoom-rate": {
|
|
152
|
-
type: Number,
|
|
153
|
-
default: 1.2,
|
|
154
|
-
observer: () => {
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
scale: {
|
|
158
|
-
type: Number,
|
|
159
|
-
default: 1,
|
|
160
|
-
observer: (t, a) => {
|
|
161
|
-
if (t < this["min-scale"] || t > this["max-scale"])
|
|
162
|
-
return this.scale = a;
|
|
163
|
-
e(this, d).style.setProperty("--ea-image-preview-scale", t);
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
"min-scale": {
|
|
167
|
-
type: Number,
|
|
168
|
-
default: 0.2,
|
|
169
|
-
observer: () => {
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
"max-scale": {
|
|
173
|
-
type: Number,
|
|
174
|
-
default: 7,
|
|
175
|
-
observer: () => {
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
"close-on-press-escape": {
|
|
179
|
-
type: Boolean,
|
|
180
|
-
default: !0,
|
|
181
|
-
observer: () => {
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
"show-progress": {
|
|
185
|
-
type: Boolean,
|
|
186
|
-
default: !1,
|
|
187
|
-
observer: () => {
|
|
188
|
-
this.updateContainerClasslist();
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
"hide-on-click-modal": {
|
|
192
|
-
type: Boolean,
|
|
193
|
-
default: !1,
|
|
194
|
-
observer: (t) => {
|
|
195
|
-
var o;
|
|
196
|
-
const a = (s) => {
|
|
197
|
-
!e(this, d).querySelector(".ea-image-preview__img").contains(s.target) && !e(this, k).contains(s.target) && !e(this, S).contains(s.target) && !e(this, C).contains(s.target) && (this.hide(), this.visible = !1);
|
|
198
|
-
};
|
|
199
|
-
(o = e(this, b)) == null || o.abort(), t && (h(this, b, new AbortController()), e(this, m).addEventListener("click", a, {
|
|
200
|
-
signal: e(this, b).signal
|
|
201
|
-
}));
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}));
|
|
205
|
-
L(this, "propState", this.properties({
|
|
206
|
-
urlList: {
|
|
207
|
-
props: !0,
|
|
208
|
-
type: Array,
|
|
209
|
-
default: [],
|
|
210
|
-
/** @param {String[]} newVal */
|
|
211
|
-
observer: (t) => {
|
|
212
|
-
e(this, n).isUrlListInit = !1, e(this, n).urlList = t, this.index = this["initial-index"], e(this, n).isUrlListInit = !0;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}));
|
|
216
|
-
/**
|
|
217
|
-
* 处理挂载到目标
|
|
218
|
-
*/
|
|
219
|
-
i(this, X, () => {
|
|
220
|
-
this["append-to-body"] && document.body.appendChild(this);
|
|
221
|
-
});
|
|
222
|
-
/**
|
|
223
|
-
* 处理切换
|
|
224
|
-
* @param {'prev' | 'next'} action
|
|
225
|
-
*/
|
|
226
|
-
i(this, x, (t) => {
|
|
227
|
-
t === "prev" ? this.index-- : t === "next" && this.index++;
|
|
228
|
-
});
|
|
229
|
-
/**
|
|
230
|
-
* 处理缩放
|
|
231
|
-
* @param {'in' | 'out'} action
|
|
232
|
-
*/
|
|
233
|
-
i(this, _, (t) => {
|
|
234
|
-
t === "in" ? this.scale = (this.scale * this["zoom-rate"]).toFixed(3) : t === "out" && (this.scale = (this.scale / this["zoom-rate"]).toFixed(3));
|
|
235
|
-
});
|
|
236
|
-
/**
|
|
237
|
-
* 处理旋转
|
|
238
|
-
* @param {'left' | 'right' | 'reset'} action
|
|
239
|
-
*/
|
|
240
|
-
i(this, E, (t) => {
|
|
241
|
-
const a = Number(
|
|
242
|
-
e(this, d).style.getPropertyValue("--ea-image-preview-rotate").split("deg")[0] || 0
|
|
243
|
-
);
|
|
244
|
-
let o = 0;
|
|
245
|
-
t === "left" ? o = a - 90 : t === "right" && (o = a + 90), e(this, d).style.setProperty(
|
|
246
|
-
"--ea-image-preview-rotate",
|
|
247
|
-
o + "deg"
|
|
248
|
-
), this.emit("rotate", {
|
|
249
|
-
detail: {
|
|
250
|
-
oldVal: a,
|
|
251
|
-
rotate: o
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
/**
|
|
256
|
-
* 处理进度
|
|
257
|
-
* @param {Number} active
|
|
258
|
-
* @param {Number} total
|
|
259
|
-
* @returns
|
|
260
|
-
*/
|
|
261
|
-
i(this, $, (t, a) => {
|
|
262
|
-
const o = this.querySelector("[slot='progress']"), s = (r, g) => {
|
|
263
|
-
r.forEach((u) => u.textContent = t), g.forEach((u) => u.textContent = a);
|
|
264
|
-
};
|
|
265
|
-
if (o)
|
|
266
|
-
try {
|
|
267
|
-
o.assignedNodes().forEach((g) => {
|
|
268
|
-
const u = g.querySelectorAll("[data-active]"), y = g.querySelectorAll("[data-total]");
|
|
269
|
-
s(u, y);
|
|
270
|
-
});
|
|
271
|
-
} catch {
|
|
272
|
-
const r = o.querySelectorAll("[data-active]"), g = o.querySelectorAll("[data-total]");
|
|
273
|
-
s(r, g);
|
|
274
|
-
}
|
|
275
|
-
else
|
|
276
|
-
e(this, A).textContent = `${t} / ${a}`;
|
|
277
|
-
});
|
|
278
|
-
/**
|
|
279
|
-
* 处理图片移动事件
|
|
280
|
-
* @param {MouseEvent} startE
|
|
281
|
-
*/
|
|
282
|
-
i(this, B, (t) => {
|
|
283
|
-
var y;
|
|
284
|
-
t.preventDefault(), (y = e(this, f)) == null || y.abort(), h(this, f, new AbortController());
|
|
285
|
-
const a = t.clientX, o = t.clientY, s = e(this, n).position.x, r = e(this, n).position.y, g = (w) => {
|
|
286
|
-
w.preventDefault();
|
|
287
|
-
const O = w.clientX - a, F = w.clientY - o, Y = s + O, G = r + F;
|
|
288
|
-
e(this, d).style.setProperty(
|
|
289
|
-
"--ea-image-preview-img-move-x",
|
|
290
|
-
`${Y}px`
|
|
291
|
-
), e(this, d).style.setProperty(
|
|
292
|
-
"--ea-image-preview-img-move-y",
|
|
293
|
-
`${G}px`
|
|
294
|
-
);
|
|
295
|
-
}, u = (w) => {
|
|
296
|
-
var Y;
|
|
297
|
-
w.preventDefault();
|
|
298
|
-
const O = w.clientX - a, F = w.clientY - o;
|
|
299
|
-
e(this, n).position.x = s + O, e(this, n).position.y = r + F, (Y = e(this, f)) == null || Y.abort();
|
|
300
|
-
};
|
|
301
|
-
window.addEventListener("mousemove", g, {
|
|
302
|
-
signal: e(this, f).signal
|
|
303
|
-
}), window.addEventListener("mouseup", u, {
|
|
304
|
-
signal: e(this, f).signal
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
/**
|
|
308
|
-
* 初始化工具栏的事件。
|
|
309
|
-
* 若用户传入了自定义工具,则优先使用用户元素,否则使用内置元素
|
|
310
|
-
*/
|
|
311
|
-
i(this, D, () => {
|
|
312
|
-
const t = this.querySelector("[slot='toolbar']"), a = {
|
|
313
|
-
"switch-prev": {
|
|
314
|
-
el: null,
|
|
315
|
-
callback: () => {
|
|
316
|
-
e(this, x).call(this, "prev");
|
|
317
|
-
}
|
|
318
|
-
},
|
|
319
|
-
"switch-next": {
|
|
320
|
-
el: null,
|
|
321
|
-
callback: () => {
|
|
322
|
-
e(this, x).call(this, "next");
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
|
-
"zoom-out": {
|
|
326
|
-
el: e(this, I),
|
|
327
|
-
callback: () => {
|
|
328
|
-
e(this, _).call(this, "out");
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
"zoom-in": {
|
|
332
|
-
el: e(this, N),
|
|
333
|
-
callback: () => {
|
|
334
|
-
e(this, _).call(this, "in");
|
|
335
|
-
}
|
|
336
|
-
},
|
|
337
|
-
"rotate-anticlockwise": {
|
|
338
|
-
el: e(this, P),
|
|
339
|
-
callback: () => {
|
|
340
|
-
e(this, E).call(this, "left");
|
|
341
|
-
}
|
|
342
|
-
},
|
|
343
|
-
"rotate-clockwise": {
|
|
344
|
-
el: e(this, U),
|
|
345
|
-
callback: () => {
|
|
346
|
-
e(this, E).call(this, "right");
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
for (const [o, s] of Object.entries(a)) {
|
|
351
|
-
let r = !1;
|
|
352
|
-
try {
|
|
353
|
-
t.assignedNodes().forEach((u) => {
|
|
354
|
-
const y = u.querySelector(`[data-action="${o}"]`);
|
|
355
|
-
y && (r = !0, s.el.style.display = "none", y.addEventListener("click", s.callback, {
|
|
356
|
-
signal: e(this, p).signal
|
|
357
|
-
}));
|
|
358
|
-
});
|
|
359
|
-
} catch {
|
|
360
|
-
s.el && (r = !0, s.el.addEventListener("click", s.callback, {
|
|
361
|
-
signal: e(this, p).signal
|
|
362
|
-
}));
|
|
363
|
-
}
|
|
364
|
-
!r && s.el && s.el.addEventListener("click", s.callback, {
|
|
365
|
-
signal: e(this, p).signal
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
/**
|
|
370
|
-
* 关闭 Preview
|
|
371
|
-
*/
|
|
372
|
-
i(this, H, () => {
|
|
373
|
-
this.hide(), this.visible = !1;
|
|
374
|
-
});
|
|
375
|
-
/**
|
|
376
|
-
* 设置当前项
|
|
377
|
-
* @param {Number} index
|
|
378
|
-
*/
|
|
379
|
-
L(this, "setActiveItem", (t) => {
|
|
380
|
-
this.index = t;
|
|
381
|
-
});
|
|
382
|
-
/**
|
|
383
|
-
* 重置状态
|
|
384
|
-
*/
|
|
385
|
-
L(this, "reset", () => {
|
|
386
|
-
this.index = this["initial-index"], this.scale = 1, e(this, E).call(this, "reset"), e(this, n).position = {
|
|
387
|
-
x: 0,
|
|
388
|
-
y: 0
|
|
389
|
-
}, e(this, d).style.setProperty("--ea-image-preview-img-move-x", "0"), e(this, d).style.setProperty("--ea-image-preview-img-move-y", "0");
|
|
390
|
-
});
|
|
391
|
-
h(this, m, this.shadowRoot.querySelector(".ea-overlay")), e(this, m).innerHTML = e(this, m).innerHTML + `
|
|
392
|
-
<header class="ea-image-preview__header" part="header">
|
|
393
|
-
<ea-icon class="ea-image-preview__icon close-icon" icon="icon-cancel" part="icon close-icon"></ea-icon>
|
|
394
|
-
</header>
|
|
395
|
-
<main class="ea-image-preview__main" part="main">
|
|
396
|
-
<ea-icon class="ea-image-preview__icon prev-icon" icon="icon-angle-left" part="icon prev-icon"></ea-icon>
|
|
397
|
-
<ea-icon class="ea-image-preview__icon next-icon" icon="icon-angle-right" part="icon next-icon"></ea-icon>
|
|
398
|
-
</main>
|
|
399
|
-
<footer class="ea-image-preview__footer" part="footer">
|
|
400
|
-
<section class="ea-image-preview__progress" part="progress">
|
|
401
|
-
<slot name="progress"></slot>
|
|
402
|
-
</section>
|
|
403
|
-
<section class="ea-image-preview__toolbar" part="toolbar">
|
|
404
|
-
<ea-icon class="ea-image-preview__icon zoom-out-icon" icon="icon-zoom-out" part="icon zoom-out-icon"></ea-icon>
|
|
405
|
-
<ea-icon class="ea-image-preview__icon zoom-in-icon" icon="icon-zoom-in" part="icon zoom-in-icon"></ea-icon>
|
|
406
|
-
<ea-icon class="ea-image-preview__icon rotate-left-icon" icon="icon-ccw" part="icon rotate-left-icon"></ea-icon>
|
|
407
|
-
<ea-icon class="ea-image-preview__icon rotate-right-icon" icon="icon-cw" part="icon rotate-right-icon"></ea-icon>
|
|
408
|
-
<slot name="toolbar"></slot>
|
|
409
|
-
</section>
|
|
410
|
-
</footer>
|
|
411
|
-
`, h(this, M, this.shadowRoot.querySelector(".ea-overlay__content")), h(this, T, this.shadowRoot.querySelector(".ea-overlay__mask")), h(this, d, this.shadowRoot.querySelector(".ea-overlay__content")), h(this, q, this.shadowRoot.querySelector(".close-icon")), h(this, R, this.shadowRoot.querySelector(".prev-icon")), h(this, z, this.shadowRoot.querySelector(".next-icon")), h(this, I, this.shadowRoot.querySelector(".zoom-in-icon")), h(this, N, this.shadowRoot.querySelector(".zoom-out-icon")), h(this, P, this.shadowRoot.querySelector(".rotate-left-icon")), h(this, U, this.shadowRoot.querySelector(".rotate-right-icon")), h(this, A, this.shadowRoot.querySelector(
|
|
412
|
-
".ea-image-preview__progress slot[name='progress']"
|
|
413
|
-
)), h(this, k, this.shadowRoot.querySelector(".ea-image-preview__header")), h(this, S, this.shadowRoot.querySelector(".ea-image-preview__main")), h(this, C, this.shadowRoot.querySelector(".ea-image-preview__footer")), e(this, X).call(this);
|
|
414
|
-
}
|
|
415
|
-
static get observedAttributes() {
|
|
416
|
-
return [
|
|
417
|
-
...super.observedAttributes,
|
|
418
|
-
"visible",
|
|
419
|
-
"index",
|
|
420
|
-
"initial-index",
|
|
421
|
-
"infinite",
|
|
422
|
-
"zoom-rate",
|
|
423
|
-
"scale",
|
|
424
|
-
"min-scale",
|
|
425
|
-
"max-scale",
|
|
426
|
-
"close-on-press-escape",
|
|
427
|
-
"hide-on-click-modal",
|
|
428
|
-
"show-progress",
|
|
429
|
-
"append-to-body"
|
|
430
|
-
];
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* 获取 classlist 列表
|
|
434
|
-
* @return {string} 属性值
|
|
435
|
-
*/
|
|
436
|
-
updateContainerClasslist() {
|
|
437
|
-
const t = `${super.updateContainerClasslist()} ${this.computedClasslist(
|
|
438
|
-
"ea-image-preview",
|
|
439
|
-
{
|
|
440
|
-
["--" + e(this, n).status]: e(this, n).status
|
|
441
|
-
},
|
|
442
|
-
{
|
|
443
|
-
"show-progress": this["show-progress"]
|
|
444
|
-
}
|
|
445
|
-
)}`;
|
|
446
|
-
return e(this, m).className = t, t;
|
|
447
|
-
}
|
|
448
|
-
connectedCallback() {
|
|
449
|
-
var s;
|
|
450
|
-
super.connectedCallback(), this.assignedStyle(V), (s = e(this, p)) == null || s.abort(), h(this, p, new AbortController());
|
|
451
|
-
const t = () => {
|
|
452
|
-
e(this, x).call(this, "prev");
|
|
453
|
-
}, a = () => {
|
|
454
|
-
e(this, x).call(this, "next");
|
|
455
|
-
}, o = (r) => {
|
|
456
|
-
r.preventDefault(), r.deltaY > 0 ? e(this, _).call(this, "out") : e(this, _).call(this, "in");
|
|
457
|
-
};
|
|
458
|
-
e(this, D).call(this), e(this, q).addEventListener("click", e(this, H), {
|
|
459
|
-
signal: e(this, p).signal
|
|
460
|
-
}), e(this, R).addEventListener("click", t, {
|
|
461
|
-
signal: e(this, p).signal
|
|
462
|
-
}), e(this, z).addEventListener("click", a, {
|
|
463
|
-
signal: e(this, p).signal
|
|
464
|
-
}), e(this, m).addEventListener("wheel", o, {
|
|
465
|
-
signal: e(this, p).signal,
|
|
466
|
-
passive: !1
|
|
467
|
-
}), this.addEventListener("closed", this.reset, {
|
|
468
|
-
signal: e(this, p).signal
|
|
469
|
-
}), e(this, d).addEventListener("mousedown", e(this, B), {
|
|
470
|
-
signal: e(this, p).signal
|
|
471
|
-
}), this["close-on-press-escape"] && window.addEventListener(
|
|
472
|
-
"keydown",
|
|
473
|
-
(r) => {
|
|
474
|
-
r.key === "Escape" && this.hide();
|
|
475
|
-
},
|
|
476
|
-
{ signal: e(this, p).signal }
|
|
477
|
-
);
|
|
478
|
-
}
|
|
479
|
-
$beforeUnmounted() {
|
|
480
|
-
var t, a, o, s;
|
|
481
|
-
(t = e(this, p)) == null || t.abort(), (a = e(this, v)) == null || a.abort(), (o = e(this, f)) == null || o.abort(), (s = e(this, b)) == null || s.abort();
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
m = new WeakMap(), M = new WeakMap(), k = new WeakMap(), S = new WeakMap(), C = new WeakMap(), d = new WeakMap(), T = new WeakMap(), q = new WeakMap(), R = new WeakMap(), z = new WeakMap(), A = new WeakMap(), I = new WeakMap(), N = new WeakMap(), P = new WeakMap(), U = new WeakMap(), v = new WeakMap(), p = new WeakMap(), b = new WeakMap(), f = new WeakMap(), n = new WeakMap(), X = new WeakMap(), x = new WeakMap(), _ = new WeakMap(), E = new WeakMap(), $ = new WeakMap(), B = new WeakMap(), D = new WeakMap(), H = new WeakMap();
|
|
485
|
-
window.customElements.get("ea-image-preview") || window.customElements.define("ea-image-preview", ee);
|
|
486
|
-
export {
|
|
487
|
-
ee as EaImagePreview
|
|
488
|
-
};
|