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