mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
2.6 KiB
101 lines
2.6 KiB
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
|
|
|
|
import {
|
|
WorkflowDto,
|
|
WorkflowStep,
|
|
WorkflowStepValues,
|
|
WorkflowTransition,
|
|
WorkflowTransitionValues,
|
|
WorkflowTransitionView
|
|
} from '@app/shared';
|
|
|
|
@Component({
|
|
selector: 'sqx-workflow-step',
|
|
styleUrls: ['./workflow-step.component.scss'],
|
|
templateUrl: './workflow-step.component.html'
|
|
})
|
|
export class WorkflowStepComponent implements OnChanges {
|
|
public readonly onBlur: { updateOn: 'blur' } = { updateOn: 'blur' };
|
|
|
|
@Output()
|
|
public makeInitial = new EventEmitter();
|
|
|
|
@Output()
|
|
public transitionAdd = new EventEmitter<WorkflowStep>();
|
|
|
|
@Output()
|
|
public transitionRemove = new EventEmitter<WorkflowTransition>();
|
|
|
|
@Output()
|
|
public transitionUpdate = new EventEmitter<{ transition: WorkflowTransition, values: WorkflowTransitionValues }>();
|
|
|
|
@Output()
|
|
public update = new EventEmitter<WorkflowStepValues>();
|
|
|
|
@Output()
|
|
public rename = new EventEmitter<string>();
|
|
|
|
@Output()
|
|
public remove = new EventEmitter();
|
|
|
|
@Input()
|
|
public workflow: WorkflowDto;
|
|
|
|
@Input()
|
|
public step: WorkflowStep;
|
|
|
|
@Input()
|
|
public roles: ReadonlyArray<string>;
|
|
|
|
@Input()
|
|
public disabled: boolean;
|
|
|
|
public openSteps: ReadonlyArray<WorkflowStep>;
|
|
public openStep: WorkflowStep;
|
|
|
|
public transitions: ReadonlyArray<WorkflowTransitionView>;
|
|
|
|
public ngOnChanges(changes: SimpleChanges) {
|
|
if (changes['workflow'] || changes['step'] || false) {
|
|
this.openSteps = this.workflow.getOpenSteps(this.step);
|
|
this.openStep = this.openSteps[0];
|
|
|
|
this.transitions = this.workflow.getTransitions(this.step);
|
|
}
|
|
}
|
|
|
|
public changeTransition(transition: WorkflowTransition, values: WorkflowTransitionValues) {
|
|
this.transitionUpdate.emit({ transition, values });
|
|
}
|
|
|
|
public changeName(name: string) {
|
|
this.rename.emit(name);
|
|
}
|
|
|
|
public changeColor(color: string) {
|
|
this.update.emit({ color });
|
|
}
|
|
|
|
public changeNoUpdate(noUpdate: boolean) {
|
|
this.update.emit({ noUpdate });
|
|
}
|
|
|
|
public changeNoUpdateExpression(noUpdateExpression?: string) {
|
|
this.update.emit({ noUpdateExpression });
|
|
}
|
|
|
|
public changeNoUpdateRoles(noUpdateRoles?: ReadonlyArray<string>) {
|
|
this.update.emit({ noUpdateRoles });
|
|
}
|
|
|
|
public trackByTransition(index: number, transition: WorkflowTransition) {
|
|
return transition.to;
|
|
}
|
|
}
|