@buildocsdev/sdk 1.1.30 → 1.1.31
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.
- package/dist/{buildocslib.esm-BUFQH2Q3.js → buildocslib.esm-75W424LQ.js} +1 -1
- package/dist/chunk-2IH7AKP7.js +2 -0
- package/dist/{chunk-AYYTOQGP.js → chunk-HEOSDBE7.js} +12 -12
- package/dist/{chunk-CFWUMDWI.js → chunk-INDXILOX.js} +1 -1
- package/dist/{chunk-63P2HHLW.js → chunk-KW6NV3R4.js} +1 -1
- package/dist/{datatable-ZKC2HMF3.js → datatable-ESOCF5OR.js} +1 -1
- package/dist/{fileviewer-24IMJQQY.js → fileviewer-Z6A6PJBD.js} +1 -1
- package/dist/form.js +1 -1
- package/dist/formeditor-J5JWKVMG.js +1 -0
- package/dist/formeditor.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{mdaviewer-5FZIKWAF.js → mdaviewer-D3G7EWJ5.js} +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/{nopreviewer-AHB7JZG4.js → nopreviewer-SXJHQ3Q5.js} +1 -1
- package/dist/{pdfviewer-MG7MA7K3.js → pdfviewer-CBLCW6BV.js} +1 -1
- package/dist/{tabulator-FIJ5BVQH.js → tabulator-WZGSK3GI.js} +1 -1
- package/package.json +2 -2
- package/dist/chunk-AW7CYQHE.js +0 -2
- package/dist/formeditor-FC5FPX7G.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {q}from'./chunk-
|
|
1
|
+
import {q}from'./chunk-HEOSDBE7.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-
|
|
1
|
+
import {a}from'./chunk-7RKPIXVG.js';import {b}from'./chunk-LBMVBVXW.js';import {q}from'./chunk-HEOSDBE7.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-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:c,cell:t,actionHandler:o})=>{let {t:e}=useTranslation();t.getRow().getPosition();let i=c.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 c{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"&&c.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=c.parseExpression(m.trim());return `@${JSON.stringify(a)}`});let n=c.tokenize(t).map(i=>i.startsWith("@")?JSON.parse(i.substring(1)):i);return c.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:[c.parseTokens(i),c.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 c.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 c=window.ResizeObserver;window.ResizeObserver=class extends c{constructor(t){let o;super((e,n)=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>t(e,n));});}};}var oe=lazy(()=>import('react-tabulator').then(c=>({default:c.ReactTabulator}))),ae=c=>{var o;if(!c.properties.folders)return null;var t=(o=c.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=(c,t,o,e,n,i,m,a)=>{let s=document.createElement("div"),d=null,f=c.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=(c,t,o,e,n,i,m,a)=>{let s=document.createElement("div"),d=null,f=c.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=(c,t,o,e)=>{var m;if(!c.alloweditrow||c.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,c.name):n==="date"?(a,s,d,f,D)=>ie(a,s,d,f,D,o.current,e,c.name):t.item_editor==="number"||n==="price"||n==="number"?"number":t.item_editor==="checkbox"||n==="checkbox"?"tickCross":"input"},ue=(c,t,o,e,n)=>{let i=c.getElement();i.style.backgroundColor="#f0f0f0",i.style.color="#555",i.style.pointerEvents="none";},Yt=(c,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=(c,t)=>{let o=c.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=(c,t)=>{let o=c.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=(c,t)=>{if(c.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(u=>{});},[x]),useEffect(()=>{if(r.current=x!=null?x:"",n.current)try{n.current.redraw(!0);}catch(u){}},[x]),useEffect(()=>{let u=()=>{n.current&&!e.isMobileDevice&&n.current.redraw();};return window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u);}},[]),useEffect(()=>{A.current=t.context.formData||{};let u=t.context.formData?t.context.formData[t.properties.name]:null;f(u?JSON.parse(u):[]);},[t.context.formData]),useEffect(()=>{var u;if(F&&n.current!=null){let M=(u=n.current)==null?void 0:u.getData();A.current&&(A.current[t.properties.name]=JSON.stringify(M)),k(false);}},[F]),useEffect(()=>((async()=>{var u,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:(u=t.context.params)==null?void 0:u.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(u){}n.current=null;}}),[]);let W=u=>{var M,C;if(n.current){let p=u.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=(u,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:u,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 u;(()=>{if(u=t.methodProvider.findWidgetItem(t.id),!u)return;let C=[];u.item.properties.datasource.columns&&(u.item.properties.datasource.columns||[]).map(l=>{C[l[1]]=l[0];});let p=[];(u.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;u.item._children.forEach(({properties:l})=>{dt+=parseInt(l.item_minsize,10)||0,l.item_bottomcalc&&(ft=true);}),b$1(dt),(u.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=u=>!!(u.readonly&&!u.ignorereadonly);function Q(u){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(u)}}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:u=>n.current=u==null?void 0:u.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-HEOSDBE7.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:c,cell:t,actionHandler:o})=>{let {t:e}=useTranslation();t.getRow().getPosition();let i=c.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 c{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"&&c.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=c.parseExpression(m.trim());return `@${JSON.stringify(a)}`});let n=c.tokenize(t).map(i=>i.startsWith("@")?JSON.parse(i.substring(1)):i);return c.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:[c.parseTokens(i),c.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 c.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 c=window.ResizeObserver;window.ResizeObserver=class extends c{constructor(t){let o;super((e,n)=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>t(e,n));});}};}var oe=lazy(()=>import('react-tabulator').then(c=>({default:c.ReactTabulator}))),ae=c=>{var o;if(!c.properties.folders)return null;var t=(o=c.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=(c,t,o,e,n,i,m,a)=>{let s=document.createElement("div"),d=null,f=c.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=(c,t,o,e,n,i,m,a)=>{let s=document.createElement("div"),d=null,f=c.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=(c,t,o,e)=>{var m;if(!c.alloweditrow||c.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,c.name):n==="date"?(a,s,d,f,D)=>ie(a,s,d,f,D,o.current,e,c.name):t.item_editor==="number"||n==="price"||n==="number"?"number":t.item_editor==="checkbox"||n==="checkbox"?"tickCross":"input"},ue=(c,t,o,e,n)=>{let i=c.getElement();i.style.backgroundColor="#f0f0f0",i.style.color="#555",i.style.pointerEvents="none";},Yt=(c,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=(c,t)=>{let o=c.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=(c,t)=>{let o=c.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=(c,t)=>{if(c.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(u=>{});},[x]),useEffect(()=>{if(r.current=x!=null?x:"",n.current)try{n.current.redraw(!0);}catch(u){}},[x]),useEffect(()=>{let u=()=>{n.current&&!e.isMobileDevice&&n.current.redraw();};return window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u);}},[]),useEffect(()=>{A.current=t.context.formData||{};let u=t.context.formData?t.context.formData[t.properties.name]:null;f(u?JSON.parse(u):[]);},[t.context.formData]),useEffect(()=>{var u;if(F&&n.current!=null){let M=(u=n.current)==null?void 0:u.getData();A.current&&(A.current[t.properties.name]=JSON.stringify(M)),k(false);}},[F]),useEffect(()=>((async()=>{var u,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:(u=t.context.params)==null?void 0:u.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(u){}n.current=null;}}),[]);let W=u=>{var M,C;if(n.current){let p=u.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=(u,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:u,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 u;(()=>{if(u=t.methodProvider.findWidgetItem(t.id),!u)return;let C=[];u.item.properties.datasource.columns&&(u.item.properties.datasource.columns||[]).map(l=>{C[l[1]]=l[0];});let p=[];(u.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;u.item._children.forEach(({properties:l})=>{dt+=parseInt(l.item_minsize,10)||0,l.item_bottomcalc&&(ft=true);}),b$1(dt),(u.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=u=>!!(u.readonly&&!u.ignorereadonly);function Q(u){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(u)}}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:u=>n.current=u==null?void 0:u.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.
|
|
3
|
+
"version": "1.1.31",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/"
|
|
6
6
|
},
|
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
"bim-fragment": "^1.2.6",
|
|
218
218
|
"bootstrap": "^5.3.8",
|
|
219
219
|
"buffer": "^6.0.3",
|
|
220
|
-
"buildocslib": "^0.2.
|
|
220
|
+
"buildocslib": "^0.2.181",
|
|
221
221
|
"cpy-cli": "^6.0.0",
|
|
222
222
|
"cross-env": "^10.1.0",
|
|
223
223
|
"css-pro-layout": "^1.1.0",
|
package/dist/chunk-AW7CYQHE.js
DELETED
|
@@ -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-3UNAMWG4.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-TYVVEP34.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-AYYTOQGP.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 Pe from'react';import Pe__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 Qa from'@mui/material/Box';import Xr from'@mui/material/Button';import Yr from'@mui/material/Tooltip';import Vi from'axios';import $i from'@mui/material/CircularProgress';import qi from'@mui/material/LinearProgress';import lr from'@mui/material/IconButton';import Ll from'@mui/material/InputAdornment';import Al from'@mui/icons-material/Visibility';import Vl from'@mui/icons-material/VisibilityOff';import {animated,useSpring}from'@react-spring/web';import {styled,alpha}from'@mui/material/styles';import Ul from'@mui/material/Collapse';import Gl from'@mui/material/Typography';import zl 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 Zl from'@mui/material/Menu';import xt from'@mui/material/MenuItem';import Fd from'i18next';import vd from'@mui/material/Backdrop';var Vn=a((Ue,An)=>{Object.defineProperty(Ue,"__esModule",{value:true});function Ae(t){return typeof t=="object"&&!("toString"in t)?Object.prototype.toString.call(t).slice(8,-1):t}var Cr=typeof process=="object"&&true;function _e(t,e){if(!t)throw Cr?new Error("Invariant failed"):new Error(e())}Ue.invariant=_e;var Bt=Object.prototype.hasOwnProperty,Ir=Array.prototype.splice,Fr=Object.prototype.toString;function Ze(t){return Fr.call(t).slice(8,-1)}var bt=Object.assign||(function(t,e){return Nt(e).forEach(function(o){Bt.call(e,o)&&(t[o]=e[o]);}),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):Ze(t)==="Map"?new Map(t):Ze(t)==="Set"?new Set(t):t&&typeof t=="object"?bt(Object.create(Object.getPrototypeOf(t)),t):t}var _n=(function(){function t(){this.commands=bt({},Tr),this.update=this.update.bind(this),this.update.extend=this.extend=this.extend.bind(this),this.update.isEquals=function(e,o){return e===o},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,o){this.commands[e]=o;},t.prototype.update=function(e,o){var i=this,a=typeof o=="function"?{$apply:o}:o;Array.isArray(e)&&Array.isArray(a)||_e(!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."}),_e(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(i.commands).join(", ")+".")});var d=e;return Nt(a).forEach(function(r){if(Bt.call(i.commands,r)){var m=e===d;d=i.commands[r](a[r],d,a,e),m&&i.isEquals(d,e)&&(d=e);}else {var s=Ze(e)==="Map"?i.update(e.get(r),a[r]):i.update(e[r],a[r]),c=Ze(d)==="Map"?d.get(r):d[r];(!i.isEquals(s,c)||typeof s=="undefined"&&!Bt.call(e,r))&&(d===e&&(d=je(e)),Ze(d)==="Map"?d.set(r,s):d[r]=s);}}),d},t})();Ue.Context=_n;var Tr={$push:function(t,e,o){return Bn(e,o,"$push"),t.length?e.concat(t):e},$unshift:function(t,e,o){return Bn(e,o,"$unshift"),t.length?t.concat(e):e},$splice:function(t,e,o,i){return Dr(e,o),t.forEach(function(a){Ln(a),e===i&&a.length&&(e=je(i)),Ir.apply(e,a);}),e},$set:function(t,e,o){return Rr(o),t},$toggle:function(t,e){dt(t,"$toggle");var o=t.length?je(e):e;return t.forEach(function(i){o[i]=!e[i];}),o},$unset:function(t,e,o,i){return dt(t,"$unset"),t.forEach(function(a){Object.hasOwnProperty.call(e,a)&&(e===i&&(e=je(i)),delete e[a]);}),e},$add:function(t,e,o,i){return Nn(e,"$add"),dt(t,"$add"),Ze(e)==="Map"?t.forEach(function(a){var d=a[0],r=a[1];e===i&&e.get(d)!==r&&(e=je(i)),e.set(d,r);}):t.forEach(function(a){e===i&&!e.has(a)&&(e=je(i)),e.add(a);}),e},$remove:function(t,e,o,i){return Nn(e,"$remove"),dt(t,"$remove"),t.forEach(function(a){e===i&&e.has(a)&&(e=je(i)),e.delete(a);}),e},$merge:function(t,e,o,i){return Sr(e,t),Nt(t).forEach(function(a){t[a]!==e[a]&&(e===i&&(e=je(i)),e[a]=t[a]);}),e},$apply:function(t,e){return Pr(t),t(e)}},_t=new _n;Ue.isEquals=_t.update.isEquals;Ue.extend=_t.extend;Ue.default=_t.update;Ue.default.default=An.exports=bt(Ue.default,Ue);function Bn(t,e,o){_e(Array.isArray(t),function(){return "update(): expected target of "+Ae(o)+" to be an array; got "+Ae(t)+"."}),dt(e[o],o);}function dt(t,e){_e(Array.isArray(t),function(){return "update(): expected spec of "+Ae(e)+" to be an array; got "+Ae(t)+". Did you forget to wrap your parameter in an array?"});}function Dr(t,e){_e(Array.isArray(t),function(){return "Expected $splice target to be an array; got "+Ae(t)}),Ln(e.$splice);}function Ln(t){_e(Array.isArray(t),function(){return "update(): expected spec of $splice to be an array of arrays; got "+Ae(t)+". Did you forget to wrap your parameters in an array?"});}function Pr(t){_e(typeof t=="function",function(){return "update(): expected spec of $apply to be a function; got "+Ae(t)+"."});}function Rr(t){_e(Object.keys(t).length===1,function(){return "Cannot have more than one key in an object with $set"});}function Sr(t,e){_e(e&&typeof e=="object",function(){return "update(): $merge expects a spec of type 'object'; got "+Ae(e)}),_e(t&&typeof t=="object",function(){return "update(): $merge expects a target of type 'object'; got "+Ae(t)});}function Nn(t,e){var o=Ze(t);_e(o==="Map"||o==="Set",function(){return "update(): "+Ae(e)+" expects a target of type Set or Map; got "+Ae(o)});}});var mr=c(Vn());var Wn=withTranslation()(memo(function(e){let{id:o,tabId:i,panelId:a,context:d,methodProvider:r,widgetsState:m}=e,s=r.findRowItem(i,a,o);return s?Pe__default.createElement("div",{className:"row-container"},(s.item._children||[]).map(({rowId:c,id:v,component:T,properties:p})=>Pe__default.createElement(Ve.getFormComponent(T,p),{key:"key_"+v,tabId:i,panelId:a,rowId:c,segmentId:v,properties:p,widgetsState:m,methodProvider:r,context:{...d},segmentsCount:s.item._children.length},null))):null}));Wn.displayName="_Rowcontainer";var Hn=Wn;var Gn=withTranslation()(memo(function(e){let{tabId:o,panelId:i,rowId:a,segmentId:d,segmentsCount:r,properties:m,methodProvider:s,context:c,widgetsState:v}=e,T=s.findSegmentItem(o,i,a,d),p={...m.style};return Pe__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 Pe__default.createElement(Ve.getFormComponent(u,g),{key:"key_"+f,context:{params:c.params,displayButtonLoader:c.displayButtonLoader,doValidateForm:c.doValidateForm,redrawComponent:c.redrawComponent,formDimension:c.formDimension,segmentDimensions:{minWidth:parseInt(p.minWidth)},tabIndex:c.tabIndex,formData:u.displayName==="_Fileuploader"||u.displayName==="_Label"||u.displayName==="_View"||u.displayName==="_Textinput"&&g.inputtype==="currency"?c.formData:[]},id:f,methodProvider:s,panelId:i,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:r,tabId:o,value:c.formData!==void 0?c.formData[y]:void 0,fieldAllowedValues:c!=null&&c.fieldAllowedValues?c.fieldAllowedValues[y]:void 0,validationMessage:c!=null&&c.formValidationData&&c.formValidationData[y]!==void 0?c.formValidationData[y]:null},null)}))}));Gn.displayName="_Rowsegment";var zn=Gn;function Hr(t,e){return {id:t,value:e}}var qn=withTranslation()(memo(function(e){var L;let o=useRef(null),{datalength:i,id:a,forcereadonly:d,ignorereadonly:r,label:m,name:s,onchangehandler:c,placeholder:v,readonly:T$1,regex:p,searchbar:f,size:u,style:g,tabIndex:y,uppercasemode:x,variant:S,visible:C}=e.properties,E=useLocation(),{viewPort:W}=b(),{tabId:_}=e,[I,F]=useState(String((L=e.value)!=null?L:"")),[h,$]=Pe__default.useState([]),ee=!!(I.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var P;F(String((P=e.value)!=null?P:""));},[e.value]),useEffect(()=>{let P=[];if(e.fieldAllowedValues){for(let H in e.fieldAllowedValues)P.push(Hr(H,e.fieldAllowedValues[H]));$(P);}},[e.fieldAllowedValues]);let ne=P=>{var H;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:P,widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:_,hasParentForm:T.hasParentForm(),originator:(H=e.context.params)==null?void 0:H.originator})});},D=P=>{F(P);};return jsx(n,{autoFocus:false,data:h,disabled:!!(T$1&&!r),error:ee,helperText:ee?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:y,style:{...g},autoComplete:nanoid(5)},InputProps:{},inputRef:o,label:m,maxCharCount:i,name:s,onBlur:P=>{ne(P.target.value);},onInput:P=>{D(P.target.value),W.isMobileDevice&&ne(P.currentTarget.value);},onChange:P=>{I.trim()===""&&ne(P.target.value);},placeholder:v,readOnly:!!(T$1&&!r),regEx:p,searchBar:f,size:u!=null?u:"small",type:"text",inputtype:e.properties.inputType,toUpperCase:x,value:I,variant:S,visible:C})}));qn.displayName="_Input";var Jn=qn;var Qn=withTranslation()(memo(function(e){var P;let o=useRef(null),{datalength:i$1,id:a,forcereadonly:d,ignorereadonly:r,label:m,name:s,onchangehandler:c,placeholder:v,readonly:T$1,regex:p,size:f,style:u,tabIndex:g,uppercasemode:y,variant:x,visible:S}=e.properties,C=useLocation(),{viewPort:E}=b(),{tabId:W}=e,[_,I]=useState(String((P=e.value)!=null?P:"")),F=!!(_.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),[h,$]=useState(false),{t:ee}=useTranslation(),ne=()=>{navigator.clipboard.writeText(_).then(()=>{$(true),setTimeout(()=>$(false),2e4);});};useEffect(()=>{var H;I(String((H=e.value)!=null?H:""));},[e.value]);let D=H=>{var Q;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:H,widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:C.pathname,parentWidgetId:W,hasParentForm:T.hasParentForm(),originator:(Q=e.context.params)==null?void 0:Q.originator})});},L=H=>{I(H);};return jsxs(Qa,{display:"flex",alignItems:"flex-start",gap:0,children:[jsx(n,{autoFocus:false,disabled:!!(T$1&&!r),error:F,helperText:F?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:g,style:{...u},autoComplete:nanoid(5)},InputProps:{},inputRef:o,label:m,maxCharCount:i$1,name:s,onBlur:H=>{D(H.target.value);},onInput:H=>{L(H.target.value),E.isMobileDevice&&D(H.currentTarget.value);},onChange:H=>{_.trim()===""&&D(H.target.value);},placeholder:v,readOnly:!!(T$1&&!r),regEx:p,size:f,type:"text",inputtype:e.properties.inputType,toUpperCase:y,value:_,variant:x,visible:S}),S&&jsx(Yr,{title:ee(h?"copied!":"copy to clipboard"),children:jsx(Xr,{variant:"contained",style:{backgroundColor:"#C0C0C0",borderRadius:"0px 4px 4px 0px",boxShadow:"none",marginLeft:"-3px",border:"2px solid #C0C0C0",lineHeight:"24px",fontSize:"11px"},onClick:ne,startIcon:jsx(i,{}),children:ee("copy")})})]})}));Qn.displayName="_InputWCopy";var Kn=Qn;var Yn=withTranslation()(memo(function(e){useRef(null);let {tabId:i,id:a,context:d,widgetsState:r}=e,m=e.methodProvider.findWidgetItem(a),s=e.methodProvider.getActiveTabIndex(i,a),c=(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=>c(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?Pe__default.createElement("div",{className:"form-tab-widget"},jsxs(y,{selectedIndex:s,onSelect:p=>e.methodProvider.setActiveTabIndex(i,a,p),children:[jsx(z,{children:(m.item._children||[]).map(({properties:p},f)=>!p.item_visible||r&&r.visibility&&r.visibility[p.item_name]===false?null:createElement(T,{...m.item.properties.tabsetup,...p,key:"TabCaptionComponent_"+a+"_"+f},p.item_title))}),(m.item._children||[]).map(({_children:p},f)=>jsx(B,{children:(p||[]).map(({tabId:u,panelId:g,id:y,type:x,component:S,properties:C},E)=>Pe__default.createElement(Ve.getFormComponent(S,C),{key:"tabSubPanel_"+E,id:y,tabId:u,panelId:g,properties:{...C,visible:r!==void 0&&r.visibility[C.name]!==void 0?r.visibility[C.name]:C.visible,readonly:r!==void 0&&r.readonly[C.name]!==void 0?r.readonly[C.name]:C.readonly},className:x,widgetsState:r,methodProvider:e.methodProvider,context:{...d},segmentsCount:m.item._children.length,fieldAllowedValues:d!=null&&d.fieldAllowedValues?d.fieldAllowedValues[C.name]:void 0},null))},"TabPanel_"+a+"_"+f))]})):null}));Yn.displayName="_TabBox";var Zn=Yn;function li(t,e){if(!e||Array.isArray(e)&&e.length===0)return t;let o=e;return t.replace(/<b>@(\w+)<\/b>|@(\w+)/g,(i,a,d)=>{let r=(a||d).toLowerCase(),m=o[r];return typeof m=="string"?a?`<b>${m}</b>`:m:i})}var ta=withTranslation()(memo(function(e){let{title:o,style:i,verticalalign:a,visible:d}=e.properties,r={paddingTop:"0px"};if(a==="bottom"&&(r.paddingTop="10px"),!d)return null;let m=li(o,e.context.formData);return jsx("div",{style:{...i,...r},children:jsx("div",{style:{...i},dangerouslySetInnerHTML:{__html:m}})})}));ta.displayName="_Label";var oa=ta;var aa=withTranslation()(memo(function(e$1){let o=useRef(null),{defaultvalue:i,id:a,ignorereadonly:d,label:r,labelplacement:m,name:s,onchangehandler:c,readonly:v,style:T$1,tabIndex:p,visible:f}=e$1.properties,u=s,g=e$1.value||"",y=useLocation(),{tabId:x}=e$1,S=!!(!g&&e$1.validationMessage!=null&&e$1.context.doValidateForm);return useEffect(()=>{!e$1.value&&i&&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&&i),disabled:!!(v&&!d),error:S,helperText:S?e$1.validationMessage:"",icon:void 0,inputProps:{id:a,tabIndex:p},inputRef:o,labelText:r,labelPlacement:m,name:u,onChange:C=>{e$1.methodProvider.eventDispatcher({widgetName:u,widgetValue:C.target.checked?e$1.properties.value:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:y.pathname,parentWidgetId:x,hasParentForm:T.hasParentForm()})});},selectedValue:g,value:e$1.properties.value,visible:f})})}));aa.displayName="_Checkbox";var ra=aa;var la=withTranslation()(memo(function(e){let o=useRef(null),{defaultvalue:i,groupname:a,id:d,ignorereadonly:r,label:m,labelplacement:s,name:c,onchangehandler:v,readonly:T$1,style:p,tabIndex:f,visible:u}=e.properties,g=useLocation(),{tabId:y}=e,x=a||c;let C=e.value||"",E=!!(e.validationMessage!=null&&e.context.doValidateForm),W=_=>{var I;e.methodProvider.eventDispatcher({widgetName:x,widgetValue:_,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 useEffect(()=>{!C&&i&&W(e.properties.value);},[]),jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:p.textAlign,height:"100%"},children:jsx(k,{defaultValue:i?e.properties.value:"",disabled:!!(T$1&&!r),inputProps:{id:d,tabIndex:f,style:{...p}},error:E,helperText:E?e.validationMessage:"",inputRef:o,labelText:m,labelPlacement:s,name:x,onChange:_=>{C!==_.target.value.trim()&&W(_.target.value);},selectedValue:C,value:e.properties.value,visible:u})})}));la.displayName="_Radio";var da=la;var sa=withTranslation()(memo(function(e){var ne;let o=useRef(null),{runFormEvent:i,viewPort:a}=b(),{id:d,autocompleteTextArea:r,ignorereadonly:m,label:s,name:c,onchangehandler:v,placeholder:T$1,required:p,requiredmessage:f,readonly:u,size:g,style:y,tabIndex:x,variant:S,visible:C}=e.properties,E=useLocation(),{tabId:W}=e,[_,I]=useState(String((ne=e.value)!=null?ne:""));useEffect(()=>{var D;I(String((D=e.value)!=null?D:""));},[e.value]);let F=!!(_.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm),h=D=>{var L;e.methodProvider.eventDispatcher({widgetName:c,widgetValue:D,widgetEvent:v?U.onChange:null,widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:W,hasParentForm:T.hasParentForm(),originator:(L=e.context.params)==null?void 0:L.originator})});},$=async D=>{var L,P,H;try{let Q=await i({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:(L=e.context.formData)!=null?L:{},widgetContext:JSON.stringify({}),widgetEvent:U.onGetCustomResponse,widgetName:c,widgetValue:JSON.stringify({methodName:"getAutoCompleteData",value:D})});if(((P=Q.meta)==null?void 0:P.requestStatus)==="fulfilled"){let N=Q.payload,k=(H=N==null?void 0:N.FECommand)==null?void 0:H.CustomResponse;if(Array.isArray(k))return k.filter(q=>typeof q=="string").map(q=>({label:q}))}}catch(Q){}return []},ee=D=>{I(D);};return jsx(n,{autocompleteTextArea:r,autoFocus:false,disabled:!!(u&&!m),id:d,inputProps:{id:d,tabIndex:x,readOnly:!!(u&&!m),style:{...y}},error:F,helperText:F?e.validationMessage:"",InputProps:{},inputRef:o,label:s,multiline:true,name:c,onAutoCompleteChange:r?D=>$(D):void 0,onBlur:D=>{h(D.target.value);},onInput:D=>{ee(D.target.value),a.isMobileDevice&&h(D.currentTarget.value);},onChange:D=>{_.trim()===""&&h(D.target.value);},placeholder:T$1,readOnly:!!(u&&!m),size:g,type:"text",value:_,variant:S,visible:C})}));sa.displayName="_Textarea";var ma=sa;function ca(t,e){return {id:t,value:e}}var Ot="\xA4",ua=withTranslation()(memo(function(e){var P,H;let o=useRef(null),[i,a]=Pe__default.useState(null),[d,r]=Pe__default.useState([]),m=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Ot):[],[s,c]=Pe__default.useState(m),{id:v,ignorereadonly:T$1,label:p,multiple:f,name:u,onchangehandler:g,placeholder:y,readonly:x,rendertype:S,searchbar:C,size:E,tabIndex:W,variant:_,visible:I,dropvalues:F}=e.properties,h=useLocation(),{tabId:$}=e,{t:ee}=useTranslation();useEffect(()=>{let Q=typeof e.value=="string"&&e.value!=null&&e.value.length>0?e.value.split(Ot):[];c(Q);},[e.value]),useEffect(()=>{let Q=S==="none"?[{id:"",value:""}]:[];if(e.fieldAllowedValues&&Object.keys(e.fieldAllowedValues).length>0){for(let N in e.fieldAllowedValues)Q.push(ca(N,e.fieldAllowedValues[N]));r(Q);}else if(F&&Array.isArray(F)&&F.length>0){for(let N of F)typeof N=="object"&&N!==null&&Q.push(ca(N.id||"",N.value||""));r(Q);}},[e.fieldAllowedValues,F]),useEffect(()=>{var Q;if(i===false){let N=typeof e.value!="string"?e.value:[];(JSON.stringify(N)!==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:$,hasParentForm:T.hasParentForm(),originator:(Q=e.context.params)==null?void 0:Q.originator,folderData:e.context.params.folderData})});}},[i]);let ne=Q=>{let{target:{value:N}}=Q,k;f?k=typeof N=="string"?N.split(","):N:k=typeof N=="string"?[N]:N,c(k);},D=e.context.formDimension.width/e.segmentsCount;D=D<e.context.segmentDimensions.minWidth?e.context.segmentDimensions.minWidth:D-60;let L=!!(s.length===0&&e.validationMessage!=null&&e.context.doValidateForm);return jsx(l,{darkMode:false,data:d,error:L,helperText:L?e.validationMessage:"",inputProps:{tabIndex:W,style:{maxWidth:`${D}px`}},inputRef:o,onOpen:()=>{a(true);},onClose:()=>{a(false);},onChange:ne,id:v,label:p,multiple:f,placeholder:y,readOnly:x&&!T$1,renderType:S,noOptionsText:(H=(P=e.properties)==null?void 0:P.noOptionsLabel)!=null?H:ee("No options"),searchBar:C,selectDisplayProps:{style:{maxWidth:"100%",whiteSpace:S==="chip"?"normal":"nowrap"}},selectedValue:s,size:E,variant:_,width:"auto",visible:I})}));ua.displayName="_SelectBox";var fa=ua;var pa=withTranslation()(memo(function(e){var m;let{style:o,visible:i}=(m=e.properties)!=null?m:{},[a,d]=useState(false);if(useEffect(()=>{d(true);},[]),!a)return null;let r="form-widget form-placeholder-widget";return i||(r+=" visibilityOff"),jsx("div",{className:r,style:{...o,display:"flex",alignItems:"center",justifyContent:"center",width:"100%",textAlign:"center"}})}));pa.displayName="_Placeholder";var ga=pa;var ha=createContext({});function ba(){return useContext(ha)}var va=ha;var Ji=lazy(()=>import('./fileviewer-24IMJQQY.js'));function ji(){let[,t]=useState(0);return ()=>t(e=>e+1)}var Ca=withTranslation()(memo(function(e){var Ce,ge;ji();let [i,a]=useState([]),[d,r]=useState(e.context.params),[m,s]=useState(false),[c,v]=useState(null),[T$1,p$1]=useState(false),[f$1,u]=useState(null),[g$1,y]=useState(0),{t:x}=useTranslation(),{iframeMode:S}=g(),C=ba(),E=X=>{var G;return (G=C[X])!=null?G:x(X)},{UserDialog:W}=b$1(),_=f(),{style:I,readonly:F,visible:h}=e.properties,[$,ee]=useState({showDialog:false,dialogTitle:"",dialogContent:"",buttonAgree:"",buttonDisagree:"",callBackFunc:()=>{}}),{appSettings:ne,viewPort:D,runFormDeleteFileEvent:L,runFormDownloadFileEvent:P,runFormGetLinkedFileEvent:H,runFormGetLinkedFileMetaEvent:Q,runFormUploadFiles:N}=b();useEffect(()=>{r(e.context.params);},[e.context.params]),useEffect(()=>{let X=e.value?JSON.parse(e.value):[];return X&&(a(k(X,100)),s(true)),()=>{i&&(s(false),i.forEach(G=>{G.preview&&URL.revokeObjectURL(G.preview);}));}},[]);let k=(X,G)=>{let M=[];return X.forEach((te,O)=>{let n=new File([],te,{type:"image/jpeg"});Object.assign(n,{preview:null,uploadProgress:G}),M.push(n);}),M},q=useCallback(async X=>{var U;let M=(await Q({...d,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:X,context:{action:"Preview"}})).payload,{linkedFileSize:te,linkedFileName:O,mimeType:n}=M;if(!te)throw new Error("File data or metadata is missing");let oe=(U=ne==null?void 0:ne.MAX_DOWNLOAD_NOCHUNK_FILESIZE)!=null?U:b$2.MAX_DOWNLOAD_NOCHUNK_FILESIZE;return te>oe?{type:"formbuilder/getlinkedfile",payload:{linkedFile:null,linkedFileSize:te,linkedFileName:O},meta:{requestStatus:"fulfilled"}}:await H({...d,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:X,context:{action:"Load"}})},[d,e.context.params.pGuid,e.properties.name]),ie=X=>{$.callBackFunc(X);},pe=async(X,G)=>{X&&await L({...e.context.params,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:G}).then(M=>{if(M.meta.requestStatus==="fulfilled"){let te={...M.payload};te.linkedFileDeleteSuccess&&(_({toastID:nanoid(11),msg:E("The file has been successfully deleted"),clearQueue:false,hideProgressBar:false}),a(O=>O.filter(n=>n.name!==G)),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(te.linkedFiles),widgetEvent:null,widgetContext:null}));}}),ee({...$,showDialog:false,callBackFunc:M=>{}});},xe=async X=>{if(X)try{let G=await P({...e.context.params,projectGuid:e.context.params.pGuid,fieldName:e.properties.name,fileId:X}),M=new Blob([G]),te=window.URL.createObjectURL(M),O=document.createElement("a");O.href=te,O.setAttribute("download",X.split("/").pop()||"downloadedFile"),document.body.appendChild(O),O.click(),document.body.removeChild(O),window.URL.revokeObjectURL(te);}catch(G){}},de=useCallback(async(X,G)=>(G&&ee({showDialog:true,dialogTitle:E("Confirmation"),dialogContent:E("Are you sure you want to delete file?"),buttonAgree:E("Continue"),buttonDisagree:E("Close"),callBackFunc:M=>pe(M,G)}),null),[e.context.params,x]),A=useCallback(async(X,G)=>(G&&xe(G),null),[e.context.params]),ce=useCallback((X,G)=>{G&&startTransition(()=>{v(G);});},[]),K=()=>{v(null);},ue=useCallback(async(X,G)=>{var M,te;if(X){let O=new FormData;for(let U in e.context.params)e.context.params.hasOwnProperty(U)&&O.append(U,e.context.params[U]);O.append("fieldName",e.properties.name),X.forEach(U=>{O.append("files",U);}),O.append("widgetContext",JSON.stringify({hasParentForm:T.hasParentForm(),originator:(M=e.context.params)==null?void 0:M.originator,folderData:(te=e.context.params)==null?void 0:te.folderData})),O.append("widgetEvent",U.onFileUploadEvent),O.append("widgetName",e.properties.name),O.append("formData",JSON.stringify({...e.context.formData}));let n=Vi.CancelToken.source(),oe=X.map(U=>Object.assign(U,{preview:URL.createObjectURL(U),uploadProgress:0}));a(i.concat(oe)),u(0),await N({content:O,cancelTokenSource:n,onUploadProgress:U=>{let ke=U.total?Math.round(U.loaded*100/U.total):0;u(ke);}}).then(U=>{var ze,$e,Ke;let ke=[];if(U.meta.requestStatus==="fulfilled"){let ve={...U.payload};if((ze=ve.FECommand)!=null&&ze.FormValidationData&&Object.keys(ve.FECommand.FormValidationData).length>0){oe.forEach(Ie=>{Ie.preview&&URL.revokeObjectURL(Ie.preview);}),u(null),y(Ie=>Ie+1);let rt=i.filter(Ie=>Ie.uploadProgress===100);a(rt),e.methodProvider.eventDispatcher({widgetName:e.properties.name,widgetValue:JSON.stringify(i),widgetEvent:null,widgetContext:null,feCommand:ve.FECommand});}else if(ve.linkedFiles&&e.properties.name){ke=k(ve.linkedFiles,100);let rt=ke.map(Ie=>{let it=Ie;return it.uploadProgress=100,it.preview=null,it});oe.forEach(Ie=>{Ie.preview&&URL.revokeObjectURL(Ie.preview);}),u(null),y(Ie=>Ie+1),a(rt),r({...e.context.params,guid:(Ke=($e=ve.FECommand)==null?void 0:$e.ReplaceContextRecordGuid)==null?void 0:Ke.guid}),ve.FECommand={...ve.FECommand,UpdateFieldAllowedValues:ve.fieldAllowedValues,UpdateFormData:ve.data},e.methodProvider.execCommands(ve.FECommand);}}});}},[i,e.context.params,e.methodProvider,e.properties.name,e.value]);return !m||!h?null:jsxs("div",{style:{...I,lineHeight:"1.1em"},children:[jsx(W,{...$,handleDialogClose:ie}),jsxs("div",{style:{position:"relative",zIndex:1,isolation:"isolate"},children:[S&&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=(Ce=e.properties)==null?void 0:Ce.dragDropLabel)!=null?ge:E("Drag and Drop..."),tryGetLinkedFile:q,onDeleteButtonPress:de,onDownloadButtonPress:A,onDownloadText:E("Download"),onDeleteText:E("Delete"),filesData:i,onDragText:"On drop text",onFilesDrop:ue,onPreviewButtonPress:ce,isMobileDevice:D.isMobileDevice,isReadonly:F},g$1),f$1!==null&&jsx(qi,{variant:"determinate",value:f$1,style:{marginTop:6,borderRadius:3,height:8}})]}),c!=null&&jsx(Suspense,{fallback:jsx($i,{}),children:jsx(Ji,{fileId:c,fileBase64:null,fieldName:e.properties.name,params:{...e.context.params,modalCloseFn:K}},nanoid(11))})]})}));Ca.displayName="_Fileuploader";var Ia=Ca;var Fa=(t,e)=>"#"+t.replace(/^#/,"").replace(/../g,o=>("0"+Math.min(255,Math.max(0,parseInt(o,16)+e)).toString(16)).substring(-2)),Da=withTranslation()(memo(function(e){var x,S;let{buttontype:o$1,colorSchema:i,fullWidth:a,name:d,style:r,tabIndex:m,title:s,variant:c,visible:v}=e.properties,T$1=useLocation(),{tabId:p}=e,f=(S=(x=e.context)==null?void 0:x.displayButtonLoader)!=null?S:false;if(!v)return null;let u=r.backgroundColor,g=u?Fa(u,-50):"";i&&(u=i+".main",g=i+".hover");let y={};return c==="outlined"?(Object.assign(y,{"&.MuiButtonBase-root":{fontSize:r.fontSize,fontWeight:r.fontWeight,border:"1px solid"+u,cursor:"pointer"}}),Object.assign(y,{"&.MuiButtonBase-root:hover":{border:g?"1px solid"+Fa(g,-50):""}})):(Object.assign(y,{"&.MuiButtonBase-root":{fontSize:r.fontSize,fontWeight:r.fontWeight,backgroundColor:u,cursor:"pointer"}}),Object.assign(y,{"&.MuiButtonBase-root:hover":{backgroundColor:g}})),jsx("div",{children:jsx(o,{variant:c,label:s,loading:f,onPointerUp:()=>{var C,E;e.methodProvider.eventDispatcher({widgetName:d,widgetValue:null,widgetEvent:U.getFormButtonEvent(o$1),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:(E=e.context.params)==null?void 0:E.folderData})});},fullWidth:a,sx:y,tabIndex:m})})}));Da.displayName="_Button";var Pa=Da;var Ra=withTranslation()(memo(function(e){var E,W,_;let o=useRef(null),{id:i,ignorereadonly:a,defaultvalue:d,dateformat:r,label:m,name:s,onchangehandler:c,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),S=I=>{var F;return e.methodProvider.eventDispatcher({widgetName:s,widgetValue:I!=null?I:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:y,hasParentForm:T.hasParentForm(),originator:(F=e.context.params)==null?void 0:F.originator})})};useEffect(()=>{!e.value&&d==="today"&&S(a$1().utc().format());},[]);let C=(W=(E=e==null?void 0:e.i18n)==null?void 0:E.language)==null?void 0:W.substr(0,2);return jsx(f$1,{id:i,defaultvalue:d,disabled:!!(v&&!a),error:x,format:r!==void 0&&r!==""&&r!=null?r:void 0,helperText:x?e.validationMessage:"",inputRef:o,label:m,locale:C,name:s,onBlur:I=>{S(I?a$1(I).utc().format():null);},size:T$1,type:"datepicker",value:(_=e.value)!=null?_:"",variant:f,visible:u})}));Ra.displayName="_Textinput";var Sa=Ra;var ka=withTranslation()(memo(function(e){var _,I,F;let o=useRef(null),{id:i,ignorereadonly:a,defaultvalue:d,dateformat:r,label:m,name:s,onchangehandler:c,readonly:v,size:T$1,tabIndex:p,variant:f,visible:u}=e.properties,g=useLocation(),{tabId:y}=e,[x,S]=useState(String((_=e.value)!=null?_:"")),C=!!(!x&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var h;S(String((h=e.value)!=null?h:""));},[e.value]);let E=h=>{var $;return S(h),e.methodProvider.eventDispatcher({widgetName:s,widgetValue:h!=null?h:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:y,hasParentForm:T.hasParentForm(),originator:($=e.context.params)==null?void 0:$.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&&E(h);}},[]);let W=(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:r!==void 0&&r!==""&&r!=null?r:void 0,helperText:C?e.validationMessage:"",id:i,inputRef:o,label:m,locale:W,name:s,onChange:h=>{E(h?a$1(h).utc().format():null);},size:T$1,value:x,variant:f,visible:u})}));ka.displayName="_Textinput";var Ma=ka;var Ba=withTranslation()(memo(function(e){var E,W,_;let o=useRef(null),{id:i,ignorereadonly:a,defaultvalue:d,dateformat:r,label:m,name:s,onchangehandler:c,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),S=I=>{var F;return e.methodProvider.eventDispatcher({widgetName:s,widgetValue:I!=null?I:"",widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:g.pathname,parentWidgetId:y,hasParentForm:T.hasParentForm(),originator:(F=e.context.params)==null?void 0:F.originator})})};useEffect(()=>{!e.value&&d==="now"&&S(a$1().utc().format());},[]);let C=(W=(E=e==null?void 0:e.i18n)==null?void 0:E.language)==null?void 0:W.substr(0,2);return jsx(h,{id:i,defaultvalue:d,disabled:!!(v&&!a),error:x,format:r!==void 0&&r!==""&&r!=null?r:void 0,helperText:x?e.validationMessage:"",inputRef:o,label:m,locale:C,name:s,onBlur:I=>{S(I?a$1(I).utc().format():null);},size:T$1,type:"datetimepicker",value:(_=e.value)!=null?_:"",variant:f,visible:u})}));Ba.displayName="_Textinput";var Na=Ba;var _a=withTranslation()(memo(function(e){var D;let o=useRef(null),{datalength:i,id:a,forcereadonly:d,ignorereadonly:r,label:m,name:s,onchangehandler:c,placeholder:v,phoneformat:T$1,readonly:p,regex:f,size:u,style:g,tabIndex:y,uppercasemode:x,variant:S,visible:C}=e.properties,E=useLocation(),{i18n:W}=useTranslation(),{viewPort:_}=b(),{tabId:I}=e,[F,h]=useState(String((D=e.value)!=null?D:"")),$=!!(e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{e.value!==void 0&&e.value!==null&&h(String(e.value));},[e.value]);let ee=L=>{var P;e.methodProvider.eventDispatcher({widgetName:s,widgetValue:L,widgetEvent:c?U.onChange:null,widgetContext:JSON.stringify({referer:E.pathname,parentWidgetId:I,hasParentForm:T.hasParentForm(),originator:(P=e.context.params)==null?void 0:P.originator})});},ne=L=>{h(L);};return jsx(n,{autoFocus:false,disabled:!!(p&&!r),error:$,helperText:$?e.validationMessage:"",id:a,inputProps:{id:a,tabIndex:y,style:{...g}},InputProps:{},inputRef:o,label:m,maxCharCount:i,name:s,onBlur:L=>{ee(L.target.value);},onInput:L=>{ne(L.target.value),_.isMobileDevice&&ee(L.currentTarget.value);},placeholder:v,locale:W==null?void 0:W.language,phoneFormat:T$1||void 0,readOnly:!!(p&&!r),regEx:f,size:u!=null?u:"small",type:T$1?"phone":"text",toUpperCase:x,value:F,variant:S,visible:C})}));_a.displayName="_PhoneInput";var La=_a;var Oa=withTranslation()(memo(function(e){var ce;let o=useRef(null),{t:i,i18n:a}=useTranslation(),d=a==null?void 0:a.language,{currency_format:r,currency_assymbol:m,currency_currencydisplay:s,currency_fixedlocale:c,datalength:v,id:T$1,ignorereadonly:p,label:f,name:u,onchangehandler:g,placeholder:y,readonly:x,regex:S,size:C,style:E,tabIndex:W,uppercasemode:_,variant:I,visible:F}=e.properties,h=useLocation(),{viewPort:$}=b(),{tabId:ee}=e,[ne,D]=useState(String((ce=e.value)!=null?ce:"0")),[L,P]=useState(false),[H,Q]=useState(0),N=useRef(0);useEffect(()=>{var K;D(String((K=e.value)!=null?K:"0"));},[e.value]),useEffect(()=>{e.validationMessage!=null&&(N.current+=1,P(false));},[e.context.formValidationData]);let k=!!(!L&&e.validationMessage!=null&&e.context.doValidateForm),q=K=>{var ue;e.methodProvider.eventDispatcher({widgetName:u,widgetValue:K,widgetEvent:g?U.onChange:null,widgetContext:JSON.stringify({referer:h.pathname,parentWidgetId:ee,hasParentForm:T.hasParentForm(),originator:(ue=e.context.params)==null?void 0:ue.originator})});},ie=K=>{D(K);},pe=r==="fixed-locale"&&c?c:d,xe=()=>{var Ce;if(s==="")return "";let K=e.context.formData,ue=e.properties.currency_inputfield;return ue&&(K!=null&&K[ue])?K[ue]:e.properties.currency_currency?e.properties.currency_currency:(r==="locale"||r==="fixed-locale")&&(Ce=k$2(pe!=null?pe:""))!=null?Ce:""},de=s==="symbol"?true:s==="code"?false:m!=null?m:false,A=r==="locale"||r==="fixed-locale"?"locale":r!=null?r:"";return jsx(n,{autoFocus:false,currency:xe(),disabled:!!(x&&!p),error:k,helperText:k?e.validationMessage:"",id:T$1,inputProps:{id:T$1,tabIndex:W,style:{...E,textAlign:"right"}},InputProps:{},inputRef:o,label:f,locale:pe,maxCharCount:v,name:u,onBlur:K=>{P(true);let ue=K.target.value;(ue==="0"||ue==="")&&Q(Ce=>Ce+1),q(ue);},onInput:K=>{ie(K.target.value),$.isMobileDevice&&q(K.currentTarget.value);},onChange:K=>{ne.trim()===""&&q(K.target.value);},placeholder:y,readOnly:!!(x&&!p),regEx:S,size:C,type:"currency",toUpperCase:_,value:ne,variant:I,visible:F,format:A,assymbol:de},H)}));Oa.displayName="_CurrencyInput";var Wa=Oa;var Ua=withTranslation()(memo(function(e){var Q,N;let o=useRef(null),{t:i,i18n:a}=useTranslation(),d=(Q=a==null?void 0:a.language)==null?void 0:Q.substring(0,2),{datalength:r,id:m,forcereadonly:s,ignorereadonly:c,label:v,name:T$1,onchangehandler:p,placeholder:f,readonly:u,regex:g,size:y,style:x,tabIndex:S,uppercasemode:C,variant:E,visible:W}=e.properties,[_,I]=useState(false),{viewPort:F}=b(),h=useLocation(),{tabId:$}=e,[ee,ne]=useState(String((N=e.value)!=null?N:"")),D=!!(ee.trim()===""&&e.validationMessage!=null&&e.context.doValidateForm);useEffect(()=>{var k;ne(String((k=e.value)!=null?k:""));},[e.value]);let L=()=>{I(k=>!k);},P=k=>{var q;e.methodProvider.eventDispatcher({widgetName:T$1,widgetValue:k,widgetEvent:p?U.onChange:null,widgetContext:JSON.stringify({referer:h.pathname,parentWidgetId:$,hasParentForm:T.hasParentForm(),originator:(q=e.context.params)==null?void 0:q.originator})});},H=k=>{ne(k);};return jsx(n,{autoFocus:false,disabled:!!(u&&!c),error:D,helperText:D?e.validationMessage:"",id:m,inputProps:{id:m,tabIndex:S,style:{...x,textAlign:"center"}},InputProps:{endAdornment:jsx(Ll,{position:"end",children:jsx(lr,{onClick:L,edge:"end",children:_?jsx(Al,{}):jsx(Vl,{})})})},inputRef:o,label:v,locale:d,maxCharCount:r,name:T$1,onBlur:k=>{P(k.target.value);},onInput:k=>{H(k.target.value),F.isMobileDevice&&P(k.currentTarget.value);},onChange:k=>{ee.trim()===""&&P(k.target.value);},placeholder:f,readOnly:!!(u&&!c),regEx:g,size:y,type:"text",toUpperCase:C,value:ee,variant:E,visible:W,inputtype:_?"text":"password"})}));Ua.displayName="_PasswordInput";var Ga=Ua;var qa=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)}})),nd=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}})),ad=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"}}})),rd=animated(Ul);function Ja(t){let e=useSpring({to:{opacity:t.in?1:0,transform:`translate3d(0,${t.in?0:20}px,0)`}});return jsx(rd,{style:e,...t})}var id=styled(Gl)({color:"inherit",fontWeight:500});function ja({icon:t,expandable:e,children:o,isFirstRootNode:i,...a}){return jsxs(TreeItem2Label,{...a,sx:{display:"flex",alignItems:"center",fontWeight:i?"700":"normal",backgroundColor:"transparent","&.Mui-focused, &.Mui-selected":{backgroundColor:"transparent"}},children:[t&&jsx(Qa,{component:t,className:"labelIcon",color:"inherit",sx:{mr:1,fontSize:"1.2rem"}}),jsx(id,{sx:{fontSize:i?"1rem":"0.9rem",fontWeight:i?"700":"normal"},children:o})]})}var Xa=t=>Array.isArray(t)?t.length>0&&t.some(Xa):!!t,Ct=t$1=>{let e=null,o=t$1.action,i=t$1.applyInternalStyle?{fontSize:"1em",marginRight:"0.5em"}:{};return o==="add"?e=jsx(t,{style:i}):o==="edit"?e=jsx(A$1,{style:i}):o==="share"?e=jsx(E,{style:i}):o==="trash"&&(e=jsx(N,{style:i})),e},ld=Pe.forwardRef(function(e,o){let{id:i,itemId:a,label:d,disabled:r,children:m$1,item:s,index:c,mode:v,setSelectedItem:T$1,treeCheckedItems:p,properties:f,disableRootItem:u,userData:g,formData:y,deletePrompt:x$1,selectedItem:S,execCommands:C,eventDispatcher:E,...W}=e,{getRootProps:_,getContentProps:I,getIconContainerProps:F,getCheckboxProps:h,getLabelProps:$,getGroupTransitionProps:ee,getDragAndDropOverlayProps:ne,status:D}=unstable_useTreeItem2({id:i,itemId:a,children:m$1,label:d,disabled:r,rootRef:o}),L=useLocation(),{t:P}=useTranslation(),[H,Q]=Pe.useState(null),N=!!H,k=Xa(m$1),q=c===0?void 0:zl,[ie,pe]=Pe.useState(D.expanded),{runFormEvent:xe}=b(),de=useCallback(async(M,te,O,n,oe,U$1)=>{var ke,ze,$e;M&&await xe({pluginCode:O.params.pluginCode,formCode:"FOLDER",guid:(ke=O.params.folderData)==null?void 0:ke.id,projectGuid:O.params.pGuid,pGuid:O.params.pGuid,widgetContext:JSON.stringify({referer:oe.pathname,parentWidgetId:U$1,hasParentForm:T.hasParentForm(),originator:(ze=O.params)==null?void 0:ze.originator,parent:O.params,folderData:($e=O.params)==null?void 0:$e.folderData}),widgetEvent:U.onDelete,widgetName:"delete",formData:O.formData}).then(Ke=>{if(Ke.meta.requestStatus==="fulfilled"){let ve={...Ke.payload};O.execCommands(ve.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]),A=M=>{M.stopPropagation(),pe(te=>!te);},ce=M=>{M.stopPropagation(),Q(M.currentTarget);},K=()=>{Q(null);},ue=useCallback(()=>{K();let M="addbtn";return e.eventDispatcher({tabIndex:0,widgetName:M,widgetValue:null,widgetEvent:U.onFolderCreateRecordEvent,widgetContext:JSON.stringify({referer:L.pathname,parentWidgetId:"",hasParentForm:T.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:e.params,widgetName:M},parent:{widgetName:M,params:e.params},isModal:true,folderData:e.params.folderData})})},[K,L.pathname,e.params,e.eventDispatcher,T.hasParentForm]),Ce=useCallback(()=>{K();let M="share";return e.eventDispatcher({tabIndex:0,widgetName:M,widgetValue:null,widgetEvent:U.onFolderShareRecordEvent,widgetContext:JSON.stringify({referer:L.pathname,parentWidgetId:"",hasParentForm:T.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:{...e.params,guid:e.params.folderData.id},widgetName:M},parent:{widgetName:M,params:e.params},isModal:true,folderData:e.params.folderData})})},[e,L.pathname]),ge=useCallback(()=>{K();let M="edit";return e.eventDispatcher({tabIndex:0,widgetName:M,widgetValue:null,widgetEvent:U.onFolderEditRecordEvent,widgetContext:JSON.stringify({referer:L.pathname,parentWidgetId:"",hasParentForm:T.hasParentForm(),parentOriginator:{params:e.params.originator?e.params.originator.params:{}},originator:{params:e.params,widgetName:M},parent:{widgetName:M,params:e.params},isModal:true,folderData:e.params.folderData})})},[e,L.pathname]),X=useCallback(async M=>{var te,O;await xe({pluginCode:e.params.pluginCode,formCode:e.params.formCode,guid:e.params.guid,projectGuid:e.params.pGuid,pGuid:e.params.pGuid,widgetContext:JSON.stringify({referer:L.pathname,parentWidgetId:null,hasParentForm:T.hasParentForm(),originator:(te=e.params)==null?void 0:te.originator,parent:e.params,folderData:(O=e.params)==null?void 0:O.folderData}),widgetEvent:U.onRefresh,widgetName:f==null?void 0:f.name,widgetValue:M,formData:y}).then(n=>{if(n.meta.requestStatus==="fulfilled"){let oe={...n.payload};oe.FECommand={...oe.FECommand,UpdateFormData:oe.data},e.execCommands(oe.FECommand);}});},[e,f==null?void 0:f.name,L.pathname]),G=useCallback(()=>{e.deletePrompt({delete:{showDialog:true,dialogTitle:P("Delete")+" ?",dialogContent:P("Are you certain that you wish to delete this folder?"),buttonAgree:P("Continue"),buttonDisagree:P("Close"),callBackFunc:M=>{M?de(M,"delete",e,{},L,""):de(false,"",e,{},L,"");}}});},[e,P,L,de]);if(v==="live"){let M=g.rightMode!=="Edit";return jsxs(qa,{..._(W),sx:{"& > ul":{paddingLeft:"0.2rem",paddingRight:"0.1rem"}},children:[jsxs(nd,{...I({className:x("content",{"Mui-expanded":ie,"Mui-selected":D.selected,"Mui-focused":D.focused,"Mui-disabled":D.disabled})}),children:[c!==0&&jsxs(Fragment,{children:[jsx(TreeItem2IconContainer,{...F({status:D,onPointerUp:A}),children:jsx(TreeItem2Icon,{status:D})}),jsx(TreeItem2Checkbox,{...h()})]}),jsx(ja,{...$({icon:q,expandable:k&&ie,isFirstRootNode:c===0,onClick:te=>{T$1&&T$1(te,a),te.stopPropagation();}}),children:d}),!M&&e.selectedItem===a&&c!==0&&jsx(lr,{size:"small",onClick:ce,"aria-controls":N?"menu":void 0,"aria-haspopup":"true","aria-expanded":N?"true":void 0,style:{marginLeft:"auto",color:"#FFF",fontSize:"14px"},children:jsx(m,{})}),jsxs(Zl,{anchorEl:H,open:N,onClose:K,onClick:te=>te.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:P("New Folder")})]}),jsxs(xt,{onClick:ge,children:[jsx(yt,{children:jsx(Ct,{action:"edit",applyInternalStyle:true})}),jsx(wt,{children:P("Settings")})]}),jsxs(xt,{onClick:Ce,children:[jsx(yt,{children:jsx(Ct,{action:"share",applyInternalStyle:true})}),jsx(wt,{children:P("Share")})]}),jsxs(xt,{onClick:G,children:[jsx(yt,{children:jsx(Ct,{action:"trash",applyInternalStyle:true})}),jsx(wt,{children:P("Delete")})]})]}),jsx(TreeItem2DragAndDropOverlay,{...ne()})]}),m$1&&jsx(Ja,{...ee(),in:ie,children:m$1})]})}else {let M=false;return p&&p.length>0&&p.forEach((te,O)=>{if(te===a){M=true;return}}),jsxs(qa,{..._({...W,expandable:false}),sx:{"& > ul":{paddingLeft:"1rem",paddingRight:"0rem"}},children:[jsxs(ad,{...I({className:x("content",{"Mui-expanded":true,"Mui-selected":D.selected,"Mui-focused":D.focused,"Mui-disabled":D.disabled})}),children:[c!==0&&jsx(Fragment,{children:jsx(TreeItem2Checkbox,{id:a,visible:true,checked:M,onPointerUp:te=>X(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,{...$({icon:q,expandable:k,isFirstRootNode:c===0}),children:d}),jsx(TreeItem2DragAndDropOverlay,{...ne()})]}),m$1&&jsx(Ja,{...ee(),in:true,children:m$1})]})}}),dd=t=>{let e=[],o=i=>{i.forEach(a=>{a.children&&a.children.length>0&&(e.push(a.id),o(a.children));});};return o(t),e},sd=(t,e)=>{let o=(i,a)=>{for(let d of i)if(d.id===a||d.children&&o(d.children,a))return d;return null};return o(t,e)},md=(t,e)=>{let o=[],i=(a,d,r=[])=>{for(let m of a){if(m.id===d)return o.push(...r),true;if(m.children&&i(m.children,d,[...r,m]))return true}return false};return i(t,e),o},Ht=(t,e)=>{for(let o of t){if(o.id===e)return o;if(o.children){let i=Ht(o.children,e);if(i)return i}}return null},It=(t,e)=>{for(let o of t){if(o.id===e)return [o.label];if(o.children){let i=It(o.children,e);if(i.length>0)return [o.label,...i]}}return []},cd=({eventDispatcher:t,execCommands:e,params:o,properties:i,redrawComponent:a,formlayout:d,onFolderSelected:r,onFolderAdded:m,formData:s,mode:c,checkedItems:v})=>{var H,Q;let{runFormEvent:T$1}=b(),[p,f]=Pe.useState([]),[u,g]=Pe.useState(((H=o==null?void 0:o.folderData)==null?void 0:H.id)||null),[y,x]=Pe.useState([]),[S,C]=Pe.useState(v),[E,W]=Pe.useState(false),[_,I]=Pe.useState(),{UserDialog:F}=b$1();Pe.useEffect(()=>{C(v);},[v]);let h=useCallback(T.debounce(async()=>{var N,k,q,ie,pe,xe,de,A,ce,K,ue;try{let Ce=await T$1({pluginCode:((N=o.sourcePluginCode)==null?void 0:N.trim())!==""?o.sourcePluginCode:o.pluginCode,formCode:((k=o.sourceFormCode)==null?void 0:k.trim())!==""?o.sourceFormCode:o.formCode,guid:o.guid,projectGuid:o.pGuid,pGuid:o.pGuid,widgetEvent:U.onFoldersDataLoad,widgetContext:JSON.stringify({originator:(q=o.originator)!=null?q:null})});if(Ce.meta.requestStatus==="fulfilled"){let ge={...Ce.payload};ge!=null&&ge.userData&&I(ge==null?void 0:ge.userData),(ie=ge==null?void 0:ge.userData)!=null&&ie.isContributor&&W(!0);let X=JSON.parse(ge.widgetData.treeData);if(f(X),(pe=o==null?void 0:o.folderData)!=null&&pe.addedFolderId){let G=sd(X,(xe=o==null?void 0:o.folderData)==null?void 0:xe.addedFolderId);if(G){let M=dd([G]);x(M),g((de=o==null?void 0:o.folderData)==null?void 0:de.addedFolderId);let te=It([G],(A=o==null?void 0:o.folderData)==null?void 0:A.addedFolderId);m(null,te);}}else if(y.length===0&&x([(ce=X[0])==null?void 0:ce.id]),!u){let G=(K=X[0])==null?void 0:K.id,M=(ue=X[0])==null?void 0:ue.isroot;g(G||null),r(G||null,M);}}}catch(Ce){}},500),[o]);Pe.useEffect(()=>(h(),()=>{h.cancel();}),[h]),Pe.useEffect(()=>{var N,k,q,ie,pe,xe;if((N=o==null?void 0:o.folderData)!=null&&N.id){g(((k=o==null?void 0:o.folderData)==null?void 0:k.id)||null);let de=Ht(p,(q=o==null?void 0:o.folderData)==null?void 0:q.id),A=It(p,de==null?void 0:de.id),ce=[],K=md(p,(ie=o==null?void 0:o.folderData)==null?void 0:ie.id);K.length>0&&(K.forEach(ue=>{ce.push(ue.id);}),ce.push((pe=o==null?void 0:o.folderData)==null?void 0:pe.id),x(ce)),r((xe=o==null?void 0:o.folderData)==null?void 0:xe.id,de==null?void 0:de.isroot,A);}},[(Q=o==null?void 0:o.folderData)==null?void 0:Q.id]);let[$,ee]=useState({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}}),ne=N=>$.delete.callBackFunc(N),D=N=>{ee(N);},L=(N,k)=>{g(k);let q=Ht(p,k),ie=It(p,q==null?void 0:q.id);r(k,q==null?void 0:q.isroot,ie);};return jsxs(Fragment,{children:[jsx(Qa,{sx:{paddingTop:"5px"},children:jsx(RichTreeView,{items:p,selectedItems:u,expandedItems:y,sx:{height:"fit-content",flexGrow:1,maxWidth:250,overflowY:"auto"},slots:{item:N=>jsx(ld,{...N,mode:c,params:o,eventDispatcher:t,execCommands:e,deletePrompt:D,index:p.findIndex(k=>k.id===N.itemId),selectedItem:u,setSelectedItem:L,treeCheckedItems:S,disableRootItem:E,userData:_,formData:s,properties:i})},onSelectedItemsChange:L,onExpandedItemsChange:(N,k)=>{var ie;let q=(ie=p[0])==null?void 0:ie.id;q&&!k.includes(q)?x(pe=>pe.includes(q)?pe:[...pe,q]):x(k);}})}),jsx(F,{...$.delete,handleDialogClose:ne})]})},ct=cd;var Za=withTranslation()(memo(function(e){var c,v;let{style:o,verticalalign:i,plugincode:a,formcode:d,visible:r}=e.properties,m={paddingTop:"0px"};if(i==="bottom"&&(m.paddingTop="10px"),!r)return null;let s=(c=e.context.formData)!=null&&c[e.properties.name]?JSON.parse((v=e.context.formData)==null?void 0:v[e.properties.name]):{};return jsx("div",{style:{...o,...m,minHeight:"2rem"},children:jsx(ct,{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"})})}));Za.displayName="_View";var er=Za;var pd=lazy(()=>import('./tabulator-FIJ5BVQH.js').then(t=>({default:t.TabulatorTable}))),gd=lazy(()=>import('./datatable-ZKC2HMF3.js').then(t=>({default:t.Datatable}))),Ve=class{static getFormComponent(e,o){if(e.displayName==="_Rowcontainer")return Hn;if(e.displayName==="_Rowsegment")return zn;if(e.displayName==="_Textinput"){if(o.inputtype==="input")return Jn;if(o.inputtype==="inputwcopy")return Kn;if(o.inputtype==="currency")return Wa;if(o.inputtype==="password")return Ga;if(o.inputtype==="date")return Sa;if(o.inputtype==="time")return Ma;if(o.inputtype==="datetime")return Na;if(o.inputtype==="phone")return La}else {if(e.displayName==="_TabBox")return Zn;if(e.displayName==="_Button")return Pa;if(e.displayName==="_Label")return oa;if(e.displayName==="_CheckBox")return ra;if(e.displayName==="_Radio")return da;if(e.displayName==="_Textarea")return ma;if(e.displayName==="_SelectBox")return fa;if(e.displayName==="_Placeholder")return ga;if(e.displayName==="_Fileuploader")return Ia;if(e.displayName==="_Table")return o.alloweditrow||o.tablemode!==void 0&&o.tablemode==="tabulator"?pd:gd;if(e.displayName==="_View")return er}return e}};function nr(t,e,o){var i=this,a=useRef(null),d=useRef(0),r=useRef(null),m=useRef([]),s=useRef(),c=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=!!(o=o||{}).leading,u=!("trailing"in o)||!!o.trailing,g="maxWait"in o,y=g?Math.max(+o.maxWait||0,e):null;useEffect(function(){return T.current=true,function(){T.current=false;}},[]);var x=useMemo(function(){var S=function(F){var h=m.current,$=s.current;return m.current=s.current=null,d.current=F,c.current=v.current.apply($,h)},C=function(F,h){p&&cancelAnimationFrame(r.current),r.current=p?requestAnimationFrame(F):setTimeout(F,h);},E=function(F){if(!T.current)return false;var h=F-a.current;return !a.current||h>=e||h<0||g&&F-d.current>=y},W=function(F){return r.current=null,u&&m.current?S(F):(m.current=s.current=null,c.current)},_=function F(){var h=Date.now();if(E(h))return W(h);if(T.current){var $=e-(h-a.current),ee=g?Math.min($,y-(h-d.current)):$;C(F,ee);}},I=function(){var F=Date.now(),h=E(F);if(m.current=[].slice.call(arguments),s.current=i,a.current=F,h){if(!r.current&&T.current)return d.current=a.current,C(_,e),f?S(a.current):c.current;if(g)return C(_,e),S(a.current)}return r.current||C(_,e),c.current};return I.cancel=function(){r.current&&(p?cancelAnimationFrame(r.current):clearTimeout(r.current)),d.current=0,m.current=a.current=s.current=r.current=null;},I.isPending=function(){return !!r.current},I.flush=function(){return r.current?W(Date.now()):c.current},I},[f,g,e,y,u,p]);return x}var xd=Pe__default.createContext(void 0),rr=({children:t,eventDispatcher:e,redrawComponent:o,formlayout:i,params:a,onFolderSelected:d,onFolderAdded:r,formData:m,execCommands:s$1})=>{let[c,v]=useState(i),{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"}},S=()=>jsx(Gl,{variant:"h6",sx:{padding:"0.5em",fontWeight:"bold",borderBottom:"1px dashed #C0C0C0"},children:u("My Folders")});return jsxs(xd.Provider,{value:{layout:c,setLayout:v},children:[(!i||i==="regular")&&t,i==="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(vd,{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(S,{}),jsx(ct,{params:{...a,sourcePluginCode:a.pluginCode,sourceFormCode:a.formCode},redrawComponent:o,eventDispatcher:e,execCommands:s$1,formData:m,formlayout:i,onFolderSelected:d,onFolderAdded:r,mode:"live"})]})]}):jsxs("div",{className:"foldersHolder",style:x.btreeContainerDesktop,children:[jsx(S,{}),jsx(ct,{params:{...a,sourcePluginCode:a.pluginCode,sourceFormCode:a.formCode},redrawComponent:o,eventDispatcher:e,execCommands:s$1,formData:m,formlayout:i,onFolderSelected:d,onFolderAdded:r,mode:"live"})]}),jsx("div",{style:x.mainContent,children:t})]})]})};var Rd=lazy(()=>import('./fileviewer-24IMJQQY.js')),Sd=lazy(()=>import('./formeditor-FC5FPX7G.js').then(t=>({default:t.Formeditor}))),Tt=t=>new Promise(e=>setTimeout(e,t));function dr(t,e={}){let o={},i=d=>{let r=d==null?void 0:d.properties;if(!(r!=null&&r.name)||!(r!=null&&r.defaultvalue)||d.stricttype!=="_Textinput")return;let{name:m,inputtype:s}=r,c=String(r.defaultvalue).toLowerCase().trim();e[m]!=null&&e[m]!==""||(s==="date"&&c==="today"?o[m]=a$1().utc().format():s==="datetime"&&c==="now"?o[m]=a$1().utc().format():s==="time"&&c==="now"?o[m]=a$1().utc().format():s==="time"&&c==="start of day"&&(o[m]=a$1().startOf("day").utc().format()));},a=d=>{if(d.type==="formrow"||d.stricttype==="_Rowcontainer")for(let r of d._children||[])for(let m of r._children||[])i(m);else if(d._children)for(let r of d._children)a(r);};for(let d of t||[])a(d);return o}var $t={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"},sr={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}},Ed={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},kd=memo(function({previewMode:e,className:o,maxWidth:i,setup:a,params:d$1,enableEventHandlers:r,modalCloseFn:m}){var Xt,Yt;let s={...d$1,modalCloseFn:m||(d$1==null?void 0:d$1.modalCloseFn)},c=useRef(null),[v,T$1]=useState(0),{registerFormSubmitEvent:p,checkFormAccess:f$1}=i$1(),{apiConfig:u,appSettings:g,viewPort:y,runLoadFormEvent:x,runServerPingEvent:S,runFormEvent:C,fetchUserMenu:E,signInUser:W,signOut:_}=b(),[I,F]=useState(null),h=useNavigate(),[$,ee]=useState(false),ne=useRef({}),[D,L]=useState({}),[P$1,H]=useState(null),[Q,N]=useState(null),k=useLocation(),[q]=useState(y.width),[ie]=useState(s.modal||false),[pe]=useState(T.hasParentForm()||!!(u!=null&&u.token)),[xe,de]=useState([]),A=xe.length>0?xe[xe.length-1]:Ed,[ce,K]=useState(),[ue,Ce]=useState(true),{t:ge,i18n:X}=useTranslation(),G=e$1(),M=f(),te=g$2(),O={command:{},params:s,doValidateForm:false,redrawComponent:false,redrawFoldersComponent:false,fieldAllowedValues:{},formData:{},widgetRelatedData:[],widgetsState:{visibility:{},readonly:{}},formDimension:{width:v,height:0},formValidationData:{},enableEventHandlers:r,isModal:ie,hasParentForm:pe,formLayout:"regular"},[n,oe]=useState(O),[U,ke]=useState({...sr,containerSetup:a}),ze=nr(()=>{c&&c.current&&T$1(c.current.offsetWidth);},200),$e=async(l,R)=>{await x({pluginCode:l.pluginCode,formCode:l.formCode,guid:l.guid,projectGuid:l.pGuid,pGuid:l.pGuid,originator:l.originator,parent:l.parent,previewMode:e,widgetContext:JSON.stringify({folderData:l.folderData,prefillData:l.prefillData})}).then(async b=>{var V,Y,Z,ye,he,be,Te,z;if(b.meta.requestStatus==="fulfilled"){let B={...b.payload};if(Object.keys(B).length===0)return;try{let se=window.location.hostname;if(!b$2.SKIP_ACCESS_VALIDATION_DOMAINS.some(He=>se===He||se.endsWith(`.${He}`))){let He=await f$1(l.formCode);(He==null?void 0:He.subscriptionPlan)!=null&&H(He.subscriptionPlan);}}catch(se){N({title:(Y=(V=se==null?void 0:se.data)==null?void 0:V.error)!=null?Y:"Form Unavailable",message:(ye=(Z=se==null?void 0:se.data)==null?void 0:Z.message)!=null?ye:"This form is temporarily unavailable."});return}if(B.uiTranslations&&Object.keys(B.uiTranslations).length>0){ne.current=B.uiTranslations,L(B.uiTranslations);let se=Fd;se.addResourceBundle(se.language,"default",B.uiTranslations,true,true);}let Me={},le={visibility:{...n==null?void 0:n.widgetsState.visibility,...(he=B==null?void 0:B.widgetsState)==null?void 0:he.visibility},readonly:{...n==null?void 0:n.widgetsState.readonly,...(be=B==null?void 0:B.widgetsState)==null?void 0:be.readOnly}};if(R){oe(se=>({...se,formData:B.data,fieldAllowedValues:B.fieldAllowedValues,widgetsState:le,formLayout:B.layout,requiredFields:B.requiredFields}));return}let Re={},Be=[],Oe={},We=JSON.parse(B.definition);if(We==null){oe({...O,redrawComponent:false,doValidateForm:false,command:{...B.FECommand},formData:{},widgetsState:le,formLayout:B.layout,requiredFields:B.requiredFields,params:{...O.params,folderData:B.folderData}});return}T.mapComponents(We._children);let Xe=We.properties;Be=We._children,Oe=We,ke({...U,containerProps:Xe,selectedWidgetProps:{...U.containerProps},containerData:Be,containerSetup:Oe}),Me=B.fieldAllowedValues,Re={...dr(Be,B.data),...B.data},oe({...O,formData:Re,formLayout:B.layout,widgetsState:{visibility:{...n==null?void 0:n.widgetsState.visibility,...(Te=B==null?void 0:B.widgetsState)==null?void 0:Te.visibility},readonly:{...n==null?void 0:n.widgetsState.readonly,...(z=B==null?void 0:B.widgetsState)==null?void 0:z.readOnly}},requiredFields:B.requiredFields,command:{...B.FECommand},fieldAllowedValues:Me,params:{...O.params,folderData:B.folderData}}),ee(true);}});};if(useEffect(()=>(ze(),$e(s,false),window.addEventListener("resize",ze),()=>{oe(()=>({...$t})),ke(sr),ee(false),window.removeEventListener("resize",ze);}),[s.pGuid,s.guid,s.pluginCode,s.formCode]),useEffect(()=>{var R;if(!$||!((R=U.containerSetup)!=null&&R._children))return;let l=U.containerSetup._children;oe(b=>{let V=dr(l,b.formData);return Object.keys(V).length===0?b:{...b,formData:{...V,...b.formData}}});},[X.language,$]),useEffect(()=>{var Y,Z,ye,he,be,Te,z,B,Me,le,Re,Be,Oe,We,Xe,se,Rt,He,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,_o,Lo,Ao,Vo,Oo,Wo,Ho,Uo,Go,zo,$o,qo,Jo,jo,Qo,Ko,Xo,Yo,Zo,en,tn,on;let l=n,R=null,b=true,V=false;if((Y=n.command)!=null&&Y.Messages&&((Z=n.command)==null||Z.Messages.forEach(me=>{var we,Ye;let re=(we=ne.current[me.text])!=null?we:ge(me.text),Ee=(Ye=me.code)==null?void 0:Ye.toUpperCase();Ee==="NOTICE"?(V=true,te({toastID:nanoid(11),msg:re,clearQueue:false,hideProgressBar:false})):Ee==="SUCCESS"?(V=true,M({toastID:nanoid(11),msg:re,clearQueue:false,hideProgressBar:false})):Ee==="WARNING"&&(b=false,G({toastID:nanoid(11),msg:re,clearQueue:false,hideProgressBar:false}));})),(ye=n.command)!=null&&ye.DisplayButtonLoader){oe({...n,displayButtonLoader:true});return}if((he=n.command)!=null&&he.DisplayErrorPage){h("/pagenotfound");return}if((be=n.command)!=null&&be.MoveToTab){let me=(z=(Te=n.command)==null?void 0:Te.MoveToTab)==null?void 0:z.widgetName;if(me){let re=T.getTabWidgetByFieldName(me,U.containerSetup);re!==null&&(re==null?void 0:re.tabId)!=null&&ve(re);}}if((B=n.command)!=null&&B.FormValidationData&&Object.keys(n.command.FormValidationData).length>0){let me=Object.keys(n.command.FormValidationData)[0];if(me){let re=T.getTabWidgetByFieldName(me,U.containerSetup);re!==null&&(re==null?void 0:re.tabId)!=null&&ve(re),setTimeout(()=>{let Ee=[`[name="${me}"]`,`[data-field-name="${me}"]`,`#${me}`,`[id*="${me}"]`],we=null;for(let Ye of Ee)try{if(we=document.querySelector(Ye),we)break}catch(St){}we&&(we.scrollIntoView({behavior:"smooth",block:"center"}),(we.tagName==="INPUT"||we.tagName==="TEXTAREA"||we.tagName==="SELECT")&&we.focus());},100);}oe({...n,doValidateForm:true,formValidationData:(Me=n.command)==null?void 0:Me.FormValidationData});return}else l={...l,formValidationData:{}};if((le=n.command)!=null&&le.FetchUserMenu&&E&&E({ProjectGuid:(Be=(Re=n.command)==null?void 0:Re.FetchUserMenu)==null?void 0:Be.projectGuid,pGuid:(We=(Oe=n.command)==null?void 0:Oe.FetchUserMenu)==null?void 0:We.projectGuid}),(Xe=n.command)!=null&&Xe.Redirect){s.modalCloseFn&&s.modalCloseFn(),h(`${(se=n.command)==null?void 0:se.Redirect.url}?ref=${(Zt=(He=(Rt=n.command)==null?void 0:Rt.Redirect)==null?void 0:He.context)==null?void 0:Zt.referer}`,{state:{from:(oo=(to=(eo=n.command)==null?void 0:eo.Redirect)==null?void 0:to.context)==null?void 0:oo.referer}});return}if((no=n.command)!=null&&no.BuildPlugin){h(`${(ao=n.command)==null?void 0:ao.BuildPlugin.url}?ref=${(io=(ro=n.command)==null?void 0:ro.BuildPlugin)==null?void 0:io.referer}`);return}if((lo=n.command)!=null&&lo.DisplayComponent&&F((so=n.command)==null?void 0:so.DisplayComponent),(mo=n.command)!=null&&mo.CloseDisplayComponent&&F(null),(co=n.command)!=null&&co.Login&&(async()=>{var me,re,Ee,we,Ye,St,nn;W&&await W((me=n.command)==null?void 0:me.Login),E&&await E({ProjectGuid:T.extractProjectGuid((Ee=(re=n.command)==null?void 0:re.Login)==null?void 0:Ee.url),pGuid:T.extractProjectGuid((Ye=(we=n.command)==null?void 0:we.Login)==null?void 0:Ye.url)}),h(((nn=(St=n.command)==null?void 0:St.Login)==null?void 0:nn.url)||"/");})(),(uo=n.command)!=null&&uo.Logout&&(async()=>{var re;(re=n.command)!=null&&re.Logout&&(_&&await _(),h("/"));})(),((fo=n.command)!=null&&fo.Cancel||(po=n.command)!=null&&po.CloseForm)&&(n.isModal&&s.modalCloseFn!==void 0?s.modalCloseFn(null,null,false,(go=n.command)==null?void 0:go.RedrawFolders):(R=T.getUrlParameter("ref"),R!=null&&h(R))),(ho=n.command)!=null&&ho.AfterRecordSave){let me=(bo=g==null?void 0:g.TOASTER_AUTOCLOSE)!=null?bo:b$2.TOASTER_AUTOCLOSE;if(R=T.getUrlParameter("ref"),((vo=n.command)==null?void 0:vo.AfterRecordSave.guid)==null)!((yo=n.command)!=null&&yo.OpenModal)&&s.modalCloseFn?s.modalCloseFn(null,null,false,null,null):(wo=n.command)!=null&&wo.OpenModal||(async()=>(await Tt(V?me:0),R!=null&&h(R)))();else if(n.isModal){let re;(xo=n.command)!=null&&xo.HotReloadEnabled&&(re=(Co=n.command)==null?void 0:Co.HotReloadEnabled),(Io=n.command)!=null&&Io.OpenModal||(async()=>{var Ee,we;await Tt(V?me:0),s.modalCloseFn&&s.modalCloseFn(re,n.formData,(Ee=n.command)==null?void 0:Ee.RedrawScreen,(we=n.command)==null?void 0:we.RedrawFolders,null);})();}else {let re=R!=null;if(!((Fo=n.command)!=null&&Fo.OpenModal)&&re&&b)(async()=>(await Tt(V?me:0),R!=null&&h(R)))();else if(!((To=n.command)!=null&&To.OpenModal)){let Ee=k.pathname.replace(/\/new/gi,"/"+((Do=n.command)==null?void 0:Do.AfterRecordSave.guid.replace(/#/g,"%23")));h(Ee,{state:{from:k.pathname}}),l={...l,params:{...n.params,guid:(Po=n.command)==null?void 0:Po.AfterRecordSave.guid}};}}}if((Ro=n.command)!=null&&Ro.UpdateWidgetsState&&(l={...l,widgetsState:{visibility:{...l==null?void 0:l.widgetsState.visibility,...(Eo=(So=n.command)==null?void 0:So.UpdateWidgetsState)==null?void 0:Eo.visibility},readonly:{...l==null?void 0:l.widgetsState.readonly,...(Mo=(ko=n.command)==null?void 0:ko.UpdateWidgetsState)==null?void 0:Mo.readonly}}}),(Bo=n.command)!=null&&Bo.UpdateFieldAllowedValues&&(l={...l,fieldAllowedValues:{...(No=n.command)==null?void 0:No.UpdateFieldAllowedValues}}),(_o=n.command)!=null&&_o.UpdateFormData&&(l={...l,formData:{...(Lo=n.command)==null?void 0:Lo.UpdateFormData}}),(Ao=n.command)!=null&&Ao.UpdateFormDataItem&&(l={...l,formData:{...l.formData,[(Vo=n.command)==null?void 0:Vo.UpdateFormDataItem.name]:(Oo=n.command)==null?void 0:Oo.UpdateFormDataItem.value}}),((Ho=(Wo=n.command)==null?void 0:Wo.ReplaceContextRecordGuid)==null?void 0:Ho.guid)!=null&&(l={...l,displayButtonLoader:false,params:{...n.params,guid:(Uo=n.command)==null?void 0:Uo.ReplaceContextRecordGuid.guid}}),(Go=n.command)!=null&&Go.OpenModal){let me={...(zo=n.command)==null?void 0:zo.OpenModal,parentId:s.id};de(re=>[...re,me]),l={...l,command:{}};}($o=n.command)!=null&&$o.PreviewDocument&&K((qo=n.command)==null?void 0:qo.PreviewDocument),(Jo=n.command)!=null&&Jo.RedrawScreen&&(l={...l,redrawComponent:!n.redrawComponent,redrawFoldersComponent:!n.redrawFoldersComponent}),(jo=n.command)!=null&&jo.RedrawFolders&&(l={...l,params:{...n.params,folderData:{id:(Ko=(Qo=n.command)==null?void 0:Qo.RedrawFolders)==null?void 0:Ko.folderId,addedFolderId:(Yo=(Xo=n.command)==null?void 0:Xo.RedrawFolders)==null?void 0:Yo.folderId,isRoot:(en=(Zo=n.command)==null?void 0:Zo.RedrawFolders)==null?void 0:en.isRoot,captions:(on=(tn=n.command)==null?void 0:tn.RedrawFolders)==null?void 0:on.captions}}}),Object.keys(n.command).length>0&&(l={...l,command:{}},oe(l));},[n.command]),Q)return jsx(l$1,{title:Q.title,message:Q.message});if(!$)return Pe__default.createElement("div",{},jsx(a$2,{message:ge("Please wait...")}));let Ke=(l,R)=>{let b={};return Object.entries(l).forEach(([V,Y])=>{let Z=R[V];(Z==null||Z===""||Z==="0"||Z===0||Array.isArray(Z)&&Z.length===0)&&(b[V]=Y);}),b},ve=(l,R=false,b={})=>{let V=ft(null,l.tabId,l.index,R,b.containerSetup);if(V===void 0)return;let Y=T.GetParentTabId(V.containerSetup,l.tabId);(Y==null?void 0:Y.tabId)!=null?(V=ft(null,Y.tabId,Y.index,false,V.containerSetup),V!==void 0&&ve(Y,true,V)):R===false&&ft(null,l.tabId,l.index,true);},rt=async l=>(oe({...n,displayButtonLoader:true}),await C({pluginCode:l.pluginCode,formCode:l.formCode,guid:l.guid,projectGuid:l.projectGuid,pGuid:l.projectGuid,formData:{...l.formData,[l.fieldName]:l.value},widgetContext:JSON.stringify({referer:k.pathname,parentWidgetId:l.tabId,hasParentForm:T.hasParentForm(),originator:{widgetName:l.fieldName.toLowerCase(),params:n.params},parent:{widgetName:l.fieldName.toLowerCase(),params:n.params},parentOriginator:{params:n.params.originator?n.params.originator.params:{}},folderData:n.params.folderData}),widgetEvent:l.widgetEvent,widgetName:l.fieldName.toLowerCase(),widgetValue:l.widgetValue}).then(async R=>{var b,V,Y,Z,ye,he,be,Te;if(R.meta.requestStatus==="fulfilled"){let z={...R.payload};((b=z.FECommand)==null?void 0:b.ReplaceContextRecordGuid)!==void 0?(z.FECommand={Messages:(Y=(V=z.FECommand)==null?void 0:V.Messages)!=null?Y:[],UpdateFormData:z.data,ReplaceContextRecordGuid:(Z=z.FECommand)==null?void 0:Z.ReplaceContextRecordGuid},ot(z.FECommand)):(ye=z.FECommand)!=null&&ye.Messages?(z.FECommand={UpdateFormData:z.data,Messages:(he=z.FECommand)==null?void 0:he.Messages},ot(z.FECommand)):(be=z.FECommand)!=null&&be.FormValidationData&&(z.FECommand={FormValidationData:(Te=z.FECommand)==null?void 0:Te.FormValidationData},ot(z.FECommand));}else oe({...n,displayButtonLoader:false});})),Ie=l=>{let R=l.widgetContext,b=l.widgetEvent,V=l.widgetName.toLowerCase(),Y=l.widgetValue,Z=l.feCommand||{},ye=l.skipFormDataItem||false;if(b!==null&&n.enableEventHandlers){if(l.autoSave){rt(l.autoSave);return}let he=Y!=null&&ye===false?{...n.formData,[V]:Y}:n.formData;if((b==null?void 0:b.toUpperCase())==="ONSAVE"&&n.requiredFields!=null){let be=Ke(n.requiredFields,he),Te=Object.keys(n.formValidationData||{}).length>0,z=Object.keys(be).length>0;if((z||Te)&&(oe({...n,command:{...n.command,FormValidationData:be}}),z))return}(async()=>{var be,Te;if((b==null?void 0:b.toUpperCase())==="ONSAVE")try{await p(n.params.formCode);}catch(z){if((z==null?void 0:z.status)===429)return}Ce(false),await C({pluginCode:n.params.pluginCode,formCode:n.params.formCode,guid:n.params.guid,projectGuid:(be=n.params.pGuid)!=null?be:"",pGuid:(Te=n.params.pGuid)!=null?Te:"",widgetContext:R,widgetEvent:b,widgetName:V,widgetValue:typeof Y=="string"?Y:Y!=null?JSON.stringify(Y):null,formData:he,widgetsState:n.widgetsState}).then(z=>{var B,Me;if(z.meta.requestStatus==="fulfilled"){if(z.payload instanceof Blob){oe({...n,redrawComponent:!n.redrawComponent});return}let le={...z.payload};if(Object.keys(le).length===0)return;let Re=JSON.parse(le.definition);if(Re!=null){let Be=[],Oe={};T.mapComponents(Re._children);let We=Re.properties;Be=Re._children,Oe=Re,ke({...U,containerProps:We,selectedWidgetProps:{...U.selectedWidgetProps},containerData:Be,containerSetup:Oe});let Xe=V;if(Xe){let se=T.getTabWidgetByFieldName(Xe,Oe);se!==null&&(se==null?void 0:se.tabId)!=null&&ve(se,true,{containerSetup:Oe});}}ye||(n.redrawComponent=false),oe({...n,fieldAllowedValues:le.fieldAllowedValues,doValidateForm:true,command:{...le.FECommand},formData:{...n.formData,...le.data},widgetRelatedData:le.widgetRelatedData,widgetsState:{visibility:{...n==null?void 0:n.widgetsState.visibility,...(B=le==null?void 0:le.widgetsState)==null?void 0:B.visibility},readonly:{...n==null?void 0:n.widgetsState.readonly,...(Me=le==null?void 0:le.widgetsState)==null?void 0:Me.readOnly}},tabIndex:l.tabIndex?Number(l.tabIndex+1):0});}}).finally(async()=>{var z;if(Ce(true),(b==null?void 0:b.toUpperCase())==="ONSAVE"&&u!=null&&u.iframeMode&&u!=null&&u.token){let B=(z=U.containerProps)==null?void 0:z.webhooks;if(Array.isArray(B)&&B.length>0){let Me={formCode:n.params.formCode,submittedAt:new Date().toISOString(),data:he};B.forEach(le=>{var Re;le.enabled&&((Re=le.url)!=null&&Re.startsWith("http"))&&fetch(le.url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Me),mode:"cors"}).then(Be=>{Be.ok||G({toastID:nanoid(11),msg:`Webhook failed: ${le.url}`,clearQueue:false,hideProgressBar:false});}).catch(Be=>{G({toastID:nanoid(11),msg:`Webhook failed: ${le.url}`,clearQueue:false,hideProgressBar:false});});});}}});})();}if(Y!=null){let he={...n.formData,[V]:Y};oe({...n,command:Z,formData:he});}},it=(l,R,b)=>T.findRowItem(l,R,b,U.containerSetup._children),ur=(l,R,b,V)=>T.findSegmentItem(l,R,b,V,U.containerSetup._children),fr=l=>T.findWidgetByIdRecursive(U.containerSetup._children,l),pr=(l,R)=>T.getActiveTabIndex(U.containerSetup._children,R),ft=(l,R,b,V=true,Y={})=>{let Z=Object.keys(Y).length>0?Y:U.containerSetup;if(!R)return;let ye=T.getTabContainer(Z._children,R),he=T.getTabContainerChildrens(Z._children,R);if(he===void 0)return;for(let B=0;B<he.data.length;B++)he.data[B].activeTab="0";let be=he.data.filter((B,Me)=>Me===b)[0];be.properties={...ye.item.properties.tabsetup,...be.properties};let Te=T.getNodeUpdatePath(he.path,{$splice:[[b,1,{...be,activeTab:"1"}]]});var z={containerSetup:{...Z,_children:(0, mr.default)(Z._children,Te)},selectedWidgetProps:{...U.selectedWidgetProps,tabsetup:{...be.properties},_path:{...U.selectedWidgetProps._path,panelId:be.id},lastActiveTabId:R}};return V&&ke(z),z},gr=(l=true)=>{let R=$t;l&&(R={...n,redrawComponent:!n.redrawComponent,params:{...n.params,folderData:{id:"",isRoot:"",captions:[]}}}),oe(R);},ot=l=>{oe({...n,redrawComponent:!n.redrawComponent,command:{...l}});},qt=(l,R)=>{(async()=>{if(!S){l();return}await S({cmd:"ping"}).then(async b=>{(b==null?void 0:b.type)==="formbuilder/ping/rejected"?(G({toastID:nanoid(11),msg:"Application is being restarted. Please wait until it finishes....",clearQueue:false,hideProgressBar:false}),await Tt(1e3),qt(l)):l();});})();},Pt=(l,R=false,b,V=null)=>{qt(()=>{if(de(Z=>Z.slice(0,-1)),V!=null){let Z={...V,parentId:s.id};de(ye=>[...ye,Z]);}else if(l!=null){let Z={id:nanoid(5),pluginCode:l==null?void 0:l.pluginCode,formCode:l==null?void 0:l.formCode,guid:null,isFormEditorMode:true,parentId:s.id};de(ye=>[...ye,Z]);}if($e(n.params,true),b){let Z=b==null?void 0:b.folderId;Jt(Z,[]);}else oe({...n,redrawComponent:!n.redrawComponent});}),R&&n.isModal&&$e(s,true);},hr=(l,R="",b)=>{let V={...n,redrawFoldersComponent:!n.redrawFoldersComponent,redrawComponent:!n.redrawComponent,params:{...n.params,folderData:{...n.params.folderData,addedFolderId:"",captions:b,id:l!==null?l:"",isRoot:R}}};oe(V);},Jt=(l,R)=>{let b=$t;l==null?b={...n,redrawFoldersComponent:!n.redrawFoldersComponent,params:{...n.params,folderData:{...n.params.folderData,addedFolderId:l!==null?l:"",captions:R}}}:b={...n,params:{...n.params,folderData:{...n.params.folderData,id:l!==null?l:"",addedFolderId:l!==null?l:"",isRoot:"",captions:R}}},oe(b);},jt=l=>{l&&de(R=>[...R.slice(0,-1),{...l,id:nanoid(5)}]);},br=()=>{K(void 0);},vr=()=>F(null),yr=l=>{let{title:R,subtitle:b}=l,V=R;return b!==void 0&&String(b).trim()!==""&&(V=R+" - "+b),n.enableEventHandlers&&Object.keys((n==null?void 0:n.formData)||{}).length>0&&Object.entries(n.formData).forEach(([Y,Z])=>{V=V.replace(`#${Y}`,Z);}),V},{properties:Fe}=U.containerSetup||{},{minHeight:Qt}=(Fe==null?void 0:Fe.style)||{},pt={};Qt&&(pt.minHeight=Qt),ie&&(pt={...pt,width:"100%",minWidth:q-q*.3,maxHeight:"calc(100dvh - 4rem)",overflow:"auto"});let Kt={};return e&&(Kt={overflowY:"scroll",height:"100vh",padding:"0px 10px 10px 10px"}),jsx(k$1.Provider,{value:P$1,children:jsx(va.Provider,{value:D,children:jsxs(rr,{execCommands:ot,eventDispatcher:Ie,redrawComponent:n.redrawFoldersComponent,formlayout:n.formLayout,params:n.params,onFolderSelected:hr,onFolderAdded:Jt,formData:n.formData,children:[jsxs("div",{id:"main-content-wrapper",className:o,children:[jsx("div",{className:"content",children:jsx("div",{className:"main-content on-scrollbar",style:Kt,children:jsxs("div",{id:"formCanvas",ref:c,style:{maxWidth:i,border:(Fe==null?void 0:Fe.border)===false?"none":void 0},children:[jsxs("form",{onSubmit:l=>{l.preventDefault();},style:{position:"relative"},children:[Fe&&!Fe.hideheader&&jsxs("div",{className:"form-header top-border-radius",style:{backgroundColor:(Fe==null?void 0:Fe.headerbackground)===false?"transparent":void 0},children:[jsx("div",{style:{flex:1,marginLeft:"0.5rem"},children:Fe&&yr(Fe)}),ie&&s.modalCloseFn!==void 0&&jsx("div",{style:{width:"2.5em"},children:jsx(lr,{onClick:()=>s.modalCloseFn(null),children:Pe__default.createElement(P)})})]}),Fe&&Fe.hideheader&&ie&&s.modalCloseFn!==void 0&&jsx("div",{style:{position:"absolute",top:"0.5rem",right:"0.5rem",zIndex:9999},children:jsx(lr,{size:"medium",onClick:l=>{l.stopPropagation(),s.modalCloseFn(null);},sx:{backgroundColor:"rgba(255, 255, 255, 0.95)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"}},children:Pe__default.createElement(P)})}),jsx("div",{style:pt,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(Md,{eventDispatcher:Ie,context:n,formWidth:v,findRowItem:it,findSegmentItem:ur,findWidgetItem:fr,modal:ie,getActiveTabIndex:pr,setActiveTabIndex:ft,setRedrawComponent:gr,execCommands:ot,widgets:U.containerSetup})})})})})]}),I!==null&&jsx(d,{componentName:I.componentName,options:I.options,params:{params:(Xt=I.options)!=null&&Xt.contextParams?(Yt=I.options)==null?void 0:Yt.contextParams:n.params,formData:n.formData,execCommands:l=>ot(l),modalCloseFn:()=>vr(),modalCloseAndOpenFn:l=>jt(l)}})]})})}),(P$1==null?void 0:P$1.toLowerCase())==="free"&&!ie&&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...")}),!A.isFormEditorMode&&ce&&ce.fileId&&jsx(Suspense,{fallback:jsx(a$2,{message:ge("Loading viewer...")}),children:jsx(Rd,{fileId:ce.fileId,fileBase64:ce.data,fieldName:ce.fieldName,params:{...ce.context?ce.context:n.params,modalCloseFn:br}},nanoid(11))}),!A.isFormEditorMode&&(A==null?void 0:A.pluginCode)&&(A==null?void 0:A.formCode)&&jsx(a$3,{component:jsx(kd,{params:{id:A.id,parentId:A.parentId,pluginCode:A.pluginCode,formCode:A.formCode,guid:A.guid==null?"new":A.guid,pGuid:A.pGuid,modal:true,modalCloseFn:(l,R,b,V,Y=null)=>Pt(l,b,V,Y),modalCloseAndOpenFn:l=>jt(l),originator:A.originator,parent:A.parent,folderData:A.folderData,prefillData:A.prefillData},enableEventHandlers:true}),id:A.id,onCloseModal:Pt,parentId:A.parentId},A.id),A.isFormEditorMode&&(A==null?void 0:A.pluginCode)&&(A==null?void 0:A.formCode)&&jsx(a$3,{component:jsx(Suspense,{fallback:jsx(a$2,{}),children:jsx(Sd,{inPreviewMode:false,pluginCode:A.pluginCode,formCode:A.formCode,modal:true},nanoid(11))}),id:A.id,onCloseModal:()=>Pt(null,false,null),parentId:A.parentId,windowMode:"fullWindow"},A.id)]})})})}),Md=t=>{let e=0,o=i=>{for(var a in i)typeof i[a]=="object"&&i[a]!==null?o(i[a]):a==="tabIndex"&&(t.modal?i[a]=0:i[a]=++e);};return o(t.widgets._children),(t.widgets._children||[]).map(({id:i,tabId:a,panelId:d,type:r,component:m,properties:s})=>Pe__default.createElement(Ve.getFormComponent(m,s),{key:"key_"+i,id:i,tabId:a,panelId:d,className:r,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}},i))};
|
|
2
|
-
export{Vn as a,kd as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as Formeditor,b as widgetInitialStyle}from'./chunk-63P2HHLW.js';import'./chunk-CFWUMDWI.js';import'./chunk-AW7CYQHE.js';import'./chunk-POE6K4NQ.js';import'./chunk-3UNAMWG4.js';import'./chunk-FRAOYRZD.js';import'./chunk-22LEYH6Q.js';import'./chunk-TYVVEP34.js';import'./chunk-U4T4ACDE.js';import'./chunk-LBMVBVXW.js';import'./chunk-AYYTOQGP.js';import'./chunk-AR42AC7J.js';import'./chunk-SDIZEEZP.js';import'./chunk-5TBO732O.js';
|