import _Upload from "antd/es/upload";
import _Button from "antd/es/button";
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["fileList", "matter", "action", "accept", "authorization", "tenantId", "text", "hintStyle", "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,
    tenantId = _ref.tenantId,
    text = _ref.text,
    hintStyle = _ref.hintStyle,
    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: {
      type: 'get',
      Authorization: "Bearer " + authorization,
      'TENANT-ID': tenantId
    },
    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.`);
    //   }
    // },
  };

  var yangshi = {
    fontSize: hintStyle.size,
    color: hintStyle.color,
    fontWeight: hintStyle.weight
  };
  return /*#__PURE__*/React.createElement("div", {
    style: {
      width: '100%'
    }
  }, /*#__PURE__*/React.createElement(_Upload, _extends({}, props, _otherProps), /*#__PURE__*/React.createElement(_Button, {
    style: _extends({}, _otherProps.style),
    icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
  }, matter), /*#__PURE__*/React.createElement("span", {
    style: _extends({}, yangshi, {
      verticalAlign: 'bottom',
      marginLeft: '10px'
    })
  }, text)));
};
antUpload.displayName = 'antUpload';
export default antUpload;