diff options
author | Sebastian <sebasjm@gmail.com> | 2023-03-12 23:56:54 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-03-12 23:56:54 -0300 |
commit | b874f9a0c50084803de58febb698864aa8dd061a (patch) | |
tree | 50f23d8faa674a94646a21c5821fd4f494c60f64 /packages/merchant-backoffice-ui/src/components/form | |
parent | ae1aee13581469a8398321b57e95cc85f210047b (diff) | |
download | wallet-core-b874f9a0c50084803de58febb698864aa8dd061a.tar.xz |
print and setup totp
Diffstat (limited to 'packages/merchant-backoffice-ui/src/components/form')
-rw-r--r-- | packages/merchant-backoffice-ui/src/components/form/InputSelector.tsx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/merchant-backoffice-ui/src/components/form/InputSelector.tsx b/packages/merchant-backoffice-ui/src/components/form/InputSelector.tsx index 7a419ebb9..021977dfe 100644 --- a/packages/merchant-backoffice-ui/src/components/form/InputSelector.tsx +++ b/packages/merchant-backoffice-ui/src/components/form/InputSelector.tsx @@ -25,6 +25,7 @@ interface Props<T> extends InputProps<T> { readonly?: boolean; expand?: boolean; values: string[]; + convert?: (v: string) => any; toStr?: (v?: any) => string; fromStr?: (s: string) => any; } @@ -41,6 +42,7 @@ export function InputSelector<T>({ label, help, values, + convert, toStr = defaultToString, }: Props<keyof T>): VNode { const { error, value, onChange } = useField<T>(name); @@ -66,7 +68,10 @@ export function InputSelector<T>({ disabled={readonly} readonly={readonly} onChange={(e) => { - onChange(e.currentTarget.value as any); + const v = convert + ? convert(e.currentTarget.value) + : e.currentTarget.value; + onChange(v); }} > {placeholder && <option>{placeholder}</option>} |