{"version":3,"sources":["middlewares/SelectMw.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC,eAAe,CA0BzD,CAAC;AAEF,eAAe,QAAQ,CAAC","file":"SelectMw.d.ts","sourcesContent":["import * as React from 'react';\nimport get from 'lodash/get';\nimport { Select } from 'antd';\nimport { MiddlewareProps } from '../share';\n\nexport const SelectMw: React.ComponentType<MiddlewareProps> = (props) => {\n  const { schema, data: value, onChange, next, extraProps } = props;\n  if (\n    typeof schema === 'boolean' ||\n    !schema.enum ||\n    !(schema.type === 'string' || schema.type === 'number' || schema.type === 'integer') ||\n    schema.enum.find((option) => !['string', 'number'].includes(typeof option))\n  )\n    return next(props);\n\n  const labels = get(extraProps, 'labels', schema.enum);\n\n  return (\n    <Select\n      value={value}\n      style={{ width: '100%' }}\n      onChange={(value: any) => onChange(value)}\n      {...get(extraProps, 'props')}\n    >\n      {schema.enum.map((option, index) => (\n        <Select.Option key={option as string | number} value={option as string | number}>\n          {get(labels, index, null)}\n        </Select.Option>\n      ))}\n    </Select>\n  );\n};\n\nexport default SelectMw;\n"]}