prlg-ui 1.6.1 → 1.6.3
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-B_PtktNe.js +182 -0
- package/dist/Image-KC6enSsM.cjs +1 -0
- package/dist/blocks/index.cjs.js +1 -1
- package/dist/blocks/index.es.js +4 -4
- package/dist/index.d.ts +3 -3
- package/dist/prlg-ui.cjs.js +1 -1
- package/dist/prlg-ui.css +1 -1
- package/dist/prlg-ui.es.js +1 -1
- package/package.json +1 -1
- package/dist/Image-CqmYPuqB.js +0 -174
- package/dist/Image-DDHrjTpr.cjs +0 -1
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { defineComponent as F, ref as $, computed as w, onMounted as I, createElementBlock as d, openBlock as u, normalizeClass as k, createCommentVNode as v, createBlock as b, createElementVNode as n, createVNode as y, unref as g, resolveDynamicComponent as B, toDisplayString as p, Teleport as M, Transition as x, withCtx as j, useTemplateRef as E, Fragment as L } from "vue";
|
|
2
|
+
import { F as N, E as V, W as R, P as W, C, _ as h, a as O } from "./FileIcon-DkEbi-bi.js";
|
|
3
|
+
const se = (e) => {
|
|
4
|
+
const r = ["b", "kb", "mb", "gb", "tb"], l = e.match(/[a-zA-Z]+/)?.[0] || "b", t = parseFloat(e.replace(l, "")), o = r.indexOf(l.toLowerCase());
|
|
5
|
+
return t * Math.pow(1024, o);
|
|
6
|
+
};
|
|
7
|
+
function z(e) {
|
|
8
|
+
if (isNaN(e) || e < 0) return "0 Б";
|
|
9
|
+
const r = ["Б", "КБ", "МБ", "ГБ", "ТБ"];
|
|
10
|
+
let l = 0, t = e;
|
|
11
|
+
for (; t >= 1024 && l < r.length - 1; )
|
|
12
|
+
t = t / 1024, l++;
|
|
13
|
+
return `${t % 1 === 0 ? t : t.toFixed(1)} ${r[l]}`;
|
|
14
|
+
}
|
|
15
|
+
function D(e) {
|
|
16
|
+
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";
|
|
17
|
+
}
|
|
18
|
+
const P = {
|
|
19
|
+
key: 1,
|
|
20
|
+
class: "file__title"
|
|
21
|
+
}, U = { class: "file__info" }, A = { class: "file__type" }, Z = { class: "file__size" }, q = /* @__PURE__ */ F({
|
|
22
|
+
__name: "File",
|
|
23
|
+
props: {
|
|
24
|
+
file: {},
|
|
25
|
+
viewName: { type: Boolean, default: !1 },
|
|
26
|
+
outlined: { type: Boolean, default: !0 },
|
|
27
|
+
removable: { type: Boolean }
|
|
28
|
+
},
|
|
29
|
+
emits: ["remove"],
|
|
30
|
+
setup(e, { emit: r }) {
|
|
31
|
+
const l = r, t = $(null);
|
|
32
|
+
async function o(a, i = "image") {
|
|
33
|
+
const f = await (await fetch(a)).blob(), _ = f.type.split("/")[1] || "", S = _ ? `${i}.${_}` : i;
|
|
34
|
+
return new File([f], S, { type: f.type });
|
|
35
|
+
}
|
|
36
|
+
const c = w(() => t.value ? D(t.value.type) : ""), s = w(() => {
|
|
37
|
+
switch (c.value) {
|
|
38
|
+
case "pdf":
|
|
39
|
+
return W;
|
|
40
|
+
case "word":
|
|
41
|
+
return R;
|
|
42
|
+
case "excel":
|
|
43
|
+
return V;
|
|
44
|
+
case "other":
|
|
45
|
+
return N;
|
|
46
|
+
default:
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return I(async () => {
|
|
51
|
+
t.value = typeof e.file == "string" ? await o(e.file) : e.file;
|
|
52
|
+
}), (a, i) => (u(), d("div", {
|
|
53
|
+
class: k(["file", { "file--outlined": a.outlined }])
|
|
54
|
+
}, [
|
|
55
|
+
a.removable && typeof a.file != "string" ? (u(), d("button", {
|
|
56
|
+
key: 0,
|
|
57
|
+
class: "file__remove",
|
|
58
|
+
onClick: i[0] || (i[0] = (m) => l("remove", a.file))
|
|
59
|
+
}, [
|
|
60
|
+
y(g(C))
|
|
61
|
+
])) : v("", !0),
|
|
62
|
+
(u(), b(B(s.value), { class: "file__icon" })),
|
|
63
|
+
a.viewName ? (u(), d("div", P, p(t.value ? t.value.name.split(".")[0] : "unknown"), 1)) : v("", !0),
|
|
64
|
+
n("div", U, [
|
|
65
|
+
n("div", A, p(c.value), 1),
|
|
66
|
+
i[1] || (i[1] = n("div", { class: "file__info-separator" }, null, -1)),
|
|
67
|
+
n("div", Z, p(t.value ? g(z)(t.value.size) : "0 Б"), 1)
|
|
68
|
+
])
|
|
69
|
+
], 2));
|
|
70
|
+
}
|
|
71
|
+
}), ie = /* @__PURE__ */ h(q, [["__scopeId", "data-v-c33ea2a8"]]), G = {
|
|
72
|
+
key: 0,
|
|
73
|
+
class: "image-full-modal"
|
|
74
|
+
}, H = { class: "image-full-modal__wrapper" }, J = { class: "image-full-modal__header" }, K = { class: "image-full-modal__main" }, Q = ["src", "alt"], T = /* @__PURE__ */ F({
|
|
75
|
+
__name: "ImageFullModal",
|
|
76
|
+
props: {
|
|
77
|
+
src: {},
|
|
78
|
+
alt: {}
|
|
79
|
+
},
|
|
80
|
+
setup(e, { expose: r }) {
|
|
81
|
+
const l = $(!1);
|
|
82
|
+
return r({
|
|
83
|
+
open: () => {
|
|
84
|
+
l.value = !0;
|
|
85
|
+
},
|
|
86
|
+
close: () => {
|
|
87
|
+
l.value = !1;
|
|
88
|
+
}
|
|
89
|
+
}), (t, o) => (u(), b(M, { to: "body" }, [
|
|
90
|
+
y(x, { name: "fade" }, {
|
|
91
|
+
default: j(() => [
|
|
92
|
+
l.value ? (u(), d("div", G, [
|
|
93
|
+
n("div", {
|
|
94
|
+
class: "image-full-modal__overlay",
|
|
95
|
+
onClick: o[0] || (o[0] = (c) => l.value = !1)
|
|
96
|
+
}),
|
|
97
|
+
n("div", H, [
|
|
98
|
+
n("div", J, [
|
|
99
|
+
n("button", {
|
|
100
|
+
class: "image-full-modal__close",
|
|
101
|
+
onClick: o[1] || (o[1] = (c) => l.value = !1)
|
|
102
|
+
}, [
|
|
103
|
+
y(g(C))
|
|
104
|
+
])
|
|
105
|
+
]),
|
|
106
|
+
n("div", K, [
|
|
107
|
+
n("img", {
|
|
108
|
+
src: t.src,
|
|
109
|
+
alt: t.alt
|
|
110
|
+
}, null, 8, Q)
|
|
111
|
+
]),
|
|
112
|
+
o[2] || (o[2] = n("div", { class: "image-full-modal__footer" }, null, -1))
|
|
113
|
+
])
|
|
114
|
+
])) : v("", !0)
|
|
115
|
+
]),
|
|
116
|
+
_: 1
|
|
117
|
+
})
|
|
118
|
+
]));
|
|
119
|
+
}
|
|
120
|
+
}), X = /* @__PURE__ */ h(T, [["__scopeId", "data-v-edc1a47e"]]), Y = ["src", "alt"], ee = { class: "image__info" }, te = { class: "image__type" }, le = { class: "image__size" }, ae = /* @__PURE__ */ F({
|
|
121
|
+
__name: "Image",
|
|
122
|
+
props: {
|
|
123
|
+
file: {},
|
|
124
|
+
alt: {},
|
|
125
|
+
size: { default: "medium" },
|
|
126
|
+
fullScreen: { type: Boolean }
|
|
127
|
+
},
|
|
128
|
+
setup(e) {
|
|
129
|
+
const r = E("imageFullModal"), l = $(null);
|
|
130
|
+
async function t(s, a = "image") {
|
|
131
|
+
const m = await (await fetch(s)).blob(), f = m.type.split("/")[1] || "", _ = f ? `${a}.${f}` : a;
|
|
132
|
+
return new File([m], _, { type: m.type });
|
|
133
|
+
}
|
|
134
|
+
const o = w(() => typeof e.file == "string" ? e.file : URL.createObjectURL(e.file));
|
|
135
|
+
function c(s) {
|
|
136
|
+
if (s.startsWith("image/"))
|
|
137
|
+
return s.replace("image/", "").toLowerCase();
|
|
138
|
+
const a = s.match(/\.(jpeg|jpg|png|gif|webp|bmp|svg|tiff|ico)(\?.*)?$/i);
|
|
139
|
+
if (a) {
|
|
140
|
+
let i = a[1].toLowerCase();
|
|
141
|
+
return i === "jpg" && (i = "jpeg"), i;
|
|
142
|
+
}
|
|
143
|
+
return "unknown";
|
|
144
|
+
}
|
|
145
|
+
return I(async () => {
|
|
146
|
+
l.value = typeof e.file == "string" ? await t(e.file) : e.file;
|
|
147
|
+
}), (s, a) => (u(), d(L, null, [
|
|
148
|
+
n("div", {
|
|
149
|
+
class: k(["image", `image--${s.size}`, { "image--full-screen": s.fullScreen }])
|
|
150
|
+
}, [
|
|
151
|
+
s.fullScreen ? (u(), d("div", {
|
|
152
|
+
key: 0,
|
|
153
|
+
class: "image__overlay",
|
|
154
|
+
onClick: a[0] || (a[0] = (i) => r.value?.open())
|
|
155
|
+
}, [
|
|
156
|
+
y(g(O))
|
|
157
|
+
])) : v("", !0),
|
|
158
|
+
n("img", {
|
|
159
|
+
src: o.value,
|
|
160
|
+
alt: s.alt
|
|
161
|
+
}, null, 8, Y),
|
|
162
|
+
n("div", ee, [
|
|
163
|
+
n("div", te, p(l.value ? c(l.value.type) : "unknown"), 1),
|
|
164
|
+
a[1] || (a[1] = n("div", { class: "image__info-separator" }, null, -1)),
|
|
165
|
+
n("div", le, p(l.value ? g(z)(l.value.size) : "0 Б"), 1)
|
|
166
|
+
])
|
|
167
|
+
], 2),
|
|
168
|
+
s.fullScreen ? (u(), b(X, {
|
|
169
|
+
key: 0,
|
|
170
|
+
ref: "imageFullModal",
|
|
171
|
+
src: o.value,
|
|
172
|
+
alt: s.alt
|
|
173
|
+
}, null, 8, ["src", "alt"])) : v("", !0)
|
|
174
|
+
], 64));
|
|
175
|
+
}
|
|
176
|
+
}), re = /* @__PURE__ */ h(ae, [["__scopeId", "data-v-00bc3295"]]);
|
|
177
|
+
export {
|
|
178
|
+
ie as F,
|
|
179
|
+
re as I,
|
|
180
|
+
D as g,
|
|
181
|
+
se as p
|
|
182
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),c=require("./FileIcon-sxADkCIe.cjs"),_=t=>{const r=["b","kb","mb","gb","tb"],o=t.match(/[a-zA-Z]+/)?.[0]||"b",l=parseFloat(t.replace(o,"")),a=r.indexOf(o.toLowerCase());return l*Math.pow(1024,a)};function p(t){if(isNaN(t)||t<0)return"0 Б";const r=["Б","КБ","МБ","ГБ","ТБ"];let o=0,l=t;for(;l>=1024&&o<r.length-1;)l=l/1024,o++;return`${l%1===0?l:l.toFixed(1)} ${r[o]}`}function v(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 y={key:1,class:"file__title"},k={class:"file__info"},N={class:"file__type"},V={class:"file__size"},w=e.defineComponent({__name:"File",props:{file:{},viewName:{type:Boolean,default:!1},outlined:{type:Boolean,default:!0},removable:{type:Boolean}},emits:["remove"],setup(t,{emit:r}){const o=r,l=e.ref(null);async function a(n,s="image"){const d=await(await fetch(n)).blob(),f=d.type.split("/")[1]||"",g=f?`${s}.${f}`:s;return new File([d],g,{type:d.type})}const u=e.computed(()=>l.value?v(l.value.type):""),i=e.computed(()=>{switch(u.value){case"pdf":return c.PdfIcon;case"word":return c.WordIcon;case"excel":return c.ExcelIcon;case"other":return c.FileIcon;default:return null}});return e.onMounted(async()=>{l.value=typeof t.file=="string"?await a(t.file):t.file}),(n,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["file",{"file--outlined":n.outlined}])},[n.removable&&typeof n.file!="string"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"file__remove",onClick:s[0]||(s[0]=m=>o("remove",n.file))},[e.createVNode(e.unref(c.CloseIcon))])):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.value),{class:"file__icon"})),n.viewName?(e.openBlock(),e.createElementBlock("div",y,e.toDisplayString(l.value?l.value.name.split(".")[0]:"unknown"),1)):e.createCommentVNode("",!0),e.createElementVNode("div",k,[e.createElementVNode("div",N,e.toDisplayString(u.value),1),s[1]||(s[1]=e.createElementVNode("div",{class:"file__info-separator"},null,-1)),e.createElementVNode("div",V,e.toDisplayString(l.value?e.unref(p)(l.value.size):"0 Б"),1)])],2))}}),E=c._export_sfc(w,[["__scopeId","data-v-c33ea2a8"]]),F={key:0,class:"image-full-modal"},B={class:"image-full-modal__wrapper"},$={class:"image-full-modal__header"},b={class:"image-full-modal__main"},C=["src","alt"],h=e.defineComponent({__name:"ImageFullModal",props:{src:{},alt:{}},setup(t,{expose:r}){const o=e.ref(!1);return r({open:()=>{o.value=!0},close:()=>{o.value=!1}}),(l,a)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[o.value?(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("div",{class:"image-full-modal__overlay",onClick:a[0]||(a[0]=u=>o.value=!1)}),e.createElementVNode("div",B,[e.createElementVNode("div",$,[e.createElementVNode("button",{class:"image-full-modal__close",onClick:a[1]||(a[1]=u=>o.value=!1)},[e.createVNode(e.unref(c.CloseIcon))])]),e.createElementVNode("div",b,[e.createElementVNode("img",{src:l.src,alt:l.alt},null,8,C)]),a[2]||(a[2]=e.createElementVNode("div",{class:"image-full-modal__footer"},null,-1))])])):e.createCommentVNode("",!0)]),_:1})]))}}),I=c._export_sfc(h,[["__scopeId","data-v-edc1a47e"]]),S=["src","alt"],z={class:"image__info"},M={class:"image__type"},x={class:"image__size"},D=e.defineComponent({__name:"Image",props:{file:{},alt:{},size:{default:"medium"},fullScreen:{type:Boolean}},setup(t){const r=e.useTemplateRef("imageFullModal"),o=e.ref(null);async function l(i,n="image"){const m=await(await fetch(i)).blob(),d=m.type.split("/")[1]||"",f=d?`${n}.${d}`:n;return new File([m],f,{type:m.type})}const a=e.computed(()=>typeof t.file=="string"?t.file:URL.createObjectURL(t.file));function u(i){if(i.startsWith("image/"))return i.replace("image/","").toLowerCase();const n=i.match(/\.(jpeg|jpg|png|gif|webp|bmp|svg|tiff|ico)(\?.*)?$/i);if(n){let s=n[1].toLowerCase();return s==="jpg"&&(s="jpeg"),s}return"unknown"}return e.onMounted(async()=>{o.value=typeof t.file=="string"?await l(t.file):t.file}),(i,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["image",`image--${i.size}`,{"image--full-screen":i.fullScreen}])},[i.fullScreen?(e.openBlock(),e.createElementBlock("div",{key:0,class:"image__overlay",onClick:n[0]||(n[0]=s=>r.value?.open())},[e.createVNode(e.unref(c.EyeIcon))])):e.createCommentVNode("",!0),e.createElementVNode("img",{src:a.value,alt:i.alt},null,8,S),e.createElementVNode("div",z,[e.createElementVNode("div",M,e.toDisplayString(o.value?u(o.value.type):"unknown"),1),n[1]||(n[1]=e.createElementVNode("div",{class:"image__info-separator"},null,-1)),e.createElementVNode("div",x,e.toDisplayString(o.value?e.unref(p)(o.value.size):"0 Б"),1)])],2),i.fullScreen?(e.openBlock(),e.createBlock(I,{key:0,ref:"imageFullModal",src:a.value,alt:i.alt},null,8,["src","alt"])):e.createCommentVNode("",!0)],64))}}),j=c._export_sfc(D,[["__scopeId","data-v-00bc3295"]]);exports.File=E;exports.Image=j;exports.getFileTypeByMime=v;exports.parseFileSize=_;
|
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-KC6enSsM.cjs"),f=require("../FileIcon-sxADkCIe.cjs"),d=require("../TrashIcon-DJApIo8R.cjs"),p=require("../onClickOutside.util-DD1l-Ra5.cjs"),_=require("../dayjs.util-Dg65EiGQ.cjs"),v={class:"chat-file__content"},g=e.defineComponent({__name:"ChatFile",props:{file:{}},emits:["deleteFile"],setup(a,{emit:i}){const s=i,c=e.computed(()=>URL.createObjectURL(a.file));return(l,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["chat-file",{"chat-file--image":e.unref(u.getFileTypeByMime)(l.file.type)==="image"}])},[e.createElementVNode("button",{class:"chat-file__delete",onClick:r[0]||(r[0]=t=>s("deleteFile",l.file))},[e.createVNode(e.unref(f.CloseIcon))]),e.createElementVNode("div",v,[e.unref(u.getFileTypeByMime)(l.file.type)==="image"?(e.openBlock(),e.createBlock(e.unref(u.Image),{key:0,file:c.value,alt:l.file.name,size:"large","fill-screen":""},null,8,["file","alt"])):(e.openBlock(),e.createBlock(e.unref(u.File),{key:1,file:l.file,outlined:!1},null,8,["file"]))])],2))}}),h=f._export_sfc(g,[["__scopeId","data-v-d52d3d8d"]]);function y(a){if(!a)return;const i=Array.isArray(a)?a:[a],s={image:["image/*"],pdf:["application/pdf"],excel:["application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],word:["application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],all:["*/*"]};return i.flatMap(c=>s[c]||[]).join(",")}function k(a={}){return new Promise(i=>{const s=document.createElement("input");s.type="file",s.style.display="none",a.maxFiles&&a.maxFiles>1&&(s.multiple=!0);const c=y(a.accept);c&&(s.accept=c),s.addEventListener("change",l=>{const r=l.target;let t=[];if(r.files&&r.files.length>0&&(t=Array.from(r.files),a.maxFiles&&t.length>a.maxFiles&&(t=t.slice(0,a.maxFiles)),a.maxFileSize)){const o=u.parseFileSize(a.maxFileSize);t=t.filter(n=>n.size<=o)}i(t),document.body.removeChild(s)}),document.body.appendChild(s),s.click()})}const B={class:"chat-field-actions"},V={ref:"overlay",class:"chat-field-actions__overlay"},E=["onClick"],b={class:"chat-field-actions__overlay-item__label"},C=["disabled"],N=e.defineComponent({__name:"ChatFieldActions",props:e.mergeModels({actions:{},disabled:{type:Boolean,default:!1},multiple:{type:Boolean,default:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const i=e.useModel(a,"modelValue"),s=e.useTemplateRef("button"),c=e.useTemplateRef("overlay"),l=e.ref(!1),r=e.reactive({image:{icon:e.shallowRef(d.ImageIcon),label:"Добавить изображение"},file:{icon:e.shallowRef(f.FileIcon),label:"Добавить файл"}}),t=o=>{k({accept:o==="image"?["image"]:["pdf","excel","word"],maxFileSize:"5mb",maxFiles:1}).then(n=>{i.value?i.value=a.multiple?[...i.value,...n]:n:i.value=[...n],l.value=!1})};return e.onMounted(()=>{p.onClickOutside(c.value,()=>{l.value=!1},{ignore:[s.value]})}),(o,n)=>(e.openBlock(),e.createElementBlock("div",B,[e.createVNode(e.Transition,{name:"slide-up"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",V,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.actions,m=>(e.openBlock(),e.createElementBlock("div",{class:"chat-field-actions__overlay-item",key:m,onClick:H=>t(m)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r[m].icon),{class:"chat-field-actions__overlay-item__icon"})),e.createElementVNode("span",b,e.toDisplayString(r[m].label),1)],8,E))),128))],512),[[e.vShow,l.value]])]),_:1}),e.createElementVNode("button",{ref:"button",onClick:n[0]||(n[0]=m=>l.value=!l.value),class:e.normalizeClass(["chat-field-actions__button",{"chat-field-actions__button--active":l.value}]),disabled:o.disabled},[e.createVNode(e.unref(d.PlusRoundedIcon))],10,C)]))}}),F=f._export_sfc(N,[["__scopeId","data-v-6b295528"]]),$={class:"chat-field"},M={key:0,class:"chat-field__files"},S={class:"chat-field__wrapper"},I=["placeholder"],w=e.defineComponent({__name:"ChatField",props:e.mergeModels({viewActions:{type:Boolean,default:!1},actions:{default:()=>["file","image"]},placeholder:{default:"Введите сообщение"},disabled:{type:Boolean,default:!1}},{message:{required:!0},messageModifiers:{},files:{},filesModifiers:{}}),emits:e.mergeModels(["sendMessage"],["update:message","update:files"]),setup(a,{emit:i}){const s=i,c=e.useModel(a,"message"),l=e.useModel(a,"files"),r=t=>{l.value&&(l.value=l.value.filter(o=>o.name!==t.name))};return(t,o)=>(e.openBlock(),e.createElementBlock("div",$,[l.value&&l.value.length>0?(e.openBlock(),e.createElementBlock("div",M,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,n=>(e.openBlock(),e.createBlock(h,{key:n.name,file:n,onDeleteFile:r},null,8,["file"]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",S,[t.viewActions&&t.actions.length>0?(e.openBlock(),e.createBlock(F,{key:0,modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=n=>l.value=n),actions:t.actions,disabled:t.disabled},null,8,["modelValue","actions","disabled"])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":o[1]||(o[1]=n=>c.value=n),class:"chat-field__input",placeholder:t.placeholder},null,8,I),[[e.vModelText,c.value]]),e.createElementVNode("button",{class:"chat-field__button",onClick:o[2]||(o[2]=n=>s("sendMessage"))},[e.createVNode(e.unref(d.SendIcon))])])]))}}),x={class:"message__avatar"},R=["src"],z={class:"message__content"},D={class:"message__info"},T={class:"message__name"},A={class:"message__time"},L={class:"message__text"},q={class:"message-actions__item"},O={class:"message-actions__item"},j=e.defineComponent({__name:"Message",props:{message:{},position:{default:"left"}},setup(a){const i=e.computed(()=>["message",`message--${a.position}`]),s=e.ref(null),c=e.ref(!1),l=t=>{s.value&&(c.value=!0,s.value.style.left=`${t.offsetX}px`,s.value.style.top=`${t.offsetY}px`)},r=t=>{s.value&&t.composedPath().includes(s.value)||(c.value=!1)};return e.onMounted(()=>{document.addEventListener("click",r)}),e.onUnmounted(()=>{document.removeEventListener("click",r)}),(t,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(i.value),onContextmenu:e.withModifiers(l,["right","prevent"])},[e.createElementVNode("div",x,[t.message.user.avatar?(e.openBlock(),e.createElementBlock("img",{key:1,src:t.message.user.avatar,alt:"avatar"},null,8,R)):(e.openBlock(),e.createBlock(e.unref(d.AvatarIcon),{key:0}))]),e.createElementVNode("div",z,[e.createElementVNode("div",D,[e.createElementVNode("div",T,[e.createElementVNode("strong",null,e.toDisplayString(t.message.user.name)+" "+e.toDisplayString(t.message.user.lastname),1),e.createTextVNode(" ("+e.toDisplayString(t.message.user.post)+") ",1)]),e.createElementVNode("div",A,e.toDisplayString(e.unref(_.dayjs)(t.message.created_at).format("HH:mm")),1)]),e.createElementVNode("p",L,e.toDisplayString(t.message.text),1)])],34),e.createElementVNode("div",{ref_key:"actionsRef",ref:s,class:e.normalizeClass(["message-actions",{"message-actions--visible":c.value}])},[e.createElementVNode("div",q,[e.createVNode(e.unref(d.CopyIcon),{class:"message-actions__item-icon"}),o[0]||(o[0]=e.createElementVNode("span",{class:"message-actions__item-text"},"Копировать",-1))]),e.createElementVNode("div",O,[e.createVNode(e.unref(d.TrashIcon),{class:"message-actions__item-icon"}),o[1]||(o[1]=e.createElementVNode("span",{class:"message-actions__item-text"},"Удалить",-1))])],2)],64))}}),U={class:"bonus-summary"},P=e.defineComponent({__name:"BonusSummary",setup(a){return(i,s)=>(e.openBlock(),e.createElementBlock("div",U,[e.createVNode(e.unref(d.BonusIcon),{class:"bonus-summary__icon"}),s[0]||(s[0]=e.createElementVNode("div",{class:"bonus-summary__number"},"123",-1))]))}});exports.BonusSummary=P;exports.ChatField=w;exports.Message=j;
|
package/dist/blocks/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as g, computed as w, createElementBlock as u, openBlock as o, normalizeClass as h, unref as r, createElementVNode as l, createVNode as f, createBlock as p, mergeModels as y, useModel as b, useTemplateRef as k, ref as C, reactive as R, shallowRef as $, onMounted as x, Transition as A, withCtx as z, withDirectives as S, Fragment as F, renderList as B, resolveDynamicComponent as L, toDisplayString as _, vShow as T, createCommentVNode as I, vModelText as E, onUnmounted as D, withModifiers as U, createTextVNode as N } from "vue";
|
|
2
|
-
import { g as M, I as O, F as P, p as j } from "../Image-
|
|
2
|
+
import { g as M, I as O, F as P, p as j } from "../Image-B_PtktNe.js";
|
|
3
3
|
import { C as H, _ as V, F as q } from "../FileIcon-DkEbi-bi.js";
|
|
4
4
|
import { I as X, P as Y, S as G, A as J, C as K, T as Q, B as W } from "../TrashIcon-D9034G7A.js";
|
|
5
5
|
import { o as Z } from "../onClickOutside.util-CJueL_Rz.js";
|
|
@@ -24,11 +24,11 @@ const se = { class: "chat-file__content" }, te = /* @__PURE__ */ g({
|
|
|
24
24
|
l("div", se, [
|
|
25
25
|
r(M)(t.file.type) === "image" ? (o(), p(r(O), {
|
|
26
26
|
key: 0,
|
|
27
|
-
|
|
27
|
+
file: d.value,
|
|
28
28
|
alt: t.file.name,
|
|
29
29
|
size: "large",
|
|
30
30
|
"fill-screen": ""
|
|
31
|
-
}, null, 8, ["
|
|
31
|
+
}, null, 8, ["file", "alt"])) : (o(), p(r(P), {
|
|
32
32
|
key: 1,
|
|
33
33
|
file: t.file,
|
|
34
34
|
outlined: !1
|
|
@@ -36,7 +36,7 @@ const se = { class: "chat-file__content" }, te = /* @__PURE__ */ g({
|
|
|
36
36
|
])
|
|
37
37
|
], 2));
|
|
38
38
|
}
|
|
39
|
-
}), ae = /* @__PURE__ */ V(te, [["__scopeId", "data-v-
|
|
39
|
+
}), ae = /* @__PURE__ */ V(te, [["__scopeId", "data-v-d52d3d8d"]]);
|
|
40
40
|
function le(a) {
|
|
41
41
|
if (!a) return;
|
|
42
42
|
const c = Array.isArray(a) ? a : [a], s = {
|
package/dist/index.d.ts
CHANGED
|
@@ -189,17 +189,17 @@ declare type __VLS_Props_10 = {
|
|
|
189
189
|
};
|
|
190
190
|
|
|
191
191
|
declare type __VLS_Props_11 = {
|
|
192
|
-
file: File;
|
|
192
|
+
file: string | File;
|
|
193
193
|
viewName?: boolean;
|
|
194
194
|
outlined?: boolean;
|
|
195
195
|
removable?: boolean;
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
declare type __VLS_Props_12 = {
|
|
199
|
-
|
|
199
|
+
file: string | File;
|
|
200
200
|
alt?: string;
|
|
201
201
|
size?: 'small' | 'medium' | 'large';
|
|
202
|
-
|
|
202
|
+
fullScreen?: boolean;
|
|
203
203
|
};
|
|
204
204
|
|
|
205
205
|
declare type __VLS_Props_13 = {
|