Fixed highlight on type change bug

This commit is contained in:
mpetrov 2025-03-05 14:02:57 +02:00
parent d53f359bca
commit a991719585

View File

@ -76,30 +76,28 @@
</div> </div>
<div class="tb-form-panel no-gap"> <div class="tb-form-panel no-gap">
<div class="tb-form-panel-title tb-required">{{ 'calculated-fields.expression' | translate }}</div> <div class="tb-form-panel-title tb-required">{{ 'calculated-fields.expression' | translate }}</div>
@if (fieldFormGroup.get('type').value === CalculatedFieldType.SIMPLE) { <mat-form-field class="mt-3" appearance="outline" subscriptSizing="dynamic" [class.hidden]="fieldFormGroup.get('type').value !== CalculatedFieldType.SIMPLE">
<mat-form-field class="mt-3" appearance="outline" subscriptSizing="dynamic"> <input matInput formControlName="expressionSIMPLE" maxlength="255" [placeholder]="'(temperature - 32) / 1.8'" required>
<input matInput formControlName="expressionSIMPLE" maxlength="255" [placeholder]="'(temperature - 32) / 1.8'" required> @if (configFormGroup.get('expressionSIMPLE').errors && configFormGroup.get('expressionSIMPLE').touched) {
@if (configFormGroup.get('expressionSIMPLE').errors && configFormGroup.get('expressionSIMPLE').touched) { <mat-error>
<mat-error> @if (configFormGroup.get('expressionSIMPLE').hasError('required')) {
@if (configFormGroup.get('expressionSIMPLE').hasError('required')) { {{ 'calculated-fields.hint.expression-required' | translate }}
{{ 'calculated-fields.hint.expression-required' | translate }} } @else if (configFormGroup.get('expressionSIMPLE').hasError('pattern')) {
} @else if (configFormGroup.get('expressionSIMPLE').hasError('pattern')) { {{ 'calculated-fields.hint.expression-invalid' | translate }}
{{ 'calculated-fields.hint.expression-invalid' | translate }} } @else if (configFormGroup.get('expressionSIMPLE').hasError('maxLength')) {
} @else if (configFormGroup.get('expressionSIMPLE').hasError('maxLength')) { {{ 'calculated-fields.hint.expression-max-length' | translate }}
{{ 'calculated-fields.hint.expression-max-length' | translate }} }
} </mat-error>
</mat-error> } @else {
} @else { <mat-hint>{{ 'calculated-fields.hint.expression' | translate }}</mat-hint>
<mat-hint>{{ 'calculated-fields.hint.expression' | translate }}</mat-hint> }
} </mat-form-field>
</mat-form-field> <div [class.hidden]="fieldFormGroup.get('type').value !== CalculatedFieldType.SCRIPT">
} @else {
<tb-js-func <tb-js-func
required required
formControlName="expressionSCRIPT" formControlName="expressionSCRIPT"
functionName="calculate" functionName="calculate"
[functionArgs]="functionArgs$ | async" [functionArgs]="functionArgs$ | async"
[disableUndefinedCheck]="true"
[scriptLanguage]="ScriptLanguage.TBEL" [scriptLanguage]="ScriptLanguage.TBEL"
[highlightRules]="argumentsHighlightRules$ | async" [highlightRules]="argumentsHighlightRules$ | async"
[editorCompleter]="argumentsEditorCompleter$ | async" [editorCompleter]="argumentsEditorCompleter$ | async"
@ -124,7 +122,7 @@
{{ 'common.test-function' | translate }} {{ 'common.test-function' | translate }}
</button> </button>
</div> </div>
} </div>
</div> </div>
<div class="tb-form-panel" [formGroup]="outputFormGroup"> <div class="tb-form-panel" [formGroup]="outputFormGroup">
<div class="tb-form-panel-title">{{ 'calculated-fields.output' | translate }}</div> <div class="tb-form-panel-title">{{ 'calculated-fields.output' | translate }}</div>