prlg-ui 1.6.15 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/index.cjs.js +1 -1
- package/dist/blocks/index.es.js +1 -1
- package/dist/index.d.ts +71 -34
- package/dist/onClickOutside.util-BXSbNnqr.js +30 -0
- package/dist/onClickOutside.util-DWtrUc1v.cjs +1 -0
- package/dist/prlg-ui.cjs.js +1 -1
- package/dist/prlg-ui.css +1 -1
- package/dist/prlg-ui.es.js +2508 -1787
- package/dist/utils/index.cjs.js +1 -1
- package/dist/utils/index.es.js +1 -1
- package/dist/utils/onClickOutside.util.ts +32 -10
- package/dist/utils.d.ts +13 -2
- package/package.json +2 -1
- package/dist/onClickOutside.util-CJueL_Rz.js +0 -21
- package/dist/onClickOutside.util-DD1l-Ra5.cjs +0 -1
package/dist/blocks/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),u=require("../Image-KC6enSsM.cjs"),f=require("../FileIcon-sxADkCIe.cjs"),m=require("../SendIcon-_UxV_dOO.cjs"),p=require("../onClickOutside.util-
|
|
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-DWtrUc1v.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;
|
package/dist/blocks/index.es.js
CHANGED
|
@@ -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-
|
|
5
|
+
import { o as J } from "../onClickOutside.util-BXSbNnqr.js";
|
|
6
6
|
import "../dayjs.util-RJe77c19.js";
|
|
7
7
|
const K = { class: "chat-file__content" }, Q = /* @__PURE__ */ _({
|
|
8
8
|
__name: "ChatFile",
|
package/dist/index.d.ts
CHANGED
|
@@ -17,9 +17,9 @@ import { ExtractPropTypes } from 'vue';
|
|
|
17
17
|
import { GlobalComponents } from 'vue';
|
|
18
18
|
import { GlobalDirectives } from 'vue';
|
|
19
19
|
import { nextTick } from 'vue';
|
|
20
|
-
import { OffsetOptions } from '@floating-ui/dom';
|
|
21
20
|
import { OnCleanup } from '@vue/reactivity';
|
|
22
|
-
import { Placement } from '@floating-ui/
|
|
21
|
+
import { Placement } from '@floating-ui/vue';
|
|
22
|
+
import { Placement as Placement_2 } from '@floating-ui/dom';
|
|
23
23
|
import { PropType } from 'vue';
|
|
24
24
|
import { PublicProps } from 'vue';
|
|
25
25
|
import { Ref } from 'vue';
|
|
@@ -51,23 +51,45 @@ declare const __VLS_component_12: DefineComponent<__VLS_PublicProps_9, {}, {}, {
|
|
|
51
51
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
52
52
|
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
53
53
|
|
|
54
|
-
declare const __VLS_component_13: DefineComponent<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
declare const __VLS_component_13: DefineComponent<ExtractPropTypes< {
|
|
55
|
+
placement: {
|
|
56
|
+
type: PropType<Placement>;
|
|
57
|
+
default: string;
|
|
58
|
+
};
|
|
59
|
+
offset: {
|
|
60
|
+
type: PropType<OffsetValue | number>;
|
|
61
|
+
};
|
|
62
|
+
arrowVisible: {
|
|
63
|
+
type: BooleanConstructor;
|
|
64
|
+
default: boolean;
|
|
65
|
+
};
|
|
60
66
|
}>, {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
open: () => void;
|
|
68
|
+
close: () => void;
|
|
69
|
+
openSecondScreen: (event?: Event) => Promise<void>;
|
|
70
|
+
closeSecondScreen: () => void;
|
|
71
|
+
isOpen: Ref<boolean, boolean>;
|
|
72
|
+
isSecondScreenOpen: Ref<boolean, boolean>;
|
|
73
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
|
|
74
|
+
placement: {
|
|
75
|
+
type: PropType<Placement>;
|
|
76
|
+
default: string;
|
|
77
|
+
};
|
|
78
|
+
offset: {
|
|
79
|
+
type: PropType<OffsetValue | number>;
|
|
80
|
+
};
|
|
81
|
+
arrowVisible: {
|
|
82
|
+
type: BooleanConstructor;
|
|
83
|
+
default: boolean;
|
|
84
|
+
};
|
|
85
|
+
}>> & Readonly<{}>, {
|
|
64
86
|
placement: Placement;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
87
|
+
arrowVisible: boolean;
|
|
88
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {
|
|
89
|
+
reference: HTMLDivElement;
|
|
90
|
+
floating: HTMLDivElement;
|
|
91
|
+
'arrow-block': HTMLDivElement;
|
|
92
|
+
'second-screen': HTMLDivElement;
|
|
71
93
|
}, HTMLDivElement>;
|
|
72
94
|
|
|
73
95
|
declare const __VLS_component_14: DefineComponent<__VLS_Props_19, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_19> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
@@ -407,12 +429,23 @@ declare function __VLS_template_13(): {
|
|
|
407
429
|
attrs: Partial<{}>;
|
|
408
430
|
slots: {
|
|
409
431
|
trigger?(_: {}): any;
|
|
410
|
-
default?(_: {
|
|
411
|
-
|
|
432
|
+
default?(_: {
|
|
433
|
+
openSecondScreen: (event?: Event) => Promise<void>;
|
|
434
|
+
closeSecondScreen: () => void;
|
|
435
|
+
}): any;
|
|
436
|
+
default?(_: {
|
|
437
|
+
openSecondScreen: (event?: Event) => Promise<void>;
|
|
438
|
+
closeSecondScreen: () => void;
|
|
439
|
+
}): any;
|
|
440
|
+
'second-screen'?(_: {
|
|
441
|
+
closeSecondScreen: () => void;
|
|
442
|
+
}): any;
|
|
412
443
|
};
|
|
413
444
|
refs: {
|
|
414
|
-
|
|
415
|
-
|
|
445
|
+
reference: HTMLDivElement;
|
|
446
|
+
floating: HTMLDivElement;
|
|
447
|
+
'arrow-block': HTMLDivElement;
|
|
448
|
+
'second-screen': HTMLDivElement;
|
|
416
449
|
};
|
|
417
450
|
rootEl: HTMLDivElement;
|
|
418
451
|
};
|
|
@@ -1018,21 +1051,25 @@ export declare const Message: __VLS_WithTemplateSlots_8<typeof __VLS_component_8
|
|
|
1018
1051
|
|
|
1019
1052
|
export declare const Modal: __VLS_WithTemplateSlots_12<typeof __VLS_component_12, __VLS_TemplateResult_12["slots"]>;
|
|
1020
1053
|
|
|
1054
|
+
declare type OffsetValue = number | {
|
|
1055
|
+
/**
|
|
1056
|
+
* Отступ по главной оси
|
|
1057
|
+
*/
|
|
1058
|
+
mainAxis?: number;
|
|
1059
|
+
/**
|
|
1060
|
+
* Отступ по поперечной оси
|
|
1061
|
+
*/
|
|
1062
|
+
crossAxis?: number;
|
|
1063
|
+
/**
|
|
1064
|
+
* Отступ по оси выравнивания
|
|
1065
|
+
*/
|
|
1066
|
+
alignmentAxis?: number | null;
|
|
1067
|
+
};
|
|
1068
|
+
|
|
1021
1069
|
export declare const OverlayBadge: __VLS_WithTemplateSlots_9<typeof __VLS_component_9, __VLS_TemplateResult_9["slots"]>;
|
|
1022
1070
|
|
|
1023
1071
|
export declare const Popover: __VLS_WithTemplateSlots_13<typeof __VLS_component_13, __VLS_TemplateResult_13["slots"]>;
|
|
1024
1072
|
|
|
1025
|
-
declare interface PopoverProps {
|
|
1026
|
-
placement?: Placement;
|
|
1027
|
-
size?: 'small' | 'default';
|
|
1028
|
-
trigger?: 'click' | 'hover';
|
|
1029
|
-
offset?: OffsetOptions;
|
|
1030
|
-
popoverClass?: string;
|
|
1031
|
-
disabled?: boolean;
|
|
1032
|
-
showArrow?: boolean;
|
|
1033
|
-
hoverDelay?: number;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
1073
|
declare type Position = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'topleft' | 'topright' | 'bottomleft' | 'bottomright';
|
|
1037
1074
|
|
|
1038
1075
|
declare interface Props {
|
|
@@ -1259,7 +1296,7 @@ show: (element: HTMLElement) => void;
|
|
|
1259
1296
|
hide: () => void;
|
|
1260
1297
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<TooltipProps> & Readonly<{}>, {
|
|
1261
1298
|
offset: number;
|
|
1262
|
-
placement:
|
|
1299
|
+
placement: Placement_2;
|
|
1263
1300
|
showArrow: boolean;
|
|
1264
1301
|
delay: number;
|
|
1265
1302
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
@@ -1283,7 +1320,7 @@ declare interface TooltipElement extends HTMLElement {
|
|
|
1283
1320
|
|
|
1284
1321
|
declare interface TooltipProps {
|
|
1285
1322
|
content: string;
|
|
1286
|
-
placement?:
|
|
1323
|
+
placement?: Placement_2;
|
|
1287
1324
|
offset?: number;
|
|
1288
1325
|
tooltipClass?: string;
|
|
1289
1326
|
showArrow?: boolean;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { toValue as f, unref as g } from "vue";
|
|
2
|
+
const u = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
function l(t) {
|
|
4
|
+
const r = g(t);
|
|
5
|
+
return r?.$el ?? r;
|
|
6
|
+
}
|
|
7
|
+
function p(t) {
|
|
8
|
+
return typeof t == "string" ? document.querySelector(t) : l(t);
|
|
9
|
+
}
|
|
10
|
+
function w(t, r, d = {}) {
|
|
11
|
+
const n = p(t);
|
|
12
|
+
if (console.log("targetElement", n), !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(d.ignore) ?? []).map((e) => typeof e == "string" ? document.querySelector(e) : l(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 l=require("vue"),u=new WeakMap;function d(t){const r=l.unref(t);return r?.$el??r}function g(t){return typeof t=="string"?document.querySelector(t):d(t)}function p(t,r,m={}){const n=g(t);if(console.log("targetElement",n),!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 f=(l.toValue(m.ignore)??[]).map(e=>typeof e=="string"?document.querySelector(e):d(e)).filter(e=>e!=null);n.contains(c)||f.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;
|