| 11 | } |
| 12 | |
| 13 | export default function SelectMapButton<T extends ValueType>(property: Property<T>) { |
| 14 | return ( |
| 15 | <select |
| 16 | className={"form-select " + (property.className ?? "")} |
| 17 | value={property.value} |
| 18 | onChange={function (event) { |
| 19 | let value: ValueType = event.target.value |
| 20 | if (typeof property.value === "number") { |
| 21 | value = parseInt(event.target.value) |
| 22 | } |
| 23 | property.change(value as T) |
| 24 | }} |
| 25 | > |
| 26 | <option disabled={!property.allowEmpty} hidden={!property.allowEmpty} value=""> |
| 27 | -- {property.verb ?? (property.isAdd ? "add" : "select")} -- |
| 28 | </option> |
| 29 | {property.itemzz.map((item) => ( |
| 30 | <option key={item[0]} value={item[0]}> |
| 31 | {item[1]} |
| 32 | </option> |
| 33 | ))} |
| 34 | </select> |
| 35 | ) |
| 36 | } |