ud-components 0.8.10 → 0.8.11
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.
|
@@ -633,16 +633,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
633
633
|
], template: "<nav class=\"sidenav\" [class.collapsed]=\"collapsed()\">\n <a class=\"brand\" [routerLink]=\"brandRoute()\">\n @if (collapsed()) {\n <img [src]=\"logoCollapsed()\" alt=\"UDorm\" class=\"logo-glyph\" />\n } @else {\n <img [src]=\"logo()\" alt=\"UDorm\" class=\"logo-wordmark\" />\n }\n </a>\n <!-- The frame carries the fade, so it stays put while the list scrolls. -->\n <div class=\"sections-frame\" [class.more-below]=\"$moreBelow()\">\n <div class=\"sections\" #sections (scroll)=\"updateMoreBelow()\">\n <div class=\"sections-list\" #sectionsList>\n @for (group of $navGroups(); track group.key) {\n <div class=\"nav-group\">\n <!-- Same height expanded and collapsed, so icons keep their\n place when the drawer toggles. -->\n @if (group.category) {\n @if (collapsed()) {\n <div class=\"divider\" aria-hidden=\"true\"></div>\n } @else {\n <p class=\"category\">\n {{ group.category | toObservable | async }}\n </p>\n }\n }\n @for (child of group.children; track child.route) {\n <ng-container\n *ngTemplateOutlet=\"navItem; context: { $implicit: child }\" />\n }\n </div>\n }\n </div>\n </div>\n </div>\n @if ($footerGroups().length) {\n <div class=\"footer\">\n @for (group of $footerGroups(); track group.key) {\n @for (child of group.children; track child.route) {\n <ng-container\n *ngTemplateOutlet=\"navItem; context: { $implicit: child }\" />\n }\n }\n </div>\n }\n</nav>\n\n<ng-template #navItem let-child>\n @let label = child.label | toObservable | async | capitalize;\n <a\n class=\"nav-item\"\n [routerLink]=\"child.route\"\n [class.active]=\"child.route === $activeRoute()\"\n [attr.aria-current]=\"child.route === $activeRoute() ? 'page' : null\"\n [attr.aria-label]=\"collapsed() ? label : null\"\n udTooltipPosition=\"right\"\n [udTooltip]=\"collapsed() ? (label ?? '') : ''\">\n <mat-icon fontSet=\"material-icons-outlined\" aria-hidden=\"true\">\n {{ child.icon }}\n </mat-icon>\n @if (!collapsed()) {\n <span class=\"label\">{{ label }}</span>\n }\n @if (child.badge) {\n <span class=\"count\">{{ child.badge }}</span>\n }\n </a>\n</ng-template>\n", styles: [":host{display:block;height:100%}.sidenav{display:flex;flex-direction:column;height:100%;background:var(--primary-color);font-family:Sora,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.sections-frame{position:relative;flex:1;min-height:0;display:flex;flex-direction:column}.sections-frame:after{content:\"\";position:absolute;inset:auto 0 0;height:40px;background:linear-gradient(transparent,var(--primary-color));pointer-events:none;opacity:0;transition:opacity .15s ease}.sections-frame.more-below:after{opacity:1}.sections{flex:1;min-height:0;padding:4px 8px 8px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.2) transparent}.sections::-webkit-scrollbar{width:6px}.sections::-webkit-scrollbar-thumb{background:#fff3;border-radius:3px}.sections-list{display:flex;flex-direction:column;gap:12px}.footer{flex:none;padding:6px 8px;border-top:1px solid rgba(255,255,255,.1)}.brand{flex:none;display:flex;align-items:center;height:56px;margin:0 8px;padding-left:10px;border-radius:6px}.brand:focus-visible{outline:2px solid #aeb8ff;outline-offset:-2px}.logo-wordmark{height:24px;width:auto}.logo-glyph{height:28px;width:28px;object-fit:contain}.nav-group{display:flex;flex-direction:column;gap:2px}.category{display:flex;align-items:flex-end;min-height:22px;margin:0;padding:0 10px 6px;font-size:11px;font-weight:600;line-height:1.25;letter-spacing:.08em;text-transform:uppercase;color:#8a93a8}.divider{display:flex;align-items:center;justify-content:center;height:22px}.divider:before{content:\"\";width:20px;height:1px;background:#ffffff1a}.nav-item{position:relative;display:flex;align-items:center;gap:10px;height:30px;padding:0 10px;border-radius:6px;color:#dcdfe8;font-size:13.5px;line-height:1;letter-spacing:0;text-decoration:none;white-space:nowrap;transition:background-color .15s ease}.nav-item mat-icon{flex:none;width:18px;height:18px;font-size:18px;color:#939cb2}.nav-item:hover{background:#ffffff0f;color:#f5f6f7}.nav-item:hover mat-icon{color:#dcdfe8}.nav-item.active{background:#2a3768;color:#fff;font-weight:500}.nav-item.active mat-icon{color:#aeb8ff}.nav-item:focus-visible{outline:2px solid #aeb8ff;outline-offset:-2px}.label{overflow:hidden;text-overflow:ellipsis;line-height:1.35}.count{margin-left:auto;min-width:22px;height:18px;padding:0 5px;border-radius:9px;background:#ef6547;color:#1b2535;font-size:11px;font-weight:600;line-height:18px;text-align:center;font-variant-numeric:tabular-nums}.collapsed .brand{justify-content:center;padding-left:0}.collapsed .nav-item{justify-content:center;padding:0}.collapsed .count{position:absolute;top:-2px;right:3px;min-width:16px;height:15px;padding:0 4px;font-size:9.5px;line-height:15px;box-shadow:0 0 0 2px var(--primary-color)}@media (prefers-reduced-motion: reduce){.nav-item,.sections-frame:after{transition:none}}\n"] }]
|
|
634
634
|
}] });
|
|
635
635
|
/**
|
|
636
|
-
* The nav route to highlight for `url`. An exact match wins;
|
|
637
|
-
*
|
|
638
|
-
* `/
|
|
639
|
-
*
|
|
636
|
+
* The nav route to highlight for `url`. An exact match wins; then the nav
|
|
637
|
+
* route the URL sits under, the longest one, so a section's own pages keep
|
|
638
|
+
* it lit (`/finance/reports/aging` lights `/finance/reports`, not the first
|
|
639
|
+
* `/finance` item). Otherwise the item in the same top-level section, so
|
|
640
|
+
* detail and add pages (`/users/123`, `/users/add-user`) keep their section
|
|
641
|
+
* lit. When a section has several items (`/document-compliance/send` and
|
|
642
|
+
* `/list`), its list page wins.
|
|
640
643
|
*/
|
|
641
644
|
function activeNavRoute(url, routes) {
|
|
642
645
|
const path = url.split(/[?#;]/)[0];
|
|
643
646
|
if (routes.includes(path)) {
|
|
644
647
|
return path;
|
|
645
648
|
}
|
|
649
|
+
const parent = routes
|
|
650
|
+
.filter(route => path.startsWith(route + '/'))
|
|
651
|
+
.sort((x, y) => y.length - x.length)[0];
|
|
652
|
+
if (parent) {
|
|
653
|
+
return parent;
|
|
654
|
+
}
|
|
646
655
|
const section = (route) => route.split('/')[1];
|
|
647
656
|
const inSection = routes.filter(route => section(route) === section(path));
|
|
648
657
|
return inSection.find(route => route.endsWith('/list')) ?? inSection[0];
|