You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
2.1 KiB

import{UploadResultStatus as a}from"./typing-0f0a78e2.js";import{isImgTypeByName as s}from"./helper-3b79b112.js";import{e as m,b as n}from"./index-f4658ae7.js";import{P as p}from"./index-9eb90d49.js";import{T as i}from"./index-134963ca.js";import d from"./TableAction-8031dbc2.js";import c from"./ThumbUrl-5da03225.js";const{t}=m();function U(){return[{dataIndex:"thumbUrl",title:t("component.upload.legend"),width:100,customRender:({record:e})=>{const{thumbUrl:o}=e||{};return o&&n(c,{fileUrl:o},null)}},{dataIndex:"name",title:t("component.upload.fileName"),align:"left",customRender:({text:e,record:o})=>{const{percent:l,status:r}=o||{};let u="normal";return r===a.ERROR?u="exception":r===a.UPLOADING?u="active":r===a.SUCCESS&&(u="success"),n("span",null,[n("p",{class:"truncate mb-1",title:e},[e]),n(p,{percent:l,size:"small",status:u},null)])}},{dataIndex:"size",title:t("component.upload.fileSize"),width:100,customRender:({text:e=0})=>e&&(e/1024).toFixed(2)+"KB"},{dataIndex:"status",title:t("component.upload.fileStatue"),width:100,customRender:({text:e})=>e===a.SUCCESS?n(i,{color:"green"},{default:()=>t("component.upload.uploadSuccess")}):e===a.ERROR?n(i,{color:"red"},{default:()=>t("component.upload.uploadError")}):e===a.UPLOADING?n(i,{color:"blue"},{default:()=>t("component.upload.uploading")}):e}]}function h(e){return{width:120,title:t("component.upload.operating"),dataIndex:"action",fixed:!1,customRender:({record:o})=>{const l=[{label:t("component.upload.del"),color:"error",onClick:e.bind(null,o)}];return n(d,{actions:l,outside:!0},null)}}}function w(){return[{dataIndex:"url",title:t("component.upload.legend"),width:100,customRender:({record:e})=>{const{url:o}=e||{};return s(o)&&n(c,{fileUrl:o},null)}},{dataIndex:"name",title:t("component.upload.fileName"),align:"left"}]}function x({handleRemove:e,handleDownload:o}){return{width:160,title:t("component.upload.operating"),dataIndex:"action",fixed:!1,customRender:({record:l})=>{const r=[{label:t("component.upload.del"),color:"error",onClick:e.bind(null,l)},{label:t("component.upload.download"),onClick:o.bind(null,l)}];return n(d,{actions:r,outside:!0},null)}}}export{x as a,U as b,w as c,h as d};