mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-27 04:03:00 +02:00
f4219bada9
original implementation from ef20ee1882
(https://github.com/bitwarden/clients/pull/3762)
40 lines
916 B
TypeScript
40 lines
916 B
TypeScript
import { Component, ContentChildren, Input, QueryList } from "@angular/core";
|
|
|
|
import { BreadcrumbComponent } from "./breadcrumb.component";
|
|
|
|
@Component({
|
|
selector: "bit-breadcrumbs",
|
|
templateUrl: "./breadcrumbs.component.html",
|
|
})
|
|
export class BreadcrumbsComponent {
|
|
@Input()
|
|
show = 3;
|
|
|
|
private breadcrumbs: BreadcrumbComponent[] = [];
|
|
|
|
@ContentChildren(BreadcrumbComponent)
|
|
protected set breadcrumbList(value: QueryList<BreadcrumbComponent>) {
|
|
this.breadcrumbs = value.toArray();
|
|
}
|
|
|
|
protected get beforeOverflow() {
|
|
if (this.hasOverflow) {
|
|
return this.breadcrumbs.slice(0, this.show - 1);
|
|
}
|
|
|
|
return this.breadcrumbs;
|
|
}
|
|
|
|
protected get overflow() {
|
|
return this.breadcrumbs.slice(this.show - 1, -1);
|
|
}
|
|
|
|
protected get afterOverflow() {
|
|
return this.breadcrumbs.slice(-1);
|
|
}
|
|
|
|
protected get hasOverflow() {
|
|
return this.breadcrumbs.length > this.show;
|
|
}
|
|
}
|