Skip to content
Snippets Groups Projects
Commit 00fa000b authored by jojohoch's avatar jojohoch
Browse files

[editor] Rename ActionParamStateVariableComponent to generalize its use

- It will be used for trigger element
parent 2db601d3
No related branches found
No related tags found
No related merge requests found
...@@ -40,8 +40,8 @@ import { ...@@ -40,8 +40,8 @@ import {
StateVariableEditorComponent StateVariableEditorComponent
} from 'editor/src/app/components/dialogs/state-variables-dialog/state-variable-editor.component'; } from 'editor/src/app/components/dialogs/state-variables-dialog/state-variable-editor.component';
import { import {
ButtonActionParamStateVariableComponent ActionParamStateVariableComponent
} from 'editor/src/app/components/properties-panel/model-properties-tab/input-groups/button-properties/button-action-param-state-variable.component'; } from 'editor/src/app/components/properties-panel/model-properties-tab/input-groups/action-param-state-variable.component';
import { import {
VisibilityRulesDialogComponent VisibilityRulesDialogComponent
} from 'editor/src/app/components/dialogs/visibility-rules-dialog/visibility-rules-dialog.component'; } from 'editor/src/app/components/dialogs/visibility-rules-dialog/visibility-rules-dialog.component';
...@@ -199,7 +199,7 @@ import { ...@@ -199,7 +199,7 @@ import {
StateVariablesDialogComponent, StateVariablesDialogComponent,
ShowStateVariablesButtonComponent, ShowStateVariablesButtonComponent,
StateVariableEditorComponent, StateVariableEditorComponent,
ButtonActionParamStateVariableComponent, ActionParamStateVariableComponent,
GetStateVariableIdsPipe, GetStateVariableIdsPipe,
VisibilityRulesDialogComponent, VisibilityRulesDialogComponent,
SanitizationDialogComponent, SanitizationDialogComponent,
......
import {
Component, EventEmitter, Input, Output
} from '@angular/core';
import { StateVariable } from 'common/models/state-variable';
@Component({
selector: 'aspect-action-param-state-variable',
template: `
<div class="fx-column-start-stretch">
<mat-form-field>
<mat-label>{{'stateVariableId' | translate}}</mat-label>
<mat-select [(ngModel)]="stateVariable.id"
(ngModelChange)="stateVariableChange.emit(stateVariable)">
<mat-option *ngFor="let id of stateVariableIds"
[value]="id">
{{id}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>{{'stateVariableValue' | translate}}</mat-label>
<input matInput
[(ngModel)]="stateVariable.value"
(ngModelChange)="stateVariableChange.emit(stateVariable)">
</mat-form-field>
</div>
`
})
export class ActionParamStateVariableComponent {
@Input() stateVariable!: StateVariable;
@Input() stateVariableIds!: string[];
@Output() stateVariableChange = new EventEmitter<StateVariable>();
}
<div class="fx-column-start-stretch">
<mat-form-field>
<mat-label>{{'stateVariableId' | translate}}</mat-label>
<mat-select [(ngModel)]="stateVariable.id"
(ngModelChange)="stateVariableChange.emit(stateVariable)">
<mat-option *ngFor="let id of stateVariableIds"
[value]="id">
{{id}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>{{'stateVariableValue' | translate}}</mat-label>
<input matInput
[(ngModel)]="stateVariable.value"
(ngModelChange)="stateVariableChange.emit(stateVariable)">
</mat-form-field>
</div>
import {
Component, EventEmitter, Input, Output
} from '@angular/core';
import { StateVariable } from 'common/models/state-variable';
@Component({
selector: 'aspect-button-action-param-state-variable',
templateUrl: './button-action-param-state-variable.component.html'
})
export class ButtonActionParamStateVariableComponent {
@Input() stateVariable!: StateVariable;
@Input() stateVariableIds!: string[];
@Output() stateVariableChange = new EventEmitter<StateVariable>();
}
...@@ -108,14 +108,14 @@ import { SelectionService } from '../../../../../services/selection.service'; ...@@ -108,14 +108,14 @@ import { SelectionService } from '../../../../../services/selection.service';
</mat-form-field> </mat-form-field>
<ng-container *ngIf="combinedProperties.action === 'stateVariableChange'"> <ng-container *ngIf="combinedProperties.action === 'stateVariableChange'">
<aspect-button-action-param-state-variable <aspect-action-param-state-variable
*ngIf="unitService.unit.stateVariables.length" *ngIf="unitService.unit.stateVariables.length"
[stateVariableIds]="unitService.unit.stateVariables | getStateVariableIds" [stateVariableIds]="unitService.unit.stateVariables | getStateVariableIds"
[stateVariable]="combinedProperties.actionParam ? [stateVariable]="combinedProperties.actionParam ?
$any(combinedProperties.actionParam) : $any(combinedProperties.actionParam) :
{ id: unitService.unit.stateVariables[0].id, value: '' }" { id: unitService.unit.stateVariables[0].id, value: '' }"
(stateVariableChange)="updateModel.emit({ property: 'actionParam', value: $event })"> (stateVariableChange)="updateModel.emit({ property: 'actionParam', value: $event })">
</aspect-button-action-param-state-variable> </aspect-action-param-state-variable>
<p *ngIf="!unitService.unit.stateVariables.length">{{'propertiesPanel.addStateVariables' | translate}}</p> <p *ngIf="!unitService.unit.stateVariables.length">{{'propertiesPanel.addStateVariables' | translate}}</p>
</ng-container> </ng-container>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment