import React, { forwardRef } from 'react';
import Input from '../input';
import Image from '../image';
import './style';
import { jsx as _jsx } from "react/jsx-runtime";
/**
 * 数字组件
 *
 * @param FieldImageProps {
 *     text: number;
 *     moneySymbol?: string; }
 */
const FieldImage = ({
  text,
  mode: type,
  render,
  renderFormItem,
  fieldProps,
  placeholder,
  width
}, ref) => {
  if (type === 'read') {
    const dom = /*#__PURE__*/_jsx(Image, {
      width: width || 32,
      src: text
    });
    if (render) {
      return render(text, {
        mode: type,
        ...fieldProps
      }, dom);
    }
    return dom;
  }
  if (type === 'edit' || type === 'update') {
    const dom = /*#__PURE__*/_jsx(Input, {
      ref: ref,
      placeholder: placeholder,
      ...fieldProps
    });
    if (renderFormItem) {
      return renderFormItem(text, {
        mode: type,
        ...fieldProps
      }, dom);
    }
    return dom;
  }
  return null;
};
export default /*#__PURE__*/forwardRef(FieldImage);