prlg-ui 1.8.66 → 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.
@@ -0,0 +1 @@
1
+ "use strict";const e=require("vue"),d=require("./FileIcon-BE4ItwkK.cjs"),g=require("./parseFileSize.util-Bg1rLRLQ.cjs");function y(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 B={key:1,class:"file__title"},I={key:2,class:"file__info"},z={key:0,class:"file__type"},E={key:1,class:"file__info-separator"},w={key:2,class:"file__size"},V=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?y(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",B,e.toDisplayString(n.value?n.value.name.split(".")[0]:"unknown"),1)):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createElementBlock("div",I,[n.value.mime?(e.openBlock(),e.createElementBlock("div",z,e.toDisplayString(o.value),1)):e.createCommentVNode("",!0),n.value.mime&&n.value.size?(e.openBlock(),e.createElementBlock("div",E)):e.createCommentVNode("",!0),n.value.size?(e.openBlock(),e.createElementBlock("div",w,e.toDisplayString(n.value?e.unref(g.formatFileSize)(n.value.size):"0 Б"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2))}}),C=d._export_sfc(V,[["__scopeId","data-v-9dee864d"]]);class N{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 N,k=Symbol("OVERLAY_PARENT");function _(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}}const 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}=_("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=C;exports.Image=D;exports.getFileTypeByMime=y;exports.useOverlay=_;
@@ -1,83 +1,25 @@
1
- import { inject as P, ref as h, onMounted as z, provide as O, onUnmounted as T, defineComponent as w, useId as S, computed as k, createElementBlock as d, openBlock as n, normalizeClass as C, createCommentVNode as f, createBlock as b, createVNode as _, unref as v, resolveDynamicComponent as V, toDisplayString as y, Teleport as R, Transition as N, withCtx as A, normalizeStyle as Z, createElementVNode as m, useTemplateRef as j, Fragment as W } from "vue";
1
+ import { defineComponent as z, useId as S, ref as h, computed as k, onMounted as w, createElementBlock as d, openBlock as n, normalizeClass as C, createCommentVNode as f, createBlock as b, createVNode as _, unref as v, resolveDynamicComponent as P, toDisplayString as y, inject as O, provide as T, onUnmounted as V, Teleport as R, Transition as N, withCtx as A, normalizeStyle as Z, createElementVNode as m, useTemplateRef as j, Fragment as W } from "vue";
2
2
  import { F as Y, E as D, W as L, P as K, C as E, _ as F, a as U } from "./FileIcon-maHE2Nhr.js";
3
3
  import { f as M } from "./parseFileSize.util-CxVk4CvB.js";
4
- class q {
5
- stack = [];
6
- baseZIndex = {
7
- confirm: 1400,
8
- modal: 1300,
9
- drawer: 1200,
10
- popover: 1100,
11
- tooltip: 1e3
12
- };
13
- step = 10;
14
- // шаг между "корневыми" оверлеями одного типа
15
- childStep = 1;
16
- // шаг для вложенных (popover внутри modal и т.д.)
17
- idCounter = 0;
18
- listeners = /* @__PURE__ */ new Set();
19
- subscribe(a) {
20
- return this.listeners.add(a), () => this.listeners.delete(a);
21
- }
22
- notify() {
23
- this.listeners.forEach((a) => a());
24
- }
25
- register(a, t) {
26
- const o = ++this.idCounter, l = t ? this.stack.find((c) => c.id === t) : void 0;
27
- let i;
28
- if (l)
29
- i = l.zIndex + this.childStep;
30
- else {
31
- const c = this.stack.filter((u) => u.type === a && !u.parentId);
32
- i = (c.length ? Math.max(...c.map((u) => u.zIndex)) : this.baseZIndex[a]) + this.step;
33
- }
34
- const s = { id: o, type: a, parentId: t ?? null, zIndex: i };
35
- return this.stack.push(s), this.notify(), s;
36
- }
37
- unregister(a) {
38
- this.stack = this.stack.filter((t) => t.id !== a), this.notify();
39
- }
40
- getTop() {
41
- return this.stack.length ? this.stack[this.stack.length - 1] : null;
42
- }
43
- isTop(a) {
44
- return this.getTop()?.id === a;
45
- }
46
- getStack() {
47
- return [...this.stack];
48
- }
49
- }
50
- const I = new q(), x = Symbol("OVERLAY_PARENT");
51
- function G(e) {
52
- const a = P(x, null), t = h(null);
53
- return z(() => {
54
- t.value = I.register(e, a ?? null), t.value && O(x, t.value.id);
55
- }), T(() => {
56
- t.value && I.unregister(t.value.id);
57
- }), {
58
- zIndex: t,
59
- isTop: () => t.value ? I.isTop(t.value.id) : !1
60
- };
61
- }
62
- function H(e) {
4
+ function q(e) {
63
5
  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
6
  }
65
- const J = {
7
+ const G = {
66
8
  key: 1,
67
9
  class: "file__title"
68
- }, Q = {
10
+ }, H = {
69
11
  key: 2,
70
12
  class: "file__info"
71
- }, X = {
13
+ }, J = {
72
14
  key: 0,
73
15
  class: "file__type"
74
- }, ee = {
16
+ }, Q = {
75
17
  key: 1,
76
18
  class: "file__info-separator"
77
- }, te = {
19
+ }, X = {
78
20
  key: 2,
79
21
  class: "file__size"
80
- }, le = /* @__PURE__ */ w({
22
+ }, ee = /* @__PURE__ */ z({
81
23
  __name: "File",
82
24
  props: {
83
25
  file: {},
@@ -92,7 +34,7 @@ const J = {
92
34
  const p = await (await fetch(r)).blob(), $ = p.type.split("/")[1] || "", B = $ ? `${u}.${$}` : u;
93
35
  return new File([p], B, { type: p.type });
94
36
  }
95
- const s = k(() => l.value && l.value.mime ? H(l.value.mime) : null), c = k(() => {
37
+ const s = k(() => l.value && l.value.mime ? q(l.value.mime) : null), c = k(() => {
96
38
  switch (s.value) {
97
39
  case "pdf":
98
40
  return K;
@@ -105,7 +47,7 @@ const J = {
105
47
  return Y;
106
48
  }
107
49
  });
108
- return z(async () => {
50
+ return w(async () => {
109
51
  if (typeof e.file == "string") {
110
52
  const r = await i(e.file);
111
53
  l.value = {
@@ -127,23 +69,82 @@ const J = {
127
69
  }, [
128
70
  _(v(E))
129
71
  ])) : f("", !0),
130
- (n(), b(V(c.value), { class: "file__icon" })),
131
- l.value && l.value.name && r.viewName ? (n(), d("div", J, y(l.value ? l.value.name.split(".")[0] : "unknown"), 1)) : f("", !0),
132
- l.value ? (n(), d("div", Q, [
133
- l.value.mime ? (n(), d("div", X, y(s.value), 1)) : f("", !0),
134
- l.value.mime && l.value.size ? (n(), d("div", ee)) : f("", !0),
135
- l.value.size ? (n(), d("div", te, y(l.value ? v(M)(l.value.size) : "0 Б"), 1)) : f("", !0)
72
+ (n(), b(P(c.value), { class: "file__icon" })),
73
+ l.value && l.value.name && r.viewName ? (n(), d("div", G, y(l.value ? l.value.name.split(".")[0] : "unknown"), 1)) : f("", !0),
74
+ l.value ? (n(), d("div", H, [
75
+ l.value.mime ? (n(), d("div", J, y(s.value), 1)) : f("", !0),
76
+ l.value.mime && l.value.size ? (n(), d("div", Q)) : f("", !0),
77
+ l.value.size ? (n(), d("div", X, y(l.value ? v(M)(l.value.size) : "0 Б"), 1)) : f("", !0)
136
78
  ])) : f("", !0)
137
79
  ], 2));
138
80
  }
139
- }), ge = /* @__PURE__ */ F(le, [["__scopeId", "data-v-9dee864d"]]), se = { class: "image-full-modal__wrapper" }, ae = { class: "image-full-modal__header" }, ie = { class: "image-full-modal__main" }, ne = ["src", "alt"], oe = /* @__PURE__ */ w({
81
+ }), ge = /* @__PURE__ */ F(ee, [["__scopeId", "data-v-9dee864d"]]);
82
+ class te {
83
+ stack = [];
84
+ baseZIndex = {
85
+ confirm: 1400,
86
+ modal: 1300,
87
+ drawer: 1200,
88
+ popover: 1100,
89
+ tooltip: 1e3
90
+ };
91
+ step = 10;
92
+ // шаг между "корневыми" оверлеями одного типа
93
+ childStep = 1;
94
+ // шаг для вложенных (popover внутри modal и т.д.)
95
+ idCounter = 0;
96
+ listeners = /* @__PURE__ */ new Set();
97
+ subscribe(a) {
98
+ return this.listeners.add(a), () => this.listeners.delete(a);
99
+ }
100
+ notify() {
101
+ this.listeners.forEach((a) => a());
102
+ }
103
+ register(a, t) {
104
+ const o = ++this.idCounter, l = t ? this.stack.find((c) => c.id === t) : void 0;
105
+ let i;
106
+ if (l)
107
+ i = l.zIndex + this.childStep;
108
+ else {
109
+ const c = this.stack.filter((u) => u.type === a && !u.parentId);
110
+ i = (c.length ? Math.max(...c.map((u) => u.zIndex)) : this.baseZIndex[a]) + this.step;
111
+ }
112
+ const s = { id: o, type: a, parentId: t ?? null, zIndex: i };
113
+ return this.stack.push(s), this.notify(), s;
114
+ }
115
+ unregister(a) {
116
+ this.stack = this.stack.filter((t) => t.id !== a), this.notify();
117
+ }
118
+ getTop() {
119
+ return this.stack.length ? this.stack[this.stack.length - 1] : null;
120
+ }
121
+ isTop(a) {
122
+ return this.getTop()?.id === a;
123
+ }
124
+ getStack() {
125
+ return [...this.stack];
126
+ }
127
+ }
128
+ const I = new te(), x = Symbol("OVERLAY_PARENT");
129
+ function le(e) {
130
+ const a = O(x, null), t = h(null);
131
+ return w(() => {
132
+ t.value = I.register(e, a ?? null), t.value && T(x, t.value.id);
133
+ }), V(() => {
134
+ t.value && I.unregister(t.value.id);
135
+ }), {
136
+ zIndex: t,
137
+ isTop: () => t.value ? I.isTop(t.value.id) : !1
138
+ };
139
+ }
140
+ const se = { class: "image-full-modal__wrapper" }, ae = { class: "image-full-modal__header" }, ie = { class: "image-full-modal__main" }, ne = ["src", "alt"], oe = /* @__PURE__ */ z({
140
141
  __name: "ImageFullModal",
141
142
  props: {
142
143
  src: {},
143
144
  alt: {}
144
145
  },
145
146
  setup(e, { expose: a }) {
146
- const t = h(!1), { zIndex: o } = G("modal");
147
+ const t = h(!1), { zIndex: o } = le("modal");
147
148
  return a({
148
149
  open: () => {
149
150
  t.value = !0;
@@ -192,7 +193,7 @@ const J = {
192
193
  }, de = {
193
194
  key: 0,
194
195
  class: "image__size"
195
- }, fe = /* @__PURE__ */ w({
196
+ }, fe = /* @__PURE__ */ z({
196
197
  __name: "Image",
197
198
  props: {
198
199
  file: {},
@@ -209,7 +210,7 @@ const J = {
209
210
  return new File([u], p, { type: u.type });
210
211
  }
211
212
  const i = k(() => typeof e.file == "string" ? e.file : e.file.url);
212
- return z(async () => {
213
+ return w(async () => {
213
214
  if (e.viewInfo)
214
215
  if (typeof e.file == "string") {
215
216
  const s = await l(e.file);
@@ -254,6 +255,6 @@ const J = {
254
255
  export {
255
256
  ge as F,
256
257
  ye as I,
257
- H as g,
258
- G as u
258
+ q as g,
259
+ le as u
259
260
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("../Image-Cbf_uRLj.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("../Image-BCwUQuQH.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;
@@ -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-CC-8vrJo.js";
2
+ import { g as $, I as O, F as x } from "../Image-Dg-dDZPv.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";
package/dist/index.d.ts CHANGED
@@ -1118,6 +1118,7 @@ labelKey: string;
1118
1118
  maxTags: number;
1119
1119
  clearable: boolean;
1120
1120
  required: boolean;
1121
+ inputKey: string;
1121
1122
  minQueryLength: number;
1122
1123
  }, {}, {}, {}, string, ComponentProvideOptions, false, {
1123
1124
  autocompleteTrigger: HTMLDivElement;
@@ -1141,6 +1142,7 @@ declare interface AutocompleteProps {
1141
1142
  loading?: boolean;
1142
1143
  valueKey?: string;
1143
1144
  labelKey?: string;
1145
+ inputKey?: string;
1144
1146
  maxTags?: number;
1145
1147
  clearable?: boolean;
1146
1148
  minQueryLength?: number;