1 line
6.0 KiB
JavaScript
1 line
6.0 KiB
JavaScript
|
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7901],{27901:function(e,t,n){n.d(t,{Z:function(){return c}});var r,a,o=n(26042),i=n(85893),l=n(67294);function s(e){var t,n=e.value,r=e.format;if(!n)return 0;try{if("string"===r)t=n.toString().replace(/\D/g,"").replace(/\B(?=(\d{3})+(?!\d))/g,",");else t=parseInt(n.toString().replace(/\D/g,""))}catch(a){t=0,console.log(a)}return t}function u(e){var t,n,r=e.value,a=e.format,o=e.decimals,i=(null===(t=null===r||void 0===r?void 0:r.toString())||void 0===t?void 0:t.match(/^\-/))?"-":"";try{if("string"===a){var l=r.toString().split(".");n=i+l[0].toString().replace(/[^0-9\.]/g,"").replace(/\B(?=(\d{3})+(?!\d))/g,",")+(l[1]?".".concat(o?l[1].substring(0,o):l[1].substring(0,2)):"")}else n=parseFloat(i+r.toString().replace(/[^0-9\.]/g,""))}catch(s){n=0,console.log(s)}return n}function c(e){try{var t=function(e){e.target.value.match(/./)?(e.target.classList.remove("warning"),b&&b(null)):e.target.required&&e.target.classList.add("warning"),T&&(e.target.value=e.target.value.toString().match(/^0+$/)?"0":e.target.value.toString().replace(k?/[^0-9\.]/g:/\D/g,"").replace(/^0*/,"").replace(/\B(?=(\d{3})+(?!\d))/g,",")),h&&h(e),L&&L(e)},n=function(e){if(!(e.type.match(/enter/i)&&window.innerWidth<1200)){var t=e.target.closest(".info-wrapper"),n=t.querySelector(".info-dropdown");!e.type.match(/leave/i)||n.classList.contains("hidden")?e.type.match(/leave/i)&&n.classList.contains("hidden")||(t&&n.classList.contains("hidden")?n.classList.remove("hidden"):n.classList.add("hidden")):n.classList.add("hidden")}},c=function(e){var t,n=k?parseFloat(u({value:(null===(t=_.current)||void 0===t?void 0:t.value)||0}).toString())-(M?parseFloat(M.toString()):20):parseInt(s({value:_.current.value}).toString())-(M||20),r=k?u({value:n,format:"raw"}):s({value:n,format:"raw"});y&&"number"==typeof r&&r<y||(_.current.value=k?parseFloat(u({value:n,format:"raw"}).toString()).toFixed("number"===typeof k?k:2):s({value:n,format:"string"}).toString(),V&&V(_.current.value))},d=function(e){var t=k?parseFloat(u({value:_.current.value}).toString())+(M?parseFloat(M.toString()):20):parseInt(s({value:_.current.value}).toString())+(M||20),n=k?parseFloat(u({value:t,format:"raw"}).toString()).toFixed("number"===typeof k?k:2):s({value:t,format:"string"}),r=k?parseFloat(u({value:n,format:"raw"}).toString()):parseInt(s({value:n,format:"raw"}).toString());j&&r>j||(_.current.value=n.toString(),V&&V(_.current.value))},p=e.title,f=e.name,v=e.defaultValue,m=e.placeholder,g=e.autoComplete,h=e.onInputHandler,w=e.required,x=e.inputType,b=e.setAlert,S=e.prefix,y=e.minValue,j=e.maxValue,I=e.encrypted,T=e.numberText,N=e.appendCurrency,F=e.elementRef,L=e.onChangeHandler,D=e.value,M=e.step,k=e.decimal,C=e.pattern,E=e.info,W=e.fontSize,R=e.maxWidth,V=e.setValue,q=e.id,_=F||l.useRef();return(0,i.jsxs)("div",{className:"form-input-wrapper flex flex-col items-start gap-0.5 w-full relative",style:(0,o.Z)({},R?{maxWidth:R}:{}),children:[p&&(0,i.jsx)("label",{htmlFor:f,children:p}),(0,i.jsxs)("div",{className:"flex items-center w-full relative",children:[S&&(0,i.jsx)("div",{className:"absolute left-4 bottom-2 text-lg",children:S}),(0,i.jsx)("input",{type:x||"text",name:f,id:q||f,ref:_,placeholder:m||(p||""),autoComplete:g,onInput:function(e){t(e)},onChange:function(e){t(e)},value:D||void 0,defaultValue:D?void 0:v||void 0,pattern:C?C.toString():void 0,required:w||!1,style:(0,o.Z)({},W?{fontSize:W}:{},S?{paddingLeft:"35px"}:{}),min:y,max:j,"data-encrypted":I||null,"data-appendcurrency":N||null,className:"bg-white"+(E?" pr-16":"")}),T&&(0,i.jsxs)("div",{className:"absolute gap-1"+(E?" right-12":" right-4"),style:{top:"50%",transform:"translate(0,-50%)"},children:[(0,i.jsx)("span",{className:"number-text-button w-10 md:w-8 h-10 md:h-8 rounded-full bg-slate-100 dark:bg-slate-800 flex items-center justify-center cursor-pointer hover:bg-slate-200 text-2xl font-semibold touch-none",onMouseDown:function(e){e.preventDefault(),window.innerWidth<1200||(c(),r=setTimeout((function(){a=setInterval((function(){c()}),50)}),200))},onTouchStart:functi
|