prlg-ui 1.8.67 → 1.8.68
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/dist/Image-BCwUQuQH.cjs +1 -0
- package/dist/{Image-CC-8vrJo.js → Image-Dg-dDZPv.js} +81 -80
- package/dist/blocks/index.cjs.js +1 -1
- package/dist/blocks/index.es.js +1 -1
- package/dist/prlg-ui.cjs.js +1 -1
- package/dist/prlg-ui.css +1 -1
- package/dist/prlg-ui.es.js +1678 -1679
- package/package.json +1 -1
- package/dist/Image-Cbf_uRLj.cjs +0 -1
package/package.json
CHANGED
package/dist/Image-Cbf_uRLj.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),d=require("./FileIcon-BE4ItwkK.cjs"),g=require("./parseFileSize.util-Bg1rLRLQ.cjs");class B{stack=[];baseZIndex={confirm:1400,modal:1300,drawer:1200,popover:1100,tooltip:1e3};step=10;childStep=1;idCounter=0;listeners=new Set;subscribe(a){return this.listeners.add(a),()=>this.listeners.delete(a)}notify(){this.listeners.forEach(a=>a())}register(a,l){const s=++this.idCounter,n=l?this.stack.find(u=>u.id===l):void 0;let i;if(n)i=n.zIndex+this.childStep;else{const u=this.stack.filter(c=>c.type===a&&!c.parentId);i=(u.length?Math.max(...u.map(c=>c.zIndex)):this.baseZIndex[a])+this.step}const o={id:s,type:a,parentId:l??null,zIndex:i};return this.stack.push(o),this.notify(),o}unregister(a){this.stack=this.stack.filter(l=>l.id!==a),this.notify()}getTop(){return this.stack.length?this.stack[this.stack.length-1]:null}isTop(a){return this.getTop()?.id===a}getStack(){return[...this.stack]}}const v=new B,k=Symbol("OVERLAY_PARENT");function y(t){const a=e.inject(k,null),l=e.ref(null);return e.onMounted(()=>{l.value=v.register(t,a??null),l.value&&e.provide(k,l.value.id)}),e.onUnmounted(()=>{l.value&&v.unregister(l.value.id)}),{zIndex:l,isTop:()=>l.value?v.isTop(l.value.id):!1}}function _(t){return t.startsWith("image/")?"image":t==="application/pdf"?"pdf":t==="application/msword"||t==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"word":t==="application/vnd.ms-excel"||t==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"excel":"other"}const I={key:1,class:"file__title"},z={key:2,class:"file__info"},E={key:0,class:"file__type"},w={key:1,class:"file__info-separator"},V={key:2,class:"file__size"},C=e.defineComponent({__name:"File",props:{file:{},viewName:{type:Boolean,default:!1},outlined:{type:Boolean,default:!0},removable:{type:Boolean}},emits:["remove"],setup(t,{emit:a}){const l=a,s=e.useId(),n=e.ref(null);async function i(r,c="image"){const m=await(await fetch(r)).blob(),p=m.type.split("/")[1]||"",h=p?`${c}.${p}`:c;return new File([m],h,{type:m.type})}const o=e.computed(()=>n.value&&n.value.mime?_(n.value.mime):null),u=e.computed(()=>{switch(o.value){case"pdf":return d.PdfIcon;case"word":return d.WordIcon;case"excel":return d.ExcelIcon;case"other":default:return d.FileIcon}});return e.onMounted(async()=>{if(typeof t.file=="string"){const r=await i(t.file);n.value={id:s,url:t.file,name:r.name,mime:r.type,size:r.size}}else n.value=t.file}),(r,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["file",{"file--outlined":r.outlined}])},[r.removable&&typeof r.file!="string"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"file__remove",onClick:c[0]||(c[0]=f=>l("remove",r.file))},[e.createVNode(e.unref(d.CloseIcon))])):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.value),{class:"file__icon"})),n.value&&n.value.name&&r.viewName?(e.openBlock(),e.createElementBlock("div",I,e.toDisplayString(n.value?n.value.name.split(".")[0]:"unknown"),1)):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createElementBlock("div",z,[n.value.mime?(e.openBlock(),e.createElementBlock("div",E,e.toDisplayString(o.value),1)):e.createCommentVNode("",!0),n.value.mime&&n.value.size?(e.openBlock(),e.createElementBlock("div",w)):e.createCommentVNode("",!0),n.value.size?(e.openBlock(),e.createElementBlock("div",V,e.toDisplayString(n.value?e.unref(g.formatFileSize)(n.value.size):"0 Б"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2))}}),N=d._export_sfc(C,[["__scopeId","data-v-9dee864d"]]),b={class:"image-full-modal__wrapper"},F={class:"image-full-modal__header"},S={class:"image-full-modal__main"},$=["src","alt"],x=e.defineComponent({__name:"ImageFullModal",props:{src:{},alt:{}},setup(t,{expose:a}){const l=e.ref(!1),{zIndex:s}=y("modal");return a({open:()=>{l.value=!0},close:()=>{l.value=!1}}),(n,i)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"image-full-modal",style:e.normalizeStyle({zIndex:e.unref(s)?.zIndex})},[e.createElementVNode("div",{class:"image-full-modal__overlay",onClick:i[0]||(i[0]=o=>l.value=!1)}),e.createElementVNode("div",b,[e.createElementVNode("div",F,[e.createElementVNode("button",{class:"image-full-modal__close",onClick:i[1]||(i[1]=o=>l.value=!1)},[e.createVNode(e.unref(d.CloseIcon))])]),e.createElementVNode("div",S,[e.createElementVNode("img",{src:n.src,alt:n.alt},null,8,$)]),i[2]||(i[2]=e.createElementVNode("div",{class:"image-full-modal__footer"},null,-1))])],4)):e.createCommentVNode("",!0)]),_:1})]))}}),M=d._export_sfc(x,[["__scopeId","data-v-b9bc03dd"]]),O=["src","alt"],T={key:1,class:"image__info"},P={key:0,class:"image__size"},R=e.defineComponent({__name:"Image",props:{file:{},alt:{},size:{default:"medium"},fullScreen:{type:Boolean},viewInfo:{type:Boolean,default:!1},zIndexPreview:{default:1002}},setup(t){const a=e.useId(),l=e.useTemplateRef("imageFullModal"),s=e.ref(null);async function n(o,u="image"){const c=await(await fetch(o)).blob(),f=c.type.split("/")[1]||"",m=f?`${u}.${f}`:u;return new File([c],m,{type:c.type})}const i=e.computed(()=>typeof t.file=="string"?t.file:t.file.url);return e.onMounted(async()=>{if(t.viewInfo)if(typeof t.file=="string"){const o=await n(t.file);s.value={id:a,url:t.file,name:o.name,mime:o.type,size:o.size}}else s.value=t.file}),(o,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["image",`image--${o.size}`,{"image--full-screen":o.fullScreen}])},[o.fullScreen?(e.openBlock(),e.createElementBlock("div",{key:0,class:"image__overlay",onClick:u[0]||(u[0]=r=>l.value?.open())},[e.createVNode(e.unref(d.EyeIcon))])):e.createCommentVNode("",!0),e.createElementVNode("img",{src:i.value,alt:o.alt},null,8,O),o.viewInfo&&s.value&&(s.value.mime||s.value.size)&&o.size==="large"?(e.openBlock(),e.createElementBlock("div",T,[s.value.size?(e.openBlock(),e.createElementBlock("div",P,e.toDisplayString(s.value?e.unref(g.formatFileSize)(s.value.size):"0 Б"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2),o.fullScreen?(e.openBlock(),e.createBlock(M,{key:0,ref:"imageFullModal",src:i.value,alt:o.alt,zIndexPreview:o.zIndexPreview},null,8,["src","alt","zIndexPreview"])):e.createCommentVNode("",!0)],64))}}),D=d._export_sfc(R,[["__scopeId","data-v-1f4b3241"]]);exports.File=N;exports.Image=D;exports.getFileTypeByMime=_;exports.useOverlay=y;
|