UNPKG

@agentlab/rjsf-antd

Version:

Ant Design theme, fields and widgets for react-jsonschema-form

18 lines 860 B
import React from 'react'; import { Input } from 'antd'; import omit from 'omit.js'; const TextWidget = ({ id, required, readonly, disabled, value, onChange, onBlur, onFocus, autofocus, options, schema, }) => { const _onChange = ({ target: { value } }) => { onChange(value === '' ? options.emptyValue : value); }; const _onBlur = ({ target: { value } }) => { onBlur(id, value); }; const _onFocus = ({ target: { value } }) => { onFocus(id, value); }; const inputOptions = omit(options, ['enumOptions']); return (React.createElement(Input, Object.assign({}, inputOptions, { type: 'text', autoFocus: autofocus, required: required, disabled: disabled || readonly, value: value, onChange: _onChange, onBlur: _onBlur, onFocus: _onFocus }))); }; export default TextWidget; //# sourceMappingURL=TextWidget.js.map