From 301565baca022b9f2a25038de7ce5fb1161b05fb Mon Sep 17 00:00:00 2001 From: nidhal karchoud <114624188+yar01110@users.noreply.github.com> Date: Mon, 28 Sep 2026 18:20:25 +0200 Subject: [PATCH] Task/migrate historical market data editor dialog from ngModel to form control (#7933) * Migrate from ngModel to form control * Update changelog --- CHANGELOG.md | 1 + ...cal-market-data-editor-dialog.component.ts | 25 ++++++++++---- .../historical-market-data-editor-dialog.html | 34 +++++++++---------- 3 files changed, 36 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46ffe1b2ec..c09e057b2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Extended the net performance on the analysis page to include the dividends (experimental) - Extended the net performance in the portfolio summary to include the dividends (experimental) - Improved the get quotes functionality of the _Manual_ service +- Migrated the historical market data editor dialog from `ngModel` to form control - Migrated the _ESLint_ configuration to the flat config format without `FlatCompat` - Upgraded `chartjs-chart-treemap` from version `4.2.0` to `4.2.2` diff --git a/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.component.ts b/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.component.ts index 1b7b99fa21..17a5a5e612 100644 --- a/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.component.ts +++ b/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.component.ts @@ -7,11 +7,15 @@ import { CUSTOM_ELEMENTS_SCHEMA, DestroyRef, OnInit, - inject, - signal + inject } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { + FormControl, + FormGroup, + ReactiveFormsModule, + Validators +} from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core'; import { MatDatepickerModule } from '@angular/material/datepicker'; @@ -33,7 +37,6 @@ import { HistoricalMarketDataEditorDialogParams } from './interfaces/interfaces' changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'h-100' }, imports: [ - FormsModule, IonIcon, MatButtonModule, MatDatepickerModule, @@ -51,7 +54,10 @@ export class GfHistoricalMarketDataEditorDialogComponent implements OnInit { public readonly data = inject(MAT_DIALOG_DATA); - protected readonly marketPrice = signal(this.data.marketPrice); + protected readonly historicalMarketDataForm = new FormGroup({ + date: new FormControl({ disabled: true, value: this.data.dateString }), + marketPrice: new FormControl(this.data.marketPrice, Validators.required) + }); private readonly destroyRef = inject(DestroyRef); private readonly locale = @@ -84,14 +90,19 @@ export class GfHistoricalMarketDataEditorDialogComponent implements OnInit { }) .pipe(takeUntilDestroyed(this.destroyRef)) .subscribe(({ marketPrice }) => { - this.marketPrice.set(marketPrice); + this.historicalMarketDataForm.controls.marketPrice.setValue( + marketPrice + ); + + this.historicalMarketDataForm.controls.marketPrice.markAsDirty(); this.changeDetectorRef.markForCheck(); }); } public onUpdate() { - const marketPrice = this.marketPrice(); + const marketPrice = + this.historicalMarketDataForm.controls.marketPrice.value; if (isNil(marketPrice)) { return; diff --git a/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.html b/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.html index 7e81836646..6e52114058 100644 --- a/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.html +++ b/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.html @@ -1,16 +1,14 @@ -
+

Details for {{ data.symbol }}

Date - + Market Price - + {{ data.currency }}
- - +