Compare commits
2 Commits
977a05ce6f
...
cb0d95fc3c
Author | SHA1 | Date |
---|---|---|
Sofia Papacharalampous | cb0d95fc3c | |
Sofia Papacharalampous | cd3b608a97 |
|
@ -17,12 +17,13 @@ import { TranslateService } from '@ngx-translate/core';
|
|||
import { Subject } from 'rxjs';
|
||||
import { debounceTime, delay, map, takeUntil, tap } from 'rxjs/operators';
|
||||
import { GENERAL_ANIMATIONS } from '../../animations/animations';
|
||||
import { EditorCustomValidators } from '../../custom-validators/editor-custom-validators';
|
||||
import { DescriptionTemplateFieldEditorModel, DescriptionTemplateRuleEditorModel, DescriptionTemplateSectionEditorModel } from '../../description-template-editor.model';
|
||||
import { DescriptionTemplateFieldSetPersist, DescriptionTemplateReferenceTypeFieldPersist } from '@app/core/model/description-template/description-template-persist';
|
||||
import { DescriptionEditorModel } from '@app/ui/description/editor/description-editor.model';
|
||||
import { Description } from '@app/core/model/description/description';
|
||||
import { VisibilityRulesService } from '@app/ui/description/editor/description-form/visibility-rules/visibility-rules.service';
|
||||
import { ReferenceTypeService } from '@app/core/services/reference-type/reference-type.service';
|
||||
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
||||
|
||||
@Component({
|
||||
selector: 'app-description-template-editor-composite-field-component',
|
||||
|
@ -56,9 +57,7 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
|
|||
previewFieldSet: DescriptionTemplateFieldSet = null;
|
||||
previewPropertiesFormGroup: UntypedFormGroup = null;
|
||||
descriptionTemplateFieldTypeEnum = DescriptionTemplateFieldType;
|
||||
|
||||
private myCustomValidators: EditorCustomValidators = new EditorCustomValidators();
|
||||
|
||||
private availableReferenceTypes: ReferenceType[] = [];
|
||||
|
||||
constructor(
|
||||
private dialog: MatDialog,
|
||||
|
@ -66,7 +65,8 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
|
|||
public enumUtils: EnumUtils,
|
||||
public datasetProfileService: DescriptionTemplateService,
|
||||
private configurationService: ConfigurationService,
|
||||
public visibilityRulesService: VisibilityRulesService
|
||||
public visibilityRulesService: VisibilityRulesService,
|
||||
private referenceTypeService: ReferenceTypeService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
@ -79,9 +79,6 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
if (this.viewOnly) {
|
||||
this.form.get('hasCommentField').disable();
|
||||
|
@ -90,6 +87,9 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
|
|||
this.showExtendedDescription = !!this.form.get('extendedDescription').value;
|
||||
this.showAdditionalInfo = !!this.form.get('additionalInformation').value;
|
||||
|
||||
// TODO: check network
|
||||
this.referenceTypeService.query(ReferenceTypeService.DefaultReferenceTypeLookup()).subscribe(referenceTypes => this.availableReferenceTypes = referenceTypes.items as ReferenceType[]);
|
||||
|
||||
this.form.valueChanges.pipe(takeUntil(this._destroyed)).subscribe(changes => {
|
||||
this.previewDirty = true;
|
||||
this.generatePreviewForm();
|
||||
|
@ -156,8 +156,10 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
|
|||
|
||||
if (editorField.data.fieldType === DescriptionTemplateFieldType.REFERENCE_TYPES) {
|
||||
convertedField.data = editorField.data;
|
||||
let selectedReferenceType: ReferenceType = this.availableReferenceTypes.find(referenceType => referenceType.id == (editorField.data as DescriptionTemplateReferenceTypeFieldPersist).referenceTypeId);
|
||||
(convertedField.data as DescriptionTemplateReferenceTypeData).referenceType = {
|
||||
id: (editorField.data as DescriptionTemplateReferenceTypeFieldPersist).referenceTypeId
|
||||
id: (editorField.data as DescriptionTemplateReferenceTypeFieldPersist).referenceTypeId,
|
||||
name: selectedReferenceType?.name
|
||||
};
|
||||
} else {
|
||||
convertedField.data = editorField.data;
|
||||
|
|
|
@ -2,30 +2,17 @@
|
|||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { FormGroupDirective, NgForm, UntypedFormArray, UntypedFormControl, UntypedFormGroup, } from '@angular/forms';
|
||||
import { ErrorStateMatcher } from '@angular/material/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
|
||||
import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type';
|
||||
import { ValidationType } from '@app/core/common/enum/validation-type';
|
||||
import {
|
||||
DescriptionTemplateExternalDatasetData,
|
||||
DescriptionTemplateLabelAndMultiplicityData,
|
||||
DescriptionTemplateLabelData,
|
||||
DescriptionTemplateRadioBoxData,
|
||||
DescriptionTemplateReferenceTypeData,
|
||||
DescriptionTemplateSelectData,
|
||||
DescriptionTemplateSelectOption,
|
||||
DescriptionTemplateUploadData
|
||||
} from '@app/core/model/description-template/description-template';
|
||||
import { DescriptionTemplateLabelAndMultiplicityData, DescriptionTemplateLabelData, DescriptionTemplateRadioBoxData, DescriptionTemplateSelectData, DescriptionTemplateSelectOption,DescriptionTemplateUploadData } from '@app/core/model/description-template/description-template';
|
||||
import { DescriptionTemplateFieldPersist } from '@app/core/model/description-template/description-template-persist';
|
||||
import { ConfigurationService } from "@app/core/services/configuration/configuration.service";
|
||||
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { DescriptionTemplateFieldEditorModel, DescriptionTemplateRuleEditorModel } from '../../description-template-editor.model';
|
||||
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
||||
import { FilterService } from '@common/modules/text-filter/filter-service';
|
||||
import { SemanticsService } from '@app/core/services/semantic/semantics.service';
|
||||
|
||||
@Component({
|
||||
|
@ -37,7 +24,6 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple
|
|||
@Input() viewOnly: boolean;
|
||||
@Input() form: UntypedFormGroup;
|
||||
validationTypeEnum = ValidationType;
|
||||
// isFieldMultiplicityEnabled = false;
|
||||
|
||||
fieldType: DescriptionTemplateFieldType;
|
||||
descriptionTemplateFieldTypeEnum = DescriptionTemplateFieldType;
|
||||
|
@ -54,13 +40,10 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple
|
|||
constructor(
|
||||
public enumUtils: EnumUtils,
|
||||
public descriptionTemplateService: DescriptionTemplateService,
|
||||
private dialog: MatDialog,
|
||||
private configurationService: ConfigurationService,
|
||||
private filterService: FilterService,
|
||||
public semanticsService: SemanticsService
|
||||
) {
|
||||
super();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue