import { Component , Input , ViewEncapsulation } from '@angular/core' ; import { ContentActionRef } from '@alfresco/adf-extensions' ; import { AppExtensionService } from '../../../services/app.extension.service' ; import { ThemePalette } from '@angular/material/core' ; export enum ToolbarButtonType { ICON_BUTTON = 'icon-button' , MENU_ITEM = 'menu-item' } @ Component ( { selector : 'app-toolbar-button' , templateUrl : './toolbar-button.component.html' , encapsulation : ViewEncapsulation . None , host : { class : 'app-toolbar-button' } } ) export class ToolbarButtonComponent { @ Input ( ) type : ToolbarButtonType = ToolbarButtonType . ICON_BUTTON ; @ Input ( ) color : ThemePalette ; @ Input ( ) actionRef : ContentActionRef ; constructor ( private extensions ) { } runAction ( ) { if ( this . hasClickAction ( this . actionRef ) ) { this . extensions . runActionById ( this . actionRef . actions . click ) ; } } private hasClickAction ( actionRef ) { return ! ! ( actionRef && actionRef . actions && actionRef . actions . click ) ; } }