diff options
Diffstat (limited to 'packages/exchange-backoffice-ui/src/handlers')
| -rw-r--r-- | packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx | 8 | ||||
| -rw-r--r-- | packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx | 4 | 
2 files changed, 6 insertions, 6 deletions
diff --git a/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx b/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx index 8369e509d..837744827 100644 --- a/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx +++ b/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx @@ -6,7 +6,7 @@ import { useState } from "preact/hooks";  export function InputSelectMultiple<T extends object, K extends keyof T>(    props: { -    choices: Choice[]; +    choices: Choice<T[K]>[];      unique?: boolean;      max?: number;    } & UIFormProps<T, K>, @@ -18,7 +18,7 @@ export function InputSelectMultiple<T extends object, K extends keyof T>(    const [filter, setFilter] = useState<string | undefined>(undefined);    const regex = new RegExp(`.*${filter}.*`, "i");    const choiceMap = choices.reduce((prev, curr) => { -    return { ...prev, [curr.value]: curr.label }; +    return { ...prev, [curr.value as string]: curr.label };    }, {} as Record<string, string>);    const list = (value ?? []) as string[]; @@ -111,14 +111,14 @@ export function InputSelectMultiple<T extends object, K extends keyof T>(                    role="option"                    onClick={() => {                      setFilter(undefined); -                    if (unique && list.indexOf(v.value) !== -1) { +                    if (unique && list.indexOf(v.value as string) !== -1) {                        return;                      }                      if (max !== undefined && list.length >= max) {                        return;                      }                      const newValue = [...list]; -                    newValue.splice(0, 0, v.value); +                    newValue.splice(0, 0, v.value as string);                      onChange(newValue as T[K]);                    }} diff --git a/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx b/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx index 9af446e6c..b0e2277d3 100644 --- a/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx +++ b/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx @@ -6,7 +6,7 @@ import { useState } from "preact/hooks";  export function InputSelectOne<T extends object, K extends keyof T>(    props: { -    choices: Choice[]; +    choices: Choice<T[K]>[];    } & UIFormProps<T, K>,  ): VNode {    const { name, label, choices, placeholder, tooltip, required } = props; @@ -15,7 +15,7 @@ export function InputSelectOne<T extends object, K extends keyof T>(    const [filter, setFilter] = useState<string | undefined>(undefined);    const regex = new RegExp(`.*${filter}.*`, "i");    const choiceMap = choices.reduce((prev, curr) => { -    return { ...prev, [curr.value]: curr.label }; +    return { ...prev, [curr.value as string]: curr.label };    }, {} as Record<string, string>);    const filteredChoices =  | 
