@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.js
CHANGED
|
@@ -1090,7 +1090,7 @@ function samePage(pathname, url) {
|
|
|
1090
1090
|
const strip = (p) => (p.length > 1 ? p.replace(/\/+$/, "") : p);
|
|
1091
1091
|
return strip(pathname) === strip(url);
|
|
1092
1092
|
}
|
|
1093
|
-
function NavMain({ items, orgCode, closeOnNavigation = false, approvalCounts, chrome = "brand", }) {
|
|
1093
|
+
function NavMain({ items, orgCode, closeOnNavigation = false, approvalCounts, chrome = "brand", highlightActiveModule = false, }) {
|
|
1094
1094
|
const workspace = chrome === "workspace";
|
|
1095
1095
|
const params = navigation.useParams();
|
|
1096
1096
|
const pathname = navigation.usePathname();
|
|
@@ -1122,8 +1122,9 @@ function NavMain({ items, orgCode, closeOnNavigation = false, approvalCounts, ch
|
|
|
1122
1122
|
isPathActive(pathname, subPage.url)));
|
|
1123
1123
|
// Parent only active when path matches its URL exactly AND no child
|
|
1124
1124
|
// is active (so parent+child don't both light up).
|
|
1125
|
-
const isItemActive = (
|
|
1126
|
-
|
|
1125
|
+
const isItemActive = (highlightActiveModule && !item.subModules?.length && !!item.isActive) ||
|
|
1126
|
+
((workspace ? samePage(pathname, itemUrl) : pathname === itemUrl) &&
|
|
1127
|
+
!hasActiveSubItem);
|
|
1127
1128
|
return { itemUrl, activeSubItemUrl, hasActiveSubItem, isItemActive };
|
|
1128
1129
|
});
|
|
1129
1130
|
// A group opens when its page becomes current and otherwise stays as the
|
|
@@ -1282,7 +1283,7 @@ function SidebarHeader({ children, className }) {
|
|
|
1282
1283
|
return jsxRuntime.jsx("div", { className: erpTheme.cn("px-2 py-3", className), children: children });
|
|
1283
1284
|
}
|
|
1284
1285
|
|
|
1285
|
-
function AppSidebar({ modules, tools, activeModule, orgCode, approvalCounts, closeOnNavigation = false, header, footer, bottom, chrome = "brand", className, }) {
|
|
1286
|
+
function AppSidebar({ modules, tools, activeModule, orgCode, approvalCounts, closeOnNavigation = false, highlightActiveModule = false, header, footer, bottom, chrome = "brand", className, }) {
|
|
1286
1287
|
const { open } = useSidebar();
|
|
1287
1288
|
const modulesWithActiveState = React__namespace.useMemo(() => modules.map(m => ({
|
|
1288
1289
|
...m,
|
|
@@ -1293,7 +1294,7 @@ function AppSidebar({ modules, tools, activeModule, orgCode, approvalCounts, clo
|
|
|
1293
1294
|
if (chrome === "workspace") {
|
|
1294
1295
|
return (jsxRuntime.jsxs("div", { className: erpTheme.cn("flex h-screen w-[244px] shrink-0 flex-col overflow-hidden border-r border-sidebar-border bg-sidebar text-sidebar-foreground",
|
|
1295
1296
|
// As a drawer (≤1024px) it floats over the page and needs the lift.
|
|
1296
|
-
"max-[1024px]:shadow-2xl", className), children: [header ? jsxRuntime.jsx("div", { className: "shrink-0 px-[18px] pt-8 pb-6", children: header }) : null, jsxRuntime.jsxs(SidebarContent, { className: "flex-1 overflow-y-auto px-[18px]", children: [jsxRuntime.jsx(NavMain, { items: modulesWithActiveState, orgCode: orgCode, approvalCounts: approvalCounts, closeOnNavigation: closeOnNavigation, chrome: "workspace" }), jsxRuntime.jsx(NavTools, { tools: tools, closeOnNavigation: closeOnNavigation })] }), bottom ? jsxRuntime.jsx("div", { className: "shrink-0 px-[18px] pt-6", children: bottom }) : null, jsxRuntime.jsx("div", { className: "shrink-0 px-[18px] pb-3", children: footer })] }));
|
|
1297
|
+
"max-[1024px]:shadow-2xl", className), children: [header ? jsxRuntime.jsx("div", { className: "shrink-0 px-[18px] pt-8 pb-6", children: header }) : null, jsxRuntime.jsxs(SidebarContent, { className: "flex-1 overflow-y-auto px-[18px]", children: [jsxRuntime.jsx(NavMain, { items: modulesWithActiveState, orgCode: orgCode, approvalCounts: approvalCounts, closeOnNavigation: closeOnNavigation, chrome: "workspace", highlightActiveModule: highlightActiveModule }), jsxRuntime.jsx(NavTools, { tools: tools, closeOnNavigation: closeOnNavigation })] }), bottom ? jsxRuntime.jsx("div", { className: "shrink-0 px-[18px] pt-6", children: bottom }) : null, jsxRuntime.jsx("div", { className: "shrink-0 px-[18px] pb-3", children: footer })] }));
|
|
1297
1298
|
}
|
|
1298
1299
|
return (jsxRuntime.jsxs("div", { className: erpTheme.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: [jsxRuntime.jsx(SidebarHeader, { children: header }), jsxRuntime.jsxs(SidebarContent, { className: "pl-2 pr-2 flex-1 overflow-y-auto", children: [jsxRuntime.jsx(NavMain, { items: modulesWithActiveState, orgCode: orgCode, approvalCounts: approvalCounts, closeOnNavigation: closeOnNavigation }), jsxRuntime.jsx(NavTools, { tools: tools, closeOnNavigation: closeOnNavigation })] }), jsxRuntime.jsx(SidebarFooter, { className: "pl-2 pr-2", children: footer })] }));
|
|
1299
1300
|
}
|