prefill tags changes

This commit is contained in:
amentis 2024-04-30 15:04:55 +03:00
parent 500503ad37
commit e41c7f8abc
4 changed files with 13 additions and 5 deletions

View File

@ -476,6 +476,7 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
Tag tag = new Tag();
tag.setLabel(tagString.trim());
descriptionTag.setTag(tag);
descriptionTag.setIsActive(IsActive.Active);
description.getDescriptionTags().add(descriptionTag);
}
}

View File

@ -313,7 +313,7 @@ export class ResultFieldsMappingConfigurationEditorModel implements ResultFields
}
return this.formBuilder.group({
code: [{ value: this.code, disabled: true }, context.getValidation('code').validators],
code: [{ value: this.code, disabled: disabled }, context.getValidation('code').validators],
responsePath: [{ value: this.responsePath, disabled: disabled }, context.getValidation('responsePath').validators],
});
}
@ -722,7 +722,7 @@ export class StaticOptionEditorModel implements StaticOptionPersist {
}
return this.formBuilder.group({
code: [{ value: this.code, disabled: true }, context.getValidation('code').validators],
code: [{ value: this.code, disabled: disabled }, context.getValidation('code').validators],
value: [{ value: this.value, disabled: disabled }, context.getValidation('value').validators],
});
}

View File

@ -141,7 +141,7 @@
<div class="col">
<mat-form-field class="w-100">
<mat-label>{{'EXTERNAL-FETCHER-SOURCE-EDITOR.FIELDS.CODE' | translate}}</mat-label>
<input matInput type="text" [readonly]="field.get('code').disabled" name="code" [formControl]="field.get('code')" [readOnly]="true">
<input matInput type="text" [readonly]="true" name="code" [formControl]="field.get('code')">
<mat-error *ngIf="field.get('code').hasError('backendError')">{{field.get('code').getError('backendError').message}}</mat-error>
<mat-error *ngIf="field.get('code').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
@ -372,7 +372,7 @@
<div class="col-6">
<mat-form-field class="w-100">
<mat-label>{{'EXTERNAL-FETCHER-SOURCE-EDITOR.FIELDS.CODE' | translate}}</mat-label>
<input matInput type="text" [readonly]="option.get('code').disabled" name="code" [formControl]="option.get('code')">
<input matInput type="text" [readonly]="true" name="code" [formControl]="option.get('code')">
<mat-error *ngIf="option.get('code').hasError('backendError')">{{option.get('code').getError('backendError').message}}</mat-error>
<mat-error *ngIf="option.get('code').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>

View File

@ -1,5 +1,5 @@
import { COMMA, ENTER } from '@angular/cdk/keycodes';
import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
import { Component, ElementRef, Input, OnInit, SimpleChanges, ViewChild } from '@angular/core';
import { UntypedFormControl } from '@angular/forms';
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
import { MatChipInputEvent } from '@angular/material/chips';
@ -30,8 +30,15 @@ export class TagsComponent extends BaseComponent implements OnInit {
) {
super();
}
ngOnChanges(changes: SimpleChanges) {
if(changes['form']) this.applyTags();
}
ngOnInit(): void {
this.applyTags();
}
applyTags(){
this.tags = this.form.value || [];
this.filteredTags = this.form.valueChanges.pipe(
startWith(null),