UNPKG

fx-form-widget

Version:
52 lines 2.06 kB
import _extends from "@babel/runtime/helpers/extends"; import _Input from "antd/es/input"; import * as React from 'react'; import { isNotNullValue } from './tools'; import './index.less'; var TextArea = _Input.TextArea; var Textarea = function Textarea(_ref) { var _ref$schema = _ref.schema, schema = _ref$schema === void 0 ? {} : _ref$schema, _ref$onChange = _ref.onChange, onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange, _ref$value = _ref.value, value = _ref$value === void 0 ? isNotNullValue(schema.data) ? schema.data : '' : _ref$value; var _schema$rows = schema.rows, rows = _schema$rows === void 0 ? 1 : _schema$rows, _schema$readonly = schema.readonly, readonly = _schema$readonly === void 0 ? false : _schema$readonly, _schema$required = schema.required, required = _schema$required === void 0 ? false : _schema$required, _schema$placeholder = schema.placeholder, placeholder = _schema$placeholder === void 0 ? '请输入' : _schema$placeholder, _schema$allowClear = schema.allowClear, allowClear = _schema$allowClear === void 0 ? false : _schema$allowClear, _schema$minLength = schema.minLength, minLength = _schema$minLength === void 0 ? undefined : _schema$minLength, _schema$maxLength = schema.maxLength, maxLength = _schema$maxLength === void 0 ? undefined : _schema$maxLength, _schema$showCount = schema.showCount, showCount = _schema$showCount === void 0 ? false : _schema$showCount; var handleChange = function handleChange(e) { return onChange(e.target.value); }; var options = { rows: rows, placeholder: placeholder, required: required, showCount: showCount, maxLength: maxLength, minLength: minLength, allowClear: allowClear, disabled: readonly }; var defaultUi = { width: '100%' }; var ui = _extends({}, defaultUi, options); return /*#__PURE__*/React.createElement(TextArea, _extends({}, ui, { value: value, onChange: handleChange })); }; export default Textarea;