@v-c/trigger 0.0.9 → 0.0.11
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/Popup/Arrow.cjs +91 -1
- package/dist/Popup/Arrow.js +60 -38
- package/dist/Popup/Mask.cjs +66 -1
- package/dist/Popup/Mask.js +35 -32
- package/dist/Popup/PopupContent.cjs +29 -1
- package/dist/Popup/PopupContent.js +15 -8
- package/dist/Popup/index.cjs +365 -1
- package/dist/Popup/index.js +194 -160
- package/dist/UniqueProvider/UniqueContainer.cjs +159 -1
- package/dist/UniqueProvider/UniqueContainer.js +87 -67
- package/dist/UniqueProvider/index.cjs +213 -1
- package/dist/UniqueProvider/index.js +177 -131
- package/dist/UniqueProvider/useTargetState.cjs +42 -1
- package/dist/UniqueProvider/useTargetState.js +39 -10
- package/dist/context.cjs +38 -1
- package/dist/context.js +27 -16
- package/dist/hooks/useAction.cjs +32 -1
- package/dist/hooks/useAction.js +27 -12
- package/dist/hooks/useAlign.cjs +499 -1
- package/dist/hooks/useAlign.d.ts +1 -1
- package/dist/hooks/useAlign.js +445 -204
- package/dist/hooks/useDelay.cjs +27 -1
- package/dist/hooks/useDelay.js +23 -12
- package/dist/hooks/useOffsetStyle.cjs +36 -1
- package/dist/hooks/useOffsetStyle.js +28 -12
- package/dist/hooks/useWatch.cjs +37 -1
- package/dist/hooks/useWatch.js +28 -17
- package/dist/hooks/useWinClick.cjs +67 -1
- package/dist/hooks/useWinClick.js +56 -39
- package/dist/index.cjs +700 -1
- package/dist/index.js +501 -312
- package/dist/util.cjs +101 -1
- package/dist/util.js +86 -54
- package/package.json +3 -3
package/dist/Popup/Arrow.cjs
CHANGED
|
@@ -1 +1,91 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const util = require("@v-c/util");
|
|
5
|
+
const Arrow = /* @__PURE__ */ vue.defineComponent({
|
|
6
|
+
props: {
|
|
7
|
+
prefixCls: {
|
|
8
|
+
type: String,
|
|
9
|
+
required: true,
|
|
10
|
+
default: void 0
|
|
11
|
+
},
|
|
12
|
+
align: {
|
|
13
|
+
type: Object,
|
|
14
|
+
required: true,
|
|
15
|
+
default: void 0
|
|
16
|
+
},
|
|
17
|
+
arrow: {
|
|
18
|
+
type: Object,
|
|
19
|
+
required: true,
|
|
20
|
+
default: void 0
|
|
21
|
+
},
|
|
22
|
+
arrowPos: {
|
|
23
|
+
type: Object,
|
|
24
|
+
required: true,
|
|
25
|
+
default: void 0
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
name: "Arrow",
|
|
29
|
+
setup(props, {
|
|
30
|
+
expose
|
|
31
|
+
}) {
|
|
32
|
+
const arrowRef = vue.shallowRef();
|
|
33
|
+
expose({
|
|
34
|
+
arrowRef
|
|
35
|
+
});
|
|
36
|
+
return () => {
|
|
37
|
+
const {
|
|
38
|
+
prefixCls,
|
|
39
|
+
align,
|
|
40
|
+
arrow,
|
|
41
|
+
arrowPos
|
|
42
|
+
} = props;
|
|
43
|
+
const {
|
|
44
|
+
className,
|
|
45
|
+
content,
|
|
46
|
+
style
|
|
47
|
+
} = arrow || {};
|
|
48
|
+
const {
|
|
49
|
+
x = 0,
|
|
50
|
+
y = 0
|
|
51
|
+
} = arrowPos;
|
|
52
|
+
if (!align || !align.points) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const alignStyle = {
|
|
56
|
+
position: "absolute"
|
|
57
|
+
};
|
|
58
|
+
if (align.autoArrow !== false) {
|
|
59
|
+
const popupPoints = align.points[0];
|
|
60
|
+
const targetPoints = align.points[1];
|
|
61
|
+
const popupTB = popupPoints[0];
|
|
62
|
+
const popupLR = popupPoints[1];
|
|
63
|
+
const targetTB = targetPoints[0];
|
|
64
|
+
const targetLR = targetPoints[1];
|
|
65
|
+
if (popupTB === targetTB || !["t", "b"].includes(popupTB)) {
|
|
66
|
+
alignStyle.top = `${y}px`;
|
|
67
|
+
} else if (popupTB === "t") {
|
|
68
|
+
alignStyle.top = 0;
|
|
69
|
+
} else {
|
|
70
|
+
alignStyle.bottom = 0;
|
|
71
|
+
}
|
|
72
|
+
if (popupLR === targetLR || !["l", "r"].includes(popupLR)) {
|
|
73
|
+
alignStyle.left = `${x}px`;
|
|
74
|
+
} else if (popupLR === "l") {
|
|
75
|
+
alignStyle.left = 0;
|
|
76
|
+
} else {
|
|
77
|
+
alignStyle.right = 0;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return vue.createVNode("div", {
|
|
81
|
+
"ref": arrowRef,
|
|
82
|
+
"class": util.classNames(`${prefixCls}-arrow`, className),
|
|
83
|
+
"style": {
|
|
84
|
+
...alignStyle,
|
|
85
|
+
...style
|
|
86
|
+
}
|
|
87
|
+
}, [content]);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
exports.Arrow = Arrow;
|
package/dist/Popup/Arrow.js
CHANGED
|
@@ -1,69 +1,91 @@
|
|
|
1
|
-
import { defineComponent
|
|
2
|
-
import { classNames
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent, shallowRef, createVNode } from "vue";
|
|
2
|
+
import { classNames } from "@v-c/util";
|
|
3
|
+
const Arrow = /* @__PURE__ */ defineComponent({
|
|
4
4
|
props: {
|
|
5
5
|
prefixCls: {
|
|
6
6
|
type: String,
|
|
7
|
-
required:
|
|
7
|
+
required: true,
|
|
8
8
|
default: void 0
|
|
9
9
|
},
|
|
10
10
|
align: {
|
|
11
11
|
type: Object,
|
|
12
|
-
required:
|
|
12
|
+
required: true,
|
|
13
13
|
default: void 0
|
|
14
14
|
},
|
|
15
15
|
arrow: {
|
|
16
16
|
type: Object,
|
|
17
|
-
required:
|
|
17
|
+
required: true,
|
|
18
18
|
default: void 0
|
|
19
19
|
},
|
|
20
20
|
arrowPos: {
|
|
21
21
|
type: Object,
|
|
22
|
-
required:
|
|
22
|
+
required: true,
|
|
23
23
|
default: void 0
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
name: "Arrow",
|
|
27
|
-
setup(
|
|
28
|
-
expose
|
|
27
|
+
setup(props, {
|
|
28
|
+
expose
|
|
29
29
|
}) {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
arrowRef
|
|
33
|
-
})
|
|
30
|
+
const arrowRef = shallowRef();
|
|
31
|
+
expose({
|
|
32
|
+
arrowRef
|
|
33
|
+
});
|
|
34
|
+
return () => {
|
|
34
35
|
const {
|
|
35
|
-
prefixCls
|
|
36
|
-
align
|
|
37
|
-
arrow
|
|
38
|
-
arrowPos
|
|
39
|
-
} =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
prefixCls,
|
|
37
|
+
align,
|
|
38
|
+
arrow,
|
|
39
|
+
arrowPos
|
|
40
|
+
} = props;
|
|
41
|
+
const {
|
|
42
|
+
className,
|
|
43
|
+
content,
|
|
44
|
+
style
|
|
45
|
+
} = arrow || {};
|
|
46
|
+
const {
|
|
47
|
+
x = 0,
|
|
48
|
+
y = 0
|
|
49
|
+
} = arrowPos;
|
|
50
|
+
if (!align || !align.points) {
|
|
48
51
|
return null;
|
|
49
|
-
|
|
52
|
+
}
|
|
53
|
+
const alignStyle = {
|
|
50
54
|
position: "absolute"
|
|
51
55
|
};
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
|
|
56
|
+
if (align.autoArrow !== false) {
|
|
57
|
+
const popupPoints = align.points[0];
|
|
58
|
+
const targetPoints = align.points[1];
|
|
59
|
+
const popupTB = popupPoints[0];
|
|
60
|
+
const popupLR = popupPoints[1];
|
|
61
|
+
const targetTB = targetPoints[0];
|
|
62
|
+
const targetLR = targetPoints[1];
|
|
63
|
+
if (popupTB === targetTB || !["t", "b"].includes(popupTB)) {
|
|
64
|
+
alignStyle.top = `${y}px`;
|
|
65
|
+
} else if (popupTB === "t") {
|
|
66
|
+
alignStyle.top = 0;
|
|
67
|
+
} else {
|
|
68
|
+
alignStyle.bottom = 0;
|
|
69
|
+
}
|
|
70
|
+
if (popupLR === targetLR || !["l", "r"].includes(popupLR)) {
|
|
71
|
+
alignStyle.left = `${x}px`;
|
|
72
|
+
} else if (popupLR === "l") {
|
|
73
|
+
alignStyle.left = 0;
|
|
74
|
+
} else {
|
|
75
|
+
alignStyle.right = 0;
|
|
76
|
+
}
|
|
55
77
|
}
|
|
56
|
-
return
|
|
57
|
-
ref:
|
|
58
|
-
class:
|
|
59
|
-
style: {
|
|
60
|
-
...
|
|
61
|
-
...
|
|
78
|
+
return createVNode("div", {
|
|
79
|
+
"ref": arrowRef,
|
|
80
|
+
"class": classNames(`${prefixCls}-arrow`, className),
|
|
81
|
+
"style": {
|
|
82
|
+
...alignStyle,
|
|
83
|
+
...style
|
|
62
84
|
}
|
|
63
|
-
}, [
|
|
85
|
+
}, [content]);
|
|
64
86
|
};
|
|
65
87
|
}
|
|
66
88
|
});
|
|
67
89
|
export {
|
|
68
|
-
|
|
90
|
+
Arrow
|
|
69
91
|
};
|
package/dist/Popup/Mask.cjs
CHANGED
|
@@ -1 +1,66 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const transition = require("@v-c/util/dist/utils/transition");
|
|
5
|
+
const Mask = /* @__PURE__ */ vue.defineComponent((props, {
|
|
6
|
+
attrs
|
|
7
|
+
}) => {
|
|
8
|
+
return () => {
|
|
9
|
+
const {
|
|
10
|
+
prefixCls,
|
|
11
|
+
open,
|
|
12
|
+
zIndex,
|
|
13
|
+
mask,
|
|
14
|
+
motion,
|
|
15
|
+
mobile
|
|
16
|
+
} = props;
|
|
17
|
+
if (!mask) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const transitionProps = transition.getTransitionProps(motion?.name, motion);
|
|
21
|
+
return vue.createVNode(vue.Transition, transitionProps, {
|
|
22
|
+
default: () => [open ? vue.createVNode("div", {
|
|
23
|
+
"style": {
|
|
24
|
+
zIndex
|
|
25
|
+
},
|
|
26
|
+
"class": [`${prefixCls}-mask`, mobile && `${prefixCls}-mask-mobile`, attrs.class]
|
|
27
|
+
}, null) : null]
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
}, {
|
|
31
|
+
props: {
|
|
32
|
+
prefixCls: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: true,
|
|
35
|
+
default: void 0
|
|
36
|
+
},
|
|
37
|
+
open: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
required: false,
|
|
40
|
+
default: void 0
|
|
41
|
+
},
|
|
42
|
+
zIndex: {
|
|
43
|
+
type: Number,
|
|
44
|
+
required: false,
|
|
45
|
+
default: void 0
|
|
46
|
+
},
|
|
47
|
+
mask: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
required: false,
|
|
50
|
+
default: void 0
|
|
51
|
+
},
|
|
52
|
+
motion: {
|
|
53
|
+
type: Object,
|
|
54
|
+
required: false,
|
|
55
|
+
default: void 0
|
|
56
|
+
},
|
|
57
|
+
mobile: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
required: false,
|
|
60
|
+
default: void 0
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
inheritAttrs: false,
|
|
64
|
+
name: "PopupMask"
|
|
65
|
+
});
|
|
66
|
+
exports.default = Mask;
|
package/dist/Popup/Mask.js
CHANGED
|
@@ -1,63 +1,66 @@
|
|
|
1
|
-
import { defineComponent
|
|
2
|
-
import { getTransitionProps
|
|
3
|
-
const
|
|
4
|
-
attrs
|
|
5
|
-
}) =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { defineComponent, createVNode, Transition } from "vue";
|
|
2
|
+
import { getTransitionProps } from "@v-c/util/dist/utils/transition";
|
|
3
|
+
const Mask = /* @__PURE__ */ defineComponent((props, {
|
|
4
|
+
attrs
|
|
5
|
+
}) => {
|
|
6
|
+
return () => {
|
|
7
|
+
const {
|
|
8
|
+
prefixCls,
|
|
9
|
+
open,
|
|
10
|
+
zIndex,
|
|
11
|
+
mask,
|
|
12
|
+
motion,
|
|
13
|
+
mobile
|
|
14
|
+
} = props;
|
|
15
|
+
if (!mask) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const transitionProps = getTransitionProps(motion?.name, motion);
|
|
19
|
+
return createVNode(Transition, transitionProps, {
|
|
20
|
+
default: () => [open ? createVNode("div", {
|
|
21
|
+
"style": {
|
|
22
|
+
zIndex
|
|
23
|
+
},
|
|
24
|
+
"class": [`${prefixCls}-mask`, mobile && `${prefixCls}-mask-mobile`, attrs.class]
|
|
25
|
+
}, null) : null]
|
|
26
|
+
});
|
|
27
|
+
};
|
|
25
28
|
}, {
|
|
26
29
|
props: {
|
|
27
30
|
prefixCls: {
|
|
28
31
|
type: String,
|
|
29
|
-
required:
|
|
32
|
+
required: true,
|
|
30
33
|
default: void 0
|
|
31
34
|
},
|
|
32
35
|
open: {
|
|
33
36
|
type: Boolean,
|
|
34
|
-
required:
|
|
37
|
+
required: false,
|
|
35
38
|
default: void 0
|
|
36
39
|
},
|
|
37
40
|
zIndex: {
|
|
38
41
|
type: Number,
|
|
39
|
-
required:
|
|
42
|
+
required: false,
|
|
40
43
|
default: void 0
|
|
41
44
|
},
|
|
42
45
|
mask: {
|
|
43
46
|
type: Boolean,
|
|
44
|
-
required:
|
|
47
|
+
required: false,
|
|
45
48
|
default: void 0
|
|
46
49
|
},
|
|
47
50
|
motion: {
|
|
48
51
|
type: Object,
|
|
49
|
-
required:
|
|
52
|
+
required: false,
|
|
50
53
|
default: void 0
|
|
51
54
|
},
|
|
52
55
|
mobile: {
|
|
53
56
|
type: Boolean,
|
|
54
|
-
required:
|
|
57
|
+
required: false,
|
|
55
58
|
default: void 0
|
|
56
59
|
}
|
|
57
60
|
},
|
|
58
|
-
inheritAttrs:
|
|
61
|
+
inheritAttrs: false,
|
|
59
62
|
name: "PopupMask"
|
|
60
63
|
});
|
|
61
64
|
export {
|
|
62
|
-
|
|
65
|
+
Mask as default
|
|
63
66
|
};
|
|
@@ -1 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const PopupContent = /* @__PURE__ */ vue.defineComponent((props, {
|
|
5
|
+
slots
|
|
6
|
+
}) => {
|
|
7
|
+
const cachedChildren = vue.shallowRef();
|
|
8
|
+
return () => {
|
|
9
|
+
const children = slots?.default?.();
|
|
10
|
+
if (!props.cache) {
|
|
11
|
+
cachedChildren.value = children;
|
|
12
|
+
return children;
|
|
13
|
+
}
|
|
14
|
+
if (!cachedChildren.value) {
|
|
15
|
+
cachedChildren.value = children;
|
|
16
|
+
}
|
|
17
|
+
return cachedChildren.value;
|
|
18
|
+
};
|
|
19
|
+
}, {
|
|
20
|
+
props: {
|
|
21
|
+
cache: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
required: false,
|
|
24
|
+
default: void 0
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
name: "PopupContext"
|
|
28
|
+
});
|
|
29
|
+
exports.default = PopupContent;
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
import { defineComponent
|
|
2
|
-
const
|
|
3
|
-
slots
|
|
1
|
+
import { defineComponent, shallowRef } from "vue";
|
|
2
|
+
const PopupContent = /* @__PURE__ */ defineComponent((props, {
|
|
3
|
+
slots
|
|
4
4
|
}) => {
|
|
5
|
-
const
|
|
5
|
+
const cachedChildren = shallowRef();
|
|
6
6
|
return () => {
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const children = slots?.default?.();
|
|
8
|
+
if (!props.cache) {
|
|
9
|
+
cachedChildren.value = children;
|
|
10
|
+
return children;
|
|
11
|
+
}
|
|
12
|
+
if (!cachedChildren.value) {
|
|
13
|
+
cachedChildren.value = children;
|
|
14
|
+
}
|
|
15
|
+
return cachedChildren.value;
|
|
9
16
|
};
|
|
10
17
|
}, {
|
|
11
18
|
props: {
|
|
12
19
|
cache: {
|
|
13
20
|
type: Boolean,
|
|
14
|
-
required:
|
|
21
|
+
required: false,
|
|
15
22
|
default: void 0
|
|
16
23
|
}
|
|
17
24
|
},
|
|
18
25
|
name: "PopupContext"
|
|
19
26
|
});
|
|
20
27
|
export {
|
|
21
|
-
|
|
28
|
+
PopupContent as default
|
|
22
29
|
};
|