easy-component-ui 1.0.3 → 2.0.1
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/.github/workflows/publish.yml +28 -0
- package/components/Base.js +1 -90
- package/components/ea-alert/index.js +1 -298
- package/components/ea-alert/src/style/stylesheet.js +1 -0
- package/components/ea-aside/index.js +1 -0
- package/components/ea-avatar/index.js +1 -277
- package/components/ea-avatar/src/assets/defaultAvatar.js +1 -0
- package/components/ea-avatar/src/assets/errorAvatar.js +1 -0
- package/components/ea-avatar/src/assets/iconAndTextAvatar.js +1 -0
- package/components/ea-avatar/src/style/stylesheet.js +1 -0
- package/components/ea-backtop/index.js +1 -232
- package/components/ea-backtop/src/style/stylesheet.js +1 -0
- package/components/ea-badge/index.js +1 -160
- package/components/ea-badge/src/style/stylesheet.js +1 -0
- package/components/ea-breadcrumb/index.js +1 -0
- package/components/ea-breadcrumb/src/style/stylesheet.js +1 -0
- package/components/ea-breadcrumb-item/index.js +1 -0
- package/components/ea-breadcrumb-item/src/style/style.js +1 -0
- package/components/ea-button/index.js +1 -584
- package/components/ea-button/src/components/ButtonComm.js +1 -0
- package/components/ea-button/src/components/HrefComm.js +1 -0
- package/components/ea-button/src/style/stylesheet.js +1 -0
- package/components/ea-button-group/index.js +1 -459
- package/components/ea-button-group/src/style/stylesheet.js +1 -0
- package/components/ea-calendar/index.js +1 -409
- package/components/ea-calendar/src/style/stylesheet.js +1 -0
- package/components/ea-calendar/src/utils/createChangerElement.js +1 -0
- package/components/ea-calendar/src/utils/createThead.js +1 -0
- package/components/ea-calendar/src/utils/getDate.js +1 -0
- package/components/ea-calendar/src/utils/getUserWeekStart.js +1 -0
- package/components/ea-card/index.js +1 -77
- package/components/ea-card/src/style/stylesheet.js +1 -0
- package/components/ea-carousel/index.js +1 -434
- package/components/ea-carousel/src/style/stylesheet.js +1 -0
- package/components/ea-carousel/src/utils/handleIndexOverflow.js +1 -0
- package/components/ea-carousel-item/index.js +1 -0
- package/components/ea-carousel-item/src/style/stylesheet.js +1 -0
- package/components/ea-checkbox/index.js +1 -314
- package/components/ea-checkbox/src/style/stylesheet.js +1 -0
- package/components/ea-checkbox-group/index.js +1 -107
- package/components/ea-checkbox-group/src/style/stylesheet.js +1 -0
- package/components/ea-collapse/index.js +1 -293
- package/components/ea-collapse-item/index.js +1 -0
- package/components/ea-collapse-item/src/style/stylesheet.js +1 -0
- package/components/ea-container/index.js +1 -0
- package/components/ea-date-picker/index.js +1 -0
- package/components/ea-date-picker/src/style/stylesheet.js +1 -0
- package/components/ea-descriptions/index.js +1 -240
- package/components/ea-descriptions/src/components/contentTemplate.js +1 -0
- package/components/ea-descriptions/src/components/getTdTemplate_border.js +1 -0
- package/components/ea-descriptions/src/components/getTdTemplate_direction.js +1 -0
- package/components/ea-descriptions/src/components/getThTemplate_direction.js +1 -0
- package/components/ea-descriptions/src/components/getThTemplate_normal.js +1 -0
- package/components/ea-descriptions/src/style/stylesheet.js +1 -0
- package/components/ea-descriptions-item/index.js +1 -110
- package/components/ea-descriptions-item/src/stylesheet.js +1 -0
- package/components/ea-drawer/index.js +1 -0
- package/components/ea-drawer/src/style/stylesheet.js +1 -0
- package/components/ea-empty/index.js +1 -141
- package/components/ea-empty/src/assets/emptyStatusSVG.js +1 -0
- package/components/ea-empty/src/style/stylesheet.js +1 -0
- package/components/ea-footer/index.js +1 -0
- package/components/ea-form/index.js +1 -0
- package/components/ea-form-item/index.js +1 -0
- package/components/ea-form-item/src/style/stylesheet.js +1 -0
- package/components/ea-header/index.js +1 -0
- package/components/ea-icon/config.json +1029 -1017
- package/components/ea-icon/css/animation.css +85 -85
- package/components/ea-icon/css/fontello.css +226 -224
- package/components/ea-icon/font/fontello.eot +0 -0
- package/components/ea-icon/font/fontello.svg +350 -683
- package/components/ea-icon/font/fontello.ttf +0 -0
- package/components/ea-icon/font/fontello.woff +0 -0
- package/components/ea-icon/font/fontello.woff2 +0 -0
- package/components/ea-icon/index.js +1 -47
- package/components/ea-image/index.js +1 -412
- package/components/ea-image/src/assets/errorImage.js +1 -0
- package/components/ea-image/src/style/stylesheet.js +1 -0
- package/components/ea-image/src/utils/createPreviewTools.js +1 -0
- package/components/ea-infinite-scroll/index.js +1 -170
- package/components/ea-infinite-scroll-item/index.js +1 -0
- package/components/ea-input/index.js +1 -765
- package/components/ea-input/src/components/createFixIcon.js +1 -0
- package/components/ea-input/src/components/createSuggestionBoard.js +1 -0
- package/components/ea-input/src/components/createWordLimitElement.js +1 -0
- package/components/ea-input/src/style/stylesheet.js +1 -0
- package/components/ea-input/src/utils/dispatchEvent.js +1 -0
- package/components/ea-input/src/utils/handleSearchResult.js +1 -0
- package/components/ea-input/src/utils/handleSuggestionBoardTrigger.js +1 -0
- package/components/ea-input-number/index.js +1 -458
- package/components/ea-input-number/src/style/stylesheet.js +1 -0
- package/components/ea-input-number/src/utils/handleCustomEvent.js +1 -0
- package/components/ea-link/index.js +1 -200
- package/components/ea-link/src/style/stylesheet.js +1 -0
- package/components/ea-loading/index.js +1 -218
- package/components/ea-loading/src/style/stylesheet.js +1 -0
- package/components/ea-main/index.js +1 -0
- package/components/ea-menu/index.js +1 -0
- package/components/ea-menu/src/style/stylesheet.js +1 -0
- package/components/ea-menu/src/utils/handleMenuItemEvent.js +1 -0
- package/components/ea-menu-item/index.js +1 -0
- package/components/ea-menu-item/src/style/stylesheet.js +1 -0
- package/components/ea-menu-item-group/index.js +1 -0
- package/components/ea-menu-item-group/src/style/stylesheet.js +1 -0
- package/components/ea-message/index.js +1 -233
- package/components/ea-message/src/style/stylesheet.js +1 -0
- package/components/ea-message/src/utils/MessageClass.js +1 -0
- package/components/ea-message-box/index.js +1 -202
- package/components/ea-message-box/src/style/stylesheet.js +1 -0
- package/components/ea-message-box/src/utils/EaMessageBoxClass.js +1 -0
- package/components/ea-option/index.js +1 -0
- package/components/ea-option/src/style/stylesheet.js +1 -0
- package/components/ea-option-gropu/index.js +1 -0
- package/components/ea-page-header/index.js +1 -0
- package/components/ea-page-header/src/style/stylesheet.js +1 -0
- package/components/ea-pagination/index.js +1 -444
- package/components/ea-pagination/src/components/getMoreItem.js +1 -0
- package/components/ea-pagination/src/components/getPageItem.js +1 -0
- package/components/ea-pagination/src/components/getShowTotalItem.js +1 -0
- package/components/ea-pagination/src/style/stylesheet.js +1 -0
- package/components/ea-pane/index.js +1 -0
- package/components/ea-pane/src/stylesheet.js +1 -0
- package/components/ea-progress/index.js +1 -333
- package/components/ea-progress/src/components/SVGComm.js +1 -0
- package/components/ea-progress/src/style/stylesheet.js +1 -0
- package/components/ea-radio/index.js +1 -287
- package/components/ea-radio/src/style/stylesheet.js +1 -0
- package/components/ea-radio-group/index.js +1 -59
- package/components/ea-rate/index.js +1 -326
- package/components/ea-rate/src/components/rateComm.js +1 -0
- package/components/ea-rate/src/style/stylesheet.js +1 -0
- package/components/ea-result/index.js +1 -167
- package/components/ea-result/src/style/stylesheet.js +1 -0
- package/components/ea-select/index.js +1 -34
- package/components/ea-select/src/style/stylesheet.js +1 -0
- package/components/ea-skeleton/index.js +1 -341
- package/components/ea-skeleton/src/style/stylesheet.js +1 -0
- package/components/ea-skeleton/src/utils/createSkeletonElement.js +1 -0
- package/components/ea-skeleton-item/index.js +1 -0
- package/components/ea-skeleton-item/src/assets/imageSVG.js +1 -0
- package/components/ea-skeleton-item/src/style/stylesheet.js +1 -0
- package/components/ea-step/index.js +1 -0
- package/components/ea-step/src/style/stylesheet.js +1 -0
- package/components/ea-steps/index.js +1 -0
- package/components/ea-steps/src/style/stylesheet.js +1 -0
- package/components/ea-submenu/index.js +1 -0
- package/components/ea-submenu/src/style/stylesheet.js +1 -0
- package/components/ea-switch/index.js +1 -301
- package/components/ea-switch/src/style/stylesheet.js +1 -0
- package/components/ea-tab/index.js +1 -0
- package/components/ea-tab/src/style/stylesheet.js +1 -0
- package/components/ea-table/index.js +1 -0
- package/components/ea-table/src/style/stylesheet.js +1 -0
- package/components/ea-table-column/index.js +1 -0
- package/components/ea-tabs/index.js +1 -0
- package/components/ea-tabs/src/style/stylesheet.js +1 -0
- package/components/ea-tag/index.js +1 -212
- package/components/ea-tag/src/style/stylesheet.js +1 -0
- package/components/ea-textarea/index.js +1 -333
- package/components/ea-textarea/src/style/stylesheet.js +1 -0
- package/components/ea-time-picker/index.js +1 -0
- package/components/ea-time-picker/src/style/stylesheet.js +1 -0
- package/components/ea-timeline/index.js +1 -334
- package/components/ea-timeline/style/stylesheet.js +1 -0
- package/components/ea-timeline-item/index.js +1 -0
- package/components/ea-timeline-item/src/style/stylesheet.js +1 -0
- package/package.json +11 -11
- package/utils/Validator.js +1 -0
- package/utils/createElement.js +1 -30
- package/utils/handleDefaultAttrIsTrue.js +1 -0
- package/utils/handleTemplate.js +1 -19
- package/utils/setStyle.js +1 -8
- package/utils/timeout.js +1 -0
- package/components/ea-message/MessageClass.js +0 -71
- package/components/ea-message-box/EaMessageBoxClass.js +0 -48
- package/components/ea-ui-base-style.css +0 -0
|
@@ -1,333 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import Base from '../Base.js';
|
|
3
|
-
import "../ea-icon/index.js"
|
|
4
|
-
|
|
5
|
-
const stylesheet = `
|
|
6
|
-
.ea-progress_wrap {
|
|
7
|
-
position: relative;
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
width: 100%;
|
|
11
|
-
line-height: 1;
|
|
12
|
-
height: 1rem;
|
|
13
|
-
}
|
|
14
|
-
.ea-progress_wrap .ea-progress_track,
|
|
15
|
-
.ea-progress_wrap .ea-progress_path {
|
|
16
|
-
height: 0.5rem;
|
|
17
|
-
line-height: 1;
|
|
18
|
-
background-color: rgb(235, 238, 245);
|
|
19
|
-
border-radius: 999px;
|
|
20
|
-
}
|
|
21
|
-
.ea-progress_wrap .ea-progress_track {
|
|
22
|
-
width: 100%;
|
|
23
|
-
}
|
|
24
|
-
.ea-progress_wrap .ea-progress_track .ea-progress_path {
|
|
25
|
-
box-sizing: border-box;
|
|
26
|
-
padding-right: 0.5rem;
|
|
27
|
-
color: aliceblue;
|
|
28
|
-
font-size: 0.8rem;
|
|
29
|
-
text-align: right;
|
|
30
|
-
width: 0%;
|
|
31
|
-
background-color: #409eff;
|
|
32
|
-
transition: width 0.2s;
|
|
33
|
-
}
|
|
34
|
-
.ea-progress_wrap .ea-progress_text {
|
|
35
|
-
margin-left: 0.5rem;
|
|
36
|
-
font-size: 0.8rem;
|
|
37
|
-
width: 3rem;
|
|
38
|
-
}
|
|
39
|
-
.ea-progress_wrap .ea-progress_text--circle,
|
|
40
|
-
.ea-progress_wrap .ea-progress_text--dashboard {
|
|
41
|
-
position: absolute;
|
|
42
|
-
left: 50%;
|
|
43
|
-
top: 50%;
|
|
44
|
-
transform: translate(-50%, -50%);
|
|
45
|
-
}
|
|
46
|
-
.ea-progress_wrap svg circle {
|
|
47
|
-
stroke-width: 4px;
|
|
48
|
-
transform-origin: center center;
|
|
49
|
-
transition: stroke-dashoffset 0.2s;
|
|
50
|
-
}
|
|
51
|
-
.ea-progress_wrap svg .track--circle,
|
|
52
|
-
.ea-progress_wrap svg .path--circle {
|
|
53
|
-
transform: rotate(-90deg);
|
|
54
|
-
}
|
|
55
|
-
.ea-progress_wrap svg .track--dashboard,
|
|
56
|
-
.ea-progress_wrap svg .path--dashboard {
|
|
57
|
-
transform: rotate(161deg);
|
|
58
|
-
}
|
|
59
|
-
`;
|
|
60
|
-
|
|
61
|
-
const SVGTemplate = {
|
|
62
|
-
dashboard: `
|
|
63
|
-
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
|
|
64
|
-
<circle class="track--dashboard" cx="50" cy="50" r="40" fill="none" stroke-dasharray="252px" stroke="aliceblue"
|
|
65
|
-
stroke-width="4px" stroke-dashoffset="100" stroke-linecap="round" />
|
|
66
|
-
<circle class="path--dashboard" cx="50" cy="50" r="40" fill="none" stroke-dasharray="252px" stroke="rgb(32, 160, 255)" stroke-width="4px"
|
|
67
|
-
stroke-dashoffset="252" stroke-linecap="round" />
|
|
68
|
-
</svg>
|
|
69
|
-
<span class="ea-progress_text--dashboard"></span>
|
|
70
|
-
`,
|
|
71
|
-
circle: `
|
|
72
|
-
<svg viewBox="0 0 100 100">
|
|
73
|
-
<circle class="track--circle" cx="50" cy="50" r="48" fill="none" stroke="aliceblue" stroke-width="4" stroke-dasharray="302px" stroke-dashoffset="0" />
|
|
74
|
-
<circle class="path--circle" cx="50" cy="50" r="48" fill="none" stroke="rgb(32, 160, 255)" stroke-width="4" stroke-dasharray="302px" stroke-dashoffset="0" stroke-linecap="round" />
|
|
75
|
-
</svg>
|
|
76
|
-
<span class="ea-progress_text--circle"></span>
|
|
77
|
-
`,
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export class EaProgress extends Base {
|
|
81
|
-
#wrap;
|
|
82
|
-
#track;
|
|
83
|
-
#path;
|
|
84
|
-
#progressText;
|
|
85
|
-
|
|
86
|
-
constructor() {
|
|
87
|
-
super();
|
|
88
|
-
|
|
89
|
-
const shadowRoot = this.attachShadow({ mode: 'open' });
|
|
90
|
-
const wrap = document.createElement('div');
|
|
91
|
-
wrap.className = 'ea-progress_wrap';
|
|
92
|
-
|
|
93
|
-
// 背景条
|
|
94
|
-
const track = document.createElement('section');
|
|
95
|
-
track.className = 'ea-progress_track';
|
|
96
|
-
|
|
97
|
-
// 进度条
|
|
98
|
-
const path = document.createElement('section');
|
|
99
|
-
path.className = 'ea-progress_path';
|
|
100
|
-
|
|
101
|
-
track.appendChild(path);
|
|
102
|
-
wrap.appendChild(track);
|
|
103
|
-
|
|
104
|
-
// 进度文字
|
|
105
|
-
const progressText = document.createElement('section');
|
|
106
|
-
progressText.className = 'ea-progress_text';
|
|
107
|
-
|
|
108
|
-
wrap.appendChild(progressText);
|
|
109
|
-
|
|
110
|
-
this.#wrap = wrap;
|
|
111
|
-
this.#track = track;
|
|
112
|
-
this.#path = path;
|
|
113
|
-
this.#progressText = progressText;
|
|
114
|
-
|
|
115
|
-
this.setIconFile(new URL('../ea-icon/index.css', import.meta.url).href);
|
|
116
|
-
this.build(shadowRoot, stylesheet);
|
|
117
|
-
this.shadowRoot.appendChild(wrap);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// ------- type 进度条类型 -------
|
|
121
|
-
// #region
|
|
122
|
-
|
|
123
|
-
handleSVGTemplate(type) {
|
|
124
|
-
this.#wrap.style.height = '126px';
|
|
125
|
-
this.#wrap.style.width = '126px';
|
|
126
|
-
|
|
127
|
-
this.#wrap.innerHTML = SVGTemplate[type];
|
|
128
|
-
|
|
129
|
-
const track = this.#wrap.querySelector(`circle[class="track--${type}"]`);
|
|
130
|
-
const path = this.#wrap.querySelector(`circle[class="path--${type}"]`);
|
|
131
|
-
const progressText = this.#wrap.querySelector(`span[class="ea-progress_text--${type}"]`);
|
|
132
|
-
|
|
133
|
-
this.#track = track;
|
|
134
|
-
this.#path = path;
|
|
135
|
-
this.#progressText = progressText;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
get type() {
|
|
139
|
-
return this.getAttribute('type');
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
set type(value) {
|
|
143
|
-
if (value === null || value === undefined || value === '') return;
|
|
144
|
-
|
|
145
|
-
this.setAttribute('type', value);
|
|
146
|
-
|
|
147
|
-
switch (this.type) {
|
|
148
|
-
case "circle":
|
|
149
|
-
this.handleSVGTemplate("circle");
|
|
150
|
-
break;
|
|
151
|
-
case "dashboard":
|
|
152
|
-
this.handleSVGTemplate("dashboard");
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
// #endregion
|
|
157
|
-
// ------- end -------
|
|
158
|
-
|
|
159
|
-
// ------- percentage 进度百分比 -------
|
|
160
|
-
// #region
|
|
161
|
-
get percentage() {
|
|
162
|
-
return this.getAttribute('percentage') || 0;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
getCirclePercentageValue(value) {
|
|
166
|
-
return 302 * (100 - Number(value)) / 100;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
getDashboardPercentageValue(value) {
|
|
170
|
-
return 152 * (100 - Number(value)) / 100 + 100;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
set percentage(value) {
|
|
174
|
-
if (value === null || value === undefined || value === '') return;
|
|
175
|
-
else if (Number(value) < 0) value = 0;
|
|
176
|
-
else if (Number(value) > 100) value = 100;
|
|
177
|
-
|
|
178
|
-
this.setAttribute('percentage', value);
|
|
179
|
-
this.#progressText.innerHTML = `${value}%`;
|
|
180
|
-
|
|
181
|
-
switch (this.type) {
|
|
182
|
-
case "circle": {
|
|
183
|
-
this.#path.style.strokeDashoffset = `${this.getCirclePercentageValue(value)}px`;
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
case "dashboard": {
|
|
187
|
-
this.#path.style.strokeDashoffset = `${this.getDashboardPercentageValue(value)}px`;
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
default: {
|
|
191
|
-
this.#path.style.width = `${value}%`;
|
|
192
|
-
|
|
193
|
-
if (this.textInside) this.handleTextInside(value);
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
// #endregion
|
|
199
|
-
// ------- end -------
|
|
200
|
-
|
|
201
|
-
// ------- status 进度条状态样式 -------
|
|
202
|
-
// #region
|
|
203
|
-
|
|
204
|
-
// 样式配置
|
|
205
|
-
get statusList() {
|
|
206
|
-
return {
|
|
207
|
-
success: {
|
|
208
|
-
icon: 'icon-ok-circled',
|
|
209
|
-
color: '#67c23a'
|
|
210
|
-
},
|
|
211
|
-
warning: {
|
|
212
|
-
icon: 'icon-attention-circled',
|
|
213
|
-
color: '#e6a23c'
|
|
214
|
-
},
|
|
215
|
-
exception: {
|
|
216
|
-
icon: 'icon-cancel-circled',
|
|
217
|
-
color: '#f56c6c'
|
|
218
|
-
},
|
|
219
|
-
primary: '',
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// 状态处理
|
|
224
|
-
handleStatusStyle(value, className) {
|
|
225
|
-
this.#progressText.innerText = !this.statusList[value] ? `${this.percentage}%` : '';
|
|
226
|
-
this.#progressText.className = `${className} ${this.statusList[value].icon || ''}`;
|
|
227
|
-
this.#progressText.style.color = this.statusList[value].color;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
get status() {
|
|
231
|
-
return this.getAttribute('status') || 'primary';
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
set status(value) {
|
|
235
|
-
this.setAttribute('status', value);
|
|
236
|
-
|
|
237
|
-
switch (this.type) {
|
|
238
|
-
case "circle":
|
|
239
|
-
this.handleStatusStyle(value, 'ea-progress_text--circle');
|
|
240
|
-
this.#path.style.stroke = this.statusList[value].color;
|
|
241
|
-
break;
|
|
242
|
-
case "dashboard":
|
|
243
|
-
this.handleStatusStyle(value, 'ea-progress_text--dashboard');
|
|
244
|
-
this.#path.style.stroke = this.statusList[value].color;
|
|
245
|
-
break;
|
|
246
|
-
default:
|
|
247
|
-
this.handleStatusStyle(value, 'ea-progress_text');
|
|
248
|
-
this.#path.style.backgroundColor = this.statusList[value].color;
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
// #endregion
|
|
253
|
-
// ------- end -------
|
|
254
|
-
|
|
255
|
-
// ------- text-inside 进度文字内显 -------
|
|
256
|
-
// #region
|
|
257
|
-
handleTextInside(value) {
|
|
258
|
-
if (this.type === "circle") return;
|
|
259
|
-
|
|
260
|
-
if (value) {
|
|
261
|
-
this.#progressText.style.display = "none";
|
|
262
|
-
this.#path.innerText = `${this.percentage}%`;
|
|
263
|
-
} else {
|
|
264
|
-
this.#progressText.style.display = "block";
|
|
265
|
-
this.#path.innerText = ``;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
get textInside() {
|
|
270
|
-
return this.getAttrBoolean("text-inside");
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
set textInside(value) {
|
|
274
|
-
this.setAttribute("text-inside", value);
|
|
275
|
-
|
|
276
|
-
this.handleTextInside(value);
|
|
277
|
-
}
|
|
278
|
-
// #endregion
|
|
279
|
-
// ------- end -------
|
|
280
|
-
|
|
281
|
-
// ------- stroke-width 进度条高度 -------
|
|
282
|
-
// #region
|
|
283
|
-
get strokeWidth() {
|
|
284
|
-
return this.getAttribute("stroke-width");
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
set strokeWidth(value) {
|
|
288
|
-
value = value ? value : 4;
|
|
289
|
-
|
|
290
|
-
this.toggleAttr("stroke-width", value);
|
|
291
|
-
|
|
292
|
-
if (this.type === "circle") {
|
|
293
|
-
this.#track.style.strokeWidth = `${Number(value)}px`;
|
|
294
|
-
this.#path.style.strokeWidth = `${Number(value)}px`;
|
|
295
|
-
} else {
|
|
296
|
-
value = Number(value) + 4;
|
|
297
|
-
|
|
298
|
-
this.#track.style.height = `${value}px`;
|
|
299
|
-
this.#track.style.lineHeight = `${value}px`;
|
|
300
|
-
this.#path.style.height = `${value}px`;
|
|
301
|
-
this.#path.style.lineHeight = `${value}px`;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
// #endregion
|
|
305
|
-
// ------- end -------
|
|
306
|
-
|
|
307
|
-
init() {
|
|
308
|
-
const that = this;
|
|
309
|
-
|
|
310
|
-
// type 进度条类型
|
|
311
|
-
this.type = this.type;
|
|
312
|
-
|
|
313
|
-
// percentage 百分比
|
|
314
|
-
this.percentage = this.percentage;
|
|
315
|
-
|
|
316
|
-
// status 状态
|
|
317
|
-
this.status = this.status;
|
|
318
|
-
|
|
319
|
-
// text-inside 文本内显
|
|
320
|
-
this.textInside = this.textInside;
|
|
321
|
-
|
|
322
|
-
// stroke-width 进度条的高度
|
|
323
|
-
this.strokeWidth = this.strokeWidth;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
connectedCallback() {
|
|
327
|
-
this.init();
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
if (!customElements.get("ea-progress")) {
|
|
332
|
-
customElements.define("ea-progress", EaProgress);
|
|
333
|
-
}
|
|
1
|
+
import Base from"../Base.js";import"../ea-icon/index.js";import{stylesheet}from"./src/style/stylesheet.js";import{SVGComm}from"./src/components/SVGComm.js";export class EaProgress extends Base{#t;#e;#s;#r;constructor(){super();const t=this.attachShadow({mode:"open"});t.innerHTML='\n <div class="ea-progress_wrap" part="container">\n <section class="ea-progress_track" part="track-wrap">\n <section class="ea-progress_path" part="path"></section>\n </section>\n <section class="ea-progress_text" part="text-wrap"></section>\n </div>\n ',this.#t=t.querySelector(".ea-progress_wrap"),this.#e=t.querySelector(".ea-progress_track"),this.#s=t.querySelector(".ea-progress_path"),this.#r=t.querySelector(".ea-progress_text"),this.build(t,stylesheet)}get type(){return this.getAttribute("type")}set type(t){if(t)switch(this.setAttribute("type",t),this.type){case"circle":this.#i("circle");break;case"dashboard":this.#i("dashboard")}}get percentage(){return this.getAttribute("percentage")||0}#a(t){return 302*(100-Number(t))/100}#h(t){return 152*(100-Number(t))/100+100}set percentage(t){if(!isNaN(Number(t)))switch(Number(t)<0?t=0:Number(t)>100&&(t=100),this.setAttribute("percentage",t),this.#r.innerHTML=`${t}%`,this.type){case"circle":this.#s.style.strokeDashoffset=`${this.#a(t)}px`;break;case"dashboard":this.#s.style.strokeDashoffset=`${this.#h(t)}px`;break;default:this.#s.style.width=`${t}%`,this.textInside&&this.#c(t)}}get statusList(){return{success:{icon:"icon-ok-circled",color:"#67c23a"},warning:{icon:"icon-attention-circled",color:"#e6a23c"},exception:{icon:"icon-cancel-circled",color:"#f56c6c"},primary:{}}}#o(t,e){!this.type&&this.textInside||"dashboard"===this.type||"circle"===this.type?this.#r.innerText=`${this.percentage}%`:this.#r.innerText="",this.#r.className=`${e} ${this.statusList[t].icon||""}`,this.#r.style.color=this.statusList[t].color}get status(){return this.getAttribute("status")||"primary"}set status(t){switch(this.setAttribute("status",t),this.type){case"circle":this.#o(t,"ea-progress_text--circle"),this.#s.style.stroke=this.statusList[t].color;break;case"dashboard":this.#o(t,"ea-progress_text--dashboard"),this.#s.style.stroke=this.statusList[t].color;break;default:this.#o(t,"ea-progress_text"),this.#s.style.backgroundColor=this.statusList[t].color}}get textInside(){return this.getAttrBoolean("text-inside")}set textInside(t){"circle"!==this.type&&(this.setAttribute("text-inside",t),this.#c(t))}get strokeWidth(){return this.getAttribute("stroke-width")}set strokeWidth(t){t=t?Number(t):4,this.toggleAttr("stroke-width",t),"circle"===this.type||"dashboard"===this.type?(this.#e.style.strokeWidth=`${t}px`,this.#s.style.strokeWidth=`${t}px`):(t+=4,this.#e.style.height=`${t}px`,this.#e.style.lineHeight=`${t}px`,this.#s.style.height=`${t}px`,this.#s.style.lineHeight=`${t}px`,this.#t.style.height=`${t}px`,this.#t.style.lineHeight=`${t}px`)}#i(t){this.#t.style.height="126px",this.#t.style.width="126px",this.#t.innerHTML=SVGComm[t];const e=this.#t.querySelector(`circle[class="track--${t}"]`),s=this.#t.querySelector(`circle[class="path--${t}"]`),r=this.#t.querySelector(`span[class="ea-progress_text--${t}"]`);this.#e=e,this.#s=s,this.#r=r}#c(t){t?(this.#r.style.display="none",this.#s.innerText=`${this.percentage}%`):(this.#r.style.display="block",this.#s.innerText="")}connectedCallback(){this.type=this.type,this.percentage=this.percentage,this.status=this.status,this.textInside=this.textInside,this.strokeWidth=this.strokeWidth}}customElements.get("ea-progress")||customElements.define("ea-progress",EaProgress);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SVGComm={dashboard:'\n <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">\n <circle class="track--dashboard" cx="50" cy="50" r="40" fill="none" stroke-dasharray="252px" stroke="aliceblue"\n stroke-width="4px" stroke-dashoffset="100" stroke-linecap="round" />\n <circle class="path--dashboard" cx="50" cy="50" r="40" fill="none" stroke-dasharray="252px" stroke="rgb(32, 160, 255)" stroke-width="4px"\n stroke-dashoffset="252" stroke-linecap="round" />\n </svg>\n <span class="ea-progress_text--dashboard"></span>\n ',circle:'\n <svg viewBox="0 0 100 100">\n <circle class="track--circle" cx="50" cy="50" r="48" fill="none" stroke="aliceblue" stroke-width="4" stroke-dasharray="302px" stroke-dashoffset="0" />\n <circle class="path--circle" cx="50" cy="50" r="48" fill="none" stroke="rgb(32, 160, 255)" stroke-width="4" stroke-dasharray="302px" stroke-dashoffset="0" stroke-linecap="round" />\n </svg>\n <span class="ea-progress_text--circle"></span>\n '};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const stylesheet="\n.ea-progress_wrap {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n line-height: 1;\n height: 1rem;\n}\n.ea-progress_wrap .ea-progress_track,\n.ea-progress_wrap .ea-progress_path {\n height: 0.5rem;\n line-height: 1;\n background-color: rgb(235, 238, 245);\n border-radius: 999px;\n}\n.ea-progress_wrap .ea-progress_track {\n width: 100%;\n}\n.ea-progress_wrap .ea-progress_track .ea-progress_path {\n box-sizing: border-box;\n padding-right: 0.5rem;\n color: aliceblue;\n font-size: 0.8rem;\n text-align: right;\n width: 0%;\n background-color: #409eff;\n transition: width 0.2s;\n}\n.ea-progress_wrap .ea-progress_text {\n margin-left: 0.5rem;\n font-size: 0.8rem;\n width: 3rem;\n}\n.ea-progress_wrap .ea-progress_text--circle,\n.ea-progress_wrap .ea-progress_text--dashboard {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n.ea-progress_wrap svg circle {\n stroke-width: 4px;\n transform-origin: center center;\n transition: stroke-dashoffset 0.2s;\n}\n.ea-progress_wrap svg .track--circle,\n.ea-progress_wrap svg .path--circle {\n transform: rotate(-90deg);\n}\n.ea-progress_wrap svg .track--dashboard,\n.ea-progress_wrap svg .path--dashboard {\n transform: rotate(161deg);\n}\n";
|
|
@@ -1,287 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import Base from '../Base.js'
|
|
3
|
-
|
|
4
|
-
const stylesheet = `
|
|
5
|
-
:host(ea-radio) {
|
|
6
|
-
--margin-right: 0.75rem;
|
|
7
|
-
--text-color: #606266;
|
|
8
|
-
--radio-show-type: inline-block;
|
|
9
|
-
--button-size: 1rem;
|
|
10
|
-
--button-margin: 0.5rem;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.ea-radio_wrap {
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: center;
|
|
16
|
-
margin-right: 1rem;
|
|
17
|
-
}
|
|
18
|
-
.ea-radio_wrap .__ea-radio-input_wrap {
|
|
19
|
-
width: var(--button-size);
|
|
20
|
-
height: var(--button-size);
|
|
21
|
-
line-height: 1;
|
|
22
|
-
margin-right: var(--button-margin);
|
|
23
|
-
}
|
|
24
|
-
.ea-radio_wrap .__ea-radio-input_wrap input {
|
|
25
|
-
display: none;
|
|
26
|
-
}
|
|
27
|
-
.ea-radio_wrap .__ea-radio-input_wrap .__ea-radio-input_inner {
|
|
28
|
-
position: relative;
|
|
29
|
-
display: var(--radio-show-type);
|
|
30
|
-
width: 1rem;
|
|
31
|
-
height: 1rem;
|
|
32
|
-
line-height: 1;
|
|
33
|
-
box-sizing: border-box;
|
|
34
|
-
border-radius: 50%;
|
|
35
|
-
border: 1px solid #606266;
|
|
36
|
-
}
|
|
37
|
-
.ea-radio_wrap .__ea-radio-input_wrap .__ea-radio-input_inner::before {
|
|
38
|
-
position: absolute;
|
|
39
|
-
left: 50%;
|
|
40
|
-
top: 50%;
|
|
41
|
-
transform: translate(-50%, -50%);
|
|
42
|
-
content: "";
|
|
43
|
-
width: 0.35rem;
|
|
44
|
-
height: 0.35rem;
|
|
45
|
-
border-radius: 50%;
|
|
46
|
-
background-color: transparent;
|
|
47
|
-
box-sizing: border-box;
|
|
48
|
-
transition: all 0.3s ease;
|
|
49
|
-
}
|
|
50
|
-
.ea-radio_wrap .__ea-radio-input_wrap .__ea-radio-input_inner:hover {
|
|
51
|
-
border-color: #409eff;
|
|
52
|
-
}
|
|
53
|
-
.ea-radio_wrap .__ea-radio-label_desc {
|
|
54
|
-
color: var(--text-color);
|
|
55
|
-
}
|
|
56
|
-
.ea-radio_wrap.checked .__ea-radio-input_wrap .__ea-radio-input_inner {
|
|
57
|
-
border-color: #409eff;
|
|
58
|
-
background-color: #409eff;
|
|
59
|
-
}
|
|
60
|
-
.ea-radio_wrap.checked .__ea-radio-input_wrap .__ea-radio-input_inner::before {
|
|
61
|
-
background-color: white;
|
|
62
|
-
}
|
|
63
|
-
.ea-radio_wrap.checked .__ea-radio-label_desc {
|
|
64
|
-
color: #409eff;
|
|
65
|
-
}
|
|
66
|
-
.ea-radio_wrap.disabled .__ea-radio-input_wrap .__ea-radio-input_inner {
|
|
67
|
-
border-color: #eeeeee;
|
|
68
|
-
background-color: #eeeeee;
|
|
69
|
-
}
|
|
70
|
-
.ea-radio_wrap.disabled .__ea-radio-input_wrap .__ea-radio-input_inner::before {
|
|
71
|
-
background-color: transparent;
|
|
72
|
-
}
|
|
73
|
-
.ea-radio_wrap.disabled .__ea-radio-label_desc {
|
|
74
|
-
color: #c0c4cc;
|
|
75
|
-
}
|
|
76
|
-
.ea-radio_wrap.disabled[checked=true] .__ea-radio-input_wrap .__ea-radio-input_inner::before {
|
|
77
|
-
background-color: #c0c4cc;
|
|
78
|
-
}
|
|
79
|
-
.ea-radio_wrap.border {
|
|
80
|
-
border: 1px solid #ccc;
|
|
81
|
-
padding: 0.25rem 0.5rem;
|
|
82
|
-
border-radius: 8px;
|
|
83
|
-
}
|
|
84
|
-
.ea-radio_wrap.border[checked=true] {
|
|
85
|
-
border: 1px solid #409eff;
|
|
86
|
-
}`;
|
|
87
|
-
|
|
88
|
-
const inputDom = () => {
|
|
89
|
-
const wrap = document.createElement('span');
|
|
90
|
-
wrap.className = "__ea-radio-input_wrap";
|
|
91
|
-
|
|
92
|
-
const radio = document.createElement('span');
|
|
93
|
-
radio.className = "__ea-radio-input_inner";
|
|
94
|
-
wrap.appendChild(radio);
|
|
95
|
-
|
|
96
|
-
const input = document.createElement('input');
|
|
97
|
-
input.type = 'radio';
|
|
98
|
-
input.className = "__ea-radio-input_input";
|
|
99
|
-
|
|
100
|
-
wrap.appendChild(input);
|
|
101
|
-
|
|
102
|
-
return { wrap, input };
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const labelDom = () => {
|
|
106
|
-
const labelDesc = document.createElement('span');
|
|
107
|
-
labelDesc.className = "__ea-radio-label_desc";
|
|
108
|
-
const slot = document.createElement('slot');
|
|
109
|
-
labelDesc.appendChild(slot);
|
|
110
|
-
|
|
111
|
-
return labelDesc;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export class EaRadio extends Base {
|
|
115
|
-
#radio;
|
|
116
|
-
#label;
|
|
117
|
-
|
|
118
|
-
static get observedAttributes() {
|
|
119
|
-
return ['checked'];
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
constructor() {
|
|
123
|
-
super();
|
|
124
|
-
|
|
125
|
-
const shadowRoot = this.attachShadow({ mode: 'open' });
|
|
126
|
-
let dom = document.createElement('label');
|
|
127
|
-
dom.className = "ea-radio_wrap";
|
|
128
|
-
|
|
129
|
-
// input + radio
|
|
130
|
-
const input = inputDom();
|
|
131
|
-
dom.appendChild(input.wrap);
|
|
132
|
-
|
|
133
|
-
// label 标签文字
|
|
134
|
-
const label = labelDom();
|
|
135
|
-
dom.appendChild(label);
|
|
136
|
-
|
|
137
|
-
this.#label = dom;
|
|
138
|
-
this.#radio = input.input;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
// ------- 打包 -------
|
|
142
|
-
// #region
|
|
143
|
-
const styleNode = document.createElement('style');
|
|
144
|
-
styleNode.innerHTML = stylesheet;
|
|
145
|
-
this.shadowRoot.appendChild(styleNode);
|
|
146
|
-
// #endregion
|
|
147
|
-
// ------- end -------
|
|
148
|
-
|
|
149
|
-
// ------- 本地调试 -------
|
|
150
|
-
// #region
|
|
151
|
-
// setStyle(shadowRoot, new URL('./index.css', import.meta.url).href);
|
|
152
|
-
// #endregion
|
|
153
|
-
// ------- end -------
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
shadowRoot.appendChild(dom);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// ------- 选中 -------
|
|
160
|
-
// #region
|
|
161
|
-
get checked() {
|
|
162
|
-
return this.getAttrBoolean('checked');
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
set checked(val) {
|
|
166
|
-
this.#radio.checked = val;
|
|
167
|
-
|
|
168
|
-
if (val) {
|
|
169
|
-
this.setAttribute('checked', true);
|
|
170
|
-
this.#label.setAttribute('checked', true);
|
|
171
|
-
this.#label.classList.add('checked');
|
|
172
|
-
} else {
|
|
173
|
-
this.removeAttribute('checked');
|
|
174
|
-
this.#label.removeAttribute('checked');
|
|
175
|
-
this.#label.classList.remove('checked');
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
// #endregion
|
|
179
|
-
// ------- end -------
|
|
180
|
-
|
|
181
|
-
// ------- label_for 单选框的唯一键 -------
|
|
182
|
-
// #region
|
|
183
|
-
get name() {
|
|
184
|
-
return this.getAttribute('name');
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
set name(val) {
|
|
188
|
-
this.#radio.setAttribute('name', val);
|
|
189
|
-
}
|
|
190
|
-
// #endregion
|
|
191
|
-
// ------- end -------
|
|
192
|
-
|
|
193
|
-
// ------- value 单选框的值 -------
|
|
194
|
-
// #region
|
|
195
|
-
get value() {
|
|
196
|
-
return this.getAttribute('value');
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
set value(val) {
|
|
200
|
-
this.#label.setAttribute('for', val);
|
|
201
|
-
this.#radio.setAttribute('id', val);
|
|
202
|
-
this.#radio.setAttribute('value', val);
|
|
203
|
-
}
|
|
204
|
-
// #endregion
|
|
205
|
-
// ------- end -------
|
|
206
|
-
|
|
207
|
-
// ------- disabled 禁用状态 -------
|
|
208
|
-
// #region
|
|
209
|
-
get disabled() {
|
|
210
|
-
return this.getAttrBoolean('disabled');
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
set disabled(val) {
|
|
214
|
-
this.#radio.disabled = val;
|
|
215
|
-
this.#label.toggleAttribute('disabled', val);
|
|
216
|
-
this.#label.classList.toggle('disabled', val);
|
|
217
|
-
}
|
|
218
|
-
// #endregion
|
|
219
|
-
// ------- end -------
|
|
220
|
-
|
|
221
|
-
// ------- border 是否带有边框 -------
|
|
222
|
-
// #region
|
|
223
|
-
get border() {
|
|
224
|
-
return this.getAttrBoolean('border');
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
set border(val) {
|
|
228
|
-
this.#label.classList.toggle('border', val);
|
|
229
|
-
}
|
|
230
|
-
// #endregion
|
|
231
|
-
// ------- end -------
|
|
232
|
-
|
|
233
|
-
init() {
|
|
234
|
-
const that = this;
|
|
235
|
-
|
|
236
|
-
// radio 的 checked 属性
|
|
237
|
-
this.checked = this.checked;
|
|
238
|
-
|
|
239
|
-
// label 的 for 属性
|
|
240
|
-
this.name = this.name;
|
|
241
|
-
|
|
242
|
-
// radio 的 value 属性
|
|
243
|
-
this.value = this.value;
|
|
244
|
-
|
|
245
|
-
// radio 的 disabled 属性
|
|
246
|
-
this.disabled = this.disabled;
|
|
247
|
-
|
|
248
|
-
// border 属性
|
|
249
|
-
this.border = this.border;
|
|
250
|
-
|
|
251
|
-
// 监听 change 事件, 修改 checked 属性
|
|
252
|
-
this.#radio.addEventListener('change', function (e) {
|
|
253
|
-
if (e.target.checked) {
|
|
254
|
-
document.querySelectorAll(`ea-radio[name="${that.name}"]`).forEach(btn => {
|
|
255
|
-
const btnInput = btn.shadowRoot.querySelector('input');
|
|
256
|
-
|
|
257
|
-
if (btnInput !== this) {
|
|
258
|
-
btn.checked = false;
|
|
259
|
-
} else {
|
|
260
|
-
btn.checked = true;
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
that.dispatchEvent(new CustomEvent('change', {
|
|
266
|
-
detail: {
|
|
267
|
-
value: this.value,
|
|
268
|
-
checked: this.checked
|
|
269
|
-
}
|
|
270
|
-
}))
|
|
271
|
-
})
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
connectedCallback() {
|
|
277
|
-
this.init();
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
attributeChangedCallback(name, oldVal, newVal) {
|
|
281
|
-
// console.log(name);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
if (!window.customElements.get("ea-radio")) {
|
|
286
|
-
window.customElements.define("ea-radio", EaRadio);
|
|
287
|
-
}
|
|
1
|
+
import Base from"../Base.js";import{stylesheet}from"./src/style/stylesheet.js";export class EaRadio extends Base{#e;#t;constructor(){super();const e=this.attachShadow({mode:"open"});e.innerHTML='\n <label class="ea-radio_wrap" part="container">\n <span class="ea-radio-input_wrap" part="input-wrap">\n <span class="ea-radio-input_inner" part="input"></span>\n <input class="ea-radio-input_input" type="radio" />\n </span>\n <span class="ea-radio-label_desc" part="label-wrap">\n <slot></slot>\n </span>\n </label>\n ',this.#t=e.querySelector(".ea-radio_wrap"),this.#e=e.querySelector(".ea-radio-input_input"),this.build(e,stylesheet)}get checked(){return this.getAttrBoolean("checked")}set checked(e){this.setAttribute("checked",e),this.#t.setAttribute("checked",e),this.#e.checked=e,this.#t.classList.toggle("checked",e)}get name(){return this.getAttribute("name")}set name(e){this.#e.setAttribute("name",e)}get value(){return this.getAttribute("value")}set value(e){this.#t.setAttribute("for",e),this.#e.setAttribute("id",e),this.#e.setAttribute("value",e)}get disabled(){return this.getAttrBoolean("disabled")}set disabled(e){this.#e.disabled=e,this.#t.setAttribute("disabled",e),this.#t.classList.toggle("disabled",e)}get border(){return this.getAttrBoolean("border")}set border(e){this.#t.classList.toggle("border",e)}connectedCallback(){this.checked=this.checked,this.name=this.name,this.value=this.value,this.disabled=this.disabled,this.border=this.border,this.#e.addEventListener("change",(e=>{document.querySelectorAll(`ea-radio[name="${this.name}"]`).forEach((e=>{const t=e.shadowRoot.querySelector("input");e.checked=t===this.#e})),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value,checked:this.checked}}))}))}}window.customElements.get("ea-radio")||window.customElements.define("ea-radio",EaRadio);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const stylesheet='\n:host {\n --margin-right: 0.75rem;\n --text-color: #606266;\n --radio-show-type: inline-block;\n --button-size: 1rem;\n --button-margin: 0.5rem;\n}\n\n.ea-radio_wrap {\n display: flex;\n align-items: center;\n margin-right: 1rem;\n}\n.ea-radio_wrap .ea-radio-input_wrap {\n width: var(--button-size);\n height: var(--button-size);\n line-height: 1;\n margin-right: var(--button-margin);\n}\n.ea-radio_wrap .ea-radio-input_wrap input {\n display: none;\n}\n.ea-radio_wrap .ea-radio-input_wrap .ea-radio-input_inner {\n position: relative;\n display: var(--radio-show-type);\n width: 1rem;\n height: 1rem;\n line-height: 1;\n box-sizing: border-box;\n border-radius: 50%;\n border: 1px solid #606266;\n}\n.ea-radio_wrap .ea-radio-input_wrap .ea-radio-input_inner::before {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n content: "";\n width: 0.35rem;\n height: 0.35rem;\n border-radius: 50%;\n background-color: transparent;\n box-sizing: border-box;\n transition: all 0.3s ease;\n}\n.ea-radio_wrap .ea-radio-input_wrap .ea-radio-input_inner:hover {\n border-color: #409eff;\n}\n.ea-radio_wrap .ea-radio-label_desc {\n color: var(--text-color);\n}\n.ea-radio_wrap.checked .ea-radio-input_wrap .ea-radio-input_inner {\n border-color: #409eff;\n background-color: #409eff;\n}\n.ea-radio_wrap.checked .ea-radio-input_wrap .ea-radio-input_inner::before {\n background-color: white;\n}\n.ea-radio_wrap.checked .ea-radio-label_desc {\n color: #409eff;\n}\n.ea-radio_wrap.disabled .ea-radio-input_wrap .ea-radio-input_inner {\n border-color: #eeeeee;\n background-color: #eeeeee;\n}\n.ea-radio_wrap.disabled .ea-radio-input_wrap .ea-radio-input_inner::before {\n background-color: transparent;\n}\n.ea-radio_wrap.disabled .ea-radio-label_desc {\n color: #c0c4cc;\n}\n.ea-radio_wrap.disabled[checked=true] .ea-radio-input_inner::before {\n background-color: #c0c4cc;\n}\n.ea-radio_wrap.border {\n border: 1px solid #ccc;\n padding: 0.25rem 0.5rem;\n border-radius: 8px;\n}\n.ea-radio_wrap.border[checked=true] {\n border: 1px solid #409eff;\n}\n';
|