prlg-ui 1.8.13 → 1.8.15

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.
@@ -0,0 +1 @@
1
+ "use strict";const o=require("vue");function s(){let n=null,e=null;return{lockScroll:()=>{if(typeof window>"u")return;const t=document.body,i=window.innerWidth-t.clientWidth;n===null&&(n=t.style.overflow,e=t.style.paddingRight),t.style.overflow="hidden",t.style.paddingRight=`${i}px`},unlockScroll:()=>{if(!(typeof window>"u")&&n!==null&&e!==null){const t=document.body;t.style.overflow="auto",t.style.paddingRight="0",n=null,e=null}}}}const a={BASE:1e3,DROPDOWN:1010,STICKY:1020,DRAWER:1030,TOOLTIP:1040,POPOVER:1050,MODAL:1060,NOTIFICATION:1070,DEBUG:9999},c=Symbol("z-index-context");let d=a.BASE;function u(){const n=o.inject(c,null);return n||{currentLayer:o.ref(d),getNextLayer:()=>(d+=10,d)}}const f=["data-layer"],y=o.defineComponent({__name:"Portal",props:{layer:{default:"BASE"},teleport:{type:Boolean,default:!0},target:{default:"body"},zIndex:{}},setup(n){const e=n,{getNextLayer:r}=u(),l=o.computed(()=>e.zIndex?e.zIndex:e.layer&&e.layer!=="BASE"?a[e.layer]:r());return(t,i)=>(o.openBlock(),o.createBlock(o.Teleport,{to:t.target,disabled:!t.teleport},[o.createElementVNode("div",{style:o.normalizeStyle({zIndex:l.value,position:"relative"}),"data-layer":t.layer},[o.renderSlot(t.$slots,"default")],12,f)],8,["to","disabled"]))}});function p(){const n=new Map;return{on(e,r){const l=n.get(e)||[];l.push(r),n.set(e,l)},off(e,r){const l=n.get(e);l&&n.set(e,l.filter(t=>t!==r))},emit(e,r){const l=n.get(e);l&&l.forEach(t=>t(r))},clear(){n.clear()}}}exports.EventBus=p;exports._sfc_main=y;exports.useBodyScroll=s;
@@ -0,0 +1,87 @@
1
+ import { inject as i, ref as s, defineComponent as c, computed as u, createBlock as f, openBlock as y, Teleport as p, createElementVNode as g, normalizeStyle as h, renderSlot as E } from "vue";
2
+ function O() {
3
+ let n = null, e = null;
4
+ return { lockScroll: () => {
5
+ if (typeof window > "u") return;
6
+ const t = document.body, d = window.innerWidth - t.clientWidth;
7
+ n === null && (n = t.style.overflow, e = t.style.paddingRight), t.style.overflow = "hidden", t.style.paddingRight = `${d}px`;
8
+ }, unlockScroll: () => {
9
+ if (!(typeof window > "u") && n !== null && e !== null) {
10
+ const t = document.body;
11
+ t.style.overflow = "auto", t.style.paddingRight = "0", n = null, e = null;
12
+ }
13
+ } };
14
+ }
15
+ const a = {
16
+ BASE: 1e3,
17
+ DROPDOWN: 1010,
18
+ STICKY: 1020,
19
+ DRAWER: 1030,
20
+ TOOLTIP: 1040,
21
+ POPOVER: 1050,
22
+ MODAL: 1060,
23
+ NOTIFICATION: 1070,
24
+ DEBUG: 9999
25
+ }, m = Symbol("z-index-context");
26
+ let r = a.BASE;
27
+ function I() {
28
+ const n = i(m, null);
29
+ return n || {
30
+ currentLayer: s(r),
31
+ getNextLayer: () => (r += 10, r)
32
+ };
33
+ }
34
+ const S = ["data-layer"], b = /* @__PURE__ */ c({
35
+ __name: "Portal",
36
+ props: {
37
+ layer: { default: "BASE" },
38
+ teleport: { type: Boolean, default: !0 },
39
+ target: { default: "body" },
40
+ zIndex: {}
41
+ },
42
+ setup(n) {
43
+ const e = n, { getNextLayer: o } = I(), l = u(() => e.zIndex ? e.zIndex : e.layer && e.layer !== "BASE" ? a[e.layer] : o());
44
+ return (t, d) => (y(), f(p, {
45
+ to: t.target,
46
+ disabled: !t.teleport
47
+ }, [
48
+ g("div", {
49
+ style: h({
50
+ zIndex: l.value,
51
+ position: "relative"
52
+ }),
53
+ "data-layer": t.layer
54
+ }, [
55
+ E(t.$slots, "default")
56
+ ], 12, S)
57
+ ], 8, ["to", "disabled"]));
58
+ }
59
+ });
60
+ function x() {
61
+ const n = /* @__PURE__ */ new Map();
62
+ return {
63
+ on(e, o) {
64
+ const l = n.get(e) || [];
65
+ l.push(o), n.set(e, l);
66
+ },
67
+ off(e, o) {
68
+ const l = n.get(e);
69
+ l && n.set(
70
+ e,
71
+ l.filter((t) => t !== o)
72
+ );
73
+ },
74
+ emit(e, o) {
75
+ const l = n.get(e);
76
+ l && l.forEach((t) => t(o));
77
+ },
78
+ clear() {
79
+ n.clear();
80
+ }
81
+ };
82
+ }
83
+ export {
84
+ x as E,
85
+ b as _,
86
+ O as u
87
+ };
package/dist/index.d.ts CHANGED
@@ -76,7 +76,10 @@ default: undefined;
76
76
  };
