UNPKG

@gravel-form/antd

Version:

A flexible middlewares driven json schema form with Ant Design

1 lines 807 B
{"version":3,"sources":["middlewares/SwitchMw.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,EAAE,CAAC,eAAe,CAO9C,CAAC;AAEF,eAAe,QAAQ,CAAC","file":"SwitchMw.d.ts","sourcesContent":["import * as React from 'react';\nimport get from 'lodash/get';\nimport { Switch } from 'antd';\nimport { MiddlewareProps } from '../share';\n\nexport const SwitchMw: React.FC<MiddlewareProps> = (props) => {\n const { schema, onChange, data, next, extraProps } = props;\n if (typeof schema === 'boolean' || schema.type !== 'boolean') return next(props);\n\n return (\n <Switch title={schema.title} checked={data} onChange={(value) => onChange(value)} {...get(extraProps, 'props')} />\n );\n};\n\nexport default SwitchMw;\n"]}