prlg-ui 1.7.18 → 1.7.20

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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("../Image-KC6enSsM.cjs"),f=require("../FileIcon-sxADkCIe.cjs"),m=require("../SendIcon-_UxV_dOO.cjs"),p=require("../onClickOutside.util-s9tGCG0a.cjs");require("../dayjs.util-Dg65EiGQ.cjs");const v={class:"chat-file__content"},_=e.defineComponent({__name:"ChatFile",props:{file:{}},emits:["deleteFile"],setup(t,{emit:s}){const o=s,c=e.computed(()=>URL.createObjectURL(t.file));return(l,d)=>(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:d[0]||(d[0]=a=>o("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(_,[["__scopeId","data-v-d52d3d8d"]]);function g(t){if(!t)return;const s=Array.isArray(t)?t:[t],o={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 s.flatMap(c=>o[c]||[]).join(",")}function y(t={}){return new Promise(s=>{const o=document.createElement("input");o.type="file",o.style.display="none",t.maxFiles&&t.maxFiles>1&&(o.multiple=!0);const c=g(t.accept);c&&(o.accept=c),o.addEventListener("change",l=>{const d=l.target;let a=[];if(d.files&&d.files.length>0&&(a=Array.from(d.files),t.maxFiles&&a.length>t.maxFiles&&(a=a.slice(0,t.maxFiles)),t.maxFileSize)){const i=u.parseFileSize(t.maxFileSize);a=a.filter(n=>n.size<=i)}s(a),document.body.removeChild(o)}),document.body.appendChild(o),o.click()})}const k={class:"chat-field-actions"},B={ref:"overlay",class:"chat-field-actions__overlay"},b=["onClick"],F={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(t){const s=e.useModel(t,"modelValue"),o=e.useTemplateRef("button"),c=e.useTemplateRef("overlay"),l=e.ref(!1),d=e.reactive({image:{icon:e.shallowRef(m.ImageIcon),label:"Добавить изображение"},file:{icon:e.shallowRef(f.FileIcon),label:"Добавить файл"}}),a=i=>{y({accept:i==="image"?["image"]:["pdf","excel","word"],maxFileSize:"5mb",maxFiles:1}).then(n=>{s.value?s.value=t.multiple?[...s.value,...n]:n:s.value=[...n],l.value=!1})};return e.onMounted(()=>{p.onClickOutside(c.value,()=>{l.value=!1},{ignore:[o.value]})}),(i,n)=>(e.openBlock(),e.createElementBlock("div",k,[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(i.actions,r=>(e.openBlock(),e.createElementBlock("div",{class:"chat-field-actions__overlay-item",key:r,onClick:z=>a(r)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d[r].icon),{class:"chat-field-actions__overlay-item__icon"})),e.createElementVNode("span",F,e.toDisplayString(d[r].label),1)],8,b))),128))],512),[[e.vShow,l.value]])]),_:1}),e.createElementVNode("button",{ref:"button",onClick:n[0]||(n[0]=r=>l.value=!l.value),class:e.normalizeClass(["chat-field-actions__button",{"chat-field-actions__button--active":l.value}]),disabled:i.disabled},[e.createVNode(e.unref(m.PlusRoundedIcon))],10,C)]))}}),E=f._export_sfc(V,[["__scopeId","data-v-6b295528"]]),M={class:"chat-field"},N={key:0,class:"chat-field__files"},S={class:"chat-field__wrapper"},w=["placeholder"],I=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(t,{emit:s}){const o=s,c=e.useModel(t,"message"),l=e.useModel(t,"files"),d=a=>{l.value&&(l.value=l.value.filter(i=>i.name!==a.name))};return(a,i)=>(e.openBlock(),e.createElementBlock("div",M,[l.value&&l.value.length>0?(e.openBlock(),e.createElementBlock("div",N,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,n=>(e.openBlock(),e.createBlock(h,{key:n.name,file:n,onDeleteFile:d},null,8,["file"]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",S,[a.viewActions&&a.actions.length>0?(e.openBlock(),e.createBlock(E,{key:0,modelValue:l.value,"onUpdate:modelValue":i[0]||(i[0]=n=>l.value=n),actions:a.actions,disabled:a.disabled},null,8,["modelValue","actions","disabled"])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i[1]||(i[1]=n=>c.value=n),class:"chat-field__input",placeholder:a.placeholder},null,8,w),[[e.vModelText,c.value]]),e.createElementVNode("button",{class:"chat-field__button",onClick:i[2]||(i[2]=n=>o("sendMessage"))},[e.createVNode(e.unref(m.SendIcon))])])]))}}),$={class:"bonus-summary"},x=e.defineComponent({__name:"BonusSummary",setup(t){return(s,o)=>(e.openBlock(),e.createElementBlock("div",$,[e.createVNode(e.unref(m.BonusIcon),{class:"bonus-summary__icon"}),o[0]||(o[0]=e.createElementVNode("div",{class:"bonus-summary__number"},"123",-1))]))}});exports.BonusSummary=x;exports.ChatField=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("../Image-KC6enSsM.cjs"),f=require("../FileIcon-sxADkCIe.cjs"),m=require("../SendIcon-_UxV_dOO.cjs"),p=require("../onClickOutside.util-CvjEyTtT.cjs");require("../dayjs.util-Dg65EiGQ.cjs");const v={class:"chat-file__content"},_=e.defineComponent({__name:"ChatFile",props:{file:{}},emits:["deleteFile"],setup(t,{emit:s}){const o=s,c=e.computed(()=>URL.createObjectURL(t.file));return(l,d)=>(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:d[0]||(d[0]=a=>o("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(_,[["__scopeId","data-v-d52d3d8d"]]);function g(t){if(!t)return;const s=Array.isArray(t)?t:[t],o={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 s.flatMap(c=>o[c]||[]).join(",")}function y(t={}){return new Promise(s=>{const o=document.createElement("input");o.type="file",o.style.display="none",t.maxFiles&&t.maxFiles>1&&(o.multiple=!0);const c=g(t.accept);c&&(o.accept=c),o.addEventListener("change",l=>{const d=l.target;let a=[];if(d.files&&d.files.length>0&&(a=Array.from(d.files),t.maxFiles&&a.length>t.maxFiles&&(a=a.slice(0,t.maxFiles)),t.maxFileSize)){const i=u.parseFileSize(t.maxFileSize);a=a.filter(n=>n.size<=i)}s(a),document.body.removeChild(o)}),document.body.appendChild(o),o.click()})}const k={class:"chat-field-actions"},B={ref:"overlay",class:"chat-field-actions__overlay"},b=["onClick"],F={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(t){const s=e.useModel(t,"modelValue"),o=e.useTemplateRef("button"),c=e.useTemplateRef("overlay"),l=e.ref(!1),d=e.reactive({image:{icon:e.shallowRef(m.ImageIcon),label:"Добавить изображение"},file:{icon:e.shallowRef(f.FileIcon),label:"Добавить файл"}}),a=i=>{y({accept:i==="image"?["image"]:["pdf","excel","word"],maxFileSize:"5mb",maxFiles:1}).then(n=>{s.value?s.value=t.multiple?[...s.value,...n]:n:s.value=[...n],l.value=!1})};return e.onMounted(()=>{p.onClickOutside(c.value,()=>{l.value=!1},{ignore:[o.value]})}),(i,n)=>(e.openBlock(),e.createElementBlock("div",k,[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(i.actions,r=>(e.openBlock(),e.createElementBlock("div",{class:"chat-field-actions__overlay-item",key:r,onClick:z=>a(r)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d[r].icon),{class:"chat-field-actions__overlay-item__icon"})),e.createElementVNode("span",F,e.toDisplayString(d[r].label),1)],8,b))),128))],512),[[e.vShow,l.value]])]),_:1}),e.createElementVNode("button",{ref:"button",onClick:n[0]||(n[0]=r=>l.value=!l.value),class:e.normalizeClass(["chat-field-actions__button",{"chat-field-actions__button--active":l.value}]),disabled:i.disabled},[e.createVNode(e.unref(m.PlusRoundedIcon))],10,C)]))}}),E=f._export_sfc(V,[["__scopeId","data-v-6b295528"]]),M={class:"chat-field"},N={key:0,class:"chat-field__files"},S={class:"chat-field__wrapper"},w=["placeholder"],I=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(t,{emit:s}){const o=s,c=e.useModel(t,"message"),l=e.useModel(t,"files"),d=a=>{l.value&&(l.value=l.value.filter(i=>i.name!==a.name))};return(a,i)=>(e.openBlock(),e.createElementBlock("div",M,[l.value&&l.value.length>0?(e.openBlock(),e.createElementBlock("div",N,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,n=>(e.openBlock(),e.createBlock(h,{key:n.name,file:n,onDeleteFile:d},null,8,["file"]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",S,[a.viewActions&&a.actions.length>0?(e.openBlock(),e.createBlock(E,{key:0,modelValue:l.value,"onUpdate:modelValue":i[0]||(i[0]=n=>l.value=n),actions:a.actions,disabled:a.disabled},null,8,["modelValue","actions","disabled"])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i[1]||(i[1]=n=>c.value=n),class:"chat-field__input",placeholder:a.placeholder},null,8,w),[[e.vModelText,c.value]]),e.createElementVNode("button",{class:"chat-field__button",onClick:i[2]||(i[2]=n=>o("sendMessage"))},[e.createVNode(e.unref(m.SendIcon))])])]))}}),$={class:"bonus-summary"},x=e.defineComponent({__name:"BonusSummary",setup(t){return(s,o)=>(e.openBlock(),e.createElementBlock("div",$,[e.createVNode(e.unref(m.BonusIcon),{class:"bonus-summary__icon"}),o[0]||(o[0]=e.createElementVNode("div",{class:"bonus-summary__number"},"123",-1))]))}});exports.BonusSummary=x;exports.ChatField=I;
@@ -2,7 +2,7 @@ import { defineComponent as _, computed as I, createElementBlock as m, openBlock
2
2
  import { g as C, I as T, F as U, p as N } from "../Image-B_PtktNe.js";
3
3
  import { C as O, _ as B, F as P } from "../FileIcon-DkEbi-bi.js";
4
4
  import { I as j, P as q, S as H, B as G } from "../SendIcon-BGGNLlmf.js";
5
- import { o as J } from "../onClickOutside.util-h1mIKJca.js";
5
+ import { o as J } from "../onClickOutside.util-BWGmebYq.js";
6
6
  import "../dayjs.util-RJe77c19.js";
7
7
  const K = { class: "chat-file__content" }, Q = /* @__PURE__ */ _({
8
8
  __name: "ChatFile",
@@ -0,0 +1,30 @@
1
+ import { toValue as f, unref as p } from "vue";
2
+ const u = /* @__PURE__ */ new WeakMap();
3
+ function d(t) {
4
+ const r = p(t);
5
+ return r?.$el ?? r;
6
+ }
7
+ function g(t) {
8
+ return typeof t == "string" ? document.querySelector(t) : d(t);
9
+ }
10
+ function w(t, r, l = {}) {
11
+ const n = g(t);
12
+ if (!n) return () => {
13
+ };
14
+ const i = u.get(n);
15
+ i && (i(), u.delete(n));
16
+ const o = (s) => {
17
+ const c = s.target instanceof Node ? s.target : null;
18
+ if (!c) return;
19
+ const m = (f(l.ignore) ?? []).map((e) => typeof e == "string" ? document.querySelector(e) : d(e)).filter((e) => e != null);
20
+ n.contains(c) || m.some((e) => e.contains(c)) || r(s);
21
+ };
22
+ document.addEventListener("mousedown", o, { capture: !0 }), document.addEventListener("touchstart", o, { capture: !0 });
23
+ const a = () => {
24
+ document.removeEventListener("mousedown", o, { capture: !0 }), document.removeEventListener("touchstart", o, { capture: !0 }), u.delete(n);
25
+ };
26
+ return u.set(n, a), a;
27
+ }
28
+ export {
29
+ w as o
30
+ };
@@ -0,0 +1 @@
1
+ "use strict";const d=require("vue"),u=new WeakMap;function l(t){const r=d.unref(t);return r?.$el??r}function g(t){return typeof t=="string"?document.querySelector(t):l(t)}function p(t,r,f={}){const n=g(t);if(!n)return()=>{};const i=u.get(n);i&&(i(),u.delete(n));const o=s=>{const c=s.target instanceof Node?s.target:null;if(!c)return;const m=(d.toValue(f.ignore)??[]).map(e=>typeof e=="string"?document.querySelector(e):l(e)).filter(e=>e!=null);n.contains(c)||m.some(e=>e.contains(c))||r(s)};document.addEventListener("mousedown",o,{capture:!0}),document.addEventListener("touchstart",o,{capture:!0});const a=()=>{document.removeEventListener("mousedown",o,{capture:!0}),document.removeEventListener("touchstart",o,{capture:!0}),u.delete(n)};return u.set(n,a),a}exports.onClickOutside=p;