|
|
@ -29,9 +29,11 @@ import { |
|
|
import { |
|
|
import { |
|
|
MatAutocomplete, |
|
|
MatAutocomplete, |
|
|
MatAutocompleteModule, |
|
|
MatAutocompleteModule, |
|
|
|
|
|
MatAutocompleteOrigin, |
|
|
MatOption |
|
|
MatOption |
|
|
} from '@angular/material/autocomplete'; |
|
|
} from '@angular/material/autocomplete'; |
|
|
import { |
|
|
import { |
|
|
|
|
|
MAT_FORM_FIELD, |
|
|
MatFormFieldControl, |
|
|
MatFormFieldControl, |
|
|
MatFormFieldModule |
|
|
MatFormFieldModule |
|
|
} from '@angular/material/form-field'; |
|
|
} from '@angular/material/form-field'; |
|
|
@ -77,6 +79,7 @@ export class GfCurrencySelectorComponent |
|
|
public readonly formControlName = input.required<string>(); |
|
|
public readonly formControlName = input.required<string>(); |
|
|
|
|
|
|
|
|
private readonly destroyRef = inject(DestroyRef); |
|
|
private readonly destroyRef = inject(DestroyRef); |
|
|
|
|
|
private readonly formField = inject(MAT_FORM_FIELD); |
|
|
private readonly input = viewChild.required(MatInput); |
|
|
private readonly input = viewChild.required(MatInput); |
|
|
|
|
|
|
|
|
public constructor( |
|
|
public constructor( |
|
|
@ -91,6 +94,10 @@ export class GfCurrencySelectorComponent |
|
|
this.controlType = 'currency-selector'; |
|
|
this.controlType = 'currency-selector'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public get autocompleteOrigin(): MatAutocompleteOrigin { |
|
|
|
|
|
return { elementRef: this.formField.getConnectedOverlayOrigin() }; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public get emojiFlagOfSelectedCurrency() { |
|
|
public get emojiFlagOfSelectedCurrency() { |
|
|
const selectedCurrency = this.currencies().find((currency) => { |
|
|
const selectedCurrency = this.currencies().find((currency) => { |
|
|
return currency === this.control.value; |
|
|
return currency === this.control.value; |
|
|
@ -100,7 +107,7 @@ export class GfCurrencySelectorComponent |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public override get empty() { |
|
|
public override get empty() { |
|
|
return this.input().empty; |
|
|
return !this.control.value; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public override set value(value: string | null) { |
|
|
public override set value(value: string | null) { |
|
|
|