Files
maptology/web-angular/src/app/widgets/decision-panel.component.ts
T
handte d78cebfbc0
LocationBasedServices/maptology/master This commit looks good
Fix all ng linting errors.
2019-07-28 10:32:58 +02:00

41 lines
1.1 KiB
TypeScript

import { Component, Input, Output, EventEmitter, ViewChild, ElementRef, DoCheck } from '@angular/core';
import { ResourceService } from '../services/resource.service';
@Component({
selector: 'app-decision-panel',
templateUrl: 'decision-panel.component.html'
})
export class DecisionPanelComponent implements DoCheck {
@ViewChild('panel', { read: ElementRef, static: true }) panel: ElementRef;
@Input() positiveName: string;
@Input() negativeName: string;
@Input() positiveIcon = 'done';
@Input() negativeIcon = 'close';
@Input() processing = false;
@Input() disabled = false;
@Output() positive: EventEmitter<any> = new EventEmitter();
@Output() negative: EventEmitter<any> = new EventEmitter();
compact = false;
constructor(public res: ResourceService) {
this.positiveName = res.strings('button_ok');
this.negativeName = res.strings('button_cancel');
}
onPositive() {
this.positive.emit();
}
onNegative() {
this.negative.emit();
}
ngDoCheck() {
const width = this.panel.nativeElement.clientWidth;
this.compact = (width < 250);
}
}