@pdg/react-admin-layout 1.0.11 → 1.0.12

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/index.js CHANGED
@@ -50,7 +50,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
50
50
  var notEmpty = function (v) {
51
51
  return !empty(v);
52
52
  };var SideMenuListItem = function (_a) {
53
- var info = _a.info, onClick = _a.onClick;
53
+ var info = _a.info, badgeVariant = _a.badgeVariant, onClick = _a.onClick;
54
54
  var theme = material.useTheme();
55
55
  var location = reactRouterDom.useLocation();
56
56
  // -------------------------------------------------------------------------------------------------------------------
@@ -141,15 +141,16 @@ var notEmpty = function (v) {
141
141
  onClick(info);
142
142
  }, selected: isExpandable ? false : info.uri === location.pathname, style: containerStyle },
143
143
  React.createElement(material.ListItemIcon, { sx: { minWidth: 30 } }, icon && React.createElement(material.Icon, { fontSize: 'small' }, icon)),
144
- React.createElement(material.ListItemText, { primaryTypographyProps: primaryTypographyProps }, info.name),
144
+ React.createElement(material.ListItemText, { primaryTypographyProps: primaryTypographyProps }, info.badge ? (React.createElement(material.Badge, { badgeContent: info.badge, color: 'error', variant: badgeVariant !== undefined ? badgeVariant : info.badgeVariant, anchorOrigin: { horizontal: 'left', vertical: 'top' }, slotProps: { badge: { style: { left: '100%', top: '50%', transform: 'translate(10px, -50%)' } } } },
145
+ React.createElement("div", null, info.name))) : (info.name)),
145
146
  isExpandable && React.createElement(iconsMaterial.ExpandMore, { sx: expandIconSx })),
146
147
  React.createElement(material.Collapse, { in: isExpand, style: collapseStyle }, isExpandable &&
147
148
  info.items &&
148
- info.items.map(function (subInfo, idx) { return React.createElement(SideMenuListItem, { key: idx, info: subInfo, onClick: onClick }); }))));
149
+ info.items.map(function (subInfo, idx) { return (React.createElement(SideMenuListItem, { key: idx, badgeVariant: badgeVariant, info: subInfo, onClick: onClick })); }))));
149
150
  };var StyledList = material.styled(material.List)(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n padding: 0;\n"], ["\n padding: 0;\n"])));
150
151
  var templateObject_1$3;var SideMenuList = function (_a) {
151
- var list = _a.list, onClick = _a.onClick;
152
- return (React.createElement(StyledList, null, list.map(function (info, idx) { return (React.createElement(SideMenuListItem, { key: idx, info: info, onClick: onClick })); })));
152
+ var list = _a.list, badgeVariant = _a.badgeVariant, onClick = _a.onClick;
153
+ return (React.createElement(StyledList, null, list.map(function (info, idx) { return (React.createElement(SideMenuListItem, { key: idx, info: info, badgeVariant: badgeVariant, onClick: onClick })); })));
153
154
  };/** Detect free variable `global` from Node.js. */
154
155
  var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
155
156
 
@@ -1743,11 +1744,11 @@ var templateObject_1$2;function styleInject(css, ref) {
1743
1744
  }
1744
1745
  }var css_248z = "[data-simplebar]{position:relative;flex-direction:column;flex-wrap:wrap;justify-content:flex-start;align-content:flex-start;align-items:flex-start}.simplebar-wrapper{overflow:hidden;width:inherit;height:inherit;max-width:inherit;max-height:inherit}.simplebar-mask{direction:inherit;position:absolute;overflow:hidden;padding:0;margin:0;left:0;top:0;bottom:0;right:0;width:auto!important;height:auto!important;z-index:0}.simplebar-offset{direction:inherit!important;box-sizing:inherit!important;resize:none!important;position:absolute;top:0;left:0;bottom:0;right:0;padding:0;margin:0;-webkit-overflow-scrolling:touch}.simplebar-content-wrapper{direction:inherit;box-sizing:border-box!important;position:relative;display:block;height:100%;width:auto;max-width:100%;max-height:100%;overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.simplebar-content-wrapper::-webkit-scrollbar,.simplebar-hide-scrollbar::-webkit-scrollbar{display:none;width:0;height:0}.simplebar-content:after,.simplebar-content:before{content:' ';display:table}.simplebar-placeholder{max-height:100%;max-width:100%;width:100%;pointer-events:none}.simplebar-height-auto-observer-wrapper{box-sizing:inherit!important;height:100%;width:100%;max-width:1px;position:relative;float:left;max-height:1px;overflow:hidden;z-index:-1;padding:0;margin:0;pointer-events:none;flex-grow:inherit;flex-shrink:0;flex-basis:0}.simplebar-height-auto-observer{box-sizing:inherit;display:block;opacity:0;position:absolute;top:0;left:0;height:1000%;width:1000%;min-height:1px;min-width:1px;overflow:hidden;pointer-events:none;z-index:-1}.simplebar-track{z-index:1;position:absolute;right:0;bottom:0;pointer-events:none;overflow:hidden}[data-simplebar].simplebar-dragging{pointer-events:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}[data-simplebar].simplebar-dragging .simplebar-content{pointer-events:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}[data-simplebar].simplebar-dragging .simplebar-track{pointer-events:all}.simplebar-scrollbar{position:absolute;left:0;right:0;min-height:10px}.simplebar-scrollbar:before{position:absolute;content:'';background:#000;border-radius:7px;left:2px;right:2px;opacity:0;transition:opacity .2s .5s linear}.simplebar-scrollbar.simplebar-visible:before{opacity:.5;transition-delay:0s;transition-duration:0s}.simplebar-track.simplebar-vertical{top:0;width:11px}.simplebar-scrollbar:before{top:2px;bottom:2px;left:2px;right:2px}.simplebar-track.simplebar-horizontal{left:0;height:11px}.simplebar-track.simplebar-horizontal .simplebar-scrollbar{right:auto;left:0;top:0;bottom:0;min-height:0;min-width:10px;width:auto}[data-simplebar-direction=rtl] .simplebar-track.simplebar-vertical{right:auto;left:0}.simplebar-dummy-scrollbar-size{direction:rtl;position:fixed;opacity:0;visibility:hidden;height:500px;width:500px;overflow-y:hidden;overflow-x:scroll;-ms-overflow-style:scrollbar!important}.simplebar-dummy-scrollbar-size>div{width:200%;height:200%;margin:10px 0}.simplebar-hide-scrollbar{position:fixed;left:0;visibility:hidden;overflow-y:scroll;scrollbar-width:none;-ms-overflow-style:none}\n";
