-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp-57d8bb90.entry.js
5 lines (5 loc) · 3.05 KB
/
p-57d8bb90.entry.js
1
2
3
4
5
/*!
* Built by BASIS
* Copyright BASIS International Ltd.
*/
import{r as t,c as i,h as s,H as e,g as n}from"./p-0e3693b5.js";import{g as h}from"./p-d1476f28.js";import{h as o}from"./p-3e9fe89f.js";const a=class{constructor(s){t(this,s),this.modifiedEvent=i(this,"dwc-modified",7),this.spinedEvent=i(this,"dwc-spun",7),this.disabled=!1,this.readonly=!1,this.min=void 0,this.max=void 0,this.step=1}connectedCallback(){this.handleSlotChange=this.handleSlotChange.bind(this)}handleSpinedUp(){this.doSpin("up")}handleSpinedDown(){this.doSpin("down")}handleRequiredPropsChanged(t){t.stopPropagation();const{disabled:i,readonly:s,min:e,max:n}=t.detail;this.disabled=i,this.readonly=s,this.min=e,this.max=n}async setFocus(){await this.$inputn.setFocus()}async removeFocus(){await this.$inputn.removeFocus()}async spin(t){this.doSpin(t?"up":"down",!1)}doSpin(t,i=!0){if(!this.$inputn)return;if((this.readonly||this.disabled)&&1==i)return;const s=this.$inputn.value,e=this.$inputn.negateable;let n=0;if(this.$inputn.mask){const t=this.$inputn.mask;if(t.length){const i=t.split(".");i&&2===i.length&&(n=i[1].split("").filter((t=>"#"==t||"0"==t)).length)}}switch(t){case"up":{const t=Number((Number(s)+Math.abs(this.step)).toFixed(n));this.$inputn.value=isNaN(this.max)?String(t):String(t>this.max?this.max:t);break}case"down":{const t=Number((Number(s)-Math.abs(this.step)).toFixed(n));if(t<0&&!e)break;this.$inputn.value=isNaN(this.min)?String(t):String(t<this.min?this.min:t);break}}i&&this.fireModifiedEvent(),s!==this.$inputn.value&&this.fireSpinedEvent()}fireSpinedEvent(){this.disabled||this.readonly||this.spinedEvent.emit({value:this.$inputn.value,mask:this.$inputn.mask})}fireModifiedEvent(){if(this.disabled||this.readonly)return;const t=h("decimal"),i=Number(String(this.$inputn.value).replace(t,"."));isNaN(i)||this.modifiedEvent.emit(i)}handleSlotChange(){this.$inputn=this.el.querySelector("dwc-numberfield"),this.$inputn.showSpinners=!0,this.$inputn.spinnable=!0,this.disabled=this.$inputn.disabled,this.readonly=this.$inputn.readonly,this.min=this.$inputn.min,this.max=this.$inputn.max}render(){return s(e,{key:"56bead342741c8d4e5a741de256c01c6cf736443",class:o({BBjControl:!0,BBjSpinner:!0,BBjInputNSpinner:!0,"bbj-disabled":this.disabled,"bbj-readonly":this.readonly})},s("slot",{key:"b43088cbadef90262b845fd26f456e989df1e913",onSlotchange:this.handleSlotChange}))}get el(){return n(this)}};a.style="@media (prefers-reduced-motion: reduce){*,::before,::after{animation-delay:-1ms !important;animation-duration:1ms !important;animation-iteration-count:1 !important;background-attachment:initial !important;scroll-behavior:auto !important;transition-delay:0s !important;transition-duration:0s !important}}:host{box-sizing:border-box;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:relative;-webkit-tap-highlight-color:transparent;text-size-adjust:100%}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{cursor:pointer;display:inline-block}:host(:focus),:host(:active){outline:none}:host ::slotted(dwc-numberfield){height:100%;width:100%}";export{a as dwc_numberfield_spinner}