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,286 @@
|
|
|
1
|
+
var S = Object.defineProperty;
|
|
2
|
+
var k = (t) => {
|
|
3
|
+
throw TypeError(t);
|
|
4
|
+
};
|
|
5
|
+
var P = (t, s, e) => s in t ? S(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
6
|
+
var _ = (t, s, e) => P(t, typeof s != "symbol" ? s + "" : s, e), C = (t, s, e) => s.has(t) || k("Cannot " + e);
|
|
7
|
+
var r = (t, s, e) => (C(t, s, "read from private field"), e ? e.call(t) : s.get(t)), p = (t, s, e) => s.has(t) ? k("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), h = (t, s, e, a) => (C(t, s, "write to private field"), a ? a.call(t, e) : s.set(t, e), e), d = (t, s, e) => (C(t, s, "access private method"), e);
|
|
8
|
+
import { B } from "./Base.js";
|
|
9
|
+
import { s as A } from "../css/ea-progress.style.js";
|
|
10
|
+
const $ = `
|
|
11
|
+
<svg viewBox="0 0 100 100">
|
|
12
|
+
<circle class="ea-progress__track" part="track" cx="50" cy="50" fill="none" stroke-dasharray="302px" stroke-dashoffset="0" />
|
|
13
|
+
<circle class="ea-progress__path" part="path" cx="50" cy="50" fill="none" stroke-dasharray="302px" stroke-dashoffset="0" />
|
|
14
|
+
</svg>
|
|
15
|
+
<section class="ea-progress__percentage-wrapper" part="percentage">
|
|
16
|
+
<slot class="ea-progress__percentage"></slot>
|
|
17
|
+
</section>
|
|
18
|
+
`, q = `
|
|
19
|
+
<svg viewBox="0 0 100 100">
|
|
20
|
+
<mask id="myMask">
|
|
21
|
+
<rect class="mask" width="100%" height="20%" fill="white" />
|
|
22
|
+
</mask>
|
|
23
|
+
<clipPath id="myClip">
|
|
24
|
+
<rect class="mask" />
|
|
25
|
+
</clipPath>
|
|
26
|
+
<circle class="ea-progress__track" part="track" cx="50" cy="50" fill="none" clip-path="url(#myClip)" />
|
|
27
|
+
<circle class="ea-progress__path" part="path" cx="50" cy="50" fill="none" clip-path="url(#myClip)" />
|
|
28
|
+
</svg>
|
|
29
|
+
<section class="ea-progress__percentage-wrapper" part="percentage">
|
|
30
|
+
<slot class="ea-progress__percentage"></slot>
|
|
31
|
+
</section>
|
|
32
|
+
`;
|
|
33
|
+
var i, g, o, u, n, y, c, w, b;
|
|
34
|
+
class R extends B {
|
|
35
|
+
constructor() {
|
|
36
|
+
super();
|
|
37
|
+
p(this, c);
|
|
38
|
+
/** @type {HTMLElement} */
|
|
39
|
+
p(this, i);
|
|
40
|
+
/** @type {HTMLElement} */
|
|
41
|
+
p(this, g);
|
|
42
|
+
/** @type {HTMLElement} */
|
|
43
|
+
p(this, o);
|
|
44
|
+
/** @type {HTMLElement} */
|
|
45
|
+
p(this, u);
|
|
46
|
+
/** @type {HTMLElement} */
|
|
47
|
+
p(this, n);
|
|
48
|
+
_(this, "propState", this.properties({
|
|
49
|
+
color: {
|
|
50
|
+
props: !0,
|
|
51
|
+
type: {
|
|
52
|
+
Array: () => {
|
|
53
|
+
var e, a;
|
|
54
|
+
return ((a = (e = this.props) == null ? void 0 : e.color) == null ? void 0 : a.length) > 0;
|
|
55
|
+
},
|
|
56
|
+
Function: () => {
|
|
57
|
+
var e;
|
|
58
|
+
return typeof ((e = this.props) == null ? void 0 : e.color) == "function";
|
|
59
|
+
},
|
|
60
|
+
String: () => {
|
|
61
|
+
var e;
|
|
62
|
+
return typeof this.getAttribute("color") == "string" || typeof ((e = this.props) == null ? void 0 : e.color) == "string";
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
default: () => this.getAttribute("color") || "",
|
|
66
|
+
observer: (e) => {
|
|
67
|
+
r(this, y).call(this, e, e);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}));
|
|
71
|
+
_(this, "state", this.properties({
|
|
72
|
+
percentage: {
|
|
73
|
+
type: Number,
|
|
74
|
+
default: 0,
|
|
75
|
+
observer: (e) => {
|
|
76
|
+
d(this, c, b).call(this, e);
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
type: {
|
|
80
|
+
type: ["line", "circle", "dashboard"],
|
|
81
|
+
default: "line",
|
|
82
|
+
observer: () => {
|
|
83
|
+
this.$render(), this.updateContainerClasslist(), d(this, c, b).call(this);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
status: {
|
|
87
|
+
type: ["success", "exception", "warning"],
|
|
88
|
+
default: "",
|
|
89
|
+
observer: () => {
|
|
90
|
+
this.updateContainerClasslist(), d(this, c, w).call(this);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"stroke-width": {
|
|
94
|
+
type: String,
|
|
95
|
+
default: "8px",
|
|
96
|
+
observer: (e) => {
|
|
97
|
+
if (!CSS.supports("width", e))
|
|
98
|
+
return console.warn(
|
|
99
|
+
`[EaProgress] The width value ${e} is not supported.`
|
|
100
|
+
);
|
|
101
|
+
r(this, i).style.setProperty("--ea-progress-stroke-width", e);
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"text-inside": {
|
|
105
|
+
type: Boolean,
|
|
106
|
+
default: !1,
|
|
107
|
+
observer: (e) => {
|
|
108
|
+
try {
|
|
109
|
+
e ? r(this, o).appendChild(r(this, n)) : r(this, u).appendChild(r(this, n));
|
|
110
|
+
} catch {
|
|
111
|
+
}
|
|
112
|
+
this.updateContainerClasslist();
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
indeterminate: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: !1,
|
|
118
|
+
observer: () => {
|
|
119
|
+
this.updateContainerClasslist();
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
duration: {
|
|
123
|
+
type: Number,
|
|
124
|
+
default: 3,
|
|
125
|
+
observer: (e) => {
|
|
126
|
+
r(this, i).style.setProperty(
|
|
127
|
+
"--ea-progress-animation-duration",
|
|
128
|
+
`${e}s`
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
striped: {
|
|
133
|
+
type: Boolean,
|
|
134
|
+
default: !1,
|
|
135
|
+
observer: () => {
|
|
136
|
+
this.updateContainerClasslist();
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"striped-flow": {
|
|
140
|
+
type: Boolean,
|
|
141
|
+
default: !1,
|
|
142
|
+
observer: () => {
|
|
143
|
+
this.updateContainerClasslist();
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
size: {
|
|
147
|
+
type: String,
|
|
148
|
+
default: "126px",
|
|
149
|
+
observer: (e) => {
|
|
150
|
+
this.type !== "line" && r(this, i).style.setProperty("--ea-progress-size", e);
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"show-text": {
|
|
154
|
+
type: Boolean,
|
|
155
|
+
default: !0,
|
|
156
|
+
observer: () => {
|
|
157
|
+
this.updateContainerClasslist();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}));
|
|
161
|
+
/**
|
|
162
|
+
* 处理颜色变化
|
|
163
|
+
* @param {string | string[] | function} color 颜色值或函数
|
|
164
|
+
* @param {number} [percentage] 百分比
|
|
165
|
+
*/
|
|
166
|
+
p(this, y, (e, a = this.percentage) => {
|
|
167
|
+
if (!(!e || typeof e > "u"))
|
|
168
|
+
if (Array.isArray(e)) {
|
|
169
|
+
let l = e[0];
|
|
170
|
+
for (let f = 0; f < e.length; f++) {
|
|
171
|
+
const x = e[f];
|
|
172
|
+
if (a <= x.percentage) {
|
|
173
|
+
l = x;
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
r(this, o).style.setProperty("--ea-progress-path-color", l == null ? void 0 : l.color);
|
|
178
|
+
} else typeof e == "string" ? r(this, o).style.setProperty("--ea-progress-path-color", e) : typeof e == "function" && r(this, o).style.setProperty(
|
|
179
|
+
"--ea-progress-path-color",
|
|
180
|
+
e(a)
|
|
181
|
+
);
|
|
182
|
+
});
|
|
183
|
+
this.stylesheet = A, this.$render();
|
|
184
|
+
}
|
|
185
|
+
static get observedAttributes() {
|
|
186
|
+
return [
|
|
187
|
+
...super.observedAttributes,
|
|
188
|
+
"type",
|
|
189
|
+
"percentage",
|
|
190
|
+
"status",
|
|
191
|
+
"stroke-width",
|
|
192
|
+
"text-inside",
|
|
193
|
+
"indeterminate",
|
|
194
|
+
"duration",
|
|
195
|
+
"striped",
|
|
196
|
+
"striped-flow",
|
|
197
|
+
// "width",
|
|
198
|
+
"show-text"
|
|
199
|
+
];
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* 获取 classlist 列表
|
|
203
|
+
* @return {string} 属性值
|
|
204
|
+
*/
|
|
205
|
+
updateContainerClasslist() {
|
|
206
|
+
const e = this.computedClasslist(
|
|
207
|
+
"ea-progress",
|
|
208
|
+
{
|
|
209
|
+
["--" + this.status]: this.status,
|
|
210
|
+
"--text-inside": this["text-inside"],
|
|
211
|
+
"--striped": this.striped
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
[this.type]: this.type,
|
|
215
|
+
indeterminate: this.indeterminate && this.type === "line",
|
|
216
|
+
"striped-flow": this["striped-flow"],
|
|
217
|
+
"show-text": this["show-text"]
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
return r(this, i).className = e, e;
|
|
221
|
+
}
|
|
222
|
+
$render() {
|
|
223
|
+
const e = {
|
|
224
|
+
line: `
|
|
225
|
+
<div class='ea-progress' part='container'>
|
|
226
|
+
<section class="ea-progress__track" part="track">
|
|
227
|
+
<section class="ea-progress__path" part="path"></section>
|
|
228
|
+
</section>
|
|
229
|
+
<section class="ea-progress__percentage-wrapper" part="percentage">
|
|
230
|
+
<slot class="ea-progress__percentage"></slot>
|
|
231
|
+
</section>
|
|
232
|
+
</div>
|
|
233
|
+
`,
|
|
234
|
+
circle: $,
|
|
235
|
+
dashboard: q
|
|
236
|
+
};
|
|
237
|
+
this.shadowRoot.innerHTML = `
|
|
238
|
+
<div class='ea-progress' part='container'>
|
|
239
|
+
${e[this.type]}
|
|
240
|
+
</div>
|
|
241
|
+
`, h(this, i, this.shadowRoot.querySelector(".ea-progress")), h(this, g, this.shadowRoot.querySelector(".ea-progress__track")), h(this, o, this.shadowRoot.querySelector(".ea-progress__path")), h(this, u, this.shadowRoot.querySelector(
|
|
242
|
+
".ea-progress__percentage-wrapper"
|
|
243
|
+
)), h(this, n, this.shadowRoot.querySelector(".ea-progress__percentage")), this.updateContainerClasslist();
|
|
244
|
+
}
|
|
245
|
+
connectedCallback() {
|
|
246
|
+
super.connectedCallback();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
i = new WeakMap(), g = new WeakMap(), o = new WeakMap(), u = new WeakMap(), n = new WeakMap(), y = new WeakMap(), c = new WeakSet(), /**
|
|
250
|
+
* 更新状态文本/图标
|
|
251
|
+
*/
|
|
252
|
+
w = function() {
|
|
253
|
+
const e = {
|
|
254
|
+
success: "circle-check",
|
|
255
|
+
warning: "triangle-exclamation",
|
|
256
|
+
exception: "circle-xmark"
|
|
257
|
+
};
|
|
258
|
+
["success", "exception", "warning"].includes(this.status) && !this["text-inside"] ? r(this, n).innerHTML = `<ea-icon class="ea-progress__status" name="${e[this.status]}" part="status-icon"></ea-icon>` : r(this, n).textContent = this.percentage + "%";
|
|
259
|
+
}, /**
|
|
260
|
+
* 更新进度条百分比
|
|
261
|
+
* @param {number} [newVal] 新的百分比值
|
|
262
|
+
*/
|
|
263
|
+
b = function(e = this.percentage) {
|
|
264
|
+
if (e < 0) return this.percentage = 0;
|
|
265
|
+
if (e > 100) return this.percentage = 100;
|
|
266
|
+
const a = this.querySelector("[data-percentage]"), l = {
|
|
267
|
+
line: () => e + "%",
|
|
268
|
+
circle: () => 302 * ((100 - e) / 100) + "px",
|
|
269
|
+
dashboard: () => {
|
|
270
|
+
const x = 49 - Number(this["stroke-width"].replace("px", "")) / 2, m = 2 * Math.PI * x, v = (100 - e) / 100;
|
|
271
|
+
return r(this, o).style.strokeDasharray = m * (270 / 360) + "px", r(this, g).style.strokeDasharray = m * (270 / 360) + "px", m * (270 / 360) * v + "px";
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
r(this, i).style.setProperty(
|
|
275
|
+
"--ea-progress-percentage",
|
|
276
|
+
l[this.type]()
|
|
277
|
+
), d(this, c, w).call(this), a && (a.textContent = this.percentage), r(this, y).call(this, this.color, e), this.emit("change", {
|
|
278
|
+
detail: {
|
|
279
|
+
percentage: e
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
window.customElements.get("ea-progress") || window.customElements.define("ea-progress", R);
|
|
284
|
+
export {
|
|
285
|
+
R as EaProgress
|
|
286
|
+
};
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
var V = Object.defineProperty;
|
|
2
|
+
var _ = (s) => {
|
|
3
|
+
throw TypeError(s);
|
|
4
|
+
};
|
|
5
|
+
var z = (s, i, e) => i in s ? V(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
|
|
6
|
+
var E = (s, i, e) => z(s, typeof i != "symbol" ? i + "" : i, e), k = (s, i, e) => i.has(s) || _("Cannot " + e);
|
|
7
|
+
var t = (s, i, e) => (k(s, i, "read from private field"), e ? e.call(s) : i.get(s)), r = (s, i, e) => i.has(s) ? _("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, e), l = (s, i, e, a) => (k(s, i, "write to private field"), a ? a.call(s, e) : i.set(s, e), e);
|
|
8
|
+
import { F as q } from "../core/FormBase.js";
|
|
9
|
+
import { s as $ } from "../css/ea-radio.style.js";
|
|
10
|
+
import { E as w } from "../utils/Variables.js";
|
|
11
|
+
import { s as B } from "../css/ea-radio-group.style.js";
|
|
12
|
+
var b, u, p, o, h, S;
|
|
13
|
+
class G extends q {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
/** @type {HTMLElement} */
|
|
17
|
+
r(this, b);
|
|
18
|
+
/** @type {HTMLElement} */
|
|
19
|
+
r(this, u);
|
|
20
|
+
/** @type {HTMLElement} */
|
|
21
|
+
r(this, p);
|
|
22
|
+
/** @type {HTMLInputElement} */
|
|
23
|
+
r(this, o);
|
|
24
|
+
/** @type {AbortController} */
|
|
25
|
+
r(this, h);
|
|
26
|
+
E(this, "state", this.properties({
|
|
27
|
+
size: {
|
|
28
|
+
type: w,
|
|
29
|
+
default: "",
|
|
30
|
+
observer: () => {
|
|
31
|
+
this.updateContainerClasslist();
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
checked: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: !1,
|
|
37
|
+
observer: (e) => {
|
|
38
|
+
t(this, u).toggleAttribute("checked", e), t(this, o).checked = e, e ? this.setValue(this.value) : this.removeValue(), this.updateContainerClasslist();
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
name: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "",
|
|
44
|
+
observer: (e) => {
|
|
45
|
+
t(this, u).setAttribute("for", e), t(this, o).setAttribute("id", e), t(this, o).setAttribute("name", e);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
value: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "",
|
|
51
|
+
observer: (e) => {
|
|
52
|
+
t(this, o).setAttribute("value", e);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
disabled: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: !1,
|
|
58
|
+
observer: (e) => {
|
|
59
|
+
t(this, o).disabled = e, this.updateContainerClasslist();
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
border: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: !1,
|
|
65
|
+
observer: () => {
|
|
66
|
+
this.updateContainerClasslist();
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
label: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: "",
|
|
72
|
+
observer: (e) => {
|
|
73
|
+
t(this, p).textContent = e;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}));
|
|
77
|
+
/**
|
|
78
|
+
* radio change 事件
|
|
79
|
+
* @param {Event} e
|
|
80
|
+
*/
|
|
81
|
+
r(this, S, (e) => {
|
|
82
|
+
e.stopImmediatePropagation(), this.closest("ea-radio-group") || document.querySelectorAll(
|
|
83
|
+
`ea-radio[name="${this.name}"]`
|
|
84
|
+
).forEach((n) => {
|
|
85
|
+
n.toggleAttribute("checked", n === this);
|
|
86
|
+
}), this.emit("change", {
|
|
87
|
+
detail: {
|
|
88
|
+
value: this.value
|
|
89
|
+
},
|
|
90
|
+
bubbles: !0
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
this.stylesheet = $, this.$render();
|
|
94
|
+
}
|
|
95
|
+
static get observedAttributes() {
|
|
96
|
+
return [
|
|
97
|
+
...super.observedAttributes,
|
|
98
|
+
"size",
|
|
99
|
+
"checked",
|
|
100
|
+
"name",
|
|
101
|
+
"value",
|
|
102
|
+
"disabled",
|
|
103
|
+
"border",
|
|
104
|
+
"label"
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 获取 classlist 列表
|
|
109
|
+
* @return {string} 属性值
|
|
110
|
+
*/
|
|
111
|
+
updateContainerClasslist() {
|
|
112
|
+
const e = this.computedClasslist(
|
|
113
|
+
"ea-radio",
|
|
114
|
+
{
|
|
115
|
+
[`--${this.size}`]: this.size
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
checked: this.checked,
|
|
119
|
+
disabled: this.disabled,
|
|
120
|
+
border: this.border
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
return t(this, b).className = e, e;
|
|
124
|
+
}
|
|
125
|
+
$render() {
|
|
126
|
+
this.shadowRoot.innerHTML = `
|
|
127
|
+
<label class="ea-radio" part="container" role="radio">
|
|
128
|
+
<span class="ea-radio__input" part="input-wrap">
|
|
129
|
+
<span class="ea-radio__inner" part="input"></span>
|
|
130
|
+
<input class="ea-radio__original" type="radio" />
|
|
131
|
+
</span>
|
|
132
|
+
<span class="ea-radio__label" part="label-wrap">
|
|
133
|
+
<slot></slot>
|
|
134
|
+
</span>
|
|
135
|
+
</label>
|
|
136
|
+
`, l(this, b, this.shadowRoot.querySelector(".ea-radio")), l(this, u, this.shadowRoot.querySelector(".ea-radio__label")), l(this, p, this.shadowRoot.querySelector(".ea-radio__label slot")), l(this, o, this.shadowRoot.querySelector(".ea-radio__original"));
|
|
137
|
+
}
|
|
138
|
+
connectedCallback() {
|
|
139
|
+
var e;
|
|
140
|
+
super.connectedCallback(), (e = t(this, h)) == null || e.abort(), l(this, h, new AbortController()), this.name || this.setAttribute("name", Math.random().toString(36).substring(2, 15)), t(this, o).addEventListener("change", t(this, S), {
|
|
141
|
+
signal: t(this, h).signal
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
$beforeUnmounted() {
|
|
145
|
+
var e;
|
|
146
|
+
(e = t(this, h)) == null || e.abort();
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* 获取验证目标元素
|
|
150
|
+
* @returns {HTMLInputElement}
|
|
151
|
+
*/
|
|
152
|
+
get validationTarget() {
|
|
153
|
+
return t(this, o);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* 检查表单字段的有效性
|
|
157
|
+
* @returns {boolean} 如果字段有效返回 true,否则返回 false
|
|
158
|
+
*/
|
|
159
|
+
checkValidity() {
|
|
160
|
+
return t(this, o).checkValidity();
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* 报告表单字段的有效性(显示验证提示)
|
|
164
|
+
* @returns {boolean} 如果字段有效返回 true,否则返回 false
|
|
165
|
+
*/
|
|
166
|
+
reportValidity() {
|
|
167
|
+
return t(this, o).reportValidity();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
b = new WeakMap(), u = new WeakMap(), p = new WeakMap(), o = new WeakMap(), h = new WeakMap(), S = new WeakMap();
|
|
171
|
+
window.customElements.get("ea-radio") || window.customElements.define("ea-radio", G);
|
|
172
|
+
var c, g, f, d, m, y, v, C, A;
|
|
173
|
+
class x extends q {
|
|
174
|
+
constructor() {
|
|
175
|
+
super();
|
|
176
|
+
/** @type {HTMLElement} */
|
|
177
|
+
r(this, c);
|
|
178
|
+
/** @type {HTMLSlotElement} */
|
|
179
|
+
r(this, g);
|
|
180
|
+
/** @type {HTMLLabelElement} */
|
|
181
|
+
r(this, f);
|
|
182
|
+
/** @type {AbortController} */
|
|
183
|
+
r(this, d);
|
|
184
|
+
E(this, "state", this.properties({
|
|
185
|
+
label: {
|
|
186
|
+
type: String,
|
|
187
|
+
default: "",
|
|
188
|
+
observer: (e) => {
|
|
189
|
+
t(this, f).textContent = e;
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
name: {
|
|
193
|
+
type: String,
|
|
194
|
+
default: "",
|
|
195
|
+
observer: () => {
|
|
196
|
+
t(this, m).call(this);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
value: {
|
|
200
|
+
type: String,
|
|
201
|
+
default: "",
|
|
202
|
+
observer: (e) => {
|
|
203
|
+
t(this, y).call(this, e), this.setValue(e);
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
border: {
|
|
207
|
+
type: Boolean,
|
|
208
|
+
default: !1,
|
|
209
|
+
observer: (e) => {
|
|
210
|
+
t(this, v).call(this, e);
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
disabled: {
|
|
214
|
+
type: Boolean,
|
|
215
|
+
default: !1,
|
|
216
|
+
observer: (e) => {
|
|
217
|
+
t(this, C).call(this, e);
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
size: {
|
|
221
|
+
type: w,
|
|
222
|
+
default: "default",
|
|
223
|
+
observer: (e) => {
|
|
224
|
+
t(this, A).call(this, e);
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
required: {
|
|
228
|
+
type: Boolean,
|
|
229
|
+
default: !1
|
|
230
|
+
}
|
|
231
|
+
}));
|
|
232
|
+
/**
|
|
233
|
+
* 更新 radios name 属性
|
|
234
|
+
*/
|
|
235
|
+
r(this, m, () => {
|
|
236
|
+
this.querySelectorAll("ea-radio").forEach((e) => {
|
|
237
|
+
e.setAttribute("name", this.name);
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
/**
|
|
241
|
+
* 更新当前选项
|
|
242
|
+
* @param {any} currentValue
|
|
243
|
+
*/
|
|
244
|
+
r(this, y, (e) => {
|
|
245
|
+
this.querySelectorAll("ea-radio").forEach((a) => {
|
|
246
|
+
const n = a.getAttribute("value");
|
|
247
|
+
a.toggleAttribute("checked", e === n);
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
/**
|
|
251
|
+
* 更新 radios border 属性
|
|
252
|
+
* @param {Boolean} isBorder
|
|
253
|
+
*/
|
|
254
|
+
r(this, v, (e) => {
|
|
255
|
+
this.querySelectorAll("ea-radio").forEach((a) => {
|
|
256
|
+
a.toggleAttribute("border", e);
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
/**
|
|
260
|
+
* 更新 radios disabled 属性
|
|
261
|
+
* @param {Boolean} isDisabled
|
|
262
|
+
*/
|
|
263
|
+
r(this, C, (e) => {
|
|
264
|
+
this.querySelectorAll("ea-radio").forEach((a) => {
|
|
265
|
+
a.toggleAttribute("disabled", e);
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
/**
|
|
269
|
+
* 批量更新 radios size 属性
|
|
270
|
+
* @param {'large' | 'default' | 'small'} size
|
|
271
|
+
*/
|
|
272
|
+
r(this, A, (e) => {
|
|
273
|
+
this.querySelectorAll("ea-radio").forEach((a) => {
|
|
274
|
+
a.getAttribute("size") || a.setAttribute("size", e);
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
this.stylesheet = B, this.$render();
|
|
278
|
+
}
|
|
279
|
+
static get observedAttributes() {
|
|
280
|
+
return [
|
|
281
|
+
...super.observedAttributes,
|
|
282
|
+
"label",
|
|
283
|
+
"name",
|
|
284
|
+
"value",
|
|
285
|
+
"border",
|
|
286
|
+
"disabled",
|
|
287
|
+
"size",
|
|
288
|
+
"required"
|
|
289
|
+
];
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* 获取 classlist 列表
|
|
293
|
+
* @return {string} 属性值
|
|
294
|
+
*/
|
|
295
|
+
updateContainerClasslist() {
|
|
296
|
+
return this.computedClasslist("ea-radio-group", {});
|
|
297
|
+
}
|
|
298
|
+
$render() {
|
|
299
|
+
this.shadowRoot.innerHTML = `
|
|
300
|
+
<label class='ea-radio-group__form-label' part='form-label'></label>
|
|
301
|
+
<div class='ea-radio-group' part='container' role='radiogroup'>
|
|
302
|
+
<slot></slot>
|
|
303
|
+
</div>
|
|
304
|
+
`, l(this, f, this.shadowRoot.querySelector(".ea-radio-group__form-label")), l(this, c, this.shadowRoot.querySelector(".ea-radio-group")), l(this, g, t(this, c).querySelector("slot"));
|
|
305
|
+
}
|
|
306
|
+
connectedCallback() {
|
|
307
|
+
var n;
|
|
308
|
+
super.connectedCallback(), (n = t(this, d)) == null || n.abort(), l(this, d, new AbortController());
|
|
309
|
+
const e = (R) => {
|
|
310
|
+
this.value = R.detail.value;
|
|
311
|
+
}, a = () => {
|
|
312
|
+
t(this, y).call(this, this.value), this.name && t(this, m).call(this), this.border && t(this, v).call(this, this.border), this.disabled && t(this, C).call(this, this.disabled), this.size && t(this, A).call(this, this.size);
|
|
313
|
+
};
|
|
314
|
+
this.addEventListener("change", e, {
|
|
315
|
+
signal: t(this, d).signal
|
|
316
|
+
}), t(this, g).addEventListener("slotchange", a, {
|
|
317
|
+
signal: t(this, d).signal
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
$beforeUnmounted() {
|
|
321
|
+
var e;
|
|
322
|
+
(e = t(this, d)) == null || e.abort();
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* 获取验证目标元素
|
|
326
|
+
* 返回当前选中的 ea-radio,如果没有选中则返回第一个 ea-radio
|
|
327
|
+
* @returns {HTMLElement}
|
|
328
|
+
*/
|
|
329
|
+
get validationTarget() {
|
|
330
|
+
const e = this.querySelector("ea-radio[checked]");
|
|
331
|
+
return e || this.querySelector("ea-radio") || t(this, c);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* 更新表单验证状态
|
|
335
|
+
*/
|
|
336
|
+
updateValidity() {
|
|
337
|
+
const e = this.value !== "" && this.value != null;
|
|
338
|
+
this.required && !e ? this.internals.setValidity(
|
|
339
|
+
{ valueMissing: !0 },
|
|
340
|
+
"请选择一个选项",
|
|
341
|
+
this
|
|
342
|
+
) : this.internals.setValidity({}, "", this);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* 检查表单字段的有效性
|
|
346
|
+
* @returns {boolean}
|
|
347
|
+
*/
|
|
348
|
+
checkValidity() {
|
|
349
|
+
return this.updateValidity(), this.internals.validity.valid;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* 报告表单字段的有效性(显示验证提示)
|
|
353
|
+
* @returns {boolean}
|
|
354
|
+
*/
|
|
355
|
+
reportValidity() {
|
|
356
|
+
return this.updateValidity(), this.internals.reportValidity();
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
c = new WeakMap(), g = new WeakMap(), f = new WeakMap(), d = new WeakMap(), m = new WeakMap(), y = new WeakMap(), v = new WeakMap(), C = new WeakMap(), A = new WeakMap();
|
|
360
|
+
window.customElements.get("ea-radio-group") || window.customElements.define("ea-radio-group", x);
|
|
361
|
+
export {
|
|
362
|
+
G as EaRadio,
|
|
363
|
+
x as EaRadioGroup
|
|
364
|
+
};
|