import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output } from '@angular/core'; declare var CONFIG: any; @Component({ selector: 'esp-grid-icons-component', templateUrl: './grid-icons.component.html', styleUrls: ['./grid-icons.component.scss'] }) export class GridIconsComponent implements OnInit { @Input() legendsConfig: any; @Input() gridIcons: any; @Input() i18n: any; @Output() gridIconClickEvent: EventEmitter = new EventEmitter(); assetsUrl: string = CONFIG.BASE_URL; isLegend = false; constructor(private eRef: ElementRef) {} @HostListener('document:click', ['$event']) onMenuDeselect(event) { if (!this.eRef.nativeElement.contains(event.target) && this.isLegend) { this.isLegend = false; } } ngOnInit(): void { } onClick(event) { if(event.name === "legends" || event === "legends") { this.isLegend = !this.isLegend; return; } this.gridIconClickEvent.emit(event); } }