Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 1x 1x 1x | import React from "react"; import { trans_obj } from "../i18n"; import { getInputClass, MultiWidgetType, WidgetProps } from "./types"; export function SelectInputWidget(props: WidgetProps<string, MultiWidgetType>) { const { type, value, placeholder, onChange, disabled } = props; const choices = type.choices?.map((item) => ( <option key={item[0]} value={item[0]}> {trans_obj(item[1])} </option> )); return ( <div className="form-group"> <div> <select className={getInputClass(type)} value={value || placeholder || ""} onChange={(e) => onChange(e.target.value)} disabled={disabled} > <option key="" value=""> ---- </option> {choices} </select> </div> </div> ); } |