prlg-ui 1.8.48 → 1.8.50
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/eventBus.util-BXONoK5R.js +102 -0
- package/dist/eventBus.util-CXpXb6hA.cjs +1 -0
- package/dist/prlg-ui.cjs.js +1 -1
- package/dist/prlg-ui.css +1 -1
- package/dist/prlg-ui.es.js +1 -1
- package/dist/utils/index.cjs.js +1 -1
- package/dist/utils/index.es.js +1 -1
- package/dist/utils/useBodyScroll.util.ts +25 -2
- package/package.json +1 -1
- package/dist/eventBus.util-BtKtz0bo.js +0 -89
- package/dist/eventBus.util-DxR5dzi_.cjs +0 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { inject as f, ref as y, defineComponent as p, computed as h, createBlock as m, createCommentVNode as v, openBlock as g, Teleport as E, createElementVNode as w, normalizeStyle as S, renderSlot as I } from "vue";
|
|
2
|
+
function N() {
|
|
3
|
+
let t = null, e = null, l = null;
|
|
4
|
+
const o = () => {
|
|
5
|
+
if (typeof window > "u") return;
|
|
6
|
+
const n = document.body, c = window.innerWidth - n.clientWidth;
|
|
7
|
+
t === null && (t = n.style.overflow, e = n.style.paddingRight, l = n.style.touchAction), n.style.overflow = "hidden", n.style.paddingRight = `${c}px`, n.style.touchAction = "none", s();
|
|
8
|
+
}, r = () => {
|
|
9
|
+
if (!(typeof window > "u")) {
|
|
10
|
+
if (t !== null && e !== null && l !== null) {
|
|
11
|
+
const n = document.body;
|
|
12
|
+
n.style.overflow = t, n.style.paddingRight = e, n.style.touchAction = l, t = null, e = null;
|
|
13
|
+
}
|
|
14
|
+
u();
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
function d(n) {
|
|
18
|
+
n.preventDefault();
|
|
19
|
+
}
|
|
20
|
+
function s() {
|
|
21
|
+
document.addEventListener("touchmove", d, { passive: !1 }), document.addEventListener("wheel", d, { passive: !1 });
|
|
22
|
+
}
|
|
23
|
+
function u() {
|
|
24
|
+
document.removeEventListener("touchmove", d), document.removeEventListener("wheel", d);
|
|
25
|
+
}
|
|
26
|
+
return { lockScroll: o, unlockScroll: r };
|
|
27
|
+
}
|
|
28
|
+
const i = {
|
|
29
|
+
BASE: 1e3,
|
|
30
|
+
DROPDOWN: 1010,
|
|
31
|
+
STICKY: 1020,
|
|
32
|
+
DRAWER: 1030,
|
|
33
|
+
TOOLTIP: 1040,
|
|
34
|
+
POPOVER: 1050,
|
|
35
|
+
MODAL: 1060,
|
|
36
|
+
NOTIFICATION: 1070,
|
|
37
|
+
DEBUG: 9999
|
|
38
|
+
}, b = Symbol("z-index-context");
|
|
39
|
+
let a = i.BASE;
|
|
40
|
+
function A() {
|
|
41
|
+
const t = f(b, null);
|
|
42
|
+
return t || {
|
|
43
|
+
currentLayer: y(a),
|
|
44
|
+
getNextLayer: () => (a += 10, a)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const B = ["data-layer"], x = /* @__PURE__ */ p({
|
|
48
|
+
__name: "Portal",
|
|
49
|
+
props: {
|
|
50
|
+
layer: { default: "BASE" },
|
|
51
|
+
teleport: { type: Boolean, default: !0 },
|
|
52
|
+
target: { default: "body" },
|
|
53
|
+
zIndex: {},
|
|
54
|
+
show: { type: Boolean, default: !0 }
|
|
55
|
+
},
|
|
56
|
+
setup(t) {
|
|
57
|
+
const e = t, { getNextLayer: l } = A(), o = h(() => e.zIndex ? e.zIndex : e.layer && e.layer !== "BASE" ? i[e.layer] : l());
|
|
58
|
+
return (r, d) => r.show ? (g(), m(E, {
|
|
59
|
+
key: 0,
|
|
60
|
+
to: r.target,
|
|
61
|
+
disabled: !r.teleport
|
|
62
|
+
}, [
|
|
63
|
+
w("div", {
|
|
64
|
+
style: S({
|
|
65
|
+
zIndex: o.value,
|
|
66
|
+
position: "relative"
|
|
67
|
+
}),
|
|
68
|
+
"data-layer": r.layer
|
|
69
|
+
}, [
|
|
70
|
+
I(r.$slots, "default")
|
|
71
|
+
], 12, B)
|
|
72
|
+
], 8, ["to", "disabled"])) : v("", !0);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
function L() {
|
|
76
|
+
const t = /* @__PURE__ */ new Map();
|
|
77
|
+
return {
|
|
78
|
+
on(e, l) {
|
|
79
|
+
const o = t.get(e) || [];
|
|
80
|
+
o.push(l), t.set(e, o);
|
|
81
|
+
},
|
|
82
|
+
off(e, l) {
|
|
83
|
+
const o = t.get(e);
|
|
84
|
+
o && t.set(
|
|
85
|
+
e,
|
|
86
|
+
o.filter((r) => r !== l)
|
|
87
|
+
);
|
|
88
|
+
},
|
|
89
|
+
emit(e, l) {
|
|
90
|
+
const o = t.get(e);
|
|
91
|
+
o && o.forEach((r) => r(l));
|
|
92
|
+
},
|
|
93
|
+
clear() {
|
|
94
|
+
t.clear();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
L as E,
|
|
100
|
+
x as _,
|
|
101
|
+
N as u
|
|
102
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const d=require("vue");function y(){let t=null,e=null,l=null;const o=()=>{if(typeof window>"u")return;const n=document.body,f=window.innerWidth-n.clientWidth;t===null&&(t=n.style.overflow,e=n.style.paddingRight,l=n.style.touchAction),n.style.overflow="hidden",n.style.paddingRight=`${f}px`,n.style.touchAction="none",i()},r=()=>{if(!(typeof window>"u")){if(t!==null&&e!==null&&l!==null){const n=document.body;n.style.overflow=t,n.style.paddingRight=e,n.style.touchAction=l,t=null,e=null}a()}};function s(n){n.preventDefault()}function i(){document.addEventListener("touchmove",s,{passive:!1}),document.addEventListener("wheel",s,{passive:!1})}function a(){document.removeEventListener("touchmove",s),document.removeEventListener("wheel",s)}return{lockScroll:o,unlockScroll:r}}const c={BASE:1e3,DROPDOWN:1010,STICKY:1020,DRAWER:1030,TOOLTIP:1040,POPOVER:1050,MODAL:1060,NOTIFICATION:1070,DEBUG:9999},h=Symbol("z-index-context");let u=c.BASE;function p(){const t=d.inject(h,null);return t||{currentLayer:d.ref(u),getNextLayer:()=>(u+=10,u)}}const m=["data-layer"],v=d.defineComponent({__name:"Portal",props:{layer:{default:"BASE"},teleport:{type:Boolean,default:!0},target:{default:"body"},zIndex:{},show:{type:Boolean,default:!0}},setup(t){const e=t,{getNextLayer:l}=p(),o=d.computed(()=>e.zIndex?e.zIndex:e.layer&&e.layer!=="BASE"?c[e.layer]:l());return(r,s)=>r.show?(d.openBlock(),d.createBlock(d.Teleport,{key:0,to:r.target,disabled:!r.teleport},[d.createElementVNode("div",{style:d.normalizeStyle({zIndex:o.value,position:"relative"}),"data-layer":r.layer},[d.renderSlot(r.$slots,"default")],12,m)],8,["to","disabled"])):d.createCommentVNode("",!0)}});function g(){const t=new Map;return{on(e,l){const o=t.get(e)||[];o.push(l),t.set(e,o)},off(e,l){const o=t.get(e);o&&t.set(e,o.filter(r=>r!==l))},emit(e,l){const o=t.get(e);o&&o.forEach(r=>r(l))},clear(){t.clear()}}}exports.EventBus=g;exports._sfc_main=v;exports.useBodyScroll=y;
|