UNPKG

loners-form

Version:

为工作而生,基于 antd 而生的可配置化表单

43 lines (35 loc) 2.68 kB
import "antd/es/input/style"; import _Input from "antd/es/input"; var _excluded = ["fixedWidth", "style", "placeholder", "showQA"]; function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } import React from 'react'; import cx from 'classnames'; import QA from '../QA'; import { WIDTH_SIZE_ENUM, FORM_ITEM_CLASS_NAME } from '../constants'; import '../index.less'; var InputGo = function InputGo(props) { var _props$fixedWidth = props.fixedWidth, fixedWidth = _props$fixedWidth === void 0 ? false : _props$fixedWidth, style = props.style, _props$placeholder = props.placeholder, placeholder = _props$placeholder === void 0 ? '请输入' : _props$placeholder, showQA = props.showQA, rawProps = _objectWithoutProperties(props, _excluded); var ownStyle = fixedWidth ? { width: WIDTH_SIZE_ENUM.s } : style; var formItemClassName = FORM_ITEM_CLASS_NAME; return /*#__PURE__*/React.createElement("div", { className: cx("".concat(formItemClassName, "-box"), _defineProperty({}, "".concat(formItemClassName, "-mg-r"), showQA && fixedWidth)) }, /*#__PURE__*/React.createElement(_Input, _extends({ placeholder: placeholder, style: ownStyle }, rawProps)), showQA && /*#__PURE__*/React.createElement(QA, { className: "".concat(formItemClassName, "-qa"), title: typeof showQA === 'boolean' ? '' : showQA.title })); }; export default InputGo;