@jt-home/mfe-components 1.0.8 → 1.0.9

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),L=require("element-plus");/*! Element Plus Icons Vue v2.3.2 */var V=t.defineComponent({name:"Download",__name:"download",setup(e){return(n,a)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z"})]))}}),F=V,X=t.defineComponent({name:"RefreshLeft",__name:"refresh-left",setup(e){return(n,a)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"})]))}}),Z=X,$=t.defineComponent({name:"ZoomIn",__name:"zoom-in",setup(e){return(n,a)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"})]))}}),ee=$,te=t.defineComponent({name:"ZoomOut",__name:"zoom-out",setup(e){return(n,a)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704M352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64"})]))}}),ne=te;const ae="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANgAAADYCAMAAAC+/t3fAAAAaVBMVEUAAABWapNVapKeqsLJztx3hKnGzN2yu8////9XapWcqMGps8lXapVYa5RWaZWps8lfcJjS1+KjrsVXapWapr////9sfaKrtMrV2uWBj7B4iKqWob1wgaXr7fOBj6/Ax9dhc5yhq8OKl7Wba+6tAAAAE3RSTlMAgGDuDyVLoYDe2XuXRb68cy6e4BCQEAAAAyZJREFUeNrt29tyokAUheGOQjIoeMhuCQ4e0Pd/yCE1STU4mGq7bXqzZ/23ufoqYblTqkIIIYQQQggNlM42Lzctf5nMD22bKQYVOQ30sTPt6dEO74mKXLoiCgDTi1RFbUMUBhZXluQUDKbnWxWtjMLB2pYqUjmFg8WUzSg0TL+rCKVZeJheRJj9DYWHRRnHbBSYnr+qcSsoKCyeLKcfK/emc2UqH4LFGMcVWVftTC4w/TbmhGQjwvR6RBmNAbMYx4nD7k/I1GF3ZZOH3RtHAbDhcZQAG5SJgOn1Vt0mAzYwIUJgvjJ/2OVo2pcmcoQZWehxpBGue5sJEQTryyTBeuMoCtadEFmwjkwYzIyjNJief02IONj3OAqE/ZVJhJnZj3RS1c4nld04ijiC/5EJhbUyobBWJhT2OY5CYa1MKKyVCYXpdSIUphdbobB2HIXCWplQmJGFhZUn07kyNaFgbUsx1/1tb1Jh+i1hDmu0Y+uEN4xqV9ki5Q27atfmKWtYqd1lW84wqj1kr5xhB+3RkjGMrl4yxrCm9pG984V5ytZJINj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g8YGGHG/ZUKcS2BI7y9/5j7SsnrXJLjW0otqIbBQisvG5NEiLRxYSl6w4KzE1m3FLonPCG5ugnCLBoN6qUmXQ0Ta/5MWAx+wuVjv1L+K/xHgNmspxSqbAuMcL0DAaMxRopCn2UWPJj+3/NJutXiYGAWaxUI/0qkbndKQhYXJTK50j9wYDF7Me+LQKBVWc2of5gwNis1kzdAYGt3nIJdQcDFpM9DTF1BgQ2u1fja2dAYMHbLqHOgMDCsW352w8iCKweWDHffhBBYOyba2Nabz+IKDB3eFk+36+IILDQXPlQRnpdKLC0d+W9sjMoMN8kJY04woEC+6kbJY05dIMC86OPSaHA0ugREQWWR7tQYP/atZcUBmEoCsNHA4FEBxHvyKJQ7P7X2EGdlHbiNYNjON8OfvIkZP2Zi9tqV7CE2V77TyxL2PdkXJ52GUuYvZbKL1IsYcfr9GPbq2WxhJ2gMIUpTGEcFKYwEgpTGAmFKYyEwhRGQmEKI+EJy3YDCeeNdgOesMH4ZTgk4zfAoxi9GR6dsctwCfRD1sNnNm7HCmtuY8wRH42dZSXCL/CW5QQcmtoax4iLIuOglQkVpIHrPlzGPqCSNE8diT4FiIiIiIjIP2/v9e/hKQXqEwAAAABJRU5ErkJggg==",oe=new Set(["jpg","jpeg","png","gif","webp","bmp","svg","avif","ico"]),ie=new Set(["mp4","webm","ogg","ogv","mov","m4v"]),ce=new Set(["mp3","wav","ogg","oga","m4a","aac","flac"]),le=new Set(["html","htm","txt","json","xml","csv","md","log"]),se=new Set(["doc","docx","xls","xlsx","ppt","pptx","zip","rar","7z"]);let A=null,Y=null,B=null;async function ue(){return Y||(Y=Promise.all([Promise.resolve().then(()=>require("../pdf-Da0bm_Ya.cjs")),Promise.resolve().then(()=>require("../pdf.worker.min-BAJUPwg6.cjs"))]).then(([e,n])=>(e.GlobalWorkerOptions.workerSrc=n.default,e))),Y}function de(e){return typeof e=="string"?{url:e}:e}function U(e){const[n]=e.split(/[?#]/);return n??""}function J(e,n){if(n?.trim())return n.trim();const a=U(e).split("/").filter(Boolean).pop();if(!a)return"附件预览";try{return decodeURIComponent(a)}catch{return a}}function S(e){return U(e).match(/\.([a-z0-9]+)$/i)?.[1]?.toLowerCase()??""}function O(e){const n=e.toLowerCase().split(";")[0]?.trim()??"";return n.startsWith("image/")?"image":n==="application/pdf"?"pdf":n.startsWith("video/")?"video":n.startsWith("audio/")?"audio":n.startsWith("text/")?"iframe":"unknown"}function G(e){if(!e.url.trim())return"empty";if(e.mode&&e.mode!=="auto")return e.mode;if(e.mimeType){const a=O(e.mimeType);if(a!=="unknown")return a}const n=S(e.url);return oe.has(n)?"image":n==="pdf"?"pdf":ie.has(n)?"video":ce.has(n)?"audio":le.has(n)?"iframe":se.has(n)?"unsupported":"unknown"}async function me(e){try{const a=(await fetch(e,{method:"HEAD"})).headers.get("content-type")??"";return O(a)}catch{return"unknown"}}async function R(e){const n=await fetch(e);if(!n.ok)throw new Error(`fetch failed: ${n.status}`);return n.blob()}function ve(e,n){const a=S(n);return a==="doc"||a==="docx"?"W":a==="xls"||a==="xlsx"?"X":a==="ppt"||a==="pptx"?"P":a==="zip"||a==="rar"||a==="7z"?"ZIP":e==="pdf"?"PDF":"FILE"}function H(e,n,a){return t.h("button",{class:a,type:"button",onClick:()=>{z(e,n)}},[t.h(L.ElIcon,{class:"jt-attachment-preview-service__download-icon"},()=>t.h(F)),t.h("span",{class:"jt-attachment-preview-service__download-text"},"下载")])}function N(e){return e==="image"||e==="pdf"}function W(e){return t.h("div",{class:"jt-attachment-preview-service__preview-fallback"},[t.h("img",{class:"jt-attachment-preview-service__preview-fallback-icon",src:e.icon,alt:""}),t.h("div",{class:"jt-attachment-preview-service__unsupported-text"},"暂不支持预览此类型的文件"),t.h("div",{class:"jt-attachment-preview-service__file-name",title:e.name},e.name)])}function I(e,n){const a=document.createElement("a");a.href=e,a.download=n,a.style.display="none",document.body.appendChild(a),a.click(),a.remove()}async function z(e,n){try{const a=await R(e),o=URL.createObjectURL(a);I(o,n),URL.revokeObjectURL(o)}catch{I(e,n)}}const fe=t.defineComponent({name:"JtAttachmentPreviewPdfCanvas",props:{url:{type:String,required:!0},name:{type:String,required:!0},downloadName:{type:String,required:!0},downloadable:{type:Boolean,required:!0}},emits:{previewLoad:e=>e instanceof Event,previewError:e=>e instanceof Event},setup(e,{emit:n}){const a=t.ref("loading"),o=t.ref([]),r=t.ref([]),l=new Map,s=t.ref("");let d=null,w=[],m=0;async function v(i,u){if(!u)return null;const h=typeof u=="string"?await i.getDestination(u):u;return!Array.isArray(h)||!h[0]?null:await i.getPageIndex(h[0])+1}async function j(i,u,h=0){if(!u?.length)return[];const b=[];for(const E of u){const D=await v(i,E.dest);b.push({title:E.title||"未命名标题",pageNumber:D,level:h});const g=await j(i,E.items,h+1);b.push(...g)}return b}function p(){m+=1;for(const i of w)i.cancel();w=[],d?.destroy(),d=null,l.clear()}async function _(){p();const i=m;a.value="loading",s.value="",o.value=[],r.value=[];try{const u=await ue();if(i!==m)return;d=u.getDocument({url:e.url});const h=await d.promise;if(i!==m)return;o.value=Array.from({length:h.numPages},(D,g)=>g+1),r.value=await j(h,await h.getOutline()),await t.nextTick();const b=l.values().next().value,E=Math.max((b?.parentElement?.clientWidth??800)-32,320);for(const D of o.value){if(i!==m)return;const g=await h.getPage(D),y=l.get(D),x=y?.getContext("2d");if(!y||!x)continue;const M=g.getViewport({scale:1}),P=Math.min(E/M.width,2),c=g.getViewport({scale:P}),C=window.devicePixelRatio||1;y.width=Math.floor(c.width*C),y.height=Math.floor(c.height*C),y.style.width=`${Math.floor(c.width)}px`,y.style.height=`${Math.floor(c.height)}px`,x.setTransform(C,0,0,C,0,0);const T=g.render({canvas:y,canvasContext:x,viewport:c});w.push(T),await T.promise}if(i!==m)return;a.value="ready",n("previewLoad",new Event("load"))}catch(u){if(i!==m)return;a.value="error",s.value=u instanceof Error?u.message:"PDF 加载失败",n("previewError",new Event("error"))}}t.watch(()=>e.url,_,{immediate:!0}),t.onBeforeUnmount(p);function f(i){if(!i)return;l.get(i)?.scrollIntoView({behavior:"smooth",block:"start"})}return()=>t.h("div",{class:"jt-attachment-preview-service__pdf-viewer"},[a.value==="loading"?t.h("div",{class:"jt-attachment-preview-service__pdf-state"},"PDF 加载中..."):null,a.value==="error"?t.h("div",{class:"jt-attachment-preview-service__pdf-state"},[W({icon:re,name:e.name})]):null,null,null,t.h("div",{class:["jt-attachment-preview-service__pdf-layout",a.value!=="ready"?"jt-attachment-preview-service__pdf-layout--hidden":""]},[r.value.length?t.h("aside",{class:"jt-attachment-preview-service__pdf-outline"},[t.h("div",{class:"jt-attachment-preview-service__pdf-outline-title"},"目录"),t.h("div",{class:"jt-attachment-preview-service__pdf-outline-list"},r.value.map((i,u)=>t.h("button",{key:`${i.title}-${u}`,class:"jt-attachment-preview-service__pdf-outline-item",style:{paddingLeft:`${12+i.level*14}px`},type:"button",disabled:!i.pageNumber,title:i.title,onClick:()=>f(i.pageNumber)},i.title)))]):null,t.h("div",{class:"jt-attachment-preview-service__pdf-pages"},o.value.map(i=>t.h("canvas",{key:i,ref:u=>{u instanceof HTMLCanvasElement&&l.set(i,u)},class:"jt-attachment-preview-service__pdf-page"})))])])}}),he=t.defineComponent({name:"JtAttachmentPreviewImageTransform",props:{url:{type:String,required:!0},name:{type:String,required:!0},downloadName:{type:String,required:!0},downloadable:{type:Boolean,required:!0},fit:{type:String,default:"contain"}},emits:{previewLoad:e=>e instanceof Event,previewError:e=>e instanceof Event},setup(e,{emit:n}){const a=t.ref(null),o=t.ref("ready"),r=t.ref(1),l=t.ref(!1);let s=0,d=0,w=0,m=0,v=0,j=0,p=0;const _=t.computed(()=>({"--jt-attachment-preview-service-image-fit":e.fit,transform:`translate(${s}px, ${d}px) scale(${r.value})`}));function f(){a.value&&(a.value.style.transform=`translate(${s}px, ${d}px) scale(${r.value})`)}function i(){p||(p=window.requestAnimationFrame(()=>{p=0,f()}))}function u(c){r.value=Math.min(Math.max(Number(c.toFixed(2)),.2),5),r.value<=1&&(s=0,d=0),f()}function h(){u(r.value+.2)}function b(){const c=Math.max(Number((r.value-.2).toFixed(2)),.2);r.value=c,c<=1&&(s=0,d=0),f()}function E(){s=0,d=0,u(1)}function D(c){o.value="ready",n("previewLoad",c)}function g(c){o.value="error",n("previewError",c)}function y(c){r.value<=1||(c.preventDefault(),l.value=!0,w=c.clientX,m=c.clientY,v=s,j=d,window.addEventListener("pointermove",x),window.addEventListener("pointerup",M,{once:!0}))}function x(c){l.value&&(s=v+c.clientX-w,d=j+c.clientY-m,i())}function M(){l.value=!1,window.removeEventListener("pointermove",x)}function P(c){c.preventDefault(),u(r.value+(c.deltaY<0?.1:-.1))}return t.onMounted(f),t.watch(()=>e.url,()=>{o.value="ready",E()}),t.onBeforeUnmount(()=>{window.removeEventListener("pointermove",x),p&&window.cancelAnimationFrame(p)}),()=>t.h("div",{class:"jt-attachment-preview-service__image-viewer"},o.value==="error"?W({icon:ae,name:e.name}):[t.h("img",{ref:a,class:["jt-attachment-preview-service__media","jt-attachment-preview-service__image",r.value>1?"jt-attachment-preview-service__image--draggable":"",l.value?"jt-attachment-preview-service__image--dragging":""],src:e.url,alt:e.name,style:_.value,onLoad:D,onError:g,onPointerdown:y,onWheel:P,onDragstart:c=>c.preventDefault(),draggable:!1}),t.h("div",{class:"jt-attachment-preview-service__image-toolbar"},[t.h("button",{class:"jt-attachment-preview-service__image-tool",type:"button",title:"缩小",onClick:b},[t.h(L.ElIcon,()=>t.h(ne))]),t.h("span",{class:"jt-attachment-preview-service__image-scale"},`${Math.round(r.value*100)}%`),t.h("button",{class:"jt-attachment-preview-service__image-tool",type:"button",title:"放大",onClick:h},[t.h(L.ElIcon,()=>t.h(ee))]),t.h("button",{class:"jt-attachment-preview-service__image-tool",type:"button",title:"复位",onClick:E},[t.h(L.ElIcon,()=>t.h(Z))])])])}}),pe=t.defineComponent({name:"JtAttachmentPreviewService",props:{options:{type:Object,required:!0},onDestroy:{type:Function,required:!0}},setup(e){const n=t.computed(()=>J(e.options.url,e.options.name)),a=t.computed(()=>e.options.downloadName||n.value),o=t.computed(()=>G(e.options)),r=t.computed(()=>ve(o.value,e.options.url)),l=t.computed(()=>({zIndex:e.options.zIndex??3e3,"--jt-attachment-preview-service-image-fit":e.options.fit??"contain"}));function s(){e.options.onClose?.(),e.onDestroy()}function d(v){v.key==="Escape"&&e.options.closeOnPressEscape!==!1&&s()}function w(v){e.options.onLoad?.(v)}function m(v){e.options.onError?.(v)}return t.onMounted(()=>{document.addEventListener("keydown",d),document.body.classList.add("jt-attachment-preview-service-lock")}),t.onBeforeUnmount(()=>{document.removeEventListener("keydown",d),document.body.classList.remove("jt-attachment-preview-service-lock")}),()=>{const v=e.options.downloadable===!1?[]:[H(e.options.url,a.value,"jt-attachment-preview-service__top-download")];return t.h("div",{class:"jt-attachment-preview-service",style:l.value},[t.h("div",{class:"jt-attachment-preview-service__modal"},[t.h("div",{class:"jt-attachment-preview-service__header"},[t.h("div",{class:"jt-attachment-preview-service__filename",title:n.value},n.value),t.h("div",{class:"jt-attachment-preview-service__header-actions"},[...v,t.h("button",{class:"jt-attachment-preview-service__close",type:"button","aria-label":"关闭",onClick:s},"×")])]),t.h("div",{class:"jt-attachment-preview-service__body"},[we({type:o.value,url:e.options.url,name:n.value,downloadName:a.value,sandbox:e.options.sandbox,iconText:r.value,downloadable:e.options.downloadable!==!1,onLoad:w,onError:m})])])])}}}),k=t.defineComponent({name:"JtAttachmentPreviewDetectingService",props:{options:{type:Object,required:!0},onDestroy:{type:Function,required:!0},title:{type:String,default:"正在识别文件类型"},desc:{type:String,default:"请稍候,识别完成后将自动预览或下载"},spinning:{type:Boolean,default:!0}},setup(e){const n=t.computed(()=>J(e.options.url,e.options.name)),a=t.computed(()=>({zIndex:e.options.zIndex??3e3}));function o(){e.options.onClose?.(),e.onDestroy()}function r(l){l.key==="Escape"&&e.options.closeOnPressEscape!==!1&&o()}return t.onMounted(()=>{document.addEventListener("keydown",r),document.body.classList.add("jt-attachment-preview-service-lock")}),t.onBeforeUnmount(()=>{document.removeEventListener("keydown",r),document.body.classList.remove("jt-attachment-preview-service-lock")}),()=>t.h("div",{class:"jt-attachment-preview-service",style:a.value},[t.h("div",{class:"jt-attachment-preview-service__modal"},[t.h("div",{class:"jt-attachment-preview-service__header"},[t.h("div",{class:"jt-attachment-preview-service__filename",title:n.value},n.value),t.h("div",{class:"jt-attachment-preview-service__header-actions"},[t.h("button",{class:"jt-attachment-preview-service__close",type:"button","aria-label":"关闭",onClick:o},"×")])]),t.h("div",{class:"jt-attachment-preview-service__body"},[t.h("div",{class:"jt-attachment-preview-service__detecting"},[e.spinning?t.h("span",{class:"jt-attachment-preview-service__detecting-spinner"}):null,t.h("span",{class:"jt-attachment-preview-service__detecting-title"},e.title),t.h("span",{class:"jt-attachment-preview-service__detecting-desc"},e.desc)])])])])}});function we(e){return e.type==="empty"?t.h("div",{class:"jt-attachment-preview-service__empty"},"暂无附件"):e.type==="image"?t.h(he,{url:e.url,name:e.name,downloadName:e.downloadName,downloadable:e.downloadable,onPreviewLoad:e.onLoad,onPreviewError:e.onError}):e.type==="video"?t.h("video",{class:"jt-attachment-preview-service__media",src:e.url,controls:!0,onLoadeddata:e.onLoad,onError:e.onError}):e.type==="audio"?t.h("audio",{class:"jt-attachment-preview-service__audio",src:e.url,controls:!0,onLoadeddata:e.onLoad,onError:e.onError}):e.type==="pdf"?t.h(fe,{url:e.url,name:e.name,downloadName:e.downloadName,downloadable:e.downloadable,onPreviewLoad:e.onLoad,onPreviewError:e.onError}):e.type==="iframe"?t.h("iframe",{class:"jt-attachment-preview-service__iframe",src:e.url,title:e.name,sandbox:e.sandbox||void 0,onLoad:e.onLoad}):t.h("div",{class:"jt-attachment-preview-service__unsupported"},[t.h("div",{class:"jt-attachment-preview-service__file-card"},[t.h("div",{class:"jt-attachment-preview-service__file-icon"},e.iconText),t.h("div",{class:"jt-attachment-preview-service__unsupported-text"},"暂不支持预览此类型的文件")]),t.h("div",{class:"jt-attachment-preview-service__file-name",title:e.name},e.name),e.downloadable?H(e.url,e.downloadName,"jt-attachment-preview-service__primary-download"):null])}function K(e){if(typeof document>"u")return{close:()=>{}};A?.close();const n=de(e),a=n.downloadName||J(n.url,n.name);let o=!1,r=null,l=null;const s=()=>{o=!0,r&&(t.render(null,r),r.remove(),r=null),l&&(URL.revokeObjectURL(l),l=null),A?.close===s&&(A=null)};function d(){o||(r||(r=document.createElement("div"),document.body.appendChild(r)),t.render(t.h(pe,{options:n,onDestroy:s}),r))}function w(){o||(r||(r=document.createElement("div"),document.body.appendChild(r)),t.render(t.h(k,{options:n,onDestroy:s}),r))}function m(){r&&(t.render(null,r),r.remove(),r=null)}function v(){o||z(n.url,a)}function j(_){if(o)return;const f=URL.createObjectURL(_);I(f,a),URL.revokeObjectURL(f)}const p=G(n);return N(p)?d():p==="unknown"?(w(),me(n.url).then(async _=>{if(!o){if(N(_)){n.mode=_,d();return}try{const f=await R(n.url),i=O(f.type);if(N(i)){l=URL.createObjectURL(f),n.url=l,n.mode=i,d();return}m(),j(f)}catch{m(),v()}}})):v(),A={close:s},A}function q(e){B=e}function Q(e){if(typeof document>"u")return{close:()=>{}};A?.close();let n=!1,a=document.createElement("div");document.body.appendChild(a);const o=()=>{n=!0,a&&(t.render(null,a),a.remove(),a=null),A?.close===o&&(A=null)},r={close:o};return A=r,B?(t.render(t.h(k,{options:{url:"",name:"附件预览"},title:"正在获取文件信息",desc:"请稍候,获取完成后将自动预览或下载",spinning:!0,onDestroy:o}),a),B.request(e).then(l=>{if(n)return;const s=B?.mapResponse(l,e);if(!s?.url){t.render(t.h(k,{options:{url:"",name:"附件预览"},title:"文件信息缺少 URL",desc:"请检查 mapResponse 是否返回了 url 字段",spinning:!1,onDestroy:o}),a);return}K(s)}).catch(l=>{if(n)return;const s=l instanceof Error?l.message:"接口请求失败";t.render(t.h(k,{options:{url:"",name:"附件预览"},title:"文件信息获取失败",desc:s,spinning:!1,onDestroy:o}),a)}),r):(t.render(t.h(k,{options:{url:"",name:"附件预览"},title:"附件预览未初始化",desc:"请先调用 setupJtAttachmentPreview 注册请求配置",spinning:!1,onDestroy:o}),a),r)}const ge=Object.assign(K,{openByParams:Q,setup:q});exports.JtAttachmentPreview=ge;exports.JtAttachmentPreviewByParams=Q;exports.setupJtAttachmentPreview=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),L=require("element-plus");/*! Element Plus Icons Vue v2.3.2 */var V=t.defineComponent({name:"Download",__name:"download",setup(e){return(n,a)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z"})]))}}),F=V,X=t.defineComponent({name:"RefreshLeft",__name:"refresh-left",setup(e){return(n,a)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"})]))}}),Z=X,$=t.defineComponent({name:"ZoomIn",__name:"zoom-in",setup(e){return(n,a)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"})]))}}),ee=$,te=t.defineComponent({name:"ZoomOut",__name:"zoom-out",setup(e){return(n,a)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704M352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64"})]))}}),ne=te;const ae="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANgAAADYCAMAAAC+/t3fAAAAaVBMVEUAAABWapNVapKeqsLJztx3hKnGzN2yu8////9XapWcqMGps8lXapVYa5RWaZWps8lfcJjS1+KjrsVXapWapr////9sfaKrtMrV2uWBj7B4iKqWob1wgaXr7fOBj6/Ax9dhc5yhq8OKl7Wba+6tAAAAE3RSTlMAgGDuDyVLoYDe2XuXRb68cy6e4BCQEAAAAyZJREFUeNrt29tyokAUheGOQjIoeMhuCQ4e0Pd/yCE1STU4mGq7bXqzZ/23ufoqYblTqkIIIYQQQggNlM42Lzctf5nMD22bKQYVOQ30sTPt6dEO74mKXLoiCgDTi1RFbUMUBhZXluQUDKbnWxWtjMLB2pYqUjmFg8WUzSg0TL+rCKVZeJheRJj9DYWHRRnHbBSYnr+qcSsoKCyeLKcfK/emc2UqH4LFGMcVWVftTC4w/TbmhGQjwvR6RBmNAbMYx4nD7k/I1GF3ZZOH3RtHAbDhcZQAG5SJgOn1Vt0mAzYwIUJgvjJ/2OVo2pcmcoQZWehxpBGue5sJEQTryyTBeuMoCtadEFmwjkwYzIyjNJief02IONj3OAqE/ZVJhJnZj3RS1c4nld04ijiC/5EJhbUyobBWJhT2OY5CYa1MKKyVCYXpdSIUphdbobB2HIXCWplQmJGFhZUn07kyNaFgbUsx1/1tb1Jh+i1hDmu0Y+uEN4xqV9ki5Q27atfmKWtYqd1lW84wqj1kr5xhB+3RkjGMrl4yxrCm9pG984V5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871WMsciTg8YGGHG/ZUKcS2BI7y9/5j7SsnrXJLjW0otqIbBQisvG5NEiLRxYSl6w4KzE1m3FLonPCG5ugnCLBoN6qUmXQ0Ta/5MWAx+wuVjv1L+K/xHgNmspxSqbAuMcL0DAaMxRopCn2UWPJj+3/NJutXiYGAWaxUI/0qkbndKQhYXJTK50j9wYDF7Me+LQKBVWc2of5gwNis1kzdAYGt3nIJdQcDFpM9DTF1BgQ2u1fja2dAYMHbLqHOgMDCsW352w8iCKweWDHffhBBYOyba2Nabz+IKDB3eFk+36+IILDQXPlQRnpdKLC0d+W9sjMoMN8kJY04woEC+6kbJY05dIMC86OPSaHA0ugREQWWR7tQYP/atZcUBmEoCsNHA4FEBxHvyKJQ7P7X2EGdlHbiNYNjON8OfvIkZP2Zi9tqV7CE2V77TyxL2PdkXJ52GUuYvZbKL1IsYcfr9GPbq2WxhJ2gMIUpTGEcFKYwEgpTGAmFKYyEwhRGQmEKI+EJy3YDCeeNdgOesMH4ZTgk4zfAoxi9GR6dsctwCfRD1sNnNm7HCmtuY8wRH42dZSXCL/CW5QQcmtoax4iLIuOglQkVpIHrPlzGPqCSNE8diT4FiIiIiIjIP2/v9e/hKQXqEwAAAABJRU5ErkJggg==",oe=new Set(["jpg","jpeg","png","gif","webp","bmp","svg","avif","ico"]),ie=new Set(["mp4","webm","ogg","ogv","mov","m4v"]),ce=new Set(["mp3","wav","ogg","oga","m4a","aac","flac"]),le=new Set(["html","htm","txt","json","xml","csv","md","log"]),se=new Set(["doc","docx","xls","xlsx","ppt","pptx","zip","rar","7z"]);let A=null,Y=null,B=null;async function ue(){return Y||(Y=Promise.all([Promise.resolve().then(()=>require("../pdf-Da0bm_Ya.cjs")),Promise.resolve().then(()=>require("../pdf.worker.min-BAJUPwg6.cjs"))]).then(([e,n])=>(e.GlobalWorkerOptions.workerSrc=n.default,e))),Y}function de(e){return typeof e=="string"?{url:e}:e}function S(e){const[n]=e.split(/[?#]/);return n??""}function O(e,n){if(n?.trim())return n.trim();const a=S(e).split("/").filter(Boolean).pop();if(!a)return"附件预览";try{return decodeURIComponent(a)}catch{return a}}function I(e){return S(e).match(/\.([a-z0-9]+)$/i)?.[1]?.toLowerCase()??""}function me(e){return e?.trim().replace(/^\./,"").toLowerCase()??""}function ve(e){const n=me(e);return oe.has(n)?"image":n==="pdf"?"pdf":ie.has(n)?"video":ce.has(n)?"audio":le.has(n)?"iframe":se.has(n)?"unsupported":"unknown"}function T(e){const n=e.toLowerCase().split(";")[0]?.trim()??"";return n.startsWith("image/")?"image":n==="application/pdf"?"pdf":n.startsWith("video/")?"video":n.startsWith("audio/")?"audio":n.startsWith("text/")?"iframe":"unknown"}function G(e){if(!e.url.trim())return"empty";if(e.mode&&e.mode!=="auto")return e.mode;if(e.mimeType){const a=T(e.mimeType);if(a!=="unknown")return a}const n=ve(e.extension||I(e.name||"")||I(e.url));return n!=="unknown"?n:"unknown"}async function fe(e){try{const a=(await fetch(e,{method:"HEAD"})).headers.get("content-type")??"";return T(a)}catch{return"unknown"}}async function R(e){const n=await fetch(e);if(!n.ok)throw new Error(`fetch failed: ${n.status}`);return n.blob()}function he(e,n){const a=I(n);return a==="doc"||a==="docx"?"W":a==="xls"||a==="xlsx"?"X":a==="ppt"||a==="pptx"?"P":a==="zip"||a==="rar"||a==="7z"?"ZIP":e==="pdf"?"PDF":"FILE"}function z(e,n,a){return t.h("button",{class:a,type:"button",onClick:()=>{W(e,n)}},[t.h(L.ElIcon,{class:"jt-attachment-preview-service__download-icon"},()=>t.h(F)),t.h("span",{class:"jt-attachment-preview-service__download-text"},"下载")])}function N(e){return e==="image"||e==="pdf"}function H(e){return t.h("div",{class:"jt-attachment-preview-service__preview-fallback"},[t.h("img",{class:"jt-attachment-preview-service__preview-fallback-icon",src:e.icon,alt:""}),t.h("div",{class:"jt-attachment-preview-service__unsupported-text"},"暂不支持预览此类型的文件"),t.h("div",{class:"jt-attachment-preview-service__file-name",title:e.name},e.name)])}function J(e,n){const a=document.createElement("a");a.href=e,a.download=n,a.style.display="none",document.body.appendChild(a),a.click(),a.remove()}async function W(e,n){try{const a=await R(e),o=URL.createObjectURL(a);J(o,n),URL.revokeObjectURL(o)}catch{J(e,n)}}const pe=t.defineComponent({name:"JtAttachmentPreviewPdfCanvas",props:{url:{type:String,required:!0},name:{type:String,required:!0},downloadName:{type:String,required:!0},downloadable:{type:Boolean,required:!0}},emits:{previewLoad:e=>e instanceof Event,previewError:e=>e instanceof Event},setup(e,{emit:n}){const a=t.ref("loading"),o=t.ref([]),r=t.ref([]),l=new Map,s=t.ref("");let d=null,w=[],m=0;async function v(i,u){if(!u)return null;const h=typeof u=="string"?await i.getDestination(u):u;return!Array.isArray(h)||!h[0]?null:await i.getPageIndex(h[0])+1}async function j(i,u,h=0){if(!u?.length)return[];const b=[];for(const E of u){const x=await v(i,E.dest);b.push({title:E.title||"未命名标题",pageNumber:x,level:h});const g=await j(i,E.items,h+1);b.push(...g)}return b}function p(){m+=1;for(const i of w)i.cancel();w=[],d?.destroy(),d=null,l.clear()}async function _(){p();const i=m;a.value="loading",s.value="",o.value=[],r.value=[];try{const u=await ue();if(i!==m)return;d=u.getDocument({url:e.url});const h=await d.promise;if(i!==m)return;o.value=Array.from({length:h.numPages},(x,g)=>g+1),r.value=await j(h,await h.getOutline()),await t.nextTick();const b=l.values().next().value,E=Math.max((b?.parentElement?.clientWidth??800)-32,320);for(const x of o.value){if(i!==m)return;const g=await h.getPage(x),y=l.get(x),D=y?.getContext("2d");if(!y||!D)continue;const M=g.getViewport({scale:1}),P=Math.min(E/M.width,2),c=g.getViewport({scale:P}),C=window.devicePixelRatio||1;y.width=Math.floor(c.width*C),y.height=Math.floor(c.height*C),y.style.width=`${Math.floor(c.width)}px`,y.style.height=`${Math.floor(c.height)}px`,D.setTransform(C,0,0,C,0,0);const U=g.render({canvas:y,canvasContext:D,viewport:c});w.push(U),await U.promise}if(i!==m)return;a.value="ready",n("previewLoad",new Event("load"))}catch(u){if(i!==m)return;a.value="error",s.value=u instanceof Error?u.message:"PDF 加载失败",n("previewError",new Event("error"))}}t.watch(()=>e.url,_,{immediate:!0}),t.onBeforeUnmount(p);function f(i){if(!i)return;l.get(i)?.scrollIntoView({behavior:"smooth",block:"start"})}return()=>t.h("div",{class:"jt-attachment-preview-service__pdf-viewer"},[a.value==="loading"?t.h("div",{class:"jt-attachment-preview-service__pdf-state"},"PDF 加载中..."):null,a.value==="error"?t.h("div",{class:"jt-attachment-preview-service__pdf-state"},[H({icon:re,name:e.name})]):null,null,null,t.h("div",{class:["jt-attachment-preview-service__pdf-layout",a.value!=="ready"?"jt-attachment-preview-service__pdf-layout--hidden":""]},[r.value.length?t.h("aside",{class:"jt-attachment-preview-service__pdf-outline"},[t.h("div",{class:"jt-attachment-preview-service__pdf-outline-title"},"目录"),t.h("div",{class:"jt-attachment-preview-service__pdf-outline-list"},r.value.map((i,u)=>t.h("button",{key:`${i.title}-${u}`,class:"jt-attachment-preview-service__pdf-outline-item",style:{paddingLeft:`${12+i.level*14}px`},type:"button",disabled:!i.pageNumber,title:i.title,onClick:()=>f(i.pageNumber)},i.title)))]):null,t.h("div",{class:"jt-attachment-preview-service__pdf-pages"},o.value.map(i=>t.h("canvas",{key:i,ref:u=>{u instanceof HTMLCanvasElement&&l.set(i,u)},class:"jt-attachment-preview-service__pdf-page"})))])])}}),we=t.defineComponent({name:"JtAttachmentPreviewImageTransform",props:{url:{type:String,required:!0},name:{type:String,required:!0},downloadName:{type:String,required:!0},downloadable:{type:Boolean,required:!0},fit:{type:String,default:"contain"}},emits:{previewLoad:e=>e instanceof Event,previewError:e=>e instanceof Event},setup(e,{emit:n}){const a=t.ref(null),o=t.ref("ready"),r=t.ref(1),l=t.ref(!1);let s=0,d=0,w=0,m=0,v=0,j=0,p=0;const _=t.computed(()=>({"--jt-attachment-preview-service-image-fit":e.fit,transform:`translate(${s}px, ${d}px) scale(${r.value})`}));function f(){a.value&&(a.value.style.transform=`translate(${s}px, ${d}px) scale(${r.value})`)}function i(){p||(p=window.requestAnimationFrame(()=>{p=0,f()}))}function u(c){r.value=Math.min(Math.max(Number(c.toFixed(2)),.2),5),r.value<=1&&(s=0,d=0),f()}function h(){u(r.value+.2)}function b(){const c=Math.max(Number((r.value-.2).toFixed(2)),.2);r.value=c,c<=1&&(s=0,d=0),f()}function E(){s=0,d=0,u(1)}function x(c){o.value="ready",n("previewLoad",c)}function g(c){o.value="error",n("previewError",c)}function y(c){r.value<=1||(c.preventDefault(),l.value=!0,w=c.clientX,m=c.clientY,v=s,j=d,window.addEventListener("pointermove",D),window.addEventListener("pointerup",M,{once:!0}))}function D(c){l.value&&(s=v+c.clientX-w,d=j+c.clientY-m,i())}function M(){l.value=!1,window.removeEventListener("pointermove",D)}function P(c){c.preventDefault(),u(r.value+(c.deltaY<0?.1:-.1))}return t.onMounted(f),t.watch(()=>e.url,()=>{o.value="ready",E()}),t.onBeforeUnmount(()=>{window.removeEventListener("pointermove",D),p&&window.cancelAnimationFrame(p)}),()=>t.h("div",{class:"jt-attachment-preview-service__image-viewer"},o.value==="error"?H({icon:ae,name:e.name}):[t.h("img",{ref:a,class:["jt-attachment-preview-service__media","jt-attachment-preview-service__image",r.value>1?"jt-attachment-preview-service__image--draggable":"",l.value?"jt-attachment-preview-service__image--dragging":""],src:e.url,alt:e.name,style:_.value,onLoad:x,onError:g,onPointerdown:y,onWheel:P,onDragstart:c=>c.preventDefault(),draggable:!1}),t.h("div",{class:"jt-attachment-preview-service__image-toolbar"},[t.h("button",{class:"jt-attachment-preview-service__image-tool",type:"button",title:"缩小",onClick:b},[t.h(L.ElIcon,()=>t.h(ne))]),t.h("span",{class:"jt-attachment-preview-service__image-scale"},`${Math.round(r.value*100)}%`),t.h("button",{class:"jt-attachment-preview-service__image-tool",type:"button",title:"放大",onClick:h},[t.h(L.ElIcon,()=>t.h(ee))]),t.h("button",{class:"jt-attachment-preview-service__image-tool",type:"button",title:"复位",onClick:E},[t.h(L.ElIcon,()=>t.h(Z))])])])}}),ge=t.defineComponent({name:"JtAttachmentPreviewService",props:{options:{type:Object,required:!0},onDestroy:{type:Function,required:!0}},setup(e){const n=t.computed(()=>O(e.options.url,e.options.name)),a=t.computed(()=>e.options.downloadName||n.value),o=t.computed(()=>G(e.options)),r=t.computed(()=>he(o.value,e.options.url)),l=t.computed(()=>({zIndex:e.options.zIndex??3e3,"--jt-attachment-preview-service-image-fit":e.options.fit??"contain"}));function s(){e.options.onClose?.(),e.onDestroy()}function d(v){v.key==="Escape"&&e.options.closeOnPressEscape!==!1&&s()}function w(v){e.options.onLoad?.(v)}function m(v){e.options.onError?.(v)}return t.onMounted(()=>{document.addEventListener("keydown",d),document.body.classList.add("jt-attachment-preview-service-lock")}),t.onBeforeUnmount(()=>{document.removeEventListener("keydown",d),document.body.classList.remove("jt-attachment-preview-service-lock")}),()=>{const v=e.options.downloadable===!1?[]:[z(e.options.url,a.value,"jt-attachment-preview-service__top-download")];return t.h("div",{class:"jt-attachment-preview-service",style:l.value},[t.h("div",{class:"jt-attachment-preview-service__modal"},[t.h("div",{class:"jt-attachment-preview-service__header"},[t.h("div",{class:"jt-attachment-preview-service__filename",title:n.value},n.value),t.h("div",{class:"jt-attachment-preview-service__header-actions"},[...v,t.h("button",{class:"jt-attachment-preview-service__close",type:"button","aria-label":"关闭",onClick:s},"×")])]),t.h("div",{class:"jt-attachment-preview-service__body"},[ye({type:o.value,url:e.options.url,name:n.value,downloadName:a.value,sandbox:e.options.sandbox,iconText:r.value,downloadable:e.options.downloadable!==!1,onLoad:w,onError:m})])])])}}}),k=t.defineComponent({name:"JtAttachmentPreviewDetectingService",props:{options:{type:Object,required:!0},onDestroy:{type:Function,required:!0},title:{type:String,default:"正在识别文件类型"},desc:{type:String,default:"请稍候,识别完成后将自动预览或下载"},spinning:{type:Boolean,default:!0}},setup(e){const n=t.computed(()=>O(e.options.url,e.options.name)),a=t.computed(()=>({zIndex:e.options.zIndex??3e3}));function o(){e.options.onClose?.(),e.onDestroy()}function r(l){l.key==="Escape"&&e.options.closeOnPressEscape!==!1&&o()}return t.onMounted(()=>{document.addEventListener("keydown",r),document.body.classList.add("jt-attachment-preview-service-lock")}),t.onBeforeUnmount(()=>{document.removeEventListener("keydown",r),document.body.classList.remove("jt-attachment-preview-service-lock")}),()=>t.h("div",{class:"jt-attachment-preview-service",style:a.value},[t.h("div",{class:"jt-attachment-preview-service__modal"},[t.h("div",{class:"jt-attachment-preview-service__header"},[t.h("div",{class:"jt-attachment-preview-service__filename",title:n.value},n.value),t.h("div",{class:"jt-attachment-preview-service__header-actions"},[t.h("button",{class:"jt-attachment-preview-service__close",type:"button","aria-label":"关闭",onClick:o},"×")])]),t.h("div",{class:"jt-attachment-preview-service__body"},[t.h("div",{class:"jt-attachment-preview-service__detecting"},[e.spinning?t.h("span",{class:"jt-attachment-preview-service__detecting-spinner"}):null,t.h("span",{class:"jt-attachment-preview-service__detecting-title"},e.title),t.h("span",{class:"jt-attachment-preview-service__detecting-desc"},e.desc)])])])])}});function ye(e){return e.type==="empty"?t.h("div",{class:"jt-attachment-preview-service__empty"},"暂无附件"):e.type==="image"?t.h(we,{url:e.url,name:e.name,downloadName:e.downloadName,downloadable:e.downloadable,onPreviewLoad:e.onLoad,onPreviewError:e.onError}):e.type==="video"?t.h("video",{class:"jt-attachment-preview-service__media",src:e.url,controls:!0,onLoadeddata:e.onLoad,onError:e.onError}):e.type==="audio"?t.h("audio",{class:"jt-attachment-preview-service__audio",src:e.url,controls:!0,onLoadeddata:e.onLoad,onError:e.onError}):e.type==="pdf"?t.h(pe,{url:e.url,name:e.name,downloadName:e.downloadName,downloadable:e.downloadable,onPreviewLoad:e.onLoad,onPreviewError:e.onError}):e.type==="iframe"?t.h("iframe",{class:"jt-attachment-preview-service__iframe",src:e.url,title:e.name,sandbox:e.sandbox||void 0,onLoad:e.onLoad}):t.h("div",{class:"jt-attachment-preview-service__unsupported"},[t.h("div",{class:"jt-attachment-preview-service__file-card"},[t.h("div",{class:"jt-attachment-preview-service__file-icon"},e.iconText),t.h("div",{class:"jt-attachment-preview-service__unsupported-text"},"暂不支持预览此类型的文件")]),t.h("div",{class:"jt-attachment-preview-service__file-name",title:e.name},e.name),e.downloadable?z(e.url,e.downloadName,"jt-attachment-preview-service__primary-download"):null])}function K(e){if(typeof document>"u")return{close:()=>{}};A?.close();const n=de(e),a=n.downloadName||O(n.url,n.name);let o=!1,r=null,l=null;const s=()=>{o=!0,r&&(t.render(null,r),r.remove(),r=null),l&&(URL.revokeObjectURL(l),l=null),A?.close===s&&(A=null)};function d(){o||(r||(r=document.createElement("div"),document.body.appendChild(r)),t.render(t.h(ge,{options:n,onDestroy:s}),r))}function w(){o||(r||(r=document.createElement("div"),document.body.appendChild(r)),t.render(t.h(k,{options:n,onDestroy:s}),r))}function m(){r&&(t.render(null,r),r.remove(),r=null)}function v(){o||W(n.url,a)}function j(_){if(o)return;const f=URL.createObjectURL(_);J(f,a),URL.revokeObjectURL(f)}const p=G(n);return N(p)?d():p==="unknown"?(w(),fe(n.url).then(async _=>{if(!o){if(N(_)){n.mode=_,d();return}try{const f=await R(n.url),i=T(f.type);if(N(i)){l=URL.createObjectURL(f),n.url=l,n.mode=i,d();return}m(),j(f)}catch{m(),v()}}})):v(),A={close:s},A}function q(e){B=e}function Q(e){if(typeof document>"u")return{close:()=>{}};A?.close();let n=!1,a=document.createElement("div");document.body.appendChild(a);const o=()=>{n=!0,a&&(t.render(null,a),a.remove(),a=null),A?.close===o&&(A=null)},r={close:o};return A=r,B?(t.render(t.h(k,{options:{url:"",name:"附件预览"},title:"正在获取文件信息",desc:"请稍候,获取完成后将自动预览或下载",spinning:!0,onDestroy:o}),a),B.request(e).then(l=>{if(n)return;const s=B?.mapResponse(l,e);if(!s?.url){t.render(t.h(k,{options:{url:"",name:"附件预览"},title:"文件信息缺少 URL",desc:"请检查 mapResponse 是否返回了 url 字段",spinning:!1,onDestroy:o}),a);return}K(s)}).catch(l=>{if(n)return;const s=l instanceof Error?l.message:"接口请求失败";t.render(t.h(k,{options:{url:"",name:"附件预览"},title:"文件信息获取失败",desc:s,spinning:!1,onDestroy:o}),a)}),r):(t.render(t.h(k,{options:{url:"",name:"附件预览"},title:"附件预览未初始化",desc:"请先调用 setupJtAttachmentPreview 注册请求配置",spinning:!1,onDestroy:o}),a),r)}const Ae=Object.assign(K,{openByParams:Q,setup:q});exports.JtAttachmentPreview=Ae;exports.JtAttachmentPreviewByParams=Q;exports.setupJtAttachmentPreview=q;
@@ -1,7 +1,7 @@
1
- import { defineComponent as L, openBlock as O, createElementBlock as I, createElementVNode as J, ref as x, watch as q, onBeforeUnmount as T, h as n, computed as D, onMounted as W, nextTick as ae, render as A } from "vue";
1
+ import { defineComponent as k, openBlock as O, createElementBlock as I, createElementVNode as J, ref as D, watch as V, onBeforeUnmount as T, h as n, computed as x, onMounted as W, nextTick as ae, render as A } from "vue";
2
2
  import { ElIcon as N } from "element-plus";
3
3
  /*! Element Plus Icons Vue v2.3.2 */
4
- var re = /* @__PURE__ */ L({
4
+ var re = /* @__PURE__ */ k({
5
5
  name: "Download",
6
6
  __name: "download",
7
7
  setup(e) {
@@ -15,7 +15,7 @@ var re = /* @__PURE__ */ L({
15
15
  })
16
16
  ]));
17
17
  }
18
- }), ie = re, oe = /* @__PURE__ */ L({
18
+ }), ie = re, oe = /* @__PURE__ */ k({
19
19
  name: "RefreshLeft",
20
20
  __name: "refresh-left",
21
21
  setup(e) {
@@ -29,7 +29,7 @@ var re = /* @__PURE__ */ L({
29
29
  })
30
30
  ]));
31
31
  }
32
- }), ce = oe, se = /* @__PURE__ */ L({
32
+ }), ce = oe, se = /* @__PURE__ */ k({
33
33
  name: "ZoomIn",
34
34
  __name: "zoom-in",
35
35
  setup(e) {
@@ -43,7 +43,7 @@ var re = /* @__PURE__ */ L({
43
43
  })
44
44
  ]));
