@erpsquad/common 1.8.107 → 1.8.109
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/components/material-editable-table/material-editable-table/index.esm.js +28 -10
- package/dist/components/material-editable-table/material-editable-table/index.esm.js.map +1 -1
- package/dist/components/material-editable-table/material-editable-table/index.js +17 -17
- package/dist/components/material-editable-table/material-editable-table/index.js.map +1 -1
- package/dist/components/material-editable-table/material-editable-table.d.ts +1 -1
- package/dist/src/components/material-editable-table/material-editable-table.d.ts +1 -1
- package/dist/style.css +75 -75
- package/package.json +1 -1
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),o=,/* empty css */t=,/* empty css */a=,/* empty css */i=,/* empty css */l=,/* empty css */r=,/* empty css */s=;/* empty css */;/* empty css */var d=,/* empty css */u=,/* empty css */c=,/* empty css */m=,/* empty css */p=require("dayjs"),h=require("yup"),g=,/* empty css */x=require("react-i18next"),b=,/* empty css */f=,/* empty css */v=require("react-router-dom"),w=,/* empty css */y=,/* empty css */j=,/* empty css */C=,/* empty css */S=,/* empty css */M=,/* empty css */k=,/* empty css */R=,/* empty css */I=,/* empty css */T=,/* empty css */E=,/* empty css */P=,/* empty css */q=,/* empty css */D=,/* empty css */_=,/* empty css */z=,/* empty css */A=,/* empty css */B=,/* empty css */O=,/* empty css */N=,/* empty css */F=;/* empty css */function U(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function L(e){if(e&&"object"==typeof e&&"default"in e)return e;var n=/* @__PURE__ */Object.create(null);return e&&Object.keys(e).forEach(function(o){if("default"!==o){var t=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,t.get?t:{enumerable:!0,get:function(){return e[o]}})}}),n.default=e,n}var H=/* @__PURE__ */U(n),K=/* @__PURE__ */U(p),V=/* @__PURE__ */L(h);const $=P.default(T.default)(({theme:{palette:e}})=>{var n,o,t,a;return{".MuiTableCell-root":{border:"1px solid #efefef",borderBottom:0,borderLeft:0,padding:"0.19rem 0.5rem",lineHeight:"19px",fontSize:"14px",minHeight:40},".MuiTableCell-head":{backgroundColor:null==(n=e.theme)?void 0:n.secondary[100]},".MuiTableContainer-root":{maxHeight:"clamp(350px, 100vh - 200px, 9999px) !important"},".MuiPaper-root":{boxShadow:"none"},".MuiPaginationItem-root":{"&.Mui-selected":{backgroundColor:null==(o=null==e?void 0:e.theme)?void 0:o.primary[700],color:"white"}},".MuiTableRow-root":{"&.Mui-selected":{backgroundColor:`${null==(t=null==e?void 0:e.theme)?void 0:t.primary[100]} !important`,color:"white"}},".MuiCheckbox-indeterminate":{color:`${null==(a=null==e?void 0:e.theme)?void 0:a.primary[700]} !important`,"& svg":{height:"20px !important",width:"20px !important"}}}}),W=H.default.memo(({enablePagination:p=!1,rows:h,columns:P,totalPages:U,paginationModel:L,columnOrder:H,updateData:W,handleColumnOrdering:J,enableEditing:Y,enableColumnDragging:Z,states:G,rowActionMenu:Q,destructiveActionMenu:X,disableDefaultActionColumn:ee,enableRowSelection:ne,defaultActionColumnItems:oe=[],enableBottomToolbar:te,SetSelectedRowId:ae,isResetRow:ie,onCreateRow:le,onEditRow:re,onDeleteRow:se,editDisplayMode:de,enableRowCreate:ue,onChangeRowField:ce,onSelectRow:me,enableColumnResizing:pe=!0,selectedRowIds:he=[],onColumnVisibility:ge,onSortingChange:xe,getSelectedData:be,disabledDefaultActionColumnIcon:fe=!1,enableAddCustomField:ve=!0,enableRowDragging:we=!1,handleColumnResizing:ye=()=>{},columnSizes:je={},...Ce})=>{const{t:Se}=x.useTranslation(),{formData:Me=null,updatePageInfo:ke,activePage:Re}=f.usePages(),Ie=I.default(Re),{pageNo:Te}=L,[Ee,Pe]=n.useState({}),[qe,De]=n.useState(P),[_e,ze]=n.useState(null),[Ae,Be]=n.useState(!1),[Oe,Ne]=n.useState(null),Fe=qe.filter(e=>e.visible),Ue=qe.filter(e=>!e.visible),[Le,He]=n.useState(Ue),[Ke,Ve]=n.useState(null),[$e,We]=n.useState({}),[Je,Ye]=n.useState([]),[Ze,Ge]=n.useState(!1),[Qe,Xe]=n.useState(!1),[en,nn]=n.useState(!1),[on,tn]=n.useState(null),[an,ln]=n.useState({}),[rn,sn]=n.useState(!1),[dn,un]=n.useState([]),[cn,mn]=n.useState(!1),[pn,hn]=n.useState(Ie.column_sizes),[gn,xn]=n.useState({columnSizingStart:[],deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,startOffset:null,startSize:null});n.useState(0);const bn=v.useNavigate(),fn=location.pathname.split("/")[2];let vn="";switch(fn){case"accounting":vn=y.PathnameAccounting.CUSTOM_FORM;break;case"inventory":vn=j.PathnameInventory.CUSTOM_FORM;break;case"manufacturing":vn=C.PathnameManufacturing.CUSTOM_FORM;break;case"procurement":vn=S.PathnamePurchase.CUSTOM_FORM;break;case"crm":vn=M.PathnameCrm.CUSTOM_FORM;break;case"user":vn=k.PathnameUsers.CUSTOM_FORM;break;case"rental":vn=R.PathnameRental.CUSTOM_FORM;break;case"drive":vn=w.PathnameDocument.ADD_CUSTOM_FIELDS}const wn=`/dashboard/${fn}${vn}`,yn=(e,n,o)=>{var t;let a=e;switch(n.type){case"required":a=n.value?e.required(n.msg_en).typeError(n.msg_en):(null==(t=null==o?void 0:o.editProperties)?void 0:t.is_multiple)?e.min(1,n.msg_en):e;break;case"min":a=e.min(n.value,n.msg_en);break;case"email":a=e.email(n.value,n.msg_en);break;case"max":a=e.max(n.value,n.msg_en);break;case"positive":a=!0===n.value?e.test("is-positive-number","Value must be a positive number",e=>!e||e>=0):e;break;case"when":return e.when(n.relation,{is:e=>e===n.values,then:()=>{var t;return(null==(t=null==n?void 0:n.thenValidations)?void 0:t.reduce((e,n)=>yn(e,n,o),e))||e},otherwise:()=>{var t;return(null==(t=null==n?void 0:n.otherWiseValidations)?void 0:t.reduce((e,n)=>yn(e,n,o),e))||e}});default:a=e}return"required"!=n.type||!n.value||(null==o?void 0:o.editVariant)&&"text"!=(null==o?void 0:o.editVariant)||(a=e.test("no-blank-spaces","Blank space is not allowed",e=>{var n;return e&&(null==(n=e.trim())?void 0:n.length)>0})),a};n.useEffect(()=>{De(P);const e=(e=>{const n={};return e.forEach(e=>{var o,t,a;if(null==(t=null==(o=null==e?void 0:e.editProperties)?void 0:o.validations)?void 0:t.length){const o=null==(a=null==e?void 0:e.editProperties)?void 0:a.validations.reduce((n,o)=>yn(n,o,e),(e=>{var n;switch(e.editVariant){case"select":return(null==(n=null==e?void 0:e.editProperties)?void 0:n.is_multiple)?V.array():V.string();case"number":return V.number().nullable().transform((e,n)=>""===n?null:e);case"url":return V.string().matches(/^(https?:\/\/)?((([a-zA-Z0-9_-]+\.)+[a-zA-Z]{2,})|localhost)(:\d{2,5})?(\/[a-zA-Z0-9#_-]+\/?)*(\?[a-zA-Z0-9&=_-]+)?(#\S+)?$/,{excludeEmptyString:!0,message:"Please enter valid URL."});default:return V.string()}})(e));n[e.accessorKey]=o}}),n})(P);Ye(V.object().shape(e))},[P]),n.useEffect(()=>{(null==gn?void 0:gn.isResizingColumn)||(ke({column_sizes:{...Ie.column_sizes,...pn}}),null==ye||ye(pn))},[null==gn?void 0:gn.isResizingColumn,pn]);const jn=e=>{ze(e.currentTarget)},Cn=n.useCallback((e,n)=>{const o={};return Object.keys(e).forEach(t=>{const a=e[t],i=n.find(e=>e.accessorKey==t);a?a instanceof File?o[t]=a.name:i&&"date"==(null==i?void 0:i.editVariant)?o[t]=K.default(a).format((null==i?void 0:i.dateFormat)||"DD-MM-YYYY"):i&&"select"==(null==i?void 0:i.editVariant)&&"object"==typeof a&&null!==a?o[t]=a.name||a.label||a.display_name||a.title||a.value||a.id||a:(i&&(null==i||i.editVariant),o[t]=a):o[t]=a}),o},[]),Sn=n.useCallback(e=>{var n;return null==(n=null==e?void 0:e.validations)?void 0:n.some(e=>"required"===e.type)},[]);n.useEffect(()=>{const e={};!rn&&he.length&&(h.forEach(n=>{he.includes(n.id)&&(e[n.id]=!0)}),ln(e),sn(!0))},[h,he]),n.useEffect(()=>{if(xe instanceof Function){const e=Array.isArray(dn)?dn:[];xe(e[0]||null)}},[dn]);const Mn=e=>{const n=document.createElement("canvas").getContext("2d");return n?n.measureText(e).width+5:50},kn=n.useCallback(async(e,n,o)=>{try{await Je.validate(n,{abortEarly:!1}),We({}),Xe(!0),mn(!1);const t=e.getAllCells().map(e=>e.column.columnDef);e._valuesCache=Cn(n,t);const a={row:e,values:n,table:o};re&&await re(a,"edit"),Xe(!1),o.setEditingRow(null)}catch(t){if(Xe(!1),t instanceof V.ValidationError){const e={};t.inner.forEach(n=>{n.path&&(e[n.path]=n.message)}),We(e)}else t instanceof Error?b.enqueueSnackbar(t.message,{variant:"error"}):b.enqueueSnackbar("Something went wrong",{variant:"error"})}},[Je,re,Cn]),Rn=o.useMaterialReactTable({defaultColumn:{minSize:0,size:void 0},columns:[...Fe.map(n=>(Mn(n.header||""),Math.max(...h.map(e=>Mn(String(e[n.accessorKey]??"")))),{...n,..."row"===de?{Edit:({cell:o,row:t,table:a,column:i})=>/* @__PURE__ */e.jsx(d.default,{cell:o,column:i,col:n,row:t,table:a,callback:e=>{},errors:$e,validationSchema:Je,setValidationErrors:We,onChangeRowField:ce,getSelectedData:(e,n)=>null==be?void 0:be(e,n)})}:{},Header:/* @__PURE__ */e.jsxs(T.default,{display:"flex",alignItems:"center",children:[n.header,(null==n?void 0:n.required)||Sn(null==n?void 0:n.editProperties)&&/* @__PURE__ */e.jsx(l.Typography,{type:"s5",color:"theme.error.600",children:"*"})]}),enableColumnDragging:"actions"!==n.id,size:void 0,maxSize:800})),...ee?[]:[{id:"actions",enableEditing:!1,size:(null==oe?void 0:oe.length)>1?80:50,header:/* @__PURE__ */e.jsx(E.default,{size:"small",sx:{p:.5,"&:hover":{backgroundColor:"transparent"}},onClick:jn,children:/* @__PURE__ */e.jsx("img",{src:s.images.common.arrowIcon,alt:"Arrow Icon"})}),enableColumnDragging:!1,visible:!0,muiTableHeadCellProps:{className:"pinned-column"},muiTableBodyCellProps:{className:"pinned-column",sx:{whiteSpace:"pre-wrap"}},Cell:o=>(null==oe?void 0:oe.length)?oe.map(e=>{const t={...e.props,onClick:()=>e.props.onClick(o)};return n.cloneElement(e,t)}):!fe&&/* @__PURE__ */e.jsx(E.default,{onClick:e=>{return n=e,t=o.row.original,Pe(t),void Ne(n.currentTarget);var n,t},disabled:!(null==Q?void 0:Q.length)&&!(null==X?void 0:X.length),children:/* @__PURE__ */e.jsx("img",{src:s.images.more,alt:"More Icon"})})}]],data:h,muiTablePaperProps:{sx:{tableLayout:"auto"}},columnResizeMode:"onChange",onEditingRowSave:async e=>{await kn(e.row,e.values,e.table)},onCreatingRowSave:async e=>{try{await Je.validate(e.values,{abortEarly:!1}),We({}),Ge(!0),mn(!1);const n=e.row.getAllCells().map(e=>e.column.columnDef);e.row._valuesCache=Cn(e.values,n),le&&await le(e),Ge(!1),e.table.setCreatingRow(null)}catch(n){if(Ge(!1),n instanceof V.ValidationError){const e={};n.inner.forEach(n=>{n.path&&(e[n.path]=n.message)}),We(e)}else n instanceof Error?b.enqueueSnackbar(n.message,{variant:"error"}):b.enqueueSnackbar("Something went wrong",{variant:"error"})}},onCreatingRowCancel:()=>(ln({}),void mn(!1)),onEditingRowCancel:()=>{mn(!1)},onSortingChange:(null==G?void 0:G.sorting)?xe:un,displayColumnDefOptions:{"mrt-row-actions":{Header:/* @__PURE__ */e.jsx(E.default,{onClick:jn,size:"small",children:/* @__PURE__ */e.jsx("img",{src:s.images.common.arrowIcon,alt:"Arrow Icon"})}),muiTableBodyCellProps:({row:e,table:n})=>{var o,t;const a=(null==(o=n.getState().creatingRow)?void 0:o.id)===e.id;return{sx:{"& .MuiBox-root":{gap:0},backgroundColor:"#fff",whiteSpace:"pre-wrap",...(null==(t=n.getState().editingRow)?void 0:t.id)===e.id&&!a&&{"& .MuiBox-root > .MuiIconButton-root:first-of-type":{display:"none !important"},'& button[aria-label*="Save"]':{display:"none !important"},'& button[title*="Save"]':{display:"none !important"},'& .MuiIconButton-root[class*="save"]':{display:"none !important"},'& .MuiIconButton-root[data-testid*="save"]':{display:"none !important"}}},onKeyUp:e=>{}}}},"mrt-row-expand":{size:70},"mrt-row-select":{size:50}},renderRowActions:({row:n,table:o})=>/* @__PURE__ */e.jsx(e.Fragment,{children:(null==Ce?void 0:Ce.enableExpanding)?/* @__PURE__ */e.jsx(e.Fragment,{children:(null==n?void 0:n.parentId)&&/* @__PURE__ */e.jsx(T.default,{sx:{display:"flex",gap:0},children:se&&/* @__PURE__ */e.jsx(u.Tooltip,{title:"Delete",children:/* @__PURE__ */e.jsx(E.default,{disabled:cn,onClick:()=>tn(n),size:"small",children:/* @__PURE__ */e.jsx(N.Trash,{fontSize:"small",sx:{color:"theme.secondary.1000"}})})})})}):/* @__PURE__ */e.jsx(T.default,{sx:{display:"flex",gap:0},children:se&&/* @__PURE__ */e.jsx(u.Tooltip,{title:"Delete",children:/* @__PURE__ */e.jsx(E.default,{disabled:cn,onClick:()=>tn(n),children:/* @__PURE__ */e.jsx(N.Trash,{fontSize:"small",sx:{color:"theme.secondary.1000"}})})})})}),...Boolean(ue)&&{renderBottomToolbarCustomActions:({table:n})=>/* @__PURE__ */e.jsx(c.Button,{variant:"outlined",startIcon:/* @__PURE__ */e.jsx(m.default,{}),className:"add-row-btn",disabled:cn,onClick:()=>{n.setCreatingRow(!0),mn(!0)},children:Se("common.add")})},onRowSelectionChange:ln,enableColumnOrdering:!0,enableRowSelection:ne??!0,enableEditing:Y instanceof Function?Y():Y??!0,editDisplayMode:de??"row",createDisplayMode:"row",enableColumnResizing:pe,enableRowDragging:we,enableTopToolbar:!1,enableColumnActions:!1,enableSorting:!0,enableGrouping:!0,enableBottomToolbar:te??!1,enableColumnDragging:Z??!0,enableStickyHeader:!0,enableSortingRemoval:!1,state:{columnOrder:H,columnPinning:{left:["actions","mrt-row-actions"]},isSaving:Ze||Qe,showProgressBars:!1,rowSelection:an,...G,sorting:Array.isArray(null==G?void 0:G.sorting)?null==G?void 0:G.sorting:Array.isArray(dn)?dn:[],columnSizing:pn},getRowId:e=>null==e?void 0:e.id,muiTableBodyRowProps:({row:e,table:n})=>{var o,t,a,i,l;const r=(null==(t=null==(o=n.getState())?void 0:o.editingRow)?void 0:t.id)||(null==(i=null==(a=n.getState())?void 0:a.creatingRow)?void 0:i.id)||null,s=Boolean(null==(l=null==e?void 0:e.original)?void 0:l.has_error),d=r===e.id;return{onClick:()=>{Ve(e.id)},onKeyDown:o=>{d&&("Enter"===o.key?(o.preventDefault(),n.setEditingRow(null)):"Escape"===o.key&&(o.preventDefault(),n.setEditingRow(null),mn(!1),kn(e,e._valuesCache||e.original,n)))},sx:{cursor:"pointer",backgroundColor:r?"inherit":s?"theme.error.100":"inherit","&:hover":{backgroundColor:r?"transparent":s?"theme.error.200":"#e8e8e8"},"&:hover td:after":{backgroundColor:"transparent"}}}},onColumnOrderChange:e=>{J&&J(e)},onColumnSizingChange:hn,onColumnSizingInfoChange:xn,renderEmptyRowsFallback:()=>/* @__PURE__ */e.jsxs(T.default,{className:"no-data",children:[
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=,/* empty css */o=,/* empty css */a=,/* empty css */i=,/* empty css */l=,/* empty css */r=,/* empty css */s=;/* empty css */;/* empty css */var d=,/* empty css */u=,/* empty css */c=,/* empty css */m=,/* empty css */p=require("dayjs"),g=require("yup"),h=,/* empty css */x=require("react-i18next"),b=,/* empty css */v=,/* empty css */f=require("react-router-dom"),w=,/* empty css */y=,/* empty css */C=,/* empty css */j=,/* empty css */S=,/* empty css */M=,/* empty css */R=,/* empty css */k=,/* empty css */I=,/* empty css */T=,/* empty css */E=,/* empty css */P=,/* empty css */q=,/* empty css */D=,/* empty css */_=,/* empty css */z=,/* empty css */A=,/* empty css */B=,/* empty css */O=,/* empty css */N=,/* empty css */F=;/* empty css */function U(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function L(e){if(e&&"object"==typeof e&&"default"in e)return e;var n=/* @__PURE__ */Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,n}var H=/* @__PURE__ */U(n),K=/* @__PURE__ */U(p),V=/* @__PURE__ */L(g);const $=P.default(T.default)(({theme:{palette:e}})=>{var n,t,o,a;return{".MuiTableCell-root":{border:"1px solid #efefef",borderBottom:0,borderLeft:0,padding:"0.19rem 0.5rem",lineHeight:"19px",fontSize:"14px",minHeight:40},".MuiTableCell-head":{backgroundColor:null==(n=e.theme)?void 0:n.secondary[100]},".MuiTableContainer-root":{maxHeight:"clamp(350px, 100vh - 200px, 9999px) !important"},".MuiPaper-root":{boxShadow:"none"},".MuiPaginationItem-root":{"&.Mui-selected":{backgroundColor:null==(t=null==e?void 0:e.theme)?void 0:t.primary[700],color:"white"}},".MuiTableRow-root":{"&.Mui-selected":{backgroundColor:`${null==(o=null==e?void 0:e.theme)?void 0:o.primary[100]} !important`,color:"white"}},".MuiCheckbox-indeterminate":{color:`${null==(a=null==e?void 0:e.theme)?void 0:a.primary[700]} !important`,"& svg":{height:"20px !important",width:"20px !important"}}}}),W=H.default.memo(({enablePagination:p=!1,rows:g,columns:P,totalPages:U,paginationModel:L,columnOrder:H,updateData:W,handleColumnOrdering:J,enableEditing:Y,enableColumnDragging:Z,states:G,rowActionMenu:Q,destructiveActionMenu:X,disableDefaultActionColumn:ee,enableRowSelection:ne,defaultActionColumnItems:te=[],enableBottomToolbar:oe,SetSelectedRowId:ae,isResetRow:ie,onCreateRow:le,onEditRow:re,onDeleteRow:se,editDisplayMode:de,enableRowCreate:ue,onChangeRowField:ce,onSelectRow:me,enableColumnResizing:pe=!0,selectedRowIds:ge=[],onColumnVisibility:he,onSortingChange:xe,getSelectedData:be,disabledDefaultActionColumnIcon:ve=!1,enableAddCustomField:fe=!0,enableRowDragging:we=!1,handleColumnResizing:ye=()=>{},columnSizes:Ce={},hideSaveButton:je=!1,...Se})=>{const{t:Me}=x.useTranslation(),{formData:Re=null,updatePageInfo:ke,activePage:Ie}=v.usePages(),Te=I.default(Ie),{pageNo:Ee}=L,[Pe,qe]=n.useState({}),[De,_e]=n.useState(P),[ze,Ae]=n.useState(null),[Be,Oe]=n.useState(!1),[Ne,Fe]=n.useState(null),Ue=De.filter(e=>e.visible),Le=De.filter(e=>!e.visible),[He,Ke]=n.useState(Le),[Ve,$e]=n.useState(null),[We,Je]=n.useState({}),[Ye,Ze]=n.useState([]),[Ge,Qe]=n.useState(!1),[Xe,en]=n.useState(!1),[nn,tn]=n.useState(!1),[on,an]=n.useState(null),[ln,rn]=n.useState({}),[sn,dn]=n.useState(!1),[un,cn]=n.useState([]),[mn,pn]=n.useState(!1),[gn,hn]=n.useState(Te.column_sizes),[xn,bn]=n.useState({columnSizingStart:[],deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,startOffset:null,startSize:null});n.useState(0);const vn=f.useNavigate(),fn=location.pathname.split("/")[2];let wn="";switch(fn){case"accounting":wn=y.PathnameAccounting.CUSTOM_FORM;break;case"inventory":wn=C.PathnameInventory.CUSTOM_FORM;break;case"manufacturing":wn=j.PathnameManufacturing.CUSTOM_FORM;break;case"procurement":wn=S.PathnamePurchase.CUSTOM_FORM;break;case"crm":wn=M.PathnameCrm.CUSTOM_FORM;break;case"user":wn=R.PathnameUsers.CUSTOM_FORM;break;case"rental":wn=k.PathnameRental.CUSTOM_FORM;break;case"drive":wn=w.PathnameDocument.ADD_CUSTOM_FIELDS}const yn=`/dashboard/${fn}${wn}`,Cn=(e,n,t)=>{var o;let a=e;switch(n.type){case"required":a=n.value?e.required(n.msg_en).typeError(n.msg_en):(null==(o=null==t?void 0:t.editProperties)?void 0:o.is_multiple)?e.min(1,n.msg_en):e;break;case"min":a=e.min(n.value,n.msg_en);break;case"email":a=e.email(n.value,n.msg_en);break;case"max":a=e.max(n.value,n.msg_en);break;case"positive":a=!0===n.value?e.test("is-positive-number","Value must be a positive number",e=>!e||e>=0):e;break;case"when":return e.when(n.relation,{is:e=>e===n.values,then:()=>{var o;return(null==(o=null==n?void 0:n.thenValidations)?void 0:o.reduce((e,n)=>Cn(e,n,t),e))||e},otherwise:()=>{var o;return(null==(o=null==n?void 0:n.otherWiseValidations)?void 0:o.reduce((e,n)=>Cn(e,n,t),e))||e}});default:a=e}return"required"!=n.type||!n.value||(null==t?void 0:t.editVariant)&&"text"!=(null==t?void 0:t.editVariant)||(a=e.test("no-blank-spaces","Blank space is not allowed",e=>{var n;return e&&(null==(n=e.trim())?void 0:n.length)>0})),a};n.useEffect(()=>{_e(P);const e=(e=>{const n={};return e.forEach(e=>{var t,o,a;if(null==(o=null==(t=null==e?void 0:e.editProperties)?void 0:t.validations)?void 0:o.length){const t=null==(a=null==e?void 0:e.editProperties)?void 0:a.validations.reduce((n,t)=>Cn(n,t,e),(e=>{var n;switch(e.editVariant){case"select":return(null==(n=null==e?void 0:e.editProperties)?void 0:n.is_multiple)?V.array():V.string();case"number":return V.number().nullable().transform((e,n)=>""===n?null:e);case"url":return V.string().matches(/^(https?:\/\/)?((([a-zA-Z0-9_-]+\.)+[a-zA-Z]{2,})|localhost)(:\d{2,5})?(\/[a-zA-Z0-9#_-]+\/?)*(\?[a-zA-Z0-9&=_-]+)?(#\S+)?$/,{excludeEmptyString:!0,message:"Please enter valid URL."});default:return V.string()}})(e));n[e.accessorKey]=t}}),n})(P);Ze(V.object().shape(e))},[P]),n.useEffect(()=>{(null==xn?void 0:xn.isResizingColumn)||(ke({column_sizes:{...Te.column_sizes,...gn}}),null==ye||ye(gn))},[null==xn?void 0:xn.isResizingColumn,gn]);const jn=e=>{Ae(e.currentTarget)},Sn=n.useCallback((e,n)=>{const t={};return Object.keys(e).forEach(o=>{const a=e[o],i=n.find(e=>e.accessorKey==o);a?a instanceof File?t[o]=a.name:i&&"date"==(null==i?void 0:i.editVariant)?t[o]=K.default(a).format((null==i?void 0:i.dateFormat)||"DD-MM-YYYY"):i&&"select"==(null==i?void 0:i.editVariant)&&"object"==typeof a&&null!==a?t[o]=a.name||a.label||a.display_name||a.title||a.value||a.id||a:(i&&(null==i||i.editVariant),t[o]=a):t[o]=a}),t},[]),Mn=n.useCallback(e=>{var n;return null==(n=null==e?void 0:e.validations)?void 0:n.some(e=>"required"===e.type)},[]);n.useEffect(()=>{const e={};!sn&&ge.length&&(g.forEach(n=>{ge.includes(n.id)&&(e[n.id]=!0)}),rn(e),dn(!0))},[g,ge]),n.useEffect(()=>{if(xe instanceof Function){const e=Array.isArray(un)?un:[];xe(e[0]||null)}},[un]);const Rn=e=>{const n=document.createElement("canvas").getContext("2d");return n?n.measureText(e).width+5:50},kn=n.useCallback(async(e,n,t)=>{try{await Ye.validate(n,{abortEarly:!1}),Je({}),en(!0),pn(!1);const o=e.getAllCells().map(e=>e.column.columnDef);e._valuesCache=Sn(n,o);const a={row:e,values:n,table:t};re&&await re(a,"edit"),en(!1),t.setEditingRow(null)}catch(o){if(en(!1),o instanceof V.ValidationError){const e={};o.inner.forEach(n=>{n.path&&(e[n.path]=n.message)}),Je(e)}else o instanceof Error?b.enqueueSnackbar(o.message,{variant:"error"}):b.enqueueSnackbar("Something went wrong",{variant:"error"})}},[Ye,re,Sn]),In=t.useMaterialReactTable({defaultColumn:{minSize:0,size:void 0},columns:[...Ue.map(n=>(Rn(n.header||""),Math.max(...g.map(e=>Rn(String(e[n.accessorKey]??"")))),{...n,..."row"===de?{Edit:({cell:t,row:o,table:a,column:i})=>/* @__PURE__ */e.jsx(d.default,{cell:t,column:i,col:n,row:o,table:a,callback:e=>{},errors:We,validationSchema:Ye,setValidationErrors:Je,onChangeRowField:ce,getSelectedData:(e,n)=>null==be?void 0:be(e,n)})}:{},Header:/* @__PURE__ */e.jsxs(T.default,{display:"flex",alignItems:"center",children:[n.header,(null==n?void 0:n.required)||Mn(null==n?void 0:n.editProperties)&&/* @__PURE__ */e.jsx(l.Typography,{type:"s5",color:"theme.error.600",children:"*"})]}),enableColumnDragging:"actions"!==n.id,size:void 0,maxSize:800})),...ee?[]:[{id:"actions",enableEditing:!1,size:(null==te?void 0:te.length)>1?80:50,header:/* @__PURE__ */e.jsx(E.default,{size:"small",sx:{p:.5,"&:hover":{backgroundColor:"transparent"}},onClick:jn,children:/* @__PURE__ */e.jsx("img",{src:s.images.common.arrowIcon,alt:"Arrow Icon"})}),enableColumnDragging:!1,visible:!0,muiTableHeadCellProps:{className:"pinned-column"},muiTableBodyCellProps:{className:"pinned-column",sx:{whiteSpace:"pre-wrap"}},Cell:t=>(null==te?void 0:te.length)?te.map(e=>{const o={...e.props,onClick:()=>e.props.onClick(t)};return n.cloneElement(e,o)}):!ve&&/* @__PURE__ */e.jsx(E.default,{onClick:e=>{return n=e,o=t.row.original,qe(o),void Fe(n.currentTarget);var n,o},disabled:!(null==Q?void 0:Q.length)&&!(null==X?void 0:X.length),children:/* @__PURE__ */e.jsx("img",{src:s.images.more,alt:"More Icon"})})}]],data:g,muiTablePaperProps:{sx:{tableLayout:"auto"}},columnResizeMode:"onChange",onEditingRowSave:async e=>{await kn(e.row,e.values,e.table)},onCreatingRowSave:async e=>{try{await Ye.validate(e.values,{abortEarly:!1}),Je({}),Qe(!0),pn(!1);const n=e.row.getAllCells().map(e=>e.column.columnDef);e.row._valuesCache=Sn(e.values,n),le&&await le(e),Qe(!1),e.table.setCreatingRow(null)}catch(n){if(Qe(!1),n instanceof V.ValidationError){const e={};n.inner.forEach(n=>{n.path&&(e[n.path]=n.message)}),Je(e)}else n instanceof Error?b.enqueueSnackbar(n.message,{variant:"error"}):b.enqueueSnackbar("Something went wrong",{variant:"error"})}},onCreatingRowCancel:()=>(rn({}),void pn(!1)),onEditingRowCancel:()=>{pn(!1)},onSortingChange:(null==G?void 0:G.sorting)?xe:cn,displayColumnDefOptions:{"mrt-row-actions":{Header:/* @__PURE__ */e.jsx(E.default,{onClick:jn,size:"small",children:/* @__PURE__ */e.jsx("img",{src:s.images.common.arrowIcon,alt:"Arrow Icon"})}),muiTableBodyCellProps:({row:e,table:n})=>{var t,o;const a=(null==(t=n.getState().creatingRow)?void 0:t.id)===e.id,i=(null==(o=n.getState().editingRow)?void 0:o.id)===e.id;return{sx:{"& .MuiBox-root":{gap:0},backgroundColor:"#fff",whiteSpace:"pre-wrap",...je&&(i||a)?{"& .MuiBox-root > .MuiIconButton-root:first-of-type":{display:"none !important"},'& button[aria-label*="Save"]':{display:"none !important"},'& button[title*="Save"]':{display:"none !important"},'& .MuiIconButton-root[class*="save"]':{display:"none !important"},'& .MuiIconButton-root[data-testid*="save"]':{display:"none !important"}}:{}},onKeyUp:e=>{}}}},"mrt-row-expand":{size:70},"mrt-row-select":{size:50}},renderRowActions:({row:n,table:t})=>/* @__PURE__ */e.jsx(e.Fragment,{children:(null==Se?void 0:Se.enableExpanding)?/* @__PURE__ */e.jsx(e.Fragment,{children:(null==n?void 0:n.parentId)&&/* @__PURE__ */e.jsx(T.default,{sx:{display:"flex",gap:0},children:se&&/* @__PURE__ */e.jsx(u.Tooltip,{title:"Delete",children:/* @__PURE__ */e.jsx(E.default,{disabled:mn,onClick:()=>an(n),size:"small",children:/* @__PURE__ */e.jsx(N.Trash,{fontSize:"small",sx:{color:"theme.secondary.1000"}})})})})}):/* @__PURE__ */e.jsx(T.default,{sx:{display:"flex",gap:0},children:se&&/* @__PURE__ */e.jsx(u.Tooltip,{title:"Delete",children:/* @__PURE__ */e.jsx(E.default,{disabled:mn,onClick:()=>an(n),children:/* @__PURE__ */e.jsx(N.Trash,{fontSize:"small",sx:{color:"theme.secondary.1000"}})})})})}),...Boolean(ue)&&{renderBottomToolbarCustomActions:({table:n})=>/* @__PURE__ */e.jsx(c.Button,{variant:"outlined",startIcon:/* @__PURE__ */e.jsx(m.default,{}),className:"add-row-btn",disabled:mn,onClick:()=>{n.setCreatingRow(!0),pn(!0)},children:Me("common.add")})},onRowSelectionChange:rn,enableColumnOrdering:!0,enableRowSelection:ne??!0,enableEditing:Y instanceof Function?Y():Y??!0,editDisplayMode:de??"row",createDisplayMode:"row",enableColumnResizing:pe,enableRowDragging:we,enableTopToolbar:!1,enableColumnActions:!1,enableSorting:!0,enableGrouping:!0,enableBottomToolbar:oe??!1,enableColumnDragging:Z??!0,enableStickyHeader:!0,enableSortingRemoval:!1,state:{columnOrder:H,columnPinning:{left:["actions","mrt-row-actions"]},isSaving:Ge||Xe,showProgressBars:!1,rowSelection:ln,...G,sorting:Array.isArray(null==G?void 0:G.sorting)?null==G?void 0:G.sorting:Array.isArray(un)?un:[],columnSizing:gn},getRowId:e=>null==e?void 0:e.id,muiTableBodyRowProps:({row:e,table:n})=>{var t,o,a,i,l,r,s;const d=(null==(o=null==(t=n.getState())?void 0:t.editingRow)?void 0:o.id)||(null==(i=null==(a=n.getState())?void 0:a.creatingRow)?void 0:i.id)||null,u=(null==(r=null==(l=n.getState())?void 0:l.creatingRow)?void 0:r.id)||null,c=Boolean(null==(s=null==e?void 0:e.original)?void 0:s.has_error),m=d===e.id;return{onClick:()=>{$e(e.id)},onKeyDown:t=>{m&&("Enter"===t.key?(t.preventDefault(),n.setEditingRow(null)):"Escape"===t.key&&(t.preventDefault(),u===e.id?n.setCreatingRow(null):n.setEditingRow(null),pn(!1),u!==e.id&&kn(e,e._valuesCache||e.original,n)))},sx:{cursor:"pointer",backgroundColor:d?"inherit":c?"theme.error.100":"inherit","&:hover":{backgroundColor:d?"transparent":c?"theme.error.200":"#e8e8e8"},"&:hover td:after":{backgroundColor:"transparent"}}}},onColumnOrderChange:e=>{J&&J(e)},onColumnSizingChange:hn,onColumnSizingInfoChange:bn,renderEmptyRowsFallback:()=>/* @__PURE__ */e.jsxs(T.default,{className:"no-data",children:[
|
|
2
2
|
/* @__PURE__ */e.jsx("img",{src:s.images.common.tableNoData}),
|
|
3
|
-
/* @__PURE__ */e.jsx(l.Typography,{type:"s3",weight:"medium",color:"theme.secondary.1000",children:
|
|
4
|
-
/* @__PURE__ */e.jsx(
|
|
5
|
-
/* @__PURE__ */e.jsx(i.Menu,{anchorEl:
|
|
6
|
-
/* @__PURE__ */e.jsxs(q.default,{onClick:()=>{
|
|
3
|
+
/* @__PURE__ */e.jsx(l.Typography,{type:"s3",weight:"medium",color:"theme.secondary.1000",children:Me("common.noData")})]}),enablePagination:p,paginationDisplayMode:"pages",muiPaginationProps:{shape:"rounded",page:Ee,count:U,showRowsPerPage:!1,boundaryCount:3},muiEditTextFieldProps:({row:e,column:n})=>({InputProps:{disableUnderline:!0},onBlur:t=>{W(t.target.value,n,e.id)},variant:"outlined",sx:({palette:e})=>{var n;return{"& .MuiOutlinedInput-root":{"& fieldset":{borderColor:`${null==(n=e.theme)?void 0:n.primary[700]} !important`}}}}}),muiCircularProgressProps:{sx:{color:"#289B64"}},muiTableHeadCellProps:{sx:{lineHeight:"140%",letterSpacing:"-0.28px",fontWeight:"500",fontSize:"0.875rem","& .Mui-TableHeadCell-Content":{height:"100%"},"& .Mui-TableHeadCell-Content-Labels":{width:"100%",justifyContent:"space-between"},"&.pinned-column":{backgroundColor:"#fff"},"& .Mui-TableHeadCell-ResizeHandle-Wrapper":{padding:0,margin:0,right:"-5px",opacity:0}}},muiTableBodyProps:{sx:{zIndex:500}},muiTableHeadProps:{sx:{zIndex:600}},muiTableBodyCellProps:({cell:e,column:n,table:t,row:o})=>({sx:{lineHeight:"140%",letterSpacing:"-0.26px",fontWeight:"400",fontSize:"0.8125rem","&.pinned-column":{backgroundColor:"#fff"},"&:hover":{backgroundColor:"transparent"},whiteSpace:"pre-wrap"},onClick:e=>{var a,i,l,r;if(!1===n.columnDef.isOnClickEditable)return;const s=(null==(i=null==(a=t.getState())?void 0:a.editingRow)?void 0:i.id)||(null==(r=null==(l=t.getState())?void 0:l.creatingRow)?void 0:r.id)||null,d=s===o.id;if(s&&s!==o.id)return t.setEditingRow(null),void setTimeout(()=>{t.setEditingRow(o),pn(!0)},100);mn||d||s||(t.setEditingRow(o),pn(!0))}}),muiSelectCheckboxProps:{sx:{color:"theme.secondary.300","&.Mui-checked":{color:"theme.primary.600","&:hover":{color:"theme.primary.500"}},"&.Mui-disabled":{color:"theme.secondary.200"}},icon:/* @__PURE__ */e.jsx(O.RecgtangleIcon,{sx:{width:20,height:20}}),checkedIcon:/* @__PURE__ */e.jsx(F.CheckBoxIcon,{sx:{width:20,height:20}})},muiSelectAllCheckboxProps:{sx:{color:"theme.secondary.300","&.Mui-checked":{color:"theme.primary.600","&:hover":{color:"theme.primary.500"}},"&.Mui-disabled":{color:"theme.secondary.600"}},icon:/* @__PURE__ */e.jsx(O.RecgtangleIcon,{sx:{width:20,height:20}}),checkedIcon:/* @__PURE__ */e.jsx(F.CheckBoxIcon,{sx:{width:20,height:20}})},muiBottomToolbarProps:{sx:{boxShadow:"none","& .MuiBox-root":{paddingLeft:0}}},layoutMode:"grid",icons:{DragHandleIcon:()=>/* @__PURE__ */e.jsx(O.RecgtangleIcon,{fontSize:"medium"}),SortIcon:()=>/* @__PURE__ */e.jsx(B.ArrowUpDown,{fontSize:"medium"}),ArrowDownwardIcon:()=>/* @__PURE__ */e.jsx(B.ArrowUpDown,{fontSize:"medium"}),ArrowUpwardIcon:()=>/* @__PURE__ */e.jsx(B.ArrowUpDown,{fontSize:"medium"}),ExpandMoreIcon:()=>/* @__PURE__ */e.jsx(B.ArrowUpDown,{fontSize:"medium"}),ExpandLessIcon:()=>/* @__PURE__ */e.jsx(B.ArrowUpDown,{fontSize:"medium"}),SyncAltIcon:()=>/* @__PURE__ */e.jsx(B.ArrowUpDown,{fontSize:"medium"}),CancelIcon:n=>/* @__PURE__ */e.jsx(A.Close,{fontSize:"small",...n,color:"theme.secondary.1000"})},...Se});return n.useEffect(()=>{var e,n;ne&&(null==(e=null==In?void 0:In.getSelectedRowModel())?void 0:e.rows)&&(null==ae||ae(null==(n=null==In?void 0:In.getSelectedRowModel())?void 0:n.rows))},[ne]),n.useEffect(()=>{if(me)if(null==Se?void 0:Se.enableExpanding){const e=[],n=In.getState().rowSelection,t=(o,a="")=>{o.forEach((o,i)=>{var l;const r=a?`${a}.${i}`:`${o.id}`;n[r]&&e.push(o),(null==(l=o.subRows)?void 0:l.length)&&t(o.subRows,r)})};t(In.getRowModel().rows),me(e,ln)}else me(In.getSelectedRowModel().rows,ln)},[ln,In]),n.useEffect(()=>{ie&&(null==In||In.resetRowSelection())},[ie,In]),n.useEffect(()=>{if(!In)return;let e,n,t=0,o=!1;const a=a=>{a.target.closest('.MuiSelect-root, .MuiMenuItem-root, .MuiPopover-root, .MuiList-root, .MuiMenu-list, .MuiModal-root, .MuiBackdrop-root, .MuiButtonBase-root, .MuiFormControl-root, .MuiInputBase-root, .MuiTextField-root, .MuiOutlinedInput-root, .MuiFilledInput-root, .MuiAutocomplete-popper, .MuiPickersPopper-root, [role="option"], [role="listbox"], [role="combobox"]')&&(o=!0,t=Date.now(),n&&clearTimeout(n),e&&clearTimeout(e),e=setTimeout(()=>{o=!1},500))},i=e=>{var a,i;const l=null==(a=In.getState())?void 0:a.editingRow,r=null==(i=In.getState())?void 0:i.creatingRow;if(!l&&!r)return;const s=e.target,d=Date.now();o||d-t<300||s.closest(".MuiTableContainer-root, .MuiPaper-root, .MRT_Table")||(n&&clearTimeout(n),n=setTimeout(()=>{var e,n,t;const a=null==(e=In.getState())?void 0:e.editingRow,i=null==(n=In.getState())?void 0:n.creatingRow;if(!o){if(i){const e=i._valuesCache||i.original;return void((null==(t=In.options)?void 0:t.onCreatingRowSave)&&In.options.onCreatingRowSave({row:i,values:e,table:In}))}a&&kn(a,a._valuesCache||a.original,In)}},200))};return document.addEventListener("mousedown",a,!0),document.addEventListener("click",i,!0),()=>{document.removeEventListener("mousedown",a,!0),document.removeEventListener("click",i,!0),e&&clearTimeout(e),n&&clearTimeout(n)}},[In,kn]),/* @__PURE__ */e.jsxs($,{className:"MRT-TableWrapper custom-table",children:[
|
|
4
|
+
/* @__PURE__ */e.jsx(t.MaterialReactTable,{table:In}),
|
|
5
|
+
/* @__PURE__ */e.jsx(i.Menu,{anchorEl:ze,open:Boolean(ze),onClose:()=>{Ae(null)},className:"add-role-drp",children:Be?/* @__PURE__ */e.jsxs("div",{children:[
|
|
6
|
+
/* @__PURE__ */e.jsxs(q.default,{onClick:()=>{Oe(!1)},className:"role-drp-list add-column-title",children:[
|
|
7
7
|
/* @__PURE__ */e.jsx(D.default,{className:"add-icon",children:/* @__PURE__ */e.jsx(a.default,{})}),
|
|
8
|
-
/* @__PURE__ */e.jsx(_.default,{className:"title",children:
|
|
8
|
+
/* @__PURE__ */e.jsx(_.default,{className:"title",children:Me("common.addColumn_label")})]}),
|
|
9
9
|
/* @__PURE__ */e.jsx(z.default,{flexItem:!0,sx:{mt:"0.25rem !important",mb:"0.25rem !important"}}),
|
|
10
|
-
/* @__PURE__ */e.jsx("div",{className:"searchbar-box-list",children:/* @__PURE__ */e.jsx(r.SearchBar,{placeholder:"Search User",handleSearch:e=>(e=>{const n=
|
|
11
|
-
/* @__PURE__ */e.jsx("div",{className:"all-attribute-title",children:/* @__PURE__ */e.jsx(l.Typography,{variant:"body2",color:"text.secondary",children:
|
|
12
|
-
/* @__PURE__ */e.jsx(z.default,{flexItem:!0,sx:{mt:"0.25rem !important",mb:"0.25rem !important"}}),
|
|
10
|
+
/* @__PURE__ */e.jsx("div",{className:"searchbar-box-list",children:/* @__PURE__ */e.jsx(r.SearchBar,{placeholder:"Search User",handleSearch:e=>(e=>{const n=Le.filter(n=>n.header.toLowerCase().includes(e.toLowerCase()));Ke(n)})(e)})}),
|
|
11
|
+
/* @__PURE__ */e.jsx("div",{className:"all-attribute-title",children:/* @__PURE__ */e.jsx(l.Typography,{variant:"body2",color:"text.secondary",children:Me("common.allAttributes_label")})}),He.map(n=>/* @__PURE__ */e.jsx(q.default,{onClick:()=>(e=>{const n=De.map(n=>({...n,visible:n.accessorKey===e.accessorKey||n.visible}));null==he||he(JSON.parse(JSON.stringify(n))),_e(n);const t=He.filter(n=>n.accessorKey!==e.accessorKey);Ke(t),Ae(null),Oe(!1)})(n),children:/* @__PURE__ */e.jsx(l.Typography,{color:"theme.secondary.1000",type:"s3",children:n.header})},n.accessorKey)),
|
|
12
|
+
/* @__PURE__ */e.jsx(z.default,{flexItem:!0,sx:{mt:"0.25rem !important",mb:"0.25rem !important"}}),fe&&/* @__PURE__ */e.jsxs(q.default,{onClick:()=>{vn(yn,{state:Re}),Ae(null),Oe(!1)},className:"role-drp-list",children:[
|
|
13
13
|
/* @__PURE__ */e.jsx(D.default,{className:"add-icon",children:/* @__PURE__ */e.jsx("img",{src:s.images.common.addIcon,alt:"Add Icon"})}),
|
|
14
|
-
/* @__PURE__ */e.jsx(_.default,{className:"title",children:
|
|
14
|
+
/* @__PURE__ */e.jsx(_.default,{className:"title",children:Me("common.addCustomField_label")})]})]}):/* @__PURE__ */e.jsxs(e.Fragment,{children:[Ue.map(n=>/* @__PURE__ */e.jsxs(q.default,{onClick:()=>(e=>{const n=De.map(n=>({...n,visible:n.accessorKey!==e.accessorKey&&n.visible}));_e(n),null==he||he(JSON.parse(JSON.stringify(n))),Ke([...He,e]),Ae(null)})(n),className:"role-drp-list",children:[
|
|
15
15
|
/* @__PURE__ */e.jsx(D.default,{className:"add-icon",children:/* @__PURE__ */e.jsx("img",{src:s.images.common.dotsIcon,alt:"Add Icon"})}),
|
|
16
16
|
/* @__PURE__ */e.jsx(_.default,{className:"title",children:n.header}),
|
|
17
17
|
/* @__PURE__ */e.jsx(D.default,{className:"eye-icon",children:/* @__PURE__ */e.jsx("img",{src:s.images.common.eyeIcon,alt:"Eye Icon"})})]},n.accessorKey)),
|
|
18
18
|
/* @__PURE__ */e.jsx(z.default,{flexItem:!0,sx:{mt:"0.25rem !important",mb:"0.25rem !important"}}),
|
|
19
|
-
/* @__PURE__ */e.jsxs(q.default,{onClick:()=>{
|
|
19
|
+
/* @__PURE__ */e.jsxs(q.default,{onClick:()=>{Oe(!0)},className:"role-drp-list",children:[
|
|
20
20
|
/* @__PURE__ */e.jsx(D.default,{className:"add-icon",children:/* @__PURE__ */e.jsx("img",{src:s.images.common.addIcon,alt:"Add Icon"})}),
|
|
21
|
-
/* @__PURE__ */e.jsx(_.default,{className:"title",children:
|
|
22
|
-
/* @__PURE__ */e.jsx(l.Typography,{variant:"body2",color:"text.secondary",className:"eye-icon",children:/* @__PURE__ */e.jsx(
|
|
23
|
-
/* @__PURE__ */e.jsxs(i.Menu,{anchorEl:
|
|
24
|
-
/* @__PURE__ */e.jsx(l.Typography,{type:"s4",color:"inherit",children:"function"==typeof n.label?n.label(
|
|
21
|
+
/* @__PURE__ */e.jsx(_.default,{className:"title",children:Me("common.addColumn_label")}),
|
|
22
|
+
/* @__PURE__ */e.jsx(l.Typography,{variant:"body2",color:"text.secondary",className:"eye-icon",children:/* @__PURE__ */e.jsx(o.default,{sx:{fontSize:"1.25rem !important"}})})]})]})}),
|
|
23
|
+
/* @__PURE__ */e.jsxs(i.Menu,{anchorEl:Ne,open:Boolean(Ne),onClose:()=>{Fe(null)},children:[null==Q?void 0:Q.map(n=>/* @__PURE__ */e.jsxs(q.default,{onClick:async()=>{await n.handleAction(Pe),Fe(null)},disabled:"function"==typeof n.disabled?n.disabled(Pe):Boolean(n.disabled),sx:{alignItems:"center",gap:.5},children:[null==n?void 0:n.icon,
|
|
24
|
+
/* @__PURE__ */e.jsx(l.Typography,{type:"s4",color:"inherit",children:"function"==typeof n.label?n.label(Pe):n.label})]})),(null==X?void 0:X.length)>0&&/* @__PURE__ */e.jsxs(e.Fragment,{children:[
|
|
25
25
|
/* @__PURE__ */e.jsx(z.default,{flexItem:!0,sx:{mt:"0.25rem !important",mb:"0.25rem !important"}}),
|
|
26
|
-
/* @__PURE__ */e.jsx("div",{className:"dropdown-inner--DestructiveHeader",children:null==X?void 0:X.map(n=>/* @__PURE__ */e.jsx(q.default,{onClick:()=>{n.handleAction(
|
|
27
|
-
/* @__PURE__ */e.jsx(
|
|
26
|
+
/* @__PURE__ */e.jsx("div",{className:"dropdown-inner--DestructiveHeader",children:null==X?void 0:X.map(n=>/* @__PURE__ */e.jsx(q.default,{onClick:()=>{n.handleAction(Pe),Fe(null)},className:"dropdown-inner--DestructiveActions",disabled:"function"==typeof n.disabled?n.disabled(Pe):Boolean(n.disabled),children:/* @__PURE__ */e.jsx(l.Typography,{type:"s4",color:"inherit",children:"function"==typeof n.label?n.label(Pe):n.label})}))})]})]}),
|
|
27
|
+
/* @__PURE__ */e.jsx(h.ConfirmPopUp,{open:Boolean(on),onClose:()=>an(null),onConfirm:()=>(async()=>{tn(!0),on&&(await(null==se?void 0:se(on)),an(null)),tn(!1)})(),title:"Delete Item",description:"Are you sure you want to delete entry ?",loading:nn})]})});exports.MaterialEditableTable=W,exports.default=W;
|
|
28
28
|
//# sourceMappingURL=index.js.map
|