prlg-ui 1.8.295 → 1.8.297

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.
@@ -0,0 +1,200 @@
1
+ import { defineComponent as w, useId as b, ref as z, computed as I, onMounted as h, createElementBlock as o, openBlock as t, normalizeClass as C, createCommentVNode as r, createBlock as F, createVNode as g, unref as d, resolveDynamicComponent as E, toDisplayString as y, Teleport as V, Transition as O, withCtx as x, normalizeStyle as N, createElementVNode as m, useTemplateRef as W, Fragment as j } from "vue";
2
+ import { F as D, E as P, W as R, P as q } from "./FileIcon-D68SKu3j.js";
3
+ import { C as B, _ as k, E as A } from "./EyeIcon-D6SZWKKH.js";
4
+ import { h as S } from "./parseFileSize.util-BAG-MLFl.js";
5
+ import { u as G } from "./useOverlay-CkT4RNfY.js";
6
+ function H(e) {
7
+ 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";
8
+ }
9
+ const J = {
10
+ key: 1,
11
+ class: "file__title"
12
+ }, K = {
13
+ key: 2,
14
+ class: "file__info"
15
+ }, L = {
16
+ key: 0,
17
+ class: "file__type"
18
+ }, Q = {
19
+ key: 1,
20
+ class: "file__info-separator"
21
+ }, U = {
22
+ key: 2,
23
+ class: "file__size"
24
+ }, X = /* @__PURE__ */ w({
25
+ __name: "File",
26
+ props: {
27
+ file: {},
28
+ viewName: { type: Boolean, default: !1 },
29
+ outlined: { type: Boolean, default: !0 },
30
+ removable: { type: Boolean }
31
+ },
32
+ emits: ["remove"],
33
+ setup(e, { emit: v }) {
34
+ const u = v, i = b(), l = z(null);
35
+ async function n(s, c = "image") {
36
+ const p = await (await fetch(s)).blob(), $ = p.type.split("/")[1] || "", M = $ ? `${c}.${$}` : c;
37
+ return new File([p], M, { type: p.type });
38
+ }
39
+ const a = I(() => l.value && l.value.mime ? H(l.value.mime) : null), f = I(() => {
40
+ switch (a.value) {
41
+ case "pdf":
42
+ return q;
43
+ case "word":
44
+ return R;
45
+ case "excel":
46
+ return P;
47
+ case "other":
48
+ default:
49
+ return D;
50
+ }
51
+ });
52
+ return h(async () => {
53
+ if (typeof e.file == "string") {
54
+ const s = await n(e.file);
55
+ l.value = {
56
+ id: i,
57
+ url: e.file,
58
+ name: s.name,
59
+ mime: s.type,
60
+ size: s.size
61
+ };
62
+ } else
63
+ l.value = e.file;
64
+ }), (s, c) => (t(), o("div", {
65
+ class: C(["file", { "file--outlined": s.outlined }])
66
+ }, [
67
+ s.removable && typeof s.file != "string" ? (t(), o("button", {
68
+ key: 0,
69
+ class: "file__remove",
70
+ onClick: c[0] || (c[0] = (_) => u("remove", s.file))
71
+ }, [
72
+ g(d(B))
73
+ ])) : r("", !0),
74
+ (t(), F(E(f.value), { class: "file__icon" })),
75
+ l.value && l.value.name && s.viewName ? (t(), o("div", J, y(l.value ? l.value.name.split(".")[0] : "unknown"), 1)) : r("", !0),
76
+ l.value ? (t(), o("div", K, [
77
+ l.value.mime ? (t(), o("div", L, y(a.value), 1)) : r("", !0),
78
+ l.value.mime && l.value.size ? (t(), o("div", Q)) : r("", !0),
79
+ l.value.size ? (t(), o("div", U, y(l.value ? d(S)(l.value.size) : "0 Б"), 1)) : r("", !0)
80
+ ])) : r("", !0)
81
+ ], 2));
82
+ }
83
+ }), fe = /* @__PURE__ */ k(X, [["__scopeId", "data-v-7c3d1c11"]]), Y = { class: "image-full-modal__wrapper" }, Z = { class: "image-full-modal__header" }, T = { class: "image-full-modal__main" }, ee = ["src", "alt"], le = /* @__PURE__ */ w({
84
+ __name: "ImageFullModal",
85
+ props: {
86
+ src: {},
87
+ alt: {}
88
+ },
89
+ setup(e, { expose: v }) {
90
+ const u = z(!1), { zIndex: i } = G("modal");
91
+ return v({
92
+ open: () => {
93
+ u.value = !0;
94
+ },
95
+ close: () => {
96
+ u.value = !1;
97
+ }
98
+ }), (l, n) => (t(), F(V, { to: "body" }, [
99
+ g(O, { name: "fade" }, {
100
+ default: x(() => [
101
+ u.value ? (t(), o("div", {
102
+ key: 0,
103
+ class: "image-full-modal",
104
+ style: N({ zIndex: d(i)?.zIndex })
105
+ }, [
106
+ m("div", {
107
+ class: "image-full-modal__overlay",
108
+ onClick: n[0] || (n[0] = (a) => u.value = !1)
109
+ }),
110
+ m("div", Y, [
111
+ m("div", Z, [
112
+ m("button", {
113
+ class: "image-full-modal__close",
114
+ onClick: n[1] || (n[1] = (a) => u.value = !1)
115
+ }, [
116
+ g(d(B))
117
+ ])
118
+ ]),
119
+ m("div", T, [
120
+ m("img", {
121
+ src: l.src,
122
+ alt: l.alt
123
+ }, null, 8, ee)
124
+ ]),
125
+ n[2] || (n[2] = m("div", { class: "image-full-modal__footer" }, null, -1))
126
+ ])
127
+ ], 4)) : r("", !0)
128
+ ]),
129
+ _: 1
130
+ })
131
+ ]));
132
+ }
133
+ }), ae = /* @__PURE__ */ k(le, [["__scopeId", "data-v-26b5c867"]]), te = ["src", "alt"], se = {
134
+ key: 1,
135
+ class: "image__info"
136
+ }, ie = {
137
+ key: 0,
138
+ class: "image__size"
139
+ }, oe = /* @__PURE__ */ w({
140
+ __name: "Image",
141
+ props: {
142
+ file: {},
143
+ alt: {},
144
+ size: { default: "medium" },
145
+ fullScreen: { type: Boolean },
146
+ viewInfo: { type: Boolean, default: !1 }
147
+ },
148
+ setup(e) {
149
+ const v = b(), u = W("imageFullModal"), i = z(null);
150
+ async function l(a, f = "image") {
151
+ const c = await (await fetch(a)).blob(), _ = c.type.split("/")[1] || "", p = _ ? `${f}.${_}` : f;
152
+ return new File([c], p, { type: c.type });
153
+ }
154
+ const n = I(() => typeof e.file == "string" ? e.file : e.file.url);
155
+ return h(async () => {
156
+ if (e.viewInfo)
157
+ if (typeof e.file == "string") {
158
+ const a = await l(e.file);
159
+ i.value = {
160
+ id: v,
161
+ url: e.file,
162
+ name: a.name,
163
+ mime: a.type,
164
+ size: a.size
165
+ };
166
+ } else
167
+ i.value = e.file;
168
+ }), (a, f) => (t(), o(j, null, [
169
+ m("div", {
170
+ class: C(["image", `image--${a.size}`, { "image--full-screen": a.fullScreen }])
171
+ }, [
172
+ a.fullScreen ? (t(), o("div", {
173
+ key: 0,
174
+ class: "image__overlay",
175
+ onClick: f[0] || (f[0] = (s) => u.value?.open())
176
+ }, [
177
+ g(d(A))
178
+ ])) : r("", !0),
179
+ m("img", {
180
+ src: n.value,
181
+ alt: a.alt
182
+ }, null, 8, te),
183
+ a.viewInfo && i.value && (i.value.mime || i.value.size) && a.size === "large" ? (t(), o("div", se, [
184
+ i.value.size ? (t(), o("div", ie, y(i.value ? d(S)(i.value.size) : "0 Б"), 1)) : r("", !0)
185
+ ])) : r("", !0)
186
+ ], 2),
187
+ a.fullScreen ? (t(), F(ae, {
188
+ key: 0,
189
+ ref: "imageFullModal",
190
+ src: n.value,
191
+ alt: a.alt
192
+ }, null, 8, ["src", "alt"])) : r("", !0)
193
+ ], 64));
194
+ }
195
+ }), de = /* @__PURE__ */ k(oe, [["__scopeId", "data-v-903c99cc"]]);
196
+ export {
197
+ fe as F,
198
+ de as I,
199
+ H as g
200
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("vue"),v=require("./FileIcon-Dt-TWf3B.cjs"),u=require("./EyeIcon-CJg2W9QQ.cjs"),y=require("./parseFileSize.util-zKz6zjwq.cjs"),g=require("./useOverlay-DDiMe8yV.cjs");function k(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 B={key:1,class:"file__title"},I={key:2,class:"file__info"},V={key:0,class:"file__type"},z={key:1,class:"file__info-separator"},C={key:2,class:"file__size"},E=e.defineComponent({__name:"File",props:{file:{},viewName:{type:Boolean,default:!1},outlined:{type:Boolean,default:!0},removable:{type:Boolean}},emits:["remove"],setup(l,{emit:m}){const s=m,a=e.useId(),t=e.ref(null);async function i(n,c="image"){const d=await(await fetch(n)).blob(),p=d.type.split("/")[1]||"",_=p?`${c}.${p}`:c;return new File([d],_,{type:d.type})}const o=e.computed(()=>t.value&&t.value.mime?k(t.value.mime):null),r=e.computed(()=>{switch(o.value){case"pdf":return v.PdfIcon;case"word":return v.WordIcon;case"excel":return v.ExcelIcon;case"other":default:return v.FileIcon}});return e.onMounted(async()=>{if(typeof l.file=="string"){const n=await i(l.file);t.value={id:a,url:l.file,name:n.name,mime:n.type,size:n.size}}else t.value=l.file}),(n,c)=>(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:c[0]||(c[0]=f=>s("remove",n.file))},[e.createVNode(e.unref(u.CloseIcon))])):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{class:"file__icon"})),t.value&&t.value.name&&n.viewName?(e.openBlock(),e.createElementBlock("div",B,e.toDisplayString(t.value?t.value.name.split(".")[0]:"unknown"),1)):e.createCommentVNode("",!0),t.value?(e.openBlock(),e.createElementBlock("div",I,[t.value.mime?(e.openBlock(),e.createElementBlock("div",V,e.toDisplayString(o.value),1)):e.createCommentVNode("",!0),t.value.mime&&t.value.size?(e.openBlock(),e.createElementBlock("div",z)):e.createCommentVNode("",!0),t.value.size?(e.openBlock(),e.createElementBlock("div",C,e.toDisplayString(t.value?e.unref(y.formatFileSize)(t.value.size):"0 Б"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2))}}),N=u._export_sfc(E,[["__scopeId","data-v-7c3d1c11"]]),F={class:"image-full-modal__wrapper"},w={class:"image-full-modal__header"},$={class:"image-full-modal__main"},b=["src","alt"],h=e.defineComponent({__name:"ImageFullModal",props:{src:{},alt:{}},setup(l,{expose:m}){const s=e.ref(!1),{zIndex:a}=g.useOverlay("modal");return m({open:()=>{s.value=!0},close:()=>{s.value=!1}}),(t,i)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[s.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"image-full-modal",style:e.normalizeStyle({zIndex:e.unref(a)?.zIndex})},[e.createElementVNode("div",{class:"image-full-modal__overlay",onClick:i[0]||(i[0]=o=>s.value=!1)}),e.createElementVNode("div",F,[e.createElementVNode("div",w,[e.createElementVNode("button",{class:"image-full-modal__close",onClick:i[1]||(i[1]=o=>s.value=!1)},[e.createVNode(e.unref(u.CloseIcon))])]),e.createElementVNode("div",$,[e.createElementVNode("img",{src:t.src,alt:t.alt},null,8,b)]),i[2]||(i[2]=e.createElementVNode("div",{class:"image-full-modal__footer"},null,-1))])],4)):e.createCommentVNode("",!0)]),_:1})]))}}),S=u._export_sfc(h,[["__scopeId","data-v-26b5c867"]]),M=["src","alt"],q={key:1,class:"image__info"},D={key:0,class:"image__size"},O=e.defineComponent({__name:"Image",props:{file:{},alt:{},size:{default:"medium"},fullScreen:{type:Boolean},viewInfo:{type:Boolean,default:!1}},setup(l){const m=e.useId(),s=e.useTemplateRef("imageFullModal"),a=e.ref(null);async function t(o,r="image"){const c=await(await fetch(o)).blob(),f=c.type.split("/")[1]||"",d=f?`${r}.${f}`:r;return new File([c],d,{type:c.type})}const i=e.computed(()=>typeof l.file=="string"?l.file:l.file.url);return e.onMounted(async()=>{if(l.viewInfo)if(typeof l.file=="string"){const o=await t(l.file);a.value={id:m,url:l.file,name:o.name,mime:o.type,size:o.size}}else a.value=l.file}),(o,r)=>(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:r[0]||(r[0]=n=>s.value?.open())},[e.createVNode(e.unref(u.EyeIcon))])):e.createCommentVNode("",!0),e.createElementVNode("img",{src:i.value,alt:o.alt},null,8,M),o.viewInfo&&a.value&&(a.value.mime||a.value.size)&&o.size==="large"?(e.openBlock(),e.createElementBlock("div",q,[a.value.size?(e.openBlock(),e.createElementBlock("div",D,e.toDisplayString(a.value?e.unref(y.formatFileSize)(a.value.size):"0 Б"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2),o.fullScreen?(e.openBlock(),e.createBlock(S,{key:0,ref:"imageFullModal",src:i.value,alt:o.alt},null,8,["src","alt"])):e.createCommentVNode("",!0)],64))}}),x=u._export_sfc(O,[["__scopeId","data-v-903c99cc"]]);exports.File=N;exports.Image=x;exports.getFileTypeByMime=k;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("../Image-598ujuSJ.cjs"),f=require("../EyeIcon-CJg2W9QQ.cjs"),p=require("../FileIcon-Dt-TWf3B.cjs"),m=require("../SendIcon-Hp7buqZM.cjs"),_=require("../parseFileSize.util-DE7Sk0nR.cjs"),v=require("../uploadFile.util-B_xj5G6-.cjs"),h={class:"chat-file__content"},k=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",h,[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))}}),g=f._export_sfc(k,[["__scopeId","data-v-12b8458b"]]),B={class:"chat-field-actions"},y={ref:"overlay",class:"chat-field-actions__overlay"},b=["onClick"],C={class:"chat-field-actions__overlay-item__label"},V=["disabled"],F=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(p.FileIcon),label:"Добавить файл"}}),l=a=>{v.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(()=>{_.onClickOutside(r.value,()=>{t.value=!1},{ignore:[i.value]})}),(a,o)=>(e.openBlock(),e.createElementBlock("div",B,[e.createVNode(e.Transition,{name:"slide-up"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",y,[(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:R=>l(d)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c[d].icon),{class:"chat-field-actions__overlay-item__icon"})),e.createElementVNode("span",C,e.toDisplayString(c[d].label),1)],8,b))),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,V)]))}}),E=f._export_sfc(F,[["__scopeId","data-v-62b95e1b"]]),N={class:"chat-field"},M={key:0,class:"chat-field__files"},T={class:"chat-field__wrapper"},I=["maxlength","placeholder"],S={key:1,class:"chat-field__footer"},$={key:1,class:"chat-field__char-count"},w=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",N,[t.value&&t.value.length>0?(e.openBlock(),e.createElementBlock("div",M,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,o=>(e.openBlock(),e.createBlock(g,{key:o.name,file:o,onDeleteFile:c},null,8,["file"]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",T,[l.viewActions&&l.actions.length>0?(e.openBlock(),e.createBlock(E,{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,I),[[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)]))}}),L={class:"bonus-summary"},D=e.defineComponent({__name:"BonusSummary",setup(s){return(n,i)=>(e.openBlock(),e.createElementBlock("div",L,[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=D;exports.ChatField=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("../Image-kzSjYHy-.cjs"),f=require("../EyeIcon-CJg2W9QQ.cjs"),p=require("../FileIcon-Dt-TWf3B.cjs"),m=require("../SendIcon-Hp7buqZM.cjs"),_=require("../dayjs.util-DVNMZ0pw.cjs"),v=require("../uploadFile.util-DUsZt4gt.cjs"),h={class:"chat-file__content"},k=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",h,[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))}}),g=f._export_sfc(k,[["__scopeId","data-v-12b8458b"]]),B={class:"chat-field-actions"},y={ref:"overlay",class:"chat-field-actions__overlay"},b=["onClick"],C={class:"chat-field-actions__overlay-item__label"},V=["disabled"],E=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(p.FileIcon),label:"Добавить файл"}}),l=a=>{v.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(()=>{_.onClickOutside(r.value,()=>{t.value=!1},{ignore:[i.value]})}),(a,o)=>(e.openBlock(),e.createElementBlock("div",B,[e.createVNode(e.Transition,{name:"slide-up"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",y,[(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:R=>l(d)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c[d].icon),{class:"chat-field-actions__overlay-item__icon"})),e.createElementVNode("span",C,e.toDisplayString(c[d].label),1)],8,b))),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,V)]))}}),F=f._export_sfc(E,[["__scopeId","data-v-62b95e1b"]]),N={class:"chat-field"},M={key:0,class:"chat-field__files"},T={class:"chat-field__wrapper"},I=["maxlength","placeholder"],$={key:1,class:"chat-field__footer"},S={key:1,class:"chat-field__char-count"},w=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",N,[t.value&&t.value.length>0?(e.openBlock(),e.createElementBlock("div",M,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,o=>(e.openBlock(),e.createBlock(g,{key:o.name,file:o,onDeleteFile:c},null,8,["file"]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",T,[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,I),[[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",$,[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",S,e.toDisplayString(r.value.length)+" / "+e.toDisplayString(l.maxLength),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),L={class:"bonus-summary"},D=e.defineComponent({__name:"BonusSummary",setup(s){return(n,i)=>(e.openBlock(),e.createElementBlock("div",L,[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=D;exports.ChatField=w;
@@ -1,10 +1,10 @@
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-n1noBvGw.js";
2
+ import { g as $, I as O, F as x } from "../Image-bZf6ZaIG.js";
3
3
  import { C as A, _ as M } from "../EyeIcon-D6SZWKKH.js";
4
4
  import { F as E } from "../FileIcon-D68SKu3j.js";
5
5
  import { I as P, P as j, S as q, B as H } from "../SendIcon-MVeP0ZnP.js";
6
- import { o as G } from "../parseFileSize.util-EJk-rAI5.js";
7
- import { o as J } from "../uploadFile.util-vuFr0xb6.js";
6
+ import { o as G } from "../dayjs.util-DSjkslnJ.js";
7
+ import { o as J } from "../uploadFile.util-CTWK4zza.js";
8
8
  const K = { class: "chat-file__content" }, Q = /* @__PURE__ */ g({
9
9
  __name: "ChatFile",
10
10
  props: {
@@ -0,0 +1,41 @@
1
+ import { toValue as p, unref as g } from "vue";
2
+ import { d as e, l as x, r as v, i as y, a as E, b as w, c as L, e as O, f as S, g as T } from "./parseFileSize.util-BAG-MLFl.js";
3
+ const a = /* @__PURE__ */ new WeakMap();
4
+ function m(n) {
5
+ const o = g(n);
6
+ return o?.$el ?? o;
7
+ }
8
+ function h(n) {
9
+ return typeof n == "string" ? document.querySelector(n) : m(n);
10
+ }
11
+ function C(n, o, l = {}) {
12
+ const r = h(n);
13
+ if (!r) return () => {
14
+ };
15
+ const c = a.get(r);
16
+ c && (c(), a.delete(r));
17
+ const s = (u) => {
18
+ const i = u.target instanceof Node ? u.target : null;
19
+ if (!i) return;
20
+ const f = (p(l.ignore) ?? []).map((t) => typeof t == "string" ? document.querySelector(t) : m(t)).filter((t) => t != null);
21
+ r.contains(i) || f.some((t) => t.contains(i)) || o(u);
22
+ };
23
+ document.addEventListener("mousedown", s, { capture: !0 }), document.addEventListener("touchstart", s, { capture: !0 });
24
+ const d = () => {
25
+ document.removeEventListener("mousedown", s, { capture: !0 }), document.removeEventListener("touchstart", s, { capture: !0 }), a.delete(r);
26
+ };
27
+ return a.set(r, d), d;
28
+ }
29
+ e.extend(x);
30
+ e.extend(v);
31
+ e.extend(y);
32
+ e.extend(E);
33
+ e.extend(w);
34
+ e.extend(L);
35
+ e.extend(O);
36
+ e.extend(S);
37
+ e.extend(T);
38
+ e.locale("ru");
39
+ export {
40
+ C as o
41
+ };
@@ -0,0 +1 @@
1
+ "use strict";const l=require("vue"),e=require("./parseFileSize.util-zKz6zjwq.cjs"),u=new WeakMap;function m(n){const o=l.unref(n);return o?.$el??o}function p(n){return typeof n=="string"?document.querySelector(n):m(n)}function g(n,o,f={}){const r=p(n);if(!r)return()=>{};const d=u.get(r);d&&(d(),u.delete(r));const s=a=>{const i=a.target instanceof Node?a.target:null;if(!i)return;const y=(l.toValue(f.ignore)??[]).map(t=>typeof t=="string"?document.querySelector(t):m(t)).filter(t=>t!=null);r.contains(i)||y.some(t=>t.contains(i))||o(a)};document.addEventListener("mousedown",s,{capture:!0}),document.addEventListener("touchstart",s,{capture:!0});const c=()=>{document.removeEventListener("mousedown",s,{capture:!0}),document.removeEventListener("touchstart",s,{capture:!0}),u.delete(r)};return u.set(r,c),c}e.dayjs.extend(e.localizedFormat);e.dayjs.extend(e.relativeTime);e.dayjs.extend(e.isToday);e.dayjs.extend(e.isBetween);e.dayjs.extend(e.isSameOrBefore);e.dayjs.extend(e.isSameOrAfter);e.dayjs.extend(e.duration);e.dayjs.extend(e.customParseFormat);e.dayjs.extend(e.dayOfYear);e.dayjs.locale("ru");exports.onClickOutside=g;