@v-c/trigger 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/Popup/Arrow.cjs +60 -89
- package/dist/Popup/Arrow.js +58 -88
- package/dist/Popup/Mask.cjs +53 -64
- package/dist/Popup/Mask.js +49 -63
- package/dist/Popup/PopupContent.cjs +22 -27
- package/dist/Popup/PopupContent.js +18 -26
- package/dist/Popup/index.cjs +312 -366
- package/dist/Popup/index.d.ts +1 -1
- package/dist/Popup/index.js +304 -362
- package/dist/UniqueProvider/UniqueContainer.cjs +133 -150
- package/dist/UniqueProvider/UniqueContainer.js +128 -148
- package/dist/UniqueProvider/index.cjs +151 -213
- package/dist/UniqueProvider/index.js +144 -210
- package/dist/UniqueProvider/useTargetState.cjs +39 -39
- package/dist/UniqueProvider/useTargetState.js +37 -39
- package/dist/_virtual/rolldown_runtime.cjs +21 -0
- package/dist/context.cjs +17 -28
- package/dist/context.js +17 -33
- package/dist/hooks/useAction.cjs +19 -25
- package/dist/hooks/useAction.js +17 -25
- package/dist/hooks/useAlign.cjs +396 -486
- package/dist/hooks/useAlign.js +391 -484
- package/dist/hooks/useDelay.cjs +21 -24
- package/dist/hooks/useDelay.js +20 -25
- package/dist/hooks/useOffsetStyle.cjs +34 -33
- package/dist/hooks/useOffsetStyle.js +32 -33
- package/dist/hooks/useWatch.cjs +38 -34
- package/dist/hooks/useWatch.js +36 -34
- package/dist/hooks/useWinClick.cjs +54 -64
- package/dist/hooks/useWinClick.js +51 -63
- package/dist/index.cjs +605 -694
- package/dist/index.d.ts +1 -1
- package/dist/index.js +593 -689
- package/dist/interface.cjs +0 -1
- package/dist/interface.js +0 -1
- package/dist/util.cjs +65 -82
- package/dist/util.js +66 -87
- package/package.json +4 -4
|
@@ -1,150 +1,133 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
type: Object,
|
|
135
|
-
required: false,
|
|
136
|
-
default: void 0
|
|
137
|
-
},
|
|
138
|
-
uniqueContainerClassName: {
|
|
139
|
-
type: String,
|
|
140
|
-
required: false,
|
|
141
|
-
default: void 0
|
|
142
|
-
},
|
|
143
|
-
uniqueContainerStyle: {
|
|
144
|
-
type: null,
|
|
145
|
-
required: false,
|
|
146
|
-
default: void 0
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
exports.default = UniqueContainer;
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
3
|
+
const require_useOffsetStyle = require("../hooks/useOffsetStyle.cjs");
|
|
4
|
+
let vue = require("vue");
|
|
5
|
+
let __v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
6
|
+
let __v_c_util_dist_utils_transition = require("@v-c/util/dist/utils/transition");
|
|
7
|
+
var UniqueContainer = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
|
|
8
|
+
const motionVisible = (0, vue.shallowRef)(false);
|
|
9
|
+
const { open, isMobile, align, ready, offsetR, offsetB, offsetX, offsetY } = (0, __v_c_util_dist_props_util.toPropsRefs)(props, "open", "isMobile", "align", "ready", "offsetR", "offsetB", "offsetX", "offsetY");
|
|
10
|
+
const offsetStyle = require_useOffsetStyle.default(isMobile, ready, open, align, offsetR, offsetB, offsetX, offsetY);
|
|
11
|
+
const cachedOffsetStyleRef = (0, vue.shallowRef)(offsetStyle.value);
|
|
12
|
+
(0, vue.watchEffect)(() => {
|
|
13
|
+
if (ready.value) cachedOffsetStyleRef.value = offsetStyle.value;
|
|
14
|
+
});
|
|
15
|
+
(0, vue.watch)(open, async (nextVisible) => {
|
|
16
|
+
await (0, vue.nextTick)();
|
|
17
|
+
if (nextVisible) motionVisible.value = true;
|
|
18
|
+
});
|
|
19
|
+
return () => {
|
|
20
|
+
const { popupSize, motion, prefixCls, uniqueContainerClassName, arrowPos, uniqueContainerStyle } = props;
|
|
21
|
+
const sizeStyle = {};
|
|
22
|
+
if (popupSize) {
|
|
23
|
+
sizeStyle.width = `${popupSize.width}px`;
|
|
24
|
+
sizeStyle.height = `${popupSize.height}px`;
|
|
25
|
+
}
|
|
26
|
+
const baseTransitionProps = (0, __v_c_util_dist_utils_transition.getTransitionProps)(motion?.name, motion);
|
|
27
|
+
const mergedTransitionProps = {
|
|
28
|
+
...baseTransitionProps,
|
|
29
|
+
onBeforeEnter: (element) => {
|
|
30
|
+
motionVisible.value = true;
|
|
31
|
+
baseTransitionProps.onBeforeEnter?.(element);
|
|
32
|
+
},
|
|
33
|
+
onAfterEnter: (element) => {
|
|
34
|
+
motionVisible.value = true;
|
|
35
|
+
baseTransitionProps.onAfterEnter?.(element);
|
|
36
|
+
},
|
|
37
|
+
onAfterLeave: (element) => {
|
|
38
|
+
motionVisible.value = false;
|
|
39
|
+
baseTransitionProps.onAfterLeave?.(element);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const containerCls = `${prefixCls}-unique-container`;
|
|
43
|
+
return (0, vue.createVNode)(vue.Transition, mergedTransitionProps, { default: () => [(0, vue.withDirectives)((0, vue.createVNode)("div", {
|
|
44
|
+
"class": [
|
|
45
|
+
containerCls,
|
|
46
|
+
uniqueContainerClassName,
|
|
47
|
+
{ [`${containerCls}-visible`]: motionVisible.value }
|
|
48
|
+
],
|
|
49
|
+
"style": [
|
|
50
|
+
{
|
|
51
|
+
"--arrow-x": `${arrowPos?.x || 0}px`,
|
|
52
|
+
"--arrow-y": `${arrowPos?.y || 0}px`
|
|
53
|
+
},
|
|
54
|
+
cachedOffsetStyleRef.value,
|
|
55
|
+
sizeStyle,
|
|
56
|
+
uniqueContainerStyle
|
|
57
|
+
]
|
|
58
|
+
}, null), [[vue.vShow, open.value]])] });
|
|
59
|
+
};
|
|
60
|
+
}, { props: {
|
|
61
|
+
prefixCls: {
|
|
62
|
+
type: String,
|
|
63
|
+
required: true,
|
|
64
|
+
default: void 0
|
|
65
|
+
},
|
|
66
|
+
isMobile: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
required: true,
|
|
69
|
+
default: void 0
|
|
70
|
+
},
|
|
71
|
+
ready: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
required: true,
|
|
74
|
+
default: void 0
|
|
75
|
+
},
|
|
76
|
+
open: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
required: true,
|
|
79
|
+
default: void 0
|
|
80
|
+
},
|
|
81
|
+
align: {
|
|
82
|
+
type: Object,
|
|
83
|
+
required: true,
|
|
84
|
+
default: void 0
|
|
85
|
+
},
|
|
86
|
+
offsetR: {
|
|
87
|
+
type: Number,
|
|
88
|
+
required: true,
|
|
89
|
+
default: void 0
|
|
90
|
+
},
|
|
91
|
+
offsetB: {
|
|
92
|
+
type: Number,
|
|
93
|
+
required: true,
|
|
94
|
+
default: void 0
|
|
95
|
+
},
|
|
96
|
+
offsetX: {
|
|
97
|
+
type: Number,
|
|
98
|
+
required: true,
|
|
99
|
+
default: void 0
|
|
100
|
+
},
|
|
101
|
+
offsetY: {
|
|
102
|
+
type: Number,
|
|
103
|
+
required: true,
|
|
104
|
+
default: void 0
|
|
105
|
+
},
|
|
106
|
+
arrowPos: {
|
|
107
|
+
type: Object,
|
|
108
|
+
required: false,
|
|
109
|
+
default: void 0
|
|
110
|
+
},
|
|
111
|
+
popupSize: {
|
|
112
|
+
type: Object,
|
|
113
|
+
required: false,
|
|
114
|
+
default: void 0
|
|
115
|
+
},
|
|
116
|
+
motion: {
|
|
117
|
+
type: Object,
|
|
118
|
+
required: false,
|
|
119
|
+
default: void 0
|
|
120
|
+
},
|
|
121
|
+
uniqueContainerClassName: {
|
|
122
|
+
type: String,
|
|
123
|
+
required: false,
|
|
124
|
+
default: void 0
|
|
125
|
+
},
|
|
126
|
+
uniqueContainerStyle: {
|
|
127
|
+
type: null,
|
|
128
|
+
required: false,
|
|
129
|
+
default: void 0
|
|
130
|
+
}
|
|
131
|
+
} });
|
|
132
|
+
var UniqueContainer_default = UniqueContainer;
|
|
133
|
+
exports.default = UniqueContainer_default;
|
|
@@ -1,150 +1,130 @@
|
|
|
1
|
-
import
|
|
1
|
+
import useOffsetStyle from "../hooks/useOffsetStyle.js";
|
|
2
|
+
import { Transition, createVNode, defineComponent, nextTick, shallowRef, vShow, watch, watchEffect, withDirectives } from "vue";
|
|
2
3
|
import { toPropsRefs } from "@v-c/util/dist/props-util";
|
|
3
4
|
import { getTransitionProps } from "@v-c/util/dist/utils/transition";
|
|
4
|
-
|
|
5
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
motion: {
|
|
132
|
-
type: Object,
|
|
133
|
-
required: false,
|
|
134
|
-
default: void 0
|
|
135
|
-
},
|
|
136
|
-
uniqueContainerClassName: {
|
|
137
|
-
type: String,
|
|
138
|
-
required: false,
|
|
139
|
-
default: void 0
|
|
140
|
-
},
|
|
141
|
-
uniqueContainerStyle: {
|
|
142
|
-
type: null,
|
|
143
|
-
required: false,
|
|
144
|
-
default: void 0
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
export {
|
|
149
|
-
UniqueContainer as default
|
|
150
|
-
};
|
|
5
|
+
var UniqueContainer_default = /* @__PURE__ */ defineComponent((props) => {
|
|
6
|
+
const motionVisible = shallowRef(false);
|
|
7
|
+
const { open, isMobile, align, ready, offsetR, offsetB, offsetX, offsetY } = toPropsRefs(props, "open", "isMobile", "align", "ready", "offsetR", "offsetB", "offsetX", "offsetY");
|
|
8
|
+
const offsetStyle = useOffsetStyle(isMobile, ready, open, align, offsetR, offsetB, offsetX, offsetY);
|
|
9
|
+
const cachedOffsetStyleRef = shallowRef(offsetStyle.value);
|
|
10
|
+
watchEffect(() => {
|
|
11
|
+
if (ready.value) cachedOffsetStyleRef.value = offsetStyle.value;
|
|
12
|
+
});
|
|
13
|
+
watch(open, async (nextVisible) => {
|
|
14
|
+
await nextTick();
|
|
15
|
+
if (nextVisible) motionVisible.value = true;
|
|
16
|
+
});
|
|
17
|
+
return () => {
|
|
18
|
+
const { popupSize, motion, prefixCls, uniqueContainerClassName, arrowPos, uniqueContainerStyle } = props;
|
|
19
|
+
const sizeStyle = {};
|
|
20
|
+
if (popupSize) {
|
|
21
|
+
sizeStyle.width = `${popupSize.width}px`;
|
|
22
|
+
sizeStyle.height = `${popupSize.height}px`;
|
|
23
|
+
}
|
|
24
|
+
const baseTransitionProps = getTransitionProps(motion?.name, motion);
|
|
25
|
+
const mergedTransitionProps = {
|
|
26
|
+
...baseTransitionProps,
|
|
27
|
+
onBeforeEnter: (element) => {
|
|
28
|
+
motionVisible.value = true;
|
|
29
|
+
baseTransitionProps.onBeforeEnter?.(element);
|
|
30
|
+
},
|
|
31
|
+
onAfterEnter: (element) => {
|
|
32
|
+
motionVisible.value = true;
|
|
33
|
+
baseTransitionProps.onAfterEnter?.(element);
|
|
34
|
+
},
|
|
35
|
+
onAfterLeave: (element) => {
|
|
36
|
+
motionVisible.value = false;
|
|
37
|
+
baseTransitionProps.onAfterLeave?.(element);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const containerCls = `${prefixCls}-unique-container`;
|
|
41
|
+
return createVNode(Transition, mergedTransitionProps, { default: () => [withDirectives(createVNode("div", {
|
|
42
|
+
"class": [
|
|
43
|
+
containerCls,
|
|
44
|
+
uniqueContainerClassName,
|
|
45
|
+
{ [`${containerCls}-visible`]: motionVisible.value }
|
|
46
|
+
],
|
|
47
|
+
"style": [
|
|
48
|
+
{
|
|
49
|
+
"--arrow-x": `${arrowPos?.x || 0}px`,
|
|
50
|
+
"--arrow-y": `${arrowPos?.y || 0}px`
|
|
51
|
+
},
|
|
52
|
+
cachedOffsetStyleRef.value,
|
|
53
|
+
sizeStyle,
|
|
54
|
+
uniqueContainerStyle
|
|
55
|
+
]
|
|
56
|
+
}, null), [[vShow, open.value]])] });
|
|
57
|
+
};
|
|
58
|
+
}, { props: {
|
|
59
|
+
prefixCls: {
|
|
60
|
+
type: String,
|
|
61
|
+
required: true,
|
|
62
|
+
default: void 0
|
|
63
|
+
},
|
|
64
|
+
isMobile: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
required: true,
|
|
67
|
+
default: void 0
|
|
68
|
+
},
|
|
69
|
+
ready: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
required: true,
|
|
72
|
+
default: void 0
|
|
73
|
+
},
|
|
74
|
+
open: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
required: true,
|
|
77
|
+
default: void 0
|
|
78
|
+
},
|
|
79
|
+
align: {
|
|
80
|
+
type: Object,
|
|
81
|
+
required: true,
|
|
82
|
+
default: void 0
|
|
83
|
+
},
|
|
84
|
+
offsetR: {
|
|
85
|
+
type: Number,
|
|
86
|
+
required: true,
|
|
87
|
+
default: void 0
|
|
88
|
+
},
|
|
89
|
+
offsetB: {
|
|
90
|
+
type: Number,
|
|
91
|
+
required: true,
|
|
92
|
+
default: void 0
|
|
93
|
+
},
|
|
94
|
+
offsetX: {
|
|
95
|
+
type: Number,
|
|
96
|
+
required: true,
|
|
97
|
+
default: void 0
|
|
98
|
+
},
|
|
99
|
+
offsetY: {
|
|
100
|
+
type: Number,
|
|
101
|
+
required: true,
|
|
102
|
+
default: void 0
|
|
103
|
+
},
|
|
104
|
+
arrowPos: {
|
|
105
|
+
type: Object,
|
|
106
|
+
required: false,
|
|
107
|
+
default: void 0
|
|
108
|
+
},
|
|
109
|
+
popupSize: {
|
|
110
|
+
type: Object,
|
|
111
|
+
required: false,
|
|
112
|
+
default: void 0
|
|
113
|
+
},
|
|
114
|
+
motion: {
|
|
115
|
+
type: Object,
|
|
116
|
+
required: false,
|
|
117
|
+
default: void 0
|
|
118
|
+
},
|
|
119
|
+
uniqueContainerClassName: {
|
|
120
|
+
type: String,
|
|
121
|
+
required: false,
|
|
122
|
+
default: void 0
|
|
123
|
+
},
|
|
124
|
+
uniqueContainerStyle: {
|
|
125
|
+
type: null,
|
|
126
|
+
required: false,
|
|
127
|
+
default: void 0
|
|
128
|
+
}
|
|
129
|
+
} });
|
|
130
|
+
export { UniqueContainer_default as default };
|