Skip to content

Commit

Permalink
Merge pull request #699 from geonetwork/DF/fix-empty-value-dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas authored Nov 27, 2023
2 parents 6653144 + 248d26d commit 8c497f9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/datafeeder/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -76,6 +77,7 @@ export function apiConfigurationFactory() {
MatIconModule,
UtilI18nModule,
FeatureEditorModule,
BrowserAnimationsModule,
ApiModule.forRoot(apiConfigurationFactory),
TranslateModule.forRoot(TRANSLATE_DEFAULT_CONFIG),
StoreModule.forRoot({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {
AfterViewInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
Input,
OnDestroy,
Expand Down Expand Up @@ -66,6 +68,7 @@ export const MY_FORMATS = {
},
{ provide: MAT_DATE_FORMATS, useValue: MY_FORMATS },
],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class WizardFieldComponent implements AfterViewInit, OnDestroy {
@Input() wizardFieldConfig: WizardFieldModel
Expand Down Expand Up @@ -108,10 +111,14 @@ export class WizardFieldComponent implements AfterViewInit, OnDestroy {
}
}

constructor(private wizardService: WizardService) {}
constructor(
private wizardService: WizardService,
private cdr: ChangeDetectorRef
) {}

ngAfterViewInit() {
this.initializeListeners()
this.cdr.detectChanges()
}

ngOnDestroy() {
Expand Down Expand Up @@ -196,6 +203,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(
Expand Down

0 comments on commit 8c497f9

Please sign in to comment.