@buildocsdev/sdk 1.1.22 → 1.1.23

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.
@@ -0,0 +1 @@
1
+ import {d}from'./chunk-SYCZSSRF.js';import {a}from'./chunk-POE6K4NQ.js';import {e,b as b$1}from'./chunk-FRAOYRZD.js';import {U,T,k}from'./chunk-KW32CT2P.js';import'./chunk-U4T4ACDE.js';import {b}from'./chunk-LBMVBVXW.js';import {d as d$1,t,p,V,h,q,g,N,_,Y,W,X,Z,P,r,n,i,w,A,b as b$2,y,x,C,l,O,o}from'./chunk-AR42AC7J.js';import'./chunk-5TBO732O.js';import dt,{lazy,memo,useRef,useState,useEffect,useCallback,useMemo,Suspense}from'react';import {withTranslation,useTranslation}from'react-i18next';import qn from'@mui/material/CircularProgress';import Xt from'@mui/material/Box';import Fe from'@mui/material/Button';import $n from'@mui/material/Checkbox';import Kn from'@mui/material/ClickAwayListener';import Kt from'@mui/material/IconButton';import Qe from'@mui/material/ListItemIcon';import Xe from'@mui/material/ListItemText';import Ze from'@mui/material/MenuItem';import Qn from'@mui/material/MenuList';import re from'@mui/material/Tooltip';import {nanoid}from'@reduxjs/toolkit';import {useNavigate,useLocation}from'react-router-dom';import en from'@mui/material/Menu';import Zn from'axios';import ea from'@mui/icons-material/MoreVert';import {jsx,Fragment,jsxs}from'react/jsx-runtime';var ta=lazy(()=>import('./buildocslib.esm-AQXFL65L.js').then(c=>({default:c.DatatableImb}))),na="#1976d2";var ut=(r=>(r[r.SIGN=0]="SIGN",r[r.CONFIRM=1]="CONFIRM",r))(ut||{}),tn=(l=>(l[l.SIGN=0]="SIGN",l[l.CONFIRM=1]="CONFIRM",l[l.EDIT=2]="EDIT",l))(tn||{}),et=(c,e,r,l,g)=>{var le,G,se,E,b;return e.methodProvider.eventDispatcher({skipFormDataItem:true,widgetName:e.properties.name.toLowerCase(),widgetValue:JSON.stringify({action:c,rowData:{_id:(le=r._id)!=null?le:null,_sk:(G=r._sk)!=null?G:null,_code:(se=r._fcode)!=null?se:r._code,_origformcode:(E=r._origformcode)!=null?E:null,_plugincode:(b=r._plcode)!=null?b:r._plugincode}}),widgetEvent:U.onTableRunActionEvent,widgetContext:JSON.stringify({referer:l.pathname,parentWidgetId:g,hasParentForm:T.hasParentForm(),originator:{widgetName:e.properties.name.toLowerCase(),params:e.context.params},parent:{widgetName:e.properties.name.toLowerCase(),params:e.context.params},folderData:e.context.params.folderData})})},Se=(c,e)=>{var r,l;return !(c==="file"&&e.formLayout==="folders"&&((r=e.params.folderData)!=null&&r.isRoot||((l=e.params.folderData)==null?void 0:l.id)===null))},aa=({anchorEl:c,handleClose:e$1,setUploadMode:r,uploadMode:l,props:g,setLoaded:le})=>{let{runFormUploadFiles:G}=b(),se=e(),E=!!c,b$1=useRef(null),[ie,q]=useState([]),{t:ce}=useTranslation(),te=(de="file")=>{if(!Se(de,g.context)){se({toastID:nanoid(11),msg:ce("Please select a folder before uploading a file"),clearQueue:false,hideProgressBar:false});return}b$1.current&&b$1.current.click(),r(de),e$1();},$=async de=>{var m,R;let me=de.target.files;if(me){le(false);let _=Array.from(me).map(T=>({...T,uploadProgress:0})),x=new FormData;if(g.context.params)for(let T in g.context.params)g.context.params.hasOwnProperty(T)&&x.append(T,g.context.params[T]);x.append("fieldName",g.properties.name),Array.from(me).forEach(T=>{x.append("files",T);}),x.append("widgetContext",JSON.stringify({hasParentForm:T.hasParentForm(),originator:(m=g.context.params)==null?void 0:m.originator,folderData:(R=g.context.params)==null?void 0:R.folderData})),x.append("widgetEvent",U.onFileUploadCreateDocumentEvent),x.append("widgetName","attached_files"),x.append("formData",JSON.stringify({...g.context.formData})),x.append("uploadMode",l);let B=Zn.CancelToken.source();try{let T=await G({content:x,cancelTokenSource:B,onUploadProgress:X=>{let he=Math.round(X.loaded/_.length),ye=_.map(be=>({...be,uploadProgress:X.loaded===X.total?100:Math.round(he*100/be.size)}));q(be=>be.concat(ye));}});if(T.meta.requestStatus==="fulfilled"){let X={...T.payload};g.methodProvider.execCommands(X.FECommand);}}catch(T){}b$1.current&&(b$1.current.value="");}},Te=Se("file",g.context)?"inherit":"#C0C0C0";return jsxs(Fragment,{children:[jsx("input",{type:"file",name:"files",ref:b$1,style:{display:"none"},onChange:$,multiple:true}),jsxs(en,{anchorEl:c,open:E,onClose:e$1,MenuListProps:{"aria-labelledby":"upload-button"},children:[jsxs(Ze,{onPointerUp:()=>te("file"),children:[jsx(Qe,{sx:{color:Te},children:jsx(Pe,{action:"uploadfile",applyInternalStyle:true})}),jsx(Xe,{primary:ce("Upload File(s)"),primaryTypographyProps:{fontSize:"0.875rem",color:Te}})]},"Upload File(s)"),jsxs(Ze,{onPointerUp:()=>te("container"),children:[jsx(Qe,{children:jsx(Pe,{action:"uploadzipfile",applyInternalStyle:true})}),jsx(Xe,{primary:ce("Upload .ZIP Archive"),primaryTypographyProps:{fontSize:"0.875rem"}})]},"Upload .ZIP Archive")]})]})},oa=(c,e,r,l)=>(c._plugincode=e.context.params.pluginCode,c._origformcode=c._code=e.context.params.formCode,et("onrowcheckboxclicked",e,c,r,l)),ia=({value:c,style:e})=>{let[r,l]=dt.useState(false),g=dt.useRef(null);return jsx(re,{title:String(c!=null?c:"").trim()?c:"No data",open:r,arrow:true,children:jsx("div",{ref:g,style:e,onMouseEnter:()=>{g.current&&g.current.scrollWidth>g.current.clientWidth&&l(true);},onMouseLeave:()=>l(false),children:c||""})})},gt=c=>!!(c.readonly&&!c.ignorereadonly),st=c=>{let e=c.replace(/\s/g,""),r=e.lastIndexOf(","),l=e.lastIndexOf("."),g;return r>l?g=e.replace(/\./g,"").replace(",","."):l>r?g=e.replace(/,/g,""):g=e,parseFloat(g)},Qt=(c,e,r,l)=>c===0?"first":c<e?"previous":l>0&&(c+1)*r>=l?"last":"next",ct={rowsPerPage:0,pageIndex:0,serverPaginationEnabled:false,nextToken:"",paginationDirection:"first",previousToken:"",rowCount:0,qId:""},ra={string:"freetext",freetext:"freetext",currency:"price",price:"price",date:"date",datetime:"datetime",number:"number",checkbox:"checkbox"},nn=withTranslation()(memo(function(e$1){var bt,Ct,Dt;let r$1=useRef(false),{runFormEvent:l,viewPort:g$1}=b(),le=e(),{UserDialog:G}=b$1(),se=e$1.properties.name,E=d(se,e$1.properties.pagesize||50),{pageIndex:b$2,pageSize:ie}=E,[q$1,ce]=useState(null),[te,$]=useState(false),[Te,de]=useState("single"),[me,m]=useState([]),[R,_$1]=useState(0),[x,B]=useState(),[T$1,X$1]=useState(),[he,ye]=useState(false),[be,Be]=useState(false),[I,P$1]=useState({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}}),[M,O]=useState(true),[Z$1,Oe]=useState({}),ee=useRef(e$1),ve=useRef(e$1.context.formData);useEffect(()=>{ee.current=e$1;},[e$1]),useEffect(()=>{ve.current=e$1.context.formData;},[e$1.context.formData]);let[sa,an]=useState((bt=e$1.context)==null?void 0:bt.widgetRelatedData),ke=useCallback(async(a,t,i,d,o)=>{$(false),await l({pluginCode:t.context.params.pluginCode,formCode:t.context.params.formCode,guid:t.context.params.guid,projectGuid:t.context.params.pGuid,pGuid:t.context.params.pGuid,formData:t.context.formData,widgetContext:JSON.stringify({referer:d.pathname,parentWidgetId:o,hasParentForm:T.hasParentForm(),originator:{widgetName:t.properties.name.toLowerCase(),params:t.context.params},parent:{widgetName:t.properties.name.toLowerCase(),params:t.context.params},parentOriginator:{params:t.context.params.originator?t.context.params.originator.params:{}},folderData:t.context.params.folderData}),widgetEvent:U.onTableEditRunActionEvent,widgetName:t.properties.name.toLowerCase(),widgetValue:JSON.stringify({action:a,data:i})}).then(u=>{var w;if(u.meta.requestStatus==="fulfilled"){let y={...u.payload};y.FECommand={...y.FECommand,UpdateFieldAllowedValues:y.fieldAllowedValues,UpdateFormData:y.data,UpdateFormDataItem:{name:t.properties.name,value:(w=y.data)==null?void 0:w[t.properties.name]}},t.methodProvider.execCommands(y.FECommand);}});},[]),Ie=useCallback(async(a,t,i,d,o,u)=>{$(false),u.toggleAllRowsSelected(false),await l({pluginCode:t.context.params.pluginCode,formCode:t.context.params.formCode,guid:t.context.params.guid,projectGuid:t.context.params.pGuid,pGuid:t.context.params.pGuid,widgetContext:JSON.stringify({referer:d.pathname,parentWidgetId:o,hasParentForm:T.hasParentForm(),originator:{widgetName:t.properties.name.toLowerCase(),params:t.context.params},parent:{widgetName:t.properties.name.toLowerCase(),params:t.context.params},parentOriginator:{params:t.context.params.originator?t.context.params.originator.params:{}},folderData:t.context.params.folderData}),widgetEvent:U.onTableRunBatchActionEvent,widgetName:t.properties.name.toLowerCase(),widgetValue:JSON.stringify({action:a,data:i})}).then(w=>{if(w.meta.requestStatus==="fulfilled"){let y={...w.payload};y.widgetData&&m(Object.values(y.widgetData)),O(true),$(true),y.FECommand&&t.methodProvider.execCommands(y.FECommand);}});},[e$1.context.params.pluginCode,e$1.context.params.formCode,e$1.context.params.guid,e$1.context.params.pGuid,e$1.properties.name,e$1.context.formData]),on=useCallback((a,t,i,d,o,u)=>{a&&(i.properties.alloweditrow?ke("delete",i,JSON.stringify(d),o,u):et(t,i,d,o,u)),P$1({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}});},[e$1.properties.alloweditrow]),yt=useCallback((a,t,i,d,o,u,w)=>{a&&Ie(t,i,d,u,w,o),P$1({delete:{buttonAgree:"",buttonDisagree:"",dialogTitle:"",dialogContent:"",showDialog:false,callBackFunc:()=>{}}});},[Ie,P$1]),rn=a=>I.delete.callBackFunc(a),tt=a=>{P$1(a);},{alloweditrow:Ce,backendpagination:ne,colactions:ln,colgrouping:sn,colordering:cn,colresizing:dn,enableuploadfiles:mn,height:un,hideaddbutton:gn,newrecordurl:pt,folders:ze,pagination:fn,pagesize:Ue,rowactions:yn,rowactiontype:Ve,rowclickas:He,rowdensity:pn,rownumber:xn,rowselection:wn,rowvirtualization:hn,search:bn,searchtype:Ge,selectall:Cn,stickyheader:Dn,toolbarInternalActions:Rn,topToolbar:_n,visible:Fn}=e$1.properties,nt=fn===true,Tn=hn!==false&&!nt,In=nt,xt=Ve==="flat"||Ve==="menu"||Ve==="primary",wt=useNavigate(),F=useLocation(),{tabId:v}=e$1,{t:K,i18n:at}=useTranslation(),W$1=(Ct=at==null?void 0:at.language)==null?void 0:Ct.substring(0,2),ht=useCallback((a,t)=>{E.setLastEvaluatedKey(Number(a),t||null);},[E]),We=useCallback(a=>E.getLastEvaluatedKey(Number(a)),[E]),Le=useCallback(async(a,t,i,d,o)=>{var k,L;$(false),a&&(_$1(0),B(null),X$1(ct));let u=Qt(i.pageIndex,b$2,i.pageSize,R),w=We(i.pageIndex-1),y=u==="last"?"":d;he&&u!=="last"&&(u==="next"&&(y=We(i.pageIndex+1)),u==="previous"&&(w=We(i.pageIndex+1))),await l({DataTableMeta:{serverPaginationEnabled:ne,rowsPerPage:i.pageSize,pageIndex:i.pageIndex,nextToken:y,previousToken:w,paginationDirection:u==="last"?"last":t,rowCount:R,qId:o==null?void 0:o.qId,lastRequestLimit:o==null?void 0:o.lastRequestLimit,oppositeDirection:u==="last"||he},pluginCode:e$1.context.params.pluginCode,formCode:e$1.context.params.formCode,guid:e$1.context.params.guid,projectGuid:e$1.context.params.pGuid,pGuid:e$1.context.params.pGuid,widgetContext:JSON.stringify({referer:F.pathname,parentWidgetId:v,hasParentForm:T.hasParentForm(),originator:(k=e$1.context.params)==null?void 0:k.originator,parent:e$1.context.params,folderData:(L=e$1.context.params)==null?void 0:L.folderData}),widgetEvent:Ce?U.onTableEditDataLoad:U.onTableDataLoad,widgetName:e$1.properties.name.toLowerCase(),formData:e$1.context.formData}).then(ae=>{var ue,N,j,pe,S,qe,ge,xe,Ae;if(ae.meta.requestStatus==="fulfilled"){let z={...ae.payload},U=(ue=z.data)==null?void 0:ue[e$1.properties.name];if(Array.isArray(z.widgetData)&&z.widgetData.length===0&&typeof U=="string"&&U.trim()!==""&&U!=="null"&&U!=="undefined"){let f=JSON.parse(U);m(f!=null?f:{});}else m(Object.values((N=z.widgetData)!=null?N:{})),_$1((pe=(j=z.tableMeta)==null?void 0:j.rowCount)!=null?pe:0),B((qe=(S=z.tableMeta)==null?void 0:S.nextToken)!=null?qe:null),X$1((ge=z.tableMeta)!=null?ge:{}),(xe=z.tableMeta)!=null&&xe.nextToken&&ht(i.pageIndex,(Ae=z.tableMeta)==null?void 0:Ae.nextToken),Be(false),z.widgetRelatedData&&Object.keys(z.widgetRelatedData).length>0&&(ee.current.context.widgetRelatedData=z.widgetRelatedData);O(a),$(true);}});},[ne,Ce,We,he,F.pathname,b$2,e$1.context.formData,e$1.context.params,e$1.properties.name,R,O,$,B,Be,_$1,m,X$1,ht,v]),Mn=useCallback(a=>{if(r$1.current&&!ne){r$1.current=false;return}let t;typeof a=="function"?t=a({pageIndex:b$2,pageSize:ie}):t=a;let i=Qt(t.pageIndex,b$2,t.pageSize,R);if(te&&M&&b$2>0){O(false);return}t.pageIndex!==b$2&&E.setPageIndex(Number(t.pageIndex)),t.pageSize!==ie&&E.setPageSize(Number(t.pageSize)),(ne&&t.pageIndex!==b$2||t.pageSize!==ie)&&(Be(true),i==="last"&&ye(true),i==="first"&&ye(false),Le(false,i,t,x,T$1));},[ne,b$2,R,te,M,ie,Le,x,T$1]);useEffect(()=>{var a;an((a=e$1.context)==null?void 0:a.widgetRelatedData);},[(Dt=e$1.context)==null?void 0:Dt.widgetRelatedData]),useEffect(()=>{r$1.current=true,E.reset(Number(Ue));},[e$1.properties.name,e$1.context.params]),useEffect(()=>{var a;if(Ce){let t=(a=e$1.context.formData)==null?void 0:a[e$1.properties.name];if(t){let i=typeof t=="string"?JSON.parse(t):t;m(i);}}},[e$1.context.formData]),useEffect(()=>{(async()=>{var a,t,i,d;if(e$1.context.enableEventHandlers){if(e$1.context.formLayout==="folders"&&!((t=(a=e$1.context.params)==null?void 0:a.folderData)!=null&&t.id)&&!((d=(i=e$1.context.params)==null?void 0:i.folderData)!=null&&d.isRoot))return;ne?b$2===0?Le(true,"first",{pageIndex:0,pageSize:Ue||100},"",ct):Le(false,"current",{pageIndex:b$2,pageSize:ie},x,T$1):Le(true,"first",{pageIndex:0,pageSize:Ue||100},"",ct);}else $(true);})();},[e$1.properties.name,e$1.context.redrawComponent,Ce,ne]);let je=e$1.methodProvider.findWidgetItem(e$1.id),Ne=[],Ye={};(je.item.properties.datasource.columns||[]).forEach(a=>{var t;Ne[a[1]]=a[0],a[2]&&(Ye[a[1]]=(t=ra[a[2]])!=null?t:"freetext");});let Sn=(je.item._children||[]).some(({properties:a})=>{var i,d;if(!a.item_bottomcalc)return false;let t=(d=(i=Ye[a.item_name])!=null?i:a.item_columntype)!=null?d:a.item_isprice?"price":"freetext";return t==="price"||t==="number"}),Pn=useMemo(()=>{let a$1=[];return (je.item._children||[]).map(({properties:t})=>{var i,d,o,u,w,y,k$1,L,ae,ue,N,j,pe;if(t.item_name.toString()!==""){let S=(i=Ye[t.item_name])!=null?i:"";S||(S=(d=t.item_columntype)!=null?d:"freetext",t.item_columntype||(t.item_isdate===true?S="date":t.item_isdatetime===true?S="datetime":t.item_ischeckbox===true?S="checkbox":t.item_isprice===true?S="price":S="freetext"));let qe=S==="checkbox",ge=S==="price",xe=S==="number",Ae=S==="date",z=S==="datetime",U={};qe?U={accessorKey:t.item_name,muiTableHeadCellProps:{align:(o=t.style.item_textalign)!=null?o:"left"},muiTableBodyCellProps:{align:(u=t.style.item_ctextalign)!=null?u:"left"},header:(w=Ne[t.item_name])!=null?w:t.item_title,Header:()=>{var s;let f=(s=Ne[t.item_name])!=null?s:t.item_title;return t.item_displaytooltip?jsx(re,{title:f,arrow:true,children:jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:f})}):jsx("span",{children:f})},Cell:({row:f})=>{var s;return jsx("span",{style:{borderBottom:"none",padding:"0px",height:"36px"},children:jsx($n,{checked:Array.isArray((s=ee.current.context)==null?void 0:s.widgetRelatedData)&&ee.current.context.widgetRelatedData.includes(f.original._sk),onPointerUp:()=>oa(f.original,ee.current,F,v),style:{margin:0}})})},size:parseInt(t.item_minsize,10)||void 0,enableSorting:(y=t.item_enablesorting)!=null?y:false,enableHiding:(k$1=t.item_visible)!=null?k$1:true,grow:true}:(U={accessorKey:t.item_name.toString(),muiTableHeadCellProps:{align:(L=t.style.item_textalign)!=null?L:"left"},muiTableBodyCellProps:{align:(ae=t.style.item_ctextalign)!=null?ae:"left"},header:(ue=Ne[t.item_name])!=null?ue:t.item_title.toString(),Header:()=>{var s;let f=(s=Ne[t.item_name])!=null?s:t.item_title.toString();return t.item_displaytooltip?jsx(re,{title:f,arrow:true,children:jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:f})}):jsx("span",{children:f})},size:parseInt(t.item_minsize,10)||void 0,enableSorting:(N=t.item_enablesorting)!=null?N:false,enableHiding:t.item_visible===true,grow:true,muiEditTextFieldProps:{required:true,error:!!(Z$1!=null&&Z$1.firstName),helperText:Z$1==null?void 0:Z$1.firstName,onFocus:()=>Oe({...Z$1,[t.item_name.toString()]:void 0})},Cell:({cell:f})=>{var A;let s=(A=f.getValue())!=null?A:"";if(ge&&s){let p=st(s);if(!isNaN(p)){let h=t.item_fixedlocale||"",Y=t.item_format==="fixed-locale"&&h?h:W$1||void 0,D=t.item_inputfield&&ve.current&&ve.current[t.item_inputfield]||""||t.item_currency||"",De=t.item_format==="locale"?k(W$1!=null?W$1:""):t.item_format==="fixed-locale"&&h?k(h):void 0,Re=D||De||"";try{let we=t.item_currencydisplay||"";Re&&we!==""?s=new Intl.NumberFormat(Y,{style:"currency",currency:Re,currencyDisplay:we,minimumFractionDigits:2,maximumFractionDigits:2}).format(p):s=new Intl.NumberFormat(Y,{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}).format(p);}catch(we){s=p.toFixed(2);}}}if(xe&&s){let p=st(s);isNaN(p)||(s=p.toLocaleString());}if(Ae&&s){let p=(()=>{if(/^\d{4}-\d{2}-\d{2}/.test(s)){let h=a(s);if(h.isValid())return h}return a(s,"DD.MM.YYYY",true)})();if(p.isValid())try{s=new Intl.DateTimeFormat(W$1||void 0,{dateStyle:"short"}).format(p.toDate());}catch(h){}}if(z&&s){let p=(()=>{if(/^\d{4}-\d{2}-\d{2}/.test(s)){let h=a(s);if(h.isValid())return h}return a(s,"DD.MM.YYYY HH:mm",true)})();if(p.isValid())try{s=new Intl.DateTimeFormat(W$1||void 0,{dateStyle:"short",timeStyle:"short"}).format(p.toDate());}catch(h){}}return t.item_displaytooltip?jsx(ia,{value:s,style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:`${parseInt(t.item_maxsize,10)||150}px`,minWidth:"50px",cursor:"default"}}):jsx(Fragment,{children:s})}},t.item_bottomcalc&&(ge||xe)&&(U.muiTableFooterCellProps={align:(pe=(j=t.style)==null?void 0:j.item_ctextalign)!=null?pe:"left"},U.Footer=({table:f})=>{var Y,C;let s=(Y=f.getState().creatingRow)==null?void 0:Y.id,A=(C=f.getState().editingRow)==null?void 0:C.id,p=f.getFilteredRowModel().rows.reduce((D,De)=>{if(De.id===s||De.id===A)return D;let Re=De.getValue(t.item_name.toString()),we=st(String(Re!=null?Re:""));return D+(isNaN(we)?0:we)},0),h=p.toLocaleString(W$1||void 0,{minimumFractionDigits:ge||xe?2:0,maximumFractionDigits:ge||xe?2:0});if(ge){let D=t.item_fixedlocale||"",De=t.item_format==="fixed-locale"&&D?D:W$1||void 0,we=t.item_inputfield&&ve.current&&ve.current[t.item_inputfield]||""||t.item_currency||"",Hn=t.item_format==="locale"?k(W$1!=null?W$1:""):t.item_format==="fixed-locale"&&D?k(D):void 0,Rt=we||Hn||"",_t=t.item_currencydisplay||"";if(Rt&&_t!=="")try{h=new Intl.NumberFormat(De,{style:"currency",currency:Rt,currencyDisplay:_t,minimumFractionDigits:2,maximumFractionDigits:2}).format(p);}catch(ma){h=p.toFixed(2);}}return jsx("b",{children:h})})),Ae?U.sortingFn=(f,s,A)=>{let p=f.getValue(A),h=s.getValue(A),Y=C=>{if(!C)return a("1900-01-01");if(/^\d{4}-\d{2}-\d{2}/.test(C)){let D=a(C);if(D.isValid())return D}return a(C,"DD.MM.YYYY",true)};try{let C=Y(p),D=Y(h);return C.isBefore(D)?-1:C.isAfter(D)?1:0}catch(C){return 0}}:z?U.sortingFn=(f,s,A)=>{let p=f.getValue(A),h=s.getValue(A),Y=C=>{if(!C)return a("1900-01-01T00:00:00");if(/^\d{4}-\d{2}-\d{2}/.test(C)){let D=a(C);if(D.isValid())return D}return a(C,"DD.MM.YYYY HH:mm",true)};try{let C=Y(p),D=Y(h);return C.isBefore(D)?-1:C.isAfter(D)?1:0}catch(C){return 0}}:(ge||xe)&&(U.sortingFn=(f,s,A)=>{let p=parseFloat(f.getValue(A))||0,h=parseFloat(s.getValue(A))||0;return p-h}),He&&He!=="none"&&(U.Cell=({row:f})=>jsx("div",{style:{cursor:"pointer",width:"100%",padding:"0.7em"},onPointerUp:()=>{var A,p,h,Y,C,D;let s={pluginCode:f.original._plugincode,formCode:f.original._origformcode,guid:null,originator:(A=ee.current.context.params)==null?void 0:A.originator,pGuid:(p=ee.current.context.params)==null?void 0:p.pGuid,folderData:ee.current.context.params.folderData};He==="new"&&(Y=(h=ee.current.context)==null?void 0:h.params)!=null&&Y.modalCloseFn&&((D=(C=ee.current.context)==null?void 0:C.params)==null||D.modalCloseAndOpenFn(s));},children:f.getValue(t.item_name.toString())})),a$1.push(U);}}),a$1},[W$1,Z$1,He,v]),vn=a=>{ce(a.currentTarget);},kn=()=>{ce(null);},Ln=useCallback(()=>{var t,i;if(!ze)return null;var a=(i=(t=e$1.context.params)==null?void 0:t.folderData)==null?void 0:i.captions;return a==null||a.length===0?null:(a=a.slice(1),jsx("span",{style:{display:"flex",alignItems:"center"},children:a.map((d,o)=>jsxs("span",{style:{display:"inline-flex",alignItems:"center"},children:[d,o<a.length-1&&jsx(d$1,{style:{margin:"0 8px",fontSize:"0.6rem",color:"#666"}},`chevron-${o}`)]},`caption-${o}`))}))},[ze,e$1.context.params.folderData]),Nn={density:pn,expanded:true,grouping:[],isFullScreen:false,pagination:{pageIndex:b$2||0,pageSize:Number(ie)||Ue},columnVisibility:{id:false}},An=useCallback((a,t)=>{var i=[];a.forEach(d=>{var u,w,y,k,L,ae;let o=d.original;i.push({_sk:(u=o._sk)!=null?u:null,_code:(w=o._fcode)!=null?w:o._code,_origformcode:(k=(y=o._origformcode)!=null?y:o._fcode)!=null?k:o._code,_plugincode:(L=o._plcode)!=null?L:o._plugincode,_desc:(ae=o._desc)!=null?ae:null});}),i.length>0&&Ie("createsigncontainer",e$1,i,F,v,t);},[Ie,e$1,F,v]),En=useCallback((a,t)=>{var i=[];a.forEach(d=>{var u,w,y,k,L;let o=d.original;i.push({_sk:(u=o._sk)!=null?u:null,_code:(w=o._fcode)!=null?w:o._code,_origformcode:(k=(y=o._origformcode)!=null?y:o._fcode)!=null?k:o._code,_plugincode:(L=o._plcode)!=null?L:o._plugincode});}),i.length>0&&Ie("download",e$1,i,F,v,t);},[Ie,e$1,F,v]),Bn=useCallback((a,t)=>{var i=[];a.forEach(d=>{var u,w,y,k,L;let o=d.original;i.push({_sk:(u=o._sk)!=null?u:null,_code:(w=o._fcode)!=null?w:o._code,_origformcode:(k=(y=o._origformcode)!=null?y:o._fcode)!=null?k:o._code,_plugincode:(L=o._plcode)!=null?L:o._plugincode});}),tt({delete:{showDialog:true,dialogTitle:K("Delete")+" ?",dialogContent:K("Are you certain that you wish to delete selected records?"),buttonAgree:K("Continue"),buttonDisagree:K("Close"),callBackFunc:d=>yt(d,"delete",e$1,i,t,F,v)}});},[tt,yt,K,e$1,F,v]),On=useCallback(async({values:a,table:t})=>{ke("add",e$1,JSON.stringify(a),F,v),t.setCreatingRow(null);},[ke,e$1,F,v]),zn=useCallback(async({values:a,table:t,row:i})=>{let d={...i.original,...a};ke("edit",e$1,JSON.stringify(d),F,v),t.setEditingRow(null);},[ke,e$1,F,v]),[ca,Un]=useState(null);if(!Fn)return null;let Je=Se("file",e$1.context)?"primary":"#C0C0C0",Vn=Se("file",e$1.context)?"contained":"outlined";return jsxs(Fragment,{children:[ze&&jsx("div",{style:{paddingBottom:"0.8rem",fontSize:"0.85rem",color:"#666",marginLeft:"0.2rem"},children:Ln()}),jsx("div",{style:{maxWidth:e$1.context.isModal?g$1.width-30:void 0},children:jsx(Suspense,{fallback:jsx(qn,{}),children:jsx(ta,{locale:W$1,columns:Pn,enableBottomToolbar:In,enableTableFooter:Sn,createDisplayMode:"row",editDisplayMode:"row",enableEditing:false,enableColumnActions:ln,enableColumnOrdering:cn,enableColumnResizing:dn,enableGlobalFilter:bn,enableGlobalFilterModes:true,globalFilterModeOptions:[Ge||"startsWith"],globalFilterFn:Ge||"startsWith",enableGrouping:sn,enablePagination:nt,manualPagination:ne!=null?ne:false,enableRowActions:xt,enableRowNumbers:xn,enableRowSelection:wn,enableRowVirtualization:Tn,enableSelectAll:Cn,enableStickyHeader:Dn,enableToolbarInternalActions:Rn,enableTopToolbar:_n,onCreatingRowSave:On,onEditingRowSave:zn,darkMode:false,data:me,icons:{SaveIcon:()=>jsx(r,{color:na,style:{fontSize:"1.2rem"}}),CancelIcon:()=>jsx(P,{color:"gray",style:{fontSize:"1.2rem"}})},initialState:Nn,isLoading:!te,muiTableContainerProps:{sx:{maxHeight:un}},name:e$1.properties.name,pageIndex:b$2,pageSize:ie,muiPaginationProps:{rowsPerPageOptions:[50,100,300,500],disabled:be},onPaginationChange:Mn,positionActionsColumn:"last",displayColumnDefOptions:{"mrt-row-actions":xt?{header:"",minSize:g$1.isMobileDevice?75:270,enableHiding:false}:void 0},rowOnDoubleClick:a=>{!Ce&&!gt(e$1.properties)&&et("edit",e$1,a,F,v);},rowCount:ne?R:void 0,renderToolbarInternalActions:({table:a})=>jsx(Xt,{children:!g$1.isMobileDevice&&jsxs(Fragment,{children:[!Ce&&jsx(_,{table:a}),jsx(Y,{table:a}),jsx(W,{table:a}),jsx(X,{table:a}),!e$1.context.isModal&&jsx(Z,{table:a})]})}),renderTopToolbarCustomActions:({table:a})=>{var t$1,i,d,o,u,w,y,k,L,ae;return jsxs("div",{style:{display:"flex",flexDirection:"row"},children:[a.getSelectedRowModel().rows.length===0&&ze&&e$1.context.formLayout==="folders"&&jsx(Fragment,{children:jsx(re,{title:(i=(t$1=e$1.properties)==null?void 0:t$1.newFolderLabel)!=null?i:K("New Folder"),children:jsx(Fe,{style:{marginRight:"5px"},color:"primary",onPointerUp:()=>e$1.context.isModal||e$1.context.hasParentForm?e$1.methodProvider.eventDispatcher({widgetName:e$1.properties.name.toLowerCase(),widgetValue:null,widgetEvent:U.onFolderCreateRecordEvent,widgetContext:JSON.stringify({referer:F.pathname,parentWidgetId:v,hasParentForm:T.hasParentForm(),parentOriginator:{params:e$1.context.params.originator?e$1.context.params.originator.params:{}},originator:{params:e$1.context.params,widgetName:e$1.properties.name.toLowerCase()},parent:{widgetName:e$1.properties.name.toLowerCase(),params:e$1.context.params},isModal:e$1.context.isModal,folderData:e$1.context.params.folderData})}):wt(`${F.pathname}/new`,{state:{from:F.pathname}}),variant:"outlined",children:jsx(t,{})})})}),a.getSelectedRowModel().rows.length===0&&!gn&&jsx(Fragment,{children:jsx(re,{title:(o=(d=e$1.properties)==null?void 0:d.addrecordlabel)!=null?o:K("Add Record"),children:jsx(Fe,{disabled:gt(e$1.properties),color:"primary",sx:{color:Je,borderColor:Je},style:{marginRight:"5px"},onPointerUp:()=>{if(!Se("file",e$1.context)){le({toastID:nanoid(11),msg:K("Please select a folder before adding a document"),clearQueue:false,hideProgressBar:false});return}if(Ce){let ue={};(je.item._children||[]).forEach(({properties:N})=>{var pe,S;if(!N.item_increment||!N.item_name)return;let j=(pe=Ye[N.item_name])!=null?pe:"";j||(j=(S=N.item_columntype)!=null?S:"freetext",N.item_columntype||(N.item_isdate?j="date":N.item_isdatetime?j="datetime":N.item_ischeckbox?j="checkbox":N.item_isprice?j="price":j="freetext")),j==="number"&&(ue[N.item_name.toString()]=me.length+1);}),Object.keys(ue).length>0?a.setCreatingRow(V(a,ue)):a.setCreatingRow(true);}else return pt?wt(`${F.pathname}/${pt}`,{state:{from:F.pathname}}):e$1.methodProvider.eventDispatcher({widgetName:e$1.properties.name.toLowerCase(),widgetValue:null,widgetEvent:U.onTableCreateRecordEvent,widgetContext:JSON.stringify({referer:F.pathname,parentWidgetId:v,hasParentForm:true,parentOriginator:{params:e$1.context.params.originator?e$1.context.params.originator.params:{}},originator:{params:e$1.context.params,widgetName:e$1.properties.name.toLowerCase()},parent:{widgetName:e$1.properties.name.toLowerCase(),params:e$1.context.params},isModal:e$1.context.isModal,folderData:e$1.context.params.folderData})})},variant:"outlined",children:jsx(p,{})})})}),a.getSelectedRowModel().rows.length===0&&mn&&jsx(Fragment,{children:jsx(re,{title:(w=(u=e$1.properties)==null?void 0:u.uploadFilesLabel)!=null?w:K("Upload Files"),children:jsx(Fe,{color:"primary",onPointerUp:vn,variant:"outlined",children:jsx(h,{})})})}),a.getSelectedRowModel().rows.length>0&&jsxs(Fragment,{children:[e$1.context.formLayout==="folders"&&a.getSelectedRowModel().rows.length>1&&jsx(Fragment,{children:jsx(re,{title:K("Create Container"),children:jsx(Fe,{style:{marginRight:"5px",color:Je,borderColor:Je},onPointerUp:()=>{if(!Se("file",e$1.context)){le({toastID:nanoid(11),msg:K("Please select a folder before creating a container"),clearQueue:false,hideProgressBar:false});return}An(a.getSelectedRowModel().rows,a);},variant:Vn,children:jsx(q,{})})})}),jsxs(Fragment,{children:[jsx(re,{title:(k=(y=e$1.properties)==null?void 0:y.downloadLabel)!=null?k:K("Download"),children:jsx(Fe,{style:{marginRight:"5px"},onPointerUp:()=>En(a.getSelectedRowModel().rows,a),variant:"contained",children:jsx(g,{})})}),jsx(re,{title:(ae=(L=e$1.properties)==null?void 0:L.deleteLabel)!=null?ae:K("Delete"),children:jsx(Fe,{style:{marginRight:"5px"},onPointerUp:()=>Bn(a.getSelectedRowModel().rows,a),variant:"contained",children:jsx(N,{})})})]})]}),jsx(aa,{anchorEl:q$1,handleClose:kn,setUploadMode:de,uploadMode:Te,props:e$1,setLoaded:$})]})},...la(e$1,yn,Ve,g$1.isMobileDevice,tt,on)},W$1)})}),jsx(G,{...I.delete,handleDialogClose:rn})]})})),Pe=c=>{let e=null,r=c.action,l$1=c.applyInternalStyle?{fontSize:"1em",marginRight:"0.5em"}:{};return r==="open"?e=jsx(n,{style:l$1}):r==="copy"?e=jsx(i,{style:l$1}):r==="confirm"?e=jsx(w,{style:{...l$1,fontSize:"1.6em"}}):r==="edit"?e=jsx(A,{style:l$1}):r==="editrow"?e=jsx(n,{style:l$1}):r==="amend"?e=jsx(b$2,{style:l$1}):r==="delete"?e=jsx(N,{style:l$1}):r==="lock"?e=jsx(y,{style:l$1}):r==="unlock"?e=jsx(x,{style:l$1}):r==="print"?e=jsx(C,{style:l$1}):r==="preview"?e=jsx(n,{style:l$1}):r==="sign"?e=jsx(q,{style:l$1}):r==="download"?e=jsx(l,{style:l$1}):r==="uploadfile"?e=jsx(O,{style:l$1}):r==="uploadzipfile"&&(e=jsx(o,{style:l$1})),e},la=(c,e,r,l,g,le)=>{var de,me;let G=typeof e=="string"?JSON.parse(e):e!=null?e:[],se=useLocation(),{t:E}=useTranslation(),{tabId:b}=c,ie=(me=(de=c.properties)==null?void 0:de.rowactionlabels)!=null?me:{},q=(m,R)=>ie[m]||E(R),ce={color:"text.secondary","&:hover":{color:"primary.main"},"&:focus":{color:"primary.main"},fontSize:"1.1em",marginRight:"0.5em"},te=(m,R,_)=>m==="delete"?()=>{g({delete:{showDialog:true,dialogTitle:`${q("delete","Delete")} ?`,dialogContent:q("deleteConfirmContent","Are you certain that you wish to delete this record?"),buttonAgree:q("deleteConfirmAgree","Continue"),buttonDisagree:q("deleteConfirmDisagree","Close"),callBackFunc:x=>le(x,"delete",c,_,se,b)}});}:m==="editrow"?()=>{R.closeMenu(),R.table.setEditingRow(R.row);}:()=>{var x;(x=R.closeMenu)==null||x.call(R),et(m,c,_,se,b);},$=({entryType:m,mode:R})=>{let _=m.row.original,[x,B]=dt.useState(null),T=I=>{B(I.currentTarget);},X=()=>{B(null);},he=()=>jsx(Fragment,{children:Object.entries(G).map(([I,P])=>{if(!P)return null;let M=I.replace("action_",""),O=te(M,m,_);return jsx("span",{children:jsx(re,{title:q(M,M.charAt(0).toUpperCase()+M.slice(1)),children:jsx(Kt,{sx:ce,onPointerUp:O,children:jsx(Pe,{action:M})})})},I)})}),ye={};if(_._primAct){let I=_._primAct;if(Object.values(tn).includes(I)){Object.values(ut).includes(I)&&(ye.edit=true,G.action_edit&&delete G.action_edit);let P="action_"+I.toLowerCase();ye[P]=true,G[P]&&delete G[P];}}return jsxs(Xt,{sx:{display:"flex",flexWrap:"nowrap",gap:"8px",justifyContent:"center",alignItems:"center"},children:[R===0&&jsx(he,{}),R===1&&jsxs(Fragment,{children:[jsx(()=>jsx(Fragment,{children:Object.entries(ye).map(([I,P])=>{if(!P)return null;let M=I.replace("action_",""),O=te(M,m,_),Z=Object.values(ut).includes(M.toUpperCase()),Oe=M.charAt(0).toUpperCase()+M.slice(1),ee=Oe==="Edit"?q("open","Open"):q(M,Oe);return jsx(Fe,{onClick:O,startIcon:jsx(Pe,{action:M==="edit"?"open":M}),variant:"contained",size:"small",sx:{textTransform:"none",fontSize:"0.75rem",height:"28px",borderRadius:"4px",boxShadow:"none",backgroundColor:Z?"actionbtnok.main":"regularbtn.main",color:"#fff","&:hover":{backgroundColor:Z?"actionbtnok.hover":"regularbtn.hover",boxShadow:"none"},minInlineSize:"7.5em"},children:ee},I)})}),{}),jsx(()=>{let I=x?x.getBoundingClientRect():null;return jsxs("span",{style:{paddingLeft:"1.5em"},children:[jsx(Kt,{sx:ce,onClick:T,id:"dropdown-button",children:jsx(ea,{})}),jsx(en,{anchorEl:x,open:!!x,onClose:X,PaperProps:{sx:{borderRadius:2,minWidth:180,py:1,boxShadow:3,top:I?`${I.top+5}px !important`:"auto",left:I?`${I.left+15}px !important`:"auto",zIndex:P=>P.zIndex.modal+1}},children:Object.entries(G).map(([P,M])=>{if(!M)return null;let O=P.replace("action_","");return jsxs(Ze,{onClick:()=>{X(),te(O,m,_)();},sx:{px:2,py:1},children:[jsx(Qe,{sx:{minWidth:"unset",mr:1},children:jsx(Pe,{action:O==="print"?"preview":O,applyInternalStyle:true})}),jsx(Xe,{primaryTypographyProps:{fontSize:"0.875rem"},children:q(O,O.charAt(0).toUpperCase()+O.slice(1))})]},P)})})]})},{})]})]})},Te=m=>{let R=m.row.original;return [jsx(Kn,{onClickAway:()=>{var _;return (_=m.closeMenu)==null?void 0:_.call(m)},children:jsx(Qn,{sx:{minWidth:"12em",py:0,background:"none"},children:Object.entries(G).map(([_,x])=>{if(!x)return null;let B=_.replace("action_",""),T=te(B,m,R);return jsxs(Ze,{disabled:gt(c.properties),onPointerUp:T,children:[jsx(Qe,{children:jsx(Pe,{action:B==="print"?"preview":B,applyInternalStyle:true})}),jsx(Xe,{primaryTypographyProps:{fontSize:"0.875rem"},children:q(B,B.charAt(0).toUpperCase()+B.slice(1))})]},_)})})},"row-action-menu")]};return r==="flat"&&!l?{renderRowActions:m=>jsx($,{entryType:m,mode:0})}:r==="menu"||r!=="none"&&l?{renderRowActionMenuItems:m=>Te(m)}:r==="primary"?{renderRowActions:m=>jsx($,{entryType:m,mode:1})}:{}};nn.displayName="_Datatable";var Ya=nn;export{Ya as Datatable};
package/dist/form.js CHANGED
@@ -1 +1 @@
1
- export{b as Form,b as default}from'./chunk-5ZFXQAPR.js';import'./chunk-POE6K4NQ.js';import'./chunk-PEJGRTDP.js';import'./chunk-FRAOYRZD.js';import'./chunk-22LEYH6Q.js';import'./chunk-KW32CT2P.js';import'./chunk-U4T4ACDE.js';import'./chunk-LBMVBVXW.js';import'./chunk-3QKKOFXC.js';import'./chunk-AR42AC7J.js';import'./chunk-SDIZEEZP.js';import'./chunk-5TBO732O.js';
1
+ export{b as Form,b as default}from'./chunk-PQ5N6YFT.js';import'./chunk-POE6K4NQ.js';import'./chunk-PEJGRTDP.js';import'./chunk-FRAOYRZD.js';import'./chunk-22LEYH6Q.js';import'./chunk-KW32CT2P.js';import'./chunk-U4T4ACDE.js';import'./chunk-LBMVBVXW.js';import'./chunk-3QKKOFXC.js';import'./chunk-AR42AC7J.js';import'./chunk-SDIZEEZP.js';import'./chunk-5TBO732O.js';
@@ -1 +1 @@
1
- export{a as Formeditor,b as widgetInitialStyle}from'./chunk-BBBJBJ6N.js';import'./chunk-6K3ZZUUM.js';import'./chunk-5ZFXQAPR.js';import'./chunk-POE6K4NQ.js';import'./chunk-PEJGRTDP.js';import'./chunk-FRAOYRZD.js';import'./chunk-22LEYH6Q.js';import'./chunk-KW32CT2P.js';import'./chunk-U4T4ACDE.js';import'./chunk-LBMVBVXW.js';import'./chunk-3QKKOFXC.js';import'./chunk-AR42AC7J.js';import'./chunk-SDIZEEZP.js';import'./chunk-5TBO732O.js';
1
+ export{a as Formeditor,b as widgetInitialStyle}from'./chunk-XIDBIR6O.js';import'./chunk-6K3ZZUUM.js';import'./chunk-PQ5N6YFT.js';import'./chunk-POE6K4NQ.js';import'./chunk-PEJGRTDP.js';import'./chunk-FRAOYRZD.js';import'./chunk-22LEYH6Q.js';import'./chunk-KW32CT2P.js';import'./chunk-U4T4ACDE.js';import'./chunk-LBMVBVXW.js';import'./chunk-3QKKOFXC.js';import'./chunk-AR42AC7J.js';import'./chunk-SDIZEEZP.js';import'./chunk-5TBO732O.js';
@@ -1 +1 @@
1
- export{a as Formeditor,a as default}from'./chunk-BBBJBJ6N.js';import'./chunk-6K3ZZUUM.js';import'./chunk-5ZFXQAPR.js';import'./chunk-POE6K4NQ.js';import'./chunk-PEJGRTDP.js';import'./chunk-FRAOYRZD.js';import'./chunk-22LEYH6Q.js';import'./chunk-KW32CT2P.js';import'./chunk-U4T4ACDE.js';import'./chunk-LBMVBVXW.js';import'./chunk-3QKKOFXC.js';import'./chunk-AR42AC7J.js';import'./chunk-SDIZEEZP.js';import'./chunk-5TBO732O.js';
1
+ export{a as Formeditor,a as default}from'./chunk-XIDBIR6O.js';import'./chunk-6K3ZZUUM.js';import'./chunk-PQ5N6YFT.js';import'./chunk-POE6K4NQ.js';import'./chunk-PEJGRTDP.js';import'./chunk-FRAOYRZD.js';import'./chunk-22LEYH6Q.js';import'./chunk-KW32CT2P.js';import'./chunk-U4T4ACDE.js';import'./chunk-LBMVBVXW.js';import'./chunk-3QKKOFXC.js';import'./chunk-AR42AC7J.js';import'./chunk-SDIZEEZP.js';import'./chunk-5TBO732O.js';