import _Upload from "antd/es/upload";
import _extends from "@babel/runtime/helpers/extends";
import _Button from "antd/es/button";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["fileList", "matter", "action", "accept", "authorization", "text", "style"];
/* eslint-disable @typescript-eslint/no-shadow */
import * as React from 'react';
import { UploadOutlined } from '@ant-design/icons/es/index';
import "./index.less";
var antUpload = function antUpload(_ref) {
  var fileList = _ref.fileList,
    matter = _ref.matter,
    action = _ref.action,
    accept = _ref.accept,
    authorization = _ref.authorization,
    text = _ref.text,
    style = _ref.style,
    otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
  var _style = style || {};
  // _style['height'] = _style['height'] ? _style['height'] : '30px';
  // _style['width'] = _style['width'] ? _style['width'] : '300px';
  var _otherProps = otherProps || {};
  _otherProps.style = _style;
  var props = {
    label: "文件上传",
    name: "file",
    title: "上传文件",
    action: action,
    accept: accept,
    headers: {
      Authorization: "Bearer " + authorization
    },
    fileList: fileList
    // onChange(info) {
    //   console.log(info.file, info.fileList, 5555555555555);
    //   if (info.file.status !== 'uploading') {
    //   }
    //   if (info.file.status === 'done') {
    //     message.success(`${info.file.name} file uploaded successfully`);
    //   } else if (info.file.status === 'error') {
    //     message.error(`${info.file.name} file upload failed.`);
    //   }
    // },
  };

  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Upload, _extends({}, props, _otherProps), /*#__PURE__*/React.createElement(_Button, {
    icon: /*#__PURE__*/React.createElement(UploadOutlined, null),
    style: _otherProps.style
  }, matter), /*#__PURE__*/React.createElement("span", {
    style: {
      fontSize: '12px',
      verticalAlign: 'bottom',
      marginLeft: '10px'
    }
  }, text)));
};
antUpload.displayName = 'antUpload';
export default antUpload;