@foodpilot/foods 2.19.3 → 2.20.0
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as o,jsx as i}from"react/jsx-runtime";import{ArrowForward as
|
|
2
|
-
return i(
|
|
1
|
+
import{jsxs as e,Fragment as o,jsx as i}from"react/jsx-runtime";import{ArrowForward as t,ArrowBack as a}from"@mui/icons-material";import{Stack as n,Pagination as r,PaginationItem as l,useTheme as p,Typography as d}from"@mui/material";import{useMaterialReactTable as s,MRT_TableContainer as g,MRT_TablePagination as m}from"material-react-table";import{useMemo as c}from"react";import{FoodsIcon as b}from"../Icons/FoodsIcon.js";import{MRT_GRID_HUB_LAYOUT as u}from"./mrtGridLayout.js";const h={xs:"15px",sm:"32px 40px 40px"},x=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),w=(e,o)=>Object.entries(o).reduce((e,[o,i])=>{const t=e[o];return e[o]=x(t)&&x(i)?w(t,i):i,e},{...e}),y=(e,o)=>e?"function"==typeof e?y(e(o),o):Array.isArray(e)?e.reduce((e,i)=>w(e,y(i,o)),{}):x(e)?e:{}:{},P=(e,o,i)=>t=>{const a=y(e,t),n=y(o,t);return i?w(n,a):w(a,n)},C=(e,o,i=!1)=>{if(void 0===o)return e;const t=o=>({...e,...o,sx:void 0===o.sx?e.sx:void 0===e.sx?o.sx:P(e.sx,o.sx,i)});return"function"==typeof o?e=>t(o(e)):t(o)};function f(x){const{appearance:w="default",columns:y,displayColumnDefOptions:P,enableColumnPinning:f,enableColumnResizing:H,maxLinesPerRow:v=2,muiPaginationProps:R,muiPaginationStackProps:T,muiTableBodyCellProps:$,muiTableBodyRowProps:k,muiTableHeadCellProps:S,muiTableHeadRowProps:A,muiTableProps:M,...I}=x,L="hub"===w,z=(e=>{const o=p(),{appearance:i,maxLinePerRow:t}=e,a="hub"===i,n=a?[o.custom.strokes.containerDivider.width,o.custom.strokes.containerDivider.style,o.custom.strokes.containerDivider.color].join(" "):`1px solid ${o.custom.grey[500]}`;return{bodyCell:{padding:a?u.bodyCellPadding:o.spacing(1,2),...a&&{boxSizing:"border-box",height:`${u.rowHeight}px`,maxHeight:`${u.rowHeight}px`,paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",paddingTop:"8px"},"&:last-child[data-pinned='true']":a?{boxShadow:u.pinnedActionShadow}:{width:"1%"},borderInline:n,"& p":{display:"-webkit-box",WebkitLineClamp:t,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"initial",textOverflow:"ellipsis"}},bodyRow:{minHeight:`${u.rowHeight}px`,...a&&{boxSizing:"border-box",height:`${u.rowHeight}px`,maxHeight:`${u.rowHeight}px`},"&:hover td::after":{backgroundColor:o.custom.grey[300]}},headCell:{backgroundColor:o.custom.grey[200],border:n,...a&&{"&:last-child[data-pinned='true']":{boxShadow:u.pinnedActionShadow},boxSizing:"border-box",height:`${u.headerHeight}px`,maxHeight:`${u.headerHeight}px`,paddingBottom:"12px",paddingLeft:"12px",paddingRight:"8px",paddingTop:"12px"},"& p":{display:"-webkit-box",WebkitLineClamp:t,WebkitBoxOrient:"vertical",overflow:"hidden",whiteSpace:"initial",...!a&&{lineHeight:"normal"},textOverflow:"ellipsis"},padding:a?u.headerCellPadding:o.spacing(2),minHeight:a?`${u.headerHeight}px`:"48px",justifyContent:"center","&>.Mui-TableHeadCell-Content .MuiDivider-vertical":{opacity:"0"},"& .Mui-TableHeadCell-Content-Labels":{width:"100%","& .Mui-TableHeadCell-Content-Wrapper":{width:"100%"}}},headRow:{boxShadow:"none",...a&&{boxSizing:"border-box",height:`${u.headerHeight}px`,maxHeight:`${u.headerHeight}px`,minHeight:`${u.headerHeight}px`}},table:{...a?{"& tbody tr":{backgroundColor:`${o.palette.common.white} !important`}}:{"& tr:nth-of-type(even)":{backgroundColor:`${o.custom.grey[200]} !important`}},"[data-pinned='true']:before":{display:"none"}},pagination:{"& .MuiPagination-ul":{gap:o.spacing(1),justifyContent:"flex-end"},"& .MuiPaginationItem-root":{...a?o.typography["body-bold"]:o.typography["small-bold"],border:0,color:o.palette.text.primary,height:o.spacing(4),margin:0,minWidth:o.spacing(4),width:o.spacing(4)},"& .MuiPaginationItem-root.Mui-selected":{backgroundColor:o.palette.primary[500],color:o.palette.common.white,"&:hover":{backgroundColor:o.palette.primary[600]}},"& .MuiPaginationItem-root.Mui-focusVisible":{outline:`${o.spacing(.25)} solid ${o.palette.primary[700]}`,outlineOffset:o.spacing(.25)}}}})({appearance:w,maxLinePerRow:c(()=>v,[v])}),B=L?{...P,"mrt-row-actions":{...P?.["mrt-row-actions"],grow:!1,header:"",size:u.actionColumnWidth}}:P,j=c(()=>y.map(e=>({Header:e=>{const{column:o}=e,t=o.columnDef.header;/* @__PURE__ */
|
|
2
|
+
return i(d,{variant:L?"small-semibold":"small-bold",component:"p",title:t,children:t})},Cell:e=>"object"==typeof e.cell.getValue()?null:/* @__PURE__ */i(d,{variant:"body",component:"p",children:e.renderedCellValue}),...e,...L&&{grow:e.grow??!0}})),[y,L]),D={shape:"circular",variant:"text",showFirstButton:!1,showLastButton:!1,showRowsPerPage:!1,sx:z.pagination},O=e=>({...C(D,e,!0),showRowsPerPage:!1}),W=L?"function"==typeof R?e=>O(R(e)):O(R):R??D,G={columns:j,enableDensityToggle:!1,enableToolbarInternalActions:!1,enableColumnActions:!1,enableRowActions:!1,positionActionsColumn:"last",enableRowSelection:!0,enableSelectAll:!0,enablePagination:!0,muiTableBodyCellProps:L?C({sx:z.bodyCell},$,!0):$??{sx:z.bodyCell},muiTableBodyRowProps:L?C({sx:z.bodyRow},k,!0):k??{sx:z.bodyRow},muiTableHeadCellProps:L?C({sx:z.headCell},S,!0):S??{sx:z.headCell},muiTableHeadRowProps:L?C({sx:z.headRow},A,!0):A??{sx:z.headRow},muiTableProps:L?C({sx:z.table},M,!0):M??{sx:z.table},muiSelectCheckboxProps:{},muiSelectAllCheckboxProps:{},paginationDisplayMode:"pages",icons:{ChevronLeftIcon:()=>/* @__PURE__ */i(a,{}),ChevronRightIcon:()=>/* @__PURE__ */i(t,{})},enableColumnPinning:!!L||f,enableColumnResizing:!L&&(H??!0),layoutMode:"grid",...I,displayColumnDefOptions:B,muiPaginationProps:W},V=s(G),F=x.enablePagination??G.enablePagination,q=V.getPageCount(),E=V.getState().pagination.pageIndex,J="function"==typeof G.muiPaginationProps?G.muiPaginationProps({table:V}):G.muiPaginationProps,{showRowsPerPage:K,...N}=J??{},{sx:Q,...U}=T??{},X={margin:L?0:h,...L&&{boxSizing:"border-box",minHeight:`${u.paginationMinHeight}px`,padding:u.paginationPadding},".MuiTablePagination-root":{padding:0},".MuiTablePagination-toolbar":{padding:0}},Y=void 0===Q?X:L?[...Array.isArray(Q)?Q:[Q],X]:[X,...Array.isArray(Q)?Q:[Q]];/* @__PURE__ */
|
|
3
3
|
return e(o,{children:[
|
|
4
|
-
/* @__PURE__ */i(g,{table:V}),F&&(!
|
|
4
|
+
/* @__PURE__ */i(g,{table:V}),F&&(!L||q>0)&&/* @__PURE__ */i(n,{alignItems:"flex-end","data-appearance":w,"data-testid":"mrt-grid-pagination",...U,sx:Y,children:L?/* @__PURE__ */i(r,{"aria-label":"Table pagination",...N,count:q,getItemAriaLabel:(e,o,i)=>"page"===e?i?`page ${o}`:`Go to page ${o}`:`Go to ${e} page`,onChange:(e,o)=>V.setPageIndex(o-1),page:Math.min(E+1,q),renderItem:e=>/* @__PURE__ */i(l,{...e,slots:{previous:()=>/* @__PURE__ */i(b,{icon:"arrowLeft",size:2}),next:()=>/* @__PURE__ */i(b,{icon:"arrowRight",size:2})}})}):/* @__PURE__ */i(m,{table:V})})]})}export{f as MRTGrid};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const i={actionColumnWidth:60,bodyCellPadding:"8px 12px",headerCellPadding:"12px 8px 12px 12px",headerHeight:64,paginationMinHeight:104,paginationPadding:"32px 40px 40px",rowHeight:64};export{i as MRT_GRID_HUB_LAYOUT};
|
|
1
|
+
const i={actionColumnWidth:60,bodyCellPadding:"8px 12px",headerCellPadding:"12px 8px 12px 12px",headerHeight:64,paginationMinHeight:104,paginationPadding:"32px 40px 40px",pinnedActionShadow:"-4px 0 6px rgba(50, 50, 47, 0.06)",rowHeight:64};export{i as MRT_GRID_HUB_LAYOUT};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foodpilot/foods",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.20.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/main.js",
|
|
7
7
|
"module": "./dist/main.js",
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
"@mui/x-tree-view": "^7.0.0",
|
|
220
220
|
"i18next": "^23.0.0 || ^25.0.0",
|
|
221
221
|
"lodash": "^4.18.1",
|
|
222
|
-
"material-react-table": "^2.
|
|
222
|
+
"material-react-table": "^3.2.1",
|
|
223
223
|
"react": "^18.0.0 || ^19.0.0",
|
|
224
224
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
225
225
|
"react-i18next": "^16.5.4",
|