From 2c8f0b857b6f6f04578a9697228510f70d10f7dc Mon Sep 17 00:00:00 2001 From: Florian Necas Date: Mon, 20 Nov 2023 17:36:46 +0100 Subject: [PATCH] fix: fix scale value to avoid nullity #685 --- apps/datafeeder/src/app/app.module.ts | 2 ++ .../wizard-field/wizard-field.component.ts | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/apps/datafeeder/src/app/app.module.ts b/apps/datafeeder/src/app/app.module.ts index 9af9382362..21237b8d8d 100644 --- a/apps/datafeeder/src/app/app.module.ts +++ b/apps/datafeeder/src/app/app.module.ts @@ -37,6 +37,7 @@ import { SummarizeBackgroundComponent } from './presentation/components/svg/summ import { DATAFEEDER_STATE_KEY, reducer } from './store/datafeeder.reducer' import { FeatureAuthModule } from '@geonetwork-ui/feature/auth' import { MatIconModule } from '@angular/material/icon' +import { BrowserAnimationsModule } from '@angular/platform-browser/animations' export function apiConfigurationFactory() { return new Configuration({ @@ -76,6 +77,7 @@ export function apiConfigurationFactory() { MatIconModule, UtilI18nModule, FeatureEditorModule, + BrowserAnimationsModule, ApiModule.forRoot(apiConfigurationFactory), TranslateModule.forRoot(TRANSLATE_DEFAULT_CONFIG), StoreModule.forRoot({ diff --git a/libs/feature/editor/src/lib/components/wizard-field/wizard-field.component.ts b/libs/feature/editor/src/lib/components/wizard-field/wizard-field.component.ts index fe45598346..4863ee0645 100644 --- a/libs/feature/editor/src/lib/components/wizard-field/wizard-field.component.ts +++ b/libs/feature/editor/src/lib/components/wizard-field/wizard-field.component.ts @@ -1,5 +1,6 @@ import { AfterViewInit, + ChangeDetectorRef, Component, Input, OnDestroy, @@ -103,15 +104,20 @@ export class WizardFieldComponent implements AfterViewInit, OnDestroy { return data ? new Date(Number(data)) : new Date() } case WizardFieldType.DROPDOWN: { + //TODO called continuously return data ? JSON.parse(data) : this.dropdownChoices[0]?.value } } } - constructor(private wizardService: WizardService) {} + constructor( + private wizardService: WizardService, + private cdr: ChangeDetectorRef + ) {} ngAfterViewInit() { this.initializeListeners() + this.cdr.detectChanges() } ngOnDestroy() { @@ -196,6 +202,17 @@ export class WizardFieldComponent implements AfterViewInit, OnDestroy { } private initializeDropdownListener() { + if ( + this.wizardService.getWizardFieldData(this.wizardFieldConfig.id) === + undefined && + !!this.dropdown.selected + ) { + this.wizardService.setWizardFieldData( + this.wizardFieldConfig.id, + this.dropdown.selected + ) + } + this.subs.add( this.dropdown.selectValue.subscribe((value) => { this.wizardService.onWizardWizardFieldDataChanged(