@v-c/util 0.0.12 → 0.0.14
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/Children/isFragment.cjs +5 -1
- package/dist/Children/isFragment.js +4 -6
- package/dist/Children/toArray.cjs +13 -1
- package/dist/Children/toArray.js +12 -10
- package/dist/Dom/addEventListener.cjs +8 -1
- package/dist/Dom/addEventListener.js +7 -10
- package/dist/Dom/canUseDom.cjs +5 -1
- package/dist/Dom/canUseDom.js +3 -5
- package/dist/Dom/class.cjs +15 -1
- package/dist/Dom/class.js +10 -16
- package/dist/Dom/contains.cjs +12 -1
- package/dist/Dom/contains.js +10 -15
- package/dist/Dom/css.cjs +81 -1
- package/dist/Dom/css.js +63 -64
- package/dist/Dom/dynamicCSS.cjs +83 -1
- package/dist/Dom/dynamicCSS.js +70 -67
- package/dist/Dom/findDOMNode.cjs +13 -1
- package/dist/Dom/findDOMNode.js +9 -10
- package/dist/Dom/focus.cjs +53 -1
- package/dist/Dom/focus.js +43 -34
- package/dist/Dom/isVisible.cjs +17 -1
- package/dist/Dom/isVisible.js +15 -21
- package/dist/Dom/scrollLocker.cjs +67 -1
- package/dist/Dom/scrollLocker.js +65 -63
- package/dist/Dom/shadow.cjs +11 -1
- package/dist/Dom/shadow.js +7 -10
- package/dist/Dom/styleChecker.cjs +21 -1
- package/dist/Dom/styleChecker.js +18 -17
- package/dist/Dom/support.cjs +20 -1
- package/dist/Dom/support.js +17 -22
- package/dist/EventInterface.cjs +0 -1
- package/dist/EventInterface.js +0 -1
- package/dist/KeyCode.cjs +166 -1
- package/dist/KeyCode.js +164 -515
- package/dist/Portal.cjs +42 -1
- package/dist/Portal.js +38 -31
- package/dist/PortalWrapper.cjs +135 -1
- package/dist/PortalWrapper.js +130 -113
- package/dist/classnames.cjs +37 -1
- package/dist/classnames.js +33 -30
- package/dist/composeProps.cjs +17 -1
- package/dist/composeProps.js +15 -12
- package/dist/createRef.cjs +22 -1
- package/dist/createRef.js +16 -18
- package/dist/debug/diff.cjs +44 -1
- package/dist/debug/diff.js +41 -39
- package/dist/deprecated.cjs +5 -1
- package/dist/deprecated.js +3 -7
- package/dist/getScrollBarSize.cjs +47 -1
- package/dist/getScrollBarSize.js +42 -34
- package/dist/guid.cjs +6 -1
- package/dist/guid.js +4 -6
- package/dist/hooks/useEvent.cjs +5 -1
- package/dist/hooks/useEvent.js +3 -5
- package/dist/hooks/useId.cjs +13 -1
- package/dist/hooks/useId.js +10 -10
- package/dist/hooks/useLayoutEffect.cjs +35 -1
- package/dist/hooks/useLayoutEffect.js +32 -26
- package/dist/hooks/useMemo.cjs +12 -1
- package/dist/hooks/useMemo.js +10 -9
- package/dist/hooks/useMergedState.cjs +25 -1
- package/dist/hooks/useMergedState.js +23 -20
- package/dist/hooks/useMobile.cjs +16 -1
- package/dist/hooks/useMobile.js +13 -13
- package/dist/hooks/useState.cjs +10 -1
- package/dist/hooks/useState.js +8 -10
- package/dist/index.cjs +9 -1
- package/dist/index.js +5 -11
- package/dist/isEqual.cjs +28 -1
- package/dist/isEqual.js +26 -31
- package/dist/isMobile.cjs +7 -1
- package/dist/isMobile.js +5 -12
- package/dist/isValid.cjs +6 -1
- package/dist/isValid.js +4 -5
- package/dist/omit.cjs +9 -1
- package/dist/omit.js +7 -8
- package/dist/pickAttrs.cjs +25 -3
- package/dist/pickAttrs.js +22 -24
- package/dist/props-util/index.cjs +52 -1
- package/dist/props-util/index.js +42 -34
- package/dist/raf.cjs +45 -1
- package/dist/raf.js +39 -33
- package/dist/setStyle.cjs +16 -1
- package/dist/setStyle.js +14 -12
- package/dist/switchScrollingEffect.cjs +32 -1
- package/dist/switchScrollingEffect.js +29 -29
- package/dist/test/domHook.cjs +38 -1
- package/dist/test/domHook.js +35 -35
- package/dist/type.cjs +70 -1
- package/dist/type.d.ts +1 -1
- package/dist/type.js +59 -49
- package/dist/utils/checkSlotProp.cjs +9 -1
- package/dist/utils/checkSlotProp.js +8 -5
- package/dist/utils/get.cjs +10 -1
- package/dist/utils/get.js +8 -11
- package/dist/utils/omit.cjs +8 -1
- package/dist/utils/omit.js +7 -8
- package/dist/utils/set.cjs +50 -1
- package/dist/utils/set.js +42 -37
- package/dist/utils/transition.cjs +92 -1
- package/dist/utils/transition.js +83 -86
- package/dist/utils/watchState.cjs +18 -1
- package/dist/utils/watchState.js +15 -13
- package/dist/vnode.cjs +48 -1
- package/dist/vnode.js +38 -34
- package/dist/vueuse/unref-element.cjs +6 -1
- package/dist/vueuse/unref-element.js +5 -7
- package/dist/warning.cjs +45 -1
- package/dist/warning.js +30 -41
- package/package.json +1 -1
package/dist/Portal.cjs
CHANGED
|
@@ -1 +1,42 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
const require_canUseDom = require("./Dom/canUseDom.cjs");
|
|
3
|
+
let vue = require("vue");
|
|
4
|
+
var Portal = /* @__PURE__ */ (0, vue.defineComponent)((props, ctx) => {
|
|
5
|
+
const parentRef = (0, vue.shallowRef)();
|
|
6
|
+
const containerRef = (0, vue.shallowRef)();
|
|
7
|
+
const initRef = (0, vue.shallowRef)(false);
|
|
8
|
+
if (!initRef.value && require_canUseDom.default()) {
|
|
9
|
+
containerRef.value = props.getContainer();
|
|
10
|
+
parentRef.value = containerRef.value?.parentNode;
|
|
11
|
+
initRef.value = true;
|
|
12
|
+
}
|
|
13
|
+
(0, vue.onMounted)(() => {
|
|
14
|
+
if (containerRef.value?.parentNode === null && parentRef.value !== null) parentRef.value.appendChild(containerRef.value);
|
|
15
|
+
});
|
|
16
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
17
|
+
props.didUpdate?.(props);
|
|
18
|
+
});
|
|
19
|
+
(0, vue.onUnmounted)(() => {
|
|
20
|
+
containerRef.value?.parentNode?.removeChild?.(containerRef.value);
|
|
21
|
+
});
|
|
22
|
+
return () => {
|
|
23
|
+
if (containerRef.value) return (0, vue.createVNode)(vue.Teleport, { "to": containerRef.value }, { default: () => [ctx.slots.default?.()] });
|
|
24
|
+
return null;
|
|
25
|
+
};
|
|
26
|
+
}, {
|
|
27
|
+
props: {
|
|
28
|
+
didUpdate: {
|
|
29
|
+
type: Function,
|
|
30
|
+
required: false,
|
|
31
|
+
default: void 0
|
|
32
|
+
},
|
|
33
|
+
getContainer: {
|
|
34
|
+
type: Function,
|
|
35
|
+
required: true,
|
|
36
|
+
default: void 0
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
inheritAttrs: false
|
|
40
|
+
});
|
|
41
|
+
var Portal_default = Portal;
|
|
42
|
+
exports.default = Portal_default;
|
package/dist/Portal.js
CHANGED
|
@@ -1,33 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import canUseDom from "./Dom/canUseDom.js";
|
|
2
|
+
import { Teleport, createVNode, defineComponent, onBeforeUnmount, onMounted, onUnmounted, shallowRef } from "vue";
|
|
3
|
+
var Portal_default = /* @__PURE__ */ defineComponent((props, ctx) => {
|
|
4
|
+
const parentRef = shallowRef();
|
|
5
|
+
const containerRef = shallowRef();
|
|
6
|
+
const initRef = shallowRef(false);
|
|
7
|
+
if (!initRef.value && canUseDom()) {
|
|
8
|
+
containerRef.value = props.getContainer();
|
|
9
|
+
parentRef.value = containerRef.value?.parentNode;
|
|
10
|
+
initRef.value = true;
|
|
11
|
+
}
|
|
12
|
+
onMounted(() => {
|
|
13
|
+
if (containerRef.value?.parentNode === null && parentRef.value !== null) parentRef.value.appendChild(containerRef.value);
|
|
14
|
+
});
|
|
15
|
+
onBeforeUnmount(() => {
|
|
16
|
+
props.didUpdate?.(props);
|
|
17
|
+
});
|
|
18
|
+
onUnmounted(() => {
|
|
19
|
+
containerRef.value?.parentNode?.removeChild?.(containerRef.value);
|
|
20
|
+
});
|
|
21
|
+
return () => {
|
|
22
|
+
if (containerRef.value) return createVNode(Teleport, { "to": containerRef.value }, { default: () => [ctx.slots.default?.()] });
|
|
23
|
+
return null;
|
|
24
|
+
};
|
|
16
25
|
}, {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
props: {
|
|
27
|
+
didUpdate: {
|
|
28
|
+
type: Function,
|
|
29
|
+
required: false,
|
|
30
|
+
default: void 0
|
|
31
|
+
},
|
|
32
|
+
getContainer: {
|
|
33
|
+
type: Function,
|
|
34
|
+
required: true,
|
|
35
|
+
default: void 0
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
inheritAttrs: false
|
|
30
39
|
});
|
|
31
|
-
export {
|
|
32
|
-
m as default
|
|
33
|
-
};
|
|
40
|
+
export { Portal_default as default };
|
package/dist/PortalWrapper.cjs
CHANGED
|
@@ -1 +1,135 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
const require_canUseDom = require("./Dom/canUseDom.cjs");
|
|
3
|
+
const require_Portal = require("./Portal.cjs");
|
|
4
|
+
const require_setStyle = require("./setStyle.cjs");
|
|
5
|
+
const require_scrollLocker = require("./Dom/scrollLocker.cjs");
|
|
6
|
+
const require_raf = require("./raf.cjs");
|
|
7
|
+
let vue = require("vue");
|
|
8
|
+
var openCount = 0;
|
|
9
|
+
var supportDom = require_canUseDom.default();
|
|
10
|
+
function getOpenCount() {
|
|
11
|
+
return process.env.NODE_ENV === "test" ? openCount : 0;
|
|
12
|
+
}
|
|
13
|
+
var cacheOverflow = {};
|
|
14
|
+
function getParent(getContainer) {
|
|
15
|
+
if (!supportDom) return null;
|
|
16
|
+
if (getContainer) {
|
|
17
|
+
if (typeof getContainer === "string") return document.querySelectorAll(getContainer)[0];
|
|
18
|
+
if (typeof getContainer === "function") return getContainer();
|
|
19
|
+
if (typeof getContainer === "object" && getContainer instanceof window.HTMLElement) return getContainer;
|
|
20
|
+
}
|
|
21
|
+
return document.body;
|
|
22
|
+
}
|
|
23
|
+
var PortalWrapper = /* @__PURE__ */ (0, vue.defineComponent)((props, ctx) => {
|
|
24
|
+
const container = (0, vue.shallowRef)();
|
|
25
|
+
const componentRef = (0, vue.shallowRef)();
|
|
26
|
+
const rafId = (0, vue.shallowRef)();
|
|
27
|
+
const scrollLocker = (0, vue.shallowRef)();
|
|
28
|
+
const removeCurrentContainer = () => {
|
|
29
|
+
container.value?.parentNode?.removeChild(container.value);
|
|
30
|
+
};
|
|
31
|
+
const updateOpenCount = (prevProps) => {
|
|
32
|
+
const { visible: prevVisible, getContainer: prevGetContainer } = prevProps || {};
|
|
33
|
+
const { visible, getContainer: getContainer$1 } = props;
|
|
34
|
+
if (visible !== prevVisible && supportDom && getParent(getContainer$1) === document.body) {
|
|
35
|
+
if (visible && !prevVisible) openCount += 1;
|
|
36
|
+
else if (prevProps) openCount -= 1;
|
|
37
|
+
}
|
|
38
|
+
if (typeof getContainer$1 === "function" && typeof prevGetContainer === "function" ? getContainer$1.toString() !== prevGetContainer.toString() : getContainer$1 !== prevGetContainer) removeCurrentContainer();
|
|
39
|
+
};
|
|
40
|
+
const attachToParent = (force = false) => {
|
|
41
|
+
if (force || container.value && !container.value.parentNode) {
|
|
42
|
+
const parent = getParent(props.getContainer);
|
|
43
|
+
if (parent) {
|
|
44
|
+
parent.appendChild(container.value);
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
};
|
|
51
|
+
const setWrapperClassName = () => {
|
|
52
|
+
const { wrapperClassName } = props;
|
|
53
|
+
if (container.value && wrapperClassName && wrapperClassName !== container.value.className) container.value.className = wrapperClassName;
|
|
54
|
+
};
|
|
55
|
+
const getContainer = () => {
|
|
56
|
+
if (!supportDom) return null;
|
|
57
|
+
if (!container.value) {
|
|
58
|
+
container.value = document.createElement("div");
|
|
59
|
+
attachToParent(true);
|
|
60
|
+
}
|
|
61
|
+
setWrapperClassName();
|
|
62
|
+
return container.value;
|
|
63
|
+
};
|
|
64
|
+
(0, vue.onMounted)(() => {
|
|
65
|
+
scrollLocker.value = new require_scrollLocker.default({ container: getParent(props.getContainer) });
|
|
66
|
+
updateOpenCount();
|
|
67
|
+
if (!attachToParent()) rafId.value = require_raf.default(() => {});
|
|
68
|
+
});
|
|
69
|
+
(0, vue.onUpdated)(() => {
|
|
70
|
+
updateOpenCount(props);
|
|
71
|
+
updateOpenCount(props);
|
|
72
|
+
setWrapperClassName();
|
|
73
|
+
attachToParent();
|
|
74
|
+
});
|
|
75
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
76
|
+
const { visible, getContainer: getContainer$1 } = props;
|
|
77
|
+
if (supportDom && getParent(getContainer$1) === document.body) openCount = visible && openCount ? openCount - 1 : openCount;
|
|
78
|
+
removeCurrentContainer();
|
|
79
|
+
require_raf.default.cancel(rafId.value);
|
|
80
|
+
});
|
|
81
|
+
const switchScrollingEffect = () => {
|
|
82
|
+
if (openCount === 1 && !Object.keys(cacheOverflow).length) {
|
|
83
|
+
switchScrollingEffect();
|
|
84
|
+
cacheOverflow = require_setStyle.default({
|
|
85
|
+
overflow: "hidden",
|
|
86
|
+
overflowX: "hidden",
|
|
87
|
+
overflowY: "hidden"
|
|
88
|
+
});
|
|
89
|
+
} else if (!openCount) {
|
|
90
|
+
require_setStyle.default(cacheOverflow);
|
|
91
|
+
cacheOverflow = {};
|
|
92
|
+
switchScrollingEffect();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return () => {
|
|
96
|
+
const { forceRender, visible } = props;
|
|
97
|
+
let portal = null;
|
|
98
|
+
const childProps = {
|
|
99
|
+
getOpenCount,
|
|
100
|
+
getContainer,
|
|
101
|
+
switchScrollingEffect,
|
|
102
|
+
scrollLocker: scrollLocker.value
|
|
103
|
+
};
|
|
104
|
+
if (forceRender || visible || componentRef.value) portal = (0, vue.createVNode)(require_Portal.default, {
|
|
105
|
+
"getContainer": getContainer,
|
|
106
|
+
"ref": componentRef
|
|
107
|
+
}, { default: () => [ctx?.slots?.default(childProps)] });
|
|
108
|
+
return portal;
|
|
109
|
+
};
|
|
110
|
+
}, { props: {
|
|
111
|
+
visible: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
required: false,
|
|
114
|
+
default: void 0
|
|
115
|
+
},
|
|
116
|
+
getContainer: {
|
|
117
|
+
type: [String, Function],
|
|
118
|
+
required: false,
|
|
119
|
+
skipCheck: true,
|
|
120
|
+
default: void 0
|
|
121
|
+
},
|
|
122
|
+
wrapperClassName: {
|
|
123
|
+
type: String,
|
|
124
|
+
required: false,
|
|
125
|
+
default: void 0
|
|
126
|
+
},
|
|
127
|
+
forceRender: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
required: false,
|
|
130
|
+
default: void 0
|
|
131
|
+
}
|
|
132
|
+
} });
|
|
133
|
+
var PortalWrapper_default = PortalWrapper;
|
|
134
|
+
exports.default = PortalWrapper_default;
|
|
135
|
+
exports.getOpenCount = getOpenCount;
|
package/dist/PortalWrapper.js
CHANGED
|
@@ -1,115 +1,132 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
1
|
+
import canUseDom from "./Dom/canUseDom.js";
|
|
2
|
+
import Portal_default from "./Portal.js";
|
|
3
|
+
import setStyle_default from "./setStyle.js";
|
|
4
|
+
import ScrollLocker from "./Dom/scrollLocker.js";
|
|
5
|
+
import raf_default from "./raf.js";
|
|
6
|
+
import { createVNode, defineComponent, onBeforeUnmount, onMounted, onUpdated, shallowRef } from "vue";
|
|
7
|
+
var openCount = 0;
|
|
8
|
+
var supportDom = canUseDom();
|
|
9
|
+
function getOpenCount() {
|
|
10
|
+
return process.env.NODE_ENV === "test" ? openCount : 0;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return document.body;
|
|
12
|
+
var cacheOverflow = {};
|
|
13
|
+
function getParent(getContainer) {
|
|
14
|
+
if (!supportDom) return null;
|
|
15
|
+
if (getContainer) {
|
|
16
|
+
if (typeof getContainer === "string") return document.querySelectorAll(getContainer)[0];
|
|
17
|
+
if (typeof getContainer === "function") return getContainer();
|
|
18
|
+
if (typeof getContainer === "object" && getContainer instanceof window.HTMLElement) return getContainer;
|
|
19
|
+
}
|
|
20
|
+
return document.body;
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
22
|
+
var PortalWrapper_default = /* @__PURE__ */ defineComponent((props, ctx) => {
|
|
23
|
+
const container = shallowRef();
|
|
24
|
+
const componentRef = shallowRef();
|
|
25
|
+
const rafId = shallowRef();
|
|
26
|
+
const scrollLocker = shallowRef();
|
|
27
|
+
const removeCurrentContainer = () => {
|
|
28
|
+
container.value?.parentNode?.removeChild(container.value);
|
|
29
|
+
};
|
|
30
|
+
const updateOpenCount = (prevProps) => {
|
|
31
|
+
const { visible: prevVisible, getContainer: prevGetContainer } = prevProps || {};
|
|
32
|
+
const { visible, getContainer: getContainer$1 } = props;
|
|
33
|
+
if (visible !== prevVisible && supportDom && getParent(getContainer$1) === document.body) {
|
|
34
|
+
if (visible && !prevVisible) openCount += 1;
|
|
35
|
+
else if (prevProps) openCount -= 1;
|
|
36
|
+
}
|
|
37
|
+
if (typeof getContainer$1 === "function" && typeof prevGetContainer === "function" ? getContainer$1.toString() !== prevGetContainer.toString() : getContainer$1 !== prevGetContainer) removeCurrentContainer();
|
|
38
|
+
};
|
|
39
|
+
const attachToParent = (force = false) => {
|
|
40
|
+
if (force || container.value && !container.value.parentNode) {
|
|
41
|
+
const parent = getParent(props.getContainer);
|
|
42
|
+
if (parent) {
|
|
43
|
+
parent.appendChild(container.value);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
};
|
|
50
|
+
const setWrapperClassName = () => {
|
|
51
|
+
const { wrapperClassName } = props;
|
|
52
|
+
if (container.value && wrapperClassName && wrapperClassName !== container.value.className) container.value.className = wrapperClassName;
|
|
53
|
+
};
|
|
54
|
+
const getContainer = () => {
|
|
55
|
+
if (!supportDom) return null;
|
|
56
|
+
if (!container.value) {
|
|
57
|
+
container.value = document.createElement("div");
|
|
58
|
+
attachToParent(true);
|
|
59
|
+
}
|
|
60
|
+
setWrapperClassName();
|
|
61
|
+
return container.value;
|
|
62
|
+
};
|
|
63
|
+
onMounted(() => {
|
|
64
|
+
scrollLocker.value = new ScrollLocker({ container: getParent(props.getContainer) });
|
|
65
|
+
updateOpenCount();
|
|
66
|
+
if (!attachToParent()) rafId.value = raf_default(() => {});
|
|
67
|
+
});
|
|
68
|
+
onUpdated(() => {
|
|
69
|
+
updateOpenCount(props);
|
|
70
|
+
updateOpenCount(props);
|
|
71
|
+
setWrapperClassName();
|
|
72
|
+
attachToParent();
|
|
73
|
+
});
|
|
74
|
+
onBeforeUnmount(() => {
|
|
75
|
+
const { visible, getContainer: getContainer$1 } = props;
|
|
76
|
+
if (supportDom && getParent(getContainer$1) === document.body) openCount = visible && openCount ? openCount - 1 : openCount;
|
|
77
|
+
removeCurrentContainer();
|
|
78
|
+
raf_default.cancel(rafId.value);
|
|
79
|
+
});
|
|
80
|
+
const switchScrollingEffect = () => {
|
|
81
|
+
if (openCount === 1 && !Object.keys(cacheOverflow).length) {
|
|
82
|
+
switchScrollingEffect();
|
|
83
|
+
cacheOverflow = setStyle_default({
|
|
84
|
+
overflow: "hidden",
|
|
85
|
+
overflowX: "hidden",
|
|
86
|
+
overflowY: "hidden"
|
|
87
|
+
});
|
|
88
|
+
} else if (!openCount) {
|
|
89
|
+
setStyle_default(cacheOverflow);
|
|
90
|
+
cacheOverflow = {};
|
|
91
|
+
switchScrollingEffect();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
return () => {
|
|
95
|
+
const { forceRender, visible } = props;
|
|
96
|
+
let portal = null;
|
|
97
|
+
const childProps = {
|
|
98
|
+
getOpenCount,
|
|
99
|
+
getContainer,
|
|
100
|
+
switchScrollingEffect,
|
|
101
|
+
scrollLocker: scrollLocker.value
|
|
102
|
+
};
|
|
103
|
+
if (forceRender || visible || componentRef.value) portal = createVNode(Portal_default, {
|
|
104
|
+
"getContainer": getContainer,
|
|
105
|
+
"ref": componentRef
|
|
106
|
+
}, { default: () => [ctx?.slots?.default(childProps)] });
|
|
107
|
+
return portal;
|
|
108
|
+
};
|
|
109
|
+
}, { props: {
|
|
110
|
+
visible: {
|
|
111
|
+
type: Boolean,
|
|
112
|
+
required: false,
|
|
113
|
+
default: void 0
|
|
114
|
+
},
|
|
115
|
+
getContainer: {
|
|
116
|
+
type: [String, Function],
|
|
117
|
+
required: false,
|
|
118
|
+
skipCheck: true,
|
|
119
|
+
default: void 0
|
|
120
|
+
},
|
|
121
|
+
wrapperClassName: {
|
|
122
|
+
type: String,
|
|
123
|
+
required: false,
|
|
124
|
+
default: void 0
|
|
125
|
+
},
|
|
126
|
+
forceRender: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
required: false,
|
|
129
|
+
default: void 0
|
|
130
|
+
}
|
|
131
|
+
} });
|
|
132
|
+
export { PortalWrapper_default as default, getOpenCount };
|
package/dist/classnames.cjs
CHANGED
|
@@ -1 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
function toVal(mix) {
|
|
3
|
+
let str = "";
|
|
4
|
+
if (typeof mix === "string" || typeof mix === "number") str += mix;
|
|
5
|
+
else if (typeof mix === "object") {
|
|
6
|
+
if (Array.isArray(mix)) {
|
|
7
|
+
for (let k = 0; k < mix.length; k++) if (mix[k]) {
|
|
8
|
+
const y = toVal(mix[k]);
|
|
9
|
+
if (y) {
|
|
10
|
+
str && (str += " ");
|
|
11
|
+
str += y;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
} else for (const k in mix) if (mix[k]) {
|
|
15
|
+
str && (str += " ");
|
|
16
|
+
str += k;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return str;
|
|
20
|
+
}
|
|
21
|
+
function classNames(...args) {
|
|
22
|
+
let str = "";
|
|
23
|
+
for (let i = 0; i < args.length; i++) {
|
|
24
|
+
const tmp = args[i];
|
|
25
|
+
if (tmp) {
|
|
26
|
+
const x = toVal(tmp);
|
|
27
|
+
if (x) {
|
|
28
|
+
str && (str += " ");
|
|
29
|
+
str += x;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return str;
|
|
34
|
+
}
|
|
35
|
+
const clsx = classNames;
|
|
36
|
+
exports.clsx = clsx;
|
|
37
|
+
exports.default = classNames;
|
package/dist/classnames.js
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
function toVal(mix) {
|
|
2
|
+
let str = "";
|
|
3
|
+
if (typeof mix === "string" || typeof mix === "number") str += mix;
|
|
4
|
+
else if (typeof mix === "object") {
|
|
5
|
+
if (Array.isArray(mix)) {
|
|
6
|
+
for (let k = 0; k < mix.length; k++) if (mix[k]) {
|
|
7
|
+
const y = toVal(mix[k]);
|
|
8
|
+
if (y) {
|
|
9
|
+
str && (str += " ");
|
|
10
|
+
str += y;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
} else for (const k in mix) if (mix[k]) {
|
|
14
|
+
str && (str += " ");
|
|
15
|
+
str += k;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return str;
|
|
16
19
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
function classNames(...args) {
|
|
21
|
+
let str = "";
|
|
22
|
+
for (let i = 0; i < args.length; i++) {
|
|
23
|
+
const tmp = args[i];
|
|
24
|
+
if (tmp) {
|
|
25
|
+
const x = toVal(tmp);
|
|
26
|
+
if (x) {
|
|
27
|
+
str && (str += " ");
|
|
28
|
+
str += x;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return str;
|
|
27
33
|
}
|
|
28
|
-
const
|
|
29
|
-
export {
|
|
30
|
-
l as clsx,
|
|
31
|
-
s as default
|
|
32
|
-
};
|
|
34
|
+
const clsx = classNames;
|
|
35
|
+
export { clsx, classNames as default };
|
package/dist/composeProps.cjs
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
function composeProps(originProps, patchProps, isAll) {
|
|
3
|
+
const composedProps = {
|
|
4
|
+
...originProps,
|
|
5
|
+
...isAll ? patchProps : {}
|
|
6
|
+
};
|
|
7
|
+
Object.keys(patchProps).forEach((key) => {
|
|
8
|
+
const func = patchProps[key];
|
|
9
|
+
if (typeof func === "function") composedProps[key] = (...args) => {
|
|
10
|
+
func(...args);
|
|
11
|
+
return originProps[key]?.(...args);
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
return composedProps;
|
|
15
|
+
}
|
|
16
|
+
var composeProps_default = composeProps;
|
|
17
|
+
exports.default = composeProps_default;
|
package/dist/composeProps.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
function composeProps(originProps, patchProps, isAll) {
|
|
2
|
+
const composedProps = {
|
|
3
|
+
...originProps,
|
|
4
|
+
...isAll ? patchProps : {}
|
|
5
|
+
};
|
|
6
|
+
Object.keys(patchProps).forEach((key) => {
|
|
7
|
+
const func = patchProps[key];
|
|
8
|
+
if (typeof func === "function") composedProps[key] = (...args) => {
|
|
9
|
+
func(...args);
|
|
10
|
+
return originProps[key]?.(...args);
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
return composedProps;
|
|
10
14
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
15
|
+
var composeProps_default = composeProps;
|
|
16
|
+
export { composeProps_default as default };
|