prlg-ui 1.8.90 → 1.8.91
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-BHDBSn7B.cjs +1 -0
- package/dist/{Image-6zoTMdCp.js → Image-CAGIshx9.js} +93 -91
- 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 +5 -4
- package/package.json +1 -1
- package/dist/Image-OgzfB2zs.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),m=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=50;idCounter=0;listeners=new Set;subscribe(a){return this.listeners.add(a),()=>this.listeners.delete(a)}notify(){this.listeners.forEach(a=>a())}register(a,o){const i=++this.idCounter,l=o?this.stack.find(u=>u.id===o):void 0;let s;if(l)s=l.zIndex+this.childStep;else{const u=this.stack.filter(c=>c.type===a&&!c.parentId);s=(u.length?Math.max(...u.map(c=>c.zIndex)):this.baseZIndex[a])+this.step}const n={id:i,type:a,parentId:o??null,zIndex:s};return this.stack.push(n),this.notify(),n}unregister(a){this.stack=this.stack.filter(o=>o.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 p=new B,k=Symbol("OVERLAY_PARENT");function y(t){const a=e.inject(k,null),o=e.ref(null);return e.onMounted(()=>{o.value=p.register(t,a??null)}),e.onUnmounted(()=>{o.value&&p.unregister(o.value.id)}),e.watch(o,i=>{i&&e.provide(k,i.id)},{immediate:!0}),{zIndex:o,isTop:()=>o.value?p.isTop(o.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"},V={key:1,class:"file__info-separator"},C={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(t,{emit:a}){const o=a,i=e.useId(),l=e.ref(null);async function s(r,c="image"){const d=await(await fetch(r)).blob(),v=d.type.split("/")[1]||"",h=v?`${c}.${v}`:c;return new File([d],h,{type:d.type})}const n=e.computed(()=>l.value&&l.value.mime?_(l.value.mime):null),u=e.computed(()=>{switch(n.value){case"pdf":return m.PdfIcon;case"word":return m.WordIcon;case"excel":return m.ExcelIcon;case"other":default:return m.FileIcon}});return e.onMounted(async()=>{if(typeof t.file=="string"){const r=await s(t.file);l.value={id:i,url:t.file,name:r.name,mime:r.type,size:r.size}}else l.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=>o("remove",r.file))},[e.createVNode(e.unref(m.CloseIcon))])):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.value),{class:"file__icon"})),l.value&&l.value.name&&r.viewName?(e.openBlock(),e.createElementBlock("div",I,e.toDisplayString(l.value?l.value.name.split(".")[0]:"unknown"),1)):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createElementBlock("div",z,[l.value.mime?(e.openBlock(),e.createElementBlock("div",E,e.toDisplayString(n.value),1)):e.createCommentVNode("",!0),l.value.mime&&l.value.size?(e.openBlock(),e.createElementBlock("div",V)):e.createCommentVNode("",!0),l.value.size?(e.openBlock(),e.createElementBlock("div",C,e.toDisplayString(l.value?e.unref(g.formatFileSize)(l.value.size):"0 Б"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2))}}),w=m._export_sfc(N,[["__scopeId","data-v-9dee864d"]]),F={class:"image-full-modal__wrapper"},b={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 o=e.ref(!1),{zIndex:i}=y("modal");return a({open:()=>{o.value=!0},close:()=>{o.value=!1}}),(l,s)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[o.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"image-full-modal",style:e.normalizeStyle({zIndex:e.unref(i)?.zIndex})},[e.createElementVNode("div",{class:"image-full-modal__overlay",onClick:s[0]||(s[0]=n=>o.value=!1)}),e.createElementVNode("div",F,[e.createElementVNode("div",b,[e.createElementVNode("button",{class:"image-full-modal__close",onClick:s[1]||(s[1]=n=>o.value=!1)},[e.createVNode(e.unref(m.CloseIcon))])]),e.createElementVNode("div",S,[e.createElementVNode("img",{src:l.src,alt:l.alt},null,8,$)]),s[2]||(s[2]=e.createElementVNode("div",{class:"image-full-modal__footer"},null,-1))])],4)):e.createCommentVNode("",!0)]),_:1})]))}}),M=m._export_sfc(x,[["__scopeId","data-v-b9bc03dd"]]),O=["src","alt"],T={key:1,class:"image__info"},R={key:0,class:"image__size"},D=e.defineComponent({__name:"Image",props:{file:{},alt:{},size:{default:"medium"},fullScreen:{type:Boolean},viewInfo:{type:Boolean,default:!1}},setup(t){const a=e.useId(),o=e.useTemplateRef("imageFullModal"),i=e.ref(null);async function l(n,u="image"){const c=await(await fetch(n)).blob(),f=c.type.split("/")[1]||"",d=f?`${u}.${f}`:u;return new File([c],d,{type:c.type})}const s=e.computed(()=>typeof t.file=="string"?t.file:t.file.url);return e.onMounted(async()=>{if(t.viewInfo)if(typeof t.file=="string"){const n=await l(t.file);i.value={id:a,url:t.file,name:n.name,mime:n.type,size:n.size}}else i.value=t.file}),(n,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["image",`image--${n.size}`,{"image--full-screen":n.fullScreen}])},[n.fullScreen?(e.openBlock(),e.createElementBlock("div",{key:0,class:"image__overlay",onClick:u[0]||(u[0]=r=>o.value?.open())},[e.createVNode(e.unref(m.EyeIcon))])):e.createCommentVNode("",!0),e.createElementVNode("img",{src:s.value,alt:n.alt},null,8,O),n.viewInfo&&i.value&&(i.value.mime||i.value.size)&&n.size==="large"?(e.openBlock(),e.createElementBlock("div",T,[i.value.size?(e.openBlock(),e.createElementBlock("div",R,e.toDisplayString(i.value?e.unref(g.formatFileSize)(i.value.size):"0 Б"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2),n.fullScreen?(e.openBlock(),e.createBlock(M,{key:0,ref:"imageFullModal",src:s.value,alt:n.alt},null,8,["src","alt"])):e.createCommentVNode("",!0)],64))}}),A=m._export_sfc(D,[["__scopeId","data-v-cc14d604"]]);exports.File=w;exports.Image=A;exports.getFileTypeByMime=_;exports.useOverlay=y;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { inject as O, ref as h, onMounted as z,
|
|
2
|
-
import { F as
|
|
1
|
+
import { inject as O, ref as h, onMounted as z, onUnmounted as T, watch as V, provide as R, defineComponent as w, useId as C, computed as I, createElementBlock as d, openBlock as o, normalizeClass as x, createCommentVNode as f, createBlock as b, createVNode as _, unref as v, resolveDynamicComponent as N, toDisplayString as y, Teleport as A, Transition as P, withCtx as Z, normalizeStyle as j, createElementVNode as m, useTemplateRef as W, Fragment as Y } from "vue";
|
|
2
|
+
import { F as D, E as L, W as K, P as U, C as E, _ as F, a as q } from "./FileIcon-maHE2Nhr.js";
|
|
3
3
|
import { f as M } from "./parseFileSize.util-CxVk4CvB.js";
|
|
4
|
-
class
|
|
4
|
+
class G {
|
|
5
5
|
stack = [];
|
|
6
6
|
baseZIndex = {
|
|
7
7
|
confirm: 1400,
|
|
@@ -12,8 +12,8 @@ class q {
|
|
|
12
12
|
};
|
|
13
13
|
step = 10;
|
|
14
14
|
// шаг между "корневыми" оверлеями одного типа
|
|
15
|
-
childStep =
|
|
16
|
-
// шаг для вложенных (popover внутри modal и т.д.)
|
|
15
|
+
childStep = 50;
|
|
16
|
+
// шаг для вложенных (popover внутри modal и т.д.) - увеличиваем для гарантии
|
|
17
17
|
idCounter = 0;
|
|
18
18
|
listeners = /* @__PURE__ */ new Set();
|
|
19
19
|
subscribe(a) {
|
|
@@ -22,20 +22,20 @@ class q {
|
|
|
22
22
|
notify() {
|
|
23
23
|
this.listeners.forEach((a) => a());
|
|
24
24
|
}
|
|
25
|
-
register(a,
|
|
26
|
-
const
|
|
27
|
-
let
|
|
28
|
-
if (
|
|
29
|
-
|
|
25
|
+
register(a, l) {
|
|
26
|
+
const i = ++this.idCounter, t = l ? this.stack.find((c) => c.id === l) : void 0;
|
|
27
|
+
let n;
|
|
28
|
+
if (t)
|
|
29
|
+
n = t.zIndex + this.childStep;
|
|
30
30
|
else {
|
|
31
31
|
const c = this.stack.filter((u) => u.type === a && !u.parentId);
|
|
32
|
-
|
|
32
|
+
n = (c.length ? Math.max(...c.map((u) => u.zIndex)) : this.baseZIndex[a]) + this.step;
|
|
33
33
|
}
|
|
34
|
-
const s = { id:
|
|
34
|
+
const s = { id: i, type: a, parentId: l ?? null, zIndex: n };
|
|
35
35
|
return this.stack.push(s), this.notify(), s;
|
|
36
36
|
}
|
|
37
37
|
unregister(a) {
|
|
38
|
-
this.stack = this.stack.filter((
|
|
38
|
+
this.stack = this.stack.filter((l) => l.id !== a), this.notify();
|
|
39
39
|
}
|
|
40
40
|
getTop() {
|
|
41
41
|
return this.stack.length ? this.stack[this.stack.length - 1] : null;
|
|
@@ -47,37 +47,39 @@ class q {
|
|
|
47
47
|
return [...this.stack];
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
const k = new
|
|
51
|
-
function
|
|
52
|
-
const a = O(S, null),
|
|
50
|
+
const k = new G(), S = Symbol("OVERLAY_PARENT");
|
|
51
|
+
function H(e) {
|
|
52
|
+
const a = O(S, null), l = h(null);
|
|
53
53
|
return z(() => {
|
|
54
|
-
|
|
55
|
-
}),
|
|
56
|
-
|
|
57
|
-
}), {
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
l.value = k.register(e, a ?? null);
|
|
55
|
+
}), T(() => {
|
|
56
|
+
l.value && k.unregister(l.value.id);
|
|
57
|
+
}), V(l, (i) => {
|
|
58
|
+
i && R(S, i.id);
|
|
59
|
+
}, { immediate: !0 }), {
|
|
60
|
+
zIndex: l,
|
|
61
|
+
isTop: () => l.value ? k.isTop(l.value.id) : !1
|
|
60
62
|
};
|
|
61
63
|
}
|
|
62
|
-
function
|
|
64
|
+
function J(e) {
|
|
63
65
|
return e.startsWith("image/") ? "image" : e === "application/pdf" ? "pdf" : e === "application/msword" || e === "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ? "word" : e === "application/vnd.ms-excel" || e === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ? "excel" : "other";
|
|
64
66
|
}
|
|
65
|
-
const
|
|
67
|
+
const Q = {
|
|
66
68
|
key: 1,
|
|
67
69
|
class: "file__title"
|
|
68
|
-
},
|
|
70
|
+
}, X = {
|
|
69
71
|
key: 2,
|
|
70
72
|
class: "file__info"
|
|
71
|
-
},
|
|
73
|
+
}, ee = {
|
|
72
74
|
key: 0,
|
|
73
75
|
class: "file__type"
|
|
74
|
-
},
|
|
76
|
+
}, te = {
|
|
75
77
|
key: 1,
|
|
76
78
|
class: "file__info-separator"
|
|
77
|
-
},
|
|
79
|
+
}, le = {
|
|
78
80
|
key: 2,
|
|
79
81
|
class: "file__size"
|
|
80
|
-
},
|
|
82
|
+
}, se = /* @__PURE__ */ w({
|
|
81
83
|
__name: "File",
|
|
82
84
|
props: {
|
|
83
85
|
file: {},
|
|
@@ -87,98 +89,98 @@ const J = {
|
|
|
87
89
|
},
|
|
88
90
|
emits: ["remove"],
|
|
89
91
|
setup(e, { emit: a }) {
|
|
90
|
-
const
|
|
91
|
-
async function
|
|
92
|
+
const l = a, i = C(), t = h(null);
|
|
93
|
+
async function n(r, u = "image") {
|
|
92
94
|
const p = await (await fetch(r)).blob(), $ = p.type.split("/")[1] || "", B = $ ? `${u}.${$}` : u;
|
|
93
95
|
return new File([p], B, { type: p.type });
|
|
94
96
|
}
|
|
95
|
-
const s = I(() =>
|
|
97
|
+
const s = I(() => t.value && t.value.mime ? J(t.value.mime) : null), c = I(() => {
|
|
96
98
|
switch (s.value) {
|
|
97
99
|
case "pdf":
|
|
98
|
-
return
|
|
100
|
+
return U;
|
|
99
101
|
case "word":
|
|
100
|
-
return
|
|
102
|
+
return K;
|
|
101
103
|
case "excel":
|
|
102
|
-
return
|
|
104
|
+
return L;
|
|
103
105
|
case "other":
|
|
104
106
|
default:
|
|
105
|
-
return
|
|
107
|
+
return D;
|
|
106
108
|
}
|
|
107
109
|
});
|
|
108
110
|
return z(async () => {
|
|
109
111
|
if (typeof e.file == "string") {
|
|
110
|
-
const r = await
|
|
111
|
-
|
|
112
|
-
id:
|
|
112
|
+
const r = await n(e.file);
|
|
113
|
+
t.value = {
|
|
114
|
+
id: i,
|
|
113
115
|
url: e.file,
|
|
114
116
|
name: r.name,
|
|
115
117
|
mime: r.type,
|
|
116
118
|
size: r.size
|
|
117
119
|
};
|
|
118
120
|
} else
|
|
119
|
-
|
|
120
|
-
}), (r, u) => (
|
|
121
|
+
t.value = e.file;
|
|
122
|
+
}), (r, u) => (o(), d("div", {
|
|
121
123
|
class: x(["file", { "file--outlined": r.outlined }])
|
|
122
124
|
}, [
|
|
123
|
-
r.removable && typeof r.file != "string" ? (
|
|
125
|
+
r.removable && typeof r.file != "string" ? (o(), d("button", {
|
|
124
126
|
key: 0,
|
|
125
127
|
class: "file__remove",
|
|
126
|
-
onClick: u[0] || (u[0] = (g) =>
|
|
128
|
+
onClick: u[0] || (u[0] = (g) => l("remove", r.file))
|
|
127
129
|
}, [
|
|
128
130
|
_(v(E))
|
|
129
131
|
])) : f("", !0),
|
|
130
|
-
(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
(o(), b(N(c.value), { class: "file__icon" })),
|
|
133
|
+
t.value && t.value.name && r.viewName ? (o(), d("div", Q, y(t.value ? t.value.name.split(".")[0] : "unknown"), 1)) : f("", !0),
|
|
134
|
+
t.value ? (o(), d("div", X, [
|
|
135
|
+
t.value.mime ? (o(), d("div", ee, y(s.value), 1)) : f("", !0),
|
|
136
|
+
t.value.mime && t.value.size ? (o(), d("div", te)) : f("", !0),
|
|
137
|
+
t.value.size ? (o(), d("div", le, y(t.value ? v(M)(t.value.size) : "0 Б"), 1)) : f("", !0)
|
|
136
138
|
])) : f("", !0)
|
|
137
139
|
], 2));
|
|
138
140
|
}
|
|
139
|
-
}),
|
|
141
|
+
}), ye = /* @__PURE__ */ F(se, [["__scopeId", "data-v-9dee864d"]]), ae = { class: "image-full-modal__wrapper" }, ie = { class: "image-full-modal__header" }, ne = { class: "image-full-modal__main" }, oe = ["src", "alt"], re = /* @__PURE__ */ w({
|
|
140
142
|
__name: "ImageFullModal",
|
|
141
143
|
props: {
|
|
142
144
|
src: {},
|
|
143
145
|
alt: {}
|
|
144
146
|
},
|
|
145
147
|
setup(e, { expose: a }) {
|
|
146
|
-
const
|
|
148
|
+
const l = h(!1), { zIndex: i } = H("modal");
|
|
147
149
|
return a({
|
|
148
150
|
open: () => {
|
|
149
|
-
|
|
151
|
+
l.value = !0;
|
|
150
152
|
},
|
|
151
153
|
close: () => {
|
|
152
|
-
|
|
154
|
+
l.value = !1;
|
|
153
155
|
}
|
|
154
|
-
}), (
|
|
155
|
-
_(
|
|
156
|
-
default:
|
|
157
|
-
|
|
156
|
+
}), (t, n) => (o(), b(A, { to: "body" }, [
|
|
157
|
+
_(P, { name: "fade" }, {
|
|
158
|
+
default: Z(() => [
|
|
159
|
+
l.value ? (o(), d("div", {
|
|
158
160
|
key: 0,
|
|
159
161
|
class: "image-full-modal",
|
|
160
|
-
style:
|
|
162
|
+
style: j({ zIndex: v(i)?.zIndex })
|
|
161
163
|
}, [
|
|
162
164
|
m("div", {
|
|
163
165
|
class: "image-full-modal__overlay",
|
|
164
|
-
onClick:
|
|
166
|
+
onClick: n[0] || (n[0] = (s) => l.value = !1)
|
|
165
167
|
}),
|
|
166
|
-
m("div",
|
|
167
|
-
m("div",
|
|
168
|
+
m("div", ae, [
|
|
169
|
+
m("div", ie, [
|
|
168
170
|
m("button", {
|
|
169
171
|
class: "image-full-modal__close",
|
|
170
|
-
onClick:
|
|
172
|
+
onClick: n[1] || (n[1] = (s) => l.value = !1)
|
|
171
173
|
}, [
|
|
172
174
|
_(v(E))
|
|
173
175
|
])
|
|
174
176
|
]),
|
|
175
|
-
m("div",
|
|
177
|
+
m("div", ne, [
|
|
176
178
|
m("img", {
|
|
177
|
-
src:
|
|
178
|
-
alt:
|
|
179
|
-
}, null, 8,
|
|
179
|
+
src: t.src,
|
|
180
|
+
alt: t.alt
|
|
181
|
+
}, null, 8, oe)
|
|
180
182
|
]),
|
|
181
|
-
|
|
183
|
+
n[2] || (n[2] = m("div", { class: "image-full-modal__footer" }, null, -1))
|
|
182
184
|
])
|
|
183
185
|
], 4)) : f("", !0)
|
|
184
186
|
]),
|
|
@@ -186,13 +188,13 @@ const J = {
|
|
|
186
188
|
})
|
|
187
189
|
]));
|
|
188
190
|
}
|
|
189
|
-
}),
|
|
191
|
+
}), ue = /* @__PURE__ */ F(re, [["__scopeId", "data-v-b9bc03dd"]]), ce = ["src", "alt"], de = {
|
|
190
192
|
key: 1,
|
|
191
193
|
class: "image__info"
|
|
192
|
-
},
|
|
194
|
+
}, fe = {
|
|
193
195
|
key: 0,
|
|
194
196
|
class: "image__size"
|
|
195
|
-
},
|
|
197
|
+
}, me = /* @__PURE__ */ w({
|
|
196
198
|
__name: "Image",
|
|
197
199
|
props: {
|
|
198
200
|
file: {},
|
|
@@ -202,17 +204,17 @@ const J = {
|
|
|
202
204
|
viewInfo: { type: Boolean, default: !1 }
|
|
203
205
|
},
|
|
204
206
|
setup(e) {
|
|
205
|
-
const a = C(),
|
|
206
|
-
async function
|
|
207
|
+
const a = C(), l = W("imageFullModal"), i = h(null);
|
|
208
|
+
async function t(s, c = "image") {
|
|
207
209
|
const u = await (await fetch(s)).blob(), g = u.type.split("/")[1] || "", p = g ? `${c}.${g}` : c;
|
|
208
210
|
return new File([u], p, { type: u.type });
|
|
209
211
|
}
|
|
210
|
-
const
|
|
212
|
+
const n = I(() => typeof e.file == "string" ? e.file : e.file.url);
|
|
211
213
|
return z(async () => {
|
|
212
214
|
if (e.viewInfo)
|
|
213
215
|
if (typeof e.file == "string") {
|
|
214
|
-
const s = await
|
|
215
|
-
|
|
216
|
+
const s = await t(e.file);
|
|
217
|
+
i.value = {
|
|
216
218
|
id: a,
|
|
217
219
|
url: e.file,
|
|
218
220
|
name: s.name,
|
|
@@ -220,38 +222,38 @@ const J = {
|
|
|
220
222
|
size: s.size
|
|
221
223
|
};
|
|
222
224
|
} else
|
|
223
|
-
|
|
224
|
-
}), (s, c) => (
|
|
225
|
+
i.value = e.file;
|
|
226
|
+
}), (s, c) => (o(), d(Y, null, [
|
|
225
227
|
m("div", {
|
|
226
228
|
class: x(["image", `image--${s.size}`, { "image--full-screen": s.fullScreen }])
|
|
227
229
|
}, [
|
|
228
|
-
s.fullScreen ? (
|
|
230
|
+
s.fullScreen ? (o(), d("div", {
|
|
229
231
|
key: 0,
|
|
230
232
|
class: "image__overlay",
|
|
231
|
-
onClick: c[0] || (c[0] = (r) =>
|
|
233
|
+
onClick: c[0] || (c[0] = (r) => l.value?.open())
|
|
232
234
|
}, [
|
|
233
|
-
_(v(
|
|
235
|
+
_(v(q))
|
|
234
236
|
])) : f("", !0),
|
|
235
237
|
m("img", {
|
|
236
|
-
src:
|
|
238
|
+
src: n.value,
|
|
237
239
|
alt: s.alt
|
|
238
|
-
}, null, 8,
|
|
239
|
-
s.viewInfo &&
|
|
240
|
-
|
|
240
|
+
}, null, 8, ce),
|
|
241
|
+
s.viewInfo && i.value && (i.value.mime || i.value.size) && s.size === "large" ? (o(), d("div", de, [
|
|
242
|
+
i.value.size ? (o(), d("div", fe, y(i.value ? v(M)(i.value.size) : "0 Б"), 1)) : f("", !0)
|
|
241
243
|
])) : f("", !0)
|
|
242
244
|
], 2),
|
|
243
|
-
s.fullScreen ? (
|
|
245
|
+
s.fullScreen ? (o(), b(ue, {
|
|
244
246
|
key: 0,
|
|
245
247
|
ref: "imageFullModal",
|
|
246
|
-
src:
|
|
248
|
+
src: n.value,
|
|
247
249
|
alt: s.alt
|
|
248
250
|
}, null, 8, ["src", "alt"])) : f("", !0)
|
|
249
251
|
], 64));
|
|
250
252
|
}
|
|
251
|
-
}),
|
|
253
|
+
}), _e = /* @__PURE__ */ F(me, [["__scopeId", "data-v-cc14d604"]]);
|
|
252
254
|
export {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
ye as F,
|
|
256
|
+
_e as I,
|
|
257
|
+
J as g,
|
|
258
|
+
H as u
|
|
257
259
|
};
|
package/dist/blocks/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("../Image-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("../Image-BHDBSn7B.cjs"),f=require("../FileIcon-BE4ItwkK.cjs"),m=require("../SendIcon-CH6S0QWh.cjs"),p=require("../parseFileSize.util-Bg1rLRLQ.cjs"),_=require("../uploadFile.util-DCFkx3w3.cjs"),v={class:"chat-file__content"},h=e.defineComponent({__name:"ChatFile",props:{file:{}},emits:["deleteFile"],setup(s,{emit:n}){const i=n,r=e.computed(()=>URL.createObjectURL(s.file));return(t,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["chat-file",{"chat-file--image":e.unref(u.getFileTypeByMime)(t.file.type)==="image"}])},[e.createElementVNode("button",{class:"chat-file__delete",onClick:c[0]||(c[0]=l=>i("deleteFile",t.file))},[e.createVNode(e.unref(f.CloseIcon))]),e.createElementVNode("div",v,[e.unref(u.getFileTypeByMime)(t.file.type)==="image"?(e.openBlock(),e.createBlock(e.unref(u.Image),{key:0,file:r.value,size:"large",fullScreen:""},null,8,["file"])):(e.openBlock(),e.createBlock(e.unref(u.File),{key:1,file:r.value,outlined:!1},null,8,["file"]))])],2))}}),k=f._export_sfc(h,[["__scopeId","data-v-25ab2b0f"]]),g={class:"chat-field-actions"},B={ref:"overlay",class:"chat-field-actions__overlay"},y=["onClick"],b={class:"chat-field-actions__overlay-item__label"},C=["disabled"],V=e.defineComponent({__name:"ChatFieldActions",props:e.mergeModels({actions:{},disabled:{type:Boolean,default:!1},multiple:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(s){const n=e.useModel(s,"modelValue"),i=e.useTemplateRef("button"),r=e.useTemplateRef("overlay"),t=e.ref(!1),c=e.reactive({image:{icon:e.shallowRef(m.ImageIcon),label:"Добавить изображение"},file:{icon:e.shallowRef(f.FileIcon),label:"Добавить файл"}}),l=a=>{_.openFileDialog({accept:a==="image"?["image"]:["pdf","excel","word"],maxFileSize:"5mb",maxFiles:1}).then(o=>{n.value?n.value=s.multiple?[...n.value,...o]:o:n.value=[...o],t.value=!1})};return e.onMounted(()=>{p.onClickOutside(r.value,()=>{t.value=!1},{ignore:[i.value]})}),(a,o)=>(e.openBlock(),e.createElementBlock("div",g,[e.createVNode(e.Transition,{name:"slide-up"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",B,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.actions,d=>(e.openBlock(),e.createElementBlock("div",{class:"chat-field-actions__overlay-item",key:d,onClick:D=>l(d)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c[d].icon),{class:"chat-field-actions__overlay-item__icon"})),e.createElementVNode("span",b,e.toDisplayString(c[d].label),1)],8,y))),128))],512),[[e.vShow,t.value]])]),_:1}),e.createElementVNode("button",{ref:"button",onClick:o[0]||(o[0]=d=>t.value=!t.value),class:e.normalizeClass(["chat-field-actions__button",{"chat-field-actions__button--active":t.value}]),disabled:a.disabled},[e.createVNode(e.unref(m.PlusRoundedIcon))],10,C)]))}}),F=f._export_sfc(V,[["__scopeId","data-v-e64085d6"]]),E={class:"chat-field"},N={key:0,class:"chat-field__files"},M={class:"chat-field__wrapper"},T=["maxlength","placeholder"],S={key:1,class:"chat-field__footer"},$={key:1,class:"chat-field__char-count"},I=e.defineComponent({__name:"ChatField",props:e.mergeModels({viewActions:{type:Boolean,default:!1},actions:{default:()=>["file","image"]},placeholder:{default:"Введите сообщение"},maxLength:{},smallText:{},error:{type:Boolean},errorText:{},disabled:{type:Boolean,default:!1}},{message:{required:!0},messageModifiers:{},files:{},filesModifiers:{}}),emits:e.mergeModels(["sendMessage"],["update:message","update:files"]),setup(s,{emit:n}){const i=n,r=e.useModel(s,"message"),t=e.useModel(s,"files"),c=l=>{t.value&&(t.value=t.value.filter(a=>a.name!==l.name))};return(l,a)=>(e.openBlock(),e.createElementBlock("div",E,[t.value&&t.value.length>0?(e.openBlock(),e.createElementBlock("div",N,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,o=>(e.openBlock(),e.createBlock(k,{key:o.name,file:o,onDeleteFile:c},null,8,["file"]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",M,[l.viewActions&&l.actions.length>0?(e.openBlock(),e.createBlock(F,{key:0,modelValue:t.value,"onUpdate:modelValue":a[0]||(a[0]=o=>t.value=o),actions:l.actions,disabled:l.disabled},null,8,["modelValue","actions","disabled"])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[1]||(a[1]=o=>r.value=o),class:"chat-field__input",maxlength:l.maxLength,placeholder:l.placeholder},null,8,T),[[e.vModelText,r.value]]),e.createElementVNode("button",{class:"chat-field__button",onClick:a[2]||(a[2]=o=>i("sendMessage"))},[e.createVNode(e.unref(m.SendIcon))])]),l.smallText||l.error&&l.errorText||l.maxLength?(e.openBlock(),e.createElementBlock("div",S,[l.smallText||l.error&&l.errorText?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["chat-field__small",{"chat-field__small--error":l.error}])},e.toDisplayString(l.error?l.errorText:l.smallText),3)):e.createCommentVNode("",!0),l.maxLength?(e.openBlock(),e.createElementBlock("div",$,e.toDisplayString(r.value.length)+" / "+e.toDisplayString(l.maxLength),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),w={class:"bonus-summary"},L=e.defineComponent({__name:"BonusSummary",setup(s){return(n,i)=>(e.openBlock(),e.createElementBlock("div",w,[e.createVNode(e.unref(m.BonusIcon),{class:"bonus-summary__icon"}),i[0]||(i[0]=e.createElementVNode("div",{class:"bonus-summary__number"},"123",-1))]))}});exports.BonusSummary=L;exports.ChatField=I;
|
package/dist/blocks/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as g, computed as V, createElementBlock as o, openBlock as a, normalizeClass as C, unref as c, createElementVNode as n, createVNode as v, createBlock as p, mergeModels as y, useModel as b, useTemplateRef as F, ref as L, reactive as w, shallowRef as k, onMounted as S, Transition as R, withCtx as D, withDirectives as B, Fragment as I, renderList as T, resolveDynamicComponent as U, toDisplayString as h, vShow as z, createCommentVNode as _, vModelText as N } from "vue";
|
|
2
|
-
import { g as $, I as O, F as x } from "../Image-
|
|
2
|
+
import { g as $, I as O, F as x } from "../Image-CAGIshx9.js";
|
|
3
3
|
import { C as A, _ as M, F as E } from "../FileIcon-maHE2Nhr.js";
|
|
4
4
|
import { I as P, P as j, S as q, B as H } from "../SendIcon-Cqdt2QWN.js";
|
|
5
5
|
import { o as G } from "../parseFileSize.util-CxVk4CvB.js";
|