Browse Source

feat(lib): change tags to input signal

pull/6404/head
Kenrick Tandrian 3 days ago
parent
commit
78ededd098
  1. 2
      libs/ui/src/lib/portfolio-filter-form/portfolio-filter-form.component.html
  2. 4
      libs/ui/src/lib/portfolio-filter-form/portfolio-filter-form.component.ts

2
libs/ui/src/lib/portfolio-filter-form/portfolio-filter-form.component.html

@ -53,7 +53,7 @@
<mat-label i18n>Tag</mat-label> <mat-label i18n>Tag</mat-label>
<mat-select formControlName="tag"> <mat-select formControlName="tag">
<mat-option [value]="null" /> <mat-option [value]="null" />
@for (tag of tags; track tag.id) { @for (tag of tags(); track tag.id) {
<mat-option [value]="tag.id">{{ tag.label }}</mat-option> <mat-option [value]="tag.id">{{ tag.label }}</mat-option>
} }
</mat-select> </mat-select>

4
libs/ui/src/lib/portfolio-filter-form/portfolio-filter-form.component.ts

@ -57,12 +57,12 @@ import { PortfolioFilterFormValue } from './interfaces';
export class GfPortfolioFilterFormComponent export class GfPortfolioFilterFormComponent
implements ControlValueAccessor, OnInit, OnChanges implements ControlValueAccessor, OnInit, OnChanges
{ {
@Input() tags: Filter[] = [];
@Input() disabled = false; @Input() disabled = false;
public readonly accounts = input<AccountWithPlatform[]>([]); public readonly accounts = input<AccountWithPlatform[]>([]);
public readonly assetClasses = input<Filter[]>([]); public readonly assetClasses = input<Filter[]>([]);
public readonly holdings = input<PortfolioPosition[]>([]); public readonly holdings = input<PortfolioPosition[]>([]);
public readonly tags = input<Filter[]>([]);
public filterForm: FormGroup<{ public filterForm: FormGroup<{
account: FormControl<string | null>; account: FormControl<string | null>;
@ -123,7 +123,7 @@ export class GfPortfolioFilterFormComponent
const tagControl = this.filterForm.get('tag'); const tagControl = this.filterForm.get('tag');
if (this.tags.length === 0) { if (this.tags().length === 0) {
tagControl?.disable({ emitEvent: false }); tagControl?.disable({ emitEvent: false });
} else if (!this.disabled) { } else if (!this.disabled) {
tagControl?.enable({ emitEvent: false }); tagControl?.enable({ emitEvent: false });

Loading…
Cancel
Save