keevo-components 1.5.149 → 1.5.151
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.
|
@@ -3116,8 +3116,9 @@ class MenuComponent {
|
|
|
3116
3116
|
this.router.events.subscribe((event) => {
|
|
3117
3117
|
if (event instanceof NavigationEnd) {
|
|
3118
3118
|
console.log('Evento de navegação:', event);
|
|
3119
|
-
const rootRoute = this.route.root;
|
|
3120
|
-
|
|
3119
|
+
// const rootRoute = this.route.root;
|
|
3120
|
+
// console.log("rootRoute", rootRoute);
|
|
3121
|
+
this.breadCrumbItems = this.getBreadcrumbs(event.url);
|
|
3121
3122
|
console.log("breadCrumbItems ->", this.breadCrumbItems);
|
|
3122
3123
|
}
|
|
3123
3124
|
});
|
|
@@ -3137,24 +3138,36 @@ class MenuComponent {
|
|
|
3137
3138
|
if (licenca != undefined)
|
|
3138
3139
|
this.licencaSelected = licenca;
|
|
3139
3140
|
}
|
|
3140
|
-
getBreadcrumbs(route, url = '', breadcrumbs = []) {
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3141
|
+
// private getBreadcrumbs(route: ActivatedRoute, url: string = '', breadcrumbs: { label: string, routerLink: string }[] = []): { label: string, routerLink: string }[] {
|
|
3142
|
+
// const childrenRoutes = route.children;
|
|
3143
|
+
// console.log("childrenRoutes ->", childrenRoutes)
|
|
3144
|
+
// if (childrenRoutes.length === 0) {
|
|
3145
|
+
// return breadcrumbs;
|
|
3146
|
+
// }
|
|
3147
|
+
// for (const childRoute of childrenRoutes) {
|
|
3148
|
+
// const routeUrl = childRoute.snapshot.url.map(segment => segment.path).join('/');
|
|
3149
|
+
// if (routeUrl !== '') {
|
|
3150
|
+
// url += `/${routeUrl}`;
|
|
3151
|
+
// }
|
|
3152
|
+
// const breadcrumbLabel = childRoute.snapshot.data['breadcrumb'];
|
|
3153
|
+
// if (breadcrumbLabel) {
|
|
3154
|
+
// breadcrumbs.push({ label: breadcrumbLabel, routerLink: url });
|
|
3155
|
+
// }
|
|
3156
|
+
// this.getBreadcrumbs(childRoute, url, breadcrumbs);
|
|
3157
|
+
// }
|
|
3158
|
+
// console.log("BREADCRUMBS ->", breadcrumbs)
|
|
3159
|
+
// return breadcrumbs;
|
|
3160
|
+
// }
|
|
3161
|
+
getBreadcrumbs(url = '', breadcrumbs = []) {
|
|
3162
|
+
if (!url) {
|
|
3144
3163
|
return breadcrumbs;
|
|
3145
3164
|
}
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
}
|
|
3151
|
-
const breadcrumbLabel = childRoute.snapshot.data['breadcrumb'];
|
|
3152
|
-
if (breadcrumbLabel) {
|
|
3153
|
-
breadcrumbs.push({ label: breadcrumbLabel, routerLink: url });
|
|
3154
|
-
}
|
|
3155
|
-
this.getBreadcrumbs(childRoute, url, breadcrumbs);
|
|
3165
|
+
const segments = url.split('/').filter(segment => segment !== ''); // remove segmentos vazios
|
|
3166
|
+
let currentUrl = '';
|
|
3167
|
+
for (const segment of segments) {
|
|
3168
|
+
currentUrl += `/${segment}`;
|
|
3169
|
+
breadcrumbs.push({ label: segment, routerLink: currentUrl });
|
|
3156
3170
|
}
|
|
3157
|
-
console.log("BREADCRUMBS ->", breadcrumbs);
|
|
3158
3171
|
return breadcrumbs;
|
|
3159
3172
|
}
|
|
3160
3173
|
closeCallback(e) {
|