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,346 +0,0 @@
|
|
|
1
|
-
var $ = Object.defineProperty;
|
|
2
|
-
var q = (s) => {
|
|
3
|
-
throw TypeError(s);
|
|
4
|
-
};
|
|
5
|
-
var B = (s, i, t) => i in s ? $(s, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[i] = t;
|
|
6
|
-
var x = (s, i, t) => B(s, typeof i != "symbol" ? i + "" : i, t), E = (s, i, t) => i.has(s) || q("Cannot " + t);
|
|
7
|
-
var e = (s, i, t) => (E(s, i, "read from private field"), t ? t.call(s) : i.get(s)), a = (s, i, t) => i.has(s) ? q("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, t), n = (s, i, t, r) => (E(s, i, "write to private field"), r ? r.call(s, t) : i.set(s, t), t);
|
|
8
|
-
import { B as R } from "./Base.js";
|
|
9
|
-
import { s as N } from "../css/ea-step.style.js";
|
|
10
|
-
import { s as k } from "../css/ea-steps.style.js";
|
|
11
|
-
var l, p, u, C, c, b, m, S, A;
|
|
12
|
-
class I extends R {
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
a(this, l);
|
|
16
|
-
/** @type {HTMLElement} */
|
|
17
|
-
a(this, u);
|
|
18
|
-
/** @type {HTMLElement} */
|
|
19
|
-
a(this, C);
|
|
20
|
-
/** @type {HTMLElement} */
|
|
21
|
-
a(this, c);
|
|
22
|
-
/** @type {HTMLElement} */
|
|
23
|
-
a(this, b);
|
|
24
|
-
/** @type {HTMLElement} */
|
|
25
|
-
a(this, m);
|
|
26
|
-
/** @type {AbortController} */
|
|
27
|
-
a(this, S, new AbortController());
|
|
28
|
-
x(this, "state", this.properties({
|
|
29
|
-
title: {
|
|
30
|
-
type: String,
|
|
31
|
-
default: "",
|
|
32
|
-
observer: (t) => {
|
|
33
|
-
e(this, b).textContent = t;
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
description: {
|
|
37
|
-
type: String,
|
|
38
|
-
default: "",
|
|
39
|
-
observer: (t) => {
|
|
40
|
-
e(this, m).textContent = t;
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
icon: {
|
|
44
|
-
type: String,
|
|
45
|
-
default: "",
|
|
46
|
-
observer: (t) => {
|
|
47
|
-
e(this, c).setAttribute("icon", t);
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
status: {
|
|
51
|
-
type: ["", "wait", "process", "finish", "error", "success"],
|
|
52
|
-
default: "",
|
|
53
|
-
observer: (t) => {
|
|
54
|
-
this.updateContainerClasslist(), !this.icon && e(this, A).call(this, t);
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
index: {
|
|
58
|
-
type: Number,
|
|
59
|
-
default: () => {
|
|
60
|
-
var r;
|
|
61
|
-
const t = (r = e(this, l, p)) == null ? void 0 : r.querySelectorAll("ea-step");
|
|
62
|
-
return t ? Array.from(t).indexOf(this) : 0;
|
|
63
|
-
},
|
|
64
|
-
observer: () => {
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
simple: {
|
|
68
|
-
type: Boolean,
|
|
69
|
-
default: () => {
|
|
70
|
-
var t;
|
|
71
|
-
return !!((t = e(this, l, p)) != null && t.hasAttribute("simple"));
|
|
72
|
-
},
|
|
73
|
-
observer: () => {
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"align-center": {
|
|
77
|
-
type: Boolean,
|
|
78
|
-
default: () => {
|
|
79
|
-
var t;
|
|
80
|
-
return !!((t = e(this, l, p)) != null && t.hasAttribute("align-center"));
|
|
81
|
-
},
|
|
82
|
-
observer: () => {
|
|
83
|
-
this.updateContainerClasslist();
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
direction: {
|
|
87
|
-
type: ["vertical", "horizontal"],
|
|
88
|
-
default: () => {
|
|
89
|
-
var t;
|
|
90
|
-
return ((t = e(this, l, p)) == null ? void 0 : t.getAttribute("direction")) || "horizontal";
|
|
91
|
-
},
|
|
92
|
-
observer: () => {
|
|
93
|
-
this.updateContainerClasslist();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}));
|
|
97
|
-
/**
|
|
98
|
-
* 更新步骤状态
|
|
99
|
-
* @param {string} status 活动步骤状态
|
|
100
|
-
*/
|
|
101
|
-
a(this, A, (t = this.status) => {
|
|
102
|
-
var r;
|
|
103
|
-
t === ((r = e(this, l, p)) == null ? void 0 : r.getAttribute("finish-status")) ? (e(this, c).setAttribute("icon", "icon-ok"), e(this, c).textContent = "") : (e(this, c).setAttribute("icon", ""), e(this, c).textContent = this.index + 1);
|
|
104
|
-
});
|
|
105
|
-
this.stylesheet = N, this.$render();
|
|
106
|
-
}
|
|
107
|
-
static get observedAttributes() {
|
|
108
|
-
return [
|
|
109
|
-
...super.observedAttributes,
|
|
110
|
-
"title",
|
|
111
|
-
"description",
|
|
112
|
-
"icon",
|
|
113
|
-
"status",
|
|
114
|
-
"index",
|
|
115
|
-
"active"
|
|
116
|
-
];
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* 获取 classlist 列表
|
|
120
|
-
* @return {string} 属性值
|
|
121
|
-
*/
|
|
122
|
-
updateContainerClasslist() {
|
|
123
|
-
const t = this.computedClasslist(
|
|
124
|
-
"ea-step",
|
|
125
|
-
{
|
|
126
|
-
["--" + this.direction]: this.direction
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
[this.status]: this.status,
|
|
130
|
-
"align-center": this["align-center"],
|
|
131
|
-
icon: this.icon,
|
|
132
|
-
simple: this.simple,
|
|
133
|
-
last: (() => {
|
|
134
|
-
var o;
|
|
135
|
-
const r = (o = e(this, l, p)) == null ? void 0 : o.querySelectorAll("ea-step");
|
|
136
|
-
return r ? r.length - 1 === this.index : !1;
|
|
137
|
-
})(),
|
|
138
|
-
first: this.index === 0
|
|
139
|
-
}
|
|
140
|
-
);
|
|
141
|
-
return e(this, u) && (e(this, u).className = t), t;
|
|
142
|
-
}
|
|
143
|
-
$render() {
|
|
144
|
-
this.shadowRoot.innerHTML = `
|
|
145
|
-
<div class='ea-step' part='container'>
|
|
146
|
-
<section class="ea-step__head" part="head">
|
|
147
|
-
<div class="ea-step__icon-wrapper" part="icon-wrapper">
|
|
148
|
-
<slot name="icon">
|
|
149
|
-
<ea-icon class="ea-step__icon" part="icon"></ea-icon>
|
|
150
|
-
</slot>
|
|
151
|
-
</div>
|
|
152
|
-
<div class="ea-step__tail" part="tail"></div>
|
|
153
|
-
</section>
|
|
154
|
-
<section class="ea-step__main" part="main">
|
|
155
|
-
<div class="ea-step__title" part="title">
|
|
156
|
-
<slot name="title"></slot>
|
|
157
|
-
</div>
|
|
158
|
-
<div class="ea-step__description" part="description">
|
|
159
|
-
<slot name="description"></slot>
|
|
160
|
-
</div>
|
|
161
|
-
</section>
|
|
162
|
-
<span class="ea-step__simple-arrow" part="simple-arrow">
|
|
163
|
-
<slot name="simple-arrow"></slot>
|
|
164
|
-
</span>
|
|
165
|
-
</div>
|
|
166
|
-
`, n(this, u, this.shadowRoot.querySelector(".ea-step")), n(this, C, this.shadowRoot.querySelector('slot[name="icon"]')), n(this, c, this.shadowRoot.querySelector(".ea-step__icon")), n(this, b, this.shadowRoot.querySelector('slot[name="title"]')), n(this, m, this.shadowRoot.querySelector(
|
|
167
|
-
'slot[name="description"]'
|
|
168
|
-
)), this.updateContainerClasslist();
|
|
169
|
-
}
|
|
170
|
-
connectedCallback() {
|
|
171
|
-
super.connectedCallback();
|
|
172
|
-
}
|
|
173
|
-
$beforeUnmounted() {
|
|
174
|
-
e(this, S).abort();
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
l = new WeakSet(), p = function() {
|
|
178
|
-
try {
|
|
179
|
-
return this.closest("ea-steps");
|
|
180
|
-
} catch {
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
183
|
-
}, u = new WeakMap(), C = new WeakMap(), c = new WeakMap(), b = new WeakMap(), m = new WeakMap(), S = new WeakMap(), A = new WeakMap();
|
|
184
|
-
window.customElements.get("ea-step") || window.customElements.define("ea-step", I);
|
|
185
|
-
var f, y, h, v, w, _;
|
|
186
|
-
class L extends R {
|
|
187
|
-
constructor() {
|
|
188
|
-
super();
|
|
189
|
-
/** @type {HTMLElement} */
|
|
190
|
-
a(this, f);
|
|
191
|
-
/** @type {HTMLSlotElement} */
|
|
192
|
-
a(this, y);
|
|
193
|
-
/** @type {AbortController} */
|
|
194
|
-
a(this, h, new AbortController());
|
|
195
|
-
x(this, "state", this.properties({
|
|
196
|
-
space: {
|
|
197
|
-
type: String,
|
|
198
|
-
default: "50%",
|
|
199
|
-
observer: (t) => {
|
|
200
|
-
this.style.setProperty("--ea-step-tail-spacing", t);
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
// TODO: 没写😋
|
|
204
|
-
// direction: {
|
|
205
|
-
// type: ["vertical", "horizontal"],
|
|
206
|
-
// default: "horizontal",
|
|
207
|
-
// observer: (newVal) => {
|
|
208
|
-
// this.updateContainerClasslist();
|
|
209
|
-
// },
|
|
210
|
-
// },
|
|
211
|
-
active: {
|
|
212
|
-
type: Number,
|
|
213
|
-
default: 0,
|
|
214
|
-
observer: (t) => {
|
|
215
|
-
e(this, v).call(this, t);
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
"process-status": {
|
|
219
|
-
type: ["wait", "process", "finish", "error", "success"],
|
|
220
|
-
default: "process",
|
|
221
|
-
observer: () => {
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
"finish-status": {
|
|
225
|
-
type: ["wait", "process", "finish", "error", "success"],
|
|
226
|
-
default: "finish",
|
|
227
|
-
observer: () => {
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
"align-center": {
|
|
231
|
-
type: Boolean,
|
|
232
|
-
default: !1,
|
|
233
|
-
observer: () => {
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
simple: {
|
|
237
|
-
type: Boolean,
|
|
238
|
-
default: !1,
|
|
239
|
-
observer: (t) => {
|
|
240
|
-
e(this, w).call(this, t), this.updateContainerClasslist();
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}));
|
|
244
|
-
/**
|
|
245
|
-
* 更新步骤状态
|
|
246
|
-
* @param {number} active
|
|
247
|
-
*/
|
|
248
|
-
a(this, v, (t) => {
|
|
249
|
-
[...this.querySelectorAll("ea-step")].forEach((o) => {
|
|
250
|
-
o.index < t ? o.setAttribute("status", this["finish-status"]) : o.index > t ? o.setAttribute("status", "wait") : o.setAttribute("status", this["process-status"]);
|
|
251
|
-
});
|
|
252
|
-
});
|
|
253
|
-
/**
|
|
254
|
-
* 更新简单步骤状态
|
|
255
|
-
* @param {boolean} isSimple
|
|
256
|
-
*/
|
|
257
|
-
a(this, w, (t = this.simple) => {
|
|
258
|
-
const r = [...this.querySelectorAll("ea-step")];
|
|
259
|
-
t ? r.forEach((o) => {
|
|
260
|
-
var d;
|
|
261
|
-
try {
|
|
262
|
-
(d = o.querySelector('[slot="simple-arrow"]')) == null || d.remove();
|
|
263
|
-
} catch {
|
|
264
|
-
}
|
|
265
|
-
try {
|
|
266
|
-
const g = document.createElement("ea-icon");
|
|
267
|
-
g.setAttribute("slot", "simple-arrow"), g.setAttribute("icon", "icon-angle-right"), g.part = "simple-arrow", o.appendChild(g);
|
|
268
|
-
} catch {
|
|
269
|
-
}
|
|
270
|
-
}) : r.forEach((o) => {
|
|
271
|
-
var d;
|
|
272
|
-
try {
|
|
273
|
-
(d = o.querySelector('[slot="simple-arrow"]')) == null || d.remove();
|
|
274
|
-
} catch {
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
/**
|
|
279
|
-
* 处理 slot 变化
|
|
280
|
-
* 更新所有子 ea-step 组件的 index、first、last 状态和 status
|
|
281
|
-
*/
|
|
282
|
-
a(this, _, () => {
|
|
283
|
-
const t = [...this.querySelectorAll("ea-step")];
|
|
284
|
-
t.forEach((r, o) => {
|
|
285
|
-
r.index = o, r.toggleAttribute("first", o === 0), r.toggleAttribute("last", o === t.length - 1);
|
|
286
|
-
}), e(this, v).call(this, this.active), e(this, w).call(this);
|
|
287
|
-
});
|
|
288
|
-
this.stylesheet = k, this.$render();
|
|
289
|
-
}
|
|
290
|
-
static get observedAttributes() {
|
|
291
|
-
return [
|
|
292
|
-
...super.observedAttributes,
|
|
293
|
-
"space",
|
|
294
|
-
"direction",
|
|
295
|
-
"active",
|
|
296
|
-
"process-status",
|
|
297
|
-
"finish-status",
|
|
298
|
-
"align-center",
|
|
299
|
-
"simple"
|
|
300
|
-
];
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* 获取 classlist 列表
|
|
304
|
-
* @return {string} 属性值
|
|
305
|
-
*/
|
|
306
|
-
updateContainerClasslist() {
|
|
307
|
-
const t = this.computedClasslist(
|
|
308
|
-
"ea-steps",
|
|
309
|
-
{
|
|
310
|
-
// ["--" + this.direction]: this.direction,
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
simple: this.simple,
|
|
314
|
-
"align-center": this["align-center"]
|
|
315
|
-
}
|
|
316
|
-
);
|
|
317
|
-
return e(this, f).className = t, t;
|
|
318
|
-
}
|
|
319
|
-
$render() {
|
|
320
|
-
this.shadowRoot.innerHTML = `
|
|
321
|
-
<div class='ea-steps' part='container'>
|
|
322
|
-
<slot></slot>
|
|
323
|
-
</div>
|
|
324
|
-
`, n(this, f, this.shadowRoot.querySelector(".ea-steps")), n(this, y, this.shadowRoot.querySelector("slot"));
|
|
325
|
-
}
|
|
326
|
-
connectedCallback() {
|
|
327
|
-
var t;
|
|
328
|
-
super.connectedCallback(), (t = e(this, h)) == null || t.abort(), n(this, h, new AbortController()), e(this, y).addEventListener(
|
|
329
|
-
"slotchange",
|
|
330
|
-
() => {
|
|
331
|
-
e(this, _).call(this);
|
|
332
|
-
},
|
|
333
|
-
{ signal: e(this, h).signal }
|
|
334
|
-
);
|
|
335
|
-
}
|
|
336
|
-
$beforeUnmounted() {
|
|
337
|
-
var t;
|
|
338
|
-
(t = e(this, h)) == null || t.abort();
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
f = new WeakMap(), y = new WeakMap(), h = new WeakMap(), v = new WeakMap(), w = new WeakMap(), _ = new WeakMap();
|
|
342
|
-
window.customElements.get("ea-steps") || window.customElements.define("ea-steps", L);
|
|
343
|
-
export {
|
|
344
|
-
I as EaStep,
|
|
345
|
-
L as EaSteps
|
|
346
|
-
};
|
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
var y = Object.defineProperty;
|
|
2
|
-
var m = (i) => {
|
|
3
|
-
throw TypeError(i);
|
|
4
|
-
};
|
|
5
|
-
var w = (i, a, t) => a in i ? y(i, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[a] = t;
|
|
6
|
-
var p = (i, a, t) => w(i, typeof a != "symbol" ? a + "" : a, t), f = (i, a, t) => a.has(i) || m("Cannot " + t);
|
|
7
|
-
var e = (i, a, t) => (f(i, a, "read from private field"), t ? t.call(i) : a.get(i)), l = (i, a, t) => a.has(i) ? m("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(i) : a.set(i, t), h = (i, a, t, s) => (f(i, a, "write to private field"), s ? s.call(i, t) : a.set(i, t), t);
|
|
8
|
-
import { F as S } from "../core/FormBase.js";
|
|
9
|
-
import { s as C } from "../css/ea-switch.style.js";
|
|
10
|
-
import { E as _ } from "../utils/Variables.js";
|
|
11
|
-
var n, r, d, c, v, b, o, u, g;
|
|
12
|
-
class N extends S {
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
/** @type {HTMLElement} */
|
|
16
|
-
l(this, n);
|
|
17
|
-
/** @type {HTMLInputElement} */
|
|
18
|
-
l(this, r);
|
|
19
|
-
/** @type {HTMLElement} */
|
|
20
|
-
l(this, d);
|
|
21
|
-
/** @type {HTMLElement} */
|
|
22
|
-
l(this, c);
|
|
23
|
-
/** @type {HTMLElement} */
|
|
24
|
-
l(this, v);
|
|
25
|
-
/** @type {HTMLElement} */
|
|
26
|
-
l(this, b);
|
|
27
|
-
/** @type {AbortController} */
|
|
28
|
-
l(this, o);
|
|
29
|
-
/** @type {AbortController} */
|
|
30
|
-
l(this, u);
|
|
31
|
-
p(this, "state", this.properties({
|
|
32
|
-
label: {
|
|
33
|
-
type: String,
|
|
34
|
-
default: "",
|
|
35
|
-
observer: async (t) => {
|
|
36
|
-
e(this, b).textContent = t;
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
name: {
|
|
40
|
-
type: String,
|
|
41
|
-
default: "",
|
|
42
|
-
observer: (t) => {
|
|
43
|
-
e(this, n).setAttribute("for", t), e(this, r).setAttribute("name", t), e(this, r).setAttribute("id", t);
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
value: {
|
|
47
|
-
type: {
|
|
48
|
-
Number: () => this.hasAttribute("active-value") && (this.getAttrNumber("active-value") || this.getAttrNumber("active-value") === 0 || this.getAttrNumber("inactive-value") || this.getAttrNumber("inactive-value") === 0),
|
|
49
|
-
String: () => this.hasAttribute("active-value") && (this.getAttrString("active-value") || this.getAttrString("active-value") === "" || this.getAttrString("inactive-value") || this.getAttrString("inactive-value") === ""),
|
|
50
|
-
Boolean: () => this.hasAttribute("active-value") || !this.hasAttribute("active-value") || this.hasAttribute("inactive-value") || !this.hasAttribute("inactive-value")
|
|
51
|
-
},
|
|
52
|
-
default: () => !1,
|
|
53
|
-
observer: (t) => {
|
|
54
|
-
const s = t === this["active-value"] ? this["active-value"] : this["inactive-value"];
|
|
55
|
-
e(this, r).value = s, e(this, r).toggleAttribute("checked", s), this.setValue(s), this.updateContainerClasslist();
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
"active-value": {
|
|
59
|
-
type: {
|
|
60
|
-
Number: () => this.hasAttribute("active-value") && (this.getAttrNumber("active-value") || this.getAttrNumber("active-value") === 0),
|
|
61
|
-
String: () => this.hasAttribute("active-value") && (this.getAttrString("active-value") || this.getAttrString("active-value") === ""),
|
|
62
|
-
Boolean: () => this.hasAttribute("active-value") || !this.hasAttribute("active-value")
|
|
63
|
-
},
|
|
64
|
-
default: !0,
|
|
65
|
-
observer: () => {
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
"inactive-value": {
|
|
69
|
-
type: {
|
|
70
|
-
Number: () => this.hasAttribute("inactive-value") && (this.getAttrNumber("inactive-value") || this.getAttrNumber("inactive-value") === 0),
|
|
71
|
-
String: () => this.hasAttribute("inactive-value") && (this.getAttrString("inactive-value") || this.getAttrString("inactive-value") === ""),
|
|
72
|
-
Boolean: () => this.hasAttribute("inactive-value") || !this.hasAttribute("inactive-value")
|
|
73
|
-
},
|
|
74
|
-
default: () => !1,
|
|
75
|
-
observer: () => {
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
size: {
|
|
79
|
-
type: _,
|
|
80
|
-
default: "default",
|
|
81
|
-
observer: () => {
|
|
82
|
-
this.updateContainerClasslist();
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
"inactive-text": {
|
|
86
|
-
type: String,
|
|
87
|
-
default: "",
|
|
88
|
-
observer: (t) => {
|
|
89
|
-
e(this, v).innerText = t;
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
"inactive-color": {
|
|
93
|
-
type: String,
|
|
94
|
-
default: "",
|
|
95
|
-
observer: (t) => {
|
|
96
|
-
this.style.setProperty("--ea-switch-inactive-bg-color", t);
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
"active-text": {
|
|
100
|
-
type: String,
|
|
101
|
-
default: "",
|
|
102
|
-
observer: (t) => {
|
|
103
|
-
e(this, c).innerText = t;
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
"active-color": {
|
|
107
|
-
type: String,
|
|
108
|
-
default: "",
|
|
109
|
-
observer: (t) => {
|
|
110
|
-
this.style.setProperty("--ea-switch-active-bg-color", t);
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
disabled: {
|
|
114
|
-
type: Boolean,
|
|
115
|
-
default: !1,
|
|
116
|
-
observer: (t) => {
|
|
117
|
-
e(this, r).toggleAttribute("disabled", t), this.updateContainerClasslist();
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
required: {
|
|
121
|
-
type: Boolean,
|
|
122
|
-
default: !1,
|
|
123
|
-
observer: (t) => {
|
|
124
|
-
e(this, r).toggleAttribute("required", t);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}));
|
|
128
|
-
p(this, "funcState", this.properties({
|
|
129
|
-
beforeChange: {
|
|
130
|
-
props: !0,
|
|
131
|
-
type: Function,
|
|
132
|
-
default: null,
|
|
133
|
-
/**
|
|
134
|
-
* @param {() => Promise} cb
|
|
135
|
-
*/
|
|
136
|
-
observer: (t) => {
|
|
137
|
-
var s;
|
|
138
|
-
(s = e(this, u)) == null || s.abort(), h(this, u, new AbortController()), e(this, r).addEventListener(
|
|
139
|
-
"click",
|
|
140
|
-
async (A) => {
|
|
141
|
-
A.preventDefault(), A.stopImmediatePropagation(), t && t().then(() => {
|
|
142
|
-
e(this, r).checked = !this.value, e(this, r).dispatchEvent(new CustomEvent("change"));
|
|
143
|
-
}).catch(() => {
|
|
144
|
-
});
|
|
145
|
-
},
|
|
146
|
-
{ signal: e(this, u).signal }
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}));
|
|
151
|
-
/**
|
|
152
|
-
* 改变事件
|
|
153
|
-
* @param {Event} e
|
|
154
|
-
*/
|
|
155
|
-
l(this, g, (t) => {
|
|
156
|
-
t.preventDefault(), t.stopPropagation();
|
|
157
|
-
const s = t.target.checked ? this["active-value"] : this["inactive-value"];
|
|
158
|
-
this.setAttribute("value", s), this.emit("change", {
|
|
159
|
-
detail: { value: s },
|
|
160
|
-
bubbles: !0
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
this.stylesheet = C, this.$render();
|
|
164
|
-
}
|
|
165
|
-
static get observedAttributes() {
|
|
166
|
-
return [
|
|
167
|
-
...super.observedAttributes,
|
|
168
|
-
"name",
|
|
169
|
-
"value",
|
|
170
|
-
"active-value",
|
|
171
|
-
"inactive-value",
|
|
172
|
-
"label",
|
|
173
|
-
"size",
|
|
174
|
-
"inactive-text",
|
|
175
|
-
"inactive-color",
|
|
176
|
-
"active-text",
|
|
177
|
-
"active-color",
|
|
178
|
-
"disabled",
|
|
179
|
-
"required"
|
|
180
|
-
];
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* 获取 classlist 列表
|
|
184
|
-
* @return {string} 属性值
|
|
185
|
-
*/
|
|
186
|
-
updateContainerClasslist() {
|
|
187
|
-
const t = this.computedClasslist(
|
|
188
|
-
"ea-switch",
|
|
189
|
-
{
|
|
190
|
-
[`--${this.size}`]: this.size
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
checked: this.value === this["active-value"],
|
|
194
|
-
disabled: this.disabled || this.loading,
|
|
195
|
-
loading: this.loading
|
|
196
|
-
}
|
|
197
|
-
);
|
|
198
|
-
return e(this, n).className = t, t;
|
|
199
|
-
}
|
|
200
|
-
$render() {
|
|
201
|
-
this.shadowRoot.innerHTML = `
|
|
202
|
-
<label class="ea-switch-wrapper" part="wrapper">
|
|
203
|
-
<span class="ea-switch__form-label" part="label form-label"></span>
|
|
204
|
-
<section class="ea-switch" part="container">
|
|
205
|
-
<input class="ea-switch__original" type="checkbox" part="original" />
|
|
206
|
-
<span class="ea-switch__label label-left" part="label-left">
|
|
207
|
-
<slot name="inactive"></slot>
|
|
208
|
-
</span>
|
|
209
|
-
<span class="ea-switch__inner" part="switch"></span>
|
|
210
|
-
<span class="ea-switch__label label-right" part="label-right">
|
|
211
|
-
<slot name="active"></slot>
|
|
212
|
-
</span>
|
|
213
|
-
</section>
|
|
214
|
-
</label>
|
|
215
|
-
`, h(this, b, this.shadowRoot.querySelector(".ea-switch__form-label")), h(this, n, this.shadowRoot.querySelector(".ea-switch")), h(this, r, this.shadowRoot.querySelector(".ea-switch__original")), h(this, d, this.shadowRoot.querySelector(".ea-switch__inner")), h(this, v, this.shadowRoot.querySelector(
|
|
216
|
-
".ea-switch__label.label-left > slot[name='inactive']"
|
|
217
|
-
)), h(this, c, this.shadowRoot.querySelector(
|
|
218
|
-
".ea-switch__label.label-right slot[name='active']"
|
|
219
|
-
)), this.updateContainerClasslist();
|
|
220
|
-
}
|
|
221
|
-
connectedCallback() {
|
|
222
|
-
var t;
|
|
223
|
-
super.connectedCallback(), (t = e(this, o)) == null || t.abort(), h(this, o, new AbortController()), this.name || this.setAttribute("name", Math.random().toString(36).substring(2, 15)), this.setValue(
|
|
224
|
-
e(this, r).checked ? this["active-value"] : this["inactive-value"]
|
|
225
|
-
), e(this, r).addEventListener("change", e(this, g), {
|
|
226
|
-
signal: e(this, o).signal
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
$unmounted() {
|
|
230
|
-
var t, s;
|
|
231
|
-
(t = e(this, o)) == null || t.abort(), (s = e(this, u)) == null || s.abort();
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* 获取验证目标元素
|
|
235
|
-
* @returns {HTMLElement}
|
|
236
|
-
*/
|
|
237
|
-
get validationTarget() {
|
|
238
|
-
return e(this, n);
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* 更新表单验证状态
|
|
242
|
-
* switch 的验证逻辑:当 required 为 true 时,必须处于选中状态(value 等于 active-value)
|
|
243
|
-
*/
|
|
244
|
-
updateValidity() {
|
|
245
|
-
const t = this.value === this["active-value"];
|
|
246
|
-
this.required && !t ? this.internals.setValidity(
|
|
247
|
-
{ valueMissing: !0 },
|
|
248
|
-
"请开启此选项",
|
|
249
|
-
e(this, n)
|
|
250
|
-
) : this.internals.setValidity({}, "", e(this, n));
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* 检查表单字段的有效性
|
|
254
|
-
* @returns {boolean}
|
|
255
|
-
*/
|
|
256
|
-
checkValidity() {
|
|
257
|
-
return this.updateValidity(), this.internals.validity.valid;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* 报告表单字段的有效性(显示验证提示)
|
|
261
|
-
* @returns {boolean}
|
|
262
|
-
*/
|
|
263
|
-
reportValidity() {
|
|
264
|
-
return this.internals.reportValidity();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
n = new WeakMap(), r = new WeakMap(), d = new WeakMap(), c = new WeakMap(), v = new WeakMap(), b = new WeakMap(), o = new WeakMap(), u = new WeakMap(), g = new WeakMap();
|
|
268
|
-
window.customElements.get("ea-switch") || window.customElements.define("ea-switch", N);
|
|
269
|
-
export {
|
|
270
|
-
N as EaSwitch
|
|
271
|
-
};
|