Actually do it like this

This commit is contained in:
shamoon 2024-04-10 07:35:36 -07:00
parent c690dad174
commit 3c301a1346

View File

@ -35,17 +35,18 @@ export class MonetaryComponent extends AbstractInputComponent<string> {
get currencyCode(): string { get currencyCode(): string {
const focused = document.activeElement === this.currencyField?.nativeElement const focused = document.activeElement === this.currencyField?.nativeElement
if (focused && this.value) return this.value.match(/^([a-zA-Z]{0,3})/)?.[0] if (focused && this.value)
return this.value.toUpperCase().match(/^([A-Z]{0,3})/)?.[0]
return ( return (
this.value this.value
?.toString() ?.toString()
.toUpperCase() .toUpperCase()
.match(/^([a-zA-Z]{1,3})/)?.[0] ?? this.defaultCurrencyCode .match(/^([A-Z]{1,3})/)?.[0] ?? this.defaultCurrencyCode
) )
} }
set currencyCode(value: string) { set currencyCode(value: string) {
this.value = value + this.monetaryValue?.toString() this.value = value.toUpperCase() + this.monetaryValue?.toString()
} }
get monetaryValue(): string { get monetaryValue(): string {