mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[AAE-4569] Added readOnly property to breadcrumb components (#6636)
* [AAE-4569] Added readOnly property to breadcrumb components * [AAE-4569] Add method for testing if an anchor element should be used * [AAE-4569] Add missing return type * [AAE-4569] Add unit test
This commit is contained in:
@@ -92,6 +92,10 @@ export class BreadcrumbComponent implements OnInit, OnChanges, OnDestroy {
|
||||
return !!this.root;
|
||||
}
|
||||
|
||||
/** If true, prevents the user from navigating away from the active node. */
|
||||
@Input()
|
||||
readOnly: boolean = false;
|
||||
|
||||
/** Emitted when the user clicks on a breadcrumb. */
|
||||
@Output()
|
||||
navigate = new EventEmitter<PathElementEntity>();
|
||||
@@ -178,12 +182,16 @@ export class BreadcrumbComponent implements OnInit, OnChanges, OnDestroy {
|
||||
return position;
|
||||
}
|
||||
|
||||
breadcrumbItemIsAnchor(lastItem): boolean {
|
||||
return !this.readOnly && !lastItem;
|
||||
}
|
||||
|
||||
onRoutePathClick(route: PathElementEntity, event?: Event): void {
|
||||
if (event && event.type === 'click') {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (route) {
|
||||
if (route && !this.readOnly) {
|
||||
this.navigate.emit(route);
|
||||
|
||||
if (this.target) {
|
||||
|
Reference in New Issue
Block a user