prlg-ui 1.8.51 → 1.8.53
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-CsQRGodc.cjs +1 -0
- package/dist/{eventBus.util-SHeL5Xdk.js → eventBus.util-DeGiEiyP.js} +5 -5
- 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 +1 -2
- package/package.json +1 -1
- package/dist/eventBus.util-DiVNAdhW.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("vue");class m{scrollY=0;lockCount=0;preventTouch=e=>{const t=e.target.closest(".modal-scrollable, .scrollable");if(!t){e.preventDefault();return}const{scrollTop:o,scrollHeight:s,clientHeight:c}=t;if(!(s>c)){e.preventDefault();return}const y=e.startY||e.touches[0].clientY,f=e.touches[0].clientY,u=y-f;(o<=0&&u<0||o>=s-c&&u>0)&&e.preventDefault()};preventWheel=e=>{const t=e.target.closest(".modal-scrollable, .scrollable");if(!t){e.preventDefault();return}const{scrollTop:o,scrollHeight:s,clientHeight:c}=t;if(!(s>=c)){e.preventDefault();return}(o<=0&&e.deltaY<0||o>=s-c&&e.deltaY>0)&&e.preventDefault()};handleTouchStart=e=>{e.startY=e.touches[0].clientY};preventKeys=e=>{[32,33,34,35,36,37,38,39,40].includes(e.keyCode)&&(e.target.closest(".modal-scrollable, .scrollable")||e.preventDefault())};lock(){if(this.lockCount++,this.lockCount===1){this.scrollY=window.scrollY,document.body.style.position="fixed",document.body.style.top=`-${this.scrollY}px`,document.body.style.left="0",document.body.style.right="0",document.body.style.width="100%",document.body.style.overflow="hidden";const e={passive:!1};document.addEventListener("touchstart",this.handleTouchStart,e),document.addEventListener("touchmove",this.preventTouch,e),document.addEventListener("wheel",this.preventWheel,e),document.addEventListener("keydown",this.preventKeys)}}unlock(){if(this.lockCount>0&&this.lockCount--,this.lockCount===0){document.body.style.position="",document.body.style.top="",document.body.style.left="",document.body.style.right="",document.body.style.width="",document.body.style.overflow="",window.scrollTo(0,this.scrollY);const e={passive:!1};document.removeEventListener("touchstart",this.handleTouchStart,e),document.removeEventListener("touchmove",this.preventTouch,e),document.removeEventListener("wheel",this.preventWheel,e),document.removeEventListener("keydown",this.preventKeys)}}forceUnlock(){this.lockCount=0,this.unlock()}isLocked(){return this.lockCount>0}getLockCount(){return this.lockCount}}const i=new m,p=()=>({unlockScroll:()=>i.unlock(),lockScroll:()=>i.lock()}),d={BASE:1e3,DROPDOWN:1010,STICKY:1020,DRAWER:1030,TOOLTIP:1040,POPOVER:1050,MODAL:1060,NOTIFICATION:1070,DEBUG:9999},v=Symbol("z-index-context");let a=d.BASE;function b(){const l=n.inject(v,null);return l||{currentLayer:n.ref(a),getNextLayer:()=>(a+=10,a)}}const k=["data-layer"],g=n.defineComponent({__name:"Portal",props:{layer:{default:"BASE"},teleport:{type:Boolean,default:!0},target:{default:"body"},zIndex:{},show:{type:Boolean,default:!0}},setup(l){const e=l,{getNextLayer:r}=b(),t=n.computed(()=>e.zIndex?e.zIndex:e.layer&&e.layer!=="BASE"?d[e.layer]:r());return(o,s)=>o.show?(n.openBlock(),n.createBlock(n.Teleport,{key:0,to:o.target,disabled:!o.teleport},[n.createElementVNode("div",{style:n.normalizeStyle({zIndex:t.value,position:"relative"}),"data-layer":o.layer},[n.renderSlot(o.$slots,"default")],12,k)],8,["to","disabled"])):n.createCommentVNode("",!0)}});function E(){const l=new Map;return{on(e,r){const t=l.get(e)||[];t.push(r),l.set(e,t)},off(e,r){const t=l.get(e);t&&l.set(e,t.filter(o=>o!==r))},emit(e,r){const t=l.get(e);t&&t.forEach(o=>o(r))},clear(){l.clear()}}}exports.EventBus=E;exports._sfc_main=g;exports.useBodyScroll=p;
|
|
@@ -24,7 +24,7 @@ class T {
|
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
const { scrollTop: o, scrollHeight: r, clientHeight: s } = t;
|
|
27
|
-
if (!(r
|
|
27
|
+
if (!(r >= s)) {
|
|
28
28
|
e.preventDefault();
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
@@ -38,7 +38,7 @@ class T {
|
|
|
38
38
|
};
|
|
39
39
|
lock() {
|
|
40
40
|
if (this.lockCount++, this.lockCount === 1) {
|
|
41
|
-
|
|
41
|
+
this.scrollY = window.scrollY, document.body.style.position = "fixed", document.body.style.top = `-${this.scrollY}px`, document.body.style.left = "0", document.body.style.right = "0", document.body.style.width = "100%", document.body.style.overflow = "hidden";
|
|
42
42
|
const e = { passive: !1 };
|
|
43
43
|
document.addEventListener("touchstart", this.handleTouchStart, e), document.addEventListener("touchmove", this.preventTouch, e), document.addEventListener("wheel", this.preventWheel, e), document.addEventListener("keydown", this.preventKeys);
|
|
44
44
|
}
|
|
@@ -66,7 +66,7 @@ class T {
|
|
|
66
66
|
const u = new T(), B = () => ({
|
|
67
67
|
unlockScroll: () => u.unlock(),
|
|
68
68
|
lockScroll: () => u.lock()
|
|
69
|
-
}),
|
|
69
|
+
}), d = {
|
|
70
70
|
BASE: 1e3,
|
|
71
71
|
DROPDOWN: 1010,
|
|
72
72
|
STICKY: 1020,
|
|
@@ -77,7 +77,7 @@ const u = new T(), B = () => ({
|
|
|
77
77
|
NOTIFICATION: 1070,
|
|
78
78
|
DEBUG: 9999
|
|
79
79
|
}, w = Symbol("z-index-context");
|
|
80
|
-
let c =
|
|
80
|
+
let c = d.BASE;
|
|
81
81
|
function D() {
|
|
82
82
|
const l = f(w, null);
|
|
83
83
|
return l || {
|
|
@@ -95,7 +95,7 @@ const Y = ["data-layer"], x = /* @__PURE__ */ p({
|
|
|
95
95
|
show: { type: Boolean, default: !0 }
|
|
96
96
|
},
|
|
97
97
|
setup(l) {
|
|
98
|
-
const e = l, { getNextLayer: n } = D(), t = v(() => e.zIndex ? e.zIndex : e.layer && e.layer !== "BASE" ?
|
|
98
|
+
const e = l, { getNextLayer: n } = D(), t = v(() => e.zIndex ? e.zIndex : e.layer && e.layer !== "BASE" ? d[e.layer] : n());
|
|
99
99
|
return (o, r) => o.show ? (g(), b(E, {
|
|
100
100
|
key: 0,
|
|
101
101
|
to: o.target,
|