"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _vue = require("vue");
require("../interface");
var _progress = _interopRequireDefault(require("../../progress"));
var _ImageOperationTip = _interopRequireDefault(require("../../tooltip/ImageOperationTip"));
var _tooltip = _interopRequireDefault(require("../../tooltip"));
var _DeleteTwoTone = _interopRequireDefault(require("@pf-ui/pf-icons-vue/DeleteTwoTone"));
var _WordTwoTone = _interopRequireDefault(require("@pf-ui/pf-icons-vue/WordTwoTone"));
var _ExcleTwoTone = _interopRequireDefault(require("@pf-ui/pf-icons-vue/ExcleTwoTone"));
var _JpgTwoTone = _interopRequireDefault(require("@pf-ui/pf-icons-vue/JpgTwoTone"));
var _PdfTwoTone = _interopRequireDefault(require("@pf-ui/pf-icons-vue/PdfTwoTone"));
var _PngTwoTone = _interopRequireDefault(require("@pf-ui/pf-icons-vue/PngTwoTone"));
var _PptTwoTone = _interopRequireDefault(require("@pf-ui/pf-icons-vue/PptTwoTone"));
var _RarTwoTone = _interopRequireDefault(require("@pf-ui/pf-icons-vue/RarTwoTone"));
var _TxtTwoTone = _interopRequireDefault(require("@pf-ui/pf-icons-vue/TxtTwoTone"));
var _YasuoTwoTone = _interopRequireDefault(require("@pf-ui/pf-icons-vue/YasuoTwoTone"));
var _ZipTwoTone = _interopRequireDefault(require("@pf-ui/pf-icons-vue/ZipTwoTone"));
var _DocumentFilled = _interopRequireDefault(require("@pf-ui/pf-icons-vue/DocumentFilled"));
var FileExtension = {
  xls: (0, _vue.createVNode)(_ExcleTwoTone.default, null, null),
  xlsx: (0, _vue.createVNode)(_ExcleTwoTone.default, null, null),
  jpg: (0, _vue.createVNode)(_JpgTwoTone.default, null, null),
  jpeg: (0, _vue.createVNode)(_JpgTwoTone.default, null, null),
  pdf: (0, _vue.createVNode)(_PdfTwoTone.default, null, null),
  png: (0, _vue.createVNode)(_PngTwoTone.default, null, null),
  ppt: (0, _vue.createVNode)(_PptTwoTone.default, null, null),
  rar: (0, _vue.createVNode)(_RarTwoTone.default, null, null),
  txt: (0, _vue.createVNode)(_TxtTwoTone.default, null, null),
  doc: (0, _vue.createVNode)(_WordTwoTone.default, null, null),
  docx: (0, _vue.createVNode)(_WordTwoTone.default, null, null),
  '7z': (0, _vue.createVNode)(_YasuoTwoTone.default, null, null),
  zip: (0, _vue.createVNode)(_ZipTwoTone.default, null, null)
};
var PfTextItemRender = function PfTextItemRender(_ref) {
  var _ref2, _ref2$split;
  var file = _ref.file,
    actions = _ref.actions,
    prefixCls = _ref.prefixCls,
    message = _ref.message;
  console.log('file', file, actions);
  var _prefixCls = "".concat(prefixCls, "-preset-pf-text");
  var fileExtension = (_ref2 = file.url || file.name) === null || _ref2 === void 0 ? void 0 : (_ref2$split = _ref2.split('.')) === null || _ref2$split === void 0 ? void 0 : _ref2$split.pop();
  var dom = (0, _vue.createVNode)("div", {
    "class": _prefixCls
  }, [(0, _vue.createVNode)("a", {
    "class": "".concat(_prefixCls, "-icon"),
    "href": file.url,
    "target": "_blank",
    "rel": "noopener noreferrer",
    "onClick": actions.preview
  }, [FileExtension[fileExtension] || (0, _vue.createVNode)(_DocumentFilled.default, null, null)]), (0, _vue.createVNode)("div", {
    "class": "".concat(_prefixCls, "-file")
  }, [(0, _vue.createVNode)("div", {
    "class": "".concat(_prefixCls, "-file-info")
  }, [(0, _vue.createVNode)("div", {
    "class": "".concat(_prefixCls, "-file-name ").concat(file.status === 'error' ? "".concat(_prefixCls, "-file-name-error") : '')
  }, [file.name]), file.status !== 'uploading' && (0, _vue.createVNode)("div", {
    "class": "".concat(_prefixCls, "-file-actions")
  }, [(0, _vue.createVNode)(_ImageOperationTip.default, {
    "title": "删除"
  }, {
    default: function _default() {
      return [(0, _vue.createVNode)(_DeleteTwoTone.default, {
        "class": "".concat(_prefixCls, "-file-actions-delete"),
        "onClick": actions.remove
      }, null)];
    }
  })])]), file.status === 'uploading' && (0, _vue.createVNode)(_progress.default, {
    "percent": file.percent,
    "showInfo": false,
    "strokeColor": "#198EEB",
    "trailColor": "#DBDBDB"
  }, null)])]);
  return file.status === 'error' ? (0, _vue.createVNode)(_tooltip.default, {
    "title": message,
    "getPopupContainer": function getPopupContainer(node) {
      return node.parentNode;
    }
  }, {
    default: function _default() {
      return [dom];
    }
  }) : dom;
};
var _default2 = PfTextItemRender;
exports.default = _default2;