@buildocsdev/sdk 1.1.22 → 1.1.24

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.
@@ -1 +1 @@
1
- import {q}from'./chunk-3QKKOFXC.js';import'./chunk-AR42AC7J.js';import'./chunk-5TBO732O.js';import {useState,useCallback}from'react';import h from'@mui/material/IconButton';import y from'@mui/material/Typography';import w from'@mui/icons-material/CloudDownloadOutlined';import {useTranslation}from'react-i18next';import {jsxs,jsx}from'react/jsx-runtime';var v=e=>{let r=window.atob(e),t=r.length,n=new Uint8Array(t);for(let o=0;o<t;o++)n[o]=r.charCodeAt(o);return new Blob([n],{type:"application/octet-stream"})},g=e=>{let{t:r}=useTranslation(),[t,n]=useState(false),o=useCallback(async(c,l,s,m)=>{if(!(l==null&&!s))if(l!==null&&!s){let u=v(l),i=document.createElement("a");i.href=URL.createObjectURL(u),i.download=c,document.body.appendChild(i),i.click(),document.body.removeChild(i);}else n(true),await m(),n(false);},[]);return jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"95vh",minWidth:300,textAlign:"center"},children:[jsx(y,{variant:"h5",sx:{mb:2},children:r("A preview is not available for this file type. Click below to download the document.")}),t&&jsx(q,{text:"",size:120,textVariant:"body2",variant:void 0}),!t&&jsx(h,{onPointerUp:()=>o(e.fileName,e.fileInbase64,e.enableChunkDownload,e.downloadByChunkAsync),sx:{fontSize:"3rem",p:2},children:jsx(w,{fontSize:"inherit"})})]})},S=g;export{S as default};
1
+ import {q}from'./chunk-AYYTOQGP.js';import'./chunk-AR42AC7J.js';import'./chunk-5TBO732O.js';import {useState,useCallback}from'react';import h from'@mui/material/IconButton';import y from'@mui/material/Typography';import w from'@mui/icons-material/CloudDownloadOutlined';import {useTranslation}from'react-i18next';import {jsxs,jsx}from'react/jsx-runtime';var v=e=>{let r=window.atob(e),t=r.length,n=new Uint8Array(t);for(let o=0;o<t;o++)n[o]=r.charCodeAt(o);return new Blob([n],{type:"application/octet-stream"})},g=e=>{let{t:r}=useTranslation(),[t,n]=useState(false),o=useCallback(async(c,l,s,m)=>{if(!(l==null&&!s))if(l!==null&&!s){let u=v(l),i=document.createElement("a");i.href=URL.createObjectURL(u),i.download=c,document.body.appendChild(i),i.click(),document.body.removeChild(i);}else n(true),await m(),n(false);},[]);return jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"95vh",minWidth:300,textAlign:"center"},children:[jsx(y,{variant:"h5",sx:{mb:2},children:r("A preview is not available for this file type. Click below to download the document.")}),t&&jsx(q,{text:"",size:120,textVariant:"body2",variant:void 0}),!t&&jsx(h,{onPointerUp:()=>o(e.fileName,e.fileInbase64,e.enableChunkDownload,e.downloadByChunkAsync),sx:{fontSize:"3rem",p:2},children:jsx(w,{fontSize:"inherit"})})]})},S=g;export{S as default};
@@ -1,2 +1,2 @@
1
- import {a}from'./chunk-7RKPIXVG.js';import {b}from'./chunk-LBMVBVXW.js';import {q}from'./chunk-3QKKOFXC.js';import'./chunk-AR42AC7J.js';import'./chunk-5TBO732O.js';import {useState,useRef}from'react';import {pdfjs,Document,Page}from'react-pdf';import'react-pdf/dist/Page/TextLayer.css';import'react-pdf/dist/Page/AnnotationLayer.css';import U from'@mui/icons-material/ZoomIn';import A from'@mui/icons-material/ZoomOut';import O from'@mui/icons-material/RotateLeft';import j from'@mui/icons-material/RotateRight';import T from'@mui/material/Box';import i from'@mui/material/IconButton';import V from'@mui/icons-material/CloudDownloadOutlined';import {useTranslation}from'react-i18next';import {jsxs,jsx}from'react/jsx-runtime';pdfjs.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;var M=c=>{let n=window.atob(c),a=n.length,l=new Uint8Array(a);for(let e=0;e<a;e++)l[e]=n.charCodeAt(e);return new Blob([l],{type:"application/pdf"})},N=({fileName:c,fileInbase64:n})=>{let[a$1,l]=useState(null),[e,f]=useState(1.5),[h,u]=useState(0),p=useRef(null),{events:P}=a(p),{viewPort:x}=b(),{t:g}=useTranslation(),I=()=>{f(e+.3);},L=()=>{e>.3&&f(e-.3);},R=()=>{u(t=>t+90);},S=()=>{u(t=>t-90);},B=({numPages:t})=>{l(t);},k=t=>{if(t==null)return;let s=M(t),r=document.createElement("a");r.href=URL.createObjectURL(s),r.download=c,document.body.appendChild(r),r.click(),document.body.removeChild(r);};return jsxs("div",{style:{display:"flex",height:"95vh",minWidth:300},children:[jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",maxWidth:"4.3em"},children:jsxs("div",{style:{textAlign:"center"},children:[jsx(i,{onPointerUp:I,children:jsx(U,{fontSize:"large"})}),jsx(i,{onPointerUp:L,children:jsx(A,{fontSize:"large"})}),jsx(i,{onPointerUp:R,children:jsx(j,{fontSize:"large"})}),jsx(i,{onPointerUp:S,children:jsx(O,{fontSize:"large"})}),jsx(T,{sx:{mt:5}}),jsx(i,{onPointerUp:()=>k(n),children:jsx(V,{fontSize:"large"})})]})}),jsx("div",{ref:p,...P,style:{overflow:"auto",whiteSpace:"nowrap",display:"flex",justifyContent:x.isMobileDevice?"none":"center",width:"100%",height:"100vh",cursor:"grab"},children:jsx("div",{className:"pdf-viewer-isolate",children:jsx(Document,{file:{data:n?atob(n):void 0},onLoadSuccess:B,loading:jsx(q,{text:g("Loading file..."),size:120,textVariant:"body2",variant:void 0}),children:Array.from(new Array(a$1),(t,s)=>jsx(Page,{pageNumber:s+1,scale:e,rotate:h,renderTextLayer:false,renderAnnotationLayer:false,loading:jsx(q,{text:g("Loading file..."),size:120,textVariant:"body2",variant:void 0})},`page_${s+1}`))})})})]})},no=N;
1
+ import {a}from'./chunk-7RKPIXVG.js';import {b}from'./chunk-LBMVBVXW.js';import {q}from'./chunk-AYYTOQGP.js';import'./chunk-AR42AC7J.js';import'./chunk-5TBO732O.js';import {useState,useRef}from'react';import {pdfjs,Document,Page}from'react-pdf';import'react-pdf/dist/Page/TextLayer.css';import'react-pdf/dist/Page/AnnotationLayer.css';import U from'@mui/icons-material/ZoomIn';import A from'@mui/icons-material/ZoomOut';import O from'@mui/icons-material/RotateLeft';import j from'@mui/icons-material/RotateRight';import T from'@mui/material/Box';import i from'@mui/material/IconButton';import V from'@mui/icons-material/CloudDownloadOutlined';import {useTranslation}from'react-i18next';import {jsxs,jsx}from'react/jsx-runtime';pdfjs.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;var M=c=>{let n=window.atob(c),a=n.length,l=new Uint8Array(a);for(let e=0;e<a;e++)l[e]=n.charCodeAt(e);return new Blob([l],{type:"application/pdf"})},N=({fileName:c,fileInbase64:n})=>{let[a$1,l]=useState(null),[e,f]=useState(1.5),[h,u]=useState(0),p=useRef(null),{events:P}=a(p),{viewPort:x}=b(),{t:g}=useTranslation(),I=()=>{f(e+.3);},L=()=>{e>.3&&f(e-.3);},R=()=>{u(t=>t+90);},S=()=>{u(t=>t-90);},B=({numPages:t})=>{l(t);},k=t=>{if(t==null)return;let s=M(t),r=document.createElement("a");r.href=URL.createObjectURL(s),r.download=c,document.body.appendChild(r),r.click(),document.body.removeChild(r);};return jsxs("div",{style:{display:"flex",height:"95vh",minWidth:300},children:[jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",maxWidth:"4.3em"},children:jsxs("div",{style:{textAlign:"center"},children:[jsx(i,{onPointerUp:I,children:jsx(U,{fontSize:"large"})}),jsx(i,{onPointerUp:L,children:jsx(A,{fontSize:"large"})}),jsx(i,{onPointerUp:R,children:jsx(j,{fontSize:"large"})}),jsx(i,{onPointerUp:S,children:jsx(O,{fontSize:"large"})}),jsx(T,{sx:{mt:5}}),jsx(i,{onPointerUp:()=>k(n),children:jsx(V,{fontSize:"large"})})]})}),jsx("div",{ref:p,...P,style:{overflow:"auto",whiteSpace:"nowrap",display:"flex",justifyContent:x.isMobileDevice?"none":"center",width:"100%",height:"100vh",cursor:"grab"},children:jsx("div",{className:"pdf-viewer-isolate",children:jsx(Document,{file:{data:n?atob(n):void 0},onLoadSuccess:B,loading:jsx(q,{text:g("Loading file..."),size:120,textVariant:"body2",variant:void 0}),children:Array.from(new Array(a$1),(t,s)=>jsx(Page,{pageNumber:s+1,scale:e,rotate:h,renderTextLayer:false,renderAnnotationLayer:false,loading:jsx(q,{text:g("Loading file..."),size:120,textVariant:"body2",variant:void 0})},`page_${s+1}`))})})})]})},no=N;
2
2
  export{no as default};
@@ -1 +1 @@
1
- import {a,b as b$1}from'./chunk-5VSWNFWW.js';import {a as a$1}from'./chunk-POE6K4NQ.js';import {U,T,k}from'./chunk-KW32CT2P.js';import'./chunk-U4T4ACDE.js';import {b}from'./chunk-LBMVBVXW.js';import {q,a as a$2}from'./chunk-3QKKOFXC.js';import {c,d,p,m,N}from'./chunk-AR42AC7J.js';import'./chunk-5TBO732O.js';import {lazy,memo,useRef,useState,useEffect}from'react';import {withTranslation,useTranslation}from'react-i18next';import {useLocation}from'react-router-dom';import {LocalizationProvider,DateTimePicker,DatePicker}from'@mui/x-date-pickers';import Ft from'@mui/material/TextField';import X from'react-dom/client';import Et from'@mui/material/Tooltip';import Zt from'@mui/material/Box';import te from'@mui/material/Button';import Pt from'@mui/material/MenuList';import Nt from'@mui/material/MenuItem';import At from'@mui/material/Paper';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {nanoid}from'@reduxjs/toolkit';import ne from'react-dom/server';import'react-tabulator/lib/styles.css';import'react-tabulator/css/bootstrap/tabulator_bootstrap.min.css';import'react-tabulator/lib/css/bootstrap/tabulator_bootstrap.min.css';var $t=({cellElement:u,cell:t,actionHandler:o})=>{let {t:e}=useTranslation();t.getRow().getPosition();let i=u.getBoundingClientRect(),m=i.bottom+window.scrollY,a=i.left+window.scrollX;return jsx(At,{style:{position:"absolute",top:m+"px",left:a+"px",zIndex:2e3,minWidth:"150px"},children:jsx(Pt,{children:jsxs(Nt,{onClick:()=>o(t),children:[jsx(N,{style:{fontSize:"1em",marginRight:"0.5em"}})," ",e("Delete")]})})})},Ct=$t;var L=class u{static convertToVariables(t){let o={};for(let e in t)if(t.hasOwnProperty(e)&&(typeof t[e]=="string"||typeof t[e]=="number")){let n=Number(t[e]);isNaN(n)||(o[e]=n);}return o}static formulaHasFieldName(t,o){if(t.operands){for(let e of t.operands)if(typeof e=="string"&&e===o||typeof e=="object"&&u.formulaHasFieldName(e,o))return true}return false}static parseExpression(t){t=t.replace(/\s+/g,"");let o=/\(([^()]+)\)/;for(;o.test(t);)t=t.replace(o,(i,m)=>{let a=u.parseExpression(m.trim());return `@${JSON.stringify(a)}`});let n=u.tokenize(t).map(i=>i.startsWith("@")?JSON.parse(i.substring(1)):i);return u.parseTokens(n)}static tokenize(t){let o=[],e="",n=false,i=0;for(let m=0;m<t.length;m++){let a=t[m];if(a==="@"&&t[m+1]==="{"&&(e&&(o.push(e),e=""),n=true,i=0),n){e+=a,a==="{"?i++:a==="}"&&(i--,i===0&&(o.push(e),e="",n=false));continue}if("+-*/()".includes(a)){e&&(o.push(e),e=""),o.push(a);continue}e+=a;}return e&&o.push(e),o}static parseTokens(t){if(t.length===1){let a=t[0];if(typeof a=="string"){let s=parseFloat(a);return isNaN(s)?{operands:[a]}:{value:s}}if(typeof a=="object")return a}let o={"+":1,"-":1,"*":2,"/":2},e=1/0,n=-1;if(t.forEach((a,s)=>{if(typeof a=="string"&&a in o){let d=a;o[d]<=e&&(e=o[d],n=s);}}),n===-1)throw new Error(`Invalid expression: no operator found in tokens ${JSON.stringify(t)}`);let i=t.slice(0,n),m=t.slice(n+1);if(i.length===0||m.length===0)throw new Error(`Invalid expression: operator without operands in tokens ${JSON.stringify(t)}`);return {operator:t[n],operands:[u.parseTokens(i),u.parseTokens(m)]}}static evaluateFormula(t,o){if(t.value!==void 0)return t.value;let{operator:e,operands:n}=t;if(!e||!n||n.length!==2)throw new Error("Invalid parsed formula");let[i,m]=n.map(a=>{if(typeof a=="object"&&a.operands&&a.operands.length===1&&(a=a.operands[0]),typeof a=="string")return o[a]||0;if(typeof a=="number")return a;if(typeof a=="object")return u.evaluateFormula(a,o);throw new Error(`Unsupported operand type: ${JSON.stringify(a)}`)});switch(e){case "+":return i+m;case "-":return i-m;case "*":return i*m;case "/":return i/m;default:throw new Error(`Unsupported operator: ${e}`)}}static convertValuesToStrings(t){return t.map(o=>{let e={};for(let[n,i]of Object.entries(o))e[n]=i===void 0?"":String(i);return e})}static buildDependencyGraph(t){let o={};for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let n=t[e],i=[],m=a=>{a.forEach(s=>{typeof s=="string"?i.push(s):typeof s=="object"&&"operands"in s&&s.operands&&m(s.operands);});};n.operands&&m(n.operands),o[e]=i;}return o}static topologicalSort(t){let o=new Set,e=[],n=i=>{o.has(i)||(o.add(i),(t[i]||[]).forEach(n),e.push(i));};return Object.keys(t).forEach(n),e}};var re=ne.renderToStaticMarkup(jsx(c,{}));if(typeof window!="undefined"&&window.ResizeObserver){let u=window.ResizeObserver;window.ResizeObserver=class extends u{constructor(t){let o;super((e,n)=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>t(e,n));});}};}var oe=lazy(()=>import('react-tabulator').then(u=>({default:u.ReactTabulator}))),ae=u=>{var o;if(!u.properties.folders)return null;var t=(o=u.context.params.folderData)==null?void 0:o.captions;return t==null||t.length===0?null:(t=t.slice(1),jsx("span",{style:{display:"flex",alignItems:"center"},children:t.map((e,n)=>jsxs("span",{style:{display:"inline-flex",alignItems:"center"},children:[e,n<t.length-1&&jsx(d,{style:{margin:"0 8px",fontSize:"0.6rem",color:"#666"}})]},n))}))},ie=(u,t,o,e,n,i,m,a)=>{let s=document.createElement("div"),d=null,f=u.getValue(),D=f?a$1(f):null,w=null,E=false,R=()=>{let r=null;if(E&&w!==null){if(w.trim()===""){e(),d&&d.unmount();return}if(r=a$1(w),!r.isValid()){let h=["DD.MM.YYYY","YYYY-MM-DD","MM/DD/YYYY","DD/MM/YYYY","M/D/YYYY","D/M/YYYY"];for(let F of h)if(r=a$1(w,F),r.isValid())break}(!r||!r.isValid())&&(r=D);}else r=D;r&&r.isValid()?(m.current=a,o(r.format("YYYY-MM-DD"))):f?o(f):e(),d&&d.unmount();},y=r=>{D=r;},b=r=>{D=r,E=false,R();},H=r=>{w=r.target.value,E=true;},x=jsx("div",{onMouseDown:r=>{r.stopPropagation();},children:jsx(LocalizationProvider,{dateAdapter:a$2,adapterLocale:i,children:jsx(DatePicker,{value:a$1(f),onAccept:b,onChange:y,slots:{actionBar:()=>null,textField:r=>jsx(Ft,{...r,onChange:h=>{r.onChange&&r.onChange(h),H(h);},sx:{"& .MuiOutlinedInput-root":{fontSize:"13px",border:"none"},"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":{border:"none"}}})}})})});return t(()=>{d||(d=X.createRoot(s),d.render(x));}),s.addEventListener("blur",r=>{setTimeout(()=>{s.contains(document.activeElement)||R();},200);}),s.addEventListener("keydown",r=>{if(r.key==="Tab"||r.key==="Enter"){r.preventDefault();let h=s.querySelector('input[type="text"]');h&&E&&(w=h.value),R();}}),s},le=(u,t,o,e,n,i,m,a)=>{let s=document.createElement("div"),d=null,f=u.getValue(),D=f?a$1(f):null,w=null,E=false,R=()=>{let r=null;if(E&&w!==null){if(w.trim()===""){e(),d&&d.unmount();return}if(r=a$1(w),!r.isValid()){let h=["DD.MM.YYYY HH:mm:ss","DD.MM.YYYY HH:mm","YYYY-MM-DD HH:mm:ss","YYYY-MM-DD HH:mm","YYYY-MM-DDTHH:mm:ss","MM/DD/YYYY HH:mm:ss","MM/DD/YYYY HH:mm","DD/MM/YYYY HH:mm:ss","DD/MM/YYYY HH:mm"];for(let F of h)if(r=a$1(w,F),r.isValid())break}if(!r||!r.isValid()){let h=["HH:mm:ss","HH:mm"];for(let F of h){let k=a$1(w,F,true);if(k.isValid()){r=(f?a$1(f):a$1()).hour(k.hour()).minute(k.minute()).second(k.second());break}}}(!r||!r.isValid())&&(r=D);}else r=D;r&&r.isValid()?(m.current=a,o(r.format("YYYY-MM-DDTHH:mm:ss"))):f?o(f):e(),d&&d.unmount();},y=r=>{D=r;},b=r=>{D=r,E=false,R();},H=r=>{w=r.target.value,E=true;},x=jsx("div",{onMouseDown:r=>{r.stopPropagation();},children:jsx(LocalizationProvider,{dateAdapter:a$2,adapterLocale:i,children:jsx(DateTimePicker,{value:f?a$1(f):null,onAccept:b,onChange:y,ampm:false,slots:{actionBar:()=>null,textField:r=>jsx(Ft,{...r,onChange:h=>{r.onChange&&r.onChange(h),H(h);},sx:{"& .MuiOutlinedInput-root":{fontSize:"13px",border:"none"},"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":{border:"none"}}})}})})});return t(()=>{d||(d=X.createRoot(s),d.render(x));}),s.addEventListener("blur",r=>{setTimeout(()=>{s.contains(document.activeElement)||R();},200);}),s.addEventListener("keydown",r=>{if(r.key==="Tab"||r.key==="Enter"){r.preventDefault();let h=s.querySelector('input[type="text"]');h&&E&&(w=h.value),R();}}),s},se=(u,t,o,e)=>{var m;if(!u.alloweditrow||u.readonly===true)return;let n=(m=t.item_columntype)!=null?m:"freetext";t.item_columntype||(t.item_isdate===true?n="date":t.item_isdatetime===true?n="datetime":t.item_ischeckbox===true?n="checkbox":t.item_isprice===true?n="price":n="freetext");return n==="datetime"?(a,s,d,f,D)=>le(a,s,d,f,D,o.current,e,u.name):n==="date"?(a,s,d,f,D)=>ie(a,s,d,f,D,o.current,e,u.name):t.item_editor==="number"||n==="price"||n==="number"?"number":t.item_editor==="checkbox"||n==="checkbox"?"tickCross":"input"},ue=(u,t,o,e,n)=>{let i=u.getElement();i.style.backgroundColor="#f0f0f0",i.style.color="#555",i.style.pointerEvents="none";},Yt=(u,t,o,e,n,i)=>{var R;let m=(y,b,H)=>{if(!(H==="price"))return `<div class="tabulator-text">${y||""}</div>`;let x=e.item_format==="fixed-locale",h=x&&e.item_fixedlocale||n.current||void 0,F=b!==void 0&&b[e.item_inputfield]?b[e.item_inputfield]:e.item_currency,k$1=e.item_format==="locale"?k(n.current):void 0,A=x?k(e.item_fixedlocale||""):void 0,W=String(F!=null?F:""),K=W&&W.trim()!==""?W.trim():k$1!=null?k$1:A;try{let P,Q=e.item_currencydisplay||(x?"symbol":"");return K&&Q!==""?P=new Intl.NumberFormat(h,{style:"currency",currency:K,currencyDisplay:Q,minimumFractionDigits:2,maximumFractionDigits:2}).format(y||0):P=new Intl.NumberFormat(h,{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}).format(y||0),`<div class="tabulator-text">${P}</div>`}catch(P){return `<div class="tabulator-text">${(y||0).toFixed(2)}</div>`}};if(!t.alloweditrow)return;let a=(R=e.item_columntype)!=null?R:"freetext";e.item_columntype||(e.item_isdate===true?a="date":e.item_isdatetime===true?a="datetime":e.item_ischeckbox===true?a="checkbox":e.item_isprice===true||e.item_format==="locale"||e.item_format==="fixed-locale"?a="price":a="freetext");let s=e.item_readonly||i==="totals",d=a==="price",f=a==="number",D=a==="date",w=a==="datetime",E=a==="checkbox";return s?y=>{ue(y,t,e,n.current);let b=y.getValue();return i==="totals"&&(!e.item_bottomcalc||b==="")?"":m(b,o,a)}:w?y=>me(y,n.current)||"":D?y=>ce(y,n.current)||"":E?"tickCross":d?y=>{let b=y.getValue();return m(b,o,a)}:f?y=>{let b=y.getValue();if(b==null||b==="")return '<div class="tabulator-text"></div>';let H=parseFloat(b);return isNaN(H)?`<div class="tabulator-text">${b}</div>`:`<div class="tabulator-text">${H.toLocaleString(n.current||void 0,{minimumFractionDigits:0,maximumFractionDigits:10})}</div>`}:y=>`<div class="tabulator-text">${y.getValue()||""}</div>`},ce=(u,t)=>{let o=u.getValue();if(!o)return "";try{let e=a$1(o);return t&&b$1(t)?e.locale(t).format("L"):(t&&!b$1(t)&&a(t).catch(n=>{}),e.format("L"))}catch(e){return a$1(o).format("YYYY-MM-DD")}},me=(u,t)=>{let o=u.getValue();if(!o)return "";try{let e=a$1(o);return t&&b$1(t)?e.locale(t).format("L LT"):(t&&!b$1(t)&&a(t).catch(n=>{}),e.format("L LT"))}catch(e){return a$1(o).format("YYYY-MM-DD HH:mm")}},de=(u,t)=>{if(u.alloweditrow&&t.item_editor==="checkbox")return {allowEmpty:true,crossElement:false,tickElement:re}},kt=withTranslation()(memo(function(t){var mt;let{runFormEvent:o,viewPort:e}=b(),n=useRef(null),i=useRef(null),m$1=useRef(null),[a$1,s]=useState(false),[d,f]=useState([]),[D,w]=useState([]),[E,R]=useState([]),[y,b$1]=useState(0),{t:H,i18n:z}=useTranslation(),x=(mt=z==null?void 0:z.language)==null?void 0:mt.substring(0,2),r=useRef(x!=null?x:""),h=useLocation(),[F,k]=useState(false),A=useRef(t.context.formData||{});useEffect(()=>{x&&a(x).catch(c=>{});},[x]),useEffect(()=>{if(r.current=x!=null?x:"",n.current)try{n.current.redraw(!0);}catch(c){}},[x]),useEffect(()=>{let c=()=>{n.current&&!e.isMobileDevice&&n.current.redraw();};return window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c);}},[]),useEffect(()=>{A.current=t.context.formData||{};let c=t.context.formData?t.context.formData[t.properties.name]:null;f(c?JSON.parse(c):[]);},[t.context.formData]),useEffect(()=>{var c;if(F&&n.current!=null){let M=(c=n.current)==null?void 0:c.getData();A.current&&(A.current[t.properties.name]=JSON.stringify(M)),k(false);}},[F]),useEffect(()=>((async()=>{var c,M;t.context.enableEventHandlers?await o({pluginCode:t.context.params.pluginCode,formCode:t.context.params.formCode,guid:t.context.params.guid,projectGuid:t.context.params.pGuid,pGuid:t.context.params.pGuid,widgetContext:JSON.stringify({referer:h.pathname,parentWidgetId:It,hasParentForm:T.hasParentForm(),originator:(c=t.context.params)==null?void 0:c.originator,parent:t.context.params,folderData:(M=t.context.params)==null?void 0:M.folderData}),widgetEvent:U.onTableEditDataLoad,widgetName:t.properties.name.toLowerCase(),formData:t.context.formData}).then(C=>{if(C.meta.requestStatus==="fulfilled"){let p={...C.payload};if(Object.keys(p).length===0)return;if(!p.data){s(true);return}let v=p.data[t.properties.name];p.widgetData.length===0&&v!==void 0&&v!==null&&v.length>0?f(JSON.parse(v)):p.widgetData.length>0&&f(Object.values(p.widgetData)),s(true);}}):s(true);})(),()=>{if(n.current){try{typeof n.current.destroy=="function"&&n.current.destroy();}catch(c){}n.current=null;}}),[]);let W=c=>{var M,C;if(n.current){let p=c.getRow().getData()._id,Y=((M=n.current)==null?void 0:M.getData()).filter(_=>_._id!==p);(C=n.current)==null||C.setData(Y),k(true);}},K=(c,M)=>{if(P(t.properties))return;let C=document.querySelector(".menu-container");C&&C.remove();let p=document.createElement("div");p.className="menu-container",document.body.appendChild(p);let v=X.createRoot(p);v.render(jsx(Ct,{cellElement:c,cell:M,actionHandler:_=>{v.unmount(),p.remove(),document.removeEventListener("click",Y),W(_);}}));let Y=_=>{p.contains(_.target)||(v.unmount(),p.remove(),document.removeEventListener("click",Y));};document.addEventListener("click",Y);};useEffect(()=>{let c;(()=>{c=t.methodProvider.findWidgetItem(t.id);let C=[];c.item.properties.datasource.columns&&(c.item.properties.datasource.columns||[]).map(l=>{C[l[1]]=l[0];});let p=[];(c.item._children||[]).map(({properties:l})=>{l.item_name.toString()!==""&&l.item_increment&&p.push(l.item_name);}),R(p);let v=[];v.push({title:"",field:"remove",headerHozAlign:"center",hozAlign:"center",vertAlign:"middle",width:"1",formatter:l=>{let O=document.createElement("div");return O.style.cursor="pointer",O.style.color="#C0C0C0",O.style.fontSize="0.9rem",O.style.textAlign="center",X.createRoot(O).render(jsx(m,{})),O.addEventListener("click",B=>{B.stopPropagation();let $=l.getElement();K($,l);}),O}});let Y={},_={},I={},dt=100,ft=false;c.item._children.forEach(({properties:l})=>{dt+=parseInt(l.item_minsize,10)||0,l.item_bottomcalc&&(ft=true);}),b$1(dt),(c.item._children||[]).map(({properties:l})=>{var O,nt;if(l.item_name.toString()!==""){let B=l.item_title.split("!!!"),$=B.length>1&&B[0]||null,rt=B.length>1?B[1]:l.item_title;l.item_formula!=null&&l.item_formula.trim()!==""&&(_[l.item_name]=l.item_formula,I[l.item_name]=L.parseExpression(_[l.item_name]));let gt={cellEdited:S=>{let G=S.getField();k(true);let ot=(V,N)=>{let Z=L.buildDependencyGraph(I),at=L.topologicalSort(Z);at.forEach(tt=>{let yt=I[tt];if(yt){let jt=N.getData(),zt=L.evaluateFormula(yt,L.convertToVariables(jt));V!==tt&&(N.update({[tt]:parseFloat(zt.toFixed(2)).toFixed(2)}));}});};for(let V in I)if(Object.prototype.hasOwnProperty.call(I,V)){let N=I[V];if(N&&typeof N=="object"&&L.formulaHasFieldName(N,G)){let Z=S.getRow();if(Z){let at=S.getRow().getData(),it=L.evaluateFormula(N,L.convertToVariables(at));Z.update({[V]:parseFloat(it.toFixed(2)).toFixed(2)});}}}ot(G,S.getRow());},editor:se(t.properties,l,r,m$1),editable:!t.properties.readonly&&!l.item_readonly,field:l.item_name,formatter:Yt(n,t.properties,t.context.formData,l,r,"body"),formatterParams:de(t.properties,l),title:rt,titleFormatter:l.item_displaytooltip?()=>{let S=document.createElement("div");return X.createRoot(S).render(jsx(Et,{title:rt,arrow:true,children:jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:rt})})),S}:void 0,cssClass:!t.properties.readonly&&!l.item_readonly?"tabulator-ellipsis":"tabulator-readonly",minWidth:parseInt(l.item_minsize,10)||void 0,headerHozAlign:(O=l.style.item_textalign)!=null?O:"center",hozAlign:(nt=l.style.item_ctextalign)!=null?nt:"center",vertAlign:"middle",bottomCalc:S=>l.item_bottomcalc?S.reduce((G,ot)=>{let V=parseFloat(String(ot).replace(",","."));return G+(isNaN(V)?0:V)},0):"",bottomCalcFormatter:ft?Yt(n,t.properties,t.context.formData,l,r,"totals"):void 0,headerSort:l.item_enablesorting};$?(Y[$]||(Y[$]=[]),Y[$].push(gt)):v.push(gt);}}),Object.entries(Y).forEach(([l,O])=>{v.push({title:l,columns:O,cssClass:t.properties.readonly?"tabulator-readonly":"tabulator-ellipsis"});}),w(v),s(true);})();},[t.properties,t.context.params.guid]),useEffect(()=>{n.current&&(n.current.setColumns(D),n.current.redraw());},[D]);let P=c=>!!(c.readonly&&!c.ignorereadonly);function Q(c){let M=C=>C.reduce((p,v)=>{var Y,_;if(v.field&&(p[v.field]="",E.includes(v.field))){let I=(_=(Y=n.current)==null?void 0:Y.getDataCount())!=null?_:0;I!==void 0&&(p[v.field]=String(I+1));}return v.columns&&Array.isArray(v.columns)&&Object.assign(p,M(v.columns)),p},{});return {_id:nanoid(11),...M(c)}}let Ot=()=>jsx(Et,{title:H("Add New"),children:jsx("span",{children:jsx(te,{disabled:P(t.properties),color:"primary",style:{marginRight:"5px"},onClick:()=>{n.current&&n.current.addRow(Q(D));},variant:"outlined",children:jsx(p,{})})})}),{hideaddbutton:_t,folders:Lt,visible:Ht}=t.properties,{tabId:It}=t;if(!Ht)return null;if(!a$1)return jsx(q,{text:"",size:40,textVariant:"body2",variant:void 0});let St={minHeight:t.properties.height,movableRows:false,movableColumns:false,rowHeight:40,layout:"fitColumns"},Vt=()=>{document.querySelectorAll(".tabulator-header-contents > br").forEach(C=>C.remove());document.querySelectorAll(".tabulator-footer");};return jsxs(Fragment,{children:[Lt&&jsx("div",{style:{paddingBottom:"0.8rem",fontSize:"0.85rem",color:"#666",marginLeft:"0.2rem"},children:ae(t)}),jsxs("div",{style:{padding:10,paddingBottom:0,overflowX:"auto"},ref:i,children:[jsx(Zt,{sx:{paddingBottom:1,paddingTop:1,paddingRight:1},children:!_t&&jsx(Ot,{})}),jsx(oe,{onRef:c=>n.current=c==null?void 0:c.current,data:d,columns:D,options:St,events:{tableBuilt:Vt},className:"tabulator",style:{marginBottom:0,minWidth:y+"px"}})]})]})}));kt.displayName="_Tabulator";var Ze=kt;export{Ze as TabulatorTable};
1
+ import {a,b as b$1}from'./chunk-5VSWNFWW.js';import {a as a$1}from'./chunk-POE6K4NQ.js';import {U,T,k}from'./chunk-TYVVEP34.js';import'./chunk-U4T4ACDE.js';import {b}from'./chunk-LBMVBVXW.js';import {q,a as a$2}from'./chunk-AYYTOQGP.js';import {c,d,p,m,N}from'./chunk-AR42AC7J.js';import'./chunk-5TBO732O.js';import {lazy,memo,useRef,useState,useEffect}from'react';import {withTranslation,useTranslation}from'react-i18next';import {useLocation}from'react-router-dom';import {LocalizationProvider,DateTimePicker,DatePicker}from'@mui/x-date-pickers';import Ft from'@mui/material/TextField';import X from'react-dom/client';import Et from'@mui/material/Tooltip';import Zt from'@mui/material/Box';import te from'@mui/material/Button';import Pt from'@mui/material/MenuList';import Nt from'@mui/material/MenuItem';import At from'@mui/material/Paper';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {nanoid}from'@reduxjs/toolkit';import ne from'react-dom/server';import'react-tabulator/lib/styles.css';import'react-tabulator/css/bootstrap/tabulator_bootstrap.min.css';import'react-tabulator/lib/css/bootstrap/tabulator_bootstrap.min.css';var $t=({cellElement:u,cell:t,actionHandler:o})=>{let {t:e}=useTranslation();t.getRow().getPosition();let i=u.getBoundingClientRect(),m=i.bottom+window.scrollY,a=i.left+window.scrollX;return jsx(At,{style:{position:"absolute",top:m+"px",left:a+"px",zIndex:2e3,minWidth:"150px"},children:jsx(Pt,{children:jsxs(Nt,{onClick:()=>o(t),children:[jsx(N,{style:{fontSize:"1em",marginRight:"0.5em"}})," ",e("Delete")]})})})},Ct=$t;var L=class u{static convertToVariables(t){let o={};for(let e in t)if(t.hasOwnProperty(e)&&(typeof t[e]=="string"||typeof t[e]=="number")){let n=Number(t[e]);isNaN(n)||(o[e]=n);}return o}static formulaHasFieldName(t,o){if(t.operands){for(let e of t.operands)if(typeof e=="string"&&e===o||typeof e=="object"&&u.formulaHasFieldName(e,o))return true}return false}static parseExpression(t){t=t.replace(/\s+/g,"");let o=/\(([^()]+)\)/;for(;o.test(t);)t=t.replace(o,(i,m)=>{let a=u.parseExpression(m.trim());return `@${JSON.stringify(a)}`});let n=u.tokenize(t).map(i=>i.startsWith("@")?JSON.parse(i.substring(1)):i);return u.parseTokens(n)}static tokenize(t){let o=[],e="",n=false,i=0;for(let m=0;m<t.length;m++){let a=t[m];if(a==="@"&&t[m+1]==="{"&&(e&&(o.push(e),e=""),n=true,i=0),n){e+=a,a==="{"?i++:a==="}"&&(i--,i===0&&(o.push(e),e="",n=false));continue}if("+-*/()".includes(a)){e&&(o.push(e),e=""),o.push(a);continue}e+=a;}return e&&o.push(e),o}static parseTokens(t){if(t.length===1){let a=t[0];if(typeof a=="string"){let s=parseFloat(a);return isNaN(s)?{operands:[a]}:{value:s}}if(typeof a=="object")return a}let o={"+":1,"-":1,"*":2,"/":2},e=1/0,n=-1;if(t.forEach((a,s)=>{if(typeof a=="string"&&a in o){let d=a;o[d]<=e&&(e=o[d],n=s);}}),n===-1)throw new Error(`Invalid expression: no operator found in tokens ${JSON.stringify(t)}`);let i=t.slice(0,n),m=t.slice(n+1);if(i.length===0||m.length===0)throw new Error(`Invalid expression: operator without operands in tokens ${JSON.stringify(t)}`);return {operator:t[n],operands:[u.parseTokens(i),u.parseTokens(m)]}}static evaluateFormula(t,o){if(t.value!==void 0)return t.value;let{operator:e,operands:n}=t;if(!e||!n||n.length!==2)throw new Error("Invalid parsed formula");let[i,m]=n.map(a=>{if(typeof a=="object"&&a.operands&&a.operands.length===1&&(a=a.operands[0]),typeof a=="string")return o[a]||0;if(typeof a=="number")return a;if(typeof a=="object")return u.evaluateFormula(a,o);throw new Error(`Unsupported operand type: ${JSON.stringify(a)}`)});switch(e){case "+":return i+m;case "-":return i-m;case "*":return i*m;case "/":return i/m;default:throw new Error(`Unsupported operator: ${e}`)}}static convertValuesToStrings(t){return t.map(o=>{let e={};for(let[n,i]of Object.entries(o))e[n]=i===void 0?"":String(i);return e})}static buildDependencyGraph(t){let o={};for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let n=t[e],i=[],m=a=>{a.forEach(s=>{typeof s=="string"?i.push(s):typeof s=="object"&&"operands"in s&&s.operands&&m(s.operands);});};n.operands&&m(n.operands),o[e]=i;}return o}static topologicalSort(t){let o=new Set,e=[],n=i=>{o.has(i)||(o.add(i),(t[i]||[]).forEach(n),e.push(i));};return Object.keys(t).forEach(n),e}};var re=ne.renderToStaticMarkup(jsx(c,{}));if(typeof window!="undefined"&&window.ResizeObserver){let u=window.ResizeObserver;window.ResizeObserver=class extends u{constructor(t){let o;super((e,n)=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>t(e,n));});}};}var oe=lazy(()=>import('react-tabulator').then(u=>({default:u.ReactTabulator}))),ae=u=>{var o;if(!u.properties.folders)return null;var t=(o=u.context.params.folderData)==null?void 0:o.captions;return t==null||t.length===0?null:(t=t.slice(1),jsx("span",{style:{display:"flex",alignItems:"center"},children:t.map((e,n)=>jsxs("span",{style:{display:"inline-flex",alignItems:"center"},children:[e,n<t.length-1&&jsx(d,{style:{margin:"0 8px",fontSize:"0.6rem",color:"#666"}})]},n))}))},ie=(u,t,o,e,n,i,m,a)=>{let s=document.createElement("div"),d=null,f=u.getValue(),D=f?a$1(f):null,w=null,E=false,R=()=>{let r=null;if(E&&w!==null){if(w.trim()===""){e(),d&&d.unmount();return}if(r=a$1(w),!r.isValid()){let h=["DD.MM.YYYY","YYYY-MM-DD","MM/DD/YYYY","DD/MM/YYYY","M/D/YYYY","D/M/YYYY"];for(let F of h)if(r=a$1(w,F),r.isValid())break}(!r||!r.isValid())&&(r=D);}else r=D;r&&r.isValid()?(m.current=a,o(r.format("YYYY-MM-DD"))):f?o(f):e(),d&&d.unmount();},y=r=>{D=r;},b=r=>{D=r,E=false,R();},H=r=>{w=r.target.value,E=true;},x=jsx("div",{onMouseDown:r=>{r.stopPropagation();},children:jsx(LocalizationProvider,{dateAdapter:a$2,adapterLocale:i,children:jsx(DatePicker,{value:a$1(f),onAccept:b,onChange:y,slots:{actionBar:()=>null,textField:r=>jsx(Ft,{...r,onChange:h=>{r.onChange&&r.onChange(h),H(h);},sx:{"& .MuiOutlinedInput-root":{fontSize:"13px",border:"none"},"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":{border:"none"}}})}})})});return t(()=>{d||(d=X.createRoot(s),d.render(x));}),s.addEventListener("blur",r=>{setTimeout(()=>{s.contains(document.activeElement)||R();},200);}),s.addEventListener("keydown",r=>{if(r.key==="Tab"||r.key==="Enter"){r.preventDefault();let h=s.querySelector('input[type="text"]');h&&E&&(w=h.value),R();}}),s},le=(u,t,o,e,n,i,m,a)=>{let s=document.createElement("div"),d=null,f=u.getValue(),D=f?a$1(f):null,w=null,E=false,R=()=>{let r=null;if(E&&w!==null){if(w.trim()===""){e(),d&&d.unmount();return}if(r=a$1(w),!r.isValid()){let h=["DD.MM.YYYY HH:mm:ss","DD.MM.YYYY HH:mm","YYYY-MM-DD HH:mm:ss","YYYY-MM-DD HH:mm","YYYY-MM-DDTHH:mm:ss","MM/DD/YYYY HH:mm:ss","MM/DD/YYYY HH:mm","DD/MM/YYYY HH:mm:ss","DD/MM/YYYY HH:mm"];for(let F of h)if(r=a$1(w,F),r.isValid())break}if(!r||!r.isValid()){let h=["HH:mm:ss","HH:mm"];for(let F of h){let k=a$1(w,F,true);if(k.isValid()){r=(f?a$1(f):a$1()).hour(k.hour()).minute(k.minute()).second(k.second());break}}}(!r||!r.isValid())&&(r=D);}else r=D;r&&r.isValid()?(m.current=a,o(r.format("YYYY-MM-DDTHH:mm:ss"))):f?o(f):e(),d&&d.unmount();},y=r=>{D=r;},b=r=>{D=r,E=false,R();},H=r=>{w=r.target.value,E=true;},x=jsx("div",{onMouseDown:r=>{r.stopPropagation();},children:jsx(LocalizationProvider,{dateAdapter:a$2,adapterLocale:i,children:jsx(DateTimePicker,{value:f?a$1(f):null,onAccept:b,onChange:y,ampm:false,slots:{actionBar:()=>null,textField:r=>jsx(Ft,{...r,onChange:h=>{r.onChange&&r.onChange(h),H(h);},sx:{"& .MuiOutlinedInput-root":{fontSize:"13px",border:"none"},"& .MuiOutlinedInput-notchedOutline":{border:"none"},"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":{border:"none"}}})}})})});return t(()=>{d||(d=X.createRoot(s),d.render(x));}),s.addEventListener("blur",r=>{setTimeout(()=>{s.contains(document.activeElement)||R();},200);}),s.addEventListener("keydown",r=>{if(r.key==="Tab"||r.key==="Enter"){r.preventDefault();let h=s.querySelector('input[type="text"]');h&&E&&(w=h.value),R();}}),s},se=(u,t,o,e)=>{var m;if(!u.alloweditrow||u.readonly===true)return;let n=(m=t.item_columntype)!=null?m:"freetext";t.item_columntype||(t.item_isdate===true?n="date":t.item_isdatetime===true?n="datetime":t.item_ischeckbox===true?n="checkbox":t.item_isprice===true?n="price":n="freetext");return n==="datetime"?(a,s,d,f,D)=>le(a,s,d,f,D,o.current,e,u.name):n==="date"?(a,s,d,f,D)=>ie(a,s,d,f,D,o.current,e,u.name):t.item_editor==="number"||n==="price"||n==="number"?"number":t.item_editor==="checkbox"||n==="checkbox"?"tickCross":"input"},ue=(u,t,o,e,n)=>{let i=u.getElement();i.style.backgroundColor="#f0f0f0",i.style.color="#555",i.style.pointerEvents="none";},Yt=(u,t,o,e,n,i)=>{var R;let m=(y,b,H)=>{if(!(H==="price"))return `<div class="tabulator-text">${y||""}</div>`;let x=e.item_format==="fixed-locale",h=x&&e.item_fixedlocale||n.current||void 0,F=b!==void 0&&b[e.item_inputfield]?b[e.item_inputfield]:e.item_currency,k$1=e.item_format==="locale"?k(n.current):void 0,A=x?k(e.item_fixedlocale||""):void 0,W=String(F!=null?F:""),K=W&&W.trim()!==""?W.trim():k$1!=null?k$1:A;try{let P,Q=e.item_currencydisplay||(x?"symbol":"");return K&&Q!==""?P=new Intl.NumberFormat(h,{style:"currency",currency:K,currencyDisplay:Q,minimumFractionDigits:2,maximumFractionDigits:2}).format(y||0):P=new Intl.NumberFormat(h,{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}).format(y||0),`<div class="tabulator-text">${P}</div>`}catch(P){return `<div class="tabulator-text">${(y||0).toFixed(2)}</div>`}};if(!t.alloweditrow)return;let a=(R=e.item_columntype)!=null?R:"freetext";e.item_columntype||(e.item_isdate===true?a="date":e.item_isdatetime===true?a="datetime":e.item_ischeckbox===true?a="checkbox":e.item_isprice===true||e.item_format==="locale"||e.item_format==="fixed-locale"?a="price":a="freetext");let s=e.item_readonly||i==="totals",d=a==="price",f=a==="number",D=a==="date",w=a==="datetime",E=a==="checkbox";return s?y=>{ue(y,t,e,n.current);let b=y.getValue();return i==="totals"&&(!e.item_bottomcalc||b==="")?"":m(b,o,a)}:w?y=>me(y,n.current)||"":D?y=>ce(y,n.current)||"":E?"tickCross":d?y=>{let b=y.getValue();return m(b,o,a)}:f?y=>{let b=y.getValue();if(b==null||b==="")return '<div class="tabulator-text"></div>';let H=parseFloat(b);return isNaN(H)?`<div class="tabulator-text">${b}</div>`:`<div class="tabulator-text">${H.toLocaleString(n.current||void 0,{minimumFractionDigits:0,maximumFractionDigits:10})}</div>`}:y=>`<div class="tabulator-text">${y.getValue()||""}</div>`},ce=(u,t)=>{let o=u.getValue();if(!o)return "";try{let e=a$1(o);return t&&b$1(t)?e.locale(t).format("L"):(t&&!b$1(t)&&a(t).catch(n=>{}),e.format("L"))}catch(e){return a$1(o).format("YYYY-MM-DD")}},me=(u,t)=>{let o=u.getValue();if(!o)return "";try{let e=a$1(o);return t&&b$1(t)?e.locale(t).format("L LT"):(t&&!b$1(t)&&a(t).catch(n=>{}),e.format("L LT"))}catch(e){return a$1(o).format("YYYY-MM-DD HH:mm")}},de=(u,t)=>{if(u.alloweditrow&&t.item_editor==="checkbox")return {allowEmpty:true,crossElement:false,tickElement:re}},kt=withTranslation()(memo(function(t){var mt;let{runFormEvent:o,viewPort:e}=b(),n=useRef(null),i=useRef(null),m$1=useRef(null),[a$1,s]=useState(false),[d,f]=useState([]),[D,w]=useState([]),[E,R]=useState([]),[y,b$1]=useState(0),{t:H,i18n:z}=useTranslation(),x=(mt=z==null?void 0:z.language)==null?void 0:mt.substring(0,2),r=useRef(x!=null?x:""),h=useLocation(),[F,k]=useState(false),A=useRef(t.context.formData||{});useEffect(()=>{x&&a(x).catch(c=>{});},[x]),useEffect(()=>{if(r.current=x!=null?x:"",n.current)try{n.current.redraw(!0);}catch(c){}},[x]),useEffect(()=>{let c=()=>{n.current&&!e.isMobileDevice&&n.current.redraw();};return window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c);}},[]),useEffect(()=>{A.current=t.context.formData||{};let c=t.context.formData?t.context.formData[t.properties.name]:null;f(c?JSON.parse(c):[]);},[t.context.formData]),useEffect(()=>{var c;if(F&&n.current!=null){let M=(c=n.current)==null?void 0:c.getData();A.current&&(A.current[t.properties.name]=JSON.stringify(M)),k(false);}},[F]),useEffect(()=>((async()=>{var c,M;t.context.enableEventHandlers?await o({pluginCode:t.context.params.pluginCode,formCode:t.context.params.formCode,guid:t.context.params.guid,projectGuid:t.context.params.pGuid,pGuid:t.context.params.pGuid,widgetContext:JSON.stringify({referer:h.pathname,parentWidgetId:It,hasParentForm:T.hasParentForm(),originator:(c=t.context.params)==null?void 0:c.originator,parent:t.context.params,folderData:(M=t.context.params)==null?void 0:M.folderData}),widgetEvent:U.onTableEditDataLoad,widgetName:t.properties.name.toLowerCase(),formData:t.context.formData}).then(C=>{if(C.meta.requestStatus==="fulfilled"){let p={...C.payload};if(Object.keys(p).length===0)return;if(!p.data){s(true);return}let v=p.data[t.properties.name];p.widgetData.length===0&&v!==void 0&&v!==null&&v.length>0?f(JSON.parse(v)):p.widgetData.length>0&&f(Object.values(p.widgetData)),s(true);}}):s(true);})(),()=>{if(n.current){try{typeof n.current.destroy=="function"&&n.current.destroy();}catch(c){}n.current=null;}}),[]);let W=c=>{var M,C;if(n.current){let p=c.getRow().getData()._id,Y=((M=n.current)==null?void 0:M.getData()).filter(_=>_._id!==p);(C=n.current)==null||C.setData(Y),k(true);}},K=(c,M)=>{if(P(t.properties))return;let C=document.querySelector(".menu-container");C&&C.remove();let p=document.createElement("div");p.className="menu-container",document.body.appendChild(p);let v=X.createRoot(p);v.render(jsx(Ct,{cellElement:c,cell:M,actionHandler:_=>{v.unmount(),p.remove(),document.removeEventListener("click",Y),W(_);}}));let Y=_=>{p.contains(_.target)||(v.unmount(),p.remove(),document.removeEventListener("click",Y));};document.addEventListener("click",Y);};useEffect(()=>{let c;(()=>{c=t.methodProvider.findWidgetItem(t.id);let C=[];c.item.properties.datasource.columns&&(c.item.properties.datasource.columns||[]).map(l=>{C[l[1]]=l[0];});let p=[];(c.item._children||[]).map(({properties:l})=>{l.item_name.toString()!==""&&l.item_increment&&p.push(l.item_name);}),R(p);let v=[];v.push({title:"",field:"remove",headerHozAlign:"center",hozAlign:"center",vertAlign:"middle",width:"1",formatter:l=>{let O=document.createElement("div");return O.style.cursor="pointer",O.style.color="#C0C0C0",O.style.fontSize="0.9rem",O.style.textAlign="center",X.createRoot(O).render(jsx(m,{})),O.addEventListener("click",B=>{B.stopPropagation();let $=l.getElement();K($,l);}),O}});let Y={},_={},I={},dt=100,ft=false;c.item._children.forEach(({properties:l})=>{dt+=parseInt(l.item_minsize,10)||0,l.item_bottomcalc&&(ft=true);}),b$1(dt),(c.item._children||[]).map(({properties:l})=>{var O,nt;if(l.item_name.toString()!==""){let B=l.item_title.split("!!!"),$=B.length>1&&B[0]||null,rt=B.length>1?B[1]:l.item_title;l.item_formula!=null&&l.item_formula.trim()!==""&&(_[l.item_name]=l.item_formula,I[l.item_name]=L.parseExpression(_[l.item_name]));let gt={cellEdited:S=>{let G=S.getField();k(true);let ot=(V,N)=>{let Z=L.buildDependencyGraph(I),at=L.topologicalSort(Z);at.forEach(tt=>{let yt=I[tt];if(yt){let jt=N.getData(),zt=L.evaluateFormula(yt,L.convertToVariables(jt));V!==tt&&(N.update({[tt]:parseFloat(zt.toFixed(2)).toFixed(2)}));}});};for(let V in I)if(Object.prototype.hasOwnProperty.call(I,V)){let N=I[V];if(N&&typeof N=="object"&&L.formulaHasFieldName(N,G)){let Z=S.getRow();if(Z){let at=S.getRow().getData(),it=L.evaluateFormula(N,L.convertToVariables(at));Z.update({[V]:parseFloat(it.toFixed(2)).toFixed(2)});}}}ot(G,S.getRow());},editor:se(t.properties,l,r,m$1),editable:!t.properties.readonly&&!l.item_readonly,field:l.item_name,formatter:Yt(n,t.properties,t.context.formData,l,r,"body"),formatterParams:de(t.properties,l),title:rt,titleFormatter:l.item_displaytooltip?()=>{let S=document.createElement("div");return X.createRoot(S).render(jsx(Et,{title:rt,arrow:true,children:jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:rt})})),S}:void 0,cssClass:!t.properties.readonly&&!l.item_readonly?"tabulator-ellipsis":"tabulator-readonly",minWidth:parseInt(l.item_minsize,10)||void 0,headerHozAlign:(O=l.style.item_textalign)!=null?O:"center",hozAlign:(nt=l.style.item_ctextalign)!=null?nt:"center",vertAlign:"middle",bottomCalc:S=>l.item_bottomcalc?S.reduce((G,ot)=>{let V=parseFloat(String(ot).replace(",","."));return G+(isNaN(V)?0:V)},0):"",bottomCalcFormatter:ft?Yt(n,t.properties,t.context.formData,l,r,"totals"):void 0,headerSort:l.item_enablesorting};$?(Y[$]||(Y[$]=[]),Y[$].push(gt)):v.push(gt);}}),Object.entries(Y).forEach(([l,O])=>{v.push({title:l,columns:O,cssClass:t.properties.readonly?"tabulator-readonly":"tabulator-ellipsis"});}),w(v),s(true);})();},[t.properties,t.context.params.guid]),useEffect(()=>{n.current&&(n.current.setColumns(D),n.current.redraw());},[D]);let P=c=>!!(c.readonly&&!c.ignorereadonly);function Q(c){let M=C=>C.reduce((p,v)=>{var Y,_;if(v.field&&(p[v.field]="",E.includes(v.field))){let I=(_=(Y=n.current)==null?void 0:Y.getDataCount())!=null?_:0;I!==void 0&&(p[v.field]=String(I+1));}return v.columns&&Array.isArray(v.columns)&&Object.assign(p,M(v.columns)),p},{});return {_id:nanoid(11),...M(c)}}let Ot=()=>jsx(Et,{title:H("Add New"),children:jsx("span",{children:jsx(te,{disabled:P(t.properties),color:"primary",style:{marginRight:"5px"},onClick:()=>{n.current&&n.current.addRow(Q(D));},variant:"outlined",children:jsx(p,{})})})}),{hideaddbutton:_t,folders:Lt,visible:Ht}=t.properties,{tabId:It}=t;if(!Ht)return null;if(!a$1)return jsx(q,{text:"",size:40,textVariant:"body2",variant:void 0});let St={minHeight:t.properties.height,movableRows:false,movableColumns:false,rowHeight:40,layout:"fitColumns"},Vt=()=>{document.querySelectorAll(".tabulator-header-contents > br").forEach(C=>C.remove());document.querySelectorAll(".tabulator-footer");};return jsxs(Fragment,{children:[Lt&&jsx("div",{style:{paddingBottom:"0.8rem",fontSize:"0.85rem",color:"#666",marginLeft:"0.2rem"},children:ae(t)}),jsxs("div",{style:{padding:10,paddingBottom:0,overflowX:"auto"},ref:i,children:[jsx(Zt,{sx:{paddingBottom:1,paddingTop:1,paddingRight:1},children:!_t&&jsx(Ot,{})}),jsx(oe,{onRef:c=>n.current=c==null?void 0:c.current,data:d,columns:D,options:St,events:{tableBuilt:Vt},className:"tabulator",style:{marginBottom:0,minWidth:y+"px"}})]})]})}));kt.displayName="_Tabulator";var Ze=kt;export{Ze as TabulatorTable};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildocsdev/sdk",
3
- "version": "1.1.22",
3
+ "version": "1.1.24",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/"
6
6
  },
