k15t-aui-ng2
Version:
aui-ng2 is a set of angular 2 components, directives and services to simplify the integration with Atlassian products based on AUI/ADG. The library is still under development and is considered in an experimental state. So be aware that things will change
68 lines (53 loc) • 1.89 kB
text/typescript
import {Component, Input, Output, EventEmitter, HostListener} from '@angular/core';
import {AuiNgDialogUpdateEvent} from './dialog-update.event';
export class AuiNgDialogComponent {
title: string;
dialogClass: string;
dialogContentClass: string;
dialogStyle: string;
dialogContentStyle: string;
showXIcon: string = 'true';
showBlanket: string = 'true';
dialogClosed: EventEmitter<Event> = new EventEmitter<Event>(false);
onDialogClose($event: Event) {
$event.preventDefault();
this.dialogClosed.emit($event);
}
onKeydown(event: KeyboardEvent) {
// close on keydown escape
if (event.keyCode === 27) {
this.onDialogClose(event);
}
}
onDialogUpdate($event: CustomEvent) {
this.updateDialog($event.detail);
if ($event.detail.toAll !== undefined && !$event.detail.toAll) {
$event.preventDefault();
}
}
updateDialog(update: AuiNgDialogUpdateEvent) {
if (update.title) {
this.title = update.title;
}
if (update.showXIcon !== undefined) {
this.showXIcon = update.showXIcon.toString();
}
if (update.dialogClass) {
this.dialogClass = update.dialogClass;
}
if (update.dialogContentClass) {
this.dialogContentClass = update.dialogContentClass;
}
if (update.dialogContentStyle) {
this.dialogContentStyle = update.dialogContentStyle;
}
if (update.dialogStyle) {
this.dialogStyle = update.dialogStyle;
}
}
}