1745
1746
  styleInject(css_248z);var SideMenu = function (_a) {
1746
- var logo = _a.logo, list = _a.list, onClick = _a.onClick;
1747
+ var logo = _a.logo, badgeVariant = _a.badgeVariant, list = _a.list, onClick = _a.onClick;
1747
1748
  return (React.createElement(StyledSimpleBar, null,
1748
1749
  React.createElement(StyledLogoContainerBox, null,
1749
1750
  React.createElement(material.Toolbar, null, logo)),
1750
- list && React.createElement(SideMenuList, { list: list, onClick: onClick })));
1751
+ list && React.createElement(SideMenuList, { badgeVariant: badgeVariant, list: list, onClick: onClick })));
1751
1752
  };var StyledContainerBox$1 = material.styled(material.Box)(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n position: relative;\n"], ["\n position: relative;\n"])));
1752
1753
  var StyledHeadContainerBox = material.styled(material.Box)(function (_a) {
1753
1754
  var theme = _a.theme;
@@ -1830,7 +1831,7 @@ var _getNextScreen = function (screen) {
1830
1831
  };
1831
1832
  var DefaultLayout = function (_a) {
1832
1833
  // -------------------------------------------------------------------------------------------------------------------
1833
- var children = _a.children, logo = _a.logo, menu = _a.menu, initMenuHideScreen = _a.menuHideScreen, appBarControl = _a.appBarControl, onMenuClick = _a.onMenuClick;
1834
+ var children = _a.children, logo = _a.logo, badgeVariant = _a.badgeVariant, menu = _a.menu, initMenuHideScreen = _a.menuHideScreen, appBarControl = _a.appBarControl, onMenuClick = _a.onMenuClick;
1834
1835
  var location = reactRouterDom.useLocation();
1835
1836
  // -------------------------------------------------------------------------------------------------------------------
1836
1837
  var _b = React.useState(false), isMobileOpen = _b[0], setIsMobileOpen = _b[1];
@@ -1938,12 +1939,12 @@ var DefaultLayout = function (_a) {
1938
1939
  React.createElement(StyledSideMenuContainerBox, { component: 'nav', "aria-label": 'mailbox folders', sx: sideMenuContainerBoxSx },
1939
1940
  React.createElement(StyledSideMenuTemporaryDrawer, { variant: 'temporary', open: isMobileOpen, onClose: toggleIsMobileOpen, sx: sideMenuTemporaryDrawerSx, ModalProps: {
1940
1941
  keepMounted: true, // Better open performance on mobile.
1941
- } }, menu && (React.createElement(SideMenu, { logo: logo, list: menu, onClick: function (menuItem) {
1942
+ } }, menu && (React.createElement(SideMenu, { logo: logo, badgeVariant: badgeVariant, list: menu, onClick: function (menuItem) {
1942
1943
  toggleIsMobileOpen();
1943
1944
  if (onMenuClick)
1944
1945
  onMenuClick(menuItem);
1945
1946
  } }))),
1946
- React.createElement(StyledSideMenuPermanentDrawer, { variant: 'permanent', open: true, sx: sideMenuPermanentDrawerSx }, menu && React.createElement(SideMenu, { logo: logo, list: menu, onClick: onMenuClick }))),
1947
+ React.createElement(StyledSideMenuPermanentDrawer, { variant: 'permanent', open: true, sx: sideMenuPermanentDrawerSx }, menu && React.createElement(SideMenu, { logo: logo, badgeVariant: badgeVariant, list: menu, onClick: onMenuClick }))),
1947
1948
  React.createElement(StyledMainBox, { component: 'main', sx: mainBoxSx },
1948
1949
  React.createElement(material.Toolbar, null),
1949
1950
  React.createElement(StyledMainContentDiv, null, children))));