UNPKG

rjsf-antd

Version:

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

21 lines 1.02 kB
import { __assign } from "tslib"; import React from 'react'; import { Input } from 'antd'; var TextWidget = function (_a) { var id = _a.id, required = _a.required, readonly = _a.readonly, disabled = _a.disabled, value = _a.value, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, autofocus = _a.autofocus, options = _a.options, schema = _a.schema; var _onChange = function (_a) { var value = _a.target.value; onChange(value === '' ? options.emptyValue : value); }; var _onBlur = function (_a) { var value = _a.target.value; onBlur(id, value); }; var _onFocus = function (_a) { var value = _a.target.value; onFocus(id, value); }; return (React.createElement(Input, __assign({}, options, { type: "text", autoFocus: autofocus, required: required, disabled: disabled || readonly, value: value, onChange: _onChange, onBlur: _onBlur, onFocus: _onFocus }))); }; export default TextWidget; //# sourceMappingURL=TextWidget.js.map