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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1x 1x 1x 1x 6x 6x 6x 6x 12x 17x | import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
import { Observable } from 'rxjs';
import { CMSFacade } from 'ish-core/facades/cms.facade';
import { ContentPageTreeView } from 'ish-core/models/content-page-tree-view/content-page-tree-view.model';
import { ContentPageletView } from 'ish-core/models/content-view/content-view.model';
import { CMSComponent } from 'ish-shared/cms/models/cms-component/cms-component.model';
@Component({
selector: 'ish-cms-navigation-page',
templateUrl: './cms-navigation-page.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CMSNavigationPageComponent implements CMSComponent, OnChanges {
@Input({ required: true }) pagelet: ContentPageletView;
pageTree$: Observable<ContentPageTreeView>;
private openedPages: string[] = [];
constructor(private cmsFacade: CMSFacade) {}
ngOnChanges(): void {
if (this.pagelet?.hasParam('Page')) {
this.pageTree$ = this.cmsFacade.completeContentPageTree$(
this.pagelet.stringParam('Page'),
this.pagelet.numberParam('SubNavigationDepth', 0)
);
}
}
showSubMenu(childCount: number) {
return (this.pagelet.hasParam('SubNavigationDepth') &&
this.pagelet.numberParam('SubNavigationDepth') > 0 &&
childCount) ||
this.pagelet.hasParam('SubNavigationHTML')
? true
: false;
}
subMenuShow(subMenu: HTMLElement) {
subMenu.classList.add('hover');
}
subMenuHide(subMenu: HTMLElement) {
subMenu.classList.remove('hover');
}
/**
* Indicate if specific content page is expanded.
*/
isOpened(uniqueId: string): boolean {
return this.openedPages.includes(uniqueId);
}
/**
* Toggle content page open state.
*/
toggleOpen(uniqueId: string) {
const index = this.openedPages.findIndex(id => id === uniqueId);
index > -1 ? this.openedPages.splice(index, 1) : this.openedPages.push(uniqueId);
}
}
|