{"version":3,"sources":["middlewares/FormItemTemplateMw.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,aAAa,CAAC,eAAe,CAqBnE,CAAC;AAEF,eAAe,kBAAkB,CAAC","file":"FormItemTemplateMw.d.ts","sourcesContent":["import * as React from 'react';\nimport get from 'lodash/get';\nimport { toJSONSchemaPath, isRequired } from '../core';\nimport { MiddlewareProps } from '../share';\nimport { Form } from 'antd';\n\nexport const FormItemTemplateMw: React.ComponentType<MiddlewareProps> = (props) => {\n  const { schema, dataPath, next, errors, extraProps } = props;\n\n  if (typeof schema === 'boolean') return next(props);\n\n  const id = toJSONSchemaPath(dataPath);\n  const error = errors && errors.find(({ dataPath }) => dataPath === id);\n\n  return (\n    <Form.Item\n      label={schema.title || dataPath[dataPath.length - 1]}\n      extra={schema.description}\n      {...(error && { help: error.message })}\n      validateStatus={error ? 'error' : ''}\n      hasFeedback\n      required={isRequired(props)}\n      {...get(extraProps, 'formItem')}\n    >\n      {next(props)}\n    </Form.Item>\n  );\n};\n\nexport default FormItemTemplateMw;\n"]}