import{j as s}from"./tanstack-1.0.74-aU0azVkW.js";import{N as w}from"./react-number-format.es-1.0.74-V5uzMUOI.js";import{e as j}from"./utils-1.0.74-7xWhx9mc.js";import{l as C,d6 as k,C as F,d5 as A}from"./lib-1.0.74-B5IEqfHg.js";import{y as z,aR as R,ac as _,ad as E}from"./index-1.0.74-DxwH6OqZ.js";import{T as P}from"./TextField-1.0.74-BW9Byijb.js";import{I as V}from"./InputAdornment-1.0.74-DzikPcDx.js";import"./redux-1.0.74-D8bIc6ki.js";import"./vendor-1.0.74-CN03Eozo.js";import"./CircularProgress-1.0.74-QfwfRJ7i.js";import"./ButtonBase-1.0.74-W6tAH7AI.js";import"./Typography-1.0.74-B4mhsevh.js";import"./useEnhancedEffect-1.0.74-B56M26dS.js";import"./ThemeProvider-1.0.74-4uzbYYLM.js";import"./Portal-1.0.74-BrUPeMX9.js";import"./iconBase-1.0.74-Cs0vntJu.js";import"./Select-1.0.74-DHOnlEEH.js";import"./Menu-1.0.74-CdjCBJ4R.js";import"./isHostComponent-1.0.74-DVu5iVWx.js";import"./Modal-1.0.74-BfLid1bk.js";import"./createSvgIcon-1.0.74-Cw_ZFbxi.js";const u=({value:f,columnState:i,columnMetaData:d,setValue:x,saveChanges:b,cancel:y,setButtons:g,locale:p,language:o})=>{C.debug(f,i,d);const a=parseInt(d.numeric_scale),N={};(i==null?void 0:i.inlineNumericMin)!==void 0&&(N.min=i.inlineNumericMin),(i==null?void 0:i.inlineNumericMax)!==void 0&&(N.max=i.inlineNumericMax);const n=k((o==null?void 0:o.code)??F.defaultLanguage.code),h=()=>{const e=(parseFloat(f)||0)+Number((i==null?void 0:i.inlineNumericStep)??1);((i==null?void 0:i.inlineNumericMax)===void 0||i.inlineNumericMax>=e)&&x(e)},I=()=>{const e=(parseFloat(f)||0)-Number((i==null?void 0:i.inlineNumericStep)??1);((i==null?void 0:i.inlineNumericMin)===void 0||i.inlineNumericMin<=e)&&x(e)};return s.jsx("div",{onClick:r=>{r.stopPropagation()},onKeyDown:r=>{r.stopPropagation()},children:s.jsx(w,{customInput:P,className:"pp-inline-editing",value:f??"",thousandSeparator:i.localize?n.thousandSeparator:void 0,decimalSeparator:i.localize?n.decimalSeparator:void 0,decimalScale:a,required:d.is_nullable==="NO",slotProps:{htmlInput:N,input:{...(i==null?void 0:i.inlineNumericStepIcon)!=="none"&&{endAdornment:s.jsx(V,{position:"end",style:{marginLeft:0},children:s.jsx("div",{style:{display:"flex",flexDirection:"column",marginRight:"-12px",cursor:"default"},children:(i==null?void 0:i.inlineNumericStepIcon)==="plusmin"?s.jsxs(s.Fragment,{children:[s.jsx(z,{size:14,color:"#555",onClick:h,style:{border:"1px solid #ddd",borderRadius:"3px"}}),s.jsx(R,{size:14,color:"#555",onClick:I,style:{border:"1px solid #ddd",borderRadius:"3px"}})]}):s.jsxs(s.Fragment,{children:[s.jsx(_,{size:16,color:"#999",onClick:h}),s.jsx(E,{size:16,color:"#999",onClick:I})]})})})}}},variant:"outlined",prefix:(i==null?void 0:i.prefix)??"",suffix:(i==null?void 0:i.suffix)??"",placeholder:((i==null?void 0:i.prefix)??"")+(d!=null&&d.numeric_scale&&d.numeric_scale>0?`9${n.thousandSeparator}999${n.decimalSeparator}99`:`9${n.thousandSeparator}999`)+((i==null?void 0:i.suffix)??""),onValueChange:({value:r})=>{r===""&&d.is_nullable!=="NO"?x(null):x(r)},onKeyDown:r=>{if(r.key==="Enter"){let e=!0;r.target.value!==""&&(r.target.min&&parseInt(r.target.value)<parseInt(r.target.min)&&(j((p==null?void 0:p.minAllowed)+" "+r.target.min,{variant:"error"}),e=!1),r.target.max&&parseInt(r.target.value)>parseInt(r.target.max)&&(j((p==null?void 0:p.maxAllowed)+" "+r.target.max,{variant:"error"}),e=!1)),e&&b()}else r.key==="Escape"&&y()},onFocus:()=>{g(!0)},onBlur:()=>{setTimeout(()=>{g(!1)},200)},sx:A(i)})})};export{u as default};
