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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const stylesheet="\n\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Base from"../Base.js";import{stylesheet}from"./src/style/stylesheet.js";export class EaTimelineItem extends Base{#t;#e;#i;#s;constructor(){super();const t=this.attachShadow({mode:"open"});t.innerHTML="\n <div class='ea-timeline-item_wrap' part='container'>\n <div class='ea-timeline-item_circle' part='circle'></div>\n <div class='ea-timeline-item_tail' part='tail'></div>\n <div class='ea-timeline-item_container' part='body'>\n <div class='ea-timeline-item_content' part='content'>\n <slot></slot>\n </div>\n <div class='ea-timeline-item_timestamp' part='timestamp'></div>\n </div>\n </div>\n ",this.#t=t.querySelector(".ea-timeline-item_wrap"),this.#e=t.querySelector(".ea-timeline-item_timestamp"),this.#i=t.querySelector(".ea-timeline-item_circle"),this.#s=t.querySelector(".ea-timeline-item_timestamp"),this.build(t,stylesheet)}get time(){return this.getAttribute("time")||""}set time(t){t&&(this.setAttribute("time",t),this.#s.innerText=t)}get typeList(){return["primary","success","warning","danger","info"]}get type(){const t=this.getAttribute("type");return this.typeList.includes(t)?t:"info"}set type(t){this.setAttribute("type",t),this.#i.classList.add(`ea-timeline-item--${t}`)}get color(){return this.getAttribute("color")||""}set color(t){if(!t)return;this.setAttribute("color",t);""!==((new Option).style.color=t)&&(this.#i.style.backgroundColor=t)}get sizeList(){return["normal","large"]}get size(){const t=this.getAttribute("size");return this.sizeList.includes(t)?t:"normal"}set size(t){this.setAttribute("size",t),this.#t.classList.add(`ea-timeline-item_circle--${t}`)}get placementList(){return["top","bottom"]}get placement(){const t=this.getAttribute("placement");return this.placementList.includes(t)?t:"bottom"}set placement(t){this.setAttribute("placement",t),this.#e.classList.add(`ea-timeline-item_timestamp--${t}`)}connectedCallback(){this.time=this.time,this.type=this.type,this.color=this.color,this.size=this.size,this.placement=this.placement}}customElements.get("ea-timeline-item")||customElements.define("ea-timeline-item",EaTimelineItem);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const stylesheet="\n.ea-timeline-item_wrap {\n position: relative;\n padding-bottom: 20px;\n padding-left: 28px;\n list-style: none;\n}\n.ea-timeline-item_wrap .ea-timeline-item_circle {\n position: absolute;\n left: 0;\n z-index: 1;\n display: block;\n width: 12px;\n height: 12px;\n font-size: 12px;\n border-radius: 50%;\n background-color: #e4e7ed;\n}\n.ea-timeline-item_wrap .ea-timeline-item_circle.ea-timeline-item--primary {\n background-color: #409eff;\n color: #409eff;\n}\n.ea-timeline-item_wrap .ea-timeline-item_circle.ea-timeline-item--success {\n background-color: #67c23a;\n color: #67c23a;\n}\n.ea-timeline-item_wrap .ea-timeline-item_circle.ea-timeline-item--warning {\n background-color: #e6a23c;\n color: #e6a23c;\n}\n.ea-timeline-item_wrap .ea-timeline-item_circle.ea-timeline-item--danger {\n background-color: #f56c6c;\n color: #f56c6c;\n}\n.ea-timeline-item_wrap .ea-timeline-item_circle.ea-timeline-item--info {\n background-color: #e4e7ed;\n color: #e4e7ed;\n}\n.ea-timeline-item_wrap .ea-timeline-item_tail {\n z-index: 0;\n position: absolute;\n left: 0.3281rem;\n height: 100%;\n border-left: 2px solid #e4e7ed;\n}\n.ea-timeline-item_wrap .ea-timeline-item_container {\n position: relative;\n top: -4px;\n font-size: 14px;\n display: flex;\n flex-direction: column;\n}\n.ea-timeline-item_wrap .ea-timeline-item_container .ea-timeline-item_timestamp {\n color: #909399;\n line-height: 1;\n margin-top: 8px;\n}\n.ea-timeline-item_wrap .ea-timeline-item_container .ea-timeline-item_content {\n color: #303133;\n}\n.ea-timeline-item_wrap .ea-timeline-item_container.ea-timeline-item_timestamp--top {\n flex-direction: column-reverse;\n}\n.ea-timeline-item_wrap .ea-timeline-item_container.ea-timeline-item_timestamp--top .ea-timeline-item_timestamp {\n margin-top: 0;\n margin-bottom: 8px;\n}\n.ea-timeline-item_wrap .ea-timeline-item_container.ea-timeline-item_timestamp--bottom {\n flex-direction: column;\n}\n.ea-timeline-item_wrap.ea-timeline-item_circle--large .ea-timeline-item_circle {\n width: 14px;\n height: 14px;\n}\n.ea-timeline-item_wrap.ea-timeline-item_circle--large .ea-timeline-item_tail {\n left: 0.3906rem;\n}\n.ea-timeline-item_wrap.ea-timeline-item_circle--large .ea-timeline-item_container {\n font-size: 16px;\n}\n";
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "easy-component-ui",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Easy-ui, 基于 Web Components 的 UI 组件库",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
-
},
|
|
9
|
-
"keywords": [],
|
|
10
|
-
"author": "Lumina <https://github.com/LuminaQAQ>",
|
|
11
|
-
"license": "ISC"
|
|
1
|
+
{
|
|
2
|
+
"name": "easy-component-ui",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Easy-ui, 基于 Web Components 的 UI 组件库",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "Lumina <https://github.com/LuminaQAQ>",
|
|
11
|
+
"license": "ISC"
|
|
12
12
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const Validator={required:r=>"string"==typeof r?""!==r:!!Array.isArray(r)&&r.length>0,min:(r,t)=>r.length>=t,max:(r,t)=>r.length<=t,reg:(r,t)=>t.test(r)};
|
package/utils/createElement.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 创建元素
|
|
3
|
-
* @param {String} tagName
|
|
4
|
-
* @param {String} className
|
|
5
|
-
* @param {HTMLElement} children
|
|
6
|
-
* @returns {HTMLElement}
|
|
7
|
-
*/
|
|
8
|
-
export const createElement = (tagName, className, children) => {
|
|
9
|
-
const element = document.createElement(tagName || 'div');
|
|
10
|
-
element.className = className || '';
|
|
11
|
-
|
|
12
|
-
if (children) {
|
|
13
|
-
if (Array.isArray(children)) {
|
|
14
|
-
children.forEach(child => {
|
|
15
|
-
element.appendChild(child);
|
|
16
|
-
});
|
|
17
|
-
} else {
|
|
18
|
-
element.appendChild(children);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return element;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const createSlotElement = (name) => {
|
|
26
|
-
const slot = document.createElement('slot');
|
|
27
|
-
slot.name = name;
|
|
28
|
-
|
|
29
|
-
return slot;
|
|
30
|
-
};
|
|
1
|
+
export const createElement=(e,t,n)=>{const r=document.createElement(e||"div");return r.className=t||"",n&&(Array.isArray(n)?n.forEach((e=>{r.appendChild(e)})):r.appendChild(n)),r};export const createSlotElement=e=>{const t=document.createElement("slot");return e&&(t.name=e),t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const handleDefaultAttrIsTrue=e=>e="false"!==e&&!1!==e;
|
package/utils/handleTemplate.js
CHANGED
|
@@ -1,19 +1 @@
|
|
|
1
|
-
export const handleTemplate
|
|
2
|
-
const template = self.querySelector(`[slot="${slotName}"]`);
|
|
3
|
-
if (!template) return;
|
|
4
|
-
|
|
5
|
-
try {
|
|
6
|
-
if (template.childNodes.length === 0) {
|
|
7
|
-
realSlot.innerHTML = template.innerHTML;
|
|
8
|
-
} else if (template.innerHTML === '') {
|
|
9
|
-
const nodes = template.childNodes;
|
|
10
|
-
realSlot.innerHTML = '';
|
|
11
|
-
Array.from(nodes).forEach(node => {
|
|
12
|
-
realSlot.appendChild(node.cloneNode(true));
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
template.remove();
|
|
17
|
-
tempSlot.remove();
|
|
18
|
-
} catch (e) { }
|
|
19
|
-
}
|
|
1
|
+
export const handleTemplate=(e,n,o,r)=>{const c=e.querySelector(`[slot="${n}"]`);if(c)try{if(0===c.childNodes.length)o.innerHTML=c.innerHTML;else if(""===c.innerHTML){const e=c.childNodes;o.innerHTML="",Array.from(e).forEach((e=>{o.appendChild(e.cloneNode(!0))}))}c.remove(),r.remove()}catch(e){}};
|
package/utils/setStyle.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
export default function setStyle(
|
|
2
|
-
const link = document.createElement('link');
|
|
3
|
-
|
|
4
|
-
link.href = href;
|
|
5
|
-
link.rel = "stylesheet";
|
|
6
|
-
|
|
7
|
-
shadowRoot.appendChild(link);
|
|
8
|
-
}
|
|
1
|
+
export default function setStyle(e,t){const l=document.createElement("link");l.href=t,l.rel="stylesheet",e.appendChild(l)}
|
package/utils/timeout.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const timeout=(t,e=0)=>{let i=setTimeout((()=>{clearTimeout(i),i=null,t()}),e)};export const withTransitionTimeOut=(t,e=300)=>{let i=setTimeout((()=>{clearTimeout(i),i=null,t.classList.add("with-transition")}),e)};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
export class EaMessage {
|
|
3
|
-
constructor() {
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 处理字符串型消息
|
|
8
|
-
* @param {Element} el EaMessage元素
|
|
9
|
-
* @param {String} tip 文本
|
|
10
|
-
*/
|
|
11
|
-
handleStringMsg(el, tip) {
|
|
12
|
-
el.text = tip;
|
|
13
|
-
el.type = "info";
|
|
14
|
-
el.hasClose = false;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 处理对象型消息
|
|
19
|
-
* @param {Element} el EaMessage元素
|
|
20
|
-
* @param {String} tips 文本
|
|
21
|
-
* @param {*} attrs 属性列表
|
|
22
|
-
*/
|
|
23
|
-
handleObjectMsg(el, tips, attrs) {
|
|
24
|
-
for (const k in tips) {
|
|
25
|
-
if (attrs.includes(k)) el[k] = tips[k];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (!Object.keys(tips).includes("type")) el.type = "info";
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 处理消失的时长
|
|
33
|
-
* @param {*} el EaMessage元素
|
|
34
|
-
* @param {*} duration 时间间隔
|
|
35
|
-
*/
|
|
36
|
-
handleDuration(el, duration = 3) {
|
|
37
|
-
if (duration === 0) return;
|
|
38
|
-
|
|
39
|
-
let timer = setTimeout(() => {
|
|
40
|
-
el.show = false;
|
|
41
|
-
|
|
42
|
-
clearTimeout(timer);
|
|
43
|
-
timer = null;
|
|
44
|
-
}, duration * 1000 + 40);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
open(tip) {
|
|
48
|
-
const eaMessage = document.createElement('ea-message');
|
|
49
|
-
document.body.appendChild(eaMessage);
|
|
50
|
-
|
|
51
|
-
if (typeof tip === 'string') {
|
|
52
|
-
this.handleStringMsg(eaMessage, tip);
|
|
53
|
-
this.handleDuration(eaMessage);
|
|
54
|
-
} else if (typeof tip === 'object') {
|
|
55
|
-
this.handleObjectMsg(eaMessage, tip, eaMessage.attrs);
|
|
56
|
-
this.handleDuration(eaMessage, tip.duration);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
setTimeout(() => {
|
|
60
|
-
eaMessage.show = true;
|
|
61
|
-
}, 20);
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
onClose(fn) {
|
|
65
|
-
if (typeof fn === 'function') eaMessage.addEventListener('click', function () {
|
|
66
|
-
fn();
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { createElement } from "../../utils/createElement.js"
|
|
2
|
-
|
|
3
|
-
export class EaMessageBox {
|
|
4
|
-
constructor() {
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get attrs() {
|
|
9
|
-
return ["cancelButtonText", "confirmButtonText"];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
#handleElementAttrs(el, options, attrs) {
|
|
13
|
-
attrs.forEach(attr => {
|
|
14
|
-
if (options[attr]) el[attr] = options[attr];
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
#close(el) {
|
|
19
|
-
el.remove();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
open(content, title, options) {
|
|
23
|
-
const that = this;
|
|
24
|
-
|
|
25
|
-
const EaMessageBox = createElement('ea-message-box', '');
|
|
26
|
-
document.body.appendChild(EaMessageBox);
|
|
27
|
-
|
|
28
|
-
EaMessageBox.open = true;
|
|
29
|
-
|
|
30
|
-
EaMessageBox.content = content;
|
|
31
|
-
EaMessageBox.title = title;
|
|
32
|
-
|
|
33
|
-
this.#handleElementAttrs(EaMessageBox, options, this.attrs);
|
|
34
|
-
|
|
35
|
-
return new Promise((resolve, reject) => {
|
|
36
|
-
EaMessageBox.addEventListener('cancel', () => {
|
|
37
|
-
that.#close(EaMessageBox);
|
|
38
|
-
reject();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
EaMessageBox.addEventListener('confirm', () => {
|
|
42
|
-
that.#close(EaMessageBox);
|
|
43
|
-
resolve(true);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
}
|
|
File without changes
|