@eintrek/erp-shell 0.1.49 → 0.1.50
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.esm.js
CHANGED
|
@@ -1071,7 +1071,7 @@ function samePage(pathname, url) {
|
|
|
1071
1071
|
const strip = (p) => (p.length > 1 ? p.replace(/\/+$/, "") : p);
|
|
1072
1072
|
return strip(pathname) === strip(url);
|
|
1073
1073
|
}
|
|
1074
|
-
function NavMain({ items, orgCode, closeOnNavigation = false, approvalCounts, chrome = "brand", }) {
|
|
1074
|
+
function NavMain({ items, orgCode, closeOnNavigation = false, approvalCounts, chrome = "brand", highlightActiveModule = false, }) {
|
|
1075
1075
|
const workspace = chrome === "workspace";
|
|
1076
1076
|
const params = useParams();
|
|
1077
1077
|
const pathname = usePathname();
|
|
@@ -1103,8 +1103,9 @@ function NavMain({ items, orgCode, closeOnNavigation = false, approvalCounts, ch
|
|
|
1103
1103
|
isPathActive(pathname, subPage.url)));
|
|
1104
1104
|
// Parent only active when path matches its URL exactly AND no child
|
|
1105
1105
|
// is active (so parent+child don't both light up).
|
|
1106
|
-
const isItemActive = (
|
|
1107
|
-
|
|
1106
|
+
const isItemActive = (highlightActiveModule && !item.subModules?.length && !!item.isActive) ||
|
|
1107
|
+
((workspace ? samePage(pathname, itemUrl) : pathname === itemUrl) &&
|
|
1108
|
+
!hasActiveSubItem);
|
|
1108
1109
|
return { itemUrl, activeSubItemUrl, hasActiveSubItem, isItemActive };
|
|
1109
1110
|
});
|
|
1110
1111
|
// A group opens when its page becomes current and otherwise stays as the
|
|
@@ -1263,7 +1264,7 @@ function SidebarHeader({ children, className }) {
|
|
|
1263
1264
|
return jsx("div", { className: cn("px-2 py-3", className), children: children });
|
|
1264
1265
|
}
|
|
1265
1266
|
|
|
1266
|
-
function AppSidebar({ modules, tools, activeModule, orgCode, approvalCounts, closeOnNavigation = false, header, footer, bottom, chrome = "brand", className, }) {
|
|
1267
|
+
function AppSidebar({ modules, tools, activeModule, orgCode, approvalCounts, closeOnNavigation = false, highlightActiveModule = false, header, footer, bottom, chrome = "brand", className, }) {
|
|
1267
1268
|
const { open } = useSidebar();
|
|
1268
1269
|
const modulesWithActiveState = React.useMemo(() => modules.map(m => ({
|
|
1269
1270
|
...m,
|
|
@@ -1274,7 +1275,7 @@ function AppSidebar({ modules, tools, activeModule, orgCode, approvalCounts, clo
|
|
|
1274
1275
|
if (chrome === "workspace") {
|
|
1275
1276
|
return (jsxs("div", { className: cn("flex h-screen w-[244px] shrink-0 flex-col overflow-hidden border-r border-sidebar-border bg-sidebar text-sidebar-foreground",
|
|
1276
1277
|
// As a drawer (≤1024px) it floats over the page and needs the lift.
|
|
1277
|
-
"max-[1024px]:shadow-2xl", className), children: [header ? jsx("div", { className: "shrink-0 px-[18px] pt-8 pb-6", children: header }) : null, jsxs(SidebarContent, { className: "flex-1 overflow-y-auto px-[18px]", children: [jsx(NavMain, { items: modulesWithActiveState, orgCode: orgCode, approvalCounts: approvalCounts, closeOnNavigation: closeOnNavigation, chrome: "workspace" }), jsx(NavTools, { tools: tools, closeOnNavigation: closeOnNavigation })] }), bottom ? jsx("div", { className: "shrink-0 px-[18px] pt-6", children: bottom }) : null, jsx("div", { className: "shrink-0 px-[18px] pb-3", children: footer })] }));
|
|
1278
|
+
"max-[1024px]:shadow-2xl", className), children: [header ? jsx("div", { className: "shrink-0 px-[18px] pt-8 pb-6", children: header }) : null, jsxs(SidebarContent, { className: "flex-1 overflow-y-auto px-[18px]", children: [jsx(NavMain, { items: modulesWithActiveState, orgCode: orgCode, approvalCounts: approvalCounts, closeOnNavigation: closeOnNavigation, chrome: "workspace", highlightActiveModule: highlightActiveModule }), jsx(NavTools, { tools: tools, closeOnNavigation: closeOnNavigation })] }), bottom ? jsx("div", { className: "shrink-0 px-[18px] pt-6", children: bottom }) : null, jsx("div", { className: "shrink-0 px-[18px] pb-3", children: footer })] }));
|
|
1278
1279
|
}
|
|
1279
1280
|
return (jsxs("div", { className: cn("bg-sidebar shrink-0 flex flex-col overflow-hidden shadow-2xl h-screen w-[var(--sidebar-width-mobile)]", "!w-76 xl:rounded-b-4xl xl:rounded-tl-4xl xl:m-5 xl:h-[calc(100vh-2.5rem)]", className), children: [jsx(SidebarHeader, { children: header }), jsxs(SidebarContent, { className: "pl-2 pr-2 flex-1 overflow-y-auto", children: [jsx(NavMain, { items: modulesWithActiveState, orgCode: orgCode, approvalCounts: approvalCounts, closeOnNavigation: closeOnNavigation }), jsx(NavTools, { tools: tools, closeOnNavigation: closeOnNavigation })] }), jsx(SidebarFooter, { className: "pl-2 pr-2", children: footer })] }));
|
|
1280
1281
|
}
|