From 04e6e3a50ff02580264e802e320072155830eea2 Mon Sep 17 00:00:00 2001 From: Derek Burgman Date: Fri, 9 Dec 2022 20:09:37 -0600 Subject: [PATCH] fix: fixed mapbox fields marked issue - fixed issue where mapbox fields were not marked as touched or dirty on map changes, causing dbxActionForm to not register the changes --- packages/dbx-core/src/lib/action/action.store.ts | 2 +- .../mapbox/src/lib/field/latlng/latlng.field.component.ts | 6 +++++- .../mapbox/src/lib/field/zoom/zoom.field.component.ts | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/dbx-core/src/lib/action/action.store.ts b/packages/dbx-core/src/lib/action/action.store.ts index 7e2909148..b22217863 100644 --- a/packages/dbx-core/src/lib/action/action.store.ts +++ b/packages/dbx-core/src/lib/action/action.store.ts @@ -320,7 +320,7 @@ export class ActionContextStore extends ComponentStore afterDistinctLoadingStateTypeChange(): Observable> { return this.state$.pipe( - map((x) => [x, loadingStateForActionContextState(x)] as [ActionContextState, LoadingStateType]), + map((x) => [x, loadingStateTypeForActionContextState(x)] as [ActionContextState, LoadingStateType]), distinctUntilChanged((a, b) => a?.[1] === b?.[1]), // Filter out when the loading state remains the same. map((x) => x[0] as ActionContextState), shareReplay(1) diff --git a/packages/dbx-form/mapbox/src/lib/field/latlng/latlng.field.component.ts b/packages/dbx-form/mapbox/src/lib/field/latlng/latlng.field.component.ts index 12103361e..c81dd9e95 100644 --- a/packages/dbx-form/mapbox/src/lib/field/latlng/latlng.field.component.ts +++ b/packages/dbx-form/mapbox/src/lib/field/latlng/latlng.field.component.ts @@ -154,7 +154,9 @@ export class DbxFormMapboxLatLngFieldComponent { this.dbxMapboxMapStore.centerGivenMargin$.pipe(first()).subscribe(() => { if (!this.isReadonlyOrDisabled) { - this.ngZone.run(() => this.setValue(center)); + this.ngZone.run(() => { + this.setValue(center); + }); } }); }); @@ -189,5 +191,7 @@ export class DbxFormMapboxLatLngFieldComponent) { this.formControl.setValue(latLng ? this._latLngStringFunction(latLng) : latLng); + this.formControl.markAsTouched(); + this.formControl.markAsDirty(); } } diff --git a/packages/dbx-form/mapbox/src/lib/field/zoom/zoom.field.component.ts b/packages/dbx-form/mapbox/src/lib/field/zoom/zoom.field.component.ts index ab97097db..faf3fe39b 100644 --- a/packages/dbx-form/mapbox/src/lib/field/zoom/zoom.field.component.ts +++ b/packages/dbx-form/mapbox/src/lib/field/zoom/zoom.field.component.ts @@ -174,5 +174,7 @@ export class DbxFormMapboxZoomFieldComponent) { this.formControl.setValue(zoom); + this.formControl.markAsTouched(); + this.formControl.markAsDirty(); } }