keevo-components 1.5.150 → 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,9 +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
|
-
console.log("rootRoute", rootRoute);
|
|
3121
|
-
this.breadCrumbItems = this.getBreadcrumbs(
|
|
3119
|
+
// const rootRoute = this.route.root;
|
|
3120
|
+
// console.log("rootRoute", rootRoute);
|
|
3121
|
+
this.breadCrumbItems = this.getBreadcrumbs(event.url);
|
|
3122
3122
|
console.log("breadCrumbItems ->", this.breadCrumbItems);
|
|
3123
3123
|
}
|
|
3124
3124
|
});
|
|
@@ -3138,24 +3138,36 @@ class MenuComponent {
|
|
|
3138
3138
|
if (licenca != undefined)
|
|
3139
3139
|
this.licencaSelected = licenca;
|
|
3140
3140
|
}
|
|
3141
|
-
getBreadcrumbs(route, url = '', breadcrumbs = []) {
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
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) {
|
|
3145
3163
|
return breadcrumbs;
|
|
3146
3164
|
}
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
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);
|
|
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 });
|
|
3157
3170
|
}
|
|
3158
|
-
console.log("BREADCRUMBS ->", breadcrumbs);
|
|
3159
3171
|
return breadcrumbs;
|
|
3160
3172
|
}
|
|
3161
3173
|
closeCallback(e) {
|