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.
- package/dist/src/components/common/EnhancedTable/EnhancedTable.js +1 -1
- package/dist/src/components/common/EnhancedTable/EnhancedTableFilterRow.js +1 -1
- package/dist/src/data/loaders/e-commerce/getSingleOpo.js +1 -1
- package/dist/src/lib/processFilters.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/data/loaders/e-commerce/getSingleOpo.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/common/EnhancedTable/EnhancedTable.tsx +11 -6
- package/src/components/common/EnhancedTable/EnhancedTableFilterRow.tsx +65 -36
- package/src/data/loaders/e-commerce/getSingleOpo.ts +1 -1
- package/src/lib/processFilters.ts +5 -1
|
@@ -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
|
|
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
|
|
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
|
|
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),
|
|
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};
|