// 导入前、文件上传中/校验中展示模块
import React, { memo, useContext } from 'react';
import { Button, Progress } from 'antd';
import { ExclamationCircleOutlined, CloudUploadOutlined, LoadingOutlined } from '@ant-design/icons';
import Upload from "../upload";
import { ConfigContext } from "../config-provider/context";
var Initial = function Initial(_ref) {
  var template = _ref.template,
    notice = _ref.notice,
    bucketName = _ref.bucketName,
    _ref$percent = _ref.percent,
    percent = _ref$percent === void 0 ? 0 : _ref$percent,
    status = _ref.status,
    onCancelUpload = _ref.onCancelUpload,
    onUpload = _ref.onUpload;
  var componentContext = useContext(ConfigContext);
  var uiLocale = componentContext.uiLocale;
  return /*#__PURE__*/React.createElement("div", {
    className: "container-initial"
  }, template && /*#__PURE__*/React.createElement("div", {
    className: "template"
  }, template), notice && /*#__PURE__*/React.createElement("div", {
    className: "tips"
  }, /*#__PURE__*/React.createElement(ExclamationCircleOutlined, null), /*#__PURE__*/React.createElement("span", null, notice)), /*#__PURE__*/React.createElement(Upload, {
    dragger: true,
    bucketName: bucketName,
    className: "upload-drag",
    validFileType: ['XLS', 'XLSX'],
    disabled: status === 'uploading',
    maxSize: 50 * 1024 * 1024,
    onChange: function onChange(fileList, file) {
      return onUpload(file);
    },
    showUploadList: false
  }, status === 'initial' ? /*#__PURE__*/React.createElement("div", {
    className: "wraps-initial"
  }, /*#__PURE__*/React.createElement("div", {
    className: "drag-icon"
  }, /*#__PURE__*/React.createElement(CloudUploadOutlined, null)), /*#__PURE__*/React.createElement("div", {
    className: "drag-text"
  }, uiLocale.Upload.dragUploadText), /*#__PURE__*/React.createElement("div", {
    className: "drag-hint"
  }, uiLocale.FileImport.Initial.hintText), /*#__PURE__*/React.createElement(Button, {
    type: "primary"
  }, uiLocale.Upload.text)) : /*#__PURE__*/React.createElement("div", {
    className: "wraps-uploading"
  }, /*#__PURE__*/React.createElement("div", {
    className: "progress"
  }, /*#__PURE__*/React.createElement(Progress, {
    percent: +percent.toFixed(0),
    status: "active"
  }), /*#__PURE__*/React.createElement("a", {
    className: "cancel",
    onClick: onCancelUpload
  }, uiLocale.FileImport.Initial.cancelText)), /*#__PURE__*/React.createElement("div", {
    className: "progress-text"
  }, /*#__PURE__*/React.createElement(LoadingOutlined, null), " ", percent >= 30 ? uiLocale.FileImport.Initial.validating : uiLocale.FileImport.Initial.uploading))));
};
export default /*#__PURE__*/memo(Initial);