dsql-admin/dsql-app/.local_dist/static/chunks/5414-904c4e3b277b1a40.js

1 line
5.8 KiB
JavaScript
Raw Permalink Normal View History

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