@conecli/cone-render 0.8.15-videoAndInView.3 → 0.8.16
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/components/base/CommonFloorHead/index.module.scss +2 -0
- package/dist/components/base/InViewRender/index.tsx +1 -1
- package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/open/components/index.ts +1 -1
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/package.json +1 -1
- package/dist/components/base/CustomVideo/index.module.scss +0 -66
- package/dist/components/base/CustomVideo/index.tsx +0 -1
- package/dist/components/base/InOrOutViewObserver/index.module.scss +0 -0
- package/dist/components/base/InOrOutViewObserver/index.tsx +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
TaroEventType,
|
|
3
2
|
const {
|
|
4
3
|
children,
|
|
5
4
|
placeholder,
|
|
6
5
|
height,
|
|
7
6
|
inViewCallback
|
|
8
7
|
} = props
|
|
9
8
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
10
9
|
const [componentRenderShowState, setComponentRenderShowState] =
|
|
11
10
|
useState(false)
|
|
12
11
|
const componentLazyRef = useRef<HTMLElement | null>(null)
|
|
13
12
|
const componentShowStateRef = useRef(false)
|
|
14
13
|
if (isH5AndJdShopView) {
|
|
15
14
|
useEffect(() => {
|
|
16
15
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
17
16
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
18
17
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
19
18
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
20
19
|
})
|
|
21
20
|
}, [])
|
|
22
21
|
useEffect(() => {
|
|
23
22
|
if (componentShowState) {
|
|
24
23
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
25
24
|
console.log('InViewRender -- 店铺H5 展示啦!')
|
|
26
25
|
}
|
|
27
26
|
}, [componentShowState])
|
|
28
27
|
|
|
29
28
|
const dealPageScrollInfo = (res) => {
|
|
30
29
|
if (componentLazyRef.current) {
|
|
31
30
|
const eleClientRect =
|
|
32
31
|
componentLazyRef.current.getBoundingClientRect()
|
|
33
32
|
const getContainerHeightOffSetY = res.displayHeight + res.offSetY
|
|
34
33
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
35
34
|
if (!componentShowStateRef.current) {
|
|
36
35
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
37
36
|
componentShowStateRef.current = true
|
|
38
37
|
setComponentShowState(true)
|
|
39
38
|
Taro.nextTick(() => {
|
|
40
39
|
setComponentRenderShowState(true)
|
|
41
40
|
})
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
return (
|
|
47
46
|
<View
|
|
48
47
|
ref={componentLazyRef}
|
|
49
48
|
className={classNames(
|
|
50
49
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
51
50
|
'd-app-floor-lazy-load',
|
|
52
51
|
)}
|
|
53
52
|
style={{
|
|
54
53
|
minHeight: `${componentRenderShowState ? 'auto' : height + (typeof height === 'number' ? 'px' : '')
|
|
55
54
|
}`,
|
|
56
55
|
backgroundColor: componentRenderShowState
|
|
57
56
|
? 'transparent'
|
|
58
57
|
: '#ffffff',
|
|
59
58
|
}}
|
|
60
59
|
>
|
|
61
60
|
{componentShowState ? children : placeholder}
|
|
62
61
|
</View>
|
|
63
62
|
)
|
|
64
63
|
} else {
|
|
65
64
|
const rootDom = document.querySelector('#J_shopHomeRoot')
|
|
66
65
|
const { ref, inView } = useInView({
|
|
67
66
|
threshold: 0,
|
|
68
67
|
triggerOnce: true,
|
|
69
68
|
root: rootDom || null,
|
|
70
69
|
rootMargin: `0px 0px 0px 0px`,
|
|
71
70
|
})
|
|
72
71
|
useEffect(() => {
|
|
73
72
|
if (inView) {
|
|
74
73
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
75
74
|
console.log('InViewRender -- 其它H5 展示啦!')
|
|
76
75
|
}
|
|
77
76
|
}, [inView])
|
|
78
77
|
return (
|
|
79
78
|
<View
|
|
80
79
|
ref={ref}
|
|
81
80
|
style={{
|
|
82
81
|
minHeight: `${inView ? 'auto' : height + 'px'}`,
|
|
83
82
|
backgroundColor: 'transparent',
|
|
84
83
|
}}
|
|
85
84
|
>
|
|
86
85
|
{inView ? children : placeholder}
|
|
87
86
|
</View>
|
|
88
87
|
)
|
|
89
88
|
}
|
|
90
89
|
children: null,
|
|
91
90
|
placeholder: null,
|
|
92
91
|
height: 1,
|
|
93
92
|
className: '',
|
|
94
93
|
lazyNodeClassName: '',
|
|
95
94
|
inViewCallback: null,
|
|
95
|
+
import Taro from '@tarojs/taro'
|
|
96
96
|
inViewCallback
|
|
97
97
|
if (isH5AndJdShopView) {
|
|
98
98
|
useEffect(() => {
|
|
99
99
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
100
100
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
101
101
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
102
102
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
103
103
|
})
|
|
104
104
|
}, [])
|
|
105
105
|
useEffect(() => {
|
|
106
106
|
if(componentShowState){
|
|
107
107
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
108
108
|
console.log('InViewRender -- 店铺H5 展示啦!')
|
|
109
109
|
}
|
|
110
110
|
}, [componentShowState])
|
|
111
111
|
|
|
112
112
|
const dealPageScrollInfo = (res) => {
|
|
113
113
|
if (componentLazyRef.current) {
|
|
114
114
|
const eleClientRect =
|
|
115
115
|
componentLazyRef.current.getBoundingClientRect()
|
|
116
116
|
const getContainerHeightOffSetY = res.displayHeight + res.offSetY
|
|
117
117
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
118
118
|
if (!componentShowStateRef.current) {
|
|
119
119
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
120
120
|
componentShowStateRef.current = true
|
|
121
121
|
setComponentShowState(true)
|
|
122
122
|
Taro.nextTick(() => {
|
|
123
123
|
setComponentRenderShowState(true)
|
|
124
124
|
})
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
return (
|
|
130
130
|
<View
|
|
131
131
|
ref={componentLazyRef}
|
|
132
132
|
className={classNames(
|
|
133
133
|
lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
|
|
134
134
|
'd-app-floor-lazy-load',
|
|
135
135
|
)}
|
|
136
136
|
style={{
|
|
137
137
|
minHeight: `${
|
|
138
138
|
componentRenderShowState ? 'auto' : height + (typeof height === 'number'? 'px': '')
|
|
139
139
|
}`,
|
|
140
140
|
backgroundColor: componentRenderShowState
|
|
141
141
|
? 'transparent'
|
|
142
142
|
: '#ffffff',
|
|
143
143
|
}}
|
|
144
144
|
>
|
|
145
145
|
{componentShowState ? children : placeholder}
|
|
146
146
|
</View>
|
|
147
147
|
)
|
|
148
148
|
} else {
|
|
149
149
|
const rootDom = document.querySelector('#J_shopHomeRoot')
|
|
150
150
|
const { ref, inView } = useInView({
|
|
151
151
|
threshold: 0,
|
|
152
152
|
triggerOnce: true,
|
|
153
153
|
root: rootDom,
|
|
154
154
|
rootMargin: `0px 0px 0px 0px`,
|
|
155
155
|
})
|
|
156
156
|
useEffect(() => {
|
|
157
157
|
if(inView){
|
|
158
158
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
159
159
|
console.log('InViewRender -- 其它H5 展示啦!')
|
|
160
160
|
}
|
|
161
161
|
}, [inView])
|
|
162
162
|
return (
|
|
163
163
|
<View
|
|
164
164
|
ref={ref}
|
|
165
165
|
style={{
|
|
166
166
|
minHeight: `${inView ? 'auto' : height + 'px'}`,
|
|
167
167
|
backgroundColor: 'transparent',
|
|
168
168
|
}}
|
|
169
169
|
>
|
|
170
170
|
{inView ? children : placeholder}
|
|
171
171
|
</View>
|
|
172
172
|
)
|
|
173
173
|
}
|
|
174
174
|
inViewCallback: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import { View } from '@tarojs/components'
|
|
1
|
+
import { View } from '@tarojs/components'
|
|
2
2
|
selectContainerId,
|
|
3
3
|
placeHolderPreContainerId,
|
|
4
4
|
containerData,
|
|
5
5
|
children,
|
|
6
6
|
style,
|
|
7
7
|
shopTotalInfo,
|
|
8
8
|
} = props;
|
|
9
9
|
return children ? children : null;
|
|
10
10
|
}, [containerData, shopTotalInfo]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React from 'react'
|
|
2
2
|
containerIndex?: number
|
|
3
3
|
containerData?: any
|
|
4
4
|
shopTotalInfo?: any
|
|
5
5
|
selectContainerFn?: Function
|
|
6
6
|
selectContainerId?: string
|
|
7
7
|
placeHolderPreContainerId?: string
|
|
8
8
|
children?: any
|
|
9
9
|
style?: {
|
|
10
10
|
[key: string]: any
|
|
11
11
|
};
|
|
12
12
|
layoutLeftRightMargin?: number
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = {
|
|
3
2
|
displayHeight: 1920,
|
|
4
3
|
offSetY: 0
|
|
5
4
|
}
|
|
6
5
|
console.log('>>>>>>>>>>>>>>>>>>> render taroEventSendPageScrollInfo origin time:', Date.now(), 'res:', options)
|
|
7
6
|
if(options){
|
|
8
7
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = options
|
|
9
8
|
}
|
|
10
9
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
10
|
+
import Taro from '@tarojs/taro'
|
|
11
11
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = {
|
|
12
12
|
displayHeight: 1920,
|
|
13
13
|
offSetY: 0
|
|
14
14
|
}
|
|
15
15
|
console.log('>>>>>>>>>>>>>>>>>>> render taroEventSendPageScrollInfo origin time:', Date.now(), 'res:', options)
|
|
16
16
|
if(options){
|
|
17
17
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = options
|
|
18
18
|
}
|
|
19
19
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
package/package.json
CHANGED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
.d-video-wrap{
|
|
2
|
-
position: relative;
|
|
3
|
-
overflow: hidden;
|
|
4
|
-
|
|
5
|
-
.d-video-play {
|
|
6
|
-
display: block;
|
|
7
|
-
overflow: hidden;
|
|
8
|
-
width: 100%;
|
|
9
|
-
height: 100%;
|
|
10
|
-
background-color: transparent;
|
|
11
|
-
-webkit-backface-visibility: hidden;
|
|
12
|
-
-webkit-transform: translate3d(0, 0, 0);
|
|
13
|
-
object-fit: fill;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.d-video-mute-btn{
|
|
17
|
-
position: absolute;
|
|
18
|
-
width: 51px;
|
|
19
|
-
height: 51px;
|
|
20
|
-
background-repeat: no-repeat;
|
|
21
|
-
background-position: 50% 50%;
|
|
22
|
-
background-size: 50%;
|
|
23
|
-
}
|
|
24
|
-
.d-mute-btn-topLeft{
|
|
25
|
-
left: 10px;
|
|
26
|
-
top: 10px;
|
|
27
|
-
}
|
|
28
|
-
.d-mute-btn-topRight{
|
|
29
|
-
right: 10px;
|
|
30
|
-
top: 10px;
|
|
31
|
-
}
|
|
32
|
-
.d-mute-btn-bottomLeft{
|
|
33
|
-
left: 10px;
|
|
34
|
-
bottom: 10px;
|
|
35
|
-
}
|
|
36
|
-
.d-mute-btn-bottomRight{
|
|
37
|
-
right: 10px;
|
|
38
|
-
bottom: 10px;
|
|
39
|
-
}
|
|
40
|
-
.d-is-muted{
|
|
41
|
-
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhE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+piiXHzAOmtPx9gXgug8itQx9SXwDpw47AGKXZWvXvQmNFCwE3gCXA2dY0Az4GrRzHONA9cU/vAbERsllEOyh31e8USV2mrMPdG9uyn+rDom2/BHHCm5puWKiKmgdtAnz+rvaxO5mNygEvHaZ5BfADuARvAaWBpP4DGFBHfgBngFzClTrUKkCDeA+9S837rAEnbqb7VFcCpVJ/oCmCw959aB1AfAROpudYqgDoOLKRmPyLelAF8bcD4pPoMeAtcB34AT4uDBqXXwFG8XXUU/72MIuK1OgE8Bs6l7mEvo8up7lN1Ge0n9aK6VHMFZvJTr9S3CiALaCQhqZOSvegMIAvu2UVSWpigLC1fbQ0gm6in7qpfLCQbhwGIYcyPQ53/G3YO8BtUtd35bvKcVwAAAABJRU5ErkJggg==");
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.d-video-play-btn{
|
|
48
|
-
position: absolute;
|
|
49
|
-
width: 120px;
|
|
50
|
-
height: 120px;
|
|
51
|
-
background-repeat: no-repeat;
|
|
52
|
-
background-position: 50% 50%;
|
|
53
|
-
background-size: 50%;
|
|
54
|
-
top: 50%;
|
|
55
|
-
left: 50%;
|
|
56
|
-
transform: translateX(-50%) translateY(-50%);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.d-is-pause{
|
|
60
|
-
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAeCAYAAAAy2w7YAAAAAXNSR0IArs4c6QAAAWhJREFUSA1j+P///0cgBoHjQGzCQCsAtgJB/AMy5wCxGNXtQ9iBwvoA5BUCMQvVLEQxHpNzDSjkRhXLMM3GKrIeKKpEkYVYjcUu+AMo3ALE3GRZiN1MvKKPgbIRJFuG10j8koeA0gZEW4jfLIKyf4EqpgOxMEELCRpFnIJ3QGU5QMyM00LizCFa1SWgSkeslhFtBGkKVwGVy6FYSJp+klR/A6quB2JOkIWMIK0oNlOf8xBoZDE9LAI7nYn6HsBq4l96WHQEaLUpAyiOaASeAM2NgvuPBpaACt82IEYtfKls0UagecpwXyAzqGTRdaA57sjmYrAptAjUsCkGYlYMg9EFyLQI1IiZB8Ti6Obh5JNh0QmgHlOcBuKSIMGi50C18UDMiMssvOJEWPQLqKYbiHnxGkRIkoBF24DyaoTMIEoeh0W3geI+RBlArCI0iz4D+RVAzEasfqLVAQ19AcSg5LoYiKWI1kiiQgCMBLnEEcfDSgAAAABJRU5ErkJggg==");
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.d-not-pause{
|
|
64
|
-
background-image: none;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef, useState, useImperativeHandle } from 'react'
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
|
TaroEventType,
|
|
3
1
|
const {
|
|
4
2
|
children,
|
|
5
3
|
inViewCallback,
|
|
6
4
|
outViewCallback,
|
|
7
5
|
threshold
|
|
8
6
|
} = props
|
|
9
7
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
10
8
|
const componentObserverRef = useRef<HTMLElement | null>(null)
|
|
11
9
|
const componentShowStateRef = useRef(false)
|
|
12
10
|
if (isH5AndJdShopView) {
|
|
13
11
|
useEffect(() => {
|
|
14
12
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
15
13
|
dealPageScrollInfo(latestRes)
|
|
16
14
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
17
15
|
dealPageScrollInfo(res)
|
|
18
16
|
})
|
|
19
17
|
Taro.eventCenter.on(TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE, (state) => {
|
|
20
18
|
state === 0 && handleInOrOutView(false)
|
|
21
19
|
})
|
|
22
20
|
}, [])
|
|
23
21
|
useEffect(() => {
|
|
24
22
|
if (componentShowState) {
|
|
25
23
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
26
24
|
console.log('app=>in可视区域')
|
|
27
25
|
} else {
|
|
28
26
|
typeof outViewCallback === 'function' && outViewCallback()
|
|
29
27
|
console.log('app=>out可视区域')
|
|
30
28
|
}
|
|
31
29
|
}, [componentShowState])
|
|
32
30
|
|
|
33
31
|
const handleInOrOutView = (type: boolean) => {
|
|
34
32
|
componentShowStateRef.current = type
|
|
35
33
|
setComponentShowState(type)
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
const dealPageScrollInfo = (res) => {
|
|
39
37
|
const { displayHeight, offSetY } = res
|
|
40
38
|
if (componentObserverRef.current) {
|
|
41
39
|
const eleClientRect =
|
|
42
40
|
componentObserverRef.current.getBoundingClientRect()
|
|
43
41
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
44
42
|
const eleHeight = Math.ceil(eleClientRect.height)
|
|
45
43
|
console.log('==========================eleOffsetTop, eleHeight', eleOffsetTop, eleHeight)
|
|
46
44
|
if (eleOffsetTop >= 0 && eleOffsetTop < displayHeight) {
|
|
47
45
|
const isOutView = offSetY > eleOffsetTop + Math.ceil(eleHeight * (1 - threshold))
|
|
48
46
|
handleInOrOutView(isOutView ? false : true)
|
|
49
47
|
} else {
|
|
50
48
|
const isInView = (offSetY > eleOffsetTop - displayHeight + Math.ceil(eleHeight * threshold)) && (offSetY < eleOffsetTop + Math.ceil(eleHeight * (1 - threshold)))
|
|
51
49
|
handleInOrOutView(isInView ? true : false)
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
return (
|
|
56
54
|
<View ref={componentObserverRef}>
|
|
57
55
|
{children}
|
|
58
56
|
</View>
|
|
59
57
|
)
|
|
60
58
|
} else {
|
|
61
59
|
const rootDom = document.querySelector('#J_shopHomeRoot')
|
|
62
60
|
const { ref, inView } = useInView({
|
|
63
61
|
threshold,
|
|
64
62
|
triggerOnce: false,
|
|
65
63
|
root: rootDom || null,
|
|
66
64
|
rootMargin: `0px 0px 0px 0px`,
|
|
67
65
|
})
|
|
68
66
|
useEffect(() => {
|
|
69
67
|
if (inView) {
|
|
70
68
|
typeof inViewCallback === 'function' && inViewCallback()
|
|
71
69
|
console.log('其他h5=>in可视区域')
|
|
72
70
|
} else {
|
|
73
71
|
typeof outViewCallback === 'function' && outViewCallback()
|
|
74
72
|
console.log('其他h5=>out可视区域')
|
|
75
73
|
}
|
|
76
74
|
}, [inView])
|
|
77
75
|
return (
|
|
78
76
|
<View ref={ref}>
|
|
79
77
|
{children}
|
|
80
78
|
</View>
|
|
81
79
|
)
|
|
82
80
|
}
|
|
83
81
|
children: null,
|
|
84
82
|
className: '',
|
|
85
83
|
inViewCallback: null,
|
|
86
84
|
outViewCallback: null,
|
|
87
85
|
threshold: 0
|