import React from 'react';
import Input from '../input';
import { useIntl } from '../wau-provider';
import './style';

/**
 * 最基本的组件，就是个普通的 Input.TextArea
 *
 * @param
 */
import { jsx as _jsx } from "react/jsx-runtime";
const FieldTextArea = ({
  text,
  mode,
  render,
  renderFormItem,
  fieldProps
}, ref) => {
  const intl = useIntl();
  if (mode === 'read') {
    const dom = /*#__PURE__*/_jsx("span", {
      ref: ref,
      children: text || '-'
    });
    if (render) {
      return render(text, {
        mode,
        ...fieldProps
      }, dom);
    }
    return dom;
  }
  if (mode === 'edit' || mode === 'update') {
    const dom = /*#__PURE__*/_jsx(Input.TextArea, {
      rows: 3,
      placeholder: intl.getMessage('tableForm.inputPlaceholder', '请输入'),
      ref: ref,
      ...fieldProps
    });
    if (renderFormItem) {
      return renderFormItem(text, {
        mode,
        ...fieldProps
      }, dom);
    }
    return dom;
  }
  return null;
};
export default /*#__PURE__*/React.forwardRef(FieldTextArea);