fix: ui break when press tab key in keymap short name control (#816)

This commit is contained in:
Róbert Kiss
2018-10-07 23:21:25 +02:00
committed by László Monda
parent 404ccc7b2b
commit 2cbfc6a11e
2 changed files with 18 additions and 16 deletions
@@ -1,5 +1,8 @@
<div class="pull-right"> <div class="pull-right">
<div class="alert alert-warning alert-dismissible" role="alert" [@slideInOut]="slideInOut"> <div *ngIf="text"
[@slideInOut]
class="alert alert-warning alert-dismissible"
role="alert">
<button type="button" <button type="button"
class="close" class="close"
aria-label="Close" aria-label="Close"
@@ -1,5 +1,5 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import { animate, state, style, transition, trigger } from '@angular/animations'; import { animate, style, transition, trigger } from '@angular/animations';
import { Notification } from 'uhk-common'; import { Notification } from 'uhk-common';
@@ -9,16 +9,17 @@ import { Notification } from 'uhk-common';
styleUrls: ['./undoable-notifier.component.scss'], styleUrls: ['./undoable-notifier.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
animations: [ animations: [
trigger('slideInOut', [ trigger(
state('in', style({ 'slideInOut', [
transform: 'translate3d(0, 0, 0)' transition(':enter', [
})), style({transform: 'translateX(100%)'}),
state('out', style({ animate('400ms ease-in-out', style({transform: 'translateX(0)'}))
transform: 'translate3d(200%, 0, 0)' ]),
})), transition(':leave', [
transition('in => out', animate('400ms ease-in-out')), style({transform: 'translateX(0)'}),
transition('out => in', animate('400ms ease-in-out')) animate('400ms ease-in-out', style({transform: 'translateX(100%)'}))
]) ])
])
] ]
}) })
export class UndoableNotifierComponent implements OnChanges { export class UndoableNotifierComponent implements OnChanges {
@@ -28,16 +29,14 @@ export class UndoableNotifierComponent implements OnChanges {
@Output() close = new EventEmitter(); @Output() close = new EventEmitter();
@Output() undo = new EventEmitter(); @Output() undo = new EventEmitter();
get slideInOut() {
return this.notification ? 'in' : 'out';
}
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
if (changes['notification']) { if (changes['notification']) {
const not: Notification = changes['notification'].currentValue; const not: Notification = changes['notification'].currentValue;
if (not) { if (not) {
this.text = not.message; this.text = not.message;
this.undoable = !!not.extra; this.undoable = !!not.extra;
} else {
this.text = null;
} }
} }
} }