Files
YG_FT/frontend/dist/assets/el-upload-BidZtrXE.js

2 lines
14 KiB
JavaScript
Raw Normal View History

import{C as Q,a6 as ce,J as ke,a8 as fe,b as N,R as f,a5 as V,aU as h,d as q,aW as Ee,a as K,o as b,e as U,w as F,c as T,M as we,ad as Re,t as x,f as o,n as g,h as $,g as k,q as A,aL as B,s as S,E as D,a_ as Pe,aa as Y,al as $e,a$ as Fe,b0 as Ce,b1 as Se,b2 as Te,b3 as Le,b4 as Ue,y as pe,j as G,B as Be,aQ as W,b5 as Z,b6 as De,b7 as Oe,b8 as je,D as ee,aK as Ae,b9 as Ke,P as Ne,H as qe,aX as te,Y as ae,F as Me,a9 as He,l as _e}from"./index-Di_EOfGc.js";import{c as M}from"./index-DXP8yRbu.js";import{E as ze}from"./el-progress-DMG4au6m.js";import{f as se}from"./index-DfvEbper.js";import{c as oe}from"./el-form-item-BA58sHM7.js";const Ie="ElUpload";var Xe=class extends Error{constructor(t,i,n,d){super(t),this.name="UploadAjaxError",this.status=i,this.method=n,this.url=d}};function ne(t,i,n){let d;return n.response?d=`${n.response.error||n.response}`:n.responseText?d=`${n.responseText}`:d=`fail to ${i.method} ${t} ${n.status}`,new Xe(d,n.status,i.method,t)}function Ve(t){const i=t.responseText||t.response;if(!i)return i;try{return JSON.parse(i)}catch{return i}}const xe=t=>{typeof XMLHttpRequest>"u"&&Q(Ie,"XMLHttpRequest is undefined");const i=new XMLHttpRequest,n=t.action;i.upload&&i.upload.addEventListener("progress",r=>{const u=r;u.percent=r.total>0?r.loaded/r.total*100:0,t.onProgress(u)});const d=new FormData;if(t.data)for(const[r,u]of Object.entries(t.data))ce(u)?u.length===2&&u[0]instanceof Blob&&ke(u[1])?d.append(r,u[0],u[1]):u.forEach(w=>{d.append(r,w)}):d.append(r,u);d.append(t.filename,t.file,t.file.name),i.addEventListener("error",()=>{t.onError(ne(n,t,i))}),i.addEventListener("load",()=>{if(i.status<200||i.status>=300)return t.onError(ne(n,t,i));t.onSuccess(Ve(i))}),i.open(t.method,n,!0),t.withCredentials&&"withCredentials"in i&&(i.withCredentials=!0);const p=t.headers||{};if(p instanceof Headers)p.forEach((r,u)=>i.setRequestHeader(u,r));else for(const[r,u]of Object.entries(p))fe(u)||i.setRequestHeader(r,String(u));return i.send(d),i},ve=["text","picture","picture-card"];let Ge=1;const J=()=>Date.now()+Ge++,ye=N({action:{type:String,default:"#"},headers:{type:f(Object)},method:{type:String,default:"post"},data:{type:f([Object,Function,Promise]),default:()=>V({})},multiple:Boolean,name:{type:String,default:"file"},drag:Boolean,withCredentials:Boolean,showFileList:{type:Boolean,default:!0},accept:{type:String,default:""},fileList:{type:f(Array),default:()=>V([])},autoUpload:{type:Boolean,default:!0},listType:{type:String,values:ve,default:"text"},httpRequest:{type:f(Function),default:xe},disabled:{type:Boolean,default:void 0},limit:Number,directory:Boolean}),We=N({...ye,beforeUpload:{type:f(Function),default:h},beforeRemove:{type:f(Function)},onRemove:{type:f(Function),default:h},onChange:{type:f(Function),default:h},onPreview:{type:f(Function),default:h},onSuccess:{type:f(Function),default:h},onProgress:{type:f(Function),default:h},onError:{type:f(Function),default:h},onExceed:{type:f(Function),default:h},crossorigin:{type:f(String)}}),me=Symbol("uploadContextKey"),Je=N({files:{type:f(Array),default:()=>V([])},disabled:{type:Boolean,default:void 0},handlePreview:{type:f(Function),default:h},listType:{type:String,values:ve,default:"text"},crossorigin:{type:f(String)}}),Qe={remove:t=>!!t},Ye=N({...ye,beforeUpload:{type:f(Function),default:h},onRemove:{type:f(Function),default:h},onStart:{type:f(Function),default:h},onSuccess:{type:f(Function),default:h},onProgress:{type:f(Function),default:h},onError:{type:f(Function),default:h},onExceed:{type:f(Function),default:h}}),Ze=N({disabled:{type:Boolean,default:void 0},directory:Boolean}),et={file:t=>ce(t)},tt=["tabindex","aria-disabled","onKeydown"],at=["src","crossorigin"],st=["onClick"],ot=["title"],nt=["onClick"],lt=["onClick"];var rt=q({name:"ElUploadList",__name:"upload-list",props:Je,emits:Qe,setup(t,{emit:i}){const n=t,d=i,{t:p}=Ee(),r=K("upload"),u=K("icon"),w=K("list"),y=M(),P=pe(!1),C=G(()=>[r.b("list"),r.bm("list",n.listType),r.is("disabled",y.value)]),E=c=>{d("remove",c)};return(c,v)=>(b(),U(Ue,{tag:"ul",class:g(C.value),name:o(w).b()},{default:F(()=>[(b(!0),T