ui fix for description editor change ref

This commit is contained in:
Diamantis Tziotzios 2024-08-06 13:47:39 +03:00
parent d5af0aa2e6
commit f2312dabcd
4 changed files with 20 additions and 16 deletions

3
frontend/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"html.format.wrapLineLength": 0
}

View File

@ -8,9 +8,8 @@ import { DescriptionTemplateFieldValidationType } from '@app/core/common/enum/de
import { DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateLabelAndMultiplicityData, DescriptionTemplateUploadData } from '@app/core/model/description-template/description-template';
import { StorageFile } from '@app/core/model/storage-file/storage-file';
import { DescriptionService } from '@app/core/services/description/description.service';
import { PlanService } from '@app/core/services/plan/plan.service';
import { SnackBarNotificationLevel, UiNotificationService } from "@app/core/services/notification/ui-notification-service";
import { ReferenceService } from '@app/core/services/reference/reference.service';
import { PlanService } from '@app/core/services/plan/plan.service';
import { StorageFileService } from '@app/core/services/storage-file/storage-file.service';
import { TagService } from '@app/core/services/tag/tag.service';
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
@ -83,13 +82,11 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
public planService: PlanService,
public descriptionService: DescriptionService,
public tagService: TagService,
private cdr: ChangeDetectorRef,
private changeDetectorRef: ChangeDetectorRef,
private uiNotificationService: UiNotificationService,
public dialog: MatDialog,
private fileUtils: FileUtils,
private referenceService: ReferenceService,
private storageFileService: StorageFileService,
private changeDetectorRef: ChangeDetectorRef,
private httpErrorHandlingService: HttpErrorHandlingService,
private descriptionFormService: DescriptionFormService,
) {
@ -119,7 +116,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
this.applyFieldType();
}
this.descriptionFormService.getDetectChangesObservable().pipe(takeUntil(this._destroyed)).subscribe( x => this.changeDetectorRef.markForCheck());
this.descriptionFormService.getDetectChangesObservable().pipe(takeUntil(this._destroyed)).subscribe(x => this.changeDetectorRef.markForCheck());
}
private applyFieldType() {
@ -132,6 +129,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
)
.subscribe(item => {
this.visibilityRulesService.updateVisibilityForSource(this.field?.id);
this.descriptionFormService.detectChanges(true);
});
}
@ -210,7 +208,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
.pipe(takeUntil(this._destroyed)).subscribe((response) => {
this.propertiesFormGroup?.get(this.field.id).get('textValue').patchValue(response[0].id.toString());
this.createFileNameDisplay(response[0].name, response[0].extension);
this.cdr.detectChanges();
this.changeDetectorRef.detectChanges();
}, error => {
this.onCallbackUploadFail(error.error);
})
@ -270,8 +268,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
onRemove(makeFilesNull: boolean = true) {
this.makeFilesNull()
this.cdr.detectChanges();
this.changeDetectorRef.detectChanges();
}
makeFilesNull() {

View File

@ -1,14 +1,16 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { DescriptionTemplateSection } from '@app/core/model/description-template/description-template';
import { PlanUser } from '@app/core/model/plan/plan';
import { BaseComponent } from '@common/base/base.component';
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
import { Guid } from '@common/types/guid';
import { ToCEntry } from '../../../table-of-contents/models/toc-entry';
import { ToCEntryType } from '../../../table-of-contents/models/toc-entry-type.enum';
import { LinkToScroll } from '../../../table-of-contents/table-of-contents.component';
import { VisibilityRulesService } from '../../visibility-rules/visibility-rules.service';
import { Guid } from '@common/types/guid';
import { PlanUser } from '@app/core/model/plan/plan';
import { DescriptionFormService } from '../services/description-form.service';
import { takeUntil } from 'rxjs';
@Component({
@ -38,6 +40,7 @@ export class DescriptionFormSectionComponent extends BaseComponent implements On
@Input() validationErrorModel: ValidationErrorModel;
constructor(
private descriptionFormService: DescriptionFormService,
private changeDetector: ChangeDetectorRef
) {
super();
@ -45,6 +48,7 @@ export class DescriptionFormSectionComponent extends BaseComponent implements On
}
ngOnInit() {
this.descriptionFormService.getDetectChangesObservable().pipe(takeUntil(this._destroyed)).subscribe( _ => this.changeDetector.markForCheck() );
}
ngOnChanges(changes: SimpleChanges) {
@ -62,7 +66,7 @@ export class DescriptionFormSectionComponent extends BaseComponent implements On
}
}
onAskedToScroll(event:MouseEvent, id: string) {
onAskedToScroll(event: MouseEvent, id: string) {
event?.stopPropagation();
this.panelExpanded = true;
this.askedToScroll.emit(id);

View File

@ -1,15 +1,15 @@
import { AfterViewInit, Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { MatExpansionPanel } from '@angular/material/expansion';
import { AnnotationEntityType } from '@app/core/common/enum/annotation-entity-type';
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
import { PlanUser } from '@app/core/model/plan/plan';
import { BaseComponent } from '@common/base/base.component';
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
import { Guid } from '@common/types/guid';
import { LinkToScroll } from '../table-of-contents/table-of-contents.component';
import { FormAnnotationService } from '../../../annotations/annotation-dialog-component/form-annotation.service';
import { LinkToScroll } from '../table-of-contents/table-of-contents.component';
import { VisibilityRulesService } from './visibility-rules/visibility-rules.service';
import { PlanUser } from '@app/core/model/plan/plan';
import { AnnotationEntityType } from '@app/core/common/enum/annotation-entity-type';
@Component({
selector: 'app-description-form',