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,233 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import Base from '../Base.js';
|
|
3
|
-
import { createElement } from '../../utils/createElement.js';
|
|
4
|
-
import "../ea-icon/index.js"
|
|
5
|
-
|
|
6
|
-
const stylesheet = `
|
|
7
|
-
|
|
8
|
-
.ea-message_wrap {
|
|
9
|
-
position: fixed;
|
|
10
|
-
left: 50%;
|
|
11
|
-
z-index: 999;
|
|
12
|
-
display: flex;
|
|
13
|
-
align-items: center;
|
|
14
|
-
padding: 15px 15px 15px 20px;
|
|
15
|
-
border: 1px solid #ebeef5;
|
|
16
|
-
border-radius: 4px;
|
|
17
|
-
top: -100%;
|
|
18
|
-
transform-origin: center;
|
|
19
|
-
opacity: 0;
|
|
20
|
-
transform: translate(-50%, 0);
|
|
21
|
-
min-width: 380px;
|
|
22
|
-
overflow: hidden;
|
|
23
|
-
background-color: black;
|
|
24
|
-
transition: opacity 0.3s, top 0.3s;
|
|
25
|
-
}
|
|
26
|
-
.ea-message_wrap .ea-icon-wrap {
|
|
27
|
-
margin-right: 0.5rem;
|
|
28
|
-
line-height: 1;
|
|
29
|
-
}
|
|
30
|
-
.ea-message_wrap .ea-text-content {
|
|
31
|
-
line-height: 1;
|
|
32
|
-
vertical-align: middle;
|
|
33
|
-
}
|
|
34
|
-
.ea-message_wrap .ea-close-icon {
|
|
35
|
-
margin-left: auto;
|
|
36
|
-
}
|
|
37
|
-
.ea-message_wrap.ea-message--success {
|
|
38
|
-
background-color: #f0f9eb;
|
|
39
|
-
color: #67c23a;
|
|
40
|
-
}
|
|
41
|
-
.ea-message_wrap.ea-message--info {
|
|
42
|
-
background-color: #f4f4f5;
|
|
43
|
-
color: #909399;
|
|
44
|
-
}
|
|
45
|
-
.ea-message_wrap.ea-message--warning {
|
|
46
|
-
background-color: #fdf6ec;
|
|
47
|
-
color: #e6a23c;
|
|
48
|
-
}
|
|
49
|
-
.ea-message_wrap.ea-message--error {
|
|
50
|
-
background-color: #fef0f0;
|
|
51
|
-
color: #f56c6c;
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
|
|
55
|
-
export class EaMessageElement extends Base {
|
|
56
|
-
#wrap;
|
|
57
|
-
|
|
58
|
-
#icon;
|
|
59
|
-
|
|
60
|
-
#textContent;
|
|
61
|
-
|
|
62
|
-
#closeWrap;
|
|
63
|
-
|
|
64
|
-
constructor() {
|
|
65
|
-
super();
|
|
66
|
-
|
|
67
|
-
const shadowRoot = this.attachShadow({ mode: 'open' });
|
|
68
|
-
const wrap = document.createElement('div');
|
|
69
|
-
wrap.className = 'ea-message_wrap';
|
|
70
|
-
|
|
71
|
-
const icon = createElement('i', 'ea-icon-wrap');
|
|
72
|
-
wrap.appendChild(icon);
|
|
73
|
-
|
|
74
|
-
const textContent = createElement('div', 'ea-text-content');
|
|
75
|
-
wrap.appendChild(textContent);
|
|
76
|
-
|
|
77
|
-
const closeIcon = createElement('i', 'ea-close-icon icon-cancel');
|
|
78
|
-
wrap.appendChild(closeIcon);
|
|
79
|
-
closeIcon.style.display = 'none';
|
|
80
|
-
|
|
81
|
-
this.#wrap = wrap;
|
|
82
|
-
this.wrap = wrap;
|
|
83
|
-
this.#icon = icon;
|
|
84
|
-
this.#textContent = textContent;
|
|
85
|
-
this.#closeWrap = closeIcon;
|
|
86
|
-
this.closeWrap = closeIcon;
|
|
87
|
-
|
|
88
|
-
this.build(shadowRoot, stylesheet);
|
|
89
|
-
this.setIconFile(new URL('../ea-icon/index.css', import.meta.url).href);
|
|
90
|
-
|
|
91
|
-
this.shadowRoot.appendChild(wrap);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
get attrs() {
|
|
95
|
-
return ["show", "text", "icon", "type", "showClose", "center"];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
get iconList() {
|
|
99
|
-
return {
|
|
100
|
-
"success": "icon-ok-circled",
|
|
101
|
-
"error": "icon-cancel-circled",
|
|
102
|
-
"warning": "icon-attention-alt",
|
|
103
|
-
"info": "icon-info"
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// ------- show 提示框的显示状态 -------
|
|
108
|
-
// #region
|
|
109
|
-
get show() {
|
|
110
|
-
return this.getAttrBoolean('show');
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
set show(value) {
|
|
114
|
-
this.setAttribute('show', value);
|
|
115
|
-
|
|
116
|
-
const eaMessageList = document.querySelectorAll('ea-message');
|
|
117
|
-
|
|
118
|
-
if (value) {
|
|
119
|
-
const length = eaMessageList.length - 1;
|
|
120
|
-
const elementHeight = this.#wrap.getBoundingClientRect().height;
|
|
121
|
-
let gap = length <= 0 ? 10 : (length + 1) * 10;
|
|
122
|
-
|
|
123
|
-
this.#wrap.style.top = `${length * elementHeight + gap}px`;
|
|
124
|
-
this.#wrap.style.opacity = 1;
|
|
125
|
-
} else {
|
|
126
|
-
const that = this;
|
|
127
|
-
|
|
128
|
-
this.#wrap.style.top = `-100%`;
|
|
129
|
-
this.#wrap.style.opacity = 0;
|
|
130
|
-
|
|
131
|
-
let event = this.#wrap.addEventListener('transitionend', function () {
|
|
132
|
-
this.removeEventListener('transitionend', event);
|
|
133
|
-
that.remove();
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
// #endregion
|
|
139
|
-
// ------- end -------
|
|
140
|
-
|
|
141
|
-
// ------- text 提示框的文字 -------
|
|
142
|
-
// #region
|
|
143
|
-
get text() {
|
|
144
|
-
return this.getAttribute('text');
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
set text(value) {
|
|
148
|
-
this.setAttribute('text', value);
|
|
149
|
-
|
|
150
|
-
this.#textContent.innerText = value;
|
|
151
|
-
}
|
|
152
|
-
// #endregion
|
|
153
|
-
// ------- end -------
|
|
154
|
-
|
|
155
|
-
// ------- type 提示框的类型 -------
|
|
156
|
-
// #region
|
|
157
|
-
get type() {
|
|
158
|
-
return this.getAttribute('type') || "info";
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
set type(value) {
|
|
162
|
-
this.setAttribute('type', value);
|
|
163
|
-
|
|
164
|
-
this.#wrap.classList.add(`ea-message--${value}`);
|
|
165
|
-
this.#icon.classList.add(`${this.iconList[value]}`);
|
|
166
|
-
}
|
|
167
|
-
// #endregion
|
|
168
|
-
// ------- end -------
|
|
169
|
-
|
|
170
|
-
// ------- showClose 提示框的关闭按钮 -------
|
|
171
|
-
// #region
|
|
172
|
-
get showClose() {
|
|
173
|
-
return this.getAttrBoolean('showClose') || false;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
set showClose(value) {
|
|
177
|
-
this.setAttribute('showClose', value);
|
|
178
|
-
|
|
179
|
-
if (value) {
|
|
180
|
-
this.#closeWrap.style.display = "block";
|
|
181
|
-
} else {
|
|
182
|
-
this.#closeWrap.style.display = "none";
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
// #endregion
|
|
186
|
-
// ------- end -------
|
|
187
|
-
|
|
188
|
-
// ------- center 提示框是否居中 -------
|
|
189
|
-
// #region
|
|
190
|
-
get center() {
|
|
191
|
-
return this.getAttrBoolean('center') || false;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
set center(value) {
|
|
195
|
-
this.setAttribute('center', value);
|
|
196
|
-
|
|
197
|
-
if (value) {
|
|
198
|
-
this.#icon.style.marginLeft = `auto`;
|
|
199
|
-
} else {
|
|
200
|
-
this.#icon.style.marginLeft = `0`;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
// #endregion
|
|
204
|
-
// ------- end -------
|
|
205
|
-
|
|
206
|
-
init() {
|
|
207
|
-
const that = this;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
connectedCallback() {
|
|
211
|
-
this.init();
|
|
212
|
-
|
|
213
|
-
this.#closeWrap.addEventListener('click', () => {
|
|
214
|
-
this.show = false;
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
disconnectedCallback() {
|
|
219
|
-
const eaMessageList = document.querySelectorAll('ea-message');
|
|
220
|
-
const length = eaMessageList.length;
|
|
221
|
-
|
|
222
|
-
if (length > 0) {
|
|
223
|
-
Array.from(eaMessageList).forEach((el, index) => {
|
|
224
|
-
const elementHeight = el.wrap.getBoundingClientRect().height;
|
|
225
|
-
el.wrap.style.top = `${index * elementHeight + (index * 10)}px`;
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (!customElements.get('ea-message')) {
|
|
232
|
-
customElements.define('ea-message', EaMessageElement);
|
|
233
|
-
}
|
|
1
|
+
import Base from"../Base.js";import{createElement}from"../../utils/createElement.js";import"../ea-icon/index.js";import{EaMessage}from"./src/utils/MessageClass.js";import{stylesheet}from"./src/style/stylesheet.js";export class EaMessageElement extends Base{#e;#t;#s;#n;constructor(){super();const e=this.attachShadow({mode:"open"});e.innerHTML='\n <div class="ea-message_wrap" part="container">\n <ea-icon class="ea-icon-wrap" part="icon"></ea-icon>\n <div class="ea-text-content" part="content-wrap"></div>\n <ea-icon class="ea-close-icon" icon="icon-cancel"></ea-icon>\n </div>\n ',this.#e=e.querySelector(".ea-message_wrap"),this.wrap=this.#e,this.#t=e.querySelector(".ea-icon-wrap"),this.#s=e.querySelector(".ea-text-content"),this.#n=e.querySelector(".ea-close-icon"),this.closeWrap=this.#n,this.build(e,stylesheet)}get attrs(){return["show","text","icon","type","showClose","center"]}get iconList(){return{success:"icon-ok-circled",error:"icon-cancel-circled",warning:"icon-attention-alt",info:"icon-info"}}get show(){return this.getAttrBoolean("show")}set show(e){this.setAttribute("show",e);const t=document.querySelectorAll("ea-message");if(e){const e=t.length-1,s=this.#e.getBoundingClientRect().height;let n=e<=0?10:10*(e+1);this.#e.style.top=`${e*s+n}px`,this.#e.style.opacity=1}else{this.#e.style.top="-100%",this.#e.style.opacity=0;let e=this.#e.addEventListener("transitionend",(()=>{this.removeEventListener("transitionend",e),this.remove()}))}}get text(){return this.getAttribute("text")}set text(e){e&&(this.setAttribute("text",e),this.#s.innerText=e)}get type(){return this.getAttribute("type")||"info"}set type(e){this.setAttribute("type",e),this.#e.classList.add(`ea-message--${e}`),this.#t.icon=this.iconList[e]}get showClose(){return this.getAttrBoolean("showClose")||!1}set showClose(e){e&&(this.setAttribute("showClose",e),this.#n.style.display=e?"block":"none")}get center(){return this.getAttrBoolean("center")||!1}set center(e){e&&(this.setAttribute("center",e),this.#t.style.marginLeft=e?"auto":"0")}connectedCallback(){this.#n.addEventListener("click",(()=>{this.show=!1}))}disconnectedCallback(){const e=document.querySelectorAll("ea-message");e.length>0&&Array.from(e).forEach(((e,t)=>{const s=e.wrap.getBoundingClientRect().height;e.wrap.style.top=t*s+10*t+"px"}))}}customElements.get("ea-message")||customElements.define("ea-message",EaMessageElement),window.$message=new EaMessage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const stylesheet="\n.ea-message_wrap {\n position: fixed;\n left: 50%;\n z-index: 999;\n display: flex;\n align-items: center;\n padding: 15px 15px 15px 20px;\n border: 1px solid #ebeef5;\n border-radius: 4px;\n top: -100%;\n transform-origin: center;\n opacity: 0;\n transform: translate(-50%, 0);\n min-width: 380px;\n overflow: hidden;\n background-color: black;\n transition: opacity 0.3s, top 0.3s;\n}\n.ea-message_wrap .ea-icon-wrap {\n margin-right: 0.5rem;\n line-height: 1;\n}\n.ea-message_wrap .ea-text-content {\n line-height: 1;\n margin-right: auto;\n vertical-align: middle;\n}\n.ea-message_wrap .ea-close-icon {\n margin-left: auto;\n}\n.ea-message_wrap.ea-message--success {\n background-color: #f0f9eb;\n color: #67c23a;\n}\n.ea-message_wrap.ea-message--info {\n background-color: #f4f4f5;\n color: #909399;\n}\n.ea-message_wrap.ea-message--warning {\n background-color: #fdf6ec;\n color: #e6a23c;\n}\n.ea-message_wrap.ea-message--error {\n background-color: #fef0f0;\n color: #f56c6c;\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export class EaMessage{handleStringMsg(e,t){e.text=t,e.type="info",e.hasClose=!1}handleObjectMsg(e,t,n){for(const s in t)n.includes(s)&&(e[s]=t[s]);Object.keys(t).includes("type")||(e.type="info")}handleDuration(e,t=3){if(0===t)return;let n=setTimeout((()=>{e.show=!1,clearTimeout(n),n=null}),1e3*t+40)}open(e){const t=document.createElement("ea-message");if(document.body.appendChild(t),"string"==typeof e)this.handleStringMsg(t,e),this.handleDuration(t);else{if("object"!=typeof e)throw new Error("[EaMessage] TypeError");this.handleObjectMsg(t,e,t.attrs),this.handleDuration(t,e.duration)}return t.show=!0,{onClose(e){"function"==typeof e&&t.addEventListener("click",(function(){e()}))}}}}
|
|
@@ -1,202 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import Base from '../Base.js';
|
|
3
|
-
import { createElement } from "../../utils/createElement.js"
|
|
4
|
-
|
|
5
|
-
const stylesheet = `
|
|
6
|
-
.ea-dialog_wrap {
|
|
7
|
-
position: fixed;
|
|
8
|
-
top: 0;
|
|
9
|
-
left: 0;
|
|
10
|
-
width: 100%;
|
|
11
|
-
height: 100%;
|
|
12
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
13
|
-
z-index: 2024;
|
|
14
|
-
}
|
|
15
|
-
.ea-dialog_wrap .ea-dialog_board {
|
|
16
|
-
position: absolute;
|
|
17
|
-
left: 50%;
|
|
18
|
-
top: 50%;
|
|
19
|
-
transform: translate(-50%, -50%);
|
|
20
|
-
background-color: aliceblue;
|
|
21
|
-
width: 420px;
|
|
22
|
-
padding-bottom: 10px;
|
|
23
|
-
border-radius: 4px;
|
|
24
|
-
border: 1px solid #ebeef5;
|
|
25
|
-
box-sizing: 0 2px 12px 0;
|
|
26
|
-
font-size: 18px;
|
|
27
|
-
text-align: left;
|
|
28
|
-
overflow: hidden;
|
|
29
|
-
backface-visibility: hidden;
|
|
30
|
-
}
|
|
31
|
-
.ea-dialog_wrap .ea-dialog_board .ea-dialog_header {
|
|
32
|
-
padding: 15px 15px 10px;
|
|
33
|
-
display: flex;
|
|
34
|
-
justify-content: space-between;
|
|
35
|
-
align-items: center;
|
|
36
|
-
}
|
|
37
|
-
.ea-dialog_wrap .ea-dialog_board .ea-dialog_header .ea-dialog_header-title {
|
|
38
|
-
font-size: 18px;
|
|
39
|
-
line-height: 1;
|
|
40
|
-
color: #303133;
|
|
41
|
-
}
|
|
42
|
-
.ea-dialog_wrap .ea-dialog_board .ea-dialog_header .ea-dialog_header-close {
|
|
43
|
-
display: inline-block;
|
|
44
|
-
font-size: 16px;
|
|
45
|
-
color: #909399;
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
}
|
|
48
|
-
.ea-dialog_wrap .ea-dialog_board .ea-dialog_content {
|
|
49
|
-
padding: 10px 15px;
|
|
50
|
-
color: #606266;
|
|
51
|
-
font-size: 14px;
|
|
52
|
-
}
|
|
53
|
-
.ea-dialog_wrap .ea-dialog_board .ea-dialog_footer {
|
|
54
|
-
padding: 5px 15px 0;
|
|
55
|
-
display: flex;
|
|
56
|
-
align-items: center;
|
|
57
|
-
justify-content: flex-end;
|
|
58
|
-
}
|
|
59
|
-
.ea-dialog_wrap .ea-dialog_board .ea-dialog_footer :first-child {
|
|
60
|
-
margin-right: 0.5rem;
|
|
61
|
-
}
|
|
62
|
-
`;
|
|
63
|
-
|
|
64
|
-
export class EaMessageBoxElement extends Base {
|
|
65
|
-
#wrap;
|
|
66
|
-
|
|
67
|
-
#headerWrap;
|
|
68
|
-
#contentWrap;
|
|
69
|
-
#footerWrap;
|
|
70
|
-
|
|
71
|
-
#confirmButton;
|
|
72
|
-
#cancelButton;
|
|
73
|
-
|
|
74
|
-
constructor() {
|
|
75
|
-
super();
|
|
76
|
-
|
|
77
|
-
const shadowRoot = this.attachShadow({ mode: 'open' });
|
|
78
|
-
const wrap = document.createElement('div');
|
|
79
|
-
wrap.className = 'ea-dialog_wrap';
|
|
80
|
-
wrap.role = 'dialog';
|
|
81
|
-
|
|
82
|
-
const headerTitle = createElement('span', 'ea-dialog_header-title');
|
|
83
|
-
const headerClose = createElement('i', 'ea-dialog_header-close icon-cancel');
|
|
84
|
-
headerClose.addEventListener('click', () => {
|
|
85
|
-
this.dispatchEvent(new CustomEvent('cancel'));
|
|
86
|
-
});
|
|
87
|
-
const header = createElement('div', 'ea-dialog_header', [headerTitle, headerClose]);
|
|
88
|
-
|
|
89
|
-
const content = createElement('div', 'ea-dialog_content');
|
|
90
|
-
|
|
91
|
-
const confirmButton = createElement('div', 'ea-dialog_footer-confirm-button');
|
|
92
|
-
const cancelButton = createElement('div', 'ea-dialog_footer-cancel-button');
|
|
93
|
-
const footer = createElement('div', 'ea-dialog_footer', [cancelButton, confirmButton]);
|
|
94
|
-
|
|
95
|
-
const board = createElement('div', 'ea-dialog_board', [header, content, footer]);
|
|
96
|
-
wrap.appendChild(board);
|
|
97
|
-
|
|
98
|
-
this.#wrap = wrap;
|
|
99
|
-
this.#headerWrap = headerTitle;
|
|
100
|
-
this.#contentWrap = content;
|
|
101
|
-
this.#footerWrap = footer;
|
|
102
|
-
|
|
103
|
-
this.#confirmButton = confirmButton;
|
|
104
|
-
this.#cancelButton = cancelButton;
|
|
105
|
-
|
|
106
|
-
this.build(shadowRoot, stylesheet);
|
|
107
|
-
this.shadowRoot.appendChild(wrap);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// ------- open 是否显示 -------
|
|
111
|
-
// #region
|
|
112
|
-
get open() {
|
|
113
|
-
return this.getAttrBoolean('open');
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
set open(flag) {
|
|
117
|
-
this.toggleAttr('open', flag);
|
|
118
|
-
this.#wrap.style.display = flag ? 'block' : 'none';
|
|
119
|
-
}
|
|
120
|
-
// #endregion
|
|
121
|
-
// ------- end -------
|
|
122
|
-
|
|
123
|
-
// ------- content 文字区域 -------
|
|
124
|
-
// #region
|
|
125
|
-
get content() {
|
|
126
|
-
return this.getAttribute('content');
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
set content(content) {
|
|
130
|
-
this.#contentWrap.innerHTML = content;
|
|
131
|
-
}
|
|
132
|
-
// #endregion
|
|
133
|
-
// ------- end -------
|
|
134
|
-
|
|
135
|
-
// ------- title 标题 -------
|
|
136
|
-
// #region
|
|
137
|
-
get title() {
|
|
138
|
-
return this.getAttribute('title');
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
set title(title) {
|
|
142
|
-
this.#headerWrap.innerHTML = title;
|
|
143
|
-
}
|
|
144
|
-
// #endregion
|
|
145
|
-
// ------- end -------
|
|
146
|
-
|
|
147
|
-
// ------- confirmButtonText 确认按钮文本 -------
|
|
148
|
-
// #region
|
|
149
|
-
get confirmButtonText() {
|
|
150
|
-
return this.getAttribute('confirmButtonText');
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
set confirmButtonText(val) {
|
|
154
|
-
const that = this;
|
|
155
|
-
this.setAttribute('confirmButtonText', val);
|
|
156
|
-
|
|
157
|
-
if (val || val !== '') {
|
|
158
|
-
this.#confirmButton.innerHTML = `<ea-button size="medium" type="primary">${val}</ea-button>`;
|
|
159
|
-
|
|
160
|
-
this.#confirmButton.addEventListener('click', () => {
|
|
161
|
-
that.dispatchEvent(new CustomEvent('confirm'));
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
// #endregion
|
|
166
|
-
// ------- end -------
|
|
167
|
-
|
|
168
|
-
// ------- cancelButtonText 取消按钮文本 -------
|
|
169
|
-
// #region
|
|
170
|
-
get cancelButtonText() {
|
|
171
|
-
return this.getAttribute('cancelButtonText');
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
set cancelButtonText(val) {
|
|
175
|
-
const that = this;
|
|
176
|
-
this.setAttribute('cancelButtonText', val);
|
|
177
|
-
|
|
178
|
-
if (val || val !== '') {
|
|
179
|
-
this.#cancelButton.innerHTML = `<ea-button size="medium">${val}</ea-button>`;
|
|
180
|
-
|
|
181
|
-
this.#cancelButton.addEventListener('click', () => {
|
|
182
|
-
that.dispatchEvent(new CustomEvent('cancel'));
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
// #endregion
|
|
187
|
-
// ------- end -------
|
|
188
|
-
|
|
189
|
-
init() {
|
|
190
|
-
const that = this;
|
|
191
|
-
|
|
192
|
-
this
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
connectedCallback() {
|
|
196
|
-
this.init();
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (!customElements.get('ea-message-box')) {
|
|
201
|
-
customElements.define('ea-message-box', EaMessageBoxElement);
|
|
202
|
-
}
|
|
1
|
+
import Base from"../Base.js";import{EaMessageBox}from"./src/utils/EaMessageBoxClass.js";import"../ea-button/index.js";import{stylesheet}from"./src/style/stylesheet.js";export class EaMessageBoxElement extends Base{#t;#e;#o;#n;#a;#i;constructor(){super();const t=this.attachShadow({mode:"open"});t.innerHTML='\n <div class="ea-dialog_wrap" part="container" role="dialog">\n <div class="ea-dialog_board" part="dialog-body">\n <div class="ea-dialog_header" part="dialog-header">\n <span class="ea-dialog_header-title" part="dialog-title"></span>\n <ea-icon class="ea-dialog_header-close" icon="icon-cancel" part="close-icon"></ea-icon>\n </div>\n <div class="ea-dialog_content" part="dialog-content"></div>\n <div class="ea-dialog_footer" part="dialog-footer">\n <div class="ea-dialog_footer-cancel-button" part="footer-cancel-button"></div>\n <div class="ea-dialog_footer-confirm-button" part="footer-confirm-button"></div>\n </div>\n </div>\n <div class="ea-dialog_mask" part="mask-wrap"></div>\n </div>\n ',this.#t=t.querySelector(".ea-dialog_wrap"),this.#e=t.querySelector(".ea-dialog_header"),this.#o=t.querySelector(".ea-dialog_content"),this.#n=t.querySelector(".ea-dialog_footer"),this.#a=t.querySelector(".ea-dialog_footer-confirm-button"),this.#i=t.querySelector(".ea-dialog_footer-cancel-button"),this.build(t,stylesheet)}get open(){return this.getAttrBoolean("open")}set open(t){this.toggleAttr("open",t),this.#t.style.display=t?"block":"none"}get content(){return this.getAttribute("content")}set content(t){this.#o.innerHTML=t}get title(){return this.getAttribute("title")}set title(t){this.#e.innerHTML=t}get confirmButtonText(){return this.getAttribute("confirmButtonText")}set confirmButtonText(t){t&&(this.setAttribute("confirmButtonText",t),this.#a.innerHTML=`<ea-button size="medium" type="primary">${t}</ea-button>`,this.#a.addEventListener("click",(()=>{this.dispatchEvent(new CustomEvent("confirm"))})))}get cancelButtonText(){return this.getAttribute("cancelButtonText")}set cancelButtonText(t){t&&(this.setAttribute("cancelButtonText",t),this.#i.innerHTML=`<ea-button size="medium">${t}</ea-button>`,this.#i.addEventListener("click",(()=>{this.dispatchEvent(new CustomEvent("cancel"))})))}}customElements.get("ea-message-box")||customElements.define("ea-message-box",EaMessageBoxElement);const messageBox=new EaMessageBox;window.$alert=messageBox,window.$confirm=messageBox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const stylesheet="\n.ea-dialog_wrap {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n z-index: 2024;\n}\n.ea-dialog_wrap .ea-dialog_board {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n background-color: aliceblue;\n width: 420px;\n padding-bottom: 10px;\n border-radius: 4px;\n border: 1px solid #ebeef5;\n box-sizing: 0 2px 12px 0;\n font-size: 18px;\n text-align: left;\n overflow: hidden;\n backface-visibility: hidden;\n}\n.ea-dialog_wrap .ea-dialog_board .ea-dialog_header {\n padding: 15px 15px 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.ea-dialog_wrap .ea-dialog_board .ea-dialog_header .ea-dialog_header-title {\n font-size: 18px;\n line-height: 1;\n color: #303133;\n}\n.ea-dialog_wrap .ea-dialog_board .ea-dialog_header .ea-dialog_header-close {\n display: inline-block;\n font-size: 16px;\n color: #909399;\n cursor: pointer;\n}\n.ea-dialog_wrap .ea-dialog_board .ea-dialog_content {\n padding: 10px 15px;\n color: #606266;\n font-size: 14px;\n}\n.ea-dialog_wrap .ea-dialog_board .ea-dialog_footer {\n padding: 5px 15px 0;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n}\n.ea-dialog_wrap .ea-dialog_board .ea-dialog_footer :first-child {\n margin-right: 0.5rem;\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createElement}from"../../../../utils/createElement.js";export class EaMessageBox{constructor(){}get attrs(){return["cancelButtonText","confirmButtonText"]}#e(e,t,n){n.forEach((n=>{t[n]&&(e[n]=t[n])}))}#t(e){e.remove()}open(e,t,n){const s=createElement("ea-message-box","");return document.body.appendChild(s),s.open=!0,s.content=e,s.title=t,this.#e(s,n,this.attrs),new Promise(((e,t)=>{s.addEventListener("cancel",(()=>{this.#t(s),t()})),s.addEventListener("confirm",(()=>{this.#t(s),e(!0)}))}))}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Base from"../Base.js";import"../ea-icon/index.js";import{stylesheet}from"./src/style/stylesheet.js";export class EaOption extends Base{#e;constructor(){super();const e=this.attachShadow({mode:"open"});e.innerHTML="\n <div class='ea-option_wrap' part='container'>\n <slot></slot>\n </div>\n ",this.#e=e.querySelector(".ea-option_wrap"),this.build(e,stylesheet)}get value(){return this.getAttribute("value")||""}set value(e){this.setAttribute("value",e)}get checked(){return this.getAttrBoolean("checked")||!1}set checked(e){this.setAttribute("checked",e),this.#e.classList.toggle("is-checked",e)}get disabled(){return this.getAttrBoolean("disabled")||!1}set disabled(e){this.setAttribute("disabled",e),this.#e.classList.toggle("is-disabled",e)}connectedCallback(){this.value=this.value,this.disabled=this.disabled}}customElements.get("ea-option")||customElements.define("ea-option",EaOption);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const stylesheet="\n.ea-option_wrap {\n position: relative;\n padding: 0 20px;\n height: 30px;\n line-height: 30px;\n font-size: 14px;\n color: #606266;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.ea-option_wrap.is-checked {\n color: #409eff;\n font-weight: 700;\n}\n.ea-option_wrap.is-disabled {\n color: #c0c4cc;\n pointer-events: none;\n cursor: not-allowed;\n}\n.ea-option_wrap:hover {\n background-color: #f5f7fa;\n}\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Base from"../Base.js";import"../ea-icon/index.js";const stylesheet="\n.ea-option-group_wrap .ea-option-group_title {\n padding-left: 20px;\n font-size: 12px;\n color: #909399;\n line-height: 30px;\n}\n";export class EaOptionGroup extends Base{#t;#e;constructor(){super();const t=this.attachShadow({mode:"open"});t.innerHTML="\n <div class='ea-option-group_wrap' part='container'>\n <div class='ea-option-group_title' part='title-wrap'></div>\n <slot></slot>\n </div>\n ",this.#t=t.querySelector(".ea-option-group_wrap"),this.#e=t.querySelector(".ea-option-group_title"),this.build(t,stylesheet)}get label(){return this.getAttribute("label")||""}set label(t){this.setAttribute("label",t),this.#e.innerHTML=t}connectedCallback(){this.label=this.label}}customElements.get("ea-option-group")||customElements.define("ea-option-group",EaOptionGroup);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Base from"../Base.js";import"../ea-icon/index.js";import{createSlotElement,createElement}from"../../utils/createElement.js";import{stylesheet}from"./src/style/stylesheet.js";export class EaPageHeader extends Base{#t;#e;#n;#a;#i;constructor(){super();const t=this.attachShadow({mode:"open"});t.innerHTML="\n <div class='ea-page-header_wrap' part='container'>\n <div class='ea-page-header_title-wrap' part='title-wrap'>\n <ea-icon class='ea-page-header_back-icon' part='back-icon' icon=\"icon-angle-left\"></ea-icon>\n <slot name=\"title\"></slot>\n </div>\n <div class='ea-page-header_divider' part='divider'>|</div>\n <div class='ea-page-header_content-wrap' part='content-wrap'>\n <slot name=\"content\"></slot>\n </div>\n </div>\n ",this.#t=t.querySelector(".ea-page-header_wrap"),this.#e=t.querySelector(".ea-page-header_title-wrap"),this.#a=t.querySelector('slot[name="title"]'),this.#n=t.querySelector(".ea-page-header_content-wrap"),this.#i=t.querySelector('slot[name="content"]'),this.build(t,stylesheet)}get title(){return this.getAttribute("title")||""}set title(t){t?(this.setAttribute("title",t),this.#a.innerText=t):(this.setAttribute("title","返回"),this.#a.innerText="返回")}get content(){return this.getAttribute("content")||""}set content(t){t?(this.setAttribute("content",t),this.#i.innerText=t):(this.setAttribute("content",""),this.#i.innerText="")}connectedCallback(){this.title=this.title,this.content=this.content,this.#e.addEventListener("click",(()=>{this.dispatchEvent(new CustomEvent("back"))}))}}customElements.get("ea-page-header")||customElements.define("ea-page-header",EaPageHeader);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const stylesheet="\n.ea-page-header_wrap {\n display: flex;\n align-items: center;\n line-height: 24px;\n}\n.ea-page-header_wrap .ea-page-header_title-wrap,\n.ea-page-header_wrap .ea-page-header_divider,\n.ea-page-header_wrap .ea-page-header_content-wrap {\n line-height: 24px;\n}\n.ea-page-header_wrap .ea-page-header_title-wrap {\n display: flex;\n align-items: center;\n font-size: 14px;\n font-weight: 500;\n line-height: 1;\n cursor: pointer;\n}\n.ea-page-header_wrap .ea-page-header_divider {\n margin: 0 1rem;\n margin-bottom: 1px;\n font-size: 14px;\n height: 14px;\n overflow: hidden;\n color: #dcdfe6;\n line-height: 1;\n vertical-align: middle;\n}\n.ea-page-header_wrap .ea-page-header_content-wrap {\n font-size: 18px;\n color: #303133;\n line-height: 1;\n}\n";
|