From 5e4eef18389de48737885e402ff8a5987260f60b Mon Sep 17 00:00:00 2001 From: TheoLechemia Date: Thu, 14 Mar 2024 11:19:02 +0100 Subject: [PATCH] fix GenericFormComponent inheritance - fix #2961 --- .../acquisition-frameworks.component.ts | 1 + .../src/app/GN2CommonModule/form/areas/areas.component.ts | 1 + .../app/GN2CommonModule/form/datalist/datalist.component.ts | 1 + .../app/GN2CommonModule/form/datasets/datasets.component.ts | 2 ++ .../form/nomenclature/nomenclature.component.ts | 3 +++ .../form/observers-text/observers-text.component.ts | 4 +--- .../app/GN2CommonModule/form/observers/observers.component.ts | 1 + 7 files changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/GN2CommonModule/form/acquisition-frameworks/acquisition-frameworks.component.ts b/frontend/src/app/GN2CommonModule/form/acquisition-frameworks/acquisition-frameworks.component.ts index ceea901f19..2c93c93cf3 100644 --- a/frontend/src/app/GN2CommonModule/form/acquisition-frameworks/acquisition-frameworks.component.ts +++ b/frontend/src/app/GN2CommonModule/form/acquisition-frameworks/acquisition-frameworks.component.ts @@ -24,6 +24,7 @@ export class AcquisitionFrameworksComponent extends GenericFormComponent impleme } ngOnInit() { + super.ngOnInit(); this.getAcquisitionFrameworks(); } diff --git a/frontend/src/app/GN2CommonModule/form/areas/areas.component.ts b/frontend/src/app/GN2CommonModule/form/areas/areas.component.ts index 38ceb4ecfb..6dd1bee68b 100644 --- a/frontend/src/app/GN2CommonModule/form/areas/areas.component.ts +++ b/frontend/src/app/GN2CommonModule/form/areas/areas.component.ts @@ -96,6 +96,7 @@ export class AreasComponent extends GenericFormComponent implements OnInit { } ngOnInit() { + super.ngOnInit(); this.valueFieldName = this.valueFieldName === undefined ? 'id_area' : this.valueFieldName; this.getAreas(); diff --git a/frontend/src/app/GN2CommonModule/form/datalist/datalist.component.ts b/frontend/src/app/GN2CommonModule/form/datalist/datalist.component.ts index e2716528f4..317a8e2cb3 100644 --- a/frontend/src/app/GN2CommonModule/form/datalist/datalist.component.ts +++ b/frontend/src/app/GN2CommonModule/form/datalist/datalist.component.ts @@ -52,6 +52,7 @@ export class DatalistComponent extends GenericFormComponent implements OnInit { } ngOnInit() { + super.ngOnInit(); this.designStyle = this.designStyle || 'material'; this.formId = `datalist_${Math.ceil(Math.random() * 1e10)}`; this.getData(); diff --git a/frontend/src/app/GN2CommonModule/form/datasets/datasets.component.ts b/frontend/src/app/GN2CommonModule/form/datasets/datasets.component.ts index d91075c072..f440aeebca 100644 --- a/frontend/src/app/GN2CommonModule/form/datasets/datasets.component.ts +++ b/frontend/src/app/GN2CommonModule/form/datasets/datasets.component.ts @@ -69,6 +69,7 @@ export class DatasetsComponent extends GenericFormComponent implements OnInit, O } ngOnInit() { + super.ngOnInit(); this.bindValue = this.bindAllItem ? null : this.bindValue; this.getDatasets(); } @@ -102,6 +103,7 @@ export class DatasetsComponent extends GenericFormComponent implements OnInit, O } ngOnChanges(changes) { + super.ngOnChanges(changes); // detetch change on input idAcquisitionFramework // (the number, if the AFcomponent is not multiSelect) to reload datasets if ( diff --git a/frontend/src/app/GN2CommonModule/form/nomenclature/nomenclature.component.ts b/frontend/src/app/GN2CommonModule/form/nomenclature/nomenclature.component.ts index c334cfbc38..c078de2472 100644 --- a/frontend/src/app/GN2CommonModule/form/nomenclature/nomenclature.component.ts +++ b/frontend/src/app/GN2CommonModule/form/nomenclature/nomenclature.component.ts @@ -86,6 +86,7 @@ export class NomenclatureComponent } ngOnInit() { + super.ngOnInit(); this.keyValue = this.bindAllItem ? null : this.keyValue || 'id_nomenclature'; // patch pour les cas ou this.keyValue == undefined this.labelLang = 'label_' + this._translate.currentLang; this.definitionLang = 'definition_' + this._translate.currentLang; @@ -124,6 +125,8 @@ export class NomenclatureComponent } ngOnChanges(changes: SimpleChanges) { + super.ngOnChanges(changes); + // if change regne => change groupe2inpn also if (changes.regne !== undefined && !changes.regne.firstChange) { this.initLabels(); diff --git a/frontend/src/app/GN2CommonModule/form/observers-text/observers-text.component.ts b/frontend/src/app/GN2CommonModule/form/observers-text/observers-text.component.ts index 310e735e19..78071add66 100644 --- a/frontend/src/app/GN2CommonModule/form/observers-text/observers-text.component.ts +++ b/frontend/src/app/GN2CommonModule/form/observers-text/observers-text.component.ts @@ -7,10 +7,8 @@ import { GenericFormComponent } from '@geonature_common/form/genericForm.compone templateUrl: 'observers-text.component.html', styleUrls: ['./observers-text.component.scss'], }) -export class ObserversTextComponent extends GenericFormComponent implements OnInit { +export class ObserversTextComponent extends GenericFormComponent { constructor() { super(); } - - ngOnInit() {} } diff --git a/frontend/src/app/GN2CommonModule/form/observers/observers.component.ts b/frontend/src/app/GN2CommonModule/form/observers/observers.component.ts index d2151901c2..66e62bd5d6 100644 --- a/frontend/src/app/GN2CommonModule/form/observers/observers.component.ts +++ b/frontend/src/app/GN2CommonModule/form/observers/observers.component.ts @@ -41,6 +41,7 @@ export class ObserversComponent extends GenericFormComponent { } ngOnInit() { + super.ngOnInit(); this.bindValue = this.bindAllItem ? null : this.bindValue; this.multiSelect = this.multiSelect || true; // uniformise as IdList the id of list