@@ -123,11 +123,10 @@
123
123
  "node": ">=18.0.0",
124
124
  "npm": ">=9.0.0"
125
125
  },
126
- "dependencies": {},
127
126
  "peerDependencies": {
128
- "@lagarsoft/forge-viewer-react": "^0.3.5",
129
127
  "@emotion/react": "^11",
130
128
  "@emotion/styled": "^11",
129
+ "@lagarsoft/forge-viewer-react": "^0.3.5",
131
130
  "@mui/icons-material": "^5",
132
131
  "@mui/material": "^5",
133
132
  "@mui/system": "^5",
@@ -146,9 +145,9 @@
146
145
  "react-dnd-touch-backend": "^16.0.1",
147
146
  "react-dom": ">=18 <19",
148
147
  "react-hook-form": "^7.66.1",
149
- "react-player": "^2.16.0",
150
148
  "react-icons": "^5.5.0",
151
149
  "react-pdf": "^10.3.0",
150
+ "react-player": "^2.16.0",
152
151
  "react-redux": "^8.0.2",
153
152
  "react-router-dom": "^6.4.1",
154
153
  "react-tabulator": "^0.21.0",
@@ -178,23 +177,12 @@
178
177
  }
179
178
  },
180
179
  "devDependencies": {
181
- "@lagarsoft/forge-viewer-react": "^0.3.5",
182
- "buildocslib": "^0.2.179",
183
- "immutability-helper": "^3.1.1",
184
- "prop-types": "^15.8.1",
185
- "react-hook-form": "^7.66.1",
186
- "react-indiana-drag-scroll": "^2.2.0",
187
- "react-player": "^2.16.0",
188
- "react-select": "^5.7.0",
189
- "react-tabs": "^6.0.0",
190
- "react-use-draggable-scroll": "^0.4.7",
191
- "stylis-plugin-rtl": "^2.1.1",
192
- "typescript": "^4.9.5",
193
180
  "@craco/craco": "^7.1.0",
194
181
  "@emotion/react": "^11.13.3",
195
182
  "@emotion/styled": "^11.13.0",
196
183
  "@fullhuman/postcss-purgecss": "^7.0.2",
197
184
  "@headlessui/react": "^1.7.3",
185
+ "@lagarsoft/forge-viewer-react": "^0.3.5",
198
186
  "@mui/icons-material": "^5.16.7",
199
187
  "@mui/lab": "^5.0.0-alpha.173",
200
188
  "@mui/material": "^5.16.7",
@@ -229,6 +217,7 @@
229
217
  "bim-fragment": "^1.2.6",
230
218
  "bootstrap": "^5.3.8",
231
219
  "buffer": "^6.0.3",
220
+ "buildocslib": "^0.2.180",
232
221
  "cpy-cli": "^6.0.0",
233
222
  "cross-env": "^10.1.0",
234
223
  "css-pro-layout": "^1.1.0",
@@ -237,6 +226,7 @@
237
226
  "esbuild-sass-plugin": "^3.3.1",
238
227
  "i18next": "^25.8.4",
239
228
  "i18next-http-backend": "^2.1.0",
229
+ "immutability-helper": "^3.1.1",
240
230
  "jest": "^29.7.0",
241
231
  "jest-environment-jsdom": "^29.7.0",
242
232
  "js-cookie": "^3.0.5",
@@ -244,6 +234,7 @@
244
234
  "postcss-cli": "^11.0.1",
245
235
  "postcss-import": "^15.1.0",
246
236
  "postcss-nesting": "^12.0.2",
237
+ "prop-types": "^15.8.1",
247
238
  "react": "^18.3.1",
248
239
  "react-app-rewired": "^2.2.1",
249
240
  "react-color": "^2.19.3",
@@ -252,29 +243,37 @@
252
243
  "react-dnd-scrolling": "^1.3.3",
253
244
  "react-dnd-touch-backend": "^16.0.1",
254
245
  "react-dom": "^18.3.1",
246
+ "react-hook-form": "^7.66.1",
255
247
  "react-i18next": "^16.5.4",
256
248
  "react-icons": "^5.5.0",
249
+ "react-indiana-drag-scroll": "^2.2.0",
257
250
  "react-input-mask": "^2.0.4",
258
251
  "react-number-format": "^5.3.4",
259
252
  "react-pdf": "^10.3.0",
253
+ "react-player": "^2.16.0",
260
254
  "react-pro-sidebar": "^1.1.0",
261
255
  "react-redux": "^8.0.2",
262
256
  "react-responsive": "^9.0.0-beta.10",
263
257
  "react-router-dom": "^6.4.1",
264
258
  "react-scripts": "^5.0.1",
259
+ "react-select": "^5.7.0",
260
+ "react-tabs": "^6.0.0",
265
261
  "react-tabulator": "^0.21.0",
266
262
  "react-toastify": "^9.0.6",
263
+ "react-use-draggable-scroll": "^0.4.7",
267
264
  "sass": "^1.90.0",
268
265
  "sass-loader": "^12.3.0",
269
266
  "serve": "^14.2.5",
270
267
  "source-map-explorer": "^2.5.3",
271
268
  "storybook-addon-designs": "^6.3.1",
269
+ "stylis-plugin-rtl": "^2.1.1",
272
270
  "terser-webpack-plugin": "^5.3.10",
273
271
  "ts-jest": "^29.2.5",
274
272
  "ts-loader": "^9.4.2",
275
273
  "tsdx": "^0.14.1",
276
274
  "tslib": "^2.4.1",
277
275
  "tsup": "^8.5.0",
276
+ "typescript": "^4.9.5",
278
277
  "use-debounce": "^9.0.3",
279
278
  "usehooks-ts": "^2.9.1",
280
279
  "web-vitals": "^2.1.4",
@@ -1,2 +0,0 @@
1
- import {a as a$1}from'./chunk-POE6K4NQ.js';import {g,i as i$1,l as l$1,k as k$1,d}from'./chunk-PEJGRTDP.js';import {b as b$1,f,e as e$1,g as g$2}from'./chunk-FRAOYRZD.js';import {b as b$2,a as a$3}from'./chunk-22LEYH6Q.js';import {y,z,B,T,U,x,A,k as k$2}from'./chunk-KW32CT2P.js';import {b}from'./chunk-LBMVBVXW.js';import {n,e,k,l,p,o,f as f$1,g as g$1,h,m as m$1}from'./chunk-3QKKOFXC.js';import {i,m,P,t,A as A$1,E,N,s}from'./chunk-AR42AC7J.js';import {a as a$2}from'./chunk-SDIZEEZP.js';import {a,c}from'./chunk-5TBO732O.js';import*as Te from'react';import Te__default,{memo,useRef,useState,useEffect,createElement,createContext,lazy,useCallback,startTransition,Suspense,useContext,useMemo}from'react';import {withTranslation,useTranslation}from'react-i18next';import {useLocation,useNavigate}from'react-router-dom';import {nanoid}from'@reduxjs/toolkit';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import ja from'@mui/material/Box';import Qr from'@mui/material/Button';import Kr from'@mui/material/Tooltip';import _i from'axios';import Gi from'@mui/material/CircularProgress';import zi from'@mui/material/LinearProgress';import lr from'@mui/material/IconButton';import kl from'@mui/material/InputAdornment';import Ml from'@mui/icons-material/Visibility';import Bl from'@mui/icons-material/VisibilityOff';import {animated,useSpring}from'@react-spring/web';import {styled,alpha}from'@mui/material/styles';import Al from'@mui/material/Collapse';import Vl from'@mui/material/Typography';import Ol from'@mui/icons-material/FolderRounded';import {RichTreeView}from'@mui/x-tree-view/RichTreeView';import {treeItemClasses}from'@mui/x-tree-view/TreeItem';import {unstable_useTreeItem2}from'@mui/x-tree-view/useTreeItem2';import {TreeItem2Root,TreeItem2Content,TreeItem2IconContainer,TreeItem2Checkbox,TreeItem2Label}from'@mui/x-tree-view/TreeItem2';import {TreeItem2Icon}from'@mui/x-tree-view/TreeItem2Icon';import {TreeItem2DragAndDropOverlay}from'@mui/x-tree-view/TreeItem2DragAndDropOverlay';import yt from'@mui/material/ListItemIcon';import wt from'@mui/material/ListItemText';import jl from'@mui/material/Menu';import xt from'@mui/material/MenuItem';import yd from'i18next';import fd from'@mui/material/Backdrop';var An=a((Ue,_n)=>{Object.defineProperty(Ue,"__esModule",{value:true});function _e(t){return typeof t=="object"&&!("toString"in t)?Object.prototype.toString.call(t).slice(8,-1):t}var wr=typeof process=="object"&&true;function Me(t,e){if(!t)throw wr?new Error("Invariant failed"):new Error(e())}Ue.invariant=Me;var Bt=Object.prototype.hasOwnProperty,xr=Array.prototype.splice,Cr=Object.prototype.toString;function Ye(t){return Cr.call(t).slice(8,-1)}var bt=Object.assign||(function(t,e){return Nt(e).forEach(function(n){Bt.call(e,n)&&(t[n]=e[n]);}),t}),Nt=typeof Object.getOwnPropertySymbols=="function"?function(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.keys(t)};function je(t){return Array.isArray(t)?bt(t.constructor(t.length),t):Ye(t)==="Map"?new Map(t):Ye(t)==="Set"?new Set(t):t&&typeof t=="object"?bt(Object.create(Object.getPrototypeOf(t)),t):t}var Nn=(function(){function t(){this.commands=bt({},Ir),this.update=this.update.bind(this),this.update.extend=this.extend=this.extend.bind(this),this.update.isEquals=function(e,n){return e===n},this.update.newContext=function(){return new t().update};}return Object.defineProperty(t.prototype,"isEquals",{get:function(){return this.update.isEquals},set:function(e){this.update.isEquals=e;},enumerable:true,configurable:true}),t.prototype.extend=function(e,n){this.commands[e]=n;},t.prototype.update=function(e,n){var r=this,a=typeof n=="function"?{$apply:n}:n;Array.isArray(e)&&Array.isArray(a)||Me(!Array.isArray(a),function(){return "update(): You provided an invalid spec to update(). The spec may not contain an array except as the value of $set, $push, $unshift, $splice or any custom command allowing an array value."}),Me(typeof a=="object"&&a!==null,function(){return "update(): You provided an invalid spec to update(). The spec and every included key path must be plain objects containing one of the "+("following commands: "+Object.keys(r.commands).join(", ")+".")});var d=e;return Nt(a).forEach(function(l){if(Bt.call(r.commands,l)){var c=e===d;d=r.commands[l](a[l],d,a,e),c&&r.isEquals(d,e)&&(d=e);}else {var s=Ye(e)==="Map"?r.update(e.get(l),a[l]):r.update(e[l],a[l]),m=Ye(d)==="Map"?d.get(l):d[l];(!r.isEquals(s,m)||typeof s=="undefined"&&!Bt.call(e,l))&&(d===e&&(d=je(e)),Ye(d)==="Map"?d.set(l,s):d[l]=s);}}),d},t})();Ue.Context=Nn;var Ir={$push:function(t,e,n){return Mn(e,n,"$push"),t.length?e.concat(t):e},$unshift:function(t,e,n){return Mn(e,n,"$unshift"),t.length?t.concat(e):e},$splice:function(t,e,n,r){return Fr(e,n),t.forEach(function(a){Ln(a),e===r&&a.length&&(e=je(r)),xr.apply(e,a);}),e},$set:function(t,e,n){return Dr(n),t},$toggle:function(t,e){lt(t,"$toggle");var n=t.length?je(e):e;return t.forEach(function(r){n[r]=!e[r];}),n},$unset:function(t,e,n,r){return lt(t,"$unset"),t.forEach(function(a){Object.hasOwnProperty.call(e,a)&&(e===r&&(e=je(r)),delete e[a]);}),e},$add:function(t,e,n,r){return Bn(e,"$add"),lt(t,"$add"),Ye(e)==="Map"?t.forEach(function(a){var d=a[0],l=a[1];e===r&&e.get(d)!==l&&(e=je(r)),e.set(d,l);}):t.forEach(function(a){e===r&&!e.has(a)&&(e=je(r)),e.add(a);}),e},$remove:function(t,e,n,r){return Bn(e,"$remove"),lt(t,"$remove"),t.forEach(function(a){e===r&&e.has(a)&&(e=je(r)),e.delete(a);}),e},$merge:function(t,e,n,r){return Pr(e,t),Nt(t).forEach(function(a){t[a]!==e[a]&&(e===r&&(e=je(r)),e[a]=t[a]);}),e},$apply:function(t,e){return Tr(t),t(e)}},Lt=new Nn;Ue.isEquals=Lt.update.isEquals;Ue.extend=Lt.extend;Ue.default=Lt.update;Ue.default.default=_n.exports=bt(Ue.default,Ue);function Mn(t,e,n){Me(Array.isArray(t),function(){return "update(): expected target of "+_e(n)+" to be an array; got "+_e(t)+"."}),lt(e[n],n);}function lt(t,e){Me(Array.isArray(t),function(){return "update(): expected spec of "+_e(e)+" to be an array; got "+_e(t)+". Did you forget to wrap your parameter in an array?"});}function Fr(t,e){Me(Array.isArray(t),function(){return "Expected $splice target to be an array; got "+_e(t)}),Ln(e.$splice);}function Ln(t){Me(Array.isArray(t),function(){return "update(): expected spec of $splice to be an array of arrays; got "+_e(t)+". Did you forget to wrap your parameters in an array?"});}function Tr(t){Me(typeof t=="function",function(){return "update(): expected spec of $apply to be a function; got "+_e(t)+"."});}function Dr(t){Me(Object.keys(t).length===1,function(){return "Cannot have more than one key in an object with $set"});}function Pr(t,e){Me(e&&typeof e=="object",function(){return "update(): $merge expects a spec of type 'object'; got "+_e(e)}),Me(t&&typeof t=="object",function(){return "update(): $merge expects a target of type 'object'; got "+_e(t)});}function Bn(t,e){var n=Ye(t);Me(n==="Map"||n==="Set",function(){return "update(): "+_e(e)+" expects a target of type Set or Map; got "+_e(n)});}});var sr=c(An());var On=withTranslation()(memo(function(e){let{id:n,tabId:r,panelId:a,context:d,methodProvider:l,widgetsState:c}=e,s=l.findRowItem(r,a,n);return Te__default.createElement("div",{className:"row-container"},(s.item._children||[]).map(({rowId:m,id:v,component:T,properties:p})=>Te__default.createElement(Ae.getFormComponent(T,p),{key:"key_"+v,tabId:r,panelId:a,rowId:m,segmentId:v,properties:p,widgetsState:c,methodProvider:l,context:{...d},segmentsCount:s.item._children.length},null)))}));On.displayName="_Rowcontainer";var Hn=On;var Un=withTranslation()(memo(function(e){let{tabId:n,panelId:r,rowId:a,segmentId:d,segmentsCount:l,properties:c,methodProvider:s,context:m,widgetsState:v}=e,T=s.findSegmentItem(n,r,a,d),p={...c.style};return Te__default.createElement("div",{className:"rowSegment",style:p},(T.item._children||[]).map(({id:f,component:u,properties:g})=>{let y=g.groupname?g.groupname:g.name;return Te__default.createElement(Ae.getFormComponent(u,g),{key:"key_"+f,context:{params:m.params,displayButtonLoader:m.displayButtonLoader,doValidateForm:m.doValidateForm,redrawComponent:m.redrawComponent,formDimension:m.formDimension,segmentDimensions:{minWidth:parseInt(p.minWidth)},tabIndex:m.tabIndex,formData:u.displayName==="_Fileuploader"||u.displayName==="_Label"||u.displayName==="_View"||u.displayName==="_Textinput"&&g.inputtype==="currency"?m.formData:[]},id:f,methodProvider:s,panelId:r,properties:{...g,visible:v!==void 0&&v.visibility[y]!==void 0?v.visibility[y]:g.visible,readonly:v!==void 0&&v.readonly[y]!==void 0?v.readonly[y]:g.readonly},rowId:a,segmentId:d,segmentsCount:l,tabId:n,value:m.formData!==void 0?m.formData[y]:void 0,fieldAllowedValues:m!=null&&m.fieldAllowedValues?m.fieldAllowedValues[y]:void 0,validationMessage:m!=null&&m.formValidationData&&m.formValidationData[y]!==void 0?m.formValidationData[y]:null},null)}))}));Un.displayName="_Rowsegment";var Gn=Un;function Or(t,e){return {id:t,value:e}}var $n=withTranslation()(memo(function(e){var V;let n$1=useRef(null),{datalength:r,id:a,forcereadonly:d,ignorereadonly:l,label:c,name:s,onchangehandler:m,placeholder:v,readonly:T$1,regex:p,searchbar:f,size:u,style:g,tabIndex:y,uppercasemode:x,variant:M,visible:C}=e.properties,P=useLocation(),{viewPort:U$1}=b(),{tabId:L}=e,[I,F]=useState(String((V=e.value)!=null?V:"")),[h,J]=Te__default.useState([]),Z=!!(I.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var R;F(String((R=e.value)!=null?R:""));},[e.value]),useEffect(()=>{let R=[];if(e.fieldAllowedValues){for(let O in e.fieldAllowedValues)R.push(Or(O,e.fieldAllowedValues[O]));J(R);}},[e.fieldAllowedValues]);let ee=R=>{var O;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:R,widgetEvent:m?U.onChange:null,widgetContext:JSON.stringify({referer:P.pathname,parentWidgetId:L,hasParentForm:T.hasParentForm(),originator:(O=e.context.params)==null?void 0:O.originator})});},b$1=R=>{F(R);};return jsx(n,{autoFocus:false,data:h,disabled:!!(T$1&&!l),error:Z,helperText:Z?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:y,style:{...g},autoComplete:nanoid(5)},InputProps:{},inputRef:n$1,label:c,maxCharCount:r,name:s,onBlur:R=>{ee(R.target.value);},onInput:R=>{b$1(R.target.value),U$1.isMobileDevice&&ee(R.currentTarget.value);},onChange:R=>{I.trim()===""&&ee(R.target.value);},placeholder:v,readOnly:!!(T$1&&!l),regEx:p,searchBar:f,size:u!=null?u:"small",type:"text",inputtype:e.properties.inputType,toUpperCase:x,value:I,variant:M,visible:C})}));$n.displayName="_Input";var qn=$n;var jn=withTranslation()(memo(function(e){var R;let n$1=useRef(null),{datalength:r,id:a,forcereadonly:d,ignorereadonly:l,label:c,name:s,onchangehandler:m,placeholder:v,readonly:T$1,regex:p,size:f,style:u,tabIndex:g,uppercasemode:y,variant:x,visible:M}=e.properties,C=useLocation(),{viewPort:P}=b(),{tabId:U$1}=e,[L,I]=useState(String((R=e.value)!=null?R:"")),F=!!(L.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),[h,J]=useState(false),{t:Z}=useTranslation(),ee=()=>{navigator.clipboard.writeText(L).then(()=>{J(true),setTimeout(()=>J(false),2e4);});};useEffect(()=>{var O;I(String((O=e.value)!=null?O:""));},[e.value]);let b$1=O=>{var j;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:O,widgetEvent:m?U.onChange:null,widgetContext:JSON.stringify({referer:C.pathname,parentWidgetId:U$1,hasParentForm:T.hasParentForm(),originator:(j=e.context.params)==null?void 0:j.originator})});},V=O=>{I(O);};return jsxs(ja,{display:"flex",alignItems:"flex-start",gap:0,children:[jsx(n,{autoFocus:false,disabled:!!(T$1&&!l),error:F,helperText:F?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:g,style:{...u},autoComplete:nanoid(5)},InputProps:{},inputRef:n$1,label:c,maxCharCount:r,name:s,onBlur:O=>{b$1(O.target.value);},onInput:O=>{V(O.target.value),P.isMobileDevice&&b$1(O.currentTarget.value);},onChange:O=>{L.trim()===""&&b$1(O.target.value);},placeholder:v,readOnly:!!(T$1&&!l),regEx:p,size:f,type:"text",inputtype:e.properties.inputType,toUpperCase:y,value:L,variant:x,visible:M}),M&&jsx(Kr,{title:Z(h?"copied!":"copy to clipboard"),children:jsx(Qr,{variant:"contained",style:{backgroundColor:"#C0C0C0",borderRadius:"0px 4px 4px 0px",boxShadow:"none",marginLeft:"-3px",border:"2px solid #C0C0C0",lineHeight:"24px",fontSize:"11px"},onClick:ee,startIcon:jsx(i,{}),children:Z("copy")})})]})}));jn.displayName="_InputWCopy";var Qn=jn;var Xn=withTranslation()(memo(function(e){useRef(null);let {tabId:r,id:a,context:d,widgetsState:l}=e,c=e.methodProvider.findWidgetItem(a),s=e.methodProvider.getActiveTabIndex(r,a),m=(p,f,u,g)=>{f||(p.target.style.background=g,p.target.style.color=u);},v=(p,f,u,g)=>{f||(p.target.style.background=g,p.target.style.color=u);},T=({children:p,...f})=>jsx(A,{onPointerUp:u=>u.stopPropagation(),onMouseOver:u=>m(u,f.selected,f.item_active_color,f.item_active_background_color),onMouseOut:u=>v(u,f.selected,f.item_default_color,f.item_default_background_color),style:{borderRadius:"5px 5px 0 0",marginRight:"1px",color:f.selected?f.item_active_color:f.item_default_color,background:f.selected?f.item_active_background_color:f.item_default_background_color,fontSize:f.item_fontsize,fontWeight:f.item_fontweight},selected:f.selected,children:p},f.id);return T.tabsRole="Tab",e.properties.visible?Te__default.createElement("div",{className:"form-tab-widget"},jsxs(y,{selectedIndex:s,onSelect:p=>e.methodProvider.setActiveTabIndex(r,a,p),children:[jsx(z,{children:(c.item._children||[]).map(({properties:p},f)=>!p.item_visible||l&&l.visibility&&l.visibility[p.item_name]===false?null:createElement(T,{...c.item.properties.tabsetup,...p,key:"TabCaptionComponent_"+a+"_"+f},p.item_title))}),(c.item._children||[]).map(({_children:p},f)=>jsx(B,{children:(p||[]).map(({tabId:u,panelId:g,id:y,type:x,component:M,properties:C},P)=>Te__default.createElement(Ae.getFormComponent(M,C),{key:"tabSubPanel_"+P,id:y,tabId:u,panelId:g,properties:{...C,visible:l!==void 0&&l.visibility[C.name]!==void 0?l.visibility[C.name]:C.visible,readonly:l!==void 0&&l.readonly[C.name]!==void 0?l.readonly[C.name]:C.readonly},className:x,widgetsState:l,methodProvider:e.methodProvider,context:{...d},segmentsCount:c.item._children.length,fieldAllowedValues:d!=null&&d.fieldAllowedValues?d.fieldAllowedValues[C.name]:void 0},null))},"TabPanel_"+a+"_"+f))]})):null}));Xn.displayName="_TabBox";var Yn=Xn;function ri(t,e){if(!e||Array.isArray(e)&&e.length===0)return t;let n=e;return t.replace(/<b>@(\w+)<\/b>|@(\w+)/g,(r,a,d)=>{let l=(a||d).toLowerCase(),c=n[l];return typeof c=="string"?a?`<b>${c}</b>`:c:r})}var ea=withTranslation()(memo(function(e){let{title:n,style:r,verticalalign:a,visible:d}=e.properties,l={paddingTop:"0px"};if(a==="bottom"&&(l.paddingTop="10px"),!d)return null;let c=ri(n,e.context.formData);return jsx("div",{style:{...r,...l},children:jsx("div",{style:{...r},dangerouslySetInnerHTML:{__html:c}})})}));ea.displayName="_Label";var ta=ea;var na=withTranslation()(memo(function(e$1){let n=useRef(null),{defaultvalue:r,id:a,ignorereadonly:d,label:l,labelplacement:c,name:s,onchangehandler:m,readonly:v,style:T$1,tabIndex:p,visible:f}=e$1.properties,u=s,g=e$1.value||"",y=useLocation(),{tabId:x}=e$1,M=!!(!g&&e$1.validationMessage!=null&&e$1.context.doValidateForm);return useEffect(()=>{!e$1.value&&r&&e$1.methodProvider.eventDispatcher({widgetName:u,widgetValue:e$1.properties.value,widgetEvent:null,widgetContext:JSON.stringify({referer:y.pathname,parentWidgetId:x,hasParentForm:T.hasParentForm()})});},[]),jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:T$1.textAlign,height:"100%"},children:jsx(e,{checkedIcon:void 0,defaultChecked:!!(e$1.value===void 0&&r),disabled:!!(v&&!d),error:M,helperText:M?e$1.validationMessage:"",icon:void 0,inputProps:{id:a,tabIndex:p},inputRef:n,labelText:l,labelPlacement:c,name:u,onChange:C=>{e$1.methodProvider.eventDispatcher({widgetName:u,widgetValue:C.target.checked?e$1.properties.value:"",widgetEvent:m?U.onChange:null,widgetContext:JSON.stringify({referer:y.pathname,parentWidgetId:x,hasParentForm:T.hasParentForm()})});},selectedValue:g,value:e$1.properties.value,visible:f})})}));na.displayName="_Checkbox";var aa=na;var ia=withTranslation()(memo(function(e){let n=useRef(null),{defaultvalue:r,groupname:a,id:d,ignorereadonly:l,label:c,labelplacement:s,name:m,onchangehandler:v,readonly:T$1,style:p,tabIndex:f,visible:u}=e.properties,g=useLocation(),{tabId:y}=e;useEffect(()=>{!C&&r&&U$1(e.properties.value);},[]);let x=a||m;let C=e.value||"",P=!!(e.validationMessage!=null&&e.context.doValidateForm),U$1=L=>{var I;e.methodProvider.eventDispatcher({widgetName:x,widgetValue:L,widgetEvent:v?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:y,hasParentForm:T.hasParentForm(),originator:(I=e.context.params)==null?void 0:I.originator})});};return jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:p.textAlign,height:"100%"},children:jsx(k,{defaultValue:r?e.properties.value:"",disabled:!!(T$1&&!l),inputProps:{id:d,tabIndex:f,style:{...p}},error:P,helperText:P?e.validationMessage:"",inputRef:n,labelText:c,labelPlacement:s,name:x,onChange:L=>{C!==L.target.value.trim()&&U$1(L.target.value);},selectedValue:C,value:e.properties.value,visible:u})})}));ia.displayName="_Radio";var la=ia;var da=withTranslation()(memo(function(e){var ee;let n$1=useRef(null),{runFormEvent:r,viewPort:a}=b(),{id:d,autocompleteTextArea:l,ignorereadonly:c,label:s,name:m,onchangehandler:v,placeholder:T$1,required:p,requiredmessage:f,readonly:u,size:g,style:y,tabIndex:x,variant:M,visible:C}=e.properties,P=useLocation(),{tabId:U$1}=e,[L,I]=useState(String((ee=e.value)!=null?ee:""));useEffect(()=>{var b;I(String((b=e.value)!=null?b:""));},[e.value]);let F=!!(L.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),h=b=>{var V;e.methodProvider.eventDispatcher({widgetName:m,widgetValue:b,widgetEvent:v?U.onChange:null,widgetContext:JSON.stringify({referer:P.pathname,parentWidgetId:U$1,hasParentForm:T.hasParentForm(),originator:(V=e.context.params)==null?void 0:V.originator})});},J=async b=>{var V,R,O;try{let j=await r({pluginCode:e.context.params.pluginCode,formCode:e.context.params.formCode,guid:e.context.params.guid,projectGuid:e.context.params.pGuid,pGuid:e.context.params.pGuid,formData:(V=e.context.formData)!=null?V:{},widgetContext:JSON.stringify({}),widgetEvent:U.onGetCustomResponse,widgetName:m,widgetValue:JSON.stringify({methodName:"getAutoCompleteData",value:b})});if(((R=j.meta)==null?void 0:R.requestStatus)==="fulfilled"){let B=j.payload,S=(O=B==null?void 0:B.FECommand)==null?void 0:O.CustomResponse;if(Array.isArray(S))return S.filter(G=>typeof G=="string").map(G=>({label:G}))}}catch(j){}return []},Z=b=>{I(b);};return jsx(n,{autocompleteTextArea:l,autoFocus:false,disabled:!!(u&&!c),id:d,inputProps:{id:d,tabIndex:x,readOnly:!!(u&&!c),style:{...y}},error:F,helperText:F?e.validationMessage:"",InputProps:{},inputRef:n$1,label:s,multiline:true,name:m,onAutoCompleteChange:l?b=>J(b):void 0,onBlur:b=>{h(b.target.value);},onInput:b=>{Z(b.target.value),a.isMobileDevice&&h(b.currentTarget.value);},onChange:b=>{L.trim()===""&&h(b.target.value);},placeholder:T$1,readOnly:!!(u&&!c),size:g,type:"text",value:L,variant:M,visible:C})}));da.displayName="_Textarea";var sa=da;function ma(t,e){return {id:t,value:e}}var Ot="\xA4",ca=withTranslation()(memo(function(e){var R,O;let n=useRef(null),[r,a]=Te__default.useState(null),[d,l$1]=Te__default.useState([]),c=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Ot):[],[s,m]=Te__default.useState(c),{id:v,ignorereadonly:T$1,label:p,multiple:f,name:u,onchangehandler:g,placeholder:y,readonly:x,rendertype:M,searchbar:C,size:P,tabIndex:U$1,variant:L,visible:I,dropvalues:F}=e.properties,h=useLocation(),{tabId:J}=e,{t:Z}=useTranslation();useEffect(()=>{let j=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Ot):[];m(j);},[e.value]),useEffect(()=>{let j=M==="none"?[{id:"",value:""}]:[];if(e.fieldAllowedValues&&Object.keys(e.fieldAllowedValues).length>0){for(let B in e.fieldAllowedValues)j.push(ma(B,e.fieldAllowedValues[B]));l$1(j);}else if(F&&Array.isArray(F)&&F.length>0){for(let B of F)typeof B=="object"&&B!==null&&j.push(ma(B.id||"",B.value||""));l$1(j);}},[e.fieldAllowedValues,F]),useEffect(()=>{var j;if(r===false){let B=typeof e.value!="string"?e.value:[];(JSON.stringify(B)!==JSON.stringify(s)||s.length===0)&&e.methodProvider.eventDispatcher({widgetName:u,widgetValue:s.length>0?s.join(Ot):[],widgetEvent:g?U.onChange:null,widgetContext:JSON.stringify({referer:h.pathname,parentWidgetId:J,hasParentForm:T.hasParentForm(),originator:(j=e.context.params)==null?void 0:j.originator,folderData:e.context.params.folderData})});}},[r]);let ee=j=>{let{target:{value:B}}=j,S;f?S=typeof B=="string"?B.split(","):B:S=typeof B=="string"?[B]:B,m(S);},b=e.context.formDimension.width/e.segmentsCount;b=b<e.context.segmentDimensions.minWidth?e.context.segmentDimensions.minWidth:b-60;let V=!!(s.length===0&&e.validationMessage!=null&&e.context.doValidateForm);return jsx(l,{darkMode:false,data:d,error:V,helperText:V?e.validationMessage:"",inputProps:{tabIndex:U$1,style:{maxWidth:`${b}px`}},inputRef:n,onOpen:()=>{a(true);},onClose:()=>{a(false);},onChange:ee,id:v,label:p,multiple:f,placeholder:y,readOnly:x&&!T$1,renderType:M,noOptionsText:(O=(R=e.properties)==null?void 0:R.noOptionsLabel)!=null?O:Z("No options"),searchBar:C,selectDisplayProps:{style:{maxWidth:"100%",whiteSpace:M==="chip"?"normal":"nowrap"}},selectedValue:s,size:P,variant:L,width:"auto",visible:I})}));ca.displayName="_SelectBox";var ua=ca;var fa=withTranslation()(memo(function(e){var c;let{style:n,visible:r}=(c=e.properties)!=null?c:{},[a,d]=useState(false);if(useEffect(()=>{d(true);},[]),!a)return null;let l="form-widget form-placeholder-widget";return r||(l+=" visibilityOff"),jsx("div",{className:l,style:{...n,display:"flex",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center"}})}));fa.displayName="_Placeholder";var pa=fa;var ga=createContext({});function ha(){return useContext(ga)}var ba=ga;var $i=lazy(()=>import('./fileviewer-3RB5ZB4B.js'));function qi(){let[,t]=useState(0);return ()=>t(e=>e+1)}var xa=withTranslation()(memo(function(e){var we,ge;qi();let [r,a]=useState([]),[d,l]=useState(e.context.params),[c,s]=useState(false),[m,v]=useState(null),[T$1,p$1]=useState(false),[f$1,u]=useState(null),[g$1,y]=useState(0),{t:x}=useTranslation(),{iframeMode:M}=g(),C=ha(),P=H=>{var K;return (K=C[H])!=null?K:x(H)},{UserDialog:U$1}=b$1(),L=f(),{style:I,readonly:F,visible:h}=e.properties,[J,Z]=useState({showDialog:false,dialogTitle:"",dialogContent:"",buttonAgree:"",buttonDisagree:"",callBackFunc:()=>{}}),{appSettings:ee,viewPort:b$3,runFormDeleteFileEvent:V,runFormDownloadFileEvent:R,runFormGetLinkedFileEvent:O,runFormGetLinkedFileMetaEvent:j,runFormUploadFiles:B}=b();useEffect(()=>{l(e.context.params);},[e.context.params]),useEffect(()=>{let H=e.value?JSON.parse(e.value):[];return H&&(a(S(H,100)),s(true)),()=>{r&&(s(false),r.forEach(K=>{K.preview&&URL.revokeObjectURL(K.preview);}));}},[]);let S=(H,K)=>{let E=[];return H.forEach((z,o)=>{let te=new File([],z,{type:"image/jpeg"});Object.assign(te,{preview:null,uploadProgress:K}),E.push(te);}),E},G=useCallback(async H=>{var ie;let E=(await j({...d,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:H,context:{action:"Preview"}})).payload,{linkedFileSize:z,linkedFileName:o,mimeType:te}=E;if(!z)throw new Error("File data or metadata is missing");let oe=(ie=ee==null?void 0:ee.MAX_DOWNLOAD_NOCHUNK_FILESIZE)!=null?ie:b$2.MAX_DOWNLOAD_NOCHUNK_FILESIZE;return z>oe?{type:"formbuilder/getlinkedfile",payload:{linkedFile:null,linkedFileSize:z,linkedFileName:o},meta:{requestStatus:"fulfilled"}}:await O({...d,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:H,context:{action:"Load"}})},[d,e.context.params.pGuid,e.properties.name]),re=H=>{J.callBackFunc(H);},pe=async(H,K)=>{H&&await V({...e.context.params,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:K}).then(E=>{if(E.meta.requestStatus==="fulfilled"){let z={...E.payload};z.linkedFileDeleteSuccess&&(L({toastID:nanoid(11),msg:P("The file has been successfully deleted"),clearQueue:false,hideProgressBar:false}),a(o=>o.filter(te=>te.name!==K)),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(z.linkedFiles),widgetEvent:null,widgetContext:null}));}}),Z({...J,showDialog:false,callBackFunc:E=>{}});},ye=async H=>{if(H)try{let K=await R({...e.context.params,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:H}),E=new Blob([K]),z=window.URL.createObjectURL(E),o=document.createElement("a");o.href=z,o.setAttribute("download",H.split("/").pop()||"downloadedFile"),document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(z);}catch(K){}},se=useCallback(async(H,K)=>(K&&Z({showDialog:true,dialogTitle:P("Confirmation"),dialogContent:P("Are you sure you want to delete file?"),buttonAgree:P("Continue"),buttonDisagree:P("Close"),callBackFunc:E=>pe(E,K)}),null),[e.context.params,x]),_=useCallback(async(H,K)=>(K&&ye(K),null),[e.context.params]),ce=useCallback((H,K)=>{K&&startTransition(()=>{v(K);});},[]),Q=()=>{v(null);},ue=useCallback(async(H,K)=>{var E,z;if(H){let o=new FormData;for(let ie in e.context.params)e.context.params.hasOwnProperty(ie)&&o.append(ie,e.context.params[ie]);o.append("fieldName",e.properties.name),H.forEach(ie=>{o.append("files",ie);}),o.append("widgetContext",JSON.stringify({hasParentForm:T.hasParentForm(),originator:(E=e.context.params)==null?void 0:E.originator,folderData:(z=e.context.params)==null?void 0:z.folderData})),o.append("widgetEvent",U.onFileUploadEvent),o.append("widgetName",e.properties.name),o.append("formData",JSON.stringify({...e.context.formData}));let te=_i.CancelToken.source(),oe=H.map(ie=>Object.assign(ie,{preview:URL.createObjectURL(ie),uploadProgress:0}));a(r.concat(oe)),u(0),await B({content:o,cancelTokenSource:te,onUploadProgress:ie=>{let Ne=ie.total?Math.round(ie.loaded*100/ie.total):0;u(Ne);}}).then(ie=>{var ze,Ke,Ve;let Ne=[];if(ie.meta.requestStatus==="fulfilled"){let xe={...ie.payload};if((ze=xe.FECommand)!=null&&ze.FormValidationData&&Object.keys(xe.FECommand.FormValidationData).length>0){oe.forEach(Ce=>{Ce.preview&&URL.revokeObjectURL(Ce.preview);}),u(null),y(Ce=>Ce+1);let tt=r.filter(Ce=>Ce.uploadProgress===100);a(tt),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(r),widgetEvent:null,widgetContext:null,feCommand:xe.FECommand});}else if(xe.linkedFiles&&e.properties.name){Ne=S(xe.linkedFiles,100);let tt=Ne.map(Ce=>{let rt=Ce;return rt.uploadProgress=100,rt.preview=null,rt});oe.forEach(Ce=>{Ce.preview&&URL.revokeObjectURL(Ce.preview);}),u(null),y(Ce=>Ce+1),a(tt),l({...e.context.params,guid:(Ve=(Ke=xe.FECommand)==null?void 0:Ke.ReplaceContextRecordGuid)==null?void 0:Ve.guid}),xe.FECommand={...xe.FECommand,UpdateFieldAllowedValues:xe.fieldAllowedValues,UpdateFormData:xe.data},e.methodProvider.execCommands(xe.FECommand);}}});}},[r,e.context.params,e.methodProvider,e.properties.name,e.value]);return !c||!h?null:jsxs("div",{style:{...I,lineHeight:"1.1em"},children:[jsx(U$1,{...J,handleDialogClose:re}),jsxs("div",{style:{position:"relative",zIndex:1,isolation:"isolate"},children:[M&&jsx("div",{style:{position:"absolute",inset:0,zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255,255,255,0.85)",borderRadius:4,padding:"8px 16px",textAlign:"center",fontSize:"0.875rem",color:"#555"},children:x("File upload is available only when using the SDK")}),jsx(p,{defaultText:(ge=(we=e.properties)==null?void 0:we.dragDropLabel)!=null?ge:P("Drag and Drop..."),tryGetLinkedFile:G,onDeleteButtonPress:se,onDownloadButtonPress:_,onDownloadText:P("Download"),onDeleteText:P("Delete"),filesData:r,onDragText:"On drop text",onFilesDrop:ue,onPreviewButtonPress:ce,isMobileDevice:b$3.isMobileDevice,isReadonly:F},g$1),f$1!==null&&jsx(zi,{variant:"determinate",value:f$1,style:{marginTop:6,borderRadius:3,height:8}})]}),m!=null&&jsx(Suspense,{fallback:jsx(Gi,{}),children:jsx($i,{fileId:m,fileBase64:null,fieldName:e.properties.name,params:{...e.context.params,modalCloseFn:Q}},nanoid(11))})]})}));xa.displayName="_Fileuploader";var Ca=xa;var Ia=(t,e)=>"#"+t.replace(/^#/,"").replace(/../g,n=>("0"+Math.min(255,Math.max(0,parseInt(n,16)+e)).toString(16)).substring(-2)),Ta=withTranslation()(memo(function(e){var x,M;let{buttontype:n,colorSchema:r,fullWidth:a,name:d,style:l,tabIndex:c,title:s,variant:m,visible:v}=e.properties,T$1=useLocation(),{tabId:p}=e,f=(M=(x=e.context)==null?void 0:x.displayButtonLoader)!=null?M:false;if(!v)return null;let u=l.backgroundColor,g=u?Ia(u,-50):"";r&&(u=r+".main",g=r+".hover");let y={};return m==="outlined"?(Object.assign(y,{"&.MuiButtonBase-root":{fontSize:l.fontSize,fontWeight:l.fontWeight,border:"1px solid"+u,cursor:"pointer"}}),Object.assign(y,{"&.MuiButtonBase-root:hover":{border:g?"1px solid"+Ia(g,-50):""}})):(Object.assign(y,{"&.MuiButtonBase-root":{fontSize:l.fontSize,fontWeight:l.fontWeight,backgroundColor:u,cursor:"pointer"}}),Object.assign(y,{"&.MuiButtonBase-root:hover":{backgroundColor:g}})),jsx("div",{children:jsx(o,{variant:m,label:s,loading:f,onPointerUp:()=>{var C,P;e.methodProvider.eventDispatcher({widgetName:d,widgetValue:null,widgetEvent:U.getFormButtonEvent(n),widgetContext:JSON.stringify({referer:T$1.pathname,parentWidgetId:p,hasParentForm:T.hasParentForm(),originator:(C=e.context.params)==null?void 0:C.originator,parent:{widgetName:d,params:{pGuid:e.context.params.pGuid,pluginCode:e.context.params.pluginCode,formCode:e.context.params.formCode,guid:e.context.params.guid}},folderData:(P=e.context.params)==null?void 0:P.folderData})});},fullWidth:a,sx:y,tabIndex:c})})}));Ta.displayName="_Button";var Da=Ta;var Pa=withTranslation()(memo(function(e){var P,U$1,L;let n=useRef(null),{id:r,ignorereadonly:a,defaultvalue:d,dateformat:l,label:c,name:s,onchangehandler:m,readonly:v,size:T$1,tabIndex:p,variant:f,visible:u}=e.properties,g=useLocation(),{tabId:y}=e,x=!!(!e.value&&e.validationMessage!=null&&e.context.doValidateForm),M=I=>{var F;return e.methodProvider.eventDispatcher({widgetName:s,widgetValue:I!=null?I:"",widgetEvent:m?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:y,hasParentForm:T.hasParentForm(),originator:(F=e.context.params)==null?void 0:F.originator})})},C=(U$1=(P=e==null?void 0:e.i18n)==null?void 0:P.language)==null?void 0:U$1.substr(0,2);return jsx(f$1,{id:r,defaultvalue:d,disabled:!!(v&&!a),error:x,format:l!==void 0&&l!==""&&l!=null?l:void 0,helperText:x?e.validationMessage:"",inputRef:n,label:c,locale:C,name:s,onBlur:I=>{M(I?a$1(I).utc().format():null);},size:T$1,type:"datepicker",value:(L=e.value)!=null?L:"",variant:f,visible:u})}));Pa.displayName="_Textinput";var Ra=Pa;var Ea=withTranslation()(memo(function(e){var L,I,F;let n=useRef(null),{id:r,ignorereadonly:a,defaultvalue:d,dateformat:l,label:c,name:s,onchangehandler:m,readonly:v,size:T$1,tabIndex:p,variant:f,visible:u}=e.properties,g=useLocation(),{tabId:y}=e,[x,M]=useState(String((L=e.value)!=null?L:"")),C=!!(!x&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var h;M(String((h=e.value)!=null?h:""));},[e.value]);let P=h=>{var J;return M(h),e.methodProvider.eventDispatcher({widgetName:s,widgetValue:h!=null?h:"",widgetEvent:m?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:y,hasParentForm:T.hasParentForm(),originator:(J=e.context.params)==null?void 0:J.originator})})};useEffect(()=>{if(!e.value&&d){let h=d==="now"?a$1().utc().format():d==="start of day"?a$1().startOf("day").utc().format():null;h&&P(h);}},[]);let U$1=(F=(I=e==null?void 0:e.i18n)==null?void 0:I.language)==null?void 0:F.substr(0,2);return jsx(g$1,{autoFocus:false,defaultvalue:d,disabled:!!(v&&!a),error:C,format:l!==void 0&&l!==""&&l!=null?l:void 0,helperText:C?e.validationMessage:"",id:r,inputRef:n,label:c,locale:U$1,name:s,onChange:h=>{P(h?a$1(h).utc().format():null);},size:T$1,value:x,variant:f,visible:u})}));Ea.displayName="_Textinput";var ka=Ea;var Ma=withTranslation()(memo(function(e){var P,U$1,L;let n=useRef(null),{id:r,ignorereadonly:a,defaultvalue:d,dateformat:l,label:c,name:s,onchangehandler:m,readonly:v,size:T$1,tabIndex:p,variant:f,visible:u}=e.properties,g=useLocation(),{tabId:y}=e,x=!!(!e.value&&e.validationMessage!=null&&e.context.doValidateForm),M=I=>{var F;return e.methodProvider.eventDispatcher({widgetName:s,widgetValue:I!=null?I:"",widgetEvent:m?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:y,hasParentForm:T.hasParentForm(),originator:(F=e.context.params)==null?void 0:F.originator})})},C=(U$1=(P=e==null?void 0:e.i18n)==null?void 0:P.language)==null?void 0:U$1.substr(0,2);return jsx(h,{id:r,defaultvalue:d,disabled:!!(v&&!a),error:x,format:l!==void 0&&l!==""&&l!=null?l:void 0,helperText:x?e.validationMessage:"",inputRef:n,label:c,locale:C,name:s,onBlur:I=>{M(I?a$1(I).utc().format():null);},size:T$1,type:"datetimepicker",value:(L=e.value)!=null?L:"",variant:f,visible:u})}));Ma.displayName="_Textinput";var Ba=Ma;var Na=withTranslation()(memo(function(e){var ee;let n$1=useRef(null),{datalength:r,id:a,forcereadonly:d,ignorereadonly:l,label:c,name:s,onchangehandler:m,placeholder:v,phoneformat:T$1,readonly:p,regex:f,size:u,style:g,tabIndex:y,uppercasemode:x,variant:M,visible:C}=e.properties,P=useLocation(),{viewPort:U$1}=b(),{tabId:L}=e,[I,F]=useState(String((ee=e.value)!=null?ee:"")),h=!!(e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{e.value!==void 0&&e.value!==null&&F(String(e.value));},[e.value]);let J=b=>{var V;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:b,widgetEvent:m?U.onChange:null,widgetContext:JSON.stringify({referer:P.pathname,parentWidgetId:L,hasParentForm:T.hasParentForm(),originator:(V=e.context.params)==null?void 0:V.originator})});},Z=b=>{F(b);};return jsx(n,{autoFocus:false,disabled:!!(p&&!l),error:h,helperText:h?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:y,style:{...g}},InputProps:{},inputRef:n$1,label:c,maxCharCount:r,name:s,onBlur:b=>{J(b.target.value);},onInput:b=>{Z(b.target.value),U$1.isMobileDevice&&J(b.currentTarget.value);},placeholder:v,phoneFormat:T$1||void 0,readOnly:!!(p&&!l),regEx:f,size:u!=null?u:"small",type:T$1?"phone":"text",toUpperCase:x,value:I,variant:M,visible:C})}));Na.displayName="_PhoneInput";var La=Na;var Va=withTranslation()(memo(function(e){var ce;let n$1=useRef(null),{t:r,i18n:a}=useTranslation(),d=a==null?void 0:a.language,{currency_format:l,currency_assymbol:c,currency_currencydisplay:s,currency_fixedlocale:m,datalength:v,id:T$1,ignorereadonly:p,label:f,name:u,onchangehandler:g,placeholder:y,readonly:x,regex:M,size:C,style:P,tabIndex:U$1,uppercasemode:L,variant:I,visible:F}=e.properties,h=useLocation(),{viewPort:J}=b(),{tabId:Z}=e,[ee,b$1]=useState(String((ce=e.value)!=null?ce:"0")),[V,R]=useState(false),[O,j]=useState(0),B=useRef(0);useEffect(()=>{var Q;b$1(String((Q=e.value)!=null?Q:"0"));},[e.value]),useEffect(()=>{e.validationMessage!=null&&(B.current+=1,R(false));},[e.context.formValidationData]);let S=!!(!V&&e.validationMessage!=null&&e.context.doValidateForm),G=Q=>{var ue;e.methodProvider.eventDispatcher({widgetName:u,widgetValue:Q,widgetEvent:g?U.onChange:null,widgetContext:JSON.stringify({referer:h.pathname,parentWidgetId:Z,hasParentForm:T.hasParentForm(),originator:(ue=e.context.params)==null?void 0:ue.originator})});},re=Q=>{b$1(Q);},pe=l==="fixed-locale"&&m?m:d,ye=()=>{var we;if(s==="")return "";let Q=e.context.formData,ue=e.properties.currency_inputfield;return ue&&(Q!=null&&Q[ue])?Q[ue]:e.properties.currency_currency?e.properties.currency_currency:(l==="locale"||l==="fixed-locale")&&(we=k$2(pe!=null?pe:""))!=null?we:""},se=s==="symbol"?true:s==="code"?false:c!=null?c:false,_=l==="locale"||l==="fixed-locale"?"locale":l!=null?l:"";return jsx(n,{autoFocus:false,currency:ye(),disabled:!!(x&&!p),error:S,helperText:S?e.validationMessage:"",id:T$1,inputProps:{id:T$1,tabIndex:U$1,style:{...P,textAlign:"right"}},InputProps:{},inputRef:n$1,label:f,locale:pe,maxCharCount:v,name:u,onBlur:Q=>{R(true);let ue=Q.target.value;(ue==="0"||ue==="")&&j(we=>we+1),G(ue);},onInput:Q=>{re(Q.target.value),J.isMobileDevice&&G(Q.currentTarget.value);},onChange:Q=>{ee.trim()===""&&G(Q.target.value);},placeholder:y,readOnly:!!(x&&!p),regEx:M,size:C,type:"currency",toUpperCase:L,value:ee,variant:I,visible:F,format:_,assymbol:se},O)}));Va.displayName="_CurrencyInput";var Oa=Va;var Wa=withTranslation()(memo(function(e){var j,B;let n$1=useRef(null),{t:r,i18n:a}=useTranslation(),d=(j=a==null?void 0:a.language)==null?void 0:j.substring(0,2),{datalength:l,id:c,forcereadonly:s,ignorereadonly:m,label:v,name:T$1,onchangehandler:p,placeholder:f,readonly:u,regex:g,size:y,style:x,tabIndex:M,uppercasemode:C,variant:P,visible:U$1}=e.properties,[L,I]=useState(false),{viewPort:F}=b(),h=useLocation(),{tabId:J}=e,[Z,ee]=useState(String((B=e.value)!=null?B:"")),b$1=!!(Z.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var S;ee(String((S=e.value)!=null?S:""));},[e.value]);let V=()=>{I(S=>!S);},R=S=>{var G;e.methodProvider.eventDispatcher({widgetName:T$1,widgetValue:S,widgetEvent:p?U.onChange:null,widgetContext:JSON.stringify({referer:h.pathname,parentWidgetId:J,hasParentForm:T.hasParentForm(),originator:(G=e.context.params)==null?void 0:G.originator})});},O=S=>{ee(S);};return jsx(n,{autoFocus:false,disabled:!!(u&&!m),error:b$1,helperText:b$1?e.validationMessage:"",id:c,inputProps:{id:c,tabIndex:M,style:{...x,textAlign:"center"}},InputProps:{endAdornment:jsx(kl,{position:"end",children:jsx(lr,{onClick:V,edge:"end",children:L?jsx(Ml,{}):jsx(Bl,{})})})},inputRef:n$1,label:v,locale:d,maxCharCount:l,name:T$1,onBlur:S=>{R(S.target.value);},onInput:S=>{O(S.target.value),F.isMobileDevice&&R(S.currentTarget.value);},onChange:S=>{Z.trim()===""&&R(S.target.value);},placeholder:f,readOnly:!!(u&&!m),regEx:g,size:y,type:"text",toUpperCase:C,value:Z,variant:P,visible:U$1,inputtype:L?"text":"password"})}));Wa.displayName="_PasswordInput";var Ua=Wa;var $a=styled(TreeItem2Root)(({theme:t})=>({color:t.palette.mode==="light"?t.palette.grey[800]:t.palette.grey[400],position:"relative",[`& .${treeItemClasses.groupTransition}`]:{marginLeft:t.spacing(3.5)}})),Yl=styled(TreeItem2Content)(({theme:t})=>({borderRadius:t.spacing(.3),marginBottom:t.spacing(.5),marginTop:t.spacing(.3),padding:t.spacing(.3),paddingRight:t.spacing(.1),fontWeight:500,"&.Mui-expanded ":{"&:not(.Mui-focused, .Mui-selected, .Mui-selected.Mui-focused) .labelIcon":{color:t.palette.mode==="light"?t.palette.primary.main:t.palette.primary.dark},"&::before":{content:'""',display:"block",position:"absolute",left:"16px",top:"34px",height:"calc(100% - 36px)",width:"1.5px",backgroundColor:t.palette.mode==="light"?t.palette.grey[300]:t.palette.grey[700]}},"&:hover":{backgroundColor:alpha(t.palette.primary.main,.1),color:t.palette.mode==="light"?t.palette.primary.main:"white"},"&.Mui-focused, &.Mui-selected, &.Mui-selected.Mui-focused":{backgroundColor:t.palette.mode==="light"?t.palette.primary.main:t.palette.primary.dark,color:t.palette.primary.contrastText,fontWeight:700}})),Zl=styled(TreeItem2Content)(({theme:t})=>({borderRadius:t.spacing(.3),marginBottom:t.spacing(.5),marginTop:t.spacing(.3),padding:t.spacing(.3),paddingRight:t.spacing(.1),fontWeight:500,"&.Mui-expanded ":{"&:not(.Mui-focused, .Mui-selected, .Mui-selected.Mui-focused) .labelIcon":{},"&::before":{content:'""',display:"block",position:"absolute",left:"16px",top:"34px",height:"calc(100% - 36px)",width:"1.5px"}}})),ed=animated(Al);function qa(t){let e=useSpring({to:{opacity:t.in?1:0,transform:`translate3d(0,${t.in?0:20}px,0)`}});return jsx(ed,{style:e,...t})}var td=styled(Vl)({color:"inherit",fontWeight:500});function Ja({icon:t,expandable:e,children:n,isFirstRootNode:r,...a}){return jsxs(TreeItem2Label,{...a,sx:{display:"flex",alignItems:"center",fontWeight:r?"700":"normal",backgroundColor:"transparent","&.Mui-focused, &.Mui-selected":{backgroundColor:"transparent"}},children:[t&&jsx(ja,{component:t,className:"labelIcon",color:"inherit",sx:{mr:1,fontSize:"1.2rem"}}),jsx(td,{sx:{fontSize:r?"1rem":"0.9rem",fontWeight:r?"700":"normal"},children:n})]})}var Ka=t=>Array.isArray(t)?t.length>0&&t.some(Ka):!!t,Ct=t$1=>{let e=null,n=t$1.action,r=t$1.applyInternalStyle?{fontSize:"1em",marginRight:"0.5em"}:{};return n==="add"?e=jsx(t,{style:r}):n==="edit"?e=jsx(A$1,{style:r}):n==="share"?e=jsx(E,{style:r}):n==="trash"&&(e=jsx(N,{style:r})),e},od=Te.forwardRef(function(e,n){let{id:r,itemId:a,label:d,disabled:l,children:c,item:s,index:m$1,mode:v,setSelectedItem:T$1,treeCheckedItems:p,properties:f,disableRootItem:u,userData:g,formData:y,deletePrompt:x$1,selectedItem:M,execCommands:C,eventDispatcher:P,...U$1}=e,{getRootProps:L,getContentProps:I,getIconContainerProps:F,getCheckboxProps:h,getLabelProps:J,getGroupTransitionProps:Z,getDragAndDropOverlayProps:ee,status:b$1}=unstable_useTreeItem2({id:r,itemId:a,children:c,label:d,disabled:l,rootRef:n}),V=useLocation(),{t:R}=useTranslation(),[O,j]=Te.useState(null),B=!!O,S=Ka(c),G=m$1===0?void 0:Ol,[re,pe]=Te.useState(b$1.expanded),{runFormEvent:ye}=b(),se=useCallback(async(E,z,o,te,oe,ie)=>{var Ne,ze,Ke;E&&await ye({pluginCode:o.params.pluginCode,formCode:"FOLDER",guid:(Ne=o.params.folderData)==null?void 0:Ne.id,projectGuid:o.params.pGuid,pGuid:o.params.pGuid,widgetContext:JSON.stringify({referer:oe.pathname,parentWidgetId:ie,hasParentForm:T.hasParentForm(),originator:(ze=o.params)==null?void 0:ze.originator,parent:o.params,folderData:(Ke=o.params)==null?void 0:Ke.folderData}),widgetEvent:U.onDelete,widgetName:"delete",formData:o.formData}).then(Ve=>{if(Ve.meta.requestStatus==="fulfilled"){let xe={...Ve.payload};o.execCommands(xe.FECommand);}}),o.deletePrompt({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}});},[e.params.pluginCode,e.params.folderData,e.params.pGuid,e.formData,e.deletePrompt,e.execCommands]),_=E=>{E.stopPropagation(),pe(z=>!z);},ce=E=>{E.stopPropagation(),j(E.currentTarget);},Q=()=>{j(null);},ue=useCallback(()=>{Q();let E="addbtn";return e.eventDispatcher({tabIndex:0,widgetName:E,widgetValue:null,widgetEvent:U.onFolderCreateRecordEvent,widgetContext:JSON.stringify({referer:V.pathname,parentWidgetId:"",hasParentForm:T.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:e.params,widgetName:E},parent:{widgetName:E,params:e.params},isModal:true,folderData:e.params.folderData})})},[Q,V.pathname,e.params,e.eventDispatcher,T.hasParentForm]),we=useCallback(()=>{Q();let E="share";return e.eventDispatcher({tabIndex:0,widgetName:E,widgetValue:null,widgetEvent:U.onFolderShareRecordEvent,widgetContext:JSON.stringify({referer:V.pathname,parentWidgetId:"",hasParentForm:T.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:{...e.params,guid:e.params.folderData.id},widgetName:E},parent:{widgetName:E,params:e.params},isModal:true,folderData:e.params.folderData})})},[e,V.pathname]),ge=useCallback(()=>{Q();let E="edit";return e.eventDispatcher({tabIndex:0,widgetName:E,widgetValue:null,widgetEvent:U.onFolderEditRecordEvent,widgetContext:JSON.stringify({referer:V.pathname,parentWidgetId:"",hasParentForm:T.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:e.params,widgetName:E},parent:{widgetName:E,params:e.params},isModal:true,folderData:e.params.folderData})})},[e,V.pathname]),H=useCallback(async E=>{var z,o;await ye({pluginCode:e.params.pluginCode,formCode:e.params.formCode,guid:e.params.guid,projectGuid:e.params.pGuid,pGuid:e.params.pGuid,widgetContext:JSON.stringify({referer:V.pathname,parentWidgetId:null,hasParentForm:T.hasParentForm(),originator:(z=e.params)==null?void 0:z.originator,parent:e.params,folderData:(o=e.params)==null?void 0:o.folderData}),widgetEvent:U.onRefresh,widgetName:f==null?void 0:f.name,widgetValue:E,formData:y}).then(te=>{if(te.meta.requestStatus==="fulfilled"){let oe={...te.payload};oe.FECommand={...oe.FECommand,UpdateFormData:oe.data},e.execCommands(oe.FECommand);}});},[e,f==null?void 0:f.name,V.pathname]),K=useCallback(()=>{e.deletePrompt({delete:{showDialog:true,dialogTitle:R("Delete")+" ?",dialogContent:R("Are you certain that you wish to delete this folder?"),buttonAgree:R("Continue"),buttonDisagree:R("Close"),callBackFunc:E=>{E?se(E,"delete",e,{},V,""):se(false,"",e,{},V,"");}}});},[e,R,V,se]);if(v==="live"){let E=g.rightMode!=="Edit";return jsxs($a,{...L(U$1),sx:{"& > ul":{paddingLeft:"0.2rem",paddingRight:"0.1rem"}},children:[jsxs(Yl,{...I({className:x("content",{"Mui-expanded":re,"Mui-selected":b$1.selected,"Mui-focused":b$1.focused,"Mui-disabled":b$1.disabled})}),children:[m$1!==0&&jsxs(Fragment,{children:[jsx(TreeItem2IconContainer,{...F({status:b$1,onPointerUp:_}),children:jsx(TreeItem2Icon,{status:b$1})}),jsx(TreeItem2Checkbox,{...h()})]}),jsx(Ja,{...J({icon:G,expandable:S&&re,isFirstRootNode:m$1===0,onClick:z=>{T$1&&T$1(z,a),z.stopPropagation();}}),children:d}),!E&&e.selectedItem===a&&m$1!==0&&jsx(lr,{size:"small",onClick:ce,"aria-controls":B?"menu":void 0,"aria-haspopup":"true","aria-expanded":B?"true":void 0,style:{marginLeft:"auto",color:"#FFF",fontSize:"14px"},children:jsx(m,{})}),jsxs(jl,{anchorEl:O,open:B,onClose:Q,onClick:z=>z.stopPropagation(),slotProps:{paper:{sx:{minWidth:"12em"}}},children:[jsxs(xt,{onClick:ue,children:[jsx(yt,{children:jsx(Ct,{action:"add",applyInternalStyle:true})}),jsx(wt,{primaryTypographyProps:{fontSize:"0.875rem"},children:R("New Folder")})]}),jsxs(xt,{onClick:ge,children:[jsx(yt,{children:jsx(Ct,{action:"edit",applyInternalStyle:true})}),jsx(wt,{children:R("Settings")})]}),jsxs(xt,{onClick:we,children:[jsx(yt,{children:jsx(Ct,{action:"share",applyInternalStyle:true})}),jsx(wt,{children:R("Share")})]}),jsxs(xt,{onClick:K,children:[jsx(yt,{children:jsx(Ct,{action:"trash",applyInternalStyle:true})}),jsx(wt,{children:R("Delete")})]})]}),jsx(TreeItem2DragAndDropOverlay,{...ee()})]}),c&&jsx(qa,{...Z(),in:re,children:c})]})}else {let E=false;return p&&p.length>0&&p.forEach((z,o)=>{if(z===a){E=true;return}}),jsxs($a,{...L({...U$1,expandable:false}),sx:{"& > ul":{paddingLeft:"1rem",paddingRight:"0rem"}},children:[jsxs(Zl,{...I({className:x("content",{"Mui-expanded":true,"Mui-selected":b$1.selected,"Mui-focused":b$1.focused,"Mui-disabled":b$1.disabled})}),children:[m$1!==0&&jsx(Fragment,{children:jsx(TreeItem2Checkbox,{id:a,visible:true,checked:E,onPointerUp:z=>H(a),onResize:void 0,onResizeCapture:void 0,popover:void 0,popoverTargetAction:void 0,popoverTarget:void 0,inert:void 0,onToggle:void 0,onBeforeToggle:void 0,onTransitionCancel:void 0,onTransitionCancelCapture:void 0,onTransitionRun:void 0,onTransitionRunCapture:void 0,onTransitionStart:void 0,onTransitionStartCapture:void 0})}),jsx(Ja,{...J({icon:G,expandable:S,isFirstRootNode:m$1===0}),children:d}),jsx(TreeItem2DragAndDropOverlay,{...ee()})]}),c&&jsx(qa,{...Z(),in:true,children:c})]})}}),nd=t=>{let e=[],n=r=>{r.forEach(a=>{a.children&&a.children.length>0&&(e.push(a.id),n(a.children));});};return n(t),e},ad=(t,e)=>{let n=(r,a)=>{for(let d of r)if(d.id===a||d.children&&n(d.children,a))return d;return null};return n(t,e)},rd=(t,e)=>{let n=[],r=(a,d,l=[])=>{for(let c of a){if(c.id===d)return n.push(...l),true;if(c.children&&r(c.children,d,[...l,c]))return true}return false};return r(t,e),n},Wt=(t,e)=>{for(let n of t){if(n.id===e)return n;if(n.children){let r=Wt(n.children,e);if(r)return r}}return null},It=(t,e)=>{for(let n of t){if(n.id===e)return [n.label];if(n.children){let r=It(n.children,e);if(r.length>0)return [n.label,...r]}}return []},id=({eventDispatcher:t,execCommands:e,params:n,properties:r,redrawComponent:a,formlayout:d,onFolderSelected:l,onFolderAdded:c,formData:s,mode:m,checkedItems:v})=>{var O,j;let{runFormEvent:T$1}=b(),[p,f]=Te.useState([]),[u,g]=Te.useState(((O=n==null?void 0:n.folderData)==null?void 0:O.id)||null),[y,x]=Te.useState([]),[M,C]=Te.useState(v),[P,U$1]=Te.useState(false),[L,I]=Te.useState(),{UserDialog:F}=b$1();Te.useEffect(()=>{C(v);},[v]);let h=useCallback(T.debounce(async()=>{var B,S,G,re,pe,ye,se,_,ce,Q,ue;try{let we=await T$1({pluginCode:((B=n.sourcePluginCode)==null?void 0:B.trim())!==""?n.sourcePluginCode:n.pluginCode,formCode:((S=n.sourceFormCode)==null?void 0:S.trim())!==""?n.sourceFormCode:n.formCode,guid:n.guid,projectGuid:n.pGuid,pGuid:n.pGuid,widgetEvent:U.onFoldersDataLoad,widgetContext:JSON.stringify({originator:(G=n.originator)!=null?G:null})});if(we.meta.requestStatus==="fulfilled"){let ge={...we.payload};ge!=null&&ge.userData&&I(ge==null?void 0:ge.userData),(re=ge==null?void 0:ge.userData)!=null&&re.isContributor&&U$1(!0);let H=JSON.parse(ge.widgetData.treeData);if(f(H),(pe=n==null?void 0:n.folderData)!=null&&pe.addedFolderId){let K=ad(H,(ye=n==null?void 0:n.folderData)==null?void 0:ye.addedFolderId);if(K){let E=nd([K]);x(E),g((se=n==null?void 0:n.folderData)==null?void 0:se.addedFolderId);let z=It([K],(_=n==null?void 0:n.folderData)==null?void 0:_.addedFolderId);c(null,z);}}else if(y.length===0&&x([(ce=H[0])==null?void 0:ce.id]),!u){let K=(Q=H[0])==null?void 0:Q.id,E=(ue=H[0])==null?void 0:ue.isroot;g(K||null),l(K||null,E);}}}catch(we){}},500),[n]);Te.useEffect(()=>(h(),()=>{h.cancel();}),[h]),Te.useEffect(()=>{var B,S,G,re,pe,ye;if((B=n==null?void 0:n.folderData)!=null&&B.id){g(((S=n==null?void 0:n.folderData)==null?void 0:S.id)||null);let se=Wt(p,(G=n==null?void 0:n.folderData)==null?void 0:G.id),_=It(p,se==null?void 0:se.id),ce=[],Q=rd(p,(re=n==null?void 0:n.folderData)==null?void 0:re.id);Q.length>0&&(Q.forEach(ue=>{ce.push(ue.id);}),ce.push((pe=n==null?void 0:n.folderData)==null?void 0:pe.id),x(ce)),l((ye=n==null?void 0:n.folderData)==null?void 0:ye.id,se==null?void 0:se.isroot,_);}},[(j=n==null?void 0:n.folderData)==null?void 0:j.id]);let[J,Z]=useState({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}}),ee=B=>J.delete.callBackFunc(B),b$2=B=>{Z(B);},V=(B,S)=>{g(S);let G=Wt(p,S),re=It(p,G==null?void 0:G.id);l(S,G==null?void 0:G.isroot,re);};return jsxs(Fragment,{children:[jsx(ja,{sx:{paddingTop:"5px"},children:jsx(RichTreeView,{items:p,selectedItems:u,expandedItems:y,sx:{height:"fit-content",flexGrow:1,maxWidth:250,overflowY:"auto"},slots:{item:B=>jsx(od,{...B,mode:m,params:n,eventDispatcher:t,execCommands:e,deletePrompt:b$2,index:p.findIndex(S=>S.id===B.itemId),selectedItem:u,setSelectedItem:V,treeCheckedItems:M,disableRootItem:P,userData:L,formData:s,properties:r})},onSelectedItemsChange:V,onExpandedItemsChange:(B,S)=>{var re;let G=(re=p[0])==null?void 0:re.id;G&&!S.includes(G)?x(pe=>pe.includes(G)?pe:[...pe,G]):x(S);}})}),jsx(F,{...J.delete,handleDialogClose:ee})]})},mt=id;var Ya=withTranslation()(memo(function(e){var m,v;let{style:n,verticalalign:r,plugincode:a,formcode:d,visible:l}=e.properties,c={paddingTop:"0px"};if(r==="bottom"&&(c.paddingTop="10px"),!l)return null;let s=(m=e.context.formData)!=null&&m[e.properties.name]?JSON.parse((v=e.context.formData)==null?void 0:v[e.properties.name]):{};return jsx("div",{style:{...n,...c,minHeight:"2rem"},children:jsx(mt,{params:{sourceFormCode:d,sourcePluginCode:a,pluginCode:e.context.params.pluginCode,formCode:e.context.params.formCode,guid:e.context.params.guid,pGuid:e.context.params.pGuid,originator:e.context.params.originator},properties:e.properties,checkedItems:s,redrawComponent:e.context.redrawComponent,eventDispatcher:e.methodProvider.eventDispatcher,execCommands:e.methodProvider.execCommands,formData:e.context.formData,formlayout:"folders",onFolderSelected:()=>{},onFolderAdded:()=>{},mode:"setup"})})}));Ya.displayName="_View";var Za=Ya;var sd=lazy(()=>import('./tabulator-W4MWHIJ4.js').then(t=>({default:t.TabulatorTable}))),md=lazy(()=>import('./datatable-ASYTOTYB.js').then(t=>({default:t.Datatable}))),Ae=class{static getFormComponent(e,n){if(e.displayName==="_Rowcontainer")return Hn;if(e.displayName==="_Rowsegment")return Gn;if(e.displayName==="_Textinput"){if(n.inputtype==="input")return qn;if(n.inputtype==="inputwcopy")return Qn;if(n.inputtype==="currency")return Oa;if(n.inputtype==="password")return Ua;if(n.inputtype==="date")return Ra;if(n.inputtype==="time")return ka;if(n.inputtype==="datetime")return Ba;if(n.inputtype==="phone")return La}else {if(e.displayName==="_TabBox")return Yn;if(e.displayName==="_Button")return Da;if(e.displayName==="_Label")return ta;if(e.displayName==="_CheckBox")return aa;if(e.displayName==="_Radio")return la;if(e.displayName==="_Textarea")return sa;if(e.displayName==="_SelectBox")return ua;if(e.displayName==="_Placeholder")return pa;if(e.displayName==="_Fileuploader")return Ca;if(e.displayName==="_Table")return n.alloweditrow||n.tablemode!==void 0&&n.tablemode==="tabulator"?sd:md;if(e.displayName==="_View")return Za}return e}};function or(t,e,n){var r=this,a=useRef(null),d=useRef(0),l=useRef(null),c=useRef([]),s=useRef(),m=useRef(),v=useRef(t),T=useRef(true);useEffect(function(){v.current=t;},[t]);var p=!e&&e!==0&&typeof window!="undefined";if(typeof t!="function")throw new TypeError("Expected a function");e=+e||0;var f=!!(n=n||{}).leading,u=!("trailing"in n)||!!n.trailing,g="maxWait"in n,y=g?Math.max(+n.maxWait||0,e):null;useEffect(function(){return T.current=true,function(){T.current=false;}},[]);var x=useMemo(function(){var M=function(F){var h=c.current,J=s.current;return c.current=s.current=null,d.current=F,m.current=v.current.apply(J,h)},C=function(F,h){p&&cancelAnimationFrame(l.current),l.current=p?requestAnimationFrame(F):setTimeout(F,h);},P=function(F){if(!T.current)return false;var h=F-a.current;return !a.current||h>=e||h<0||g&&F-d.current>=y},U=function(F){return l.current=null,u&&c.current?M(F):(c.current=s.current=null,m.current)},L=function F(){var h=Date.now();if(P(h))return U(h);if(T.current){var J=e-(h-a.current),Z=g?Math.min(J,y-(h-d.current)):J;C(F,Z);}},I=function(){var F=Date.now(),h=P(F);if(c.current=[].slice.call(arguments),s.current=r,a.current=F,h){if(!l.current&&T.current)return d.current=a.current,C(L,e),f?M(a.current):m.current;if(g)return C(L,e),M(a.current)}return l.current||C(L,e),m.current};return I.cancel=function(){l.current&&(p?cancelAnimationFrame(l.current):clearTimeout(l.current)),d.current=0,c.current=a.current=s.current=l.current=null;},I.isPending=function(){return !!l.current},I.flush=function(){return l.current?U(Date.now()):m.current},I},[f,g,e,y,u,p]);return x}var hd=Te__default.createContext(void 0),ar=({children:t,eventDispatcher:e,redrawComponent:n,formlayout:r,params:a,onFolderSelected:d,onFolderAdded:l,formData:c,execCommands:s$1})=>{let[m,v]=useState(r),{viewPort:T}=b(),[p,f]=useState(false),{t:u}=useTranslation(),g=()=>f(C=>!C),y=()=>f(false),x={viewHolder:{display:"flex",position:"relative"},toggleButton:{position:"absolute",top:"1em",right:"1em",zIndex:1e3,background:"#FFF",color:"#3f86cc ",border:"1px solid #3f86cc",borderRadius:"50%",width:"35px",height:"35px",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer"},toggleButtonMenuActive:{background:"#3f86cc",color:"#FFF "},btreeContainerMobile:{position:"fixed",top:0,left:p?0:"-16rem",height:"100%",width:"16rem",backgroundColor:"#F8F8F8",borderRight:"1px solid #C0C0C0",transition:"left 0.3s ease",zIndex:999,padding:"0.5rem"},btreeContainerDesktop:{borderRight:"1px solid #C0C0C0"},mainContent:{flex:1,margin:"1em"}},M=()=>jsx(Vl,{variant:"h6",sx:{padding:"0.5em",fontWeight:"bold",borderBottom:"1px dashed #C0C0C0"},children:u("My Folders")});return jsxs(hd.Provider,{value:{layout:m,setLayout:v},children:[(!r||r==="regular")&&t,r==="folders"&&jsxs("div",{className:"viewHolder",style:x.viewHolder,children:[T.isMobileDevice?jsxs(Fragment,{children:[!p&&jsx("button",{onClick:g,style:{...x.toggleButton,...x.toggleButtonMenuActive},children:s({size:"1.3rem"})}),jsx(fd,{open:p,onClick:y,sx:{zIndex:998,backgroundColor:"rgba(0, 0, 0, 0.5)"}}),jsxs("div",{style:x.btreeContainerMobile,onClick:C=>C.stopPropagation(),children:[jsx("div",{style:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingLeft:"0.5rem"}}),jsx(M,{}),jsx(mt,{params:{...a,sourcePluginCode:a.pluginCode,sourceFormCode:a.formCode},redrawComponent:n,eventDispatcher:e,execCommands:s$1,formData:c,formlayout:r,onFolderSelected:d,onFolderAdded:l,mode:"live"})]})]}):jsxs("div",{className:"foldersHolder",style:x.btreeContainerDesktop,children:[jsx(M,{}),jsx(mt,{params:{...a,sourcePluginCode:a.pluginCode,sourceFormCode:a.formCode},redrawComponent:n,eventDispatcher:e,execCommands:s$1,formData:c,formlayout:r,onFolderSelected:d,onFolderAdded:l,mode:"live"})]}),jsx("div",{style:x.mainContent,children:t})]})]})};var Id=lazy(()=>import('./fileviewer-3RB5ZB4B.js')),Fd=lazy(()=>import('./formeditor-GO2PMJQS.js').then(t=>({default:t.Formeditor}))),Tt=t=>new Promise(e=>setTimeout(e,t)),zt={command:{},params:{id:null,parentId:null,guid:"",pGuid:"",formCode:"",pluginCode:"",modal:false,modalCloseFn:()=>{},modalCloseAndOpenFn:()=>{},originator:{params:{pluginCode:"",formCode:"",guid:""}},parent:{widgetName:"",params:{pluginCode:"",formCode:"",guid:""}},hasParentForm:false,folderData:{id:"",label:"",isRoot:"",captions:[]}},doValidateForm:false,redrawComponent:false,redrawFoldersComponent:false,fieldAllowedValues:{},formData:{},widgetRelatedData:[],widgetsState:{visibility:{},readonly:{}},formDimension:{width:0,height:0},formValidationData:{},enableEventHandlers:false,isModal:false,hasParentForm:false,formLayout:"regular"},dr={containerSetup:{properties:{style:{minHeight:0}}},selectedWidgetProps:{title:"",subtitle:"",style:{},tabsetup:null,_path:{type:null,stricttype:null,component:null,tabId:null,panelId:null,rowId:null,segmentId:null,widgetId:null},lastActiveTabId:null}},Td={id:"",parentId:"",pluginCode:"",formCode:"",guid:null,pGuid:void 0,isFormEditorMode:false,originator:{params:{pGuid:"",pluginCode:"",formCode:"",guid:""}},parent:{widgetName:"",params:{pGuid:"",pluginCode:"",formCode:"",guid:""}},folderData:{id:"",addedFolderId:"",isRoot:"",captions:[]},prefillData:void 0},Dd=memo(function({previewMode:e,className:n,maxWidth:r,setup:a,params:d$1,enableEventHandlers:l,modalCloseFn:c}){var Kt,Xt;let s={...d$1,modalCloseFn:c||(d$1==null?void 0:d$1.modalCloseFn)},m=useRef(null),[v,T$1]=useState(0),{registerFormSubmitEvent:p,checkFormAccess:f$1}=i$1(),{apiConfig:u,appSettings:g,viewPort:y,runLoadFormEvent:x,runServerPingEvent:M,runFormEvent:C,fetchUserMenu:P$1,signInUser:U,signOut:L}=b(),[I,F]=useState(null),h=useNavigate(),[J,Z]=useState(false),ee=useRef({}),[b$1,V]=useState({}),[R,O]=useState(null),[j,B]=useState(null),S=useLocation(),[G]=useState(y.width),[re]=useState(s.modal||false),[pe]=useState(T.hasParentForm()||!!(u!=null&&u.token)),[ye,se]=useState([]),_=ye.length>0?ye[ye.length-1]:Td,[ce,Q]=useState(),[ue,we]=useState(true),{t:ge}=useTranslation(),H=e$1(),K=f(),E=g$2(),z={command:{},params:s,doValidateForm:false,redrawComponent:false,redrawFoldersComponent:false,fieldAllowedValues:{},formData:{},widgetRelatedData:[],widgetsState:{visibility:{},readonly:{}},formDimension:{width:v,height:0},formValidationData:{},enableEventHandlers:l,isModal:re,hasParentForm:pe,formLayout:"regular"},[o,te]=useState(z),[oe,ie]=useState({...dr,containerSetup:a}),Ne=or(()=>{m&&m.current&&T$1(m.current.offsetWidth);},200),ze=async(i,k)=>{await x({pluginCode:i.pluginCode,formCode:i.formCode,guid:i.guid,projectGuid:i.pGuid,pGuid:i.pGuid,originator:i.originator,parent:i.parent,previewMode:e,widgetContext:JSON.stringify({folderData:i.folderData,prefillData:i.prefillData})}).then(async D=>{var A,X,Y,ve,he,be,Fe,W;if(D.meta.requestStatus==="fulfilled"){let N={...D.payload};if(Object.keys(N).length===0)return;try{let me=window.location.hostname;if(!b$2.SKIP_ACCESS_VALIDATION_DOMAINS.some(We=>me===We||me.endsWith(`.${We}`))){let We=await f$1(i.formCode);(We==null?void 0:We.subscriptionPlan)!=null&&O(We.subscriptionPlan);}}catch(me){B({title:(X=(A=me==null?void 0:me.data)==null?void 0:A.error)!=null?X:"Form Unavailable",message:(ve=(Y=me==null?void 0:me.data)==null?void 0:Y.message)!=null?ve:"This form is temporarily unavailable."});return}if(N.uiTranslations&&Object.keys(N.uiTranslations).length>0){ee.current=N.uiTranslations,V(N.uiTranslations);let me=yd;me.addResourceBundle(me.language,"default",N.uiTranslations,true,true);}let Se={},de={visibility:{...o==null?void 0:o.widgetsState.visibility,...(he=N==null?void 0:N.widgetsState)==null?void 0:he.visibility},readonly:{...o==null?void 0:o.widgetsState.readonly,...(be=N==null?void 0:N.widgetsState)==null?void 0:be.readOnly}};if(k){te(me=>({...me,formData:N.data,fieldAllowedValues:N.fieldAllowedValues,widgetsState:de,formLayout:N.layout,requiredFields:N.requiredFields}));return}let De={},Le=[],Oe={},He=JSON.parse(N.definition);if(He==null){te({...z,redrawComponent:false,doValidateForm:false,command:{...N.FECommand},formData:{},widgetsState:de,formLayout:N.layout,requiredFields:N.requiredFields,params:{...z.params,folderData:N.folderData}});return}T.mapComponents(He._children);let Xe=He.properties;Le=He._children,Oe=He,ie({...oe,containerProps:Xe,selectedWidgetProps:{...oe.containerProps},containerData:Le,containerSetup:Oe}),Se=N.fieldAllowedValues,De=N.data,te({...z,formData:De,formLayout:N.layout,widgetsState:{visibility:{...o==null?void 0:o.widgetsState.visibility,...(Fe=N==null?void 0:N.widgetsState)==null?void 0:Fe.visibility},readonly:{...o==null?void 0:o.widgetsState.readonly,...(W=N==null?void 0:N.widgetsState)==null?void 0:W.readOnly}},requiredFields:N.requiredFields,command:{...N.FECommand},fieldAllowedValues:Se,params:{...z.params,folderData:N.folderData}}),Z(true);}});};if(useEffect(()=>(Ne(),ze(s,false),window.addEventListener("resize",Ne),()=>{te(()=>({...zt})),ie(dr),Z(false),window.removeEventListener("resize",Ne);}),[s.pGuid,s.guid,s.pluginCode,s.formCode]),useEffect(()=>{var X,Y,ve,he,be,Fe,W,N,Se,de,De,Le,Oe,He,Xe,me,Rt,We,Yt,Zt,eo,to,oo,no,ao,ro,io,lo,so,mo,co,uo,fo,po,go,ho,bo,vo,yo,wo,xo,Co,Io,Fo,To,Do,Po,Ro,So,Eo,ko,Mo,Bo,No,Lo,_o,Ao,Vo,Oo,Ho,Wo,Uo,Go,zo,$o,qo,Jo,jo,Qo,Ko,Xo,Yo,Zo,en,tn;let i=o,k=null,D=true,A=false;if((X=o.command)!=null&&X.Messages&&((Y=o.command)==null||Y.Messages.forEach(le=>{var Ee;let ae=(Ee=ee.current[le.text])!=null?Ee:ge(le.text);le.code==="NOTICE"?(A=true,E({toastID:nanoid(11),msg:ae,clearQueue:false,hideProgressBar:false})):le.code==="SUCCESS"?(A=true,K({toastID:nanoid(11),msg:ae,clearQueue:false,hideProgressBar:false})):le.code==="WARNING"&&(D=false,H({toastID:nanoid(11),msg:ae,clearQueue:false,hideProgressBar:false}));})),(ve=o.command)!=null&&ve.DisplayButtonLoader){te({...o,displayButtonLoader:true});return}if((he=o.command)!=null&&he.DisplayErrorPage){h("/pagenotfound");return}if((be=o.command)!=null&&be.MoveToTab){let le=(W=(Fe=o.command)==null?void 0:Fe.MoveToTab)==null?void 0:W.widgetName;if(le){let ae=T.getTabWidgetByFieldName(le,oe.containerSetup);ae!==null&&(ae==null?void 0:ae.tabId)!==void 0&&Ve(ae);}}if((N=o.command)!=null&&N.FormValidationData&&Object.keys(o.command.FormValidationData).length>0){let le=Object.keys(o.command.FormValidationData)[0];if(le){let ae=T.getTabWidgetByFieldName(le,oe.containerSetup);ae!==null&&(ae==null?void 0:ae.tabId)!==void 0&&Ve(ae),setTimeout(()=>{let Ee=[`[name="${le}"]`,`[data-field-name="${le}"]`,`#${le}`,`[id*="${le}"]`],Pe=null;for(let pt of Ee)try{if(Pe=document.querySelector(pt),Pe)break}catch(St){}Pe&&(Pe.scrollIntoView({behavior:"smooth",block:"center"}),(Pe.tagName==="INPUT"||Pe.tagName==="TEXTAREA"||Pe.tagName==="SELECT")&&Pe.focus());},100);}te({...o,doValidateForm:true,formValidationData:(Se=o.command)==null?void 0:Se.FormValidationData});return}else i={...i,formValidationData:{}};if((de=o.command)!=null&&de.FetchUserMenu&&P$1&&P$1({ProjectGuid:(Le=(De=o.command)==null?void 0:De.FetchUserMenu)==null?void 0:Le.projectGuid,pGuid:(He=(Oe=o.command)==null?void 0:Oe.FetchUserMenu)==null?void 0:He.projectGuid}),(Xe=o.command)!=null&&Xe.Redirect){s.modalCloseFn&&s.modalCloseFn(),h(`${(me=o.command)==null?void 0:me.Redirect.url}?ref=${(Yt=(We=(Rt=o.command)==null?void 0:Rt.Redirect)==null?void 0:We.context)==null?void 0:Yt.referer}`,{state:{from:(to=(eo=(Zt=o.command)==null?void 0:Zt.Redirect)==null?void 0:eo.context)==null?void 0:to.referer}});return}if((oo=o.command)!=null&&oo.BuildPlugin){h(`${(no=o.command)==null?void 0:no.BuildPlugin.url}?ref=${(ro=(ao=o.command)==null?void 0:ao.BuildPlugin)==null?void 0:ro.referer}`);return}if((io=o.command)!=null&&io.DisplayComponent&&F((lo=o.command)==null?void 0:lo.DisplayComponent),(so=o.command)!=null&&so.CloseDisplayComponent&&F(null),(mo=o.command)!=null&&mo.Login&&(async()=>{var le,ae,Ee,Pe,pt,St,on;U&&await U((le=o.command)==null?void 0:le.Login),P$1&&await P$1({ProjectGuid:T.extractProjectGuid((Ee=(ae=o.command)==null?void 0:ae.Login)==null?void 0:Ee.url),pGuid:T.extractProjectGuid((pt=(Pe=o.command)==null?void 0:Pe.Login)==null?void 0:pt.url)}),h(((on=(St=o.command)==null?void 0:St.Login)==null?void 0:on.url)||"/");})(),(co=o.command)!=null&&co.Logout&&(async()=>{var ae;(ae=o.command)!=null&&ae.Logout&&(L&&await L(),h("/"));})(),((uo=o.command)!=null&&uo.Cancel||(fo=o.command)!=null&&fo.CloseForm)&&(o.isModal&&s.modalCloseFn!==void 0?s.modalCloseFn(null,null,false,(po=o.command)==null?void 0:po.RedrawFolders):(k=T.getUrlParameter("ref"),k!=null&&h(k))),(go=o.command)!=null&&go.AfterRecordSave){let le=(ho=g==null?void 0:g.TOASTER_AUTOCLOSE)!=null?ho:b$2.TOASTER_AUTOCLOSE;if(k=T.getUrlParameter("ref"),((bo=o.command)==null?void 0:bo.AfterRecordSave.guid)==null)!((vo=o.command)!=null&&vo.OpenModal)&&s.modalCloseFn?s.modalCloseFn(null,null,false,null,null):(yo=o.command)!=null&&yo.OpenModal||(async()=>(await Tt(A?le:0),k!=null&&h(k)))();else if(o.isModal){let ae;(wo=o.command)!=null&&wo.HotReloadEnabled&&(ae=(xo=o.command)==null?void 0:xo.HotReloadEnabled),(Co=o.command)!=null&&Co.OpenModal||(async()=>{var Ee,Pe;await Tt(A?le:0),s.modalCloseFn&&s.modalCloseFn(ae,o.formData,(Ee=o.command)==null?void 0:Ee.RedrawScreen,(Pe=o.command)==null?void 0:Pe.RedrawFolders,null);})();}else {let ae=k!=null;if(!((Io=o.command)!=null&&Io.OpenModal)&&ae&&D)(async()=>(await Tt(A?le:0),k!=null&&h(k)))();else if(!((Fo=o.command)!=null&&Fo.OpenModal)){let Ee=S.pathname.replace(/\/new/gi,"/"+((To=o.command)==null?void 0:To.AfterRecordSave.guid.replace(/#/g,"%23")));h(Ee,{state:{from:S.pathname}}),i={...i,params:{...o.params,guid:(Do=o.command)==null?void 0:Do.AfterRecordSave.guid}};}}}if((Po=o.command)!=null&&Po.UpdateWidgetsState&&(i={...i,widgetsState:{visibility:{...i==null?void 0:i.widgetsState.visibility,...(So=(Ro=o.command)==null?void 0:Ro.UpdateWidgetsState)==null?void 0:So.visibility},readonly:{...i==null?void 0:i.widgetsState.readonly,...(ko=(Eo=o.command)==null?void 0:Eo.UpdateWidgetsState)==null?void 0:ko.readonly}}}),(Mo=o.command)!=null&&Mo.UpdateFieldAllowedValues&&(i={...i,fieldAllowedValues:{...(Bo=o.command)==null?void 0:Bo.UpdateFieldAllowedValues}}),(No=o.command)!=null&&No.UpdateFormData&&(i={...i,formData:{...(Lo=o.command)==null?void 0:Lo.UpdateFormData}}),(_o=o.command)!=null&&_o.UpdateFormDataItem&&(i={...i,formData:{...i.formData,[(Ao=o.command)==null?void 0:Ao.UpdateFormDataItem.name]:(Vo=o.command)==null?void 0:Vo.UpdateFormDataItem.value}}),((Ho=(Oo=o.command)==null?void 0:Oo.ReplaceContextRecordGuid)==null?void 0:Ho.guid)!=null&&(i={...i,displayButtonLoader:false,params:{...o.params,guid:(Wo=o.command)==null?void 0:Wo.ReplaceContextRecordGuid.guid}}),(Uo=o.command)!=null&&Uo.OpenModal){let le={...(Go=o.command)==null?void 0:Go.OpenModal,parentId:s.id};se(ae=>[...ae,le]),i={...i,command:{}};}(zo=o.command)!=null&&zo.PreviewDocument&&Q(($o=o.command)==null?void 0:$o.PreviewDocument),(qo=o.command)!=null&&qo.RedrawScreen&&(i={...i,redrawComponent:!o.redrawComponent,redrawFoldersComponent:!o.redrawFoldersComponent}),(Jo=o.command)!=null&&Jo.RedrawFolders&&(i={...i,params:{...o.params,folderData:{id:(Qo=(jo=o.command)==null?void 0:jo.RedrawFolders)==null?void 0:Qo.folderId,addedFolderId:(Xo=(Ko=o.command)==null?void 0:Ko.RedrawFolders)==null?void 0:Xo.folderId,isRoot:(Zo=(Yo=o.command)==null?void 0:Yo.RedrawFolders)==null?void 0:Zo.isRoot,captions:(tn=(en=o.command)==null?void 0:en.RedrawFolders)==null?void 0:tn.captions}}}),Object.keys(o.command).length>0&&(i={...i,command:{}},te(i));},[o.command]),j)return jsx(l$1,{title:j.title,message:j.message});if(!J)return Te__default.createElement("div",{},jsx(a$2,{message:ge("Please wait...")}));let Ke=(i,k)=>{let D={};return Object.entries(i).forEach(([A,X])=>{let Y=k[A];(Y==null||Y===""||Y==="0"||Y===0||Array.isArray(Y)&&Y.length===0)&&(D[A]=X);}),D},Ve=(i,k=false,D={})=>{let A=ut(null,i.tabId,i.index,k,D.containerSetup);if(A===void 0)return;let X=T.GetParentTabId(A.containerSetup,i.tabId);(X==null?void 0:X.tabId)!=null?(A=ut(null,X.tabId,X.index,false,A.containerSetup),A!==void 0&&Ve(X,true,A)):k===false&&ut(null,i.tabId,i.index,true);},xe=async i=>(te({...o,displayButtonLoader:true}),await C({pluginCode:i.pluginCode,formCode:i.formCode,guid:i.guid,projectGuid:i.projectGuid,pGuid:i.projectGuid,formData:{...i.formData,[i.fieldName]:i.value},widgetContext:JSON.stringify({referer:S.pathname,parentWidgetId:i.tabId,hasParentForm:T.hasParentForm(),originator:{widgetName:i.fieldName.toLowerCase(),params:o.params},parent:{widgetName:i.fieldName.toLowerCase(),params:o.params},parentOriginator:{params:o.params.originator?o.params.originator.params:{}},folderData:o.params.folderData}),widgetEvent:i.widgetEvent,widgetName:i.fieldName.toLowerCase(),widgetValue:i.widgetValue}).then(async k=>{var D,A,X,Y,ve,he,be,Fe;if(k.meta.requestStatus==="fulfilled"){let W={...k.payload};((D=W.FECommand)==null?void 0:D.ReplaceContextRecordGuid)!==void 0?(W.FECommand={Messages:(X=(A=W.FECommand)==null?void 0:A.Messages)!=null?X:[],UpdateFormData:W.data,ReplaceContextRecordGuid:(Y=W.FECommand)==null?void 0:Y.ReplaceContextRecordGuid},ot(W.FECommand)):(ve=W.FECommand)!=null&&ve.Messages?(W.FECommand={UpdateFormData:W.data,Messages:(he=W.FECommand)==null?void 0:he.Messages},ot(W.FECommand)):(be=W.FECommand)!=null&&be.FormValidationData&&(W.FECommand={FormValidationData:(Fe=W.FECommand)==null?void 0:Fe.FormValidationData},ot(W.FECommand));}else te({...o,displayButtonLoader:false});})),tt=i=>{let k=i.widgetContext,D=i.widgetEvent,A=i.widgetName.toLowerCase(),X=i.widgetValue,Y=i.feCommand||{},ve=i.skipFormDataItem||false;if(D!==null&&o.enableEventHandlers){if(i.autoSave){xe(i.autoSave);return}let he=X!=null&&ve===false?{...o.formData,[A]:X}:o.formData;if((D==null?void 0:D.toUpperCase())==="ONSAVE"&&o.requiredFields!=null){let be=Ke(o.requiredFields,he),Fe=Object.keys(o.formValidationData||{}).length>0,W=Object.keys(be).length>0;if((W||Fe)&&(te({...o,command:{...o.command,FormValidationData:be}}),W))return}(async()=>{var be,Fe;if((D==null?void 0:D.toUpperCase())==="ONSAVE")try{await p(o.params.formCode);}catch(W){if((W==null?void 0:W.status)===429)return}we(false),await C({pluginCode:o.params.pluginCode,formCode:o.params.formCode,guid:o.params.guid,projectGuid:(be=o.params.pGuid)!=null?be:"",pGuid:(Fe=o.params.pGuid)!=null?Fe:"",widgetContext:k,widgetEvent:D,widgetName:A,widgetValue:typeof X=="string"?X:X!=null?JSON.stringify(X):null,formData:he,widgetsState:o.widgetsState}).then(W=>{var N,Se;if(W.meta.requestStatus==="fulfilled"){if(W.payload instanceof Blob){te({...o,redrawComponent:!o.redrawComponent});return}let de={...W.payload};if(Object.keys(de).length===0)return;let De=JSON.parse(de.definition);if(De!=null){let Le=[],Oe={};T.mapComponents(De._children);let He=De.properties;Le=De._children,Oe=De,ie({...oe,containerProps:He,selectedWidgetProps:{...oe.selectedWidgetProps},containerData:Le,containerSetup:Oe});let Xe=A;if(Xe){let me=T.getTabWidgetByFieldName(Xe,Oe);me!==null&&(me==null?void 0:me.tabId)!==void 0&&Ve(me,true,{containerSetup:Oe});}}ve||(o.redrawComponent=false),te({...o,fieldAllowedValues:de.fieldAllowedValues,doValidateForm:true,command:{...de.FECommand},formData:{...o.formData,...de.data},widgetRelatedData:de.widgetRelatedData,widgetsState:{visibility:{...o==null?void 0:o.widgetsState.visibility,...(N=de==null?void 0:de.widgetsState)==null?void 0:N.visibility},readonly:{...o==null?void 0:o.widgetsState.readonly,...(Se=de==null?void 0:de.widgetsState)==null?void 0:Se.readOnly}},tabIndex:i.tabIndex?Number(i.tabIndex+1):0});}}).finally(async()=>{var W;if(we(true),(D==null?void 0:D.toUpperCase())==="ONSAVE"&&u!=null&&u.iframeMode&&u!=null&&u.token){let N=(W=oe.containerProps)==null?void 0:W.webhooks;if(Array.isArray(N)&&N.length>0){let Se={formCode:o.params.formCode,submittedAt:new Date().toISOString(),data:he};N.forEach(de=>{var De;de.enabled&&((De=de.url)!=null&&De.startsWith("http"))&&fetch(de.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Se),mode:"cors"}).then(Le=>{Le.ok||H({toastID:nanoid(11),msg:`Webhook failed: ${de.url}`,clearQueue:false,hideProgressBar:false});}).catch(Le=>{H({toastID:nanoid(11),msg:`Webhook failed: ${de.url}`,clearQueue:false,hideProgressBar:false});});});}}});})();}if(X!=null){let he={...o.formData,[A]:X};te({...o,command:Y,formData:he});}},Ce=(i,k,D)=>T.findRowItem(i,k,D,oe.containerSetup._children),rt=(i,k,D,A)=>T.findSegmentItem(i,k,D,A,oe.containerSetup._children),cr=i=>T.findWidgetByIdRecursive(oe.containerSetup._children,i),ur=(i,k)=>T.getActiveTabIndex(oe.containerSetup._children,k),ut=(i,k,D,A=true,X={})=>{let Y=Object.keys(X).length>0?X:oe.containerSetup,ve=T.getTabContainer(Y._children,k),he=T.getTabContainerChildrens(Y._children,k);if(he===void 0)return;for(let N=0;N<he.data.length;N++)he.data[N].activeTab="0";let be=he.data.filter((N,Se)=>Se===D)[0];be.properties={...ve.item.properties.tabsetup,...be.properties};let Fe=T.getNodeUpdatePath(he.path,{$splice:[[D,1,{...be,activeTab:"1"}]]});var W={containerSetup:{...Y,_children:(0, sr.default)(Y._children,Fe)},selectedWidgetProps:{...oe.selectedWidgetProps,tabsetup:{...be.properties},_path:{...oe.selectedWidgetProps._path,panelId:be.id},lastActiveTabId:k}};return A&&ie(W),W},fr=(i=true)=>{let k=zt;i&&(k={...o,redrawComponent:!o.redrawComponent,params:{...o.params,folderData:{id:"",isRoot:"",captions:[]}}}),te(k);},ot=i=>{te({...o,redrawComponent:!o.redrawComponent,command:{...i}});},$t=(i,k)=>{(async()=>{if(!M){i();return}await M({cmd:"ping"}).then(async D=>{(D==null?void 0:D.type)==="formbuilder/ping/rejected"?(H({toastID:nanoid(11),msg:"Application is being restarted. Please wait until it finishes....",clearQueue:false,hideProgressBar:false}),await Tt(1e3),$t(i)):i();});})();},Pt=(i,k=false,D,A=null)=>{$t(()=>{if(se(Y=>Y.slice(0,-1)),A!=null){let Y={...A,parentId:s.id};se(ve=>[...ve,Y]);}else if(i!=null){let Y={id:nanoid(5),pluginCode:i==null?void 0:i.pluginCode,formCode:i==null?void 0:i.formCode,guid:null,isFormEditorMode:true,parentId:s.id};se(ve=>[...ve,Y]);}if(ze(o.params,true),D){let Y=D==null?void 0:D.folderId;qt(Y,[]);}else te({...o,redrawComponent:!o.redrawComponent});}),k&&o.isModal&&ze(s,true);},pr=(i,k="",D)=>{let A={...o,redrawFoldersComponent:!o.redrawFoldersComponent,redrawComponent:!o.redrawComponent,params:{...o.params,folderData:{...o.params.folderData,addedFolderId:"",captions:D,id:i!==null?i:"",isRoot:k}}};te(A);},qt=(i,k)=>{let D=zt;i==null?D={...o,redrawFoldersComponent:!o.redrawFoldersComponent,params:{...o.params,folderData:{...o.params.folderData,addedFolderId:i!==null?i:"",captions:k}}}:D={...o,params:{...o.params,folderData:{...o.params.folderData,id:i!==null?i:"",addedFolderId:i!==null?i:"",isRoot:"",captions:k}}},te(D);},Jt=i=>{i&&se(k=>[...k.slice(0,-1),{...i,id:nanoid(5)}]);},gr=()=>{Q(void 0);},hr=()=>F(null),br=i=>{let{title:k,subtitle:D}=i,A=k;return D!==void 0&&String(D).trim()!==""&&(A=k+" - "+D),o.enableEventHandlers&&Object.keys((o==null?void 0:o.formData)||{}).length>0&&Object.entries(o.formData).forEach(([X,Y])=>{A=A.replace(`#${X}`,Y);}),A},{properties:Ie}=oe.containerSetup||{},{minHeight:jt}=(Ie==null?void 0:Ie.style)||{},ft={};jt&&(ft.minHeight=jt),re&&(ft={...ft,width:"100%",minWidth:G-G*.3,maxHeight:"calc(100dvh - 4rem)",overflow:"auto"});let Qt={};return e&&(Qt={overflowY:"scroll",height:"100vh",padding:"0px 10px 10px 10px"}),jsx(k$1.Provider,{value:R,children:jsx(ba.Provider,{value:b$1,children:jsxs(ar,{execCommands:ot,eventDispatcher:tt,redrawComponent:o.redrawFoldersComponent,formlayout:o.formLayout,params:o.params,onFolderSelected:pr,onFolderAdded:qt,formData:o.formData,children:[jsxs("div",{id:"main-content-wrapper",className:n,children:[jsx("div",{className:"content",children:jsx("div",{className:"main-content on-scrollbar",style:Qt,children:jsxs("div",{id:"formCanvas",ref:m,style:{maxWidth:r,border:(Ie==null?void 0:Ie.border)===false?"none":void 0},children:[jsxs("form",{onSubmit:i=>{i.preventDefault();},style:{position:"relative"},children:[Ie&&!Ie.hideheader&&jsxs("div",{className:"form-header top-border-radius",style:{backgroundColor:(Ie==null?void 0:Ie.headerbackground)===false?"transparent":void 0},children:[jsx("div",{style:{flex:1,marginLeft:"0.5rem"},children:Ie&&br(Ie)}),re&&s.modalCloseFn!==void 0&&jsx("div",{style:{width:"2.5em"},children:jsx(lr,{onClick:()=>s.modalCloseFn(null),children:Te__default.createElement(P)})})]}),Ie&&Ie.hideheader&&re&&s.modalCloseFn!==void 0&&jsx("div",{style:{position:"absolute",top:"0.5rem",right:"0.5rem",zIndex:9999},children:jsx(lr,{size:"medium",onClick:i=>{i.stopPropagation(),s.modalCloseFn(null);},sx:{backgroundColor:"rgba(255, 255, 255, 0.95)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"}},children:Te__default.createElement(P)})}),jsx("div",{style:ft,className:"form-container bottom-border-radius",children:jsx("div",{className:"form-container",children:jsx(m$1,{darkMode:false,noPadding:true,children:jsx(Suspense,{fallback:jsx(a$2,{}),children:jsx(Pd,{eventDispatcher:tt,context:o,formWidth:v,findRowItem:Ce,findSegmentItem:rt,findWidgetItem:cr,modal:re,getActiveTabIndex:ur,setActiveTabIndex:ut,setRedrawComponent:fr,execCommands:ot,widgets:oe.containerSetup})})})})})]}),I!==null&&jsx(d,{componentName:I.componentName,options:I.options,params:{params:(Kt=I.options)!=null&&Kt.contextParams?(Xt=I.options)==null?void 0:Xt.contextParams:o.params,formData:o.formData,execCommands:i=>ot(i),modalCloseFn:()=>hr(),modalCloseAndOpenFn:i=>Jt(i)}})]})})}),(R==null?void 0:R.toLowerCase())==="free"&&!re&&jsxs("div",{style:{textAlign:"center",padding:"12px 16px",fontSize:"13px",color:"#aaa"},children:["Powered by"," ",jsx("a",{href:"https://buildocs.com",target:"_blank",rel:"noopener noreferrer",style:{color:"#3498db",textDecoration:"none",fontWeight:500},children:"Buildocs"})]})]}),!ue&&jsx(a$2,{message:ge("Please wait...")}),!_.isFormEditorMode&&ce&&ce.fileId&&jsx(Suspense,{fallback:jsx(a$2,{message:ge("Loading viewer...")}),children:jsx(Id,{fileId:ce.fileId,fileBase64:ce.data,fieldName:ce.fieldName,params:{...ce.context?ce.context:o.params,modalCloseFn:gr}},nanoid(11))}),!_.isFormEditorMode&&(_==null?void 0:_.pluginCode)&&(_==null?void 0:_.formCode)&&jsx(a$3,{component:jsx(Dd,{params:{id:_.id,parentId:_.parentId,pluginCode:_.pluginCode,formCode:_.formCode,guid:_.guid==null?"new":_.guid,pGuid:_.pGuid,modal:true,modalCloseFn:(i,k,D,A,X=null)=>Pt(i,D,A,X),modalCloseAndOpenFn:i=>Jt(i),originator:_.originator,parent:_.parent,folderData:_.folderData,prefillData:_.prefillData},enableEventHandlers:true}),id:_.id,onCloseModal:Pt,parentId:_.parentId},_.id),_.isFormEditorMode&&(_==null?void 0:_.pluginCode)&&(_==null?void 0:_.formCode)&&jsx(a$3,{component:jsx(Suspense,{fallback:jsx(a$2,{}),children:jsx(Fd,{inPreviewMode:false,pluginCode:_.pluginCode,formCode:_.formCode,modal:true},nanoid(11))}),id:_.id,onCloseModal:()=>Pt(null,false,null),parentId:_.parentId,windowMode:"fullWindow"},_.id)]})})})}),Pd=t=>{let e=0,n=r=>{for(var a in r)typeof r[a]=="object"&&r[a]!==null?n(r[a]):a==="tabIndex"&&(t.modal?r[a]=0:r[a]=++e);};return n(t.widgets._children),(t.widgets._children||[]).map(({id:r,tabId:a,panelId:d,type:l,component:c,properties:s})=>Te__default.createElement(Ae.getFormComponent(c,s),{key:"key_"+r,id:r,tabId:a,panelId:d,className:l,context:{...t.context,formDimension:{width:t.formWidth,height:0}},properties:s,widgetsState:t.context.widgetsState,methodProvider:{eventDispatcher:t.eventDispatcher,findRowItem:t.findRowItem,findSegmentItem:t.findSegmentItem,findWidgetItem:t.findWidgetItem,getActiveTabIndex:t.getActiveTabIndex,setActiveTabIndex:t.setActiveTabIndex,setRedrawComponent:t.setRedrawComponent,execCommands:t.execCommands}},r))};
2
- export{An as a,Dd as b};
@@ -1 +0,0 @@
1
- import {d}from'./chunk-SYCZSSRF.js';import {a}from'./chunk-POE6K4NQ.js';import {e,b as b$1}from'./chunk-FRAOYRZD.js';import {U,T,k}from'./chunk-KW32CT2P.js';import'./chunk-U4T4ACDE.js';import {b}from'./chunk-LBMVBVXW.js';import {d as d$1,t,p,V,h,q,g,N,_,Y,W,X,Z,P,r,n,i,w,A,b as b$2,y,x,C,l,O,o}from'./chunk-AR42AC7J.js';import'./chunk-5TBO732O.js';import mt,{lazy,memo,useRef,useState,useEffect,useCallback,useMemo,Suspense}from'react';import {withTranslation,useTranslation}from'react-i18next';import qn from'@mui/material/CircularProgress';import Xt from'@mui/material/Box';import Fe from'@mui/material/Button';import $n from'@mui/material/Checkbox';import Kn from'@mui/material/ClickAwayListener';import Kt from'@mui/material/IconButton';import Qe from'@mui/material/ListItemIcon';import Xe from'@mui/material/ListItemText';import Ze from'@mui/material/MenuItem';import Qn from'@mui/material/MenuList';import re from'@mui/material/Tooltip';import {nanoid}from'@reduxjs/toolkit';import {useNavigate,useLocation}from'react-router-dom';import en from'@mui/material/Menu';import Zn from'axios';import ea from'@mui/icons-material/MoreVert';import {jsx,Fragment,jsxs}from'react/jsx-runtime';var ta=lazy(()=>import('./buildocslib.esm-AQXFL65L.js').then(c=>({default:c.DatatableImb}))),na="#1976d2";var gt=(r=>(r[r.SIGN=0]="SIGN",r[r.CONFIRM=1]="CONFIRM",r))(gt||{}),tn=(l=>(l[l.SIGN=0]="SIGN",l[l.CONFIRM=1]="CONFIRM",l[l.EDIT=2]="EDIT",l))(tn||{}),et=(c,e,r,l,g)=>{var le,G,se,E,b;return e.methodProvider.eventDispatcher({skipFormDataItem:true,widgetName:e.properties.name.toLowerCase(),widgetValue:JSON.stringify({action:c,rowData:{_id:(le=r._id)!=null?le:null,_sk:(G=r._sk)!=null?G:null,_code:(se=r._fcode)!=null?se:r._code,_origformcode:(E=r._origformcode)!=null?E:null,_plugincode:(b=r._plcode)!=null?b:r._plugincode}}),widgetEvent:U.onTableRunActionEvent,widgetContext:JSON.stringify({referer:l.pathname,parentWidgetId:g,hasParentForm:T.hasParentForm(),originator:{widgetName:e.properties.name.toLowerCase(),params:e.context.params},parent:{widgetName:e.properties.name.toLowerCase(),params:e.context.params},folderData:e.context.params.folderData})})},Se=(c,e)=>{var r,l;return !(c==="file"&&e.formLayout==="folders"&&((r=e.params.folderData)!=null&&r.isRoot||((l=e.params.folderData)==null?void 0:l.id)===null))},aa=({anchorEl:c,handleClose:e$1,setUploadMode:r,uploadMode:l,props:g,setLoaded:le})=>{let{runFormUploadFiles:G}=b(),se=e(),E=!!c,b$1=useRef(null),[ie,q]=useState([]),{t:ce}=useTranslation(),te=(de="file")=>{if(!Se(de,g.context)){se({toastID:nanoid(11),msg:ce("Please select a folder before uploading a file"),clearQueue:false,hideProgressBar:false});return}b$1.current&&b$1.current.click(),r(de),e$1();},$=async de=>{var m,R;let me=de.target.files;if(me){le(false);let F=Array.from(me).map(T=>({...T,uploadProgress:0})),x=new FormData;if(g.context.params)for(let T in g.context.params)g.context.params.hasOwnProperty(T)&&x.append(T,g.context.params[T]);x.append("fieldName",g.properties.name),Array.from(me).forEach(T=>{x.append("files",T);}),x.append("widgetContext",JSON.stringify({hasParentForm:T.hasParentForm(),originator:(m=g.context.params)==null?void 0:m.originator,folderData:(R=g.context.params)==null?void 0:R.folderData})),x.append("widgetEvent",U.onFileUploadCreateDocumentEvent),x.append("widgetName","attached_files"),x.append("formData",JSON.stringify({...g.context.formData})),x.append("uploadMode",l);let B=Zn.CancelToken.source();try{let T=await G({content:x,cancelTokenSource:B,onUploadProgress:X=>{let he=Math.round(X.loaded/F.length),ye=F.map(be=>({...be,uploadProgress:X.loaded===X.total?100:Math.round(he*100/be.size)}));q(be=>be.concat(ye));}});if(T.meta.requestStatus==="fulfilled"){let X={...T.payload};g.methodProvider.execCommands(X.FECommand);}}catch(T){}b$1.current&&(b$1.current.value="");}},Te=Se("file",g.context)?"inherit":"#C0C0C0";return jsxs(Fragment,{children:[jsx("input",{type:"file",name:"files",ref:b$1,style:{display:"none"},onChange:$,multiple:true}),jsxs(en,{anchorEl:c,open:E,onClose:e$1,MenuListProps:{"aria-labelledby":"upload-button"},children:[jsxs(Ze,{onPointerUp:()=>te("file"),children:[jsx(Qe,{sx:{color:Te},children:jsx(Pe,{action:"uploadfile",applyInternalStyle:true})}),jsx(Xe,{primary:ce("Upload File(s)"),primaryTypographyProps:{fontSize:"0.875rem",color:Te}})]},"Upload File(s)"),jsxs(Ze,{onPointerUp:()=>te("container"),children:[jsx(Qe,{children:jsx(Pe,{action:"uploadzipfile",applyInternalStyle:true})}),jsx(Xe,{primary:ce("Upload .ZIP Archive"),primaryTypographyProps:{fontSize:"0.875rem"}})]},"Upload .ZIP Archive")]})]})},oa=(c,e,r,l)=>(c._plugincode=e.context.params.pluginCode,c._origformcode=c._code=e.context.params.formCode,et("onrowcheckboxclicked",e,c,r,l)),ia=({value:c,style:e})=>{let[r,l]=mt.useState(false),g=mt.useRef(null);return jsx(re,{title:String(c!=null?c:"").trim()?c:"No data",open:r,arrow:true,children:jsx("div",{ref:g,style:e,onMouseEnter:()=>{g.current&&g.current.scrollWidth>g.current.clientWidth&&l(true);},onMouseLeave:()=>l(false),children:c||""})})},ft=c=>!!(c.readonly&&!c.ignorereadonly),ct=c=>{let e=c.replace(/\s/g,""),r=e.lastIndexOf(","),l=e.lastIndexOf("."),g;return r>l?g=e.replace(/\./g,"").replace(",","."):l>r?g=e.replace(/,/g,""):g=e,parseFloat(g)},Qt=(c,e,r,l)=>c===0?"first":c<e?"previous":l>0&&(c+1)*r>=l?"last":"next",dt={rowsPerPage:0,pageIndex:0,serverPaginationEnabled:false,nextToken:"",paginationDirection:"first",previousToken:"",rowCount:0,qId:""},ra={string:"freetext",freetext:"freetext",currency:"price",price:"price",date:"date",datetime:"datetime",number:"number",checkbox:"checkbox"},nn=withTranslation()(memo(function(e$1){var bt,Ct,Dt;let r$1=useRef(false),{runFormEvent:l,viewPort:g$1}=b(),le=e(),{UserDialog:G}=b$1(),se=e$1.properties.name,E=d(se,e$1.properties.pagesize||50),{pageIndex:b$2,pageSize:ie}=E,[q$1,ce]=useState(null),[te,$]=useState(false),[Te,de]=useState("single"),[me,m]=useState([]),[R,F]=useState(0),[x,B]=useState(),[T$1,X$1]=useState(),[he,ye]=useState(false),[be,Be]=useState(false),[I,P$1]=useState({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}}),[M,O]=useState(true),[Z$1,Oe]=useState({}),ee=useRef(e$1),ve=useRef(e$1.context.formData);useEffect(()=>{ee.current=e$1;},[e$1]),useEffect(()=>{ve.current=e$1.context.formData;},[e$1.context.formData]);let[sa,an]=useState((bt=e$1.context)==null?void 0:bt.widgetRelatedData),ke=useCallback(async(a,t,i,d,o)=>{$(false),await l({pluginCode:t.context.params.pluginCode,formCode:t.context.params.formCode,guid:t.context.params.guid,projectGuid:t.context.params.pGuid,pGuid:t.context.params.pGuid,formData:t.context.formData,widgetContext:JSON.stringify({referer:d.pathname,parentWidgetId:o,hasParentForm:T.hasParentForm(),originator:{widgetName:t.properties.name.toLowerCase(),params:t.context.params},parent:{widgetName:t.properties.name.toLowerCase(),params:t.context.params},parentOriginator:{params:t.context.params.originator?t.context.params.originator.params:{}},folderData:t.context.params.folderData}),widgetEvent:U.onTableEditRunActionEvent,widgetName:t.properties.name.toLowerCase(),widgetValue:JSON.stringify({action:a,data:i})}).then(u=>{var w;if(u.meta.requestStatus==="fulfilled"){let y={...u.payload};y.FECommand={...y.FECommand,UpdateFieldAllowedValues:y.fieldAllowedValues,UpdateFormData:y.data,UpdateFormDataItem:{name:t.properties.name,value:(w=y.data)==null?void 0:w[t.properties.name]}},t.methodProvider.execCommands(y.FECommand);}});},[]),Ie=useCallback(async(a,t,i,d,o,u)=>{$(false),u.toggleAllRowsSelected(false),await l({pluginCode:t.context.params.pluginCode,formCode:t.context.params.formCode,guid:t.context.params.guid,projectGuid:t.context.params.pGuid,pGuid:t.context.params.pGuid,widgetContext:JSON.stringify({referer:d.pathname,parentWidgetId:o,hasParentForm:T.hasParentForm(),originator:{widgetName:t.properties.name.toLowerCase(),params:t.context.params},parent:{widgetName:t.properties.name.toLowerCase(),params:t.context.params},parentOriginator:{params:t.context.params.originator?t.context.params.originator.params:{}},folderData:t.context.params.folderData}),widgetEvent:U.onTableRunBatchActionEvent,widgetName:t.properties.name.toLowerCase(),widgetValue:JSON.stringify({action:a,data:i})}).then(w=>{if(w.meta.requestStatus==="fulfilled"){let y={...w.payload};y.widgetData&&m(Object.values(y.widgetData)),O(true),$(true),y.FECommand&&t.methodProvider.execCommands(y.FECommand);}});},[e$1.context.params.pluginCode,e$1.context.params.formCode,e$1.context.params.guid,e$1.context.params.pGuid,e$1.properties.name,e$1.context.formData]),on=useCallback((a,t,i,d,o,u)=>{a&&(i.properties.alloweditrow?ke("delete",i,JSON.stringify(d),o,u):et(t,i,d,o,u)),P$1({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}});},[e$1.properties.alloweditrow]),pt=useCallback((a,t,i,d,o,u,w)=>{a&&Ie(t,i,d,u,w,o),P$1({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}});},[Ie,P$1]),rn=a=>I.delete.callBackFunc(a),tt=a=>{P$1(a);},{alloweditrow:Ce,backendpagination:ne,colactions:ln,colgrouping:sn,colordering:cn,colresizing:dn,enableuploadfiles:mn,height:un,hideaddbutton:gn,newrecordurl:xt,folders:ze,pagination:fn,pagesize:Ue,rowactions:yn,rowactiontype:Ve,rowclickas:He,rowdensity:pn,rownumber:xn,rowselection:wn,rowvirtualization:hn,search:bn,searchtype:Ge,selectall:Cn,stickyheader:Dn,toolbarInternalActions:Rn,topToolbar:_n,visible:Fn}=e$1.properties,nt=fn===true,Tn=hn!==false&&!nt,In=nt,wt=Ve==="flat"||Ve==="menu"||Ve==="primary",at=useNavigate(),_$1=useLocation(),{tabId:v}=e$1,{t:K,i18n:ot}=useTranslation(),W$1=(Ct=ot==null?void 0:ot.language)==null?void 0:Ct.substring(0,2),ht=useCallback((a,t)=>{E.setLastEvaluatedKey(Number(a),t||null);},[E]),We=useCallback(a=>E.getLastEvaluatedKey(Number(a)),[E]),Le=useCallback(async(a,t,i,d,o)=>{var k,L;$(false),a&&(F(0),B(null),X$1(dt));let u=Qt(i.pageIndex,b$2,i.pageSize,R),w=We(i.pageIndex-1),y=u==="last"?"":d;he&&u!=="last"&&(u==="next"&&(y=We(i.pageIndex+1)),u==="previous"&&(w=We(i.pageIndex+1))),await l({DataTableMeta:{serverPaginationEnabled:ne,rowsPerPage:i.pageSize,pageIndex:i.pageIndex,nextToken:y,previousToken:w,paginationDirection:u==="last"?"last":t,rowCount:R,qId:o==null?void 0:o.qId,lastRequestLimit:o==null?void 0:o.lastRequestLimit,oppositeDirection:u==="last"||he},pluginCode:e$1.context.params.pluginCode,formCode:e$1.context.params.formCode,guid:e$1.context.params.guid,projectGuid:e$1.context.params.pGuid,pGuid:e$1.context.params.pGuid,widgetContext:JSON.stringify({referer:_$1.pathname,parentWidgetId:v,hasParentForm:T.hasParentForm(),originator:(k=e$1.context.params)==null?void 0:k.originator,parent:e$1.context.params,folderData:(L=e$1.context.params)==null?void 0:L.folderData}),widgetEvent:Ce?U.onTableEditDataLoad:U.onTableDataLoad,widgetName:e$1.properties.name.toLowerCase(),formData:e$1.context.formData}).then(ae=>{var ue,N,j,pe,S,qe,ge,xe,Ae;if(ae.meta.requestStatus==="fulfilled"){let z={...ae.payload},U=(ue=z.data)==null?void 0:ue[e$1.properties.name];if(Array.isArray(z.widgetData)&&z.widgetData.length===0&&typeof U=="string"&&U.trim()!==""&&U!=="null"&&U!=="undefined"){let f=JSON.parse(U);m(f!=null?f:{});}else m(Object.values((N=z.widgetData)!=null?N:{})),F((pe=(j=z.tableMeta)==null?void 0:j.rowCount)!=null?pe:0),B((qe=(S=z.tableMeta)==null?void 0:S.nextToken)!=null?qe:null),X$1((ge=z.tableMeta)!=null?ge:{}),(xe=z.tableMeta)!=null&&xe.nextToken&&ht(i.pageIndex,(Ae=z.tableMeta)==null?void 0:Ae.nextToken),Be(false),z.widgetRelatedData&&Object.keys(z.widgetRelatedData).length>0&&(ee.current.context.widgetRelatedData=z.widgetRelatedData);O(a),$(true);}});},[ne,Ce,We,he,_$1.pathname,b$2,e$1.context.formData,e$1.context.params,e$1.properties.name,R,O,$,B,Be,F,m,X$1,ht,v]),Mn=useCallback(a=>{if(r$1.current&&!ne){r$1.current=false;return}let t;typeof a=="function"?t=a({pageIndex:b$2,pageSize:ie}):t=a;let i=Qt(t.pageIndex,b$2,t.pageSize,R);if(te&&M&&b$2>0){O(false);return}t.pageIndex!==b$2&&E.setPageIndex(Number(t.pageIndex)),t.pageSize!==ie&&E.setPageSize(Number(t.pageSize)),(ne&&t.pageIndex!==b$2||t.pageSize!==ie)&&(Be(true),i==="last"&&ye(true),i==="first"&&ye(false),Le(false,i,t,x,T$1));},[ne,b$2,R,te,M,ie,Le,x,T$1]);useEffect(()=>{var a;an((a=e$1.context)==null?void 0:a.widgetRelatedData);},[(Dt=e$1.context)==null?void 0:Dt.widgetRelatedData]),useEffect(()=>{r$1.current=true,E.reset(Number(Ue));},[e$1.properties.name,e$1.context.params]),useEffect(()=>{var a;if(Ce){let t=(a=e$1.context.formData)==null?void 0:a[e$1.properties.name];if(t){let i=typeof t=="string"?JSON.parse(t):t;m(i);}}},[e$1.context.formData]),useEffect(()=>{(async()=>{var a,t,i,d;if(e$1.context.enableEventHandlers){if(e$1.context.formLayout==="folders"&&!((t=(a=e$1.context.params)==null?void 0:a.folderData)!=null&&t.id)&&!((d=(i=e$1.context.params)==null?void 0:i.folderData)!=null&&d.isRoot))return;ne?b$2===0?Le(true,"first",{pageIndex:0,pageSize:Ue||100},"",dt):Le(false,"current",{pageIndex:b$2,pageSize:ie},x,T$1):Le(true,"first",{pageIndex:0,pageSize:Ue||100},"",dt);}else $(true);})();},[e$1.properties.name,e$1.context.redrawComponent,Ce,ne]);let je=e$1.methodProvider.findWidgetItem(e$1.id),Ne=[],Ye={};(je.item.properties.datasource.columns||[]).forEach(a=>{var t;Ne[a[1]]=a[0],a[2]&&(Ye[a[1]]=(t=ra[a[2]])!=null?t:"freetext");});let Sn=(je.item._children||[]).some(({properties:a})=>{var i,d;if(!a.item_bottomcalc)return false;let t=(d=(i=Ye[a.item_name])!=null?i:a.item_columntype)!=null?d:a.item_isprice?"price":"freetext";return t==="price"||t==="number"}),Pn=useMemo(()=>{let a$1=[];return (je.item._children||[]).map(({properties:t})=>{var i,d,o,u,w,y,k$1,L,ae,ue,N,j,pe;if(t.item_name.toString()!==""){let S=(i=Ye[t.item_name])!=null?i:"";S||(S=(d=t.item_columntype)!=null?d:"freetext",t.item_columntype||(t.item_isdate===true?S="date":t.item_isdatetime===true?S="datetime":t.item_ischeckbox===true?S="checkbox":t.item_isprice===true?S="price":S="freetext"));let qe=S==="checkbox",ge=S==="price",xe=S==="number",Ae=S==="date",z=S==="datetime",U={};qe?U={accessorKey:t.item_name,muiTableHeadCellProps:{align:(o=t.style.item_textalign)!=null?o:"left"},muiTableBodyCellProps:{align:(u=t.style.item_ctextalign)!=null?u:"left"},header:(w=Ne[t.item_name])!=null?w:t.item_title,Header:()=>{var s;let f=(s=Ne[t.item_name])!=null?s:t.item_title;return t.item_displaytooltip?jsx(re,{title:f,arrow:true,children:jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:f})}):jsx("span",{children:f})},Cell:({row:f})=>{var s;return jsx("span",{style:{borderBottom:"none",padding:"0px",height:"36px"},children:jsx($n,{checked:Array.isArray((s=ee.current.context)==null?void 0:s.widgetRelatedData)&&ee.current.context.widgetRelatedData.includes(f.original._sk),onPointerUp:()=>oa(f.original,ee.current,_$1,v),style:{margin:0}})})},size:parseInt(t.item_minsize,10)||void 0,enableSorting:(y=t.item_enablesorting)!=null?y:false,enableHiding:(k$1=t.item_visible)!=null?k$1:true,grow:true}:(U={accessorKey:t.item_name.toString(),muiTableHeadCellProps:{align:(L=t.style.item_textalign)!=null?L:"left"},muiTableBodyCellProps:{align:(ae=t.style.item_ctextalign)!=null?ae:"left"},header:(ue=Ne[t.item_name])!=null?ue:t.item_title.toString(),Header:()=>{var s;let f=(s=Ne[t.item_name])!=null?s:t.item_title.toString();return t.item_displaytooltip?jsx(re,{title:f,arrow:true,children:jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:f})}):jsx("span",{children:f})},size:parseInt(t.item_minsize,10)||void 0,enableSorting:(N=t.item_enablesorting)!=null?N:false,enableHiding:t.item_visible===true,grow:true,muiEditTextFieldProps:{required:true,error:!!(Z$1!=null&&Z$1.firstName),helperText:Z$1==null?void 0:Z$1.firstName,onFocus:()=>Oe({...Z$1,[t.item_name.toString()]:void 0})},Cell:({cell:f})=>{var A;let s=(A=f.getValue())!=null?A:"";if(ge&&s){let p=ct(s);if(!isNaN(p)){let h=t.item_fixedlocale||"",Y=t.item_format==="fixed-locale"&&h?h:W$1||void 0,D=t.item_inputfield&&ve.current&&ve.current[t.item_inputfield]||""||t.item_currency||"",De=t.item_format==="locale"?k(W$1!=null?W$1:""):t.item_format==="fixed-locale"&&h?k(h):void 0,Re=D||De||"";try{let we=t.item_currencydisplay||"";Re&&we!==""?s=new Intl.NumberFormat(Y,{style:"currency",currency:Re,currencyDisplay:we,minimumFractionDigits:2,maximumFractionDigits:2}).format(p):s=new Intl.NumberFormat(Y,{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}).format(p);}catch(we){s=p.toFixed(2);}}}if(xe&&s){let p=ct(s);isNaN(p)||(s=p.toLocaleString());}if(Ae&&s){let p=(()=>{if(/^\d{4}-\d{2}-\d{2}/.test(s)){let h=a(s);if(h.isValid())return h}return a(s,"DD.MM.YYYY",true)})();if(p.isValid())try{s=new Intl.DateTimeFormat(W$1||void 0,{dateStyle:"short"}).format(p.toDate());}catch(h){}}if(z&&s){let p=(()=>{if(/^\d{4}-\d{2}-\d{2}/.test(s)){let h=a(s);if(h.isValid())return h}return a(s,"DD.MM.YYYY HH:mm",true)})();if(p.isValid())try{s=new Intl.DateTimeFormat(W$1||void 0,{dateStyle:"short",timeStyle:"short"}).format(p.toDate());}catch(h){}}return t.item_displaytooltip?jsx(ia,{value:s,style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:`${parseInt(t.item_maxsize,10)||150}px`,minWidth:"50px",cursor:"default"}}):jsx(Fragment,{children:s})}},t.item_bottomcalc&&(ge||xe)&&(U.muiTableFooterCellProps={align:(pe=(j=t.style)==null?void 0:j.item_ctextalign)!=null?pe:"left"},U.Footer=({table:f})=>{var Y,C;let s=(Y=f.getState().creatingRow)==null?void 0:Y.id,A=(C=f.getState().editingRow)==null?void 0:C.id,p=f.getFilteredRowModel().rows.reduce((D,De)=>{if(De.id===s||De.id===A)return D;let Re=De.getValue(t.item_name.toString()),we=ct(String(Re!=null?Re:""));return D+(isNaN(we)?0:we)},0),h=p.toLocaleString(W$1||void 0,{minimumFractionDigits:ge||xe?2:0,maximumFractionDigits:ge||xe?2:0});if(ge){let D=t.item_fixedlocale||"",De=t.item_format==="fixed-locale"&&D?D:W$1||void 0,we=t.item_inputfield&&ve.current&&ve.current[t.item_inputfield]||""||t.item_currency||"",Hn=t.item_format==="locale"?k(W$1!=null?W$1:""):t.item_format==="fixed-locale"&&D?k(D):void 0,Rt=we||Hn||"",_t=t.item_currencydisplay||"";if(Rt&&_t!=="")try{h=new Intl.NumberFormat(De,{style:"currency",currency:Rt,currencyDisplay:_t,minimumFractionDigits:2,maximumFractionDigits:2}).format(p);}catch(ma){h=p.toFixed(2);}}return jsx("b",{children:h})})),Ae?U.sortingFn=(f,s,A)=>{let p=f.getValue(A),h=s.getValue(A),Y=C=>{if(!C)return a("1900-01-01");if(/^\d{4}-\d{2}-\d{2}/.test(C)){let D=a(C);if(D.isValid())return D}return a(C,"DD.MM.YYYY",true)};try{let C=Y(p),D=Y(h);return C.isBefore(D)?-1:C.isAfter(D)?1:0}catch(C){return 0}}:z?U.sortingFn=(f,s,A)=>{let p=f.getValue(A),h=s.getValue(A),Y=C=>{if(!C)return a("1900-01-01T00:00:00");if(/^\d{4}-\d{2}-\d{2}/.test(C)){let D=a(C);if(D.isValid())return D}return a(C,"DD.MM.YYYY HH:mm",true)};try{let C=Y(p),D=Y(h);return C.isBefore(D)?-1:C.isAfter(D)?1:0}catch(C){return 0}}:(ge||xe)&&(U.sortingFn=(f,s,A)=>{let p=parseFloat(f.getValue(A))||0,h=parseFloat(s.getValue(A))||0;return p-h}),He&&He!=="none"&&(U.Cell=({row:f})=>jsx("div",{style:{cursor:"pointer",width:"100%",padding:"0.7em"},onPointerUp:()=>{var A,p,h,Y,C,D;let s={pluginCode:f.original._plugincode,formCode:f.original._origformcode,guid:null,originator:(A=ee.current.context.params)==null?void 0:A.originator,pGuid:(p=ee.current.context.params)==null?void 0:p.pGuid,folderData:ee.current.context.params.folderData};He==="new"&&(Y=(h=ee.current.context)==null?void 0:h.params)!=null&&Y.modalCloseFn&&((D=(C=ee.current.context)==null?void 0:C.params)==null||D.modalCloseAndOpenFn(s));},children:f.getValue(t.item_name.toString())})),a$1.push(U);}}),a$1},[W$1,Z$1,He,v]),vn=a=>{ce(a.currentTarget);},kn=()=>{ce(null);},Ln=useCallback(()=>{var t,i;if(!ze)return null;var a=(i=(t=e$1.context.params)==null?void 0:t.folderData)==null?void 0:i.captions;return a==null||a.length===0?null:(a=a.slice(1),jsx("span",{style:{display:"flex",alignItems:"center"},children:a.map((d,o)=>jsxs("span",{style:{display:"inline-flex",alignItems:"center"},children:[d,o<a.length-1&&jsx(d$1,{style:{margin:"0 8px",fontSize:"0.6rem",color:"#666"}},`chevron-${o}`)]},`caption-${o}`))}))},[ze,e$1.context.params.folderData]),Nn={density:pn,expanded:true,grouping:[],isFullScreen:false,pagination:{pageIndex:b$2||0,pageSize:Number(ie)||Ue},columnVisibility:{id:false}},An=useCallback((a,t)=>{var i=[];a.forEach(d=>{var u,w,y,k,L,ae;let o=d.original;i.push({_sk:(u=o._sk)!=null?u:null,_code:(w=o._fcode)!=null?w:o._code,_origformcode:(k=(y=o._origformcode)!=null?y:o._fcode)!=null?k:o._code,_plugincode:(L=o._plcode)!=null?L:o._plugincode,_desc:(ae=o._desc)!=null?ae:null});}),i.length>0&&Ie("createsigncontainer",e$1,i,_$1,v,t);},[Ie,e$1,_$1,v]),En=useCallback((a,t)=>{var i=[];a.forEach(d=>{var u,w,y,k,L;let o=d.original;i.push({_sk:(u=o._sk)!=null?u:null,_code:(w=o._fcode)!=null?w:o._code,_origformcode:(k=(y=o._origformcode)!=null?y:o._fcode)!=null?k:o._code,_plugincode:(L=o._plcode)!=null?L:o._plugincode});}),i.length>0&&Ie("download",e$1,i,_$1,v,t);},[Ie,e$1,_$1,v]),Bn=useCallback((a,t)=>{var i=[];a.forEach(d=>{var u,w,y,k,L;let o=d.original;i.push({_sk:(u=o._sk)!=null?u:null,_code:(w=o._fcode)!=null?w:o._code,_origformcode:(k=(y=o._origformcode)!=null?y:o._fcode)!=null?k:o._code,_plugincode:(L=o._plcode)!=null?L:o._plugincode});}),tt({delete:{showDialog:true,dialogTitle:K("Delete")+" ?",dialogContent:K("Are you certain that you wish to delete selected records?"),buttonAgree:K("Continue"),buttonDisagree:K("Close"),callBackFunc:d=>pt(d,"delete",e$1,i,t,_$1,v)}});},[tt,pt,K,e$1,_$1,v]),On=useCallback(async({values:a,table:t})=>{ke("add",e$1,JSON.stringify(a),_$1,v),t.setCreatingRow(null);},[ke,e$1,_$1,v]),zn=useCallback(async({values:a,table:t,row:i})=>{let d={...i.original,...a};ke("edit",e$1,JSON.stringify(d),_$1,v),t.setEditingRow(null);},[ke,e$1,_$1,v]),[ca,Un]=useState(null);if(!Fn)return null;let Je=Se("file",e$1.context)?"primary":"#C0C0C0",Vn=Se("file",e$1.context)?"contained":"outlined";return jsxs(Fragment,{children:[ze&&jsx("div",{style:{paddingBottom:"0.8rem",fontSize:"0.85rem",color:"#666",marginLeft:"0.2rem"},children:Ln()}),jsx("div",{style:{maxWidth:e$1.context.isModal?g$1.width-30:void 0},children:jsx(Suspense,{fallback:jsx(qn,{}),children:jsx(ta,{locale:W$1,columns:Pn,enableBottomToolbar:In,enableTableFooter:Sn,createDisplayMode:"row",editDisplayMode:"row",enableEditing:false,enableColumnActions:ln,enableColumnOrdering:cn,enableColumnResizing:dn,enableGlobalFilter:bn,enableGlobalFilterModes:true,globalFilterModeOptions:[Ge||"startsWith"],globalFilterFn:Ge||"startsWith",enableGrouping:sn,enablePagination:nt,manualPagination:ne!=null?ne:false,enableRowActions:wt,enableRowNumbers:xn,enableRowSelection:wn,enableRowVirtualization:Tn,enableSelectAll:Cn,enableStickyHeader:Dn,enableToolbarInternalActions:Rn,enableTopToolbar:_n,onCreatingRowSave:On,onEditingRowSave:zn,darkMode:false,data:me,icons:{SaveIcon:()=>jsx(r,{color:na,style:{fontSize:"1.2rem"}}),CancelIcon:()=>jsx(P,{color:"gray",style:{fontSize:"1.2rem"}})},initialState:Nn,isLoading:!te,muiTableContainerProps:{sx:{maxHeight:un}},name:e$1.properties.name,pageIndex:b$2,pageSize:ie,muiPaginationProps:{rowsPerPageOptions:[50,100,300,500],disabled:be},onPaginationChange:Mn,positionActionsColumn:"last",displayColumnDefOptions:{"mrt-row-actions":wt?{header:"",minSize:g$1.isMobileDevice?75:270,enableHiding:false}:void 0},rowOnDoubleClick:a=>{!Ce&&!ft(e$1.properties)&&et("edit",e$1,a,_$1,v);},rowCount:ne?R:void 0,renderToolbarInternalActions:({table:a})=>jsx(Xt,{children:!g$1.isMobileDevice&&jsxs(Fragment,{children:[!Ce&&jsx(_,{table:a}),jsx(Y,{table:a}),jsx(W,{table:a}),jsx(X,{table:a}),!e$1.context.isModal&&jsx(Z,{table:a})]})}),renderTopToolbarCustomActions:({table:a})=>{var t$1,i,d,o,u,w,y,k,L,ae;return jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[a.getSelectedRowModel().rows.length===0&&ze&&e$1.context.formLayout==="folders"&&jsx(Fragment,{children:jsx(re,{title:(i=(t$1=e$1.properties)==null?void 0:t$1.newFolderLabel)!=null?i:K("New Folder"),children:jsx(Fe,{style:{marginRight:"5px"},color:"primary",onPointerUp:()=>e$1.context.isModal||e$1.context.hasParentForm?e$1.methodProvider.eventDispatcher({widgetName:e$1.properties.name.toLowerCase(),widgetValue:null,widgetEvent:U.onFolderCreateRecordEvent,widgetContext:JSON.stringify({referer:_$1.pathname,parentWidgetId:v,hasParentForm:T.hasParentForm(),parentOriginator:{params:e$1.context.params.originator?e$1.context.params.originator.params:{}},originator:{params:e$1.context.params,widgetName:e$1.properties.name.toLowerCase()},parent:{widgetName:e$1.properties.name.toLowerCase(),params:e$1.context.params},isModal:e$1.context.isModal,folderData:e$1.context.params.folderData})}):at(`${_$1.pathname}/new`,{state:{from:_$1.pathname}}),variant:"outlined",children:jsx(t,{})})})}),a.getSelectedRowModel().rows.length===0&&!gn&&jsx(Fragment,{children:jsx(re,{title:(o=(d=e$1.properties)==null?void 0:d.addrecordlabel)!=null?o:K("Add Record"),children:jsx(Fe,{disabled:ft(e$1.properties),color:"primary",sx:{color:Je,borderColor:Je},style:{marginRight:"5px"},onPointerUp:()=>{if(!Se("file",e$1.context)){le({toastID:nanoid(11),msg:K("Please select a folder before adding a document"),clearQueue:false,hideProgressBar:false});return}if(Ce){let ue={};(je.item._children||[]).forEach(({properties:N})=>{var pe,S;if(!N.item_increment||!N.item_name)return;let j=(pe=Ye[N.item_name])!=null?pe:"";j||(j=(S=N.item_columntype)!=null?S:"freetext",N.item_columntype||(N.item_isdate?j="date":N.item_isdatetime?j="datetime":N.item_ischeckbox?j="checkbox":N.item_isprice?j="price":j="freetext")),j==="number"&&(ue[N.item_name.toString()]=me.length+1);}),Object.keys(ue).length>0?a.setCreatingRow(V(a,ue)):a.setCreatingRow(true);}else return xt?at(`${_$1.pathname}/${xt}`,{state:{from:_$1.pathname}}):e$1.context.isModal||e$1.context.hasParentForm?e$1.methodProvider.eventDispatcher({widgetName:e$1.properties.name.toLowerCase(),widgetValue:null,widgetEvent:U.onTableCreateRecordEvent,widgetContext:JSON.stringify({referer:_$1.pathname,parentWidgetId:v,hasParentForm:true,parentOriginator:{params:e$1.context.params.originator?e$1.context.params.originator.params:{}},originator:{params:e$1.context.params,widgetName:e$1.properties.name.toLowerCase()},parent:{widgetName:e$1.properties.name.toLowerCase(),params:e$1.context.params},isModal:e$1.context.isModal,folderData:e$1.context.params.folderData})}):at(`${_$1.pathname}/new`,{state:{from:_$1.pathname}})},variant:"outlined",children:jsx(p,{})})})}),a.getSelectedRowModel().rows.length===0&&mn&&jsx(Fragment,{children:jsx(re,{title:(w=(u=e$1.properties)==null?void 0:u.uploadFilesLabel)!=null?w:K("Upload Files"),children:jsx(Fe,{color:"primary",onPointerUp:vn,variant:"outlined",children:jsx(h,{})})})}),a.getSelectedRowModel().rows.length>0&&jsxs(Fragment,{children:[e$1.context.formLayout==="folders"&&a.getSelectedRowModel().rows.length>1&&jsx(Fragment,{children:jsx(re,{title:K("Create Container"),children:jsx(Fe,{style:{marginRight:"5px",color:Je,borderColor:Je},onPointerUp:()=>{if(!Se("file",e$1.context)){le({toastID:nanoid(11),msg:K("Please select a folder before creating a container"),clearQueue:false,hideProgressBar:false});return}An(a.getSelectedRowModel().rows,a);},variant:Vn,children:jsx(q,{})})})}),jsxs(Fragment,{children:[jsx(re,{title:(k=(y=e$1.properties)==null?void 0:y.downloadLabel)!=null?k:K("Download"),children:jsx(Fe,{style:{marginRight:"5px"},onPointerUp:()=>En(a.getSelectedRowModel().rows,a),variant:"contained",children:jsx(g,{})})}),jsx(re,{title:(ae=(L=e$1.properties)==null?void 0:L.deleteLabel)!=null?ae:K("Delete"),children:jsx(Fe,{style:{marginRight:"5px"},onPointerUp:()=>Bn(a.getSelectedRowModel().rows,a),variant:"contained",children:jsx(N,{})})})]})]}),jsx(aa,{anchorEl:q$1,handleClose:kn,setUploadMode:de,uploadMode:Te,props:e$1,setLoaded:$})]})},...la(e$1,yn,Ve,g$1.isMobileDevice,tt,on)},W$1)})}),jsx(G,{...I.delete,handleDialogClose:rn})]})})),Pe=c=>{let e=null,r=c.action,l$1=c.applyInternalStyle?{fontSize:"1em",marginRight:"0.5em"}:{};return r==="open"?e=jsx(n,{style:l$1}):r==="copy"?e=jsx(i,{style:l$1}):r==="confirm"?e=jsx(w,{style:{...l$1,fontSize:"1.6em"}}):r==="edit"?e=jsx(A,{style:l$1}):r==="editrow"?e=jsx(n,{style:l$1}):r==="amend"?e=jsx(b$2,{style:l$1}):r==="delete"?e=jsx(N,{style:l$1}):r==="lock"?e=jsx(y,{style:l$1}):r==="unlock"?e=jsx(x,{style:l$1}):r==="print"?e=jsx(C,{style:l$1}):r==="preview"?e=jsx(n,{style:l$1}):r==="sign"?e=jsx(q,{style:l$1}):r==="download"?e=jsx(l,{style:l$1}):r==="uploadfile"?e=jsx(O,{style:l$1}):r==="uploadzipfile"&&(e=jsx(o,{style:l$1})),e},la=(c,e,r,l,g,le)=>{var de,me;let G=typeof e=="string"?JSON.parse(e):e!=null?e:[],se=useLocation(),{t:E}=useTranslation(),{tabId:b}=c,ie=(me=(de=c.properties)==null?void 0:de.rowactionlabels)!=null?me:{},q=(m,R)=>ie[m]||E(R),ce={color:"text.secondary","&:hover":{color:"primary.main"},"&:focus":{color:"primary.main"},fontSize:"1.1em",marginRight:"0.5em"},te=(m,R,F)=>m==="delete"?()=>{g({delete:{showDialog:true,dialogTitle:`${q("delete","Delete")} ?`,dialogContent:q("deleteConfirmContent","Are you certain that you wish to delete this record?"),buttonAgree:q("deleteConfirmAgree","Continue"),buttonDisagree:q("deleteConfirmDisagree","Close"),callBackFunc:x=>le(x,"delete",c,F,se,b)}});}:m==="editrow"?()=>{R.closeMenu(),R.table.setEditingRow(R.row);}:()=>{var x;(x=R.closeMenu)==null||x.call(R),et(m,c,F,se,b);},$=({entryType:m,mode:R})=>{let F=m.row.original,[x,B]=mt.useState(null),T=I=>{B(I.currentTarget);},X=()=>{B(null);},he=()=>jsx(Fragment,{children:Object.entries(G).map(([I,P])=>{if(!P)return null;let M=I.replace("action_",""),O=te(M,m,F);return jsx("span",{children:jsx(re,{title:q(M,M.charAt(0).toUpperCase()+M.slice(1)),children:jsx(Kt,{sx:ce,onPointerUp:O,children:jsx(Pe,{action:M})})})},I)})}),ye={};if(F._primAct){let I=F._primAct;if(Object.values(tn).includes(I)){Object.values(gt).includes(I)&&(ye.edit=true,G.action_edit&&delete G.action_edit);let P="action_"+I.toLowerCase();ye[P]=true,G[P]&&delete G[P];}}return jsxs(Xt,{sx:{display:"flex",flexWrap:"nowrap",gap:"8px",justifyContent:"center",alignItems:"center"},children:[R===0&&jsx(he,{}),R===1&&jsxs(Fragment,{children:[jsx(()=>jsx(Fragment,{children:Object.entries(ye).map(([I,P])=>{if(!P)return null;let M=I.replace("action_",""),O=te(M,m,F),Z=Object.values(gt).includes(M.toUpperCase()),Oe=M.charAt(0).toUpperCase()+M.slice(1),ee=Oe==="Edit"?q("open","Open"):q(M,Oe);return jsx(Fe,{onClick:O,startIcon:jsx(Pe,{action:M==="edit"?"open":M}),variant:"contained",size:"small",sx:{textTransform:"none",fontSize:"0.75rem",height:"28px",borderRadius:"4px",boxShadow:"none",backgroundColor:Z?"actionbtnok.main":"regularbtn.main",color:"#fff","&:hover":{backgroundColor:Z?"actionbtnok.hover":"regularbtn.hover",boxShadow:"none"},minInlineSize:"7.5em"},children:ee},I)})}),{}),jsx(()=>{let I=x?x.getBoundingClientRect():null;return jsxs("span",{style:{paddingLeft:"1.5em"},children:[jsx(Kt,{sx:ce,onClick:T,id:"dropdown-button",children:jsx(ea,{})}),jsx(en,{anchorEl:x,open:!!x,onClose:X,PaperProps:{sx:{borderRadius:2,minWidth:180,py:1,boxShadow:3,top:I?`${I.top+5}px !important`:"auto",left:I?`${I.left+15}px !important`:"auto",zIndex:P=>P.zIndex.modal+1}},children:Object.entries(G).map(([P,M])=>{if(!M)return null;let O=P.replace("action_","");return jsxs(Ze,{onClick:()=>{X(),te(O,m,F)();},sx:{px:2,py:1},children:[jsx(Qe,{sx:{minWidth:"unset",mr:1},children:jsx(Pe,{action:O==="print"?"preview":O,applyInternalStyle:true})}),jsx(Xe,{primaryTypographyProps:{fontSize:"0.875rem"},children:q(O,O.charAt(0).toUpperCase()+O.slice(1))})]},P)})})]})},{})]})]})},Te=m=>{let R=m.row.original;return [jsx(Kn,{onClickAway:()=>{var F;return (F=m.closeMenu)==null?void 0:F.call(m)},children:jsx(Qn,{sx:{minWidth:"12em",py:0,background:"none"},children:Object.entries(G).map(([F,x])=>{if(!x)return null;let B=F.replace("action_",""),T=te(B,m,R);return jsxs(Ze,{disabled:ft(c.properties),onPointerUp:T,children:[jsx(Qe,{children:jsx(Pe,{action:B==="print"?"preview":B,applyInternalStyle:true})}),jsx(Xe,{primaryTypographyProps:{fontSize:"0.875rem"},children:q(B,B.charAt(0).toUpperCase()+B.slice(1))})]},F)})})},"row-action-menu")]};return r==="flat"&&!l?{renderRowActions:m=>jsx($,{entryType:m,mode:0})}:r==="menu"||r!=="none"&&l?{renderRowActionMenuItems:m=>Te(m)}:r==="primary"?{renderRowActions:m=>jsx($,{entryType:m,mode:1})}:{}};nn.displayName="_Datatable";var Ya=nn;export{Ya as Datatable};
@@ -1 +0,0 @@
1
- export{a as Formeditor,b as widgetInitialStyle}from'./chunk-BBBJBJ6N.js';import'./chunk-6K3ZZUUM.js';import'./chunk-5ZFXQAPR.js';import'./chunk-POE6K4NQ.js';import'./chunk-PEJGRTDP.js';import'./chunk-FRAOYRZD.js';import'./chunk-22LEYH6Q.js';import'./chunk-KW32CT2P.js';import'./chunk-U4T4ACDE.js';import'./chunk-LBMVBVXW.js';import'./chunk-3QKKOFXC.js';import'./chunk-AR42AC7J.js';import'./chunk-SDIZEEZP.js';import'./chunk-5TBO732O.js';