prlg-ui 1.8.86 → 1.8.88

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.
@@ -1,25 +1,83 @@
1
- import { defineComponent as z, useId as C, ref as h, computed as I, onMounted as w, createElementBlock as d, openBlock as n, normalizeClass as x, createCommentVNode as f, createBlock as b, createVNode as _, unref as v, resolveDynamicComponent as O, toDisplayString as y, inject as T, provide as V, onUnmounted as R, Teleport as N, Transition as A, withCtx as P, normalizeStyle as Z, createElementVNode as m, useTemplateRef as j, Fragment as W } from "vue";
1
+ import { inject as O, ref as h, onMounted as z, provide as T, onUnmounted as V, defineComponent as w, useId as C, computed as I, createElementBlock as d, openBlock as n, normalizeClass as x, createCommentVNode as f, createBlock as b, createVNode as _, unref as v, resolveDynamicComponent as R, toDisplayString as y, Teleport as N, Transition as A, withCtx as P, 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
- function q(e) {
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 k = new q(), S = Symbol("OVERLAY_PARENT");
51
+ function G(e) {
52
+ const a = O(S, null), t = h(null);
53
+ return z(() => {
54
+ t.value = k.register(e, a ?? null), t.value && T(S, t.value.id);
55
+ }), V(() => {
56
+ t.value && k.unregister(t.value.id);
57
+ }), {
58
+ zIndex: t,
59
+ isTop: () => t.value ? k.isTop(t.value.id) : !1
60
+ };
61
+ }
62
+ function H(e) {
5
63
  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";
6
64
  }
7
- const G = {
65
+ const J = {
8
66
  key: 1,
9
67
  class: "file__title"
10
- }, H = {
68
+ }, Q = {
11
69
  key: 2,
12
70
  class: "file__info"
13
- }, J = {
71
+ }, X = {
14
72
  key: 0,
15
73
  class: "file__type"
16
- }, Q = {
74
+ }, ee = {
17
75
  key: 1,
18
76
  class: "file__info-separator"
19
- }, X = {
77
+ }, te = {
20
78
  key: 2,
21
79
  class: "file__size"
22
- }, ee = /* @__PURE__ */ z({
80
+ }, le = /* @__PURE__ */ w({
23
81
  __name: "File",
24
82
  props: {
25
83
  file: {},
@@ -34,7 +92,7 @@ const G = {
34
92
  const p = await (await fetch(r)).blob(), $ = p.type.split("/")[1] || "", B = $ ? `${u}.${$}` : u;
35
93
  return new File([p], B, { type: p.type });
36
94
  }
37
- const s = I(() => l.value && l.value.mime ? q(l.value.mime) : null), c = I(() => {
95
+ const s = I(() => l.value && l.value.mime ? H(l.value.mime) : null), c = I(() => {
38
96
  switch (s.value) {
39
97
  case "pdf":
40
98
  return K;
@@ -47,7 +105,7 @@ const G = {
47
105
  return Y;
48
106
  }
49
107
  });
50
- return w(async () => {
108
+ return z(async () => {
51
109
  if (typeof e.file == "string") {
52
110
  const r = await i(e.file);
53
111
  l.value = {
@@ -69,82 +127,23 @@ const G = {
69
127
  }, [
70
128
  _(v(E))
71
129
  ])) : f("", !0),
72
- (n(), b(O(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)
130
+ (n(), b(R(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)
78
136
  ])) : f("", !0)
79
137
  ], 2));
80
138
  }
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 k = new te(), S = Symbol("OVERLAY_PARENT");
129
- function le(e) {
130
- const a = T(S, null), t = h(null);
131
- return w(() => {
132
- t.value = k.register(e, a ?? null), t.value && V(S, t.value.id);
133
- }), R(() => {
134
- t.value && k.unregister(t.value.id);
135
- }), {
136
- zIndex: t,
137
- isTop: () => t.value ? k.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({
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({
141
140
  __name: "ImageFullModal",
142
141
  props: {
143
142
  src: {},
144
143
  alt: {}
145
144
  },
146
145
  setup(e, { expose: a }) {
147
- const t = h(!1), { zIndex: o } = le("modal");
146
+ const t = h(!1), { zIndex: o } = G("modal");
148
147
  return a({
149
148
  open: () => {
150
149
  t.value = !0;
@@ -193,7 +192,7 @@ const se = { class: "image-full-modal__wrapper" }, ae = { class: "image-full-mod
193
192
  }, de = {
194
193
  key: 0,
195
194
  class: "image__size"
196
- }, fe = /* @__PURE__ */ z({
195
+ }, fe = /* @__PURE__ */ w({
197
196
  __name: "Image",
198
197
  props: {
199
198
  file: {},
@@ -209,7 +208,7 @@ const se = { class: "image-full-modal__wrapper" }, ae = { class: "image-full-mod
209
208
  return new File([u], p, { type: u.type });
210
209
  }
211
210
  const i = I(() => typeof e.file == "string" ? e.file : e.file.url);
212
- return w(async () => {
211
+ return z(async () => {
213
212
  if (e.viewInfo)
214
213
  if (typeof e.file == "string") {
215
214
  const s = await l(e.file);
@@ -253,6 +252,6 @@ const se = { class: "image-full-modal__wrapper" }, ae = { class: "image-full-mod
253
252
  export {
254
253
  ge as F,
255
254
  ye as I,
256
- q as g,
257
- le as u
255
+ H as g,
256
+ G as u
258
257
  };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("vue"),d=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=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,o=l?this.stack.find(u=>u.id===l):void 0;let i;if(o)i=o.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 n={id:s,type:a,parentId:l??null,zIndex:i};return this.stack.push(n),this.notify(),n}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 p=new B,k=Symbol("OVERLAY_PARENT");function y(t){const a=e.inject(k,null),l=e.ref(null);return e.onMounted(()=>{l.value=p.register(t,a??null),l.value&&e.provide(k,l.value.id)}),e.onUnmounted(()=>{l.value&&p.unregister(l.value.id)}),{zIndex:l,isTop:()=>l.value?p.isTop(l.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"},E={key:2,class:"file__info"},z={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 l=a,s=e.useId(),o=e.ref(null);async function i(r,c="image"){const m=await(await fetch(r)).blob(),v=m.type.split("/")[1]||"",h=v?`${c}.${v}`:c;return new File([m],h,{type:m.type})}const n=e.computed(()=>o.value&&o.value.mime?_(o.value.mime):null),u=e.computed(()=>{switch(n.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);o.value={id:s,url:t.file,name:r.name,mime:r.type,size:r.size}}else o.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"})),o.value&&o.value.name&&r.viewName?(e.openBlock(),e.createElementBlock("div",I,e.toDisplayString(o.value?o.value.name.split(".")[0]:"unknown"),1)):e.createCommentVNode("",!0),o.value?(e.openBlock(),e.createElementBlock("div",E,[o.value.mime?(e.openBlock(),e.createElementBlock("div",z,e.toDisplayString(n.value),1)):e.createCommentVNode("",!0),o.value.mime&&o.value.size?(e.openBlock(),e.createElementBlock("div",V)):e.createCommentVNode("",!0),o.value.size?(e.openBlock(),e.createElementBlock("div",C,e.toDisplayString(o.value?e.unref(g.formatFileSize)(o.value.size):"0 Б"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2))}}),w=d._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 l=e.ref(!1),{zIndex:s}=y("modal");return a({open:()=>{l.value=!0},close:()=>{l.value=!1}}),(o,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]=n=>l.value=!1)}),e.createElementVNode("div",F,[e.createElementVNode("div",b,[e.createElementVNode("button",{class:"image-full-modal__close",onClick:i[1]||(i[1]=n=>l.value=!1)},[e.createVNode(e.unref(d.CloseIcon))])]),e.createElementVNode("div",S,[e.createElementVNode("img",{src:o.src,alt:o.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"},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(),l=e.useTemplateRef("imageFullModal"),s=e.ref(null);async function o(n,u="image"){const c=await(await fetch(n)).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 n=await o(t.file);s.value={id:a,url:t.file,name:n.name,mime:n.type,size:n.size}}else s.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=>l.value?.open())},[e.createVNode(e.unref(d.EyeIcon))])):e.createCommentVNode("",!0),e.createElementVNode("img",{src:i.value,alt:n.alt},null,8,O),n.viewInfo&&s.value&&(s.value.mime||s.value.size)&&n.size==="large"?(e.openBlock(),e.createElementBlock("div",T,[s.value.size?(e.openBlock(),e.createElementBlock("div",R,e.toDisplayString(s.value?e.unref(g.formatFileSize)(s.value.size):"0 Б"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2),n.fullScreen?(e.openBlock(),e.createBlock(M,{key:0,ref:"imageFullModal",src:i.value,alt:n.alt},null,8,["src","alt"])):e.createCommentVNode("",!0)],64))}}),A=d._export_sfc(D,[["__scopeId","data-v-cc14d604"]]);exports.File=w;exports.Image=A;exports.getFileTypeByMime=_;exports.useOverlay=y;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("../Image-Be4KWSej.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-OgzfB2zs.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-wxPggg1a.js";
2
+ import { g as $, I as O, F as x } from "../Image-6zoTMdCp.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
@@ -265,14 +265,14 @@ onChange?: ((value?: string | undefined) => any) | undefined;
265
265
  declare const __VLS_component_6: DefineComponent<DropdownProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
266
266
  clear: () => any;
267
267
  search: (query: string) => any;
268
- change: (value: string | number | DropdownOption | (string | number | DropdownOption)[] | undefined) => any;
269
- "update:modelValue": (value: string | number | DropdownOption | (string | number | DropdownOption)[] | undefined) => any;
268
+ change: (value: string | number | DropdownOption | (string | number | DropdownOption)[] | null | undefined) => any;
269
+ "update:modelValue": (value: string | number | DropdownOption | (string | number | DropdownOption)[] | null | undefined) => any;
270
270
  "remove-tag": (value: string | number | DropdownOption) => any;
271
271
  }, string, PublicProps, Readonly<DropdownProps> & Readonly<{
272
272
  onClear?: (() => any) | undefined;
273
273
  onSearch?: ((query: string) => any) | undefined;
274
- onChange?: ((value: string | number | DropdownOption | (string | number | DropdownOption)[] | undefined) => any) | undefined;
275
- "onUpdate:modelValue"?: ((value: string | number | DropdownOption | (string | number | DropdownOption)[] | undefined) => any) | undefined;
274
+ onChange?: ((value: string | number | DropdownOption | (string | number | DropdownOption)[] | null | undefined) => any) | undefined;
275
+ "onUpdate:modelValue"?: ((value: string | number | DropdownOption | (string | number | DropdownOption)[] | null | undefined) => any) | undefined;
276
276
  "onRemove-tag"?: ((value: string | number | DropdownOption) => any) | undefined;
277
277
  }>, {
278
278
  disabled: boolean;
@@ -1362,7 +1362,7 @@ declare interface DropdownOption {
1362
1362
  }
1363
1363
 
1364
1364
  declare interface DropdownProps {
1365
- modelValue?: string | number | DropdownOption | Array<string | number | DropdownOption>;
1365
+ modelValue?: string | number | DropdownOption | Array<string | number | DropdownOption> | null;
1366
1366
  options?: DropdownOption[];
1367
1367
  multiple?: boolean;
1368
1368
  placeholder?: string;
@@ -1570,7 +1570,13 @@ onBlur?: (() => any) | undefined;
1570
1570
  onFocus?: ((value: FocusEvent) => any) | undefined;
1571
1571
  onPaste?: ((value: ClipboardEvent) => any) | undefined;
1572
1572
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
1573
- }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
1573
+ }>, {
1574
+ size: "small" | "default" | "large";
1575
+ variant: "empty" | "outlined" | "fill";
1576
+ type: "text" | "password";
1577
+ required: boolean;
1578
+ readonly: boolean;
1579
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
1574
1580
 
1575
1581
  declare type InputTextProps = {
1576
1582
  label?: string;