77
77
  zIndex: {
78
78
  type: NumberConstructor;
79
- default: number;
79
+ };
80
+ zIndexLayer: {
81
+ type: PropType<ZIndexLayer>;
82
+ default: string;
80
83
  };
81
84
  withoutStyle: {
82
85
  type: BooleanConstructor;
@@ -113,7 +116,10 @@ default: undefined;
113
116
  };
114
117
  zIndex: {
115
118
  type: NumberConstructor;
116
- default: number;
119
+ };
120
+ zIndexLayer: {
121
+ type: PropType<ZIndexLayer>;
122
+ default: string;
117
123
  };
118
124
  withoutStyle: {
119
125
  type: BooleanConstructor;
@@ -126,7 +132,7 @@ modelValue: boolean;
126
132
  placement: Placement;
127
133
  arrowVisible: boolean;
128
134
  closeMode: PopoverCloseMode;
129
- zIndex: number;
135
+ zIndexLayer: "BASE" | "DROPDOWN" | "STICKY" | "DRAWER" | "TOOLTIP" | "POPOVER" | "MODAL" | "NOTIFICATION" | "DEBUG";
130
136
  withoutStyle: boolean;
131
137
  }, {}, {}, {}, string, ComponentProvideOptions, true, {
132
138
  reference: HTMLDivElement;
@@ -380,6 +386,7 @@ declare type __VLS_Props_26 = {
380
386
  style?: CSSProperties;
381
387
  position?: 'top' | 'center' | 'bottom';
382
388
  zIndex?: number;
389
+ zIndexLayer?: ZIndexLayer;
383
390
  };
384
391
 
385
392
  declare type __VLS_Props_27 = {
@@ -1159,6 +1166,7 @@ declare type DrawerProps = {
1159
1166
  beforeClose?: (next: () => void) => void;
1160
1167
  wrapperNoStyle?: boolean;
1161
1168
  zIndex?: number;
1169
+ zIndexLayer?: ZIndexLayer;
1162
1170
  };
1163
1171
 
1164
1172
  export declare const Dropdown: DefineComponent<DropdownProps>;
@@ -1742,6 +1750,15 @@ declare interface ToastProps {
1742
1750
  * @type {ToastMessageOptions}
1743
1751
  */
1744
1752
  message?: ToastMessageOptions;
1753
+ /**
1754
+ * Custom z-index value for the toast container.
1755
+ */
1756
+ zIndex?: number;
1757
+ /**
1758
+ * Z-index layer for the toast component.
1759
+ * @defaultValue NOTIFICATION
1760
+ */
1761
+ zIndexLayer?: ZIndexLayer;
1745
1762
  }
1746
1763
 
1747
1764
  export declare const ToastService: {
@@ -1812,6 +1829,20 @@ export declare const useConfirmPopup: () => ConfirmPopupService;
1812
1829
 
1813
1830
  export declare function useToast(): ToastServiceMethods;
1814
1831
 
1832
+ declare const Z_INDEX: {
1833
+ readonly BASE: 1000;
1834
+ readonly DROPDOWN: 1010;
1835
+ readonly STICKY: 1020;
1836
+ readonly DRAWER: 1030;
1837
+ readonly TOOLTIP: 1040;
1838
+ readonly POPOVER: 1050;
1839
+ readonly MODAL: 1060;
1840
+ readonly NOTIFICATION: 1070;
1841
+ readonly DEBUG: 9999;
1842
+ };
1843
+
1844
+ declare type ZIndexLayer = keyof typeof Z_INDEX;
1845
+
1815
1846
  export { }
1816
1847
 
1817
1848