easy-component-ui 0.0.1 → 0.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/index.js +10 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var Q=(s,i,e)=>{if(!i.has(s))throw TypeError("Cannot "+e)};var r=(s,i,e)=>(Q(s,i,"read from private field"),e?e.call(s):i.get(s)),c=(s,i,e)=>{if(i.has(s))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(s):i.set(s,e)},n=(s,i,e,t)=>(Q(s,i,"write to private field"),t?t.call(s,e):i.set(s,e),e);function ie(s,i){const e=document.createElement("link");e.href=i,e.rel="stylesheet",s.appendChild(e)}class m extends HTMLElement{constructor(){super(),this.isProduction=!1,this.isProduction=!0}toggleAttribute(i,e,t){e?(this.setAttribute(i,e),t&&this.dom.classList.add(t)):(this.hasAttribute(i)&&this.removeAttribute(i),t&&this.dom.classList.remove(t))}toggleAttr(i,e){e?this.setAttribute(i,e):this.removeAttribute(i)}getAttrBoolean(i){const e=this.getAttribute(i);return e==="true"||e===""}build(i,e){if(this.isProduction){const t=document.createElement("style");t.innerHTML=e,this.shadowRoot.appendChild(t)}else ie(i,new URL(this.nodeName.toLowerCase()+"/index.css",import.meta.url).href)}}const oe=`
|
|
2
|
-
@import url('/icon/index.css');
|
|
2
|
+
@import url('/easy-component-ui/icon/index.css');
|
|
3
3
|
|
|
4
4
|
:host {
|
|
5
5
|
--margin-right: 1rem;
|
|
@@ -812,7 +812,7 @@ var Q=(s,i,e)=>{if(!i.has(s))throw TypeError("Cannot "+e)};var r=(s,i,e)=>(Q(s,i
|
|
|
812
812
|
--margin-right: 0;
|
|
813
813
|
}
|
|
814
814
|
`;class ne extends HTMLElement{constructor(){super();const i=this.attachShadow({mode:"open"}),e=document.createElement("div");i.appendChild(e);const t=document.createElement("slot");e.className="__ea-button-group",e.appendChild(t),this.dom=e;const o=document.createElement("style");o.innerHTML=ae,this.shadowRoot.appendChild(o),i.appendChild(e)}connectedCallback(){Array.from(this.children).map((i,e,t)=>{const o=i.shadowRoot?i.shadowRoot.querySelector("button"):i;e===0?o.style.setProperty("--border-radius","4px 0 0 4px"):e===t.length-1?o.style.setProperty("--border-radius","0 4px 4px 0"):o.style.setProperty("--border-radius","0")})}}const ce=`
|
|
815
|
-
@import url('/icon/index.css');
|
|
815
|
+
@import url('/easy-component-ui/icon/index.css');
|
|
816
816
|
|
|
817
817
|
.__ea-link {
|
|
818
818
|
text-decoration: none;
|
|
@@ -1056,7 +1056,7 @@ var Q=(s,i,e)=>{if(!i.has(s))throw TypeError("Cannot "+e)};var r=(s,i,e)=>(Q(s,i
|
|
|
1056
1056
|
margin-right: 1.5rem;
|
|
1057
1057
|
}`;class ke extends m{constructor(){super();const i=this.attachShadow({mode:"open"}),e=document.createElement("div");i.appendChild(e);const t=document.createElement("slot");e.className="ea-checkbox-group",e.appendChild(t),this.dom=e,this.build(i,xe),i.appendChild(e)}get name(){return this.getAttribute("name")}set name(i){this.querySelectorAll("ea-checkbox").forEach(e=>{e.setAttribute("name",i),e.name=i})}get value(){if(this.getAttribute("value"))return this.getAttribute("value")}set value(i){if(i)try{i.split(",").map(t=>t.trimStart()).map(t=>{const o=document.querySelector(`ea-checkbox[name="${this.name}"][value="${t}"]`);o.setAttribute("checked","true"),o.checked="true"})}catch{}}get disabled(){return this.getAttrBoolean("disabled")}set disabled(i){document.querySelectorAll(`ea-checkbox[name="${this.name}"]`).forEach(t=>{t.setAttribute("disabled","true"),t.disabled="true"})}init(){this.name=this.name,this.value=this.value,this.disabled=this.disabled}connectedCallback(){this.init()}}const ve="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let X=(s=21)=>{let i="",e=crypto.getRandomValues(new Uint8Array(s));for(;s--;)i+=ve[e[s]&63];return i};const ye=`
|
|
1058
1058
|
@charset "UTF-8";
|
|
1059
|
-
@import url('/icon/index.css');
|
|
1059
|
+
@import url('/easy-component-ui/icon/index.css');
|
|
1060
1060
|
|
|
1061
1061
|
|
|
1062
1062
|
:host {
|
|
@@ -1249,7 +1249,7 @@ var Q=(s,i,e)=>{if(!i.has(s))throw TypeError("Cannot "+e)};var r=(s,i,e)=>(Q(s,i
|
|
|
1249
1249
|
}
|
|
1250
1250
|
`,Ae=s=>{const i=document.createElement("input");return i.className="ea-input_inner",i.type=s||"text",i.autocomplete="off",i},Ee=()=>{const s=document.createElement("ul");return s.className="ea-input_suggestion-wrap",s},ee=s=>{const i=document.createElement("slot");return i.name=s,i};var E,l,S,P,T,M,L,Z,V;class Le extends m{constructor(){super();c(this,E,void 0);c(this,l,void 0);c(this,S,void 0);c(this,P,void 0);c(this,T,!1);c(this,M,[]);c(this,L,void 0);c(this,Z,void 0);c(this,V,void 0);const e=this.attachShadow({mode:"open"}),t=document.createElement("div");t.className="ea-input_wrap";const o=Ae(this.type),a=ee("prepend"),d=ee("append"),_=this.querySelector("[slot=prepend]"),D=this.querySelector("[slot=append]");_&&(t.classList.add("prepend-slot"),_.style.setProperty("--border-top-left-radius","3px"),_.style.setProperty("--border-bottom-left-radius","3px"),_.style.setProperty("--border-right-width","0"),_.style.setProperty("--border-left-width","1px"),a.appendChild(_.cloneNode(!0))),D&&(t.classList.add("append-slot"),D.style.setProperty("--border-top-right-radius","3px"),D.style.setProperty("--border-bottom-right-radius","3px"),D.style.setProperty("--border-left-width","0"),D.style.setProperty("--border-right-width","1px"),d.appendChild(D.cloneNode(!0))),t.appendChild(o),t.insertBefore(a,o),t.appendChild(d),n(this,E,t),n(this,l,o),n(this,Z,a),n(this,V,d),(this.suggestion.length>0||this.remote)&&this.suggestionEvent(),this.build(e,ye),this.shadowRoot.appendChild(t)}get type(){return this.getAttribute("type")||"text"}set type(e){this.setAttribute("type",e)}get value(){return r(this,T)||(r(this,l).value=this.getAttribute("value")||""),this.getAttribute("value")}set value(e){e&&(this.setAttribute("value",e),r(this,l).value=e)}get placeholder(){return this.getAttribute("placeholder")||""}set placeholder(e){this.setAttribute("placeholder",e),r(this,l).placeholder=e}get disabled(){return this.getAttrBoolean("disabled")}set disabled(e){this.toggleAttr("disabled",e),r(this,l).disabled=e,r(this,l).classList.toggle("disabled",e)}get clearable(){return this.getAttrBoolean("clearable")}set clearable(e){e&&this.setAttribute("clearable",e)}clearableEvent(e){this.clearable&&(this.clearable&&e.target.value!==""?r(this,S).style.display="block":r(this,S).style.display="none")}initClearableIcon(){if(this.clearable){const e=this.iconInit("icon-cancel-circled2");e.addEventListener("click",()=>{this.value="",r(this,l).focus()}),n(this,S,e),this.value?r(this,S).style.display="block":r(this,S).style.display="none",this.iconAppend("clearable",this.clearable,e)}}get showPassword(){return this.getAttrBoolean("show-password")}set showPassword(e){e&&(this.setAttribute("show-password",e),e&&(r(this,l).type="password"))}showPasswordEvent(e){this.showPassword&&(this.showPassword&&e.target.value!==""?r(this,P).style.display="block":r(this,P).style.display="none")}initShowPasswordIcon(){if(this.showPassword){const e=this.iconInit("icon-eye");this.value||(e.style.display="none"),e.addEventListener("click",t=>{r(this,P).className=r(this,l).type==="password"?"icon-eye-off":"icon-eye",r(this,l).type=r(this,l).type==="password"?"text":"password",r(this,l).focus()}),n(this,P,e),this.iconAppend("password",this.showPassword,e)}}get prefixIcon(){return this.getAttribute("prefix-icon")||""}set prefixIcon(e){if(!e)return;this.setAttribute("prefix",e);const t=this.iconInit(e);this.iconAppend("prefix",!0,t)}get surfixIcon(){return this.getAttribute("suffix-icon")||""}set surfixIcon(e){if(!e)return;this.setAttribute("suffix",e);const t=this.iconInit(e);this.iconAppend("suffix",!0,t)}get suggestion(){return r(this,M)}set suggestion(e){e&&(n(this,M,e),this.setAttribute("primary-key",X()),this.primaryKey=X())}get triggerOnFocus(){return this.getAttrBoolean("trigger-on-focus")}set triggerOnFocus(e){e&&this.setAttribute("trigger-on-focus",e)}get triggerAfterInput(){return this.getAttrBoolean("trigger-after-input")}set triggerAfterInput(e){e&&this.setAttribute("trigger-after-input",e)}get remote(){return this.getAttrBoolean("remote")}set remote(e){if(e!=null)try{const t=r(this,L).style.display;t=="flex"?r(this,L).style.display="block":t==""&&(r(this,L).style.display="none"),r(this,L).classList.toggle("loading",e),this.setAttribute("remote",e),r(this,T)&&this.refresh()}catch{}}refresh(){try{r(this,L).innerHTML="",this.suggestionEvent()}catch{}}suggestionEvent(){const e=r(this,T)?r(this,L):Ee();this.suggestion.forEach(t=>{const o=document.createElement("li");o.innerText=t.value,o.addEventListener("click",()=>{this.value=t.value,e.style.display="none"}),e.appendChild(o)}),document.addEventListener("click",t=>{t.target!==this&&(e.style.display="none")}),r(this,l).addEventListener("input",t=>{this.shadowRoot.querySelectorAll("li").forEach(o=>{o.innerText.includes(t.target.value)?o.style.display="block":o.style.display="none"})}),this.triggerOnFocus?r(this,l).addEventListener("focus",t=>{e.style.display=this.remote?"flex":"block"}):this.triggerAfterInput&&r(this,l).addEventListener("input",t=>{t.target.value.length>0?e.style.display="block":e.style.display="none"}),r(this,T)||(n(this,L,e),r(this,E).appendChild(e))}get maxLength(){return this.getAttribute("max-length")}set maxLength(e){!e||r(this,l).type!=="text"||(this.setAttribute("max-length",e),r(this,l).maxLength=e,r(this,l).addEventListener("input",t=>{t.target.value.length>e&&(t.target.value=t.target.value.slice(0,e))}),this.showWordLimit&&(this.showWordLimit=!0))}get minLength(){return this.getAttribute("min-length")}set minLength(e){!e||r(this,l).type!=="text"||(this.setAttribute("min-length",e),r(this,l).minLength=e,r(this,l).addEventListener("input",t=>{t.target.value.length<e?t.target.classList.add("invalid"):t.target.classList.remove("invalid")}))}get showWordLimit(){return this.getAttrBoolean("show-word-limit")}set showWordLimit(e){if(!e||r(this,l).type!=="text")return;this.setAttribute("show-word-limit",e);const t=document.createElement("span");r(this,E).classList.toggle("word-limit",e),r(this,E).classList.toggle("append-slot",e),t.className="ea-input_word-limit",t.innerText=`${r(this,l).value.length}/${this.maxLength}`,r(this,l).addEventListener("input",o=>{t.innerText=`${o.target.value.length}/${this.maxLength}`}),r(this,V).appendChild(t),r(this,E).appendChild(t)}iconInit(e){const t=document.createElement("i");return t.className=e,t}iconAppend(e,t,o){r(this,E).classList.toggle(e,t),r(this,E).appendChild(o)}eventInit(e,t){this.dispatchEvent(new CustomEvent(t,{detail:{value:e.target.value}})),this.clearableEvent(e),this.showPasswordEvent(e)}init(){this.type=this.type,this.placeholder=this.placeholder,this.value=this.value,this.disabled=this.disabled,this.clearable=this.clearable,this.initClearableIcon(),this.showPassword=this.showPassword,this.initShowPasswordIcon(),this.prefixIcon=this.prefixIcon,this.surfixIcon=this.surfixIcon,this.suggestion=this.suggestion,this.remote&&(this.remote=this.remote),this.maxLength=this.maxLength,this.minLength=this.minLength,r(this,l).addEventListener("input",e=>{this.eventInit(e,"change")}),r(this,l).addEventListener("focus",e=>{this.eventInit(e,"focus")}),r(this,l).addEventListener("blur",e=>{this.eventInit(e,"blur")})}connectedCallback(){this.init(),n(this,T,!0)}}E=new WeakMap,l=new WeakMap,S=new WeakMap,P=new WeakMap,T=new WeakMap,M=new WeakMap,L=new WeakMap,Z=new WeakMap,V=new WeakMap;const Ce=`
|
|
1251
1251
|
@charset "UTF-8";
|
|
1252
|
-
@import url('/icon/index.css');
|
|
1252
|
+
@import url('/easy-component-ui/icon/index.css');
|
|
1253
1253
|
|
|
1254
1254
|
.ea-textarea_wrap {
|
|
1255
1255
|
position: relative;
|
|
@@ -1289,7 +1289,7 @@ var Q=(s,i,e)=>{if(!i.has(s))throw TypeError("Cannot "+e)};var r=(s,i,e)=>(Q(s,i
|
|
|
1289
1289
|
right: 0.5rem;
|
|
1290
1290
|
}
|
|
1291
1291
|
`,ze=()=>{let s=document.createElement("textarea");return s.className="ea-textarea_inner",s};var I,u,U;class Ne extends m{constructor(){super();c(this,I,void 0);c(this,u,void 0);c(this,U,!1);const e=this.attachShadow({mode:"open"}),t=document.createElement("div");t.className="ea-textarea_wrap",n(this,I,t);const o=ze();n(this,u,o),r(this,I).appendChild(o),this.build(e,Ce),this.shadowRoot.appendChild(t)}get value(){return r(this,U)||(r(this,u).value=this.getAttribute("value")||""),this.getAttribute("value")}set value(e){e&&(this.setAttribute("value",e),r(this,u).value=e)}get placeholder(){return this.getAttribute("placeholder")||""}set placeholder(e){this.setAttribute("placeholder",e),r(this,u).placeholder=e}get rows(){return this.getAttribute("rows")||2}set rows(e){e&&(this.setAttribute("rows",e),r(this,u).rows=e,r(this,u).setAttribute("rows",e))}get autosize(){return this.getAttrBoolean("autosize")}set autosize(e){e&&(this.setAttribute("autosize",e),r(this,u).addEventListener("input",t=>{if(t.target.type==="textarea"){const o=r(this,u).cols,a=t.target.value.length;let d=Math.ceil(a/o)<=Number(r(this,u).rows)?Number(r(this,u).rows):Math.ceil(a/o);a%o==1&&(this.minRows>d?this.setTextareaHeight(this.minRows):this.maxRows<d?this.setTextareaHeight(this.maxRows):this.setTextareaHeight(d))}}))}setTextareaHeight(e){e=Number(e),r(this,u).rows=e}get minRows(){const e=Number(this.getAttribute("min-rows"));return e!==0&&e>0?e:1}set minRows(e){e&&(this.setAttribute("min-rows",e),this.setTextareaHeight(Number(e)))}get maxRows(){const e=Number(this.getAttribute("max-rows"));return e!==0&&e>0?e:10}set maxRows(e){e&&(this.setAttribute("max-rows",e),this.setTextareaHeight(Number(e)))}get maxLength(){return this.getAttribute("max-length")}set maxLength(e){e&&(this.setAttribute("max-length",e),r(this,u).maxLength=e,r(this,u).addEventListener("input",t=>{t.target.value.length>e&&(t.target.value=t.target.value.slice(0,e))}),this.showWordLimit&&(this.showWordLimit=!0))}get minLength(){return this.getAttribute("min-length")}set minLength(e){e&&(this.setAttribute("min-length",e),r(this,u).minLength=e,r(this,u).addEventListener("input",t=>{t.target.value.length<e?t.target.classList.add("invalid"):t.target.classList.remove("invalid")}))}get showWordLimit(){return this.getAttrBoolean("show-word-limit")}set showWordLimit(e){if(!e)return;this.setAttribute("show-word-limit",e);const t=document.createElement("span");r(this,I).classList.toggle("word-limit",e),r(this,I).classList.toggle("append-slot",e),t.className="ea-input_word-limit",t.innerText=`${r(this,u).value.length}/${this.maxLength}`,r(this,u).addEventListener("input",o=>{t.innerText=`${o.target.value.length}/${this.maxLength}`}),r(this,I).appendChild(t)}init(){this.placeholder=this.placeholder,this.value=this.value,this.disabled=this.disabled,this.autosize=this.autosize,this.maxRows&&(this.maxRows=this.maxRows),this.minRows&&(this.minRows=this.minRows),this.rows=this.rows,this.maxLength=this.maxLength,this.minLength=this.minLength,r(this,u).addEventListener("input",e=>{this.dispatchEvent(new CustomEvent("change",{detail:{value:e.target.value}}))}),r(this,u).addEventListener("focus",e=>{this.dispatchEvent(new CustomEvent("focus",{detail:{value:e.target.value}}))}),r(this,u).addEventListener("blur",e=>{this.dispatchEvent(new CustomEvent("blur",{detail:{value:e.target.value}}))})}connectedCallback(){this.init(),n(this,U,!0)}}I=new WeakMap,u=new WeakMap,U=new WeakMap;const Se=`
|
|
1292
|
-
@import url('/icon/index.css');
|
|
1292
|
+
@import url('/easy-component-ui/icon/index.css');
|
|
1293
1293
|
|
|
1294
1294
|
.ea-input-number_wrap {
|
|
1295
1295
|
display: flex;
|
|
@@ -1403,9 +1403,9 @@ var Q=(s,i,e)=>{if(!i.has(s))throw TypeError("Cannot "+e)};var r=(s,i,e)=>(Q(s,i
|
|
|
1403
1403
|
border-color: transparent;
|
|
1404
1404
|
}
|
|
1405
1405
|
`,te=s=>{const i=document.createElement("span");return i.className=`ea-input-number_sign ${s}`,i.innerHTML=s==="minus"?"-":"+",i},Te=()=>{const s=document.createElement("input");return s.className="ea-input-number_inner",s.type="text",s.value=0,s};var O,h,C,z;class Ie extends m{constructor(){super();c(this,O,void 0);c(this,h,void 0);c(this,C,void 0);c(this,z,void 0);const e=this.attachShadow({mode:"open"}),t=document.createElement("div");t.className="ea-input-number_wrap";const o=Te(),a=te("minus"),d=te("plus");t.appendChild(a),t.appendChild(o),t.appendChild(d),n(this,O,t),n(this,h,o),n(this,C,a),n(this,z,d),this.build(e,Se),this.shadowRoot.appendChild(t)}signEvent(e,t,o){if(this.getAttrBoolean("disabled"))return;const a=Number(r(this,h).value),d=r(this,h).value.split(".")[1],_=e==="minu"?a-this.step:a+this.step;t?r(this,h).value=_.toFixed(t):d!=null&&d.length?r(this,h).value=_.toFixed(d.length):r(this,h).value=_,o&&r(this,h).dispatchEvent(new CustomEvent(o,{detail:{value:r(this,h).value}})),this.handleLimitVal()}handleCounterEvent(e){let t=setInterval(()=>{this.signEvent(e,this.precision),this.handleLimitVal()},100);this.addEventListener("mouseup",function(){clearInterval(t),t=null})}handleWrapBorder(e){r(this,O).classList.toggle("focus",e)}handleLimitVal(){if(!(this.min===!1&&this.max===!1))if(this.min!==void 0&&r(this,h).value<this.min?r(this,h).value=this.min:this.max!==void 0&&r(this,h).value>this.max&&(r(this,h).value=this.max),r(this,h).value==this.min)r(this,C).classList.add("disabled");else if(r(this,h).value==this.max)r(this,z).classList.add("disabled");else try{r(this,C).classList.remove("disabled"),r(this,z).classList.remove("disabled")}catch{}}get value(){return this.getAttribute("value")||0}set value(e){e=this.precision?Number(e).toFixed(this.precision):Number(e),this.setAttribute("value",e),r(this,h).value=e}get disabled(){return this.getAttrBoolean("disabled")}set disabled(e){this.toggleAttr("disabled",e),r(this,h).disabled=e,r(this,h).classList.toggle("disabled",e),r(this,C).classList.toggle("disabled",e),r(this,z).classList.toggle("disabled",e)}get step(){return Number(this.getAttribute("step"))||1}set step(e){this.setAttribute("step",e)}get stepStrictly(){return this.getAttrBoolean("step-strictly")}set stepStrictly(e){this.toggleAttr("step-strictly",e)}get min(){return this.getAttribute("min")===null?!1:Number(this.getAttribute("min"))||0}set min(e){if(e===!1){this.removeAttribute("min");return}this.setAttribute("min",e)}get max(){return this.getAttribute("max")===null?!1:Number(this.getAttribute("max"))}set max(e){this.setAttribute("max",e)}get precision(){const e=Number(this.getAttribute("precision"));return e<0||!Number.isInteger(e)?(console.warn(`precision must be a positive integer(precisionValue: ${e})`),!1):Number(this.getAttribute("precision"))||0}set precision(e){this.setAttribute("precision",e)}get size(){return this.getAttribute("size")||""}handleSize(e){r(this,C).classList.add(`ea-input-number_sign--${e}`),r(this,z).classList.add(`ea-input-number_sign--${e}`),r(this,h).classList.add(`ea-input-number_inner--${e}`),this.setAttribute("size",e)}set size(e){switch(e){case"medium":this.handleSize("medium");break;case"small":this.handleSize("small");break;case"mini":this.handleSize("mini");break}}init(){const e=this;this.disabled=this.disabled,this.size=this.size,this.min?this.value=this.min:this.value=this.value,this.handleLimitVal(),r(this,h).addEventListener("focus",function(t){e.handleWrapBorder(!0),this.dispatchEvent(new CustomEvent("blur",{detail:{value:this.value}}))}),r(this,h).addEventListener("blur",function(t){if(e.handleWrapBorder(!1),e.stepStrictly){const o=e.step,a=Number(r(e,h).value),d=a%o;a<0&&d!==0?r(e,h).value=a-d-o:a<0&&d===0||d===0?r(e,h).value=a:r(e,h).value=a-d+o}e.handleLimitVal(),this.dispatchEvent(new CustomEvent("blur",{detail:{value:this.value}}))}),r(this,C).addEventListener("click",function(){e.signEvent("minu",e.precision,"minus")}),r(this,z).addEventListener("click",function(t){e.signEvent("plus",e.precision,"plus")}),r(this,C).addEventListener("mousedown",function(t){e.handleCounterEvent("minu",e.precision)}),r(this,z).addEventListener("mousedown",function(){e.handleCounterEvent("plus",e.precision)}),r(this,h).addEventListener("change",function(t){e.handleLimitVal(),this.dispatchEvent(new CustomEvent("change",{detail:{value:this.value}}))})}connectedCallback(){this.init()}}O=new WeakMap,h=new WeakMap,C=new WeakMap,z=new WeakMap;const $e=`
|
|
1406
|
-
@import url('/icon/index.css');
|
|
1406
|
+
@import url('/easy-component-ui/icon/index.css');
|
|
1407
1407
|
`;var J;class Re extends m{constructor(){super();c(this,J,void 0);const e=this.attachShadow({mode:"open"});this.shadowRoot=e;const t=document.createElement("div");t.className="ea-select_wrap",n(this,J,t),this.build(e,$e),this.shadowRoot.appendChild(t)}init(){}connectedCallback(){this.init()}}J=new WeakMap;const Be=`
|
|
1408
|
-
@import url('/icon/index.css');
|
|
1408
|
+
@import url('/easy-component-ui/icon/index.css');
|
|
1409
1409
|
|
|
1410
1410
|
.ea-switch_wrap {
|
|
1411
1411
|
display: flex;
|
|
@@ -1477,7 +1477,7 @@ var Q=(s,i,e)=>{if(!i.has(s))throw TypeError("Cannot "+e)};var r=(s,i,e)=>(Q(s,i
|
|
|
1477
1477
|
color: #7ebfff;
|
|
1478
1478
|
}
|
|
1479
1479
|
`,Pe=()=>{const s=document.createElement("input");return s.type="checkbox",s.className="ea-switch_input",s},qe=()=>{const s=document.createElement("span");return s.className="ea-switch_core",s},re=s=>{const i=document.createElement("span");return i.className=`ea-switch_label ea-switch_label--${s}`,i};var F,G,x,$,k,R;class De extends m{constructor(){super();c(this,F,!1);c(this,G,void 0);c(this,x,void 0);c(this,$,void 0);c(this,k,void 0);c(this,R,void 0);const e=this.attachShadow({mode:"open"}),t=document.createElement("div");t.className="ea-switch_wrap";const o=Pe(),a=re("left"),d=qe(),_=re("right");t.appendChild(o),t.appendChild(a),t.appendChild(d),t.appendChild(_),n(this,G,t),n(this,x,o),n(this,$,a),n(this,k,d),n(this,R,_),this.build(e,Be),this.shadowRoot.appendChild(t)}static get observedAttributes(){return["checked"]}get inactiveText(){return this.getAttribute("inactive-text")}set inactiveText(e){this.setAttribute("inactive-text",e),r(this,$).innerText=e}get activeText(){return this.getAttribute("active-text")}set activeText(e){this.setAttribute("active-text",e),r(this,R).innerText=e}get checked(){return this.getAttrBoolean("checked")}set checked(e){this.setAttribute("checked",e),r(this,x).checked=e,r(this,x).setAttribute("checked",e),e?(r(this,k).classList.add("ea-switch_core--checked"),r(this,R).classList.add("ea-switch_label--active"),r(this,$).classList.remove("ea-switch_label--active")):(r(this,k).classList.remove("ea-switch_core--checked"),r(this,$).classList.add("ea-switch_label--active"),r(this,R).classList.remove("ea-switch_label--active"))}get disabled(){return this.getAttrBoolean("disabled")}set disabled(e){this.setAttribute("disabled",e),r(this,x).disabled=e,r(this,G).classList.toggle("ea-switch_wrap--disabled",e)}get inactiveColor(){return this.getAttribute("inactive-color")}set inactiveColor(e){e&&(this.setAttribute("inactive-color",e),e&&(r(this,k).style.backgroundColor=e))}get activeColor(){return this.getAttribute("active-color")}set activeColor(e){e&&(this.setAttribute("active-color",e),r(this,k).style.backgroundColor=e)}handleInputChecked(e){const t=r(this,x).checked;this.inactiveColor&&this.activeColor?r(this,k).style.backgroundColor=t?this.inactiveColor:this.activeColor:r(this,k).classList.toggle("ea-switch_core--checked",t)}init(){const e=this;this.checked=this.checked,this.inactiveText=this.inactiveText,this.activeText=this.activeText,this.disabled=this.disabled,this.activeColor&&this.inactiveColor&&(this.checked?this.activeColor=this.activeColor:this.inactiveColor=this.inactiveColor),r(this,$).addEventListener("click",function(t){e.checked=!r(e,x).checked}),r(this,R).addEventListener("click",function(t){e.checked=!r(e,x).checked}),r(this,k).addEventListener("click",function(t){e.checked=!r(e,x).checked})}connectedCallback(){this.init(),n(this,F,!0)}attributeChangedCallback(e,t,o){if(r(this,F)&&e==="checked"){const a=this.checked?this.activeText:this.inactiveText;this.handleInputChecked(),this.dispatchEvent(new CustomEvent("change",{detail:{checked:this.checked,value:a}}))}}}F=new WeakMap,G=new WeakMap,x=new WeakMap,$=new WeakMap,k=new WeakMap,R=new WeakMap;const He=`
|
|
1480
|
-
@import url('/icon/index.css');
|
|
1480
|
+
@import url('/easy-component-ui/icon/index.css');
|
|
1481
1481
|
|
|
1482
1482
|
:host {
|
|
1483
1483
|
--i-color: rgb(247, 186, 42);
|
|
@@ -1529,7 +1529,7 @@ var Q=(s,i,e)=>{if(!i.has(s))throw TypeError("Cannot "+e)};var r=(s,i,e)=>(Q(s,i
|
|
|
1529
1529
|
line-height: 1;
|
|
1530
1530
|
}
|
|
1531
1531
|
`,We=s=>{const i=document.createElement("span");i.className="ea-rate_item",i.setAttribute("data-index",s);const e=document.createElement("i");return e.className="icon-star-empty",i.appendChild(e),i};var Y,w,K,q;class Me extends m{constructor(){super();c(this,Y,!1);c(this,w,void 0);c(this,K,void 0);c(this,q,["极差","失望","一般","满意","惊喜"]);const e=this.attachShadow({mode:"open"}),t=document.createElement("div");t.className="ea-rate_wrap";for(let a=0;a<5;a++){const d=We(a);t.appendChild(d)}const o=document.createElement("span");o.className="ea-rate_text",t.appendChild(o),n(this,w,t),n(this,K,o),this.build(e,He),this.shadowRoot.appendChild(t)}static get observedAttributes(){return["value"]}setCheckedStatus(e){const t=r(this,w).querySelectorAll(".ea-rate_item");for(let o=0;o<e;o++)t[o].classList.add("ea-rate_item--active"),t[o].querySelector("i").className=this.activeIconClass,this.showText&&(r(this,K).innerText=this.showTextList[e-1])}clearCheckedStatus(){r(this,w).querySelectorAll(".ea-rate_item").forEach(e=>{if(e.classList.remove("ea-rate_item--active"),e.querySelector("i").className=this.voidIconClass,this.showText){const t=r(this,w).querySelector(".ea-rate_text");t.innerText=""}})}get value(){const e=this.getAttribute("value")||0;return e<1||e>5||!e?0:Number(e)}set value(e){e=Number(e),this.setAttribute("value",e),this.clearCheckedStatus(),this.setCheckedStatus(e)}get color(){return this.getAttribute("color")||"rgb(247, 186, 42)"}set color(e){this.setAttribute("color",e),r(this,w).querySelectorAll(".ea-rate_item").forEach(t=>{t.querySelector("i").style.setProperty("--i-color",e)})}get showText(){return this.getAttrBoolean("show-text")}set showText(e){this.toggleAttr("show-text",e)}get showTextList(){return r(this,q)}set showTextList(e){typeof e=="object"&&e.length===5&&n(this,q,e)}get voidIconClass(){return this.getAttribute("void-icon-class")||"icon-star-empty"}set voidIconClass(e){this.setAttribute("void-icon-class",e),r(this,w).querySelectorAll(".ea-rate_item").forEach(t=>{t.querySelector("i").className=e})}get activeIconClass(){return this.getAttribute("active-icon-class")||"icon-star"}set activeIconClass(e){this.setAttribute("active-icon-class",e),r(this,w).querySelectorAll(".ea-rate_item").forEach(t=>{t.querySelector("i").className=e})}get disabled(){return this.getAttrBoolean("disabled")}set disabled(e){this.toggleAttr("disabled",e),r(this,w).querySelectorAll(".ea-rate_item").forEach(t=>{t.classList.toggle("ea-rate_item--disabled",e)})}initRateEvent(){const e=this;r(this,w).querySelectorAll(".ea-rate_item").forEach(t=>{t.addEventListener("mouseenter",function(o){const a=Number(this.getAttribute("data-index"));e.clearCheckedStatus(),e.setCheckedStatus(a+1),e.dispatchEvent(new CustomEvent("hover",{detail:{value:a+1,rateText:r(e,q)[a]}}))}),t.addEventListener("mouseleave",function(o){e.clearCheckedStatus(),e.setCheckedStatus(e.value)}),t.addEventListener("click",function(o){const a=Number(this.getAttribute("data-index"));e.value=a+1,e.dispatchEvent(new CustomEvent("change",{detail:{value:a+1,rateText:r(e,q)[a]}}))})})}init(){this.activeIconClass=this.activeIconClass,this.voidIconClass=this.voidIconClass,this.showText=this.showText,this.color=this.color,this.value=this.value,this.disabled=this.disabled,this.disabled||this.initRateEvent()}connectedCallback(){this.init(),n(this,Y,!0)}attributeChangedCallback(e,t,o){r(this,Y)&&e=="value"&&(this.clearCheckedStatus(),this.setCheckedStatus(o))}}Y=new WeakMap,w=new WeakMap,K=new WeakMap,q=new WeakMap;const Ve=`
|
|
1532
|
-
@import url('/icon/index.css');
|
|
1532
|
+
@import url('/easy-component-ui/icon/index.css');
|
|
1533
1533
|
|
|
1534
1534
|
.ea-tag_wrap {
|
|
1535
1535
|
display: inline-block;
|
|
@@ -1621,7 +1621,7 @@ var Q=(s,i,e)=>{if(!i.has(s))throw TypeError("Cannot "+e)};var r=(s,i,e)=>(Q(s,i
|
|
|
1621
1621
|
margin-left: 0.5rem;
|
|
1622
1622
|
cursor: pointer;
|
|
1623
1623
|
`,s};var W,j;class Oe extends m{constructor(){super();c(this,W,void 0);c(this,j,void 0);const e=this.attachShadow({mode:"open"}),t=document.createElement("div");t.className="ea-tag_wrap";const o=document.createElement("slot");t.appendChild(o);const a=document.createElement("slot");a.name="close",t.appendChild(a),n(this,W,t),n(this,j,a),this.build(e,Ve),this.shadowRoot.appendChild(t)}get type(){return this.getAttribute("type")||"default"}set type(e){this.setAttribute("type",e),r(this,W).classList.add(`ea-tag--${e}`)}get closable(){return this.getAttrBoolean("closable")}set closable(e){this.toggleAttr("closable",e)}get effect(){return this.getAttribute("effect")||"light"}set effect(e){e!=="light"&&(this.setAttribute("effect",e),r(this,W).classList.add(`ea-tag--${e}`))}initCloseEvent(){const e=this,t=Ue();t.addEventListener("mouseenter",function(o){t.className="icon-cancel-circled"}),t.addEventListener("mouseleave",function(o){t.className="icon-cancel-circled2"}),t.addEventListener("click",function(o){e.dispatchEvent(new CustomEvent("close",{detail:{value:e.innerText},bubbles:!0}))}),r(this,j).appendChild(t)}init(){this.type=this.type,this.closable=this.closable,this.closable&&this.initCloseEvent(),this.effect=this.effect}connectedCallback(){this.init()}}W=new WeakMap,j=new WeakMap;const Fe=`
|
|
1624
|
-
@import url('/icon/index.css');
|
|
1624
|
+
@import url('/easy-component-ui/icon/index.css');
|
|
1625
1625
|
|
|
1626
1626
|
.ea-progress_wrap {
|
|
1627
1627
|
position: relative;
|