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