From b874f9a0c50084803de58febb698864aa8dd061a Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 12 Mar 2023 23:56:54 -0300 Subject: print and setup totp --- .../merchant-backoffice-ui/src/components/form/InputSelector.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'packages/merchant-backoffice-ui/src/components') 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 extends InputProps { 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({ label, help, values, + convert, toStr = defaultToString, }: Props): VNode { const { error, value, onChange } = useField(name); @@ -66,7 +68,10 @@ export function InputSelector({ 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 && } -- cgit v1.2.3