"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _input = _interopRequireDefault(require("../input"));
var _wauProvider = require("../wau-provider");
require("./style");
var _jsxRuntime = require("react/jsx-runtime");
/**
 * 最基本的组件，就是个普通的 Input.TextArea
 *
 * @param
 */const FieldTextArea = ({
  text,
  mode,
  render,
  renderFormItem,
  fieldProps
}, ref) => {
  const intl = (0, _wauProvider.useIntl)();
  if (mode === 'read') {
    const dom = /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
      ref: ref,
      children: text || '-'
    });
    if (render) {
      return render(text, {
        mode,
        ...fieldProps
      }, dom);
    }
    return dom;
  }
  if (mode === 'edit' || mode === 'update') {
    const dom = /*#__PURE__*/(0, _jsxRuntime.jsx)(_input.default.TextArea, {
      rows: 3,
      placeholder: intl.getMessage('tableForm.inputPlaceholder', '请输入'),
      ref: ref,
      ...fieldProps
    });
    if (renderFormItem) {
      return renderFormItem(text, {
        mode,
        ...fieldProps
      }, dom);
    }
    return dom;
  }
  return null;
};
var _default = /*#__PURE__*/_react.default.forwardRef(FieldTextArea);
exports.default = _default;