Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | 11x 11x 11x 6x 6x 6x 6x 6x | import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { AppFacade } from 'ish-core/facades/app.facade';
import { BreadcrumbItem } from 'ish-core/models/breadcrumb-item/breadcrumb-item.interface';
/**
* component for setting the breadcrumb trail of a specific page
*
* Breadcrumbs can be set in two specific ways:
* - setting the 'breadcrumbData' field as routing data
* - dispatching a setBreadcrumbData action in an effect
*/
@Component({
selector: 'ish-breadcrumb',
standalone: false,
templateUrl: './breadcrumb.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class BreadcrumbComponent implements OnInit {
@Input() separator: string;
@Input() showHome = true;
@Input() account: boolean;
trail$: Observable<BreadcrumbItem[]>;
constructor(private appFacade: AppFacade) {}
ngOnInit() {
this.trail$ = this.appFacade.breadcrumbData$;
}
/**
* Bootstrap divider override. A provided separator (including an empty string to remove the divider)
* sets the '--bs-breadcrumb-divider' custom property; otherwise the Bootstrap default is used.
*/
get dividerStyle(): Record<string, string> {
Eif (typeof this.separator !== 'string') {
return {};
}
// escape backslashes and single quotes so the value stays a valid quoted CSS string
const escaped = this.separator.replace(/\\/g, '\\\\').replace(/'/g, "\\'");
return { '--bs-breadcrumb-divider': `'${escaped}'` };
}
}
|