prlg-ui 1.7.52 → 1.7.54
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-Bb2-xPzv.cjs +1 -0
- package/dist/Image-CFurBS6J.js +197 -0
- package/dist/blocks/index.cjs.js +1 -1
- package/dist/blocks/index.es.js +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/prlg-ui.cjs.js +1 -1
- package/dist/prlg-ui.css +1 -1
- package/dist/prlg-ui.es.js +1168 -1147
- package/dist/scss/root-vars.scss +3 -0
- package/package.json +1 -1
- package/dist/Image-CHlS9buq.js +0 -213
- package/dist/Image-DIcd8Rr2.cjs +0 -1
package/dist/scss/root-vars.scss
CHANGED
package/package.json
CHANGED
package/dist/Image-CHlS9buq.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { defineComponent as w, useId as I, ref as h, computed as k, onMounted as b, createElementBlock as o, openBlock as s, normalizeClass as C, createCommentVNode as n, createBlock as F, createVNode as $, unref as _, resolveDynamicComponent as j, toDisplayString as p, Teleport as E, Transition as V, withCtx as W, createElementVNode as c, useTemplateRef as N, Fragment as O } from "vue";
|
|
2
|
-
import { F as x, E as D, W as L, P, C as B, _ as z, a as R } from "./FileIcon-DkEbi-bi.js";
|
|
3
|
-
import { f as S } from "./parseFileSize.util-BoDbFdVW.js";
|
|
4
|
-
function q(l) {
|
|
5
|
-
return l.startsWith("image/") ? "image" : l === "application/pdf" ? "pdf" : l === "application/msword" || l === "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ? "word" : l === "application/vnd.ms-excel" || l === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ? "excel" : "other";
|
|
6
|
-
}
|
|
7
|
-
const A = {
|
|
8
|
-
key: 1,
|
|
9
|
-
class: "file__title"
|
|
10
|
-
}, G = {
|
|
11
|
-
key: 2,
|
|
12
|
-
class: "file__info"
|
|
13
|
-
}, H = {
|
|
14
|
-
key: 0,
|
|
15
|
-
class: "file__type"
|
|
16
|
-
}, J = {
|
|
17
|
-
key: 1,
|
|
18
|
-
class: "file__info-separator"
|
|
19
|
-
}, K = {
|
|
20
|
-
key: 2,
|
|
21
|
-
class: "file__size"
|
|
22
|
-
}, Q = /* @__PURE__ */ w({
|
|
23
|
-
__name: "File",
|
|
24
|
-
props: {
|
|
25
|
-
file: {},
|
|
26
|
-
viewName: { type: Boolean, default: !1 },
|
|
27
|
-
outlined: { type: Boolean, default: !0 },
|
|
28
|
-
removable: { type: Boolean }
|
|
29
|
-
},
|
|
30
|
-
emits: ["remove"],
|
|
31
|
-
setup(l, { emit: d }) {
|
|
32
|
-
const u = d, i = I(), e = h(null);
|
|
33
|
-
async function m(a, r = "image") {
|
|
34
|
-
const f = await (await fetch(a)).blob(), y = f.type.split("/")[1] || "", M = y ? `${r}.${y}` : r;
|
|
35
|
-
return new File([f], M, { type: f.type });
|
|
36
|
-
}
|
|
37
|
-
const g = k(() => e.value && e.value.mime ? q(e.value.mime) : null), t = k(() => {
|
|
38
|
-
switch (g.value) {
|
|
39
|
-
case "pdf":
|
|
40
|
-
return P;
|
|
41
|
-
case "word":
|
|
42
|
-
return L;
|
|
43
|
-
case "excel":
|
|
44
|
-
return D;
|
|
45
|
-
case "other":
|
|
46
|
-
default:
|
|
47
|
-
return x;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
return b(async () => {
|
|
51
|
-
if (typeof l.file == "string") {
|
|
52
|
-
const a = await m(l.file);
|
|
53
|
-
e.value = {
|
|
54
|
-
id: i,
|
|
55
|
-
url: l.file,
|
|
56
|
-
name: a.name,
|
|
57
|
-
mime: a.type,
|
|
58
|
-
size: a.size
|
|
59
|
-
};
|
|
60
|
-
} else
|
|
61
|
-
e.value = l.file;
|
|
62
|
-
}), (a, r) => (s(), o("div", {
|
|
63
|
-
class: C(["file", { "file--outlined": a.outlined }])
|
|
64
|
-
}, [
|
|
65
|
-
a.removable && typeof a.file != "string" ? (s(), o("button", {
|
|
66
|
-
key: 0,
|
|
67
|
-
class: "file__remove",
|
|
68
|
-
onClick: r[0] || (r[0] = (v) => u("remove", a.file))
|
|
69
|
-
}, [
|
|
70
|
-
$(_(B))
|
|
71
|
-
])) : n("", !0),
|
|
72
|
-
(s(), F(j(t.value), { class: "file__icon" })),
|
|
73
|
-
e.value && e.value.name && a.viewName ? (s(), o("div", A, p(e.value ? e.value.name.split(".")[0] : "unknown"), 1)) : n("", !0),
|
|
74
|
-
e.value ? (s(), o("div", G, [
|
|
75
|
-
e.value.mime ? (s(), o("div", H, p(g.value), 1)) : n("", !0),
|
|
76
|
-
e.value.mime && e.value.size ? (s(), o("div", J)) : n("", !0),
|
|
77
|
-
e.value.size ? (s(), o("div", K, p(e.value ? _(S)(e.value.size) : "0 Б"), 1)) : n("", !0)
|
|
78
|
-
])) : n("", !0)
|
|
79
|
-
], 2));
|
|
80
|
-
}
|
|
81
|
-
}), me = /* @__PURE__ */ z(Q, [["__scopeId", "data-v-9dee864d"]]), T = {
|
|
82
|
-
key: 0,
|
|
83
|
-
class: "image-full-modal"
|
|
84
|
-
}, U = { class: "image-full-modal__wrapper" }, X = { class: "image-full-modal__header" }, Y = { class: "image-full-modal__main" }, Z = ["src", "alt"], ee = /* @__PURE__ */ w({
|
|
85
|
-
__name: "ImageFullModal",
|
|
86
|
-
props: {
|
|
87
|
-
src: {},
|
|
88
|
-
alt: {}
|
|
89
|
-
},
|
|
90
|
-
setup(l, { expose: d }) {
|
|
91
|
-
const u = h(!1);
|
|
92
|
-
return d({
|
|
93
|
-
open: () => {
|
|
94
|
-
u.value = !0;
|
|
95
|
-
},
|
|
96
|
-
close: () => {
|
|
97
|
-
u.value = !1;
|
|
98
|
-
}
|
|
99
|
-
}), (i, e) => (s(), F(E, { to: "body" }, [
|
|
100
|
-
$(V, { name: "fade" }, {
|
|
101
|
-
default: W(() => [
|
|
102
|
-
u.value ? (s(), o("div", T, [
|
|
103
|
-
c("div", {
|
|
104
|
-
class: "image-full-modal__overlay",
|
|
105
|
-
onClick: e[0] || (e[0] = (m) => u.value = !1)
|
|
106
|
-
}),
|
|
107
|
-
c("div", U, [
|
|
108
|
-
c("div", X, [
|
|
109
|
-
c("button", {
|
|
110
|
-
class: "image-full-modal__close",
|
|
111
|
-
onClick: e[1] || (e[1] = (m) => u.value = !1)
|
|
112
|
-
}, [
|
|
113
|
-
$(_(B))
|
|
114
|
-
])
|
|
115
|
-
]),
|
|
116
|
-
c("div", Y, [
|
|
117
|
-
c("img", {
|
|
118
|
-
src: i.src,
|
|
119
|
-
alt: i.alt
|
|
120
|
-
}, null, 8, Z)
|
|
121
|
-
]),
|
|
122
|
-
e[2] || (e[2] = c("div", { class: "image-full-modal__footer" }, null, -1))
|
|
123
|
-
])
|
|
124
|
-
])) : n("", !0)
|
|
125
|
-
]),
|
|
126
|
-
_: 1
|
|
127
|
-
})
|
|
128
|
-
]));
|
|
129
|
-
}
|
|
130
|
-
}), le = /* @__PURE__ */ z(ee, [["__scopeId", "data-v-edc1a47e"]]), ae = ["src", "alt"], te = {
|
|
131
|
-
key: 1,
|
|
132
|
-
class: "image__info"
|
|
133
|
-
}, ie = {
|
|
134
|
-
key: 0,
|
|
135
|
-
class: "image__type"
|
|
136
|
-
}, se = {
|
|
137
|
-
key: 1,
|
|
138
|
-
class: "image__info-separator"
|
|
139
|
-
}, oe = {
|
|
140
|
-
key: 2,
|
|
141
|
-
class: "image__size"
|
|
142
|
-
}, ne = /* @__PURE__ */ w({
|
|
143
|
-
__name: "Image",
|
|
144
|
-
props: {
|
|
145
|
-
file: {},
|
|
146
|
-
alt: {},
|
|
147
|
-
size: { default: "medium" },
|
|
148
|
-
fullScreen: { type: Boolean }
|
|
149
|
-
},
|
|
150
|
-
setup(l) {
|
|
151
|
-
const d = I(), u = N("imageFullModal"), i = h(null);
|
|
152
|
-
async function e(t, a = "image") {
|
|
153
|
-
const v = await (await fetch(t)).blob(), f = v.type.split("/")[1] || "", y = f ? `${a}.${f}` : a;
|
|
154
|
-
return new File([v], y, { type: v.type });
|
|
155
|
-
}
|
|
156
|
-
const m = k(() => typeof l.file == "string" ? l.file : l.file.url);
|
|
157
|
-
function g(t) {
|
|
158
|
-
if (t.startsWith("image/"))
|
|
159
|
-
return t.replace("image/", "").toLowerCase();
|
|
160
|
-
const a = t.match(/\.(jpeg|jpg|png|gif|webp|bmp|svg|tiff|ico)(\?.*)?$/i);
|
|
161
|
-
if (a) {
|
|
162
|
-
let r = a[1].toLowerCase();
|
|
163
|
-
return r === "jpg" && (r = "jpeg"), r;
|
|
164
|
-
}
|
|
165
|
-
return "unknown";
|
|
166
|
-
}
|
|
167
|
-
return b(async () => {
|
|
168
|
-
if (typeof l.file == "string") {
|
|
169
|
-
const t = await e(l.file);
|
|
170
|
-
i.value = {
|
|
171
|
-
id: d,
|
|
172
|
-
url: l.file,
|
|
173
|
-
name: t.name,
|
|
174
|
-
mime: t.type,
|
|
175
|
-
size: t.size
|
|
176
|
-
};
|
|
177
|
-
} else
|
|
178
|
-
i.value = l.file;
|
|
179
|
-
}), (t, a) => (s(), o(O, null, [
|
|
180
|
-
c("div", {
|
|
181
|
-
class: C(["image", `image--${t.size}`, { "image--full-screen": t.fullScreen }])
|
|
182
|
-
}, [
|
|
183
|
-
t.fullScreen ? (s(), o("div", {
|
|
184
|
-
key: 0,
|
|
185
|
-
class: "image__overlay",
|
|
186
|
-
onClick: a[0] || (a[0] = (r) => u.value?.open())
|
|
187
|
-
}, [
|
|
188
|
-
$(_(R))
|
|
189
|
-
])) : n("", !0),
|
|
190
|
-
c("img", {
|
|
191
|
-
src: m.value,
|
|
192
|
-
alt: t.alt
|
|
193
|
-
}, null, 8, ae),
|
|
194
|
-
i.value && (i.value.mime || i.value.size) && t.size === "large" ? (s(), o("div", te, [
|
|
195
|
-
i.value.mime ? (s(), o("div", ie, p(g(i.value.mime)), 1)) : n("", !0),
|
|
196
|
-
i.value.mime && i.value.size ? (s(), o("div", se)) : n("", !0),
|
|
197
|
-
i.value.size ? (s(), o("div", oe, p(i.value ? _(S)(i.value.size) : "0 Б"), 1)) : n("", !0)
|
|
198
|
-
])) : n("", !0)
|
|
199
|
-
], 2),
|
|
200
|
-
t.fullScreen ? (s(), F(le, {
|
|
201
|
-
key: 0,
|
|
202
|
-
ref: "imageFullModal",
|
|
203
|
-
src: m.value,
|
|
204
|
-
alt: t.alt
|
|
205
|
-
}, null, 8, ["src", "alt"])) : n("", !0)
|
|
206
|
-
], 64));
|
|
207
|
-
}
|
|
208
|
-
}), fe = /* @__PURE__ */ z(ne, [["__scopeId", "data-v-5d09d408"]]);
|
|
209
|
-
export {
|
|
210
|
-
me as F,
|
|
211
|
-
fe as I,
|
|
212
|
-
q as g
|
|
213
|
-
};
|
package/dist/Image-DIcd8Rr2.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),s=require("./FileIcon-sxADkCIe.cjs"),v=require("./parseFileSize.util-BTDZr2sf.cjs");function _(l){return l.startsWith("image/")?"image":l==="application/pdf"?"pdf":l==="application/msword"||l==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"word":l==="application/vnd.ms-excel"||l==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?"excel":"other"}const k={key:1,class:"file__title"},y={key:2,class:"file__info"},B={key:0,class:"file__type"},C={key:1,class:"file__info-separator"},V={key:2,class:"file__size"},N=e.defineComponent({__name:"File",props:{file:{},viewName:{type:Boolean,default:!1},outlined:{type:Boolean,default:!0},removable:{type:Boolean}},emits:["remove"],setup(l,{emit:u}){const c=u,n=e.useId(),t=e.ref(null);async function r(o,i="image"){const m=await(await fetch(o)).blob(),p=m.type.split("/")[1]||"",g=p?`${i}.${p}`:i;return new File([m],g,{type:m.type})}const f=e.computed(()=>t.value&&t.value.mime?_(t.value.mime):null),a=e.computed(()=>{switch(f.value){case"pdf":return s.PdfIcon;case"word":return s.WordIcon;case"excel":return s.ExcelIcon;case"other":default:return s.FileIcon}});return e.onMounted(async()=>{if(typeof l.file=="string"){const o=await r(l.file);t.value={id:n,url:l.file,name:o.name,mime:o.type,size:o.size}}else t.value=l.file}),(o,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["file",{"file--outlined":o.outlined}])},[o.removable&&typeof o.file!="string"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"file__remove",onClick:i[0]||(i[0]=d=>c("remove",o.file))},[e.createVNode(e.unref(s.CloseIcon))])):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),{class:"file__icon"})),t.value&&t.value.name&&o.viewName?(e.openBlock(),e.createElementBlock("div",k,e.toDisplayString(t.value?t.value.name.split(".")[0]:"unknown"),1)):e.createCommentVNode("",!0),t.value?(e.openBlock(),e.createElementBlock("div",y,[t.value.mime?(e.openBlock(),e.createElementBlock("div",B,e.toDisplayString(f.value),1)):e.createCommentVNode("",!0),t.value.mime&&t.value.size?(e.openBlock(),e.createElementBlock("div",C)):e.createCommentVNode("",!0),t.value.size?(e.openBlock(),e.createElementBlock("div",V,e.toDisplayString(t.value?e.unref(v.formatFileSize)(t.value.size):"0 Б"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2))}}),E=s._export_sfc(N,[["__scopeId","data-v-9dee864d"]]),F={key:0,class:"image-full-modal"},$={class:"image-full-modal__wrapper"},w={class:"image-full-modal__header"},h={class:"image-full-modal__main"},z=["src","alt"],I=e.defineComponent({__name:"ImageFullModal",props:{src:{},alt:{}},setup(l,{expose:u}){const c=e.ref(!1);return u({open:()=>{c.value=!0},close:()=>{c.value=!1}}),(n,t)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("div",{class:"image-full-modal__overlay",onClick:t[0]||(t[0]=r=>c.value=!1)}),e.createElementVNode("div",$,[e.createElementVNode("div",w,[e.createElementVNode("button",{class:"image-full-modal__close",onClick:t[1]||(t[1]=r=>c.value=!1)},[e.createVNode(e.unref(s.CloseIcon))])]),e.createElementVNode("div",h,[e.createElementVNode("img",{src:n.src,alt:n.alt},null,8,z)]),t[2]||(t[2]=e.createElementVNode("div",{class:"image-full-modal__footer"},null,-1))])])):e.createCommentVNode("",!0)]),_:1})]))}}),b=s._export_sfc(I,[["__scopeId","data-v-edc1a47e"]]),S=["src","alt"],M={key:1,class:"image__info"},j={key:0,class:"image__type"},D={key:1,class:"image__info-separator"},q={key:2,class:"image__size"},x=e.defineComponent({__name:"Image",props:{file:{},alt:{},size:{default:"medium"},fullScreen:{type:Boolean}},setup(l){const u=e.useId(),c=e.useTemplateRef("imageFullModal"),n=e.ref(null);async function t(a,o="image"){const d=await(await fetch(a)).blob(),m=d.type.split("/")[1]||"",p=m?`${o}.${m}`:o;return new File([d],p,{type:d.type})}const r=e.computed(()=>typeof l.file=="string"?l.file:l.file.url);function f(a){if(a.startsWith("image/"))return a.replace("image/","").toLowerCase();const o=a.match(/\.(jpeg|jpg|png|gif|webp|bmp|svg|tiff|ico)(\?.*)?$/i);if(o){let i=o[1].toLowerCase();return i==="jpg"&&(i="jpeg"),i}return"unknown"}return e.onMounted(async()=>{if(typeof l.file=="string"){const a=await t(l.file);n.value={id:u,url:l.file,name:a.name,mime:a.type,size:a.size}}else n.value=l.file}),(a,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["image",`image--${a.size}`,{"image--full-screen":a.fullScreen}])},[a.fullScreen?(e.openBlock(),e.createElementBlock("div",{key:0,class:"image__overlay",onClick:o[0]||(o[0]=i=>c.value?.open())},[e.createVNode(e.unref(s.EyeIcon))])):e.createCommentVNode("",!0),e.createElementVNode("img",{src:r.value,alt:a.alt},null,8,S),n.value&&(n.value.mime||n.value.size)&&a.size==="large"?(e.openBlock(),e.createElementBlock("div",M,[n.value.mime?(e.openBlock(),e.createElementBlock("div",j,e.toDisplayString(f(n.value.mime)),1)):e.createCommentVNode("",!0),n.value.mime&&n.value.size?(e.openBlock(),e.createElementBlock("div",D)):e.createCommentVNode("",!0),n.value.size?(e.openBlock(),e.createElementBlock("div",q,e.toDisplayString(n.value?e.unref(v.formatFileSize)(n.value.size):"0 Б"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2),a.fullScreen?(e.openBlock(),e.createBlock(b,{key:0,ref:"imageFullModal",src:r.value,alt:a.alt},null,8,["src","alt"])):e.createCommentVNode("",!0)],64))}}),O=s._export_sfc(x,[["__scopeId","data-v-5d09d408"]]);exports.File=E;exports.Image=O;exports.getFileTypeByMime=_;
|