umwd-components 0.1.709 → 0.1.710

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.
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as o,useEffect as l}from"react";import i from"@mui/material/Box";import a from"@mui/material/Table";import r from"@mui/material/TableBody";import c from"@mui/material/TableCell";import m from"@mui/material/TableContainer";import s from"@mui/material/TablePagination";import u from"@mui/material/TableRow";import d from"@mui/material/Paper";import f from"@mui/material/FormControlLabel";import g from"@mui/material/Switch";import h from"./EnhancedTableHead.js";import p from"./EnhancedTableToolbar.js";import b from"./EnhancedTableRow.js";import v from"./EnhancedTableFilterRow.js";import{useRouter as w,usePathname as S,useSearchParams as E}from"next/navigation";function C(C){var P,T,R,F,x=C.data,y=C.meta,j=C.headCells,k=C.subHeadCells,B=C.withSelection,H=C.title,L=C.subTitle,O=C.functions,U=C.selectFunctions,q=w().replace,z=S(),A=E(),D=e(o("asc"),2),I=D[0],W=D[1],_=e(o("id"),2),G=_[0],J=_[1],K=e(o([]),2),M=K[0],N=K[1],Q=e(o(0),2),V=Q[0],X=Q[1],Y=e(o(!1),2),Z=Y[0],$=Y[1],ee=e(o(5),2),te=ee[0],ne=ee[1],oe=e(o(!1),2),le=oe[0],ie=oe[1],ae=e(o((function(){var e=new URLSearchParams(null==A?void 0:A.toString()),t={};return j.forEach((function(n){if(n.filterable){var o=e.get("filter[".concat(n.id,"]"));o&&(t[n.id]=o)}})),t})),2),re=ae[0],ce=ae[1],me=j.some((function(e){return e.filterable})),se=function(e,t){var n=M.indexOf(t),o=[];-1===n?o=o.concat(M,t):0===n?o=o.concat(M.slice(1)):n===M.length-1?o=o.concat(M.slice(0,-1)):n>0&&(o=o.concat(M.slice(0,n),M.slice(n+1))),N(o)},ue=V+1===(null===(P=null==y?void 0:y.pagination)||void 0===P?void 0:P.pageCount)?(null===(T=null==y?void 0:y.pagination)||void 0===T?void 0:T.total)-(null===(R=null==y?void 0:y.pagination)||void 0===R?void 0:R.pageCount)*te:0;return l((function(){if(A){console.log("Search Params:",A.toString());var t=new URLSearchParams(A);console.log(t),I?t.set("order",I):t.delete("order"),G?t.set("orderBy",G):t.delete("orderBy"),V?t.set("page",V.toString()):t.delete("page"),te?t.set("rowsPerPage",te.toString()):t.delete("rowsPerPage"),Object.entries(re).forEach((function(n){var o=e(n,2),l=o[0],i=o[1];i?t.set("filter[".concat(l,"]"),i):t.delete("filter[".concat(l,"]"))})),q("".concat(z,"?").concat(t.toString()))}}),[I,G,V,te,re]),n.createElement(i,{sx:{width:"100%"}},n.createElement(d,{sx:{width:"100%",mb:2}},n.createElement(p,{selected:M,setSelected:N,title:H,functions:O,selectFunctions:U,showFilters:le,onToggleFilters:function(){return ie(!le)},hasFilterableColumns:me}),n.createElement(m,null,n.createElement(a,{sx:{minWidth:750},"aria-labelledby":"tableTitle",size:Z?"small":"medium"},n.createElement(h,{numSelected:M.length,order:I,orderBy:G,onSelectAllClick:function(e){if(e.target.checked){var t=x.map((function(e){return e.id}));N(t)}else N([])},onRequestSort:function(e,t){W(G===t&&"asc"===I?"desc":"asc"),J(t)},rowCount:x.length,headCells:j,withSelection:B,withSubRows:!!k}),n.createElement(r,null,le&&n.createElement(v,{headCells:j,filters:re,onFilterChange:function(e,n){ce((function(o){var l;return t(t({},o),((l={})[e]=n,l))})),X(0)},withSelection:B,withSubRows:!!k}),x.map((function(e,t){return n.createElement(b,{key:e.id,row:e,headCells:j,subHeadCells:k,withSelection:B,isSelected:M.includes(e.id),handleSelectClick:se,subTitle:L})})),ue>0&&n.createElement(u,{style:{height:(Z?33:53)*ue}},n.createElement(c,{colSpan:j.length+(B?1:0)+(k?1:0)}))))),n.createElement(s,{rowsPerPageOptions:[5,10,25],component:"div",count:null===(F=null==y?void 0:y.pagination)||void 0===F?void 0:F.total,rowsPerPage:te,page:V,onPageChange:function(e,t){X(t)},onRowsPerPageChange:function(e){ne(parseInt(e.target.value,10)),X(0)}})),n.createElement(f,{control:n.createElement(g,{checked:Z,onChange:function(e){$(e.target.checked)}}),label:"Dense padding"}))}export{C as default};
6
+ import{__read as e,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as o,useEffect as i}from"react";import l from"@mui/material/Box";import r from"@mui/material/Table";import a from"@mui/material/TableBody";import c from"@mui/material/TableCell";import m from"@mui/material/TableContainer";import s from"@mui/material/TablePagination";import u from"@mui/material/TableRow";import d from"@mui/material/Paper";import f from"@mui/material/FormControlLabel";import h from"@mui/material/Switch";import g from"./EnhancedTableHead.js";import p from"./EnhancedTableToolbar.js";import w from"./EnhancedTableRow.js";import b from"./EnhancedTableFilterRow.js";import{useRouter as v,usePathname as E,useSearchParams as S}from"next/navigation";function C(C){var T,P,x,y,F=C.data,R=C.meta,j=C.headCells,k=C.subHeadCells,B=C.withSelection,H=C.title,L=C.subTitle,O=C.functions,q=C.selectFunctions,A=v().replace,U=E(),z=S(),D=e(o("asc"),2),I=D[0],W=D[1],X=e(o("id"),2),Y=X[0],_=X[1],G=e(o([]),2),J=G[0],K=G[1],M=e(o(0),2),N=M[0],Q=M[1],V=e(o(!1),2),Z=V[0],$=V[1],ee=e(o(5),2),te=ee[0],ne=ee[1],oe=e(o(!1),2),ie=oe[0],le=oe[1],re=e(o((function(){var e=new URLSearchParams(null==z?void 0:z.toString()),t={};return j.forEach((function(n){if(n.filterable){var o=e.get("filter[".concat(n.id,"]"));o&&(t[n.id]=o)}})),t})),2),ae=re[0],ce=re[1],me=j.some((function(e){return e.filterable})),se=function(e,t){var n=J.indexOf(t),o=[];-1===n?o=o.concat(J,t):0===n?o=o.concat(J.slice(1)):n===J.length-1?o=o.concat(J.slice(0,-1)):n>0&&(o=o.concat(J.slice(0,n),J.slice(n+1))),K(o)},ue=N+1===(null===(T=null==R?void 0:R.pagination)||void 0===T?void 0:T.pageCount)?(null===(P=null==R?void 0:R.pagination)||void 0===P?void 0:P.total)-(null===(x=null==R?void 0:R.pagination)||void 0===x?void 0:x.pageCount)*te:0;return i((function(){if(z){var t={x:window.scrollX,y:window.scrollY},n=new URLSearchParams(z);I?n.set("order",I):n.delete("order"),Y?n.set("orderBy",Y):n.delete("orderBy"),N?n.set("page",N.toString()):n.delete("page"),te?n.set("rowsPerPage",te.toString()):n.delete("rowsPerPage"),Object.entries(ae).forEach((function(t){var o=e(t,2),i=o[0],l=o[1];l?n.set("filter[".concat(i,"]"),l):n.delete("filter[".concat(i,"]"))})),A("".concat(U,"?").concat(n.toString()),{scroll:!1}),requestAnimationFrame((function(){window.scrollTo(t.x,t.y)}))}}),[I,Y,N,te,ae]),n.createElement(l,{sx:{width:"100%"}},n.createElement(d,{sx:{width:"100%",mb:2}},n.createElement(p,{selected:J,setSelected:K,title:H,functions:O,selectFunctions:q,showFilters:ie,onToggleFilters:function(){return le(!ie)},hasFilterableColumns:me}),n.createElement(m,null,n.createElement(r,{sx:{minWidth:750},"aria-labelledby":"tableTitle",size:Z?"small":"medium"},n.createElement(g,{numSelected:J.length,order:I,orderBy:Y,onSelectAllClick:function(e){if(e.target.checked){var t=F.map((function(e){return e.id}));K(t)}else K([])},onRequestSort:function(e,t){W(Y===t&&"asc"===I?"desc":"asc"),_(t)},rowCount:F.length,headCells:j,withSelection:B,withSubRows:!!k}),n.createElement(a,null,ie&&n.createElement(b,{headCells:j,filters:ae,onFilterChange:function(e,n){ce((function(o){var i;return t(t({},o),((i={})[e]=n,i))})),Q(0)},withSelection:B,withSubRows:!!k}),F.map((function(e,t){return n.createElement(w,{key:e.id,row:e,headCells:j,subHeadCells:k,withSelection:B,isSelected:J.includes(e.id),handleSelectClick:se,subTitle:L})})),ue>0&&n.createElement(u,{style:{height:(Z?33:53)*ue}},n.createElement(c,{colSpan:j.length+(B?1:0)+(k?1:0)}))))),n.createElement(s,{rowsPerPageOptions:[5,10,25],component:"div",count:null===(y=null==R?void 0:R.pagination)||void 0===y?void 0:y.total,rowsPerPage:te,page:N,onPageChange:function(e,t){Q(t)},onRowsPerPageChange:function(e){ne(parseInt(e.target.value,10)),Q(0)}})),n.createElement(f,{control:n.createElement(h,{checked:Z,onChange:function(e){$(e.target.checked)}}),label:"Dense padding"}))}export{C as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import l from"react";import r from"@mui/material/TableRow";import a from"@mui/material/TableCell";import n from"@mui/material/TextField";import i from"@mui/material/Select";import o from"@mui/material/MenuItem";import u from"@mui/material/Box";function m(m){var c=m.headCells,d=m.filters,f=m.onFilterChange,s=m.withSelection,p=m.withSubRows,v=e(l.useState(d),2),h=v[0],g=v[1],E=function(e,t){f(e,t)};return l.createElement(r,null,s&&l.createElement(a,{padding:"checkbox"}),p&&l.createElement(a,null),c.map((function(r){return l.createElement(a,{key:r.id,align:r.numeric?"right":"left",padding:r.disablePadding?"none":"normal"},r.filterable&&function(){var a,m=h[r.id]||"";switch(r.filterType){case"select":return l.createElement(i,{size:"small",value:m,onChange:function(e){var l=e.target.value;g((function(e){var a;return t(t({},e),((a={})[r.id]=l,a))})),E(r.id,l)},fullWidth:!0},l.createElement(o,{value:""},"All"),null===(a=r.filterOptions)||void 0===a?void 0:a.map((function(e){return l.createElement(o,{key:e,value:e},e)})));case"date":var c=e(m?m.split(","):["",""],2),d=c[0],f=c[1];return l.createElement(u,{sx:{display:"flex",gap:1}},l.createElement(n,{type:"date",size:"small",placeholder:"Start date",value:d,onChange:function(e){var l=[e.target.value,f].filter(Boolean).join(",");g((function(e){var a;return t(t({},e),((a={})[r.id]=l,a))})),E(r.id,l)},sx:{flex:1}}),l.createElement(n,{type:"date",size:"small",placeholder:"End date",value:f,onChange:function(e){var l=e.target.value,a=[d,l].filter(Boolean).join(",");g((function(e){var l;return t(t({},e),((l={})[r.id]=a,l))})),E(r.id,a)},sx:{flex:1}}));default:return l.createElement(n,{size:"small",placeholder:"Filter ".concat(r.label),value:m,onChange:function(e){return g((function(l){var a;return t(t({},l),((a={})[r.id]=e.target.value,a))}))},onBlur:function(){return E(r.id,m)},onKeyPress:function(e){"Enter"===e.key&&E(r.id,m)},fullWidth:!0})}}())})))}export{m as default};
6
+ import{__read as e,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import n from"react";import i from"@mui/material/TableRow";import r from"@mui/material/TableCell";import l from"@mui/material/TextField";import a from"@mui/material/Select";import o from"@mui/material/MenuItem";import u from"@mui/material/Box";import m from"@mui/material/Button";function c(c){var s=c.headCells,f=c.filters,d=c.onFilterChange,h=c.withSelection,p=c.withSubRows,v=e(n.useState(f),2),g=v[0],x=v[1],E=function(e,t){d(e,t)};return n.createElement(i,null,h&&n.createElement(r,{padding:"checkbox"}),p&&n.createElement(r,null),s.map((function(i){return n.createElement(r,{key:i.id,align:i.numeric?"right":"left",padding:i.disablePadding?"none":"normal"},i.filterable&&function(){var r,c=g[i.id]||"";switch(i.filterType){case"select":return n.createElement(a,{size:"small",value:c,onChange:function(e){return n=i.id,r=e.target.value,x((function(e){var i;return t(t({},e),((i={})[n]=r,i))})),void E(n,r);var n,r},fullWidth:!0,sx:{height:32}},n.createElement(o,{value:""},"All"),null===(r=i.filterOptions)||void 0===r?void 0:r.map((function(e){return n.createElement(o,{key:e,value:e},e)})));case"date":var s=e(c?c.split(","):["",""],2),f=s[0],d=s[1];return n.createElement(u,{sx:{display:"flex",alignItems:"center",gap:.5}},n.createElement(l,{type:"date",size:"small",InputProps:{sx:{height:32,fontSize:"0.875rem"}},value:f,onChange:function(e){return x((function(n){var r;return t(t({},n),((r={})[i.id]=[e.target.value,d].filter(Boolean).join(","),r))}))},sx:{width:130}}),n.createElement(l,{type:"date",size:"small",InputProps:{sx:{height:32,fontSize:"0.875rem"}},value:d,onChange:function(e){return x((function(n){var r;return t(t({},n),((r={})[i.id]=[f,e.target.value].filter(Boolean).join(","),r))}))},sx:{width:130}}),n.createElement(m,{size:"small",sx:{minWidth:32,height:32,px:.5},onClick:function(){x((function(e){var n;return t(t({},e),((n={})[i.id]="",n))})),E(i.id,"")}},"✕"),n.createElement(m,{size:"small",variant:"contained",sx:{minWidth:32,height:32,px:.5},onClick:function(){return E(i.id,g[i.id]||"")}},"✓"));default:return n.createElement(l,{size:"small",placeholder:"Filter ".concat(i.label),value:c,InputProps:{sx:{height:32,fontSize:"0.875rem"}},onChange:function(e){return x((function(n){var r;return t(t({},n),((r={})[i.id]=e.target.value,r))}))},onBlur:function(){return E(i.id,c)},onKeyDown:function(e){return"Enter"===e.key&&E(i.id,c)},fullWidth:!0})}}())})))}export{c as default};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__awaiter as e,__generator as o,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import r from"../../../../node_modules/qs/lib/index.js";import{fetchData as s}from"../loaders.js";import{getStrapiURL as p}from"../../../lib/utils.js";import{unstable_noStore as i}from"next/cache";var a=p();function u(p,u){return e(this,void 0,void 0,(function(){var e;return o(this,(function(o){switch(o.label){case 0:return i(),(e=new URL("/api/opos/".concat(p),a)).search=r.stringify({populate:{opo_items:{populate:{product:{populate:{price:!0,image:!0}},picked_reports:!0,packed_reports:!0,shipped_reports:!0,reports:{populate:{author:!0}}}},customer:{populate:["business_credentials"]},notes:{populate:{author:{populate:!0}}}},filters:t({},u)}),[4,s(e.href)];case 1:return[2,o.sent()]}}))}))}export{u as getSingleOpo};
7
+ import{__awaiter as e,__generator as o,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import r from"../../../../node_modules/qs/lib/index.js";import{fetchData as s}from"../loaders.js";import{getStrapiURL as p}from"../../../lib/utils.js";import{unstable_noStore as i}from"next/cache";var a=p();function u(p){return e(this,arguments,void 0,(function(e,p){var u;return void 0===p&&(p={}),o(this,(function(o){switch(o.label){case 0:return i(),(u=new URL("/api/opos/".concat(e),a)).search=r.stringify({populate:{opo_items:{populate:{product:{populate:{price:!0,image:!0}},picked_reports:!0,packed_reports:!0,shipped_reports:!0,reports:{populate:{author:!0}}}},customer:{populate:["business_credentials"]},notes:{populate:{author:{populate:!0}}}},filters:t({},p)}),[4,s(u.href)];case 1:return[2,o.sent()]}}))}))}export{u as getSingleOpo};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e}from"../../node_modules/tslib/tslib.es6.js";function t(t){return Object.entries(t).reduce((function(t,r){var i=e(r,2),n=i[0],s=i[1];if(!s)return t;if(s.includes(",")){var l=e(s.split(","),2),o=l[0],u=l[1];o&&u?t[n]={$gte:o,$lte:u}:o?t[n]={$gte:o}:u&&(t[n]={$lte:u})}else t[n]={$containsi:s};return t}),{})}export{t as processFilters};
6
+ import{__read as e}from"../../node_modules/tslib/tslib.es6.js";function t(t){return Object.entries(t).reduce((function(t,r){var i=e(r,2),n=i[0],s=i[1];if(!s)return t;if(s.includes(",")){var l=e(s.split(","),2),u=l[0],c=l[1];u&&c?t[n]={$gte:u,$lte:c}:u?t[n]={$gte:u}:c&&(t[n]={$lte:c})}else{var o=s.includes(" ")?s.replace(/\s+/g,"_"):s;t[n]={$containsi:o}}return t}),{})}export{t as processFilters};