@v-c/util 0.0.13 → 0.0.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.
- package/dist/Children/isFragment.cjs +2 -4
- package/dist/Children/isFragment.js +3 -5
- package/dist/Children/toArray.cjs +10 -17
- package/dist/Children/toArray.js +10 -17
- package/dist/Dom/addEventListener.cjs +5 -10
- package/dist/Dom/addEventListener.js +6 -11
- package/dist/Dom/canUseDom.cjs +2 -3
- package/dist/Dom/canUseDom.js +2 -4
- package/dist/Dom/class.cjs +6 -20
- package/dist/Dom/class.js +7 -23
- package/dist/Dom/contains.cjs +9 -13
- package/dist/Dom/contains.js +9 -14
- package/dist/Dom/css.cjs +51 -66
- package/dist/Dom/css.js +52 -74
- package/dist/Dom/dynamicCSS.cjs +59 -86
- package/dist/Dom/dynamicCSS.js +58 -88
- package/dist/Dom/findDOMNode.cjs +7 -10
- package/dist/Dom/findDOMNode.js +6 -11
- package/dist/Dom/focus.cjs +36 -43
- package/dist/Dom/focus.js +37 -48
- package/dist/Dom/isVisible.cjs +16 -21
- package/dist/Dom/isVisible.js +15 -21
- package/dist/Dom/scrollLocker.cjs +66 -88
- package/dist/Dom/scrollLocker.js +64 -87
- package/dist/Dom/shadow.cjs +3 -5
- package/dist/Dom/shadow.js +4 -7
- package/dist/Dom/styleChecker.cjs +14 -18
- package/dist/Dom/styleChecker.js +14 -18
- package/dist/Dom/support.cjs +14 -22
- package/dist/Dom/support.js +12 -21
- package/dist/EventInterface.cjs +0 -1
- package/dist/EventInterface.js +0 -1
- package/dist/KeyCode.cjs +165 -522
- package/dist/KeyCode.js +164 -522
- package/dist/Portal.cjs +40 -46
- package/dist/Portal.js +37 -45
- package/dist/PortalWrapper.cjs +130 -164
- package/dist/PortalWrapper.js +126 -163
- package/dist/classnames.cjs +30 -38
- package/dist/classnames.js +30 -40
- package/dist/composeProps.cjs +15 -17
- package/dist/composeProps.js +14 -17
- package/dist/createRef.cjs +14 -16
- package/dist/createRef.js +13 -18
- package/dist/debug/diff.cjs +39 -45
- package/dist/debug/diff.js +39 -46
- package/dist/deprecated.cjs +2 -7
- package/dist/deprecated.js +2 -8
- package/dist/getScrollBarSize.cjs +39 -43
- package/dist/getScrollBarSize.js +39 -45
- package/dist/guid.cjs +3 -4
- package/dist/guid.js +3 -5
- package/dist/hooks/useEvent.cjs +2 -3
- package/dist/hooks/useEvent.js +2 -4
- package/dist/hooks/useId.cjs +10 -15
- package/dist/hooks/useId.js +9 -15
- package/dist/hooks/useLayoutEffect.cjs +29 -52
- package/dist/hooks/useLayoutEffect.js +30 -54
- package/dist/hooks/useMemo.cjs +9 -13
- package/dist/hooks/useMemo.js +8 -13
- package/dist/hooks/useMergedState.cjs +22 -27
- package/dist/hooks/useMergedState.js +22 -28
- package/dist/hooks/useMobile.cjs +13 -13
- package/dist/hooks/useMobile.js +12 -14
- package/dist/hooks/useState.cjs +7 -9
- package/dist/hooks/useState.js +6 -9
- package/dist/index.cjs +9 -11
- package/dist/index.js +5 -11
- package/dist/isEqual.cjs +26 -34
- package/dist/isEqual.js +25 -34
- package/dist/isMobile.cjs +6 -12
- package/dist/isMobile.js +5 -12
- package/dist/isValid.cjs +4 -4
- package/dist/isValid.js +3 -4
- package/dist/omit.cjs +6 -9
- package/dist/omit.js +6 -10
- package/dist/pickAttrs.cjs +20 -36
- package/dist/pickAttrs.js +20 -37
- package/dist/props-util/index.cjs +35 -52
- package/dist/props-util/index.js +35 -57
- package/dist/raf.cjs +34 -37
- package/dist/raf.js +33 -38
- package/dist/setStyle.cjs +14 -15
- package/dist/setStyle.js +13 -15
- package/dist/switchScrollingEffect.cjs +29 -35
- package/dist/switchScrollingEffect.js +27 -34
- package/dist/test/domHook.cjs +32 -46
- package/dist/test/domHook.js +33 -48
- package/dist/type.cjs +36 -17
- package/dist/type.d.ts +1 -1
- package/dist/type.js +38 -30
- package/dist/utils/checkSlotProp.cjs +6 -10
- package/dist/utils/checkSlotProp.js +7 -11
- package/dist/utils/get.cjs +7 -9
- package/dist/utils/get.js +7 -10
- package/dist/utils/omit.cjs +5 -7
- package/dist/utils/omit.js +6 -8
- package/dist/utils/set.cjs +37 -51
- package/dist/utils/set.js +36 -53
- package/dist/utils/transition.cjs +76 -80
- package/dist/utils/transition.d.ts +2 -2
- package/dist/utils/transition.js +76 -84
- package/dist/utils/watchState.cjs +12 -14
- package/dist/utils/watchState.js +13 -16
- package/dist/vnode.cjs +48 -39
- package/dist/vnode.d.ts +1 -0
- package/dist/vnode.js +47 -43
- package/dist/vueuse/unref-element.cjs +3 -5
- package/dist/vueuse/unref-element.js +3 -5
- package/dist/warning.cjs +21 -29
- package/dist/warning.js +20 -36
- package/package.json +1 -1
|
@@ -1,38 +1,32 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const setStyle = require("./setStyle.cjs");
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
const require_getScrollBarSize = require("./getScrollBarSize.cjs");
|
|
3
|
+
const require_setStyle = require("./setStyle.cjs");
|
|
5
4
|
function isBodyOverflowing() {
|
|
6
|
-
|
|
5
|
+
return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;
|
|
7
6
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (!scrollingEffectClassNameReg.test(bodyClassName)) {
|
|
33
|
-
const addClassName = `${bodyClassName} ${scrollingEffectClassName}`;
|
|
34
|
-
document.body.className = addClassName.trim();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
7
|
+
var cacheStyle = {};
|
|
8
|
+
var switchScrollingEffect_default = (close) => {
|
|
9
|
+
if (!isBodyOverflowing() && !close) return;
|
|
10
|
+
const scrollingEffectClassName = "ant-scrolling-effect";
|
|
11
|
+
const scrollingEffectClassNameReg = new RegExp(`${scrollingEffectClassName}`, "g");
|
|
12
|
+
const bodyClassName = document.body.className;
|
|
13
|
+
if (close) {
|
|
14
|
+
if (!scrollingEffectClassNameReg.test(bodyClassName)) return;
|
|
15
|
+
require_setStyle.default(cacheStyle);
|
|
16
|
+
cacheStyle = {};
|
|
17
|
+
document.body.className = bodyClassName.replace(scrollingEffectClassNameReg, "").trim();
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const scrollBarSize = require_getScrollBarSize.default();
|
|
21
|
+
if (scrollBarSize) {
|
|
22
|
+
cacheStyle = require_setStyle.default({
|
|
23
|
+
position: "relative",
|
|
24
|
+
width: `calc(100% - ${scrollBarSize}px)`
|
|
25
|
+
});
|
|
26
|
+
if (!scrollingEffectClassNameReg.test(bodyClassName)) {
|
|
27
|
+
const addClassName = `${bodyClassName} ${scrollingEffectClassName}`;
|
|
28
|
+
document.body.className = addClassName.trim();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
37
31
|
};
|
|
38
|
-
exports.default =
|
|
32
|
+
exports.default = switchScrollingEffect_default;
|
|
@@ -1,38 +1,31 @@
|
|
|
1
1
|
import getScrollBarSize from "./getScrollBarSize.js";
|
|
2
|
-
import
|
|
2
|
+
import setStyle_default from "./setStyle.js";
|
|
3
3
|
function isBodyOverflowing() {
|
|
4
|
-
|
|
4
|
+
return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!scrollingEffectClassNameReg.test(bodyClassName)) {
|
|
31
|
-
const addClassName = `${bodyClassName} ${scrollingEffectClassName}`;
|
|
32
|
-
document.body.className = addClassName.trim();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
export {
|
|
37
|
-
switchScrollingEffect as default
|
|
6
|
+
var cacheStyle = {};
|
|
7
|
+
var switchScrollingEffect_default = (close) => {
|
|
8
|
+
if (!isBodyOverflowing() && !close) return;
|
|
9
|
+
const scrollingEffectClassName = "ant-scrolling-effect";
|
|
10
|
+
const scrollingEffectClassNameReg = new RegExp(`${scrollingEffectClassName}`, "g");
|
|
11
|
+
const bodyClassName = document.body.className;
|
|
12
|
+
if (close) {
|
|
13
|
+
if (!scrollingEffectClassNameReg.test(bodyClassName)) return;
|
|
14
|
+
setStyle_default(cacheStyle);
|
|
15
|
+
cacheStyle = {};
|
|
16
|
+
document.body.className = bodyClassName.replace(scrollingEffectClassNameReg, "").trim();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const scrollBarSize = getScrollBarSize();
|
|
20
|
+
if (scrollBarSize) {
|
|
21
|
+
cacheStyle = setStyle_default({
|
|
22
|
+
position: "relative",
|
|
23
|
+
width: `calc(100% - ${scrollBarSize}px)`
|
|
24
|
+
});
|
|
25
|
+
if (!scrollingEffectClassNameReg.test(bodyClassName)) {
|
|
26
|
+
const addClassName = `${bodyClassName} ${scrollingEffectClassName}`;
|
|
27
|
+
document.body.className = addClassName.trim();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
38
30
|
};
|
|
31
|
+
export { switchScrollingEffect_default as default };
|
package/dist/test/domHook.cjs
CHANGED
|
@@ -1,52 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const NO_EXIST = { __NOT_EXIST: true };
|
|
1
|
+
var NO_EXIST = { __NOT_EXIST: true };
|
|
4
2
|
function spyElementPrototypes(elementClass, properties) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const originDescriptor = originDescriptors[propName];
|
|
36
|
-
if (originDescriptor === NO_EXIST)
|
|
37
|
-
delete elementClass.prototype[propName];
|
|
38
|
-
else if (typeof originDescriptor === "function")
|
|
39
|
-
elementClass.prototype[propName] = originDescriptor;
|
|
40
|
-
else
|
|
41
|
-
Object.defineProperty(elementClass.prototype, propName, originDescriptor);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
};
|
|
3
|
+
const propNames = Object.keys(properties);
|
|
4
|
+
const originDescriptors = {};
|
|
5
|
+
propNames.forEach((propName) => {
|
|
6
|
+
const originDescriptor = Object.getOwnPropertyDescriptor(elementClass.prototype, propName);
|
|
7
|
+
originDescriptors[propName] = originDescriptor || NO_EXIST;
|
|
8
|
+
const spyProp = properties[propName];
|
|
9
|
+
if (typeof spyProp === "function") elementClass.prototype[propName] = function spyFunc(...args) {
|
|
10
|
+
return spyProp.call(this, originDescriptor, ...args);
|
|
11
|
+
};
|
|
12
|
+
else Object.defineProperty(elementClass.prototype, propName, {
|
|
13
|
+
...spyProp,
|
|
14
|
+
set(value) {
|
|
15
|
+
if (spyProp.set) return spyProp.set.call(this, originDescriptor, value);
|
|
16
|
+
return originDescriptor.set(value);
|
|
17
|
+
},
|
|
18
|
+
get() {
|
|
19
|
+
if (spyProp.get) return spyProp.get.call(this, originDescriptor);
|
|
20
|
+
return originDescriptor.get();
|
|
21
|
+
},
|
|
22
|
+
configurable: true
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
return { mockRestore() {
|
|
26
|
+
propNames.forEach((propName) => {
|
|
27
|
+
const originDescriptor = originDescriptors[propName];
|
|
28
|
+
if (originDescriptor === NO_EXIST) delete elementClass.prototype[propName];
|
|
29
|
+
else if (typeof originDescriptor === "function") elementClass.prototype[propName] = originDescriptor;
|
|
30
|
+
else Object.defineProperty(elementClass.prototype, propName, originDescriptor);
|
|
31
|
+
});
|
|
32
|
+
} };
|
|
45
33
|
}
|
|
46
34
|
function spyElementPrototype(Element, propName, property) {
|
|
47
|
-
|
|
48
|
-
[propName]: property
|
|
49
|
-
});
|
|
35
|
+
return spyElementPrototypes(Element, { [propName]: property });
|
|
50
36
|
}
|
|
51
37
|
exports.spyElementPrototype = spyElementPrototype;
|
|
52
38
|
exports.spyElementPrototypes = spyElementPrototypes;
|
package/dist/test/domHook.js
CHANGED
|
@@ -1,52 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
var NO_EXIST = { __NOT_EXIST: true };
|
|
2
2
|
function spyElementPrototypes(elementClass, properties) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const originDescriptor = originDescriptors[propName];
|
|
34
|
-
if (originDescriptor === NO_EXIST)
|
|
35
|
-
delete elementClass.prototype[propName];
|
|
36
|
-
else if (typeof originDescriptor === "function")
|
|
37
|
-
elementClass.prototype[propName] = originDescriptor;
|
|
38
|
-
else
|
|
39
|
-
Object.defineProperty(elementClass.prototype, propName, originDescriptor);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
};
|
|
3
|
+
const propNames = Object.keys(properties);
|
|
4
|
+
const originDescriptors = {};
|
|
5
|
+
propNames.forEach((propName) => {
|
|
6
|
+
const originDescriptor = Object.getOwnPropertyDescriptor(elementClass.prototype, propName);
|
|
7
|
+
originDescriptors[propName] = originDescriptor || NO_EXIST;
|
|
8
|
+
const spyProp = properties[propName];
|
|
9
|
+
if (typeof spyProp === "function") elementClass.prototype[propName] = function spyFunc(...args) {
|
|
10
|
+
return spyProp.call(this, originDescriptor, ...args);
|
|
11
|
+
};
|
|
12
|
+
else Object.defineProperty(elementClass.prototype, propName, {
|
|
13
|
+
...spyProp,
|
|
14
|
+
set(value) {
|
|
15
|
+
if (spyProp.set) return spyProp.set.call(this, originDescriptor, value);
|
|
16
|
+
return originDescriptor.set(value);
|
|
17
|
+
},
|
|
18
|
+
get() {
|
|
19
|
+
if (spyProp.get) return spyProp.get.call(this, originDescriptor);
|
|
20
|
+
return originDescriptor.get();
|
|
21
|
+
},
|
|
22
|
+
configurable: true
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
return { mockRestore() {
|
|
26
|
+
propNames.forEach((propName) => {
|
|
27
|
+
const originDescriptor = originDescriptors[propName];
|
|
28
|
+
if (originDescriptor === NO_EXIST) delete elementClass.prototype[propName];
|
|
29
|
+
else if (typeof originDescriptor === "function") elementClass.prototype[propName] = originDescriptor;
|
|
30
|
+
else Object.defineProperty(elementClass.prototype, propName, originDescriptor);
|
|
31
|
+
});
|
|
32
|
+
} };
|
|
43
33
|
}
|
|
44
34
|
function spyElementPrototype(Element, propName, property) {
|
|
45
|
-
|
|
46
|
-
[propName]: property
|
|
47
|
-
});
|
|
35
|
+
return spyElementPrototypes(Element, { [propName]: property });
|
|
48
36
|
}
|
|
49
|
-
export {
|
|
50
|
-
spyElementPrototype,
|
|
51
|
-
spyElementPrototypes
|
|
52
|
-
};
|
|
37
|
+
export { spyElementPrototype, spyElementPrototypes };
|
package/dist/type.cjs
CHANGED
|
@@ -1,41 +1,60 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
1
|
const tuple = (...args) => args;
|
|
4
2
|
const tupleNum = (...args) => args;
|
|
5
3
|
function withInstall(comp) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const c = comp;
|
|
5
|
+
c.install = function(app) {
|
|
6
|
+
app.component(c.displayName || c.name, comp);
|
|
7
|
+
};
|
|
8
|
+
return comp;
|
|
11
9
|
}
|
|
12
10
|
function eventType() {
|
|
13
|
-
|
|
11
|
+
return { type: [Function, Array] };
|
|
14
12
|
}
|
|
15
13
|
function objectType(defaultVal) {
|
|
16
|
-
|
|
14
|
+
return {
|
|
15
|
+
type: Object,
|
|
16
|
+
default: defaultVal
|
|
17
|
+
};
|
|
17
18
|
}
|
|
18
19
|
function booleanType(defaultVal) {
|
|
19
|
-
|
|
20
|
+
return {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: defaultVal
|
|
23
|
+
};
|
|
20
24
|
}
|
|
21
25
|
function functionType(defaultVal) {
|
|
22
|
-
|
|
26
|
+
return {
|
|
27
|
+
type: Function,
|
|
28
|
+
default: defaultVal
|
|
29
|
+
};
|
|
23
30
|
}
|
|
24
31
|
function anyType(defaultVal, required) {
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
const type = {
|
|
33
|
+
validator: () => true,
|
|
34
|
+
default: defaultVal
|
|
35
|
+
};
|
|
36
|
+
return required ? type : type;
|
|
27
37
|
}
|
|
28
38
|
function vNodeType() {
|
|
29
|
-
|
|
39
|
+
return { validator: () => true };
|
|
30
40
|
}
|
|
31
41
|
function arrayType(defaultVal) {
|
|
32
|
-
|
|
42
|
+
return {
|
|
43
|
+
type: Array,
|
|
44
|
+
default: defaultVal
|
|
45
|
+
};
|
|
33
46
|
}
|
|
34
47
|
function stringType(defaultVal) {
|
|
35
|
-
|
|
48
|
+
return {
|
|
49
|
+
type: String,
|
|
50
|
+
default: defaultVal
|
|
51
|
+
};
|
|
36
52
|
}
|
|
37
53
|
function someType(types, defaultVal) {
|
|
38
|
-
|
|
54
|
+
return types ? {
|
|
55
|
+
type: types,
|
|
56
|
+
default: defaultVal
|
|
57
|
+
} : anyType(defaultVal);
|
|
39
58
|
}
|
|
40
59
|
exports.anyType = anyType;
|
|
41
60
|
exports.arrayType = arrayType;
|
package/dist/type.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface PropOptions<T = any, D = T> {
|
|
|
19
19
|
default?: D | DefaultFactory<D> | null | undefined | object;
|
|
20
20
|
validator?: (value: unknown) => boolean;
|
|
21
21
|
}
|
|
22
|
-
declare type VNodeChildAtom = Component | VNode | string | number | null | undefined | void;
|
|
22
|
+
declare type VNodeChildAtom = Component | VNode | string | number | null | undefined | void | boolean;
|
|
23
23
|
export type VueNode = VNodeChildAtom | VNodeChildAtom[] | VNode;
|
|
24
24
|
export declare function withInstall<T>(comp: T): T & Plugin;
|
|
25
25
|
export type MaybeRef<T> = T | Ref<T>;
|
package/dist/type.js
CHANGED
|
@@ -1,51 +1,59 @@
|
|
|
1
1
|
const tuple = (...args) => args;
|
|
2
2
|
const tupleNum = (...args) => args;
|
|
3
3
|
function withInstall(comp) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const c = comp;
|
|
5
|
+
c.install = function(app) {
|
|
6
|
+
app.component(c.displayName || c.name, comp);
|
|
7
|
+
};
|
|
8
|
+
return comp;
|
|
9
9
|
}
|
|
10
10
|
function eventType() {
|
|
11
|
-
|
|
11
|
+
return { type: [Function, Array] };
|
|
12
12
|
}
|
|
13
13
|
function objectType(defaultVal) {
|
|
14
|
-
|
|
14
|
+
return {
|
|
15
|
+
type: Object,
|
|
16
|
+
default: defaultVal
|
|
17
|
+
};
|
|
15
18
|
}
|
|
16
19
|
function booleanType(defaultVal) {
|
|
17
|
-
|
|
20
|
+
return {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: defaultVal
|
|
23
|
+
};
|
|
18
24
|
}
|
|
19
25
|
function functionType(defaultVal) {
|
|
20
|
-
|
|
26
|
+
return {
|
|
27
|
+
type: Function,
|
|
28
|
+
default: defaultVal
|
|
29
|
+
};
|
|
21
30
|
}
|
|
22
31
|
function anyType(defaultVal, required) {
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
const type = {
|
|
33
|
+
validator: () => true,
|
|
34
|
+
default: defaultVal
|
|
35
|
+
};
|
|
36
|
+
return required ? type : type;
|
|
25
37
|
}
|
|
26
38
|
function vNodeType() {
|
|
27
|
-
|
|
39
|
+
return { validator: () => true };
|
|
28
40
|
}
|
|
29
41
|
function arrayType(defaultVal) {
|
|
30
|
-
|
|
42
|
+
return {
|
|
43
|
+
type: Array,
|
|
44
|
+
default: defaultVal
|
|
45
|
+
};
|
|
31
46
|
}
|
|
32
47
|
function stringType(defaultVal) {
|
|
33
|
-
|
|
48
|
+
return {
|
|
49
|
+
type: String,
|
|
50
|
+
default: defaultVal
|
|
51
|
+
};
|
|
34
52
|
}
|
|
35
53
|
function someType(types, defaultVal) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
eventType,
|
|
43
|
-
functionType,
|
|
44
|
-
objectType,
|
|
45
|
-
someType,
|
|
46
|
-
stringType,
|
|
47
|
-
tuple,
|
|
48
|
-
tupleNum,
|
|
49
|
-
vNodeType,
|
|
50
|
-
withInstall
|
|
51
|
-
};
|
|
54
|
+
return types ? {
|
|
55
|
+
type: types,
|
|
56
|
+
default: defaultVal
|
|
57
|
+
} : anyType(defaultVal);
|
|
58
|
+
}
|
|
59
|
+
export { anyType, arrayType, booleanType, eventType, functionType, objectType, someType, stringType, tuple, tupleNum, vNodeType, withInstall };
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
1
|
function checkSlotProp(props, slots, name, ...args) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
return null;
|
|
2
|
+
if (slots[name]) return slots[name]?.(...args);
|
|
3
|
+
if (name in props) {
|
|
4
|
+
if (typeof props[name] === "function") return props[name]?.(...args);
|
|
5
|
+
return props[name];
|
|
6
|
+
}
|
|
7
|
+
return null;
|
|
12
8
|
}
|
|
13
9
|
exports.checkSlotProp = checkSlotProp;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
function checkSlotProp(props, slots, name, ...args) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
return null;
|
|
2
|
+
if (slots[name]) return slots[name]?.(...args);
|
|
3
|
+
if (name in props) {
|
|
4
|
+
if (typeof props[name] === "function") return props[name]?.(...args);
|
|
5
|
+
return props[name];
|
|
6
|
+
}
|
|
7
|
+
return null;
|
|
10
8
|
}
|
|
11
|
-
export {
|
|
12
|
-
checkSlotProp
|
|
13
|
-
};
|
|
9
|
+
export { checkSlotProp };
|
package/dist/utils/get.cjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
"
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
function get(entity, path) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return current;
|
|
3
|
+
let current = entity;
|
|
4
|
+
for (let i = 0; i < path.length; i += 1) {
|
|
5
|
+
if (current === null || current === void 0) return void 0;
|
|
6
|
+
current = current[path[i]];
|
|
7
|
+
}
|
|
8
|
+
return current;
|
|
11
9
|
}
|
|
12
10
|
exports.default = get;
|
package/dist/utils/get.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
function get(entity, path) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return current;
|
|
2
|
+
let current = entity;
|
|
3
|
+
for (let i = 0; i < path.length; i += 1) {
|
|
4
|
+
if (current === null || current === void 0) return void 0;
|
|
5
|
+
current = current[path[i]];
|
|
6
|
+
}
|
|
7
|
+
return current;
|
|
9
8
|
}
|
|
10
|
-
export {
|
|
11
|
-
get as default
|
|
12
|
-
};
|
|
9
|
+
export { get as default };
|
package/dist/utils/omit.cjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
1
|
function omit(obj, keys) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
const result = { ...obj };
|
|
3
|
+
keys.forEach((key) => {
|
|
4
|
+
delete result[key];
|
|
5
|
+
});
|
|
6
|
+
return result;
|
|
9
7
|
}
|
|
10
8
|
exports.omit = omit;
|
package/dist/utils/omit.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
function omit(obj, keys) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
const result = { ...obj };
|
|
3
|
+
keys.forEach((key) => {
|
|
4
|
+
delete result[key];
|
|
5
|
+
});
|
|
6
|
+
return result;
|
|
7
7
|
}
|
|
8
|
-
export {
|
|
9
|
-
omit
|
|
10
|
-
};
|
|
8
|
+
export { omit };
|