remove service as component input > include in parent providers instead

This commit is contained in:
mchouliara 2024-09-06 13:59:21 +03:00
parent d87c46445c
commit bfd44d5dfd
3 changed files with 12 additions and 5 deletions

View File

@ -132,7 +132,14 @@
</div>
<div [id]="'preview_container'+ form.get('id').value" class="row">
<div *ngIf="previewFieldSet && showPreview && firstField?.get('data')?.get('fieldType')?.value" class="col-12" [@fade-in-fast]>
<app-description-form-field-set class="w-100" [canAnnotate]="false" [propertiesFormGroup]="previewPropertiesFormGroup" [fieldSet]="previewFieldSet" [visibilityRulesService]="visibilityRulesService" [numbering]="numbering" [hideAnnotations]="true" [validationErrorModel]="validationErrorModel"></app-description-form-field-set>
<app-description-form-field-set class="w-100"
[canAnnotate]="false"
[propertiesFormGroup]="previewPropertiesFormGroup"
[fieldSet]="previewFieldSet"
[numbering]="numbering"
[hideAnnotations]="true"
[validationErrorModel]="validationErrorModel"
></app-description-form-field-set>
</div>
</div>
</div>

View File

@ -28,7 +28,8 @@ import { ReferenceType } from '@app/core/model/reference-type/reference-type';
selector: 'app-description-template-editor-field-set-component',
templateUrl: './description-template-editor-field-set.component.html',
styleUrls: ['./description-template-editor-field-set.component.scss'],
animations: [GENERAL_ANIMATIONS]
animations: [GENERAL_ANIMATIONS],
providers: [VisibilityRulesService]
})
export class DescriptionTemplateEditorFieldSetComponent extends BaseComponent implements OnInit {
@ -196,7 +197,6 @@ export class DescriptionTemplateEditorFieldSetComponent extends BaseComponent im
const previewProperties = descriptionEditorModel.properties.buildForm({visibilityRulesService: this.visibilityRulesService}) as UntypedFormGroup;
this.previewPropertiesFormGroup = previewProperties.get("fieldSets").get(fieldSet.id) as UntypedFormGroup;
this.previewFieldSet = fieldSet;
this.visibilityRulesService.setContext(mockDescription.descriptionTemplate.definition, previewProperties);
}

View File

@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input } from '@angular/core';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, input, Input, SimpleChanges } from '@angular/core';
import { UntypedFormArray, UntypedFormGroup } from '@angular/forms';
import { MatDialog } from "@angular/material/dialog";
import { DescriptionTemplateFieldSet } from '@app/core/model/description-template/description-template';
@ -42,7 +42,6 @@ export class DescriptionFormFieldSetComponent extends BaseComponent {
}
isVisibleByVisibilityService: boolean = true;
@Input() visibilityRulesService: VisibilityRulesService;
@Input() path: String;
@Input() descriptionTemplateId: String;
@Input() isChild: Boolean = false;
@ -65,6 +64,7 @@ export class DescriptionFormFieldSetComponent extends BaseComponent {
private descriptionFormService: DescriptionFormService,
private uiNotificationService: UiNotificationService,
private language: TranslateService,
public visibilityRulesService: VisibilityRulesService
) {
super();
}