|
|
|
@ -5,7 +5,7 @@ |
|
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
|
|
|
*/ |
|
|
|
|
|
|
|
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; |
|
|
|
import { Component, EventEmitter, Input, Output } from '@angular/core'; |
|
|
|
|
|
|
|
import { |
|
|
|
RoleDto, |
|
|
|
@ -18,7 +18,7 @@ import { |
|
|
|
styleUrls: ['./workflow-transition.component.scss'], |
|
|
|
templateUrl: './workflow-transition.component.html' |
|
|
|
}) |
|
|
|
export class WorkflowTransitionComponent implements OnChanges { |
|
|
|
export class WorkflowTransitionComponent { |
|
|
|
@Input() |
|
|
|
public transition: WorkflowTransitionView; |
|
|
|
|
|
|
|
@ -31,50 +31,14 @@ export class WorkflowTransitionComponent implements OnChanges { |
|
|
|
@Output() |
|
|
|
public remove = new EventEmitter(); |
|
|
|
|
|
|
|
public elementsActive: { [name: string]: boolean } = {}; |
|
|
|
public elementsFocused: { [name: string]: boolean } = {}; |
|
|
|
public elementsValid: { [name: string]: boolean } = {}; |
|
|
|
|
|
|
|
public onBlur = { updateOn: 'blur' }; |
|
|
|
|
|
|
|
public ngOnChanges(changes: SimpleChanges) { |
|
|
|
if (changes['transition']) { |
|
|
|
if (this.transition.expression) { |
|
|
|
this.elementsValid['expression'] = true; |
|
|
|
this.elementsActive['expression'] = true; |
|
|
|
} |
|
|
|
|
|
|
|
if (this.transition.role) { |
|
|
|
this.elementsValid['role'] = true; |
|
|
|
this.elementsActive['role'] = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public changeExpression(expression: string) { |
|
|
|
this.update.emit({ expression }); |
|
|
|
} |
|
|
|
|
|
|
|
public changeRole(role: string) { |
|
|
|
this.update.emit({ role }); |
|
|
|
} |
|
|
|
|
|
|
|
public showElement(name: string) { |
|
|
|
this.elementsActive[name] = true; |
|
|
|
} |
|
|
|
|
|
|
|
public focusElement(name: string) { |
|
|
|
this.elementsFocused[name] = true; |
|
|
|
} |
|
|
|
|
|
|
|
public blurElement(name: string) { |
|
|
|
this.elementsFocused[name] = false; |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
if (!this.elementsFocused[name] && !this.elementsValid[name]) { |
|
|
|
this.elementsActive[name] = false; |
|
|
|
} |
|
|
|
}, 2000); |
|
|
|
this.update.emit({ role: role || '' }); |
|
|
|
} |
|
|
|
|
|
|
|
public trackByRole(index: number, role: RoleDto) { |
|
|
|
|