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,85 +0,0 @@
|
|
|
1
|
-
var p = Object.defineProperty;
|
|
2
|
-
var h = (e) => {
|
|
3
|
-
throw TypeError(e);
|
|
4
|
-
};
|
|
5
|
-
var f = (e, s, t) => s in e ? p(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
|
|
6
|
-
var l = (e, s, t) => f(e, typeof s != "symbol" ? s + "" : s, t), u = (e, s, t) => s.has(e) || h("Cannot " + t);
|
|
7
|
-
var d = (e, s, t) => (u(e, s, "read from private field"), t ? t.call(e) : s.get(e)), i = (e, s, t) => s.has(e) ? h("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), n = (e, s, t, c) => (u(e, s, "write to private field"), c ? c.call(e, t) : s.set(e, t), t);
|
|
8
|
-
import { B as m } from "./Base.js";
|
|
9
|
-
import { s as v } from "../css/ea-card.style.js";
|
|
10
|
-
var a, r, o;
|
|
11
|
-
class w extends m {
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
/** @type {HTMLElement} */
|
|
15
|
-
i(this, a);
|
|
16
|
-
/** @type {HTMLElement} */
|
|
17
|
-
i(this, r);
|
|
18
|
-
/** @type {HTMLElement} */
|
|
19
|
-
i(this, o);
|
|
20
|
-
l(this, "state", this.properties({
|
|
21
|
-
shadow: {
|
|
22
|
-
type: ["always", "never", "hover"],
|
|
23
|
-
default: "always",
|
|
24
|
-
observer: () => {
|
|
25
|
-
this.updateContainerClasslist();
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
header: {
|
|
29
|
-
type: String,
|
|
30
|
-
default: "",
|
|
31
|
-
observer: (t) => {
|
|
32
|
-
d(this, r).innerText = t;
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
footer: {
|
|
36
|
-
type: String,
|
|
37
|
-
default: "",
|
|
38
|
-
observer: (t) => {
|
|
39
|
-
d(this, o).innerText = t;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}));
|
|
43
|
-
this.stylesheet = v, this.$render();
|
|
44
|
-
}
|
|
45
|
-
static get observedAttributes() {
|
|
46
|
-
return [...super.observedAttributes, "shadow", "header", "footer"];
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 获取 classlist 列表
|
|
50
|
-
* @return {string} 属性值
|
|
51
|
-
*/
|
|
52
|
-
updateContainerClasslist() {
|
|
53
|
-
const t = this.computedClasslist("ea-card", {
|
|
54
|
-
[`--${this.shadow}-shadow`]: this.shadow
|
|
55
|
-
});
|
|
56
|
-
return d(this, a).className = t, t;
|
|
57
|
-
}
|
|
58
|
-
$render() {
|
|
59
|
-
this.shadowRoot.innerHTML = `
|
|
60
|
-
<div class="ea-card" part="container">
|
|
61
|
-
<div class="ea-card__header" part="header">
|
|
62
|
-
<slot name="header"></slot>
|
|
63
|
-
</div>
|
|
64
|
-
<div class="ea-card__content" part="content">
|
|
65
|
-
<slot></slot>
|
|
66
|
-
</div>
|
|
67
|
-
<div class="ea-card__footer" part="footer">
|
|
68
|
-
<slot name="footer"></slot>
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
`, n(this, a, this.shadowRoot.querySelector(".ea-card")), n(this, r, this.shadowRoot.querySelector(
|
|
72
|
-
".ea-card__header > slot[name='header']"
|
|
73
|
-
)), n(this, o, this.shadowRoot.querySelector(
|
|
74
|
-
".ea-card__footer > slot[name='footer']"
|
|
75
|
-
));
|
|
76
|
-
}
|
|
77
|
-
connectedCallback() {
|
|
78
|
-
super.connectedCallback();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
a = new WeakMap(), r = new WeakMap(), o = new WeakMap();
|
|
82
|
-
window.customElements.get("ea-card") || window.customElements.define("ea-card", w);
|
|
83
|
-
export {
|
|
84
|
-
w as EaCard
|
|
85
|
-
};
|
|
@@ -1,415 +0,0 @@
|
|
|
1
|
-
var j = Object.defineProperty;
|
|
2
|
-
var B = (r) => {
|
|
3
|
-
throw TypeError(r);
|
|
4
|
-
};
|
|
5
|
-
var D = (r, n, e) => n in r ? j(r, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[n] = e;
|
|
6
|
-
var T = (r, n, e) => D(r, typeof n != "symbol" ? n + "" : n, e), $ = (r, n, e) => n.has(r) || B("Cannot " + e);
|
|
7
|
-
var t = (r, n, e) => ($(r, n, "read from private field"), e ? e.call(r) : n.get(r)), a = (r, n, e) => n.has(r) ? B("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(r) : n.set(r, e), g = (r, n, e, s) => ($(r, n, "write to private field"), s ? s.call(r, e) : n.set(r, e), e), h = (r, n, e) => ($(r, n, "access private method"), e);
|
|
8
|
-
import { B as N } from "./Base.js";
|
|
9
|
-
import { s as W } from "../css/ea-carousel-item.style.js";
|
|
10
|
-
import { s as X } from "../css/ea-carousel.style.js";
|
|
11
|
-
class Y extends N {
|
|
12
|
-
static get observedAttributes() {
|
|
13
|
-
return [...super.observedAttributes];
|
|
14
|
-
}
|
|
15
|
-
constructor() {
|
|
16
|
-
super(), this.stylesheet = W, this.$render();
|
|
17
|
-
}
|
|
18
|
-
$render() {
|
|
19
|
-
this.shadowRoot.innerHTML = `
|
|
20
|
-
<div class='ea-carousel-item' part='container'>
|
|
21
|
-
<slot></slot>
|
|
22
|
-
</div>
|
|
23
|
-
`;
|
|
24
|
-
}
|
|
25
|
-
connectedCallback() {
|
|
26
|
-
super.connectedCallback();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
window.customElements.get("ea-carousel-item") || window.customElements.define("ea-carousel-item", Y);
|
|
30
|
-
var b, w, _, S, f, p, u, d, v, i, q, E, o, z, O, U, A, I, m, C, x, L, M, H, P, k, R;
|
|
31
|
-
class F extends N {
|
|
32
|
-
constructor() {
|
|
33
|
-
super();
|
|
34
|
-
a(this, o);
|
|
35
|
-
/** @type {HTMLElement} */
|
|
36
|
-
a(this, b);
|
|
37
|
-
/** @type {HTMLElement} */
|
|
38
|
-
a(this, w);
|
|
39
|
-
/** @type {HTMLElement} */
|
|
40
|
-
a(this, _);
|
|
41
|
-
/** @type {HTMLElement} */
|
|
42
|
-
a(this, S);
|
|
43
|
-
/** @type {HTMLElement} */
|
|
44
|
-
a(this, f);
|
|
45
|
-
/** @type {HTMLElement[]} */
|
|
46
|
-
a(this, p, []);
|
|
47
|
-
/** @type {AbortController} */
|
|
48
|
-
a(this, u);
|
|
49
|
-
a(this, d, {
|
|
50
|
-
triggerAbortControllers: new AbortController()
|
|
51
|
-
});
|
|
52
|
-
/** @type {MutationObserver | null} */
|
|
53
|
-
a(this, v, null);
|
|
54
|
-
a(this, i, {
|
|
55
|
-
prevIndex: 0,
|
|
56
|
-
originLength: 0,
|
|
57
|
-
timer: null,
|
|
58
|
-
pause: !1,
|
|
59
|
-
isMouseEnter: !1,
|
|
60
|
-
isEnd: !1,
|
|
61
|
-
isProcessingSlotChange: !1
|
|
62
|
-
});
|
|
63
|
-
T(this, "state", this.properties({
|
|
64
|
-
height: {
|
|
65
|
-
type: String,
|
|
66
|
-
default: "100%",
|
|
67
|
-
observer: (e) => {
|
|
68
|
-
this.style.setProperty("--ea-carousel-height", e);
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
direction: {
|
|
72
|
-
type: ["horizontal", "vertical"],
|
|
73
|
-
default: "horizontal",
|
|
74
|
-
observer: () => {
|
|
75
|
-
this.updateContainerClasslist();
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
index: {
|
|
79
|
-
type: Number,
|
|
80
|
-
default: 0,
|
|
81
|
-
observer: (e, s) => {
|
|
82
|
-
if (t(this, A).call(this, e), t(this, i).isEnd) return t(this, i).isEnd = !1;
|
|
83
|
-
e < 0 ? (e = t(this, p).length - 1, s = 0, t(this, i).isEnd = !0) : e > t(this, p).length - 1 && (s = t(this, p).length - 1, e = 0, t(this, i).isEnd = !0), t(this, i).prevIndex = s, this.emit("change", {
|
|
84
|
-
detail: {
|
|
85
|
-
current: e,
|
|
86
|
-
prev: s
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
trigger: {
|
|
92
|
-
type: ["click", "hover"],
|
|
93
|
-
default: "hover",
|
|
94
|
-
/** @param {'click' | 'hover'} newVal */
|
|
95
|
-
observer: (e) => {
|
|
96
|
-
var s;
|
|
97
|
-
(s = t(this, d).triggerAbortControllers) == null || s.abort(), t(this, d).triggerAbortControllers = new AbortController(), t(this, f).addEventListener(
|
|
98
|
-
e === "hover" ? "mouseover" : "click",
|
|
99
|
-
t(this, M),
|
|
100
|
-
{
|
|
101
|
-
signal: t(this, d).triggerAbortControllers.signal
|
|
102
|
-
}
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
interval: {
|
|
107
|
-
type: Number,
|
|
108
|
-
default: 3e3,
|
|
109
|
-
observer: () => {
|
|
110
|
-
h(this, o, m).call(this), this.autoplay && h(this, o, C).call(this);
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
arrow: {
|
|
114
|
-
type: ["never", "always", "hover"],
|
|
115
|
-
default: "hover",
|
|
116
|
-
observer: () => {
|
|
117
|
-
this.updateContainerClasslist();
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
autoplay: {
|
|
121
|
-
type: Boolean,
|
|
122
|
-
default: !0,
|
|
123
|
-
observer: (e) => {
|
|
124
|
-
h(this, o, m).call(this), e && h(this, o, C).call(this);
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
loop: {
|
|
128
|
-
type: Boolean,
|
|
129
|
-
default: !0,
|
|
130
|
-
observer: () => {
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
"pause-on-hover": {
|
|
134
|
-
type: Boolean,
|
|
135
|
-
default: !0,
|
|
136
|
-
observer: () => {
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
"indicator-position": {
|
|
140
|
-
type: ["", "none", "outside"],
|
|
141
|
-
default: "",
|
|
142
|
-
observer: () => {
|
|
143
|
-
this.updateContainerClasslist();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}));
|
|
147
|
-
/**
|
|
148
|
-
* 处理 index 溢出的情况
|
|
149
|
-
* @return {number}
|
|
150
|
-
*/
|
|
151
|
-
a(this, q, () => this.index === t(this, p).length ? 0 : this.index === -1 ? t(this, p).length - 1 : this.index);
|
|
152
|
-
/**
|
|
153
|
-
* 渲染 轮播图指示器,为了避免vue组件缓存,所以在初始化和组件挂载时都进行渲染
|
|
154
|
-
*/
|
|
155
|
-
a(this, E, () => {
|
|
156
|
-
const e = Array.from(
|
|
157
|
-
this.querySelectorAll("ea-carousel-item:not([slot])"),
|
|
158
|
-
(s, l) => `<button class='ea-carousel__indicator' part='indicator' tabindex="1" data-index="${l}"></button>`
|
|
159
|
-
).join("");
|
|
160
|
-
t(this, f).innerHTML = e, g(this, p, [
|
|
161
|
-
...t(this, f).querySelectorAll(".ea-carousel__indicator")
|
|
162
|
-
]);
|
|
163
|
-
});
|
|
164
|
-
/**
|
|
165
|
-
* 更新轮播图位置
|
|
166
|
-
* @param {number} index
|
|
167
|
-
*/
|
|
168
|
-
a(this, A, (e = 0) => {
|
|
169
|
-
const { width: s, height: l } = t(this, b).getBoundingClientRect(), c = this.direction === "horizontal" ? "X" : "Y", y = this.direction === "horizontal" ? s : l;
|
|
170
|
-
this.style.setProperty(
|
|
171
|
-
"--ea-carousel-transform",
|
|
172
|
-
`translate${c}(-${(e + 1) * y}px)`
|
|
173
|
-
), t(this, I).call(this);
|
|
174
|
-
});
|
|
175
|
-
/**
|
|
176
|
-
* 更新指示器位置
|
|
177
|
-
*/
|
|
178
|
-
a(this, I, () => {
|
|
179
|
-
t(this, p).forEach((e, s) => {
|
|
180
|
-
e.classList.toggle("is-active", s === t(this, q).call(this));
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
/**
|
|
184
|
-
* 开启轮播图过渡属性
|
|
185
|
-
*/
|
|
186
|
-
a(this, x, () => {
|
|
187
|
-
this.clientHeight, this.style.removeProperty("--ea-carousel-transition");
|
|
188
|
-
});
|
|
189
|
-
/**
|
|
190
|
-
* 关闭轮播图过渡属性
|
|
191
|
-
*/
|
|
192
|
-
a(this, L, () => {
|
|
193
|
-
this.style.setProperty("--ea-carousel-transition", "none"), this.clientHeight;
|
|
194
|
-
});
|
|
195
|
-
/**
|
|
196
|
-
* 指示器 处理事件,需要按照 `this.trigger` 来确定事件名
|
|
197
|
-
* @param {MouseEvent} e
|
|
198
|
-
*/
|
|
199
|
-
a(this, M, (e) => {
|
|
200
|
-
const s = t(this, f).querySelectorAll(
|
|
201
|
-
".ea-carousel__indicator"
|
|
202
|
-
), l = e.target.closest(".ea-carousel__indicator");
|
|
203
|
-
l && s.forEach((c, y) => {
|
|
204
|
-
c.classList.toggle("is-active", c === l), c === l && (this.index = y);
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
/**
|
|
208
|
-
* 轮播图切换结束事件,即能确保轮播图在视觉上连续
|
|
209
|
-
*/
|
|
210
|
-
a(this, H, () => {
|
|
211
|
-
t(this, L).call(this), h(this, o, m).call(this), this.index = t(this, q).call(this), this.autoplay && !t(this, i).isMouseEnter && h(this, o, C).call(this), t(this, x).call(this), t(this, i).pause = !1;
|
|
212
|
-
});
|
|
213
|
-
/**
|
|
214
|
-
* 箭头显示事件
|
|
215
|
-
*/
|
|
216
|
-
a(this, P, () => {
|
|
217
|
-
const e = () => {
|
|
218
|
-
t(this, i).isMouseEnter = !1, this["pause-on-hover"] && h(this, o, C).call(this), this.updateContainerClasslist();
|
|
219
|
-
};
|
|
220
|
-
t(this, i).isMouseEnter = !0, this["pause-on-hover"] && h(this, o, m).call(this), this.updateContainerClasslist(), t(this, b).addEventListener("mouseleave", e, {
|
|
221
|
-
signal: t(this, u).signal,
|
|
222
|
-
once: !0
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
/**
|
|
226
|
-
* 当窗口大小变化时,更新轮播图位置
|
|
227
|
-
*/
|
|
228
|
-
a(this, k, () => {
|
|
229
|
-
let e = null;
|
|
230
|
-
return {
|
|
231
|
-
listener: () => {
|
|
232
|
-
clearTimeout(e), e = null, e = setTimeout(() => {
|
|
233
|
-
t(this, A).call(this, this.index);
|
|
234
|
-
}, 100);
|
|
235
|
-
},
|
|
236
|
-
unsetHandler: () => {
|
|
237
|
-
clearTimeout(e), e = null;
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
});
|
|
241
|
-
/**
|
|
242
|
-
* 处理 slotchange 事件,当 slot 内容变化时重新渲染
|
|
243
|
-
*/
|
|
244
|
-
a(this, R, () => {
|
|
245
|
-
t(this, i).isProcessingSlotChange || (t(this, i).isProcessingSlotChange = !0, t(this, L).call(this), h(this, o, m).call(this), t(this, i).prevIndex = 0, t(this, i).originLength = 0, t(this, i).pause = !1, t(this, i).isEnd = !1, this.index = 0, t(this, E).call(this), h(this, o, z).call(this), t(this, I).call(this), this.autoplay && h(this, o, C).call(this), queueMicrotask(() => {
|
|
246
|
-
t(this, x).call(this), t(this, i).isProcessingSlotChange = !1;
|
|
247
|
-
}));
|
|
248
|
-
});
|
|
249
|
-
/**
|
|
250
|
-
* 上一张轮播图
|
|
251
|
-
*/
|
|
252
|
-
T(this, "prev", () => {
|
|
253
|
-
t(this, i).pause || (this.index--, t(this, i).pause = !0);
|
|
254
|
-
});
|
|
255
|
-
/**
|
|
256
|
-
* 下一张轮播图
|
|
257
|
-
*/
|
|
258
|
-
T(this, "next", () => {
|
|
259
|
-
t(this, i).pause || (this.index++, t(this, i).pause = !0);
|
|
260
|
-
});
|
|
261
|
-
this.stylesheet = X, this.$render();
|
|
262
|
-
}
|
|
263
|
-
static get observedAttributes() {
|
|
264
|
-
return [
|
|
265
|
-
...super.observedAttributes,
|
|
266
|
-
"height",
|
|
267
|
-
"index",
|
|
268
|
-
"trigger",
|
|
269
|
-
"autoplay",
|
|
270
|
-
"interval",
|
|
271
|
-
"indicator-position",
|
|
272
|
-
"arrow",
|
|
273
|
-
// "type",
|
|
274
|
-
// "card-scale",
|
|
275
|
-
"loop",
|
|
276
|
-
"direction",
|
|
277
|
-
"pause-on-hover"
|
|
278
|
-
// "motion-blur",
|
|
279
|
-
];
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* 获取 classlist 列表
|
|
283
|
-
* @return {string} 属性值
|
|
284
|
-
*/
|
|
285
|
-
updateContainerClasslist() {
|
|
286
|
-
const e = this.computedClasslist(
|
|
287
|
-
"ea-carousel",
|
|
288
|
-
{
|
|
289
|
-
["--" + this.direction]: this.direction
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
["arrow-" + this.arrow]: this.arrow === "always" || this.arrow === "never" || t(this, i).isMouseEnter,
|
|
293
|
-
[this["indicator-position"] + "-indicator"]: this["indicator-position"]
|
|
294
|
-
}
|
|
295
|
-
);
|
|
296
|
-
return t(this, b).className = e, e;
|
|
297
|
-
}
|
|
298
|
-
$render() {
|
|
299
|
-
this.shadowRoot.innerHTML = `
|
|
300
|
-
<div class='ea-carousel' part='container'>
|
|
301
|
-
<button class="ea-carousel__arrow arrow-left" part="arrow-left">
|
|
302
|
-
<ea-icon icon="icon-angle-left" part="arrow-left-icon"></ea-icon>
|
|
303
|
-
</button>
|
|
304
|
-
<button class="ea-carousel__arrow arrow-right" part="arrow-right">
|
|
305
|
-
<ea-icon icon="icon-angle-right" part="arrow-right-icon"></ea-icon>
|
|
306
|
-
</button>
|
|
307
|
-
<ul class="ea-carousel__content" part="content">
|
|
308
|
-
<slot name="clone-last"></slot>
|
|
309
|
-
<slot></slot>
|
|
310
|
-
<slot name="clone-first"></slot>
|
|
311
|
-
</ul>
|
|
312
|
-
<footer class="ea-carousel__indicator-wrap" part="indicator-wrap">
|
|
313
|
-
|
|
314
|
-
</footer>
|
|
315
|
-
</div>
|
|
316
|
-
`, g(this, b, this.shadowRoot.querySelector(".ea-carousel")), g(this, w, this.shadowRoot.querySelector(".ea-carousel__content")), g(this, f, this.shadowRoot.querySelector(
|
|
317
|
-
".ea-carousel__indicator-wrap"
|
|
318
|
-
)), g(this, _, this.shadowRoot.querySelector(
|
|
319
|
-
".ea-carousel__arrow.arrow-left"
|
|
320
|
-
)), g(this, S, this.shadowRoot.querySelector(
|
|
321
|
-
".ea-carousel__arrow.arrow-right"
|
|
322
|
-
)), t(this, E).call(this), this.updateContainerClasslist();
|
|
323
|
-
}
|
|
324
|
-
connectedCallback() {
|
|
325
|
-
var e, s;
|
|
326
|
-
super.connectedCallback(), (e = t(this, u)) == null || e.abort(), g(this, u, new AbortController());
|
|
327
|
-
for (const l in t(this, d))
|
|
328
|
-
(s = t(this, d)[l]) == null || s.abort(), t(this, d)[l] = new AbortController();
|
|
329
|
-
t(this, L).call(this), h(this, o, m).call(this), t(this, E).call(this), h(this, o, z).call(this), this.autoplay && h(this, o, C).call(this), t(this, f).addEventListener(
|
|
330
|
-
this.trigger === "hover" ? "mouseover" : "click",
|
|
331
|
-
t(this, M),
|
|
332
|
-
{
|
|
333
|
-
signal: t(this, d).triggerAbortControllers.signal
|
|
334
|
-
}
|
|
335
|
-
), t(this, w).addEventListener(
|
|
336
|
-
"transitionend",
|
|
337
|
-
t(this, H),
|
|
338
|
-
{ signal: t(this, u).signal }
|
|
339
|
-
), this.arrow !== "never" && this.direction !== "vertical" && (t(this, _).addEventListener("click", this.prev, {
|
|
340
|
-
signal: t(this, u).signal
|
|
341
|
-
}), t(this, S).addEventListener("click", this.next, {
|
|
342
|
-
signal: t(this, u).signal
|
|
343
|
-
})), t(this, b).addEventListener("mouseenter", t(this, P), {
|
|
344
|
-
signal: t(this, u).signal
|
|
345
|
-
}), window.addEventListener("resize", t(this, k).call(this).listener, {
|
|
346
|
-
signal: t(this, u).signal
|
|
347
|
-
}), t(this, w).querySelector("slot:not([name])").addEventListener("slotchange", t(this, R), {
|
|
348
|
-
signal: t(this, u).signal
|
|
349
|
-
}), queueMicrotask(() => {
|
|
350
|
-
t(this, x).call(this);
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
$beforeUnmounted() {
|
|
354
|
-
var e, s, l, c;
|
|
355
|
-
(e = t(this, u)) == null || e.abort();
|
|
356
|
-
for (const y in t(this, d))
|
|
357
|
-
(s = t(this, d)[y]) == null || s.abort();
|
|
358
|
-
(l = t(this, k).call(this)) == null || l.unsetHandler(), (c = t(this, v)) == null || c.disconnect(), g(this, v, null);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
b = new WeakMap(), w = new WeakMap(), _ = new WeakMap(), S = new WeakMap(), f = new WeakMap(), p = new WeakMap(), u = new WeakMap(), d = new WeakMap(), v = new WeakMap(), i = new WeakMap(), q = new WeakMap(), E = new WeakMap(), o = new WeakSet(), /**
|
|
362
|
-
* 初始化 `轮播图元素` 结构
|
|
363
|
-
*/
|
|
364
|
-
z = function() {
|
|
365
|
-
try {
|
|
366
|
-
const e = this.querySelectorAll("ea-carousel-item:not([slot])");
|
|
367
|
-
if (e.length === 0) return;
|
|
368
|
-
t(this, i).originLength = e.length, this.querySelectorAll(
|
|
369
|
-
'ea-carousel-item[slot^="clone-"]'
|
|
370
|
-
).forEach((y) => y.remove());
|
|
371
|
-
const l = e[0].cloneNode(!0), c = e[e.length - 1].cloneNode(!0);
|
|
372
|
-
l.setAttribute("slot", "clone-first"), c.setAttribute("slot", "clone-last"), this.appendChild(l), this.appendChild(c), h(this, o, O).call(this), queueMicrotask(() => {
|
|
373
|
-
t(this, A).call(this);
|
|
374
|
-
});
|
|
375
|
-
} catch {
|
|
376
|
-
}
|
|
377
|
-
}, /**
|
|
378
|
-
* 设置 MutationObserver 监听 item 内容变化
|
|
379
|
-
*/
|
|
380
|
-
O = function() {
|
|
381
|
-
t(this, v) && t(this, v).disconnect(), g(this, v, new MutationObserver((s) => {
|
|
382
|
-
s.some((c) => c.type === "childList" && c.target.closest("ea-carousel-item:not([slot])")) && h(this, o, U).call(this);
|
|
383
|
-
})), this.querySelectorAll("ea-carousel-item:not([slot])").forEach((s) => {
|
|
384
|
-
t(this, v).observe(s, {
|
|
385
|
-
childList: !0,
|
|
386
|
-
subtree: !0,
|
|
387
|
-
characterData: !0
|
|
388
|
-
});
|
|
389
|
-
});
|
|
390
|
-
}, /**
|
|
391
|
-
* 同步克隆节点的内容
|
|
392
|
-
*/
|
|
393
|
-
U = function() {
|
|
394
|
-
const e = this.querySelectorAll("ea-carousel-item:not([slot])");
|
|
395
|
-
if (e.length === 0) return;
|
|
396
|
-
const s = this.querySelector(
|
|
397
|
-
'ea-carousel-item[slot="clone-first"]'
|
|
398
|
-
), l = this.querySelector('ea-carousel-item[slot="clone-last"]');
|
|
399
|
-
s && e[0] && (s.innerHTML = e[0].innerHTML), l && e[e.length - 1] && (l.innerHTML = e[e.length - 1].innerHTML);
|
|
400
|
-
}, A = new WeakMap(), I = new WeakMap(), /**
|
|
401
|
-
* 清除轮播图自动播放
|
|
402
|
-
*/
|
|
403
|
-
m = function() {
|
|
404
|
-
t(this, i).timer && (clearInterval(t(this, i).timer), t(this, i).timer = null);
|
|
405
|
-
}, /**
|
|
406
|
-
* 处理轮播图自动播放
|
|
407
|
-
*/
|
|
408
|
-
C = function() {
|
|
409
|
-
this.autoplay && (h(this, o, m).call(this), t(this, i).timer = setInterval(this.next, this.interval));
|
|
410
|
-
}, x = new WeakMap(), L = new WeakMap(), M = new WeakMap(), H = new WeakMap(), P = new WeakMap(), k = new WeakMap(), R = new WeakMap();
|
|
411
|
-
window.customElements.get("ea-carousel") || window.customElements.define("ea-carousel", F);
|
|
412
|
-
export {
|
|
413
|
-
F as EaCarousel,
|
|
414
|
-
Y as EaCarouselItem
|
|
415
|
-
};
|