easy-component-ui 1.0.3 → 2.0.2
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,341 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import Base from '../Base.js';
|
|
3
|
-
|
|
4
|
-
const imageElement = `
|
|
5
|
-
<svg class="skeleton-image" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
|
|
6
|
-
<path d="M15 20h70v60H15z" stroke="#c0c4cc" stroke-width="5px" fill="none" />
|
|
7
|
-
<circle r="8" cx="32" cy="35" fill="#c0c4cc" />
|
|
8
|
-
<path d="M60 42.5L39 75h42z" fill="#c0c4cc" />
|
|
9
|
-
<path d="M35 52.5L20 75h-4 32z" fill="#c0c4cc" />
|
|
10
|
-
</svg>
|
|
11
|
-
`;
|
|
12
|
-
|
|
13
|
-
const stylesheet = `
|
|
14
|
-
@keyframes skeleton-loading {
|
|
15
|
-
0% {
|
|
16
|
-
background-position: 100% 50%;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
.ea-skeleton_item,
|
|
20
|
-
.ea-skeleton-item_wrap {
|
|
21
|
-
position: relative;
|
|
22
|
-
display: inline-block;
|
|
23
|
-
background-color: #f2f2f2;
|
|
24
|
-
height: 16px;
|
|
25
|
-
border-radius: 4px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.ea-skeleton-item_wrap.animated {
|
|
29
|
-
background-image: linear-gradient(90deg, #f6f6f6 25%, #e8e8e8 37%, #f6f6f6 63%);
|
|
30
|
-
background-size: 400% 100%;
|
|
31
|
-
animation: skeleton-loading 1.4s ease infinite;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.ea-skeleton_wrap.animated .ea-skeleton_item {
|
|
35
|
-
background-image: linear-gradient(90deg, #f6f6f6 25%, #e8e8e8 37%, #f6f6f6 63%);
|
|
36
|
-
background-size: 400% 100%;
|
|
37
|
-
animation: skeleton-loading 1.4s ease infinite;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.ea-skeleton_wrap {
|
|
41
|
-
width: 100%;
|
|
42
|
-
}
|
|
43
|
-
.ea-skeleton_wrap .ea-skeleton_item.el-skeleton_p {
|
|
44
|
-
width: 100%;
|
|
45
|
-
}
|
|
46
|
-
.ea-skeleton_wrap .ea-skeleton_item.el-skeleton_p.el-skeleton_paragraph {
|
|
47
|
-
width: 100%;
|
|
48
|
-
margin-top: 16px;
|
|
49
|
-
}
|
|
50
|
-
.ea-skeleton_wrap .ea-skeleton_item.el-skeleton_p.is-first {
|
|
51
|
-
width: 33%;
|
|
52
|
-
}
|
|
53
|
-
.ea-skeleton_wrap .ea-skeleton_item.el-skeleton_p.is-last {
|
|
54
|
-
width: 61%;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.ea-skeleton-item_wrap .skeleton-image {
|
|
58
|
-
width: 30%;
|
|
59
|
-
height: 30%;
|
|
60
|
-
}
|
|
61
|
-
.ea-skeleton-item_wrap.ea-skeleton_p {
|
|
62
|
-
width: 100%;
|
|
63
|
-
}
|
|
64
|
-
.ea-skeleton-item_wrap.ea-skeleton_image {
|
|
65
|
-
width: unset;
|
|
66
|
-
display: flex;
|
|
67
|
-
align-items: center;
|
|
68
|
-
justify-content: center;
|
|
69
|
-
border-radius: 0;
|
|
70
|
-
}
|
|
71
|
-
.ea-skeleton-item_wrap.ea-skeleton_text {
|
|
72
|
-
width: 100%;
|
|
73
|
-
height: 13px;
|
|
74
|
-
}
|
|
75
|
-
`;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* 创建一个具有骨架屏样式的元素。
|
|
79
|
-
*
|
|
80
|
-
* @param {string} item - 包含要添加到新元素的类名。
|
|
81
|
-
* @param {boolean} isFirst - 指示生成的元素是否应该是列表中的第一个元素。
|
|
82
|
-
* @param {boolean} isLast - 指示生成的元素是否应该是列表中的最后一个元素。
|
|
83
|
-
* @returns {HTMLElement} - 返回一个新创建的div元素。
|
|
84
|
-
*/
|
|
85
|
-
const getSkeletonElement = (className) => {
|
|
86
|
-
const el = document.createElement('div');
|
|
87
|
-
el.className = `ea-skeleton_item el-skeleton_p ${className ? className : ''}`;
|
|
88
|
-
|
|
89
|
-
return el;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export class EaSkeleton extends Base {
|
|
93
|
-
#mounted = false;
|
|
94
|
-
|
|
95
|
-
#wrap;
|
|
96
|
-
|
|
97
|
-
#customizationSlot;
|
|
98
|
-
#defaultSlot;
|
|
99
|
-
|
|
100
|
-
constructor() {
|
|
101
|
-
super();
|
|
102
|
-
|
|
103
|
-
const shadowRoot = this.attachShadow({ mode: 'open' });
|
|
104
|
-
const wrap = document.createElement('div');
|
|
105
|
-
wrap.className = 'ea-skeleton_wrap';
|
|
106
|
-
|
|
107
|
-
const defaultSlot = document.createElement('slot');
|
|
108
|
-
defaultSlot.style.display = 'none';
|
|
109
|
-
|
|
110
|
-
const customizationSlot = document.createElement('slot');
|
|
111
|
-
customizationSlot.name = 'template';
|
|
112
|
-
|
|
113
|
-
this.#wrap = wrap;
|
|
114
|
-
this.#defaultSlot = defaultSlot;
|
|
115
|
-
this.#customizationSlot = customizationSlot;
|
|
116
|
-
|
|
117
|
-
this.build(shadowRoot, stylesheet);
|
|
118
|
-
this.shadowRoot.appendChild(wrap);
|
|
119
|
-
this.shadowRoot.appendChild(customizationSlot);
|
|
120
|
-
this.shadowRoot.appendChild(defaultSlot);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// ------- row 骨架屏的渲染行数 -------
|
|
124
|
-
// #region
|
|
125
|
-
get row() {
|
|
126
|
-
return this.getAttrNumber('row') || 4;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
set row(value) {
|
|
130
|
-
this.setAttribute('row', value);
|
|
131
|
-
}
|
|
132
|
-
// #endregion
|
|
133
|
-
// ------- end -------
|
|
134
|
-
|
|
135
|
-
// ------- animated 骨架屏的动画效果 -------
|
|
136
|
-
// #region
|
|
137
|
-
get animated() {
|
|
138
|
-
return this.getAttrBoolean('animated');
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
set animated(value) {
|
|
142
|
-
this.setAttribute('animated', value);
|
|
143
|
-
|
|
144
|
-
this.#wrap.classList.toggle('animated', value);
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
// #endregion
|
|
148
|
-
// ------- end -------
|
|
149
|
-
|
|
150
|
-
// ------- count 元素重复数 -------
|
|
151
|
-
// #region
|
|
152
|
-
get count() {
|
|
153
|
-
return this.getAttrNumber('count') || 1;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
set count(value) {
|
|
157
|
-
this.setAttribute('count', value);
|
|
158
|
-
|
|
159
|
-
this.#wrap.innerHTML = '';
|
|
160
|
-
}
|
|
161
|
-
// #endregion
|
|
162
|
-
// ------- end -------
|
|
163
|
-
|
|
164
|
-
// ------- loading 是否显示骨架屏 -------
|
|
165
|
-
// #region
|
|
166
|
-
get loading() {
|
|
167
|
-
return this.getAttrBoolean('loading') || true;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
set loading(value) {
|
|
171
|
-
this.setAttribute('loading', value);
|
|
172
|
-
|
|
173
|
-
if (value) {
|
|
174
|
-
this.#customizationSlot.style.display = 'block';
|
|
175
|
-
this.#defaultSlot.style.display = 'none';
|
|
176
|
-
} else {
|
|
177
|
-
this.#customizationSlot.style.display = 'none';
|
|
178
|
-
this.#defaultSlot.style.display = 'block';
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
// #endregion
|
|
182
|
-
// ------- end -------
|
|
183
|
-
|
|
184
|
-
// 默认骨架屏的初始化
|
|
185
|
-
defaultSkeletonInit(row) {
|
|
186
|
-
row = Number(row) || 4;
|
|
187
|
-
|
|
188
|
-
const firstSkeleton = getSkeletonElement('is-first');
|
|
189
|
-
this.#wrap.appendChild(firstSkeleton);
|
|
190
|
-
|
|
191
|
-
for (let i = 0; i < row - 2; i++) {
|
|
192
|
-
const paragraphSkeleton = getSkeletonElement('el-skeleton_paragraph');
|
|
193
|
-
this.#wrap.appendChild(paragraphSkeleton);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
const lastSkeleton = getSkeletonElement('el-skeleton_paragraph is-last');
|
|
197
|
-
this.#wrap.appendChild(lastSkeleton);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// 渲染自定义骨架屏
|
|
201
|
-
customizationSkeletonInit() {
|
|
202
|
-
const item = this.querySelectorAll('ea-skeleton-item');
|
|
203
|
-
|
|
204
|
-
if (item.length > 0) this.#wrap.innerHTML = "";
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// 渲染带动画的骨架屏
|
|
208
|
-
handleSkeletonItemAniamted(isAnimated) {
|
|
209
|
-
if (!isAnimated) return;
|
|
210
|
-
|
|
211
|
-
const items = this.querySelectorAll('ea-skeleton-item');
|
|
212
|
-
items.forEach(item => {
|
|
213
|
-
item.setAttribute("animated", true);
|
|
214
|
-
})
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// 渲染骨架屏的渲染个数
|
|
218
|
-
handleSkeletonItemCount(count) {
|
|
219
|
-
const item = this.querySelector('[slot="template"]');
|
|
220
|
-
let template = ``;
|
|
221
|
-
|
|
222
|
-
for (let i = 0; i < count; i++) {
|
|
223
|
-
template += item.innerHTML;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
item.innerHTML = template;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
init() {
|
|
230
|
-
const that = this;
|
|
231
|
-
|
|
232
|
-
this.animated = this.animated;
|
|
233
|
-
|
|
234
|
-
this.count = this.count;
|
|
235
|
-
|
|
236
|
-
this.loading = this.loading;
|
|
237
|
-
|
|
238
|
-
const items = this.querySelectorAll('ea-skeleton-item');
|
|
239
|
-
if (items.length > 0) {
|
|
240
|
-
this.#wrap.style.display = "none";
|
|
241
|
-
|
|
242
|
-
this.handleSkeletonItemCount(this.count);
|
|
243
|
-
|
|
244
|
-
this.handleSkeletonItemAniamted(this.animated);
|
|
245
|
-
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
this.row = this.row;
|
|
252
|
-
this.defaultSkeletonInit(this.row);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
connectedCallback() {
|
|
256
|
-
this.init();
|
|
257
|
-
|
|
258
|
-
this.#mounted = true;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
export class EaSkeletonItem extends Base {
|
|
263
|
-
#wrap;
|
|
264
|
-
|
|
265
|
-
static get observedAttributes() {
|
|
266
|
-
return ['animated'];
|
|
267
|
-
}
|
|
268
|
-
get variantOptions() {
|
|
269
|
-
return ["text", "image", "p"];
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
constructor() {
|
|
273
|
-
super();
|
|
274
|
-
|
|
275
|
-
const shadowRoot = this.attachShadow({ mode: 'open' });
|
|
276
|
-
const wrap = document.createElement('div');
|
|
277
|
-
wrap.className = 'ea-skeleton-item_wrap';
|
|
278
|
-
|
|
279
|
-
this.#wrap = wrap;
|
|
280
|
-
|
|
281
|
-
this.build(shadowRoot, stylesheet);
|
|
282
|
-
this.shadowRoot.appendChild(wrap);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// ------- style html标签上的样式 -------
|
|
286
|
-
// #region
|
|
287
|
-
get elementStyle() {
|
|
288
|
-
return this.getAttribute('style');
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
set elementStyle(value) {
|
|
292
|
-
this.setAttribute('style', value);
|
|
293
|
-
this.#wrap.setAttribute('style', value);
|
|
294
|
-
}
|
|
295
|
-
// #endregion
|
|
296
|
-
// ------- end -------
|
|
297
|
-
|
|
298
|
-
// ------- variant html标签标识 -------
|
|
299
|
-
// #region
|
|
300
|
-
get variant() {
|
|
301
|
-
return this.getAttribute('variant');
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
set variant(value) {
|
|
305
|
-
this.variantOptions.includes(value) ? this.setAttribute('variant', value) : this.setAttribute('variant', 'text');
|
|
306
|
-
|
|
307
|
-
if (value === "image") this.#wrap.innerHTML = imageElement;
|
|
308
|
-
|
|
309
|
-
this.#wrap.classList.add("ea-skeleton_" + this.variant);
|
|
310
|
-
}
|
|
311
|
-
// #endregion
|
|
312
|
-
// ------- end -------
|
|
313
|
-
|
|
314
|
-
init() {
|
|
315
|
-
const that = this;
|
|
316
|
-
|
|
317
|
-
this.variant = this.variant;
|
|
318
|
-
|
|
319
|
-
this.elementStyle = this.elementStyle;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
connectedCallback() {
|
|
323
|
-
this.init();
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
attributeChangedCallback(name, oldVal, newVal) {
|
|
327
|
-
switch (name) {
|
|
328
|
-
case "animated":
|
|
329
|
-
this.#wrap.classList.toggle("animated", this.getAttrBoolean(name));
|
|
330
|
-
break;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
if (!customElements.get('ea-skeleton')) {
|
|
336
|
-
customElements.define('ea-skeleton', EaSkeleton);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
if (!customElements.get('ea-skeleton-item')) {
|
|
340
|
-
customElements.define('ea-skeleton-item', EaSkeletonItem);
|
|
341
|
-
}
|
|
1
|
+
import Base from"../Base.js";import"../ea-skeleton-item/index.js";import{handleDefaultAttrIsTrue}from"../../utils/handleDefaultAttrIsTrue.js";import{createSkeletonElement}from"./src/utils/createSkeletonElement.js";import{stylesheet}from"./src/style/stylesheet.js";export class EaSkeleton extends Base{#t;#e;#s;constructor(){super();const t=this.attachShadow({mode:"open"});t.innerHTML='\n <div class="ea-skeleton_wrap" part="container">\n <slot></slot>\n <slot name="template"></slot>\n </div>\n ',this.#t=t.querySelector(".ea-skeleton_wrap"),this.#s=t.querySelector("slot"),this.#e=t.querySelector('slot[name="template"]'),this.build(t,stylesheet)}get row(){return this.getAttrNumber("row")||4}set row(t){this.setAttribute("row",t)}get animated(){return this.getAttrBoolean("animated")}set animated(t){t&&this.setAttribute("animated",t)}get count(){return this.getAttrNumber("count")||1}set count(t){this.setAttribute("count",t)}get loading(){const t=this.getAttribute("loading");return handleDefaultAttrIsTrue(t)}set loading(t){this.setAttribute("loading",t),this.#e.style.display=t?"block":"none",this.#s.style.display=t?"none":"block"}#n(t){t=Number(t)||4;this.#s.assignedNodes(),this.#e.assignedNodes();if(!(this.children.length>0)){this.#t.innerHTML="";for(let e=0;e<t;e++){const t=createSkeletonElement("p",this.animated);this.#t.appendChild(t)}}}#i(t){if(!t)return;this.querySelectorAll("ea-skeleton-item").forEach((t=>{t.animated=!0}))}#o(t){if(0===this.children.length||t<1)return;const e=this.querySelector('[slot="template"]');let s="";for(let n=0;n<t;n++)s+=e.innerHTML;e.innerHTML=s}connectedCallback(){this.animated=this.animated,this.loading=this.loading,this.count=this.count,this.row=this.row,this.#n(this.row),this.#o(this.count),this.#i(this.animated)}}customElements.get("ea-skeleton")||customElements.define("ea-skeleton",EaSkeleton);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const stylesheet="\n.ea-skeleton_wrap {\n width: 100%;\n position: relative;\n border-radius: 4px;\n}\n.ea-skeleton_wrap ea-skeleton-item[variant=p]:first-child {\n --p-width: 33%;\n --margin-top: 0;\n}\n.ea-skeleton_wrap ea-skeleton-item[variant=p]:last-child {\n --p-width: 61%;\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const createSkeletonElement=(e,t)=>{const n=document.createElement("ea-skeleton-item");return n.variant=e,n.animated=t,n};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Base from"../Base.js";import{imageSVG}from"./src/assets/imageSVG.js";import{stylesheet}from"./src/style/stylesheet.js";export class EaSkeletonItem extends Base{#t;get variantOptions(){return["text","image","p","h1","h2","h3","h4","h5","h6"]}constructor(){super();const t=this.attachShadow({mode:"open"});t.innerHTML='\n <div class="ea-skeleton-item_wrap" part="container"></div>\n ',this.#t=t.querySelector(".ea-skeleton-item_wrap"),this.build(t,stylesheet)}get elementStyle(){return this.getAttribute("style")}set elementStyle(t){t&&this.#t.setAttribute("style",t)}get variant(){return this.getAttribute("variant")}set variant(t){this.variantOptions.includes(t)?this.setAttribute("variant",t):this.setAttribute("variant","text"),"image"===t&&(this.#t.innerHTML=imageSVG),this.#t.classList.add("ea-skeleton_"+this.variant)}get animated(){return this.getAttrBoolean("animated")}set animated(t){t&&(this.setAttribute("animated",t),this.#t.classList.toggle("animated",t))}connectedCallback(){this.style.display="block",this.variant=this.variant,this.animated=this.animated}}customElements.get("ea-skeleton-item")||customElements.define("ea-skeleton-item",EaSkeletonItem);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const imageSVG='\n<svg class="skeleton-image" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">\n <path d="M15 20h70v60H15z" stroke="#c0c4cc" stroke-width="5px" fill="none" />\n <circle r="8" cx="32" cy="35" fill="#c0c4cc" />\n <path d="M60 42.5L39 75h42z" fill="#c0c4cc" />\n <path d="M35 52.5L20 75h-4 32z" fill="#c0c4cc" />\n</svg>\n';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const stylesheet="\n:host {\n --p-width: 100%;\n --margin-top: 1rem;\n}\n\n@keyframes skeleton-loading {\n 0% {\n background-position: 100% 50%;\n }\n}\n.ea-skeleton-item_wrap {\n position: relative;\n background-color: #f2f2f2;\n border-radius: 4px;\n}\n.ea-skeleton-item_wrap.animated {\n background-image: linear-gradient(90deg, #f6f6f6 25%, #e8e8e8 37%, #f6f6f6 63%);\n background-size: 400% 100%;\n animation: skeleton-loading 1.4s ease infinite;\n}\n\n.ea-skeleton-item_wrap.ea-skeleton_p, .ea-skeleton-item_wrap.ea-skeleton_image, .ea-skeleton-item_wrap.ea-skeleton_text, .ea-skeleton-item_wrap.ea-skeleton_h1, .ea-skeleton-item_wrap.ea-skeleton_h2, .ea-skeleton-item_wrap.ea-skeleton_h3, .ea-skeleton-item_wrap.ea-skeleton_h4, .ea-skeleton-item_wrap.ea-skeleton_h5, .ea-skeleton-item_wrap.ea-skeleton_h6 {\n width: 100%;\n}\n.ea-skeleton-item_wrap.ea-skeleton_p {\n width: var(--p-width);\n height: 16px;\n margin-top: var(--margin-top);\n}\n.ea-skeleton-item_wrap.ea-skeleton_image {\n width: unset;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 0;\n height: 100%;\n}\n.ea-skeleton-item_wrap.ea-skeleton_image .skeleton-image {\n width: 30%;\n height: 30%;\n}\n.ea-skeleton-item_wrap.ea-skeleton_text {\n height: 13px;\n margin: 2px 0;\n}\n.ea-skeleton-item_wrap.ea-skeleton_h1 {\n height: 2rem;\n margin-block: 0.67rem;\n}\n.ea-skeleton-item_wrap.ea-skeleton_h2 {\n height: 1.5rem;\n margin-block: 0.83rem;\n}\n.ea-skeleton-item_wrap.ea-skeleton_h3 {\n height: 1.17rem;\n margin-block: 1rem;\n}\n.ea-skeleton-item_wrap.ea-skeleton_h4 {\n height: 1rem;\n margin-block: 1.33rem;\n}\n.ea-skeleton-item_wrap.ea-skeleton_h5 {\n height: 0.83rem;\n margin-block: 1.67rem;\n}\n.ea-skeleton-item_wrap.ea-skeleton_h6 {\n height: 0.67rem;\n margin-block: 2.33rem;\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Base from"../Base.js";import"../ea-icon/index.js";import{timeout}from"../../utils/timeout.js";import{stylesheet}from"./src/style/stylesheet.js";export class EaStep extends Base{#t;#e;#s;#i;#r;#n;#a;#o;constructor(){super();const t=this.attachShadow({mode:"open"});t.innerHTML='\n <div class="ea-step_wrap" part="container">\n <div class="ea-step_head-wrap" part="head-wrap">\n <div class="ea-step_bar" part="step-bar"></div>\n <div class="ea-step_head-icon" part="head-icon"></div>\n </div>\n <div class="ea-step_main-wrap" part="main-wrap">\n <div class="ea-step_title-wrap" part="title-wrap">\n <slot name="title"></slot>\n </div>\n <div class="ea-step_description-wrap" part="description-wrap">\n <slot name="description"></slot>\n </div>\n </div>\n </div>\n ',this.#t=t.querySelector(".ea-step_wrap"),this.#e=t.querySelector(".ea-step_head-wrap"),this.#s=t.querySelector(".ea-step_head-icon"),this.#i=t.querySelector(".ea-step_bar"),this.#r=t.querySelector(".ea-step_title-wrap"),this.#a=t.querySelector('slot[name="title"]'),this.#n=t.querySelector(".ea-step_description-wrap"),this.#o=t.querySelector('slot[name="description"]'),this.build(t,stylesheet)}get title(){return this.getAttribute("title")}set title(t){if(!t)return;const e=this.querySelector('[slot="title"]');e?(t=e.innerHTML,this.#a.innerHTML=t):this.#r.innerText=t,this.setAttribute("title",t)}get description(){return this.getAttribute("description")}set description(t){if(!t)return;const e=this.querySelector('[slot="description"]');e?(t=e.innerHTML,this.#o.innerHTML=t):this.#n.innerText=t,this.setAttribute("description",t)}get space(){return this.getAttribute("space")||"50%"}set space(t){this.setAttribute("space",t||"50%"),this.style.flexBasis=t||"50%"}get icon(){return this.getAttribute("icon")}set icon(t){t?this.#s.innerHTML=`\n <ea-icon icon="${t}" size="24"></ea-icon>\n `:(this.#s.innerHTML=this.index+1,this.#s.classList.add("is-text"),t=this.index+1),this.setAttribute("icon",t)}get active(){return this.getAttrBoolean("active")||!1}set active(t){this.toggleAttr("active",t)}get isLast(){return this.getAttrBoolean("is-last")||!1}set isLast(t){this.toggleAttr("is-last",t),this.#e.classList.toggle("is-last",t)}get status(){return this.getAttribute("status")}set status(t){if(this.setAttribute("status",t),this.#t.classList.toggle("is-finish","finish"===t),this.#t.classList.toggle("is-process","process"===t),this.#t.classList.toggle("is-wait","wait"===t),"finish"===t){this.#s.querySelector("ea-icon")||(this.#s.innerHTML='\n <ea-icon icon="icon-ok" color="#67c23a" style="font-size: 14px; line-height: 14px;"></ea-icon>\n ')}else this.#s.innerHTML=this.index+1}get simple(){return this.getAttrBoolean("simple")||!1}set simple(t){this.toggleAttr("simple",t),this.#t.classList.toggle("is-simple",t),t&&!this.isLast?(this.#i.innerHTML='\n <ea-icon icon="icon-angle-right" color="#c0c4cc" style="font-size: 24px; line-height: 24px;"></ea-icon>\n ',this.#i.style.flex="1",this.#i.style.textAlign="center",this.#n.remove(),this.#t.appendChild(this.#i)):t&&!this.isLast&&(this.#i.innerHTML="")}connectedCallback(){this.title=this.title,this.description=this.description,this.simple=this.simple,timeout((()=>{this.icon=this.icon}),20)}}customElements.get("ea-step")||customElements.define("ea-step",EaStep);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const stylesheet="\n.ea-step_wrap {\n color: #c0c4cc;\n transition: color 0.3s;\n}\n.ea-step_wrap .ea-step_head-wrap {\n position: relative;\n}\n.ea-step_wrap .ea-step_head-wrap .ea-step_head-icon {\n position: relative;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n width: 24px;\n height: 24px;\n background-color: #fff;\n font-size: 14px;\n z-index: 1;\n}\n.ea-step_wrap .ea-step_head-wrap .ea-step_head-icon.is-text {\n border-radius: 50%;\n border: 2px solid;\n}\n.ea-step_wrap .ea-step_head-wrap .ea-step_bar {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n margin-left: 2px;\n width: 100%;\n height: 2px;\n background-color: #c0c4cc;\n}\n.ea-step_wrap .ea-step_head-wrap.is-last {\n flex-basis: auto;\n}\n.ea-step_wrap .ea-step_head-wrap.is-last .ea-step_bar {\n display: none;\n}\n.ea-step_wrap .ea-step_main-wrap {\n white-space: normal;\n text-align: left;\n}\n.ea-step_wrap .ea-step_main-wrap .ea-step_title-wrap {\n font-size: 16px;\n line-height: 38px;\n}\n.ea-step_wrap .ea-step_main-wrap .ea-step_description-wrap {\n margin-top: -5px;\n font-size: 12px;\n line-height: 20px;\n}\n.ea-step_wrap.is-process {\n color: #303133;\n border-color: #303133;\n}\n.ea-step_wrap.is-finish {\n color: #67c23a;\n border-color: #67c23a;\n}\n.ea-step_wrap.is-finish .ea-step_head-wrap .ea-step_bar {\n background-color: #67c23a;\n}\n.ea-step_wrap.is-simple {\n display: flex;\n align-items: center;\n}\n.ea-step_wrap.is-simple .ea-step_head-wrap {\n position: relative;\n}\n.ea-step_wrap.is-simple .ea-step_head-wrap .ea-step_bar {\n position: relative;\n width: auto;\n height: auto;\n transform: translateY(0%);\n margin-left: 2px;\n flex: 1;\n}\n.ea-step_wrap.is-simple .ea-step_main-wrap {\n margin-left: 16px;\n line-height: 24px;\n height: 24px;\n}\n.ea-step_wrap.is-simple .ea-step_main-wrap .ea-step_title-wrap {\n line-height: 24px;\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Base from"../Base.js";import"../ea-icon/index.js";import"../ea-step/index.js";import{stylesheet}from"./src/style/stylesheet.js";export class EaSteps extends Base{#t;#e;constructor(){super();const t=this.attachShadow({mode:"open"});t.innerHTML='\n <div class="ea-steps_wrap" part="container">\n <slot></slot>\n </div>\n ',this.#t=t.querySelector(".ea-steps_wrap"),this.build(t,stylesheet)}get active(){return this.getAttrNumber("active")||0}set active(t){this.setAttribute("active",t),this.#e.forEach(((e,s)=>{e.status=s<t?"finish":s>t?"wait":"process"}))}get space(){return this.getAttribute("space")||"50%"}set space(t){this.setAttribute("space",t),this.#e.forEach(((e,s)=>{s<this.#e.length-1&&(e.space=t)}))}get simple(){return this.getAttrBoolean("simple")||!1}set simple(t){this.toggleAttr("simple",t),this.#e.forEach(((e,s)=>{e.simple=t,this.#t.classList.toggle("is-simple",t),s<this.#e.length-1&&(e.space=t?"auto":this.space)}))}connectedCallback(){const t=this.querySelectorAll("ea-step");this.#e=t,this.#e.forEach(((t,e)=>{t.setAttribute("index",e),t.index=e})),this.#e[this.#e.length-1].isLast=!0,this.simple=this.simple,this.active=this.active}}customElements.get("ea-steps")||customElements.define("ea-steps",EaSteps);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const stylesheet="\n.ea-steps_wrap {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.ea-steps_wrap ::slotted(ea-step) {\n flex-basis: 50%;\n}\n.ea-steps_wrap.is-simple {\n justify-content: unset;\n}\n.ea-steps_wrap ::slotted(ea-step:last-child) {\n flex-basis: auto;\n flex-grow: 0;\n flex-shrink: 0;\n}\n.ea-steps_wrap ::slotted(ea-step[simple]) {\n flex: 1;\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{timeout}from"../../utils/timeout.js";import Base from"../Base.js";import"../ea-icon/index.js";import{stylesheet}from"./src/style/stylesheet.js";export class EaSubmenu extends Base{#t;#e;#s;constructor(){super();const t=this.attachShadow({mode:"open"});t.innerHTML='\n <div class="ea-submenu_wrap" part="container">\n <div class="ea-submenu_title_wrap" part="title-wrap">\n <slot name="title"></slot>\n <ea-icon class="ea-submenu_dropdown_icon" icon="icon-angle-down" part="dropdown-icon"></ea-icon>\n </div>\n <div class="ea-submenu_items_wrap" part="dropdown-wrap">\n <slot></slot>\n </div>\n </div>\n ',this.#t=t.querySelector(".ea-submenu_wrap"),this.#e=t.querySelector(".ea-submenu_title_wrap"),this.#s=t.querySelector(".ea-submenu_items_wrap"),this.build(t,stylesheet)}get actived(){return this.getAttrBoolean("actived")}set actived(t){this.setAttribute("actived",t),this.#t.classList.toggle("is-actived",t)}get backgroundColor(){return this.getAttribute("background-color")||"#fff"}set backgroundColor(t){this.setAttribute("background-color",t),this.#t.style.setProperty("--normal-bgc",t)}get textColor(){return this.getAttribute("text-color")||"#303133"}set textColor(t){this.setAttribute("text-color",t),this.#t.style.setProperty("--normal-text-color",t)}get activeTextColor(){return this.getAttribute("active-text-color")||"#409eff"}set activeTextColor(t){this.setAttribute("active-text-color",t),this.#t.style.setProperty("--actived-text-color",t)}get disabled(){return this.getAttrBoolean("disabled")}set disabled(t){this.setAttribute("disabled",t),this.#t.classList.toggle("is-disabled",t)}get mode(){return this.getAttribute("mode")||"horizontal"}set mode(t){this.setAttribute("mode",t),this.#t.classList.toggle("is-vertical","vertical"===t)}connectedCallback(){this.disabled=this.disabled;this.querySelectorAll("ea-menu-item").forEach(((t,e)=>{t.isSubItem=!0,t.addEventListener("item-selected",(t=>{this.actived=!0}))})),timeout((()=>{this.#s.style.display="block"}),20)}}customElements.get("ea-submenu")||customElements.define("ea-submenu",EaSubmenu);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const stylesheet="\n.ea-submenu_wrap {\n --normal-bgc: #fff;\n --normal-text-color: #303133;\n --actived-text-color: #409eff;\n --actived-bgc: #fff;\n position: relative;\n box-sizing: border-box;\n padding: 0 20px;\n border-bottom: 2px solid;\n border-color: transparent;\n height: 60px;\n line-height: 60px;\n font-size: 14px;\n color: var(--normal-text-color);\n background-color: var(--normal-bgc);\n white-space: nowrap;\n cursor: pointer;\n transition: border-color 0.3s, background-color 0.3s, color 0.3s;\n}\n.ea-submenu_wrap .ea-submenu_title_wrap {\n display: flex;\n justify-content: space-between;\n}\n.ea-submenu_wrap .ea-submenu_title_wrap .ea-submenu_dropdown_icon {\n rotate: -90deg;\n transition: rotate 0.3s;\n}\n.ea-submenu_wrap .ea-submenu_items_wrap {\n display: none;\n position: absolute;\n left: 0;\n margin-top: 3px;\n border-radius: 8px;\n overflow: hidden;\n min-width: 200px;\n z-index: 100;\n opacity: 0;\n transform-origin: left top;\n transform: scale(0);\n transition: opacity 0.3s, transform 0.3s;\n}\n.ea-submenu_wrap:hover .ea-submenu_items_wrap {\n opacity: 1;\n transform: scale(1);\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);\n}\n.ea-submenu_wrap:hover .ea-submenu_title_wrap .ea-submenu_dropdown_icon {\n rotate: 0deg;\n}\n.ea-submenu_wrap.is-actived {\n color: var(--actived-text-color);\n border-color: var(--actived-text-color);\n}\n.ea-submenu_wrap.is-sub-actived {\n color: var(--actived-text-color);\n}\n.ea-submenu_wrap.is-disabled {\n color: #c0c4cc;\n pointer-events: none;\n cursor: not-allowed;\n}\n.ea-submenu_wrap ::slotted(a) {\n color: var(--normal-text-color);\n text-decoration: none;\n}\n";
|