45
45
  }
46
- }), le = se, ue = /* @__PURE__ */ L({
46
+ }), le = se, ue = /* @__PURE__ */ k({
47
47
  name: "ZoomOut",
48
48
  __name: "zoom-out",
49
49
  setup(e) {
@@ -79,13 +79,13 @@ async function ye() {
79
79
  function Ae(e) {
80
80
  return typeof e == "string" ? { url: e } : e;
81
81
  }
82
- function V(e) {
82
+ function F(e) {
83
83
  const [t] = e.split(/[?#]/);
84
84
  return t ?? "";
85
85
  }
86
- function z(e, t) {
86
+ function K(e, t) {
87
87
  if (t?.trim()) return t.trim();
88
- const a = V(e).split("/").filter(Boolean).pop();
88
+ const a = F(e).split("/").filter(Boolean).pop();
89
89
  if (!a) return "附件预览";
90
90
  try {
91
91
  return decodeURIComponent(a);
@@ -93,10 +93,17 @@ function z(e, t) {
93
93
  return a;
94
94
  }
95
95
  }
96
- function F(e) {
97
- return V(e).match(/\.([a-z0-9]+)$/i)?.[1]?.toLowerCase() ?? "";
96
+ function z(e) {
97
+ return F(e).match(/\.([a-z0-9]+)$/i)?.[1]?.toLowerCase() ?? "";
98
+ }
99
+ function _e(e) {
100
+ return e?.trim().replace(/^\./, "").toLowerCase() ?? "";
101
+ }
102
+ function be(e) {
103
+ const t = _e(e);
104
+ return fe.has(t) ? "image" : t === "pdf" ? "pdf" : we.has(t) ? "video" : pe.has(t) ? "audio" : he.has(t) ? "iframe" : ge.has(t) ? "unsupported" : "unknown";
98
105
  }
99
- function K(e) {
106
+ function Q(e) {
100
107
  const t = e.toLowerCase().split(";")[0]?.trim() ?? "";
101
108
  return t.startsWith("image/") ? "image" : t === "application/pdf" ? "pdf" : t.startsWith("video/") ? "video" : t.startsWith("audio/") ? "audio" : t.startsWith("text/") ? "iframe" : "unknown";
102
109
  }
@@ -104,16 +111,18 @@ function X(e) {
104
111
  if (!e.url.trim()) return "empty";
105
112
  if (e.mode && e.mode !== "auto") return e.mode;
106
113
  if (e.mimeType) {
107
- const a = K(e.mimeType);
114
+ const a = Q(e.mimeType);
108
115
  if (a !== "unknown") return a;
109
116
  }
110
- const t = F(e.url);
111
- return fe.has(t) ? "image" : t === "pdf" ? "pdf" : we.has(t) ? "video" : pe.has(t) ? "audio" : he.has(t) ? "iframe" : ge.has(t) ? "unsupported" : "unknown";
117
+ const t = be(
118
+ e.extension || z(e.name || "") || z(e.url)
119
+ );
120
+ return t !== "unknown" ? t : "unknown";
112
121
  }
113
- async function _e(e) {
122
+ async function je(e) {
114
123
  try {
115
124
  const a = (await fetch(e, { method: "HEAD" })).headers.get("content-type") ?? "";
116
- return K(a);
125
+ return Q(a);
117
126
  } catch {
118
127
  return "unknown";
119
128
  }
@@ -123,8 +132,8 @@ async function Z(e) {
123
132
  if (!t.ok) throw new Error(`fetch failed: ${t.status}`);
124
133
  return t.blob();
125
134
  }
126
- function be(e, t) {
127
- const a = F(t);
135
+ function Ee(e, t) {
136
+ const a = z(t);
128
137
  return a === "doc" || a === "docx" ? "W" : a === "xls" || a === "xlsx" ? "X" : a === "ppt" || a === "pptx" ? "P" : a === "zip" || a === "rar" || a === "7z" ? "ZIP" : e === "pdf" ? "PDF" : "FILE";
129
138
  }
130
139
  function $(e, t, a) {
@@ -169,7 +178,7 @@ async function te(e, t) {
169
178
  H(e, t);
170
179
  }
171
180
  }
172
- const je = L({
181
+ const xe = k({
173
182
  name: "JtAttachmentPreviewPdfCanvas",
174
183
  props: {
175
184
  url: {
@@ -194,14 +203,14 @@ const je = L({
194
203
  previewError: (e) => e instanceof Event
195
204
  },
196
205
  setup(e, { emit: t }) {
197
- const a = x("loading"), i = x([]), r = x([]), s = /* @__PURE__ */ new Map(), l = x("");
206
+ const a = D("loading"), i = D([]), r = D([]), s = /* @__PURE__ */ new Map(), l = D("");
198
207
  let d = null, h = [], v = 0;
199
208
  async function m(o, u) {
200
209
  if (!u) return null;
201
210
  const w = typeof u == "string" ? await o.getDestination(u) : u;
202
211
  return !Array.isArray(w) || !w[0] ? null : await o.getPageIndex(w[0]) + 1;
203
212
  }
204
- async function k(o, u, w = 0) {
213
+ async function L(o, u, w = 0) {
205
214
  if (!u?.length) return [];
206
215
  const j = [];
207
216
  for (const E of u) {
@@ -211,7 +220,7 @@ const je = L({
211
220
  pageNumber: C,
212
221
  level: w
213
222
  });
214
- const g = await k(o, E.items, w + 1);
223
+ const g = await L(o, E.items, w + 1);
215
224
  j.push(...g);
216
225
  }
217
226
  return j;
@@ -232,7 +241,7 @@ const je = L({
232
241
  d = u.getDocument({ url: e.url });
233
242
  const w = await d.promise;
234
243
  if (o !== v) return;
235
- i.value = Array.from({ length: w.numPages }, (C, g) => g + 1), r.value = await k(w, await w.getOutline()), await ae();
244
+ i.value = Array.from({ length: w.numPages }, (C, g) => g + 1), r.value = await L(w, await w.getOutline()), await ae();
236
245
  const j = s.values().next().value, E = Math.max((j?.parentElement?.clientWidth ?? 800) - 32, 320);
237
246
  for (const C of i.value) {
238
247
  if (o !== v) return;
@@ -240,12 +249,12 @@ const je = L({
240
249
  if (!y || !M) continue;
241
250
  const G = g.getViewport({ scale: 1 }), S = Math.min(E / G.width, 2), c = g.getViewport({ scale: S }), B = window.devicePixelRatio || 1;
242
251
  y.width = Math.floor(c.width * B), y.height = Math.floor(c.height * B), y.style.width = `${Math.floor(c.width)}px`, y.style.height = `${Math.floor(c.height)}px`, M.setTransform(B, 0, 0, B, 0, 0);
243
- const Q = g.render({
252
+ const q = g.render({
244
253
  canvas: y,
245
254
  canvasContext: M,
246
255
  viewport: c
247
256
  });
248
- h.push(Q), await Q.promise;
257
+ h.push(q), await q.promise;
249
258
  }
250
259
  if (o !== v) return;
251
260
  a.value = "ready", t("previewLoad", new Event("load"));
@@ -254,7 +263,7 @@ const je = L({
254
263
  a.value = "error", l.value = u instanceof Error ? u.message : "PDF 加载失败", t("previewError", new Event("error"));
255
264
  }
256
265
  }
257
- q(() => e.url, b, { immediate: !0 }), T(p);
266
+ V(() => e.url, b, { immediate: !0 }), T(p);
258
267
  function f(o) {
259
268
  if (!o) return;
260
269
  s.get(o)?.scrollIntoView({ behavior: "smooth", block: "start" });
@@ -317,7 +326,7 @@ const je = L({
317
326
  )
318
327
  ]);
319
328
  }
320
- }), Ee = L({
329
+ }), De = k({
321
330
  name: "JtAttachmentPreviewImageTransform",
322
331
  props: {
323
332
  url: {
@@ -346,9 +355,9 @@ const je = L({
346
355
  previewError: (e) => e instanceof Event
347
356
  },
348
357
  setup(e, { emit: t }) {
349
- const a = x(null), i = x("ready"), r = x(1), s = x(!1);
350
- let l = 0, d = 0, h = 0, v = 0, m = 0, k = 0, p = 0;
351
- const b = D(() => ({
358
+ const a = D(null), i = D("ready"), r = D(1), s = D(!1);
359
+ let l = 0, d = 0, h = 0, v = 0, m = 0, L = 0, p = 0;
360
+ const b = x(() => ({
352
361
  "--jt-attachment-preview-service-image-fit": e.fit,
353
362
  transform: `translate(${l}px, ${d}px) scale(${r.value})`
354
363
  }));
@@ -380,10 +389,10 @@ const je = L({
380
389
  i.value = "error", t("previewError", c);
381
390
  }
382
391
  function y(c) {
383
- r.value <= 1 || (c.preventDefault(), s.value = !0, h = c.clientX, v = c.clientY, m = l, k = d, window.addEventListener("pointermove", M), window.addEventListener("pointerup", G, { once: !0 }));
392
+ r.value <= 1 || (c.preventDefault(), s.value = !0, h = c.clientX, v = c.clientY, m = l, L = d, window.addEventListener("pointermove", M), window.addEventListener("pointerup", G, { once: !0 }));
384
393
  }
385
394
  function M(c) {
386
- s.value && (l = m + c.clientX - h, d = k + c.clientY - v, o());
395
+ s.value && (l = m + c.clientX - h, d = L + c.clientY - v, o());
387
396
  }
388
397
  function G() {
389
398
  s.value = !1, window.removeEventListener("pointermove", M);
@@ -391,7 +400,7 @@ const je = L({
391
400
  function S(c) {
392
401
  c.preventDefault(), u(r.value + (c.deltaY < 0 ? 0.1 : -0.1));
393
402
  }
394
- return W(f), q(() => e.url, () => {
403
+ return W(f), V(() => e.url, () => {
395
404
  i.value = "ready", E();
396
405
  }), T(() => {
397
406
  window.removeEventListener("pointermove", M), p && window.cancelAnimationFrame(p);
@@ -452,7 +461,7 @@ const je = L({
452
461
  ])
453
462
  ]);
454
463
  }
455
- }), De = L({
464
+ }), ke = k({
456
465
  name: "JtAttachmentPreviewService",
457
466
  props: {
458
467
  options: {
@@ -465,7 +474,7 @@ const je = L({
465
474
  }
466
475
  },
467
476
  setup(e) {
468
- const t = D(() => z(e.options.url, e.options.name)), a = D(() => e.options.downloadName || t.value), i = D(() => X(e.options)), r = D(() => be(i.value, e.options.url)), s = D(() => ({
477
+ const t = x(() => K(e.options.url, e.options.name)), a = x(() => e.options.downloadName || t.value), i = x(() => X(e.options)), r = x(() => Ee(i.value, e.options.url)), s = x(() => ({
469
478
  zIndex: e.options.zIndex ?? 3e3,
470
479
  "--jt-attachment-preview-service-image-fit": e.options.fit ?? "contain"
471
480
  }));
@@ -506,7 +515,7 @@ const je = L({
506
515
  ])
507
516
  ]),
508
517
  n("div", { class: "jt-attachment-preview-service__body" }, [
509
- xe({
518
+ Le({
510
519
  type: i.value,
511
520
  url: e.options.url,
512
521
  name: t.value,
@@ -522,7 +531,7 @@ const je = L({
522
531
  ]);
523
532
  };
524
533
  }
525
- }), Y = L({
534
+ }), Y = k({
526
535
  name: "JtAttachmentPreviewDetectingService",
527
536
  props: {
528
537
  options: {
@@ -547,7 +556,7 @@ const je = L({
547
556
  }
548
557
  },
549
558
  setup(e) {
550
- const t = D(() => z(e.options.url, e.options.name)), a = D(() => ({
559
+ const t = x(() => K(e.options.url, e.options.name)), a = x(() => ({
551
560
  zIndex: e.options.zIndex ?? 3e3
552
561
  }));
553
562
  function i() {
@@ -588,8 +597,8 @@ const je = L({
588
597
  ]);
589
598
  }
590
599
  });
591
- function xe(e) {
592
- return e.type === "empty" ? n("div", { class: "jt-attachment-preview-service__empty" }, "暂无附件") : e.type === "image" ? n(Ee, {
600
+ function Le(e) {
601
+ return e.type === "empty" ? n("div", { class: "jt-attachment-preview-service__empty" }, "暂无附件") : e.type === "image" ? n(De, {
593
602
  url: e.url,
594
603
  name: e.name,
595
604
  downloadName: e.downloadName,
@@ -608,7 +617,7 @@ function xe(e) {
608
617
  controls: !0,
609
618
  onLoadeddata: e.onLoad,
610
619
  onError: e.onError
611
- }) : e.type === "pdf" ? n(je, {
620
+ }) : e.type === "pdf" ? n(xe, {
612
621
  url: e.url,
613
622
  name: e.name,
614
623
  downloadName: e.downloadName,
@@ -635,13 +644,13 @@ function ne(e) {
635
644
  return { close: () => {
636
645
  } };
637
646
  _?.close();
638
- const t = Ae(e), a = t.downloadName || z(t.url, t.name);
647
+ const t = Ae(e), a = t.downloadName || K(t.url, t.name);
639
648
  let i = !1, r = null, s = null;
640
649
  const l = () => {
641
650
  i = !0, r && (A(null, r), r.remove(), r = null), s && (URL.revokeObjectURL(s), s = null), _?.close === l && (_ = null);
642
651
  };
643
652
  function d() {
644
- i || (r || (r = document.createElement("div"), document.body.appendChild(r)), A(n(De, { options: t, onDestroy: l }), r));
653
+ i || (r || (r = document.createElement("div"), document.body.appendChild(r)), A(n(ke, { options: t, onDestroy: l }), r));
645
654
  }
646
655
  function h() {
647
656
  i || (r || (r = document.createElement("div"), document.body.appendChild(r)), A(n(Y, { options: t, onDestroy: l }), r));
@@ -652,35 +661,35 @@ function ne(e) {
652
661
  function m() {
653
662
  i || te(t.url, a);
654
663
  }
655
- function k(b) {
664
+ function L(b) {
656
665
  if (i) return;
657
666
  const f = URL.createObjectURL(b);
658
667
  H(f, a), URL.revokeObjectURL(f);
659
668
  }
660
669
  const p = X(t);
661
- return R(p) ? d() : p === "unknown" ? (h(), _e(t.url).then(async (b) => {
670
+ return R(p) ? d() : p === "unknown" ? (h(), je(t.url).then(async (b) => {
662
671
  if (!i) {
663
672
  if (R(b)) {
664
673
  t.mode = b, d();
665
674
  return;
666
675
  }
667
676
  try {
668
- const f = await Z(t.url), o = K(f.type);
677
+ const f = await Z(t.url), o = Q(f.type);
669
678
  if (R(o)) {
670
679
  s = URL.createObjectURL(f), t.url = s, t.mode = o, d();
671
680
  return;
672
681
  }
673
- v(), k(f);
682
+ v(), L(f);
674
683
  } catch {
675
684
  v(), m();
676
685
  }
677
686
  }
678
687
  })) : m(), _ = { close: l }, _;
679
688
  }
680
- function Le(e) {
689
+ function Ce(e) {
681
690
  P = e;
682
691
  }
683
- function ke(e) {
692
+ function Me(e) {
684
693
  if (typeof document > "u")
685
694
  return { close: () => {
686
695
  } };
@@ -740,12 +749,12 @@ function ke(e) {
740
749
  a
741
750
  ), r);
742
751
  }
743
- const Ye = Object.assign(ne, {
744
- openByParams: ke,
745
- setup: Le
752
+ const Ne = Object.assign(ne, {
753
+ openByParams: Me,
754
+ setup: Ce
746
755
  });
747
756
  export {
748
- Ye as JtAttachmentPreview,
749
- ke as JtAttachmentPreviewByParams,
750
- Le as setupJtAttachmentPreview
757
+ Ne as JtAttachmentPreview,
758
+ Me as JtAttachmentPreviewByParams,
759
+ Ce as setupJtAttachmentPreview
751
760
  };