import { Component , Input , OnInit , OnDestroy , ViewEncapsulation } from '@angular/core' ; import { ContentActionRef } from '@alfresco/adf-extensions' ; import { takeUntil } from 'rxjs/operators' ; import { Subject } from 'rxjs' ; import { AppExtensionService } from '@alfresco/aca-shared' ; @ Component ( { selector : 'app-create-menu' , templateUrl : './create-menu.component.html' , styleUrls : [ './create-menu.component.scss' ] , encapsulation : ViewEncapsulation . None , host : { class : 'app-create-menu' } } ) export class CreateMenuComponent implements OnInit , OnDestroy { createActions : Array < ContentActionRef > = [ ] ; onDestroy$ : Subject < boolean > = new Subject < boolean > ( ) ; isMainActionPresent : boolean ; @ Input ( ) showLabel : boolean ; @ Input ( ) expanded : boolean ; constructor ( private extensions ) { } ngOnInit ( ) { this . extensions . getCreateActions ( ) . pipe ( takeUntil ( this . onDestroy$ ) ) . subscribe ( ( createActions ) => { this . createActions = createActions ; } ) ; this . extensions . getMainAction ( ) . pipe ( takeUntil ( this . onDestroy$ ) ) . subscribe ( ( mainAction ) => { this . isMainActionPresent = ! ! mainAction ; } ) ; } ngOnDestroy ( ) { this . onDestroy$ . next ( true ) ; this . onDestroy$ . complete ( ) ; } trackByActionId ( _ , obj ) { return obj . id ; } }