@lingshugroup/web-plus 1.0.31 → 1.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/index.css +1 -1
- package/lib/index.css.br +0 -0
- package/lib/index.css.gz +0 -0
- package/lib/packages/ls-components/components/_hooks/useTableListHook/index.cjs +1 -1
- package/lib/packages/ls-components/components/_hooks/useTableListHook/index.js +43 -45
- package/lib/packages/ls-components/components/_hooks/useTableListHook/index.js.br +0 -0
- package/lib/packages/ls-components/components/_hooks/useTableListHook/index.js.gz +0 -0
- package/lib/packages/ls-components/components/form/FormItem.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/form/FormItem.vue/index.js +2 -2
- package/lib/packages/ls-components/components/form/FormItem.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/form/FormItem.vue/index2.js +270 -245
- package/lib/packages/ls-components/components/form/FormItem.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/form/FormItem.vue/index2.js.gz +0 -0
- package/lib/packages/ls-components/components/form/types/index.cjs +1 -1
- package/lib/packages/ls-components/components/form/types/index.js +4 -0
- package/lib/packages/ls-components/components/form/types/index.js.br +0 -0
- package/lib/packages/ls-components/components/form/types/index.js.gz +0 -0
- package/lib/packages/ls-components/components/list/List.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/list/List.vue/index.js +2 -2
- package/lib/packages/ls-components/components/list/List.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/list/List.vue/index2.js +103 -103
- package/lib/packages/ls-components/components/list/List.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/list/List.vue/index2.js.gz +0 -0
- package/lib/packages/ls-components/components/list/types/index.cjs +1 -1
- package/lib/packages/ls-components/components/list/types/index.js +11 -0
- package/lib/packages/ls-components/components/list/types/index.js.br +0 -0
- package/lib/packages/ls-components/components/list/types/index.js.gz +0 -0
- package/lib/packages/ls-components/components/preview/components/Pdf.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/preview/components/Pdf.vue/index.js +1 -1
- package/lib/packages/ls-components/components/preview/components/Pdf.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/preview/components/Pdf.vue/index2.js +1 -1
- package/lib/packages/ls-components/components/preview/components/Pdf.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/preview/components/Pdf.vue/index2.js.gz +0 -0
- package/lib/packages/ls-components/components/table/Table.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/table/Table.vue/index.js +1 -1
- package/lib/packages/ls-components/components/table/Table.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/table/Table.vue/index2.js +98 -98
- package/lib/packages/ls-components/components/table/Table.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/table/Table.vue/index2.js.gz +0 -0
- package/lib/packages/ls-components/components/table/types/index.cjs +1 -1
- package/lib/packages/ls-components/components/table/types/index.js +12 -2
- package/lib/packages/ls-components/components/table/types/index.js.br +0 -0
- package/lib/packages/ls-components/components/table/types/index.js.gz +0 -0
- package/lib/packages/ls-components/components/upload/Index.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/upload/Index.vue/index.js +1 -1
- package/lib/packages/ls-components/components/upload/Index.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/upload/Index.vue/index2.js +65 -65
- package/lib/packages/ls-components/components/upload/Index.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/upload/Index.vue/index2.js.gz +0 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ge=Object.defineProperty;var a=(p,M)=>ge(p,"name",{value:M,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});;/* empty css */;/* empty css */;/* empty css */;/* empty css */const e=require("vue"),_=,/* empty css */he=,/* empty css */we=,/* empty css */b=,/* empty css */W=;/* empty css */;/* empty css */;/* empty css */const L=,/* empty css */ke=,/* empty css */ye=,/* empty css */Fe=a(p=>(e.pushScopeId("data-v-3d96bfcf"),p=p(),e.popScopeId(),p),"_withScopeId"),be={class:"ls-drag"},Pe={class:"drag-txt ls-color-brand6"},Ce=Fe(()=>e.createElementVNode("div",{class:"drag-txt ls-color-text2"},"拖拽到此区域",-1)),Be={key:0,class:"btn-picture-card"},xe={key:0,class:"ls-tip"},Se=e.defineComponent({name:"LSUpload",inheritAttrs:!1,__name:"Index",props:_.lsUploadProps,emits:["uploadErrorFunc","onChangeFunc","httpResponseFunc"],setup(p,{expose:M,emit:G}){const U=e.useSlots(),g=e.useAttrs(),H=we.useNamespace("upload").b(),f=e.ref(),s=e.ref(!1),h=e.reactive({isCover:!0,accept:"",disabled:!1}),i=e.reactive({uploadFileList:[],initUploadStatus:!0,showPreview:!1,typePreview:"",sourcePreview:"",iconColor:he.getVariable("colorText1")}),n=p,T=G;e.watch(()=>g["file-list"],t=>{i.uploadFileList=t||[]},{immediate:!0,deep:!0});const P=e.computed(()=>{var t,o;return(((t=n==null?void 0:n.item)==null?void 0:t.isToast)||typeof((o=n==null?void 0:n.item)==null?void 0:o.isToast))==="undefined"}),m=e.computed(()=>{var o;const t=(o=n==null?void 0:n.item)==null?void 0:o.isCover;return typeof t>"u"?!0:t}),k=e.computed(()=>g.multiple),y=e.computed(()=>{const t=g["auto-upload"];return typeof t>"u"?!0:t}),K=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.emptyFileMsg)||""}),V=e.computed(()=>g["list-type"]),w=e.computed(()=>V.value===_.UPLOAD_TYPE_MAP.picCard),X=e.computed(()=>!V.value||V.value=="text"),C=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.limitFile)||[]}),Y=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.limitFileMsg)||""}),B=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.limitSize)||2}),J=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.limitSizeMsg)||""}),$=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.limitUnit)||"MB"}),Q=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.limitNumMsg)||""}),z=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.profile)||!1}),x=e.computed(()=>g.drag),Z=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.hideCoverBtn)&&m.value&&i.uploadFileList.length>0}),F=e.computed(()=>g.disabled),N=e.computed(()=>{const t=w.value?"图片":"文件";let o=`选择${t}`;return s.value?o="正在上传...":m.value&&!k.value?y.value?i.initUploadStatus?o="点击上传":o="重新上传":i.initUploadStatus?o=`选择${t}`:o="重新上传":y.value&&(o="点击上传"),o}),ee=e.computed(()=>{let t="不限制上传格式,";return w.value&&(t="文件须为图片格式,"),`${t}文件大小不超过${B.value}${$.value}`}),te=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.tipContent)||""}),A=e.computed(()=>{var t;return(t=n==null?void 0:n.item)==null?void 0:t.httpRequestFunc}),S=e.computed(()=>{var t;return(t=n==null?void 0:n.item)==null?void 0:t.textPreview});e.watch([m,A],([t,o])=>{h.isCover=t,o&&o instanceof Function&&(h["http-request"]=ce)},{immediate:!0,deep:!0}),e.watch(()=>C.value,t=>{t&&t.length>0&&ne(t)},{immediate:!0,deep:!0});function ne(t){h.accept="",t.forEach(o=>{const l=_.fileTypeMap[o]||"";l&&(h.accept&&(h.accept+=","),h.accept+=l)})}a(ne,"updateFileAccept");function E(t){const{formRuleFunc:o,formValidateFunc:l}=e.toRefs(n==null?void 0:n.item);if(o&&o.value instanceof Function&&l&&l.value instanceof Function){const r=o.value(),{message:u}=r;r.message=t,l.value(),r.message=u}T("uploadErrorFunc",t)}a(E,"validateForm");function oe(t,o){if(s.value=!1,n.onExceed)return n.onExceed(t,o);const l=`当前限制选择 ${g.limit} 个文件,本次选择了 ${t.length} 个文件,共选择了 ${t.length+o.length} 个文件`||Q.value;P.value?setTimeout(()=>{L.ElMessage.warning(l)},200):E(l)}a(oe,"onExceedAction");function le(t){if(n.beforeUpload){const l=n.beforeUpload(t);return l&&m.value&&!k.value&&q(),l}const o=R(t,!0);return o&&y.value&&m.value&&!k.value&&q(),o}a(le,"beforeUploadAction");function R(t,o){let l=!0;const{size:r,name:u}=t,c=C.value.length>0&&!D(u);let d=!1;switch($.value){case"KB":d=r/1024>B.value;break;case"MB":d=r/1024/1024>B.value;break;default:d=r/1024/1024/1024>B.value;break}if(c){const v=Y.value||`上传文件 ${t.name} 只能是 ${C.value.filter(pe=>pe).join(",").toLocaleLowerCase()} 格式!`;P.value&&o?setTimeout(()=>{L.ElMessage.error(v)},200):E(v),l=!1}if(d){const v=J.value||`上传文件 ${t.name} 大小不能超过 ${B.value}${$.value}!`;P.value&&o?setTimeout(()=>{L.ElMessage.error(v)},200):E(v),l=!1}if(w.value&&!D(u,_.IMG_SUFFIX_LIST)){const v=`上传文件 ${t.name} 不是图片格式的文件!`;P.value&&o?setTimeout(()=>{L.ElMessage.error(v)},200):E(v),l=!1}return l}a(R,"validateUploadFile");function D(t,o){let l=[];if(C.value.length>0?l=C.value:o&&(l=o),l.length<=0)return!0;for(let r=0;r<l.length;r++){const u=(l[r]||"").toLowerCase();if(t.toLowerCase().endsWith(u))return!0}return!1}a(D,"fileTypeMatch");function q(t,o){i.uploadFileList.splice(t||0,o||i.uploadFileList.length-1)}a(q,"updateCoverFileList");function ie(t,o){i.uploadFileList=o;const l=t.raw&&R(t.raw,!y.value);if(l&&m.value&&!k.value&&q(),n.onChange)return n.onChange(t,o);const{size:r}=t;if(r<=0){I();const u=K.value||"禁止上传空文件,请检查后重新上传!";P.value?L.ElMessage.error(u):E(u);return}t.raw&&(!y.value&&!l?I():(t.blob=URL.createObjectURL(t.raw)||"",T("onChangeFunc",t)))}a(ie,"onChangeAction");function I(){let t=0;i.uploadFileList.length>1&&(t=i.uploadFileList.length-1),q(t,1),T("onChangeFunc",{})}a(I,"setChangeRes");function re(t,o,l){s.value=!1,i.initUploadStatus=!1;const{formRuleFunc:r,formValidateFunc:u}=e.toRefs(n==null?void 0:n.item);if(r&&r.value instanceof Function&&u&&u.value instanceof Function&&u.value(),n.onSuccess)return n.onSuccess(t,o,l)}a(re,"onSuccessAction");function ae(t,o,l){if(s.value=!1,n.onError)return n.onError(t,o,l)}a(ae,"onErrorAction");function ue(t,o){if(i.initUploadStatus=!o.length,i.uploadFileList=i.uploadFileList.filter(l=>l.uid===t.uid||l.name===t.name?null:l),n.onRemove)return n.onRemove(t,o)}a(ue,"onRemoveAction");function se(t){if(n.onPreview)return n.onPreview(t);const{raw:o,url:l,blob:r,name:u}=t,{type:c}=o||{};o?S.value&&S.value.length>0?c!=null&&c.startsWith("image")?(i.typePreview="image",i.sourcePreview=w.value?[l]:[r],i.showPreview=!0):S.value.includes("pdf")&&c=="application/pdf"?(i.typePreview="pdf",i.sourcePreview=r,i.showPreview=!0):S.value.includes("xlsx")&&["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"].includes(c)?(i.typePreview="xlsx",fetch(r).then(d=>d.blob()).then(d=>{i.sourcePreview=new File([d],u,{type:c}),i.showPreview=!0})):S.value.includes("docx")&&c=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"&&(i.typePreview="docx",fetch(r).then(d=>d.blob()).then(d=>d.arrayBuffer()).then(d=>{i.sourcePreview=d,i.showPreview=!0})):w.value&&c!=null&&c.startsWith("image")&&(i.typePreview="image",i.sourcePreview=[l],i.showPreview=!0):w.value&&(i.typePreview="image",i.sourcePreview=[l],i.showPreview=!0)}a(se,"onPreviewAction");async function ce(t){const{file:o}=t;if(!o)return;const{size:l}=o;if(l<=0||!R(o,!1))return;if(n.httpRequest)return n.httpRequest(t);const r=new FormData;if(r.append("file",o),A.value instanceof Function){s.value=!0;let u={};try{u=await A.value(r)}catch(c){u=c}finally{s.value=!1,T("httpResponseFunc",u)}}}a(ce,"httpRequestAction");function O(){let t=!1;for(let o=0;o<i.uploadFileList.length;o++)if(i.uploadFileList[o].status===_.UPLOAD_STATUS_MAP.ready){t=!0;break}return t}a(O,"hasReadyFile");function j(){var t;(t=f==null?void 0:f.value)==null||t.submit()}a(j,"comfirmUpload");function de(t){f==null||f.value.handleRemove(t)}a(de,"removeFile");function fe(){i.uploadFileList.forEach(t=>{var o;if(t)try{(o=f==null?void 0:f.value)==null||o.abort(t),de(t)}catch{}})}a(fe,"cancelUpload");function me(){s.value=!0}a(me,"onProgressAction");function ve(){i.showPreview=!1,i.sourcePreview=""}return a(ve,"closePreview"),M({uploadRef:f}),(t,o)=>{const l=ke.ElAvatar,r=ye.ElUpload,u=e.resolveComponent("LSPreview");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(H),e.unref(x)?"ls-upload-drag":"",e.unref(z)?"ls-profile":"",e.unref(Z)?"hide-cover-btn":""])},[e.createVNode(r,e.mergeProps({ref_key:"uploadRef",ref:f},Object.assign(e.unref(h),t.$attrs),{"on-exceed":oe,"before-upload":le,"on-change":ie,"on-success":re,"on-error":ae,"on-remove":ue,"on-preview":se,"on-progress":me}),e.createSlots({trigger:e.withCtx(()=>[e.unref(z)?t.item.defProfile&&e.unref(i).uploadFileList.length<1?(e.openBlock(),e.createBlock(l,{key:1,size:60,src:t.item.defProfile,fit:"contain"},null,8,["src"])):e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(U).trigger?e.renderSlot(t.$slots,"trigger",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(x)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(s)?(e.openBlock(),e.createBlock(b.default,{key:0,text:"",loading:e.unref(s),disabled:e.unref(F)},null,8,["loading","disabled"])):(e.openBlock(),e.createBlock(W.default,{key:1,class:"upload-icon",name:"UploadFilled",size:"56",color:"#E7E7E7"})),e.createElementVNode("div",be,[e.createElementVNode("div",Pe,e.toDisplayString(e.unref(N)),1),e.unref(s)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" / "),Ce],64))])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(w)?(e.openBlock(),e.createElementBlock("div",Be,[e.unref(s)?(e.openBlock(),e.createBlock(b.default,{key:0,text:"",loading:e.unref(s),disabled:e.unref(F)},null,8,["loading","disabled"])):(e.openBlock(),e.createBlock(W.default,{key:1,class:"upload-btn-plus",name:"Plus",size:28,color:e.unref(i).iconColor},null,8,["color"])),e.createElementVNode("div",null,e.toDisplayString(e.unref(N)),1)])):(e.openBlock(),e.createBlock(b.default,{key:1,plain:"",icon:"upload",loading:e.unref(s),disabled:e.unref(F)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(N)),1)]),_:1},8,["loading","disabled"]))],64))],64))],64))]),default:e.withCtx(()=>[e.unref(U).default?e.renderSlot(t.$slots,"default",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[!e.unref(y)&&(e.unref(X)||e.unref(x))?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["upload-btn-handle",[e.unref(x)?"drag-css":"nor-css",!e.unref(m)||e.unref(k)?"multi-css":""]])},[e.unref(x)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[!e.unref(m)||e.unref(k)?(e.openBlock(),e.createBlock(b.default,{key:0,type:"primary",loading:e.unref(s),disabled:e.unref(F),onClick:fe,class:"ls-upload-btn-com ls-upload-btn-cancel"},{default:e.withCtx(()=>[e.createTextVNode("取消上传")]),_:1},8,["loading","disabled"])):e.createCommentVNode("",!0),e.createVNode(b.default,{class:e.normalizeClass(["start-upload ls-upload-btn-com ls-upload-btn-comfirm",{"is-ready":O()}]),type:"primary",loading:e.unref(s),disabled:e.unref(F),onClick:j},{default:e.withCtx(()=>[e.createTextVNode("开始上传")]),_:1},8,["class","loading","disabled"])],64)):(e.openBlock(),e.createBlock(b.default,{key:0,type:"primary",class:e.normalizeClass(["ls-upload-btn-com ls-upload-btn-comfirm",{"is-ready":O()}]),loading:e.unref(s),disabled:e.unref(F),onClick:j},{default:e.withCtx(()=>[e.createTextVNode("开始上传 ")]),_:1},8,["class","loading","disabled"]))],2)):e.createCommentVNode("",!0)],64))]),tip:e.withCtx(()=>[e.unref(U).tip?e.renderSlot(t.$slots,"tip",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock("div",xe,e.toDisplayString(e.unref(te)||e.unref(ee)),1))]),_:2},[e.unref(U).file?{name:"file",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"file",{},void 0,!0)]),key:"0"}:void 0]),1040),e.createVNode(u,{modelValue:e.unref(i).showPreview,"onUpdate:modelValue":o[0]||(o[0]=c=>e.unref(i).showPreview=c),"on-close":ve,type:e.unref(i).typePreview,source:e.unref(i).sourcePreview},null,8,["modelValue","type","source"])],2)}}});exports.default=Se;
|
|
1
|
+
"use strict";var ge=Object.defineProperty;var a=(p,M)=>ge(p,"name",{value:M,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});;/* empty css */;/* empty css */;/* empty css */;/* empty css */const e=require("vue"),_=,/* empty css */he=,/* empty css */we=,/* empty css */P=,/* empty css */W=;/* empty css */;/* empty css */;/* empty css */const L=,/* empty css */ke=,/* empty css */ye=,/* empty css */Fe=a(p=>(e.pushScopeId("data-v-32f99b7f"),p=p(),e.popScopeId(),p),"_withScopeId"),be={class:"ls-drag"},Pe={class:"drag-txt ls-color-brand6"},Ce=Fe(()=>e.createElementVNode("div",{class:"drag-txt ls-color-text2"},"拖拽到此区域",-1)),Be={key:0,class:"btn-picture-card"},xe={key:0,class:"ls-tip"},Se=e.defineComponent({name:"LSUpload",inheritAttrs:!1,__name:"Index",props:_.lsUploadProps,emits:["uploadErrorFunc","onChangeFunc","httpResponseFunc"],setup(p,{expose:M,emit:G}){const U=e.useSlots(),g=e.useAttrs(),H=we.useNamespace("upload").b(),f=e.ref(),s=e.ref(!1),h=e.reactive({isCover:!0,accept:"",disabled:!1}),i=e.reactive({uploadFileList:[],initUploadStatus:!0,showPreview:!1,typePreview:"",sourcePreview:"",iconColor:he.getVariable("colorText1")}),n=p,T=G;e.watch(()=>g["file-list"],t=>{i.uploadFileList=t||[]},{immediate:!0,deep:!0});const C=e.computed(()=>{var t,o;return(((t=n==null?void 0:n.item)==null?void 0:t.isToast)||typeof((o=n==null?void 0:n.item)==null?void 0:o.isToast))==="undefined"}),m=e.computed(()=>{var o;const t=(o=n==null?void 0:n.item)==null?void 0:o.isCover;return typeof t>"u"?!0:t}),k=e.computed(()=>g.multiple),y=e.computed(()=>{const t=g["auto-upload"];return typeof t>"u"?!0:t}),K=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.emptyFileMsg)||""}),N=e.computed(()=>g["list-type"]),w=e.computed(()=>N.value===_.UPLOAD_TYPE_MAP.picCard),X=e.computed(()=>!N.value||N.value=="text"),B=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.limitFile)||[]}),Y=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.limitFileMsg)||""}),x=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.limitSize)||2}),J=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.limitSizeMsg)||""}),V=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.limitUnit)||"MB"}),Q=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.limitNumMsg)||""}),z=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.profile)||!1}),S=e.computed(()=>g.drag),Z=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.hideCoverBtn)&&m.value&&i.uploadFileList.length>0}),F=e.computed(()=>g.disabled),$=e.computed(()=>{const t=w.value?"图片":"文件";let o=`选择${t}`;return s.value?o="正在上传...":m.value&&!k.value?y.value?i.initUploadStatus?o="点击上传":o="重新上传":i.initUploadStatus?o=`选择${t}`:o="重新上传":y.value&&(o="点击上传"),o}),ee=e.computed(()=>{let t="不限制上传格式,";return w.value&&(t="文件须为图片格式,"),`${t}文件大小不超过${x.value}${V.value}`}),te=e.computed(()=>{var t;return((t=n==null?void 0:n.item)==null?void 0:t.tipContent)||""}),A=e.computed(()=>{var t;return(t=n==null?void 0:n.item)==null?void 0:t.httpRequestFunc}),b=e.computed(()=>{var t;return(t=n==null?void 0:n.item)==null?void 0:t.textPreview});e.watch([m,A],([t,o])=>{h.isCover=t,o&&o instanceof Function&&(h["http-request"]=ce)},{immediate:!0,deep:!0}),e.watch(()=>B.value,t=>{t&&t.length>0&&ne(t)},{immediate:!0,deep:!0});function ne(t){h.accept="",t.forEach(o=>{const l=_.fileTypeMap[o]||"";l&&(h.accept&&(h.accept+=","),h.accept+=l)})}a(ne,"updateFileAccept");function E(t){const{formRuleFunc:o,formValidateFunc:l}=e.toRefs(n==null?void 0:n.item);if(o&&o.value instanceof Function&&l&&l.value instanceof Function){const r=o.value(),{message:u}=r;r.message=t,l.value(),r.message=u}T("uploadErrorFunc",t)}a(E,"validateForm");function oe(t,o){if(s.value=!1,n.onExceed)return n.onExceed(t,o);const l=`当前限制选择 ${g.limit} 个文件,本次选择了 ${t.length} 个文件,共选择了 ${t.length+o.length} 个文件`||Q.value;C.value?setTimeout(()=>{L.ElMessage.warning(l)},200):E(l)}a(oe,"onExceedAction");function le(t){if(n.beforeUpload){const l=n.beforeUpload(t);return l&&m.value&&!k.value&&q(),l}const o=R(t,!0);return o&&y.value&&m.value&&!k.value&&q(),o}a(le,"beforeUploadAction");function R(t,o){let l=!0;const{size:r,name:u}=t,c=B.value.length>0&&!D(u);let d=!1;switch(V.value){case"KB":d=r/1024>x.value;break;case"MB":d=r/1024/1024>x.value;break;default:d=r/1024/1024/1024>x.value;break}if(c){const v=Y.value||`上传文件 ${t.name} 只能是 ${B.value.filter(pe=>pe).join(",").toLocaleLowerCase()} 格式!`;C.value&&o?setTimeout(()=>{L.ElMessage.error(v)},200):E(v),l=!1}if(d){const v=J.value||`上传文件 ${t.name} 大小不能超过 ${x.value}${V.value}!`;C.value&&o?setTimeout(()=>{L.ElMessage.error(v)},200):E(v),l=!1}if(w.value&&!D(u,_.IMG_SUFFIX_LIST)){const v=`上传文件 ${t.name} 不是图片格式的文件!`;C.value&&o?setTimeout(()=>{L.ElMessage.error(v)},200):E(v),l=!1}return l}a(R,"validateUploadFile");function D(t,o){let l=[];if(B.value.length>0?l=B.value:o&&(l=o),l.length<=0)return!0;for(let r=0;r<l.length;r++){const u=(l[r]||"").toLowerCase();if(t.toLowerCase().endsWith(u))return!0}return!1}a(D,"fileTypeMatch");function q(t,o){i.uploadFileList.splice(t||0,o||i.uploadFileList.length-1)}a(q,"updateCoverFileList");function ie(t,o){i.uploadFileList=o;const l=t.raw&&R(t.raw,!y.value);if(l&&m.value&&!k.value&&q(),n.onChange)return n.onChange(t,o);const{size:r}=t;if(r<=0){I();const u=K.value||"禁止上传空文件,请检查后重新上传!";C.value?L.ElMessage.error(u):E(u);return}t.raw&&(!y.value&&!l?I():(t.blob=URL.createObjectURL(t.raw)||"",T("onChangeFunc",t)))}a(ie,"onChangeAction");function I(){let t=0;i.uploadFileList.length>1&&(t=i.uploadFileList.length-1),q(t,1),T("onChangeFunc",{})}a(I,"setChangeRes");function re(t,o,l){s.value=!1,i.initUploadStatus=!1;const{formRuleFunc:r,formValidateFunc:u}=e.toRefs(n==null?void 0:n.item);if(r&&r.value instanceof Function&&u&&u.value instanceof Function&&u.value(),n.onSuccess)return n.onSuccess(t,o,l)}a(re,"onSuccessAction");function ae(t,o,l){if(s.value=!1,n.onError)return n.onError(t,o,l)}a(ae,"onErrorAction");function ue(t,o){if(i.initUploadStatus=!o.length,i.uploadFileList=i.uploadFileList.filter(l=>l.uid===t.uid||l.name===t.name?null:l),n.onRemove)return n.onRemove(t,o)}a(ue,"onRemoveAction");function se(t){if(n.onPreview)return n.onPreview(t);const{raw:o,url:l,blob:r,name:u}=t,{type:c}=o||{};o?b.value&&b.value.length>0?c!=null&&c.startsWith("image")?(i.typePreview="image",i.sourcePreview=w.value?[l]:[r],i.showPreview=!0):c=="application/pdf"?b.value.includes("pdf")?(i.typePreview="pdf",i.sourcePreview=r,i.showPreview=!0):b.value.includes("pdfNative")&&r&&window.open(r,"_blank"):b.value.includes("xlsx")&&["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"].includes(c)?(i.typePreview="xlsx",fetch(r).then(d=>d.blob()).then(d=>{i.sourcePreview=new File([d],u,{type:c}),i.showPreview=!0})):b.value.includes("docx")&&c=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"&&(i.typePreview="docx",fetch(r).then(d=>d.blob()).then(d=>d.arrayBuffer()).then(d=>{i.sourcePreview=d,i.showPreview=!0})):w.value&&c!=null&&c.startsWith("image")&&(i.typePreview="image",i.sourcePreview=[l],i.showPreview=!0):w.value&&(i.typePreview="image",i.sourcePreview=[l],i.showPreview=!0)}a(se,"onPreviewAction");async function ce(t){const{file:o}=t;if(!o)return;const{size:l}=o;if(l<=0||!R(o,!1))return;if(n.httpRequest)return n.httpRequest(t);const r=new FormData;if(r.append("file",o),A.value instanceof Function){s.value=!0;let u={};try{u=await A.value(r)}catch(c){u=c}finally{s.value=!1,T("httpResponseFunc",u)}}}a(ce,"httpRequestAction");function O(){let t=!1;for(let o=0;o<i.uploadFileList.length;o++)if(i.uploadFileList[o].status===_.UPLOAD_STATUS_MAP.ready){t=!0;break}return t}a(O,"hasReadyFile");function j(){var t;(t=f==null?void 0:f.value)==null||t.submit()}a(j,"comfirmUpload");function de(t){f==null||f.value.handleRemove(t)}a(de,"removeFile");function fe(){i.uploadFileList.forEach(t=>{var o;if(t)try{(o=f==null?void 0:f.value)==null||o.abort(t),de(t)}catch{}})}a(fe,"cancelUpload");function me(){s.value=!0}a(me,"onProgressAction");function ve(){i.showPreview=!1,i.sourcePreview=""}return a(ve,"closePreview"),M({uploadRef:f}),(t,o)=>{const l=ke.ElAvatar,r=ye.ElUpload,u=e.resolveComponent("LSPreview");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(H),e.unref(S)?"ls-upload-drag":"",e.unref(z)?"ls-profile":"",e.unref(Z)?"hide-cover-btn":""])},[e.createVNode(r,e.mergeProps({ref_key:"uploadRef",ref:f},Object.assign(e.unref(h),t.$attrs),{"on-exceed":oe,"before-upload":le,"on-change":ie,"on-success":re,"on-error":ae,"on-remove":ue,"on-preview":se,"on-progress":me}),e.createSlots({trigger:e.withCtx(()=>[e.unref(z)?t.item.defProfile&&e.unref(i).uploadFileList.length<1?(e.openBlock(),e.createBlock(l,{key:1,size:60,src:t.item.defProfile,fit:"contain"},null,8,["src"])):e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(U).trigger?e.renderSlot(t.$slots,"trigger",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(S)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(s)?(e.openBlock(),e.createBlock(P.default,{key:0,text:"",loading:e.unref(s),disabled:e.unref(F)},null,8,["loading","disabled"])):(e.openBlock(),e.createBlock(W.default,{key:1,class:"upload-icon",name:"UploadFilled",size:"56",color:"#E7E7E7"})),e.createElementVNode("div",be,[e.createElementVNode("div",Pe,e.toDisplayString(e.unref($)),1),e.unref(s)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" / "),Ce],64))])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(w)?(e.openBlock(),e.createElementBlock("div",Be,[e.unref(s)?(e.openBlock(),e.createBlock(P.default,{key:0,text:"",loading:e.unref(s),disabled:e.unref(F)},null,8,["loading","disabled"])):(e.openBlock(),e.createBlock(W.default,{key:1,class:"upload-btn-plus",name:"Plus",size:28,color:e.unref(i).iconColor},null,8,["color"])),e.createElementVNode("div",null,e.toDisplayString(e.unref($)),1)])):(e.openBlock(),e.createBlock(P.default,{key:1,plain:"",icon:"upload",loading:e.unref(s),disabled:e.unref(F)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref($)),1)]),_:1},8,["loading","disabled"]))],64))],64))],64))]),default:e.withCtx(()=>[e.unref(U).default?e.renderSlot(t.$slots,"default",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[!e.unref(y)&&(e.unref(X)||e.unref(S))?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["upload-btn-handle",[e.unref(S)?"drag-css":"nor-css",!e.unref(m)||e.unref(k)?"multi-css":""]])},[e.unref(S)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[!e.unref(m)||e.unref(k)?(e.openBlock(),e.createBlock(P.default,{key:0,type:"primary",loading:e.unref(s),disabled:e.unref(F),onClick:fe,class:"ls-upload-btn-com ls-upload-btn-cancel"},{default:e.withCtx(()=>[e.createTextVNode("取消上传")]),_:1},8,["loading","disabled"])):e.createCommentVNode("",!0),e.createVNode(P.default,{class:e.normalizeClass(["start-upload ls-upload-btn-com ls-upload-btn-comfirm",{"is-ready":O()}]),type:"primary",loading:e.unref(s),disabled:e.unref(F),onClick:j},{default:e.withCtx(()=>[e.createTextVNode("开始上传")]),_:1},8,["class","loading","disabled"])],64)):(e.openBlock(),e.createBlock(P.default,{key:0,type:"primary",class:e.normalizeClass(["ls-upload-btn-com ls-upload-btn-comfirm",{"is-ready":O()}]),loading:e.unref(s),disabled:e.unref(F),onClick:j},{default:e.withCtx(()=>[e.createTextVNode("开始上传 ")]),_:1},8,["class","loading","disabled"]))],2)):e.createCommentVNode("",!0)],64))]),tip:e.withCtx(()=>[e.unref(U).tip?e.renderSlot(t.$slots,"tip",{key:1},void 0,!0):(e.openBlock(),e.createElementBlock("div",xe,e.toDisplayString(e.unref(te)||e.unref(ee)),1))]),_:2},[e.unref(U).file?{name:"file",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"file",{},void 0,!0)]),key:"0"}:void 0]),1040),e.createVNode(u,{modelValue:e.unref(i).showPreview,"onUpdate:modelValue":o[0]||(o[0]=c=>e.unref(i).showPreview=c),"on-close":ve,type:e.unref(i).typePreview,source:e.unref(i).sourcePreview},null,8,["modelValue","type","source"])],2)}}});exports.default=Se;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var Te = Object.defineProperty;
|
|
2
|
-
var r = (
|
|
2
|
+
var r = (b, W) => Te(b, "name", { value: W, configurable: !0 });
|
|
3
3
|
/* empty css */
|
|
4
4
|
/* empty css */
|
|
5
5
|
/* empty css */
|
|
@@ -8,14 +8,14 @@ import { defineComponent as $e, useSlots as Me, useAttrs as Re, ref as ne, react
|
|
|
8
8
|
import { lsUploadProps as Ne, UPLOAD_TYPE_MAP as qe, fileTypeMap as Oe, UPLOAD_STATUS_MAP as je, IMG_SUFFIX_LIST as We } from "../types/index.js";
|
|
9
9
|
import { getVariable as Ge } from "../../_utils/config/index.js";
|
|
10
10
|
import { useNamespace as He } from "../../_hooks/useNamespace/index.js";
|
|
11
|
-
import
|
|
11
|
+
import U from "../../button/Button.vue/index.js";
|
|
12
12
|
import se from "../../icon/Index.vue/index.js";
|
|
13
13
|
/* empty css */
|
|
14
14
|
/* empty css */
|
|
15
15
|
import { ElMessage as z } from "../../../../../node_modules/.pnpm/element-plus@2.8.1_vue@3.4.38_typescript@5.5.4_/node_modules/element-plus/es/components/message/index/index.js";
|
|
16
16
|
import { ElAvatar as Ke } from "../../../../../node_modules/.pnpm/element-plus@2.8.1_vue@3.4.38_typescript@5.5.4_/node_modules/element-plus/es/components/avatar/index/index.js";
|
|
17
17
|
import { ElUpload as Xe } from "../../../../../node_modules/.pnpm/element-plus@2.8.1_vue@3.4.38_typescript@5.5.4_/node_modules/element-plus/es/components/upload/index/index.js";
|
|
18
|
-
const Ye = /* @__PURE__ */ r((
|
|
18
|
+
const Ye = /* @__PURE__ */ r((b) => (Ve("data-v-32f99b7f"), b = b(), De(), b), "_withScopeId"), Je = { class: "ls-drag" }, Qe = { class: "drag-txt ls-color-brand6" }, Ze = /* @__PURE__ */ Ye(() => /* @__PURE__ */ j("div", { class: "drag-txt ls-color-text2" }, "拖拽到此区域", -1)), et = {
|
|
19
19
|
key: 0,
|
|
20
20
|
class: "btn-picture-card"
|
|
21
21
|
}, tt = {
|
|
@@ -27,8 +27,8 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
27
27
|
__name: "Index",
|
|
28
28
|
props: Ne,
|
|
29
29
|
emits: ["uploadErrorFunc", "onChangeFunc", "httpResponseFunc"],
|
|
30
|
-
setup(
|
|
31
|
-
const B = Me(),
|
|
30
|
+
setup(b, { expose: W, emit: re }) {
|
|
31
|
+
const B = Me(), F = Re(), ue = He("upload").b(), v = ne(), d = ne(!1), P = le({
|
|
32
32
|
isCover: !0,
|
|
33
33
|
accept: "",
|
|
34
34
|
disabled: !1
|
|
@@ -39,9 +39,9 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
39
39
|
typePreview: "",
|
|
40
40
|
sourcePreview: "",
|
|
41
41
|
iconColor: Ge("colorText1")
|
|
42
|
-
}), t =
|
|
42
|
+
}), t = b, I = re;
|
|
43
43
|
J(
|
|
44
|
-
() =>
|
|
44
|
+
() => F["file-list"],
|
|
45
45
|
(e) => {
|
|
46
46
|
l.uploadFileList = e || [];
|
|
47
47
|
},
|
|
@@ -50,26 +50,26 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
50
50
|
deep: !0
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
|
-
const
|
|
53
|
+
const A = s(() => {
|
|
54
54
|
var e, i;
|
|
55
55
|
return (((e = t == null ? void 0 : t.item) == null ? void 0 : e.isToast) || typeof ((i = t == null ? void 0 : t.item) == null ? void 0 : i.isToast)) === "undefined";
|
|
56
56
|
}), g = s(() => {
|
|
57
57
|
var i;
|
|
58
58
|
const e = (i = t == null ? void 0 : t.item) == null ? void 0 : i.isCover;
|
|
59
59
|
return typeof e > "u" ? !0 : e;
|
|
60
|
-
}), C = s(() =>
|
|
61
|
-
const e =
|
|
60
|
+
}), C = s(() => F.multiple), _ = s(() => {
|
|
61
|
+
const e = F["auto-upload"];
|
|
62
62
|
return typeof e > "u" ? !0 : e;
|
|
63
63
|
}), ce = s(() => {
|
|
64
64
|
var e;
|
|
65
65
|
return ((e = t == null ? void 0 : t.item) == null ? void 0 : e.emptyFileMsg) || "";
|
|
66
|
-
}), G = s(() =>
|
|
66
|
+
}), G = s(() => F["list-type"]), k = s(() => G.value === qe.picCard), de = s(() => !G.value || G.value == "text"), E = s(() => {
|
|
67
67
|
var e;
|
|
68
68
|
return ((e = t == null ? void 0 : t.item) == null ? void 0 : e.limitFile) || [];
|
|
69
69
|
}), fe = s(() => {
|
|
70
70
|
var e;
|
|
71
71
|
return ((e = t == null ? void 0 : t.item) == null ? void 0 : e.limitFileMsg) || "";
|
|
72
|
-
}),
|
|
72
|
+
}), T = s(() => {
|
|
73
73
|
var e;
|
|
74
74
|
return ((e = t == null ? void 0 : t.item) == null ? void 0 : e.limitSize) || 2;
|
|
75
75
|
}), me = s(() => {
|
|
@@ -84,37 +84,37 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
84
84
|
}), Z = s(() => {
|
|
85
85
|
var e;
|
|
86
86
|
return ((e = t == null ? void 0 : t.item) == null ? void 0 : e.profile) || !1;
|
|
87
|
-
}),
|
|
87
|
+
}), $ = s(() => F.drag), pe = s(() => {
|
|
88
88
|
var e;
|
|
89
89
|
return ((e = t == null ? void 0 : t.item) == null ? void 0 : e.hideCoverBtn) && g.value && l.uploadFileList.length > 0;
|
|
90
|
-
}),
|
|
90
|
+
}), L = s(() => F.disabled), K = s(() => {
|
|
91
91
|
const e = k.value ? "图片" : "文件";
|
|
92
92
|
let i = `选择${e}`;
|
|
93
|
-
return d.value ? i = "正在上传..." : g.value && !C.value ?
|
|
93
|
+
return d.value ? i = "正在上传..." : g.value && !C.value ? _.value ? l.initUploadStatus ? i = "点击上传" : i = "重新上传" : l.initUploadStatus ? i = `选择${e}` : i = "重新上传" : _.value && (i = "点击上传"), i;
|
|
94
94
|
}), ge = s(() => {
|
|
95
95
|
let e = "不限制上传格式,";
|
|
96
|
-
return k.value && (e = "文件须为图片格式,"), `${e}文件大小不超过${
|
|
96
|
+
return k.value && (e = "文件须为图片格式,"), `${e}文件大小不超过${T.value}${H.value}`;
|
|
97
97
|
}), he = s(() => {
|
|
98
98
|
var e;
|
|
99
99
|
return ((e = t == null ? void 0 : t.item) == null ? void 0 : e.tipContent) || "";
|
|
100
100
|
}), X = s(() => {
|
|
101
101
|
var e;
|
|
102
102
|
return (e = t == null ? void 0 : t.item) == null ? void 0 : e.httpRequestFunc;
|
|
103
|
-
}),
|
|
103
|
+
}), x = s(() => {
|
|
104
104
|
var e;
|
|
105
105
|
return (e = t == null ? void 0 : t.item) == null ? void 0 : e.textPreview;
|
|
106
106
|
});
|
|
107
107
|
J(
|
|
108
108
|
[g, X],
|
|
109
109
|
([e, i]) => {
|
|
110
|
-
P.isCover = e, i && i instanceof Function && (P["http-request"] =
|
|
110
|
+
P.isCover = e, i && i instanceof Function && (P["http-request"] = _e);
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
immediate: !0,
|
|
114
114
|
deep: !0
|
|
115
115
|
}
|
|
116
116
|
), J(
|
|
117
|
-
() =>
|
|
117
|
+
() => E.value,
|
|
118
118
|
(e) => {
|
|
119
119
|
e && e.length > 0 && we(e);
|
|
120
120
|
},
|
|
@@ -142,51 +142,51 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
142
142
|
function ye(e, i) {
|
|
143
143
|
if (d.value = !1, t.onExceed)
|
|
144
144
|
return t.onExceed(e, i);
|
|
145
|
-
const n = `当前限制选择 ${
|
|
146
|
-
|
|
145
|
+
const n = `当前限制选择 ${F.limit} 个文件,本次选择了 ${e.length} 个文件,共选择了 ${e.length + i.length} 个文件` || ve.value;
|
|
146
|
+
A.value ? setTimeout(() => {
|
|
147
147
|
z.warning(n);
|
|
148
148
|
}, 200) : M(n);
|
|
149
149
|
}
|
|
150
150
|
r(ye, "onExceedAction");
|
|
151
|
-
function
|
|
151
|
+
function be(e) {
|
|
152
152
|
if (t.beforeUpload) {
|
|
153
153
|
const n = t.beforeUpload(e);
|
|
154
154
|
return n && g.value && !C.value && V(), n;
|
|
155
155
|
}
|
|
156
156
|
const i = Y(e, !0);
|
|
157
|
-
return i &&
|
|
157
|
+
return i && _.value && g.value && !C.value && V(), i;
|
|
158
158
|
}
|
|
159
|
-
r(
|
|
159
|
+
r(be, "beforeUploadAction");
|
|
160
160
|
function Y(e, i) {
|
|
161
161
|
let n = !0;
|
|
162
|
-
const { size: a, name: u } = e, f =
|
|
162
|
+
const { size: a, name: u } = e, f = E.value.length > 0 && !ee(u);
|
|
163
163
|
let m = !1;
|
|
164
164
|
switch (H.value) {
|
|
165
165
|
case "KB":
|
|
166
|
-
m = a / 1024 >
|
|
166
|
+
m = a / 1024 > T.value;
|
|
167
167
|
break;
|
|
168
168
|
case "MB":
|
|
169
|
-
m = a / 1024 / 1024 >
|
|
169
|
+
m = a / 1024 / 1024 > T.value;
|
|
170
170
|
break;
|
|
171
171
|
default:
|
|
172
|
-
m = a / 1024 / 1024 / 1024 >
|
|
172
|
+
m = a / 1024 / 1024 / 1024 > T.value;
|
|
173
173
|
break;
|
|
174
174
|
}
|
|
175
175
|
if (f) {
|
|
176
|
-
const h = fe.value || `上传文件 ${e.name} 只能是 ${
|
|
177
|
-
|
|
176
|
+
const h = fe.value || `上传文件 ${e.name} 只能是 ${E.value.filter((Ee) => Ee).join(",").toLocaleLowerCase()} 格式!`;
|
|
177
|
+
A.value && i ? setTimeout(() => {
|
|
178
178
|
z.error(h);
|
|
179
179
|
}, 200) : M(h), n = !1;
|
|
180
180
|
}
|
|
181
181
|
if (m) {
|
|
182
|
-
const h = me.value || `上传文件 ${e.name} 大小不能超过 ${
|
|
183
|
-
|
|
182
|
+
const h = me.value || `上传文件 ${e.name} 大小不能超过 ${T.value}${H.value}!`;
|
|
183
|
+
A.value && i ? setTimeout(() => {
|
|
184
184
|
z.error(h);
|
|
185
185
|
}, 200) : M(h), n = !1;
|
|
186
186
|
}
|
|
187
187
|
if (k.value && !ee(u, We)) {
|
|
188
188
|
const h = `上传文件 ${e.name} 不是图片格式的文件!`;
|
|
189
|
-
|
|
189
|
+
A.value && i ? setTimeout(() => {
|
|
190
190
|
z.error(h);
|
|
191
191
|
}, 200) : M(h), n = !1;
|
|
192
192
|
}
|
|
@@ -195,7 +195,7 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
195
195
|
r(Y, "validateUploadFile");
|
|
196
196
|
function ee(e, i) {
|
|
197
197
|
let n = [];
|
|
198
|
-
if (
|
|
198
|
+
if (E.value.length > 0 ? n = E.value : i && (n = i), n.length <= 0)
|
|
199
199
|
return !0;
|
|
200
200
|
for (let a = 0; a < n.length; a++) {
|
|
201
201
|
const u = (n[a] || "").toLowerCase();
|
|
@@ -209,21 +209,21 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
209
209
|
l.uploadFileList.splice(e || 0, i || l.uploadFileList.length - 1);
|
|
210
210
|
}
|
|
211
211
|
r(V, "updateCoverFileList");
|
|
212
|
-
function
|
|
212
|
+
function Fe(e, i) {
|
|
213
213
|
l.uploadFileList = i;
|
|
214
|
-
const n = e.raw && Y(e.raw, !
|
|
214
|
+
const n = e.raw && Y(e.raw, !_.value);
|
|
215
215
|
if (n && g.value && !C.value && V(), t.onChange)
|
|
216
216
|
return t.onChange(e, i);
|
|
217
217
|
const { size: a } = e;
|
|
218
218
|
if (a <= 0) {
|
|
219
219
|
te();
|
|
220
220
|
const u = ce.value || "禁止上传空文件,请检查后重新上传!";
|
|
221
|
-
|
|
221
|
+
A.value ? z.error(u) : M(u);
|
|
222
222
|
return;
|
|
223
223
|
}
|
|
224
|
-
e.raw && (!
|
|
224
|
+
e.raw && (!_.value && !n ? te() : (e.blob = URL.createObjectURL(e.raw) || "", I("onChangeFunc", e)));
|
|
225
225
|
}
|
|
226
|
-
r(
|
|
226
|
+
r(Fe, "onChangeAction");
|
|
227
227
|
function te() {
|
|
228
228
|
let e = 0;
|
|
229
229
|
l.uploadFileList.length > 1 && (e = l.uploadFileList.length - 1), V(e, 1), I("onChangeFunc", {});
|
|
@@ -250,14 +250,14 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
250
250
|
if (t.onPreview)
|
|
251
251
|
return t.onPreview(e);
|
|
252
252
|
const { raw: i, url: n, blob: a, name: u } = e, { type: f } = i || {};
|
|
253
|
-
i ?
|
|
253
|
+
i ? x.value && x.value.length > 0 ? f != null && f.startsWith("image") ? (l.typePreview = "image", l.sourcePreview = k.value ? [n] : [a], l.showPreview = !0) : f == "application/pdf" ? x.value.includes("pdf") ? (l.typePreview = "pdf", l.sourcePreview = a, l.showPreview = !0) : x.value.includes("pdfNative") && a && window.open(a, "_blank") : x.value.includes("xlsx") && ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"].includes(f) ? (l.typePreview = "xlsx", fetch(a).then((m) => m.blob()).then((m) => {
|
|
254
254
|
l.sourcePreview = new File([m], u, { type: f }), l.showPreview = !0;
|
|
255
|
-
})) :
|
|
255
|
+
})) : x.value.includes("docx") && f == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" && (l.typePreview = "docx", fetch(a).then((m) => m.blob()).then((m) => m.arrayBuffer()).then((m) => {
|
|
256
256
|
l.sourcePreview = m, l.showPreview = !0;
|
|
257
257
|
})) : k.value && f != null && f.startsWith("image") && (l.typePreview = "image", l.sourcePreview = [n], l.showPreview = !0) : k.value && (l.typePreview = "image", l.sourcePreview = [n], l.showPreview = !0);
|
|
258
258
|
}
|
|
259
259
|
r(Ce, "onPreviewAction");
|
|
260
|
-
async function
|
|
260
|
+
async function _e(e) {
|
|
261
261
|
const { file: i } = e;
|
|
262
262
|
if (!i)
|
|
263
263
|
return;
|
|
@@ -279,7 +279,7 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
|
-
r(
|
|
282
|
+
r(_e, "httpRequestAction");
|
|
283
283
|
function ie() {
|
|
284
284
|
let e = !1;
|
|
285
285
|
for (let i = 0; i < l.uploadFileList.length; i++)
|
|
@@ -295,16 +295,16 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
295
295
|
(e = v == null ? void 0 : v.value) == null || e.submit();
|
|
296
296
|
}
|
|
297
297
|
r(oe, "comfirmUpload");
|
|
298
|
-
function
|
|
298
|
+
function Le(e) {
|
|
299
299
|
v == null || v.value.handleRemove(e);
|
|
300
300
|
}
|
|
301
|
-
r(
|
|
301
|
+
r(Le, "removeFile");
|
|
302
302
|
function xe() {
|
|
303
303
|
l.uploadFileList.forEach((e) => {
|
|
304
304
|
var i;
|
|
305
305
|
if (e)
|
|
306
306
|
try {
|
|
307
|
-
(i = v == null ? void 0 : v.value) == null || i.abort(e),
|
|
307
|
+
(i = v == null ? void 0 : v.value) == null || i.abort(e), Le(e);
|
|
308
308
|
} catch {
|
|
309
309
|
}
|
|
310
310
|
});
|
|
@@ -322,15 +322,15 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
322
322
|
}), (e, i) => {
|
|
323
323
|
const n = Ke, a = Xe, u = ze("LSPreview");
|
|
324
324
|
return c(), p("div", {
|
|
325
|
-
class: D([o(ue), o(
|
|
325
|
+
class: D([o(ue), o($) ? "ls-upload-drag" : "", o(Z) ? "ls-profile" : "", o(pe) ? "hide-cover-btn" : ""])
|
|
326
326
|
}, [
|
|
327
327
|
Q(a, Be({
|
|
328
328
|
ref_key: "uploadRef",
|
|
329
329
|
ref: v
|
|
330
330
|
}, Object.assign(o(P), e.$attrs), {
|
|
331
331
|
"on-exceed": ye,
|
|
332
|
-
"before-upload":
|
|
333
|
-
"on-change":
|
|
332
|
+
"before-upload": be,
|
|
333
|
+
"on-change": Fe,
|
|
334
334
|
"on-success": Pe,
|
|
335
335
|
"on-error": ke,
|
|
336
336
|
"on-remove": Se,
|
|
@@ -345,12 +345,12 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
345
345
|
fit: "contain"
|
|
346
346
|
}, null, 8, ["src"])) : q("", !0) : (c(), p(S, { key: 0 }, [
|
|
347
347
|
o(B).trigger ? O(e.$slots, "trigger", { key: 1 }, void 0, !0) : (c(), p(S, { key: 0 }, [
|
|
348
|
-
o(
|
|
349
|
-
o(d) ? (c(), y(
|
|
348
|
+
o($) ? (c(), p(S, { key: 0 }, [
|
|
349
|
+
o(d) ? (c(), y(U, {
|
|
350
350
|
key: 0,
|
|
351
351
|
text: "",
|
|
352
352
|
loading: o(d),
|
|
353
|
-
disabled: o(
|
|
353
|
+
disabled: o(L)
|
|
354
354
|
}, null, 8, ["loading", "disabled"])) : (c(), y(se, {
|
|
355
355
|
key: 1,
|
|
356
356
|
class: "upload-icon",
|
|
@@ -367,11 +367,11 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
367
367
|
])
|
|
368
368
|
], 64)) : (c(), p(S, { key: 1 }, [
|
|
369
369
|
o(k) ? (c(), p("div", et, [
|
|
370
|
-
o(d) ? (c(), y(
|
|
370
|
+
o(d) ? (c(), y(U, {
|
|
371
371
|
key: 0,
|
|
372
372
|
text: "",
|
|
373
373
|
loading: o(d),
|
|
374
|
-
disabled: o(
|
|
374
|
+
disabled: o(L)
|
|
375
375
|
}, null, 8, ["loading", "disabled"])) : (c(), y(se, {
|
|
376
376
|
key: 1,
|
|
377
377
|
class: "upload-btn-plus",
|
|
@@ -380,12 +380,12 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
380
380
|
color: o(l).iconColor
|
|
381
381
|
}, null, 8, ["color"])),
|
|
382
382
|
j("div", null, N(o(K)), 1)
|
|
383
|
-
])) : (c(), y(
|
|
383
|
+
])) : (c(), y(U, {
|
|
384
384
|
key: 1,
|
|
385
385
|
plain: "",
|
|
386
386
|
icon: "upload",
|
|
387
387
|
loading: o(d),
|
|
388
|
-
disabled: o(
|
|
388
|
+
disabled: o(L)
|
|
389
389
|
}, {
|
|
390
390
|
default: w(() => [
|
|
391
391
|
R(N(o(K)), 1)
|
|
@@ -398,16 +398,16 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
398
398
|
]),
|
|
399
399
|
default: w(() => [
|
|
400
400
|
o(B).default ? O(e.$slots, "default", { key: 1 }, void 0, !0) : (c(), p(S, { key: 0 }, [
|
|
401
|
-
!o(
|
|
401
|
+
!o(_) && (o(de) || o($)) ? (c(), p("div", {
|
|
402
402
|
key: 0,
|
|
403
|
-
class: D(["upload-btn-handle", [o(
|
|
403
|
+
class: D(["upload-btn-handle", [o($) ? "drag-css" : "nor-css", !o(g) || o(C) ? "multi-css" : ""]])
|
|
404
404
|
}, [
|
|
405
|
-
o(
|
|
406
|
-
!o(g) || o(C) ? (c(), y(
|
|
405
|
+
o($) ? (c(), p(S, { key: 1 }, [
|
|
406
|
+
!o(g) || o(C) ? (c(), y(U, {
|
|
407
407
|
key: 0,
|
|
408
408
|
type: "primary",
|
|
409
409
|
loading: o(d),
|
|
410
|
-
disabled: o(
|
|
410
|
+
disabled: o(L),
|
|
411
411
|
onClick: xe,
|
|
412
412
|
class: "ls-upload-btn-com ls-upload-btn-cancel"
|
|
413
413
|
}, {
|
|
@@ -416,11 +416,11 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
416
416
|
]),
|
|
417
417
|
_: 1
|
|
418
418
|
}, 8, ["loading", "disabled"])) : q("", !0),
|
|
419
|
-
Q(
|
|
419
|
+
Q(U, {
|
|
420
420
|
class: D(["start-upload ls-upload-btn-com ls-upload-btn-comfirm", { "is-ready": ie() }]),
|
|
421
421
|
type: "primary",
|
|
422
422
|
loading: o(d),
|
|
423
|
-
disabled: o(
|
|
423
|
+
disabled: o(L),
|
|
424
424
|
onClick: oe
|
|
425
425
|
}, {
|
|
426
426
|
default: w(() => [
|
|
@@ -428,12 +428,12 @@ const Ye = /* @__PURE__ */ r((F) => (Ve("data-v-3d96bfcf"), F = F(), De(), F), "
|
|
|
428
428
|
]),
|
|
429
429
|
_: 1
|
|
430
430
|
}, 8, ["class", "loading", "disabled"])
|
|
431
|
-
], 64)) : (c(), y(
|
|
431
|
+
], 64)) : (c(), y(U, {
|
|
432
432
|
key: 0,
|
|
433
433
|
type: "primary",
|
|
434
434
|
class: D(["ls-upload-btn-com ls-upload-btn-comfirm", { "is-ready": ie() }]),
|
|
435
435
|
loading: o(d),
|
|
436
|
-
disabled: o(
|
|
436
|
+
disabled: o(L),
|
|
437
437
|
onClick: oe
|
|
438
438
|
}, {
|
|
439
439
|
default: w(() => [
|
|
Binary file
|
|
Binary file
|