Browse Source

Task/migrate the components from NgStyle to style bindings

Replaces all 8 [ngStyle] template usages with native [style.*] bindings
per the Angular schematic at https://angular.dev/reference/migrations/ngstyle-to-style.

The single-property cases (display, pointer-events on
investment-chart, benchmark-comparator, treemap-chart, fire-calculator,
line-chart, portfolio-proportion-chart, premium-indicator) become a
single [style.X]="expr". The multi-property case in fire-page.html
(opacity + pointer-events on the GfFireCalculatorComponent) splits
into two separate [style.X]="expr" attributes; the standalone
fire-page component drops its now-unused NgStyle import.

CHANGELOG entry added under 3.2.0 / Changed.

Closes #6816
pull/6837/head
Matt Van Horn 2 weeks ago
parent
commit
543aa4d3d3
Failed to extract signature
  1. 1
      CHANGELOG.md
  2. 2
      apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.html
  3. 2
      apps/client/src/app/components/investment-chart/investment-chart.component.html
  4. 3
      apps/client/src/app/pages/portfolio/fire/fire-page.component.ts
  5. 9
      apps/client/src/app/pages/portfolio/fire/fire-page.html
  6. 2
      libs/ui/src/lib/fire-calculator/fire-calculator.component.html
  7. 2
      libs/ui/src/lib/line-chart/line-chart.component.html
  8. 2
      libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.html
  9. 2
      libs/ui/src/lib/premium-indicator/premium-indicator.component.html
  10. 2
      libs/ui/src/lib/treemap-chart/treemap-chart.component.html

1
CHANGELOG.md

@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Harmonized the unit styling in the value component - Harmonized the unit styling in the value component
- Migrated the components from `NgStyle` to style bindings
- Upgraded `stripe` from version `20.4.1` to `21.0.1` - Upgraded `stripe` from version `20.4.1` to `21.0.1`
### Fixed ### Fixed

2
apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.html

@ -53,6 +53,6 @@
<canvas <canvas
#chartCanvas #chartCanvas
class="h-100" class="h-100"
[ngStyle]="{ display: isLoading ? 'none' : 'block' }" [style.display]="isLoading ? 'none' : 'block'"
></canvas> ></canvas>
</div> </div>

2
apps/client/src/app/components/investment-chart/investment-chart.component.html

@ -10,5 +10,5 @@
<canvas <canvas
#chartCanvas #chartCanvas
class="h-100" class="h-100"
[ngStyle]="{ display: isLoading ? 'none' : 'block' }" [style.display]="isLoading ? 'none' : 'block'"
></canvas> ></canvas>

3
apps/client/src/app/pages/portfolio/fire/fire-page.component.ts

@ -12,7 +12,7 @@ import { GfPremiumIndicatorComponent } from '@ghostfolio/ui/premium-indicator';
import { DataService } from '@ghostfolio/ui/services'; import { DataService } from '@ghostfolio/ui/services';
import { GfValueComponent } from '@ghostfolio/ui/value'; import { GfValueComponent } from '@ghostfolio/ui/value';
import { CommonModule, NgStyle } from '@angular/common'; import { CommonModule } from '@angular/common';
import { import {
ChangeDetectorRef, ChangeDetectorRef,
Component, Component,
@ -35,7 +35,6 @@ import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
GfFireCalculatorComponent, GfFireCalculatorComponent,
GfPremiumIndicatorComponent, GfPremiumIndicatorComponent,
GfValueComponent, GfValueComponent,
NgStyle,
NgxSkeletonLoaderModule, NgxSkeletonLoaderModule,
ReactiveFormsModule ReactiveFormsModule
], ],

9
apps/client/src/app/pages/portfolio/fire/fire-page.html

@ -19,11 +19,10 @@
!hasImpersonationId && hasPermissionToUpdateUserSettings !hasImpersonationId && hasPermissionToUpdateUserSettings
" "
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
[ngStyle]="{ [style.opacity]="user?.subscription?.type === 'Basic' ? '0.67' : 'initial'"
opacity: user?.subscription?.type === 'Basic' ? '0.67' : 'initial', [style.pointer-events]="
'pointer-events': user?.subscription?.type === 'Basic' ? 'none' : 'initial'
user?.subscription?.type === 'Basic' ? 'none' : 'initial' "
}"
[projectedTotalAmount]="user?.settings?.projectedTotalAmount" [projectedTotalAmount]="user?.settings?.projectedTotalAmount"
[retirementDate]="user?.settings?.retirementDate" [retirementDate]="user?.settings?.retirementDate"
[savingsRate]="user?.settings?.savingsRate" [savingsRate]="user?.settings?.savingsRate"

2
libs/ui/src/lib/fire-calculator/fire-calculator.component.html

@ -81,7 +81,7 @@
<canvas <canvas
#chartCanvas #chartCanvas
class="h-100" class="h-100"
[ngStyle]="{ display: isLoading ? 'none' : 'block' }" [style.display]="isLoading ? 'none' : 'block'"
></canvas> ></canvas>
</div> </div>
</div> </div>

2
libs/ui/src/lib/line-chart/line-chart.component.html

@ -9,5 +9,5 @@
} }
<canvas <canvas
#chartCanvas #chartCanvas
[ngStyle]="{ display: isLoading ? 'none' : 'block' }" [style.display]="isLoading ? 'none' : 'block'"
></canvas> ></canvas>

2
libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.html

@ -9,5 +9,5 @@
} }
<canvas <canvas
#chartCanvas #chartCanvas
[ngStyle]="{ display: isLoading ? 'none' : 'block' }" [style.display]="isLoading ? 'none' : 'block'"
></canvas> ></canvas>

2
libs/ui/src/lib/premium-indicator/premium-indicator.component.html

@ -1,7 +1,7 @@
<a <a
class="align-items-center d-flex" class="align-items-center d-flex"
title="Upgrade to Ghostfolio Premium" title="Upgrade to Ghostfolio Premium"
[ngStyle]="{ 'pointer-events': enableLink ? 'initial' : 'none' }" [style.pointer-events]="enableLink ? 'initial' : 'none'"
[routerLink]="routerLinkPricing" [routerLink]="routerLinkPricing"
><ion-icon class="text-muted" name="diamond-outline" ><ion-icon class="text-muted" name="diamond-outline"
/></a> /></a>

2
libs/ui/src/lib/treemap-chart/treemap-chart.component.html

@ -9,5 +9,5 @@
} }
<canvas <canvas
#chartCanvas #chartCanvas
[ngStyle]="{ display: isLoading ? 'none' : 'block' }" [style.display]="isLoading ? 'none' : 'block'"
></canvas> ></canvas>

Loading…
Cancel
Save