@conecli/cone-render 0.8.17 → 0.8.18-beta.1

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.
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  inViewCallback
3
2
  if (isH5AndJdShopView) {
4
3
  useEffect(() => {
5
4
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
6
5
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
7
6
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
8
7
  !componentShowStateRef.current && dealPageScrollInfo(res)
9
8
  })
10
9
  }, [])
11
10
  useEffect(() => {
12
11
  if(componentShowState){
13
12
  typeof inViewCallback === 'function' && inViewCallback()
14
13
  console.log('InViewRender -- 店铺H5 展示啦!')
15
14
  }
16
15
  }, [componentShowState])
17
16
 
18
17
  const dealPageScrollInfo = (res) => {
19
18
  if (componentLazyRef.current) {
20
19
  const eleClientRect =
21
20
  componentLazyRef.current.getBoundingClientRect()
22
21
  const getContainerHeightOffSetY = res.displayHeight + res.offSetY
23
22
  const eleOffsetTop = Math.ceil(eleClientRect.top)
24
23
  if (!componentShowStateRef.current) {
25
24
  if (getContainerHeightOffSetY > eleOffsetTop) {
26
25
  componentShowStateRef.current = true
27
26
  setComponentShowState(true)
28
27
  Taro.nextTick(() => {
29
28
  setComponentRenderShowState(true)
30
29
  })
31
30
  }
32
31
  }
33
32
  }
34
33
  }
35
34
  return (
36
35
  <View
37
36
  ref={componentLazyRef}
38
37
  className={classNames(
39
38
  lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
40
39
  'd-app-floor-lazy-load',
41
40
  )}
42
41
  style={{
43
42
  minHeight: `${
44
43
  componentRenderShowState ? 'auto' : height + (typeof height === 'number'? 'px': '')
45
44
  }`,
46
45
  backgroundColor: componentRenderShowState
47
46
  ? 'transparent'
48
47
  : '#ffffff',
49
48
  }}
50
49
  >
51
50
  {componentShowState ? children : placeholder}
52
51
  </View>
53
52
  )
54
53
  } else {
55
54
  const rootDom = document.querySelector('#J_shopHomeRoot')
56
55
  const { ref, inView } = useInView({
57
56
  threshold: 0,
58
57
  triggerOnce: true,
59
58
  root: rootDom,
60
59
  rootMargin: `0px 0px 0px 0px`,
61
60
  })
62
61
  useEffect(() => {
63
62
  if(inView){
64
63
  typeof inViewCallback === 'function' && inViewCallback()
65
64
  console.log('InViewRender -- 其它H5 展示啦!')
66
65
  }
67
66
  }, [inView])
68
67
  return (
69
68
  <View
70
69
  ref={ref}
71
70
  style={{
72
71
  minHeight: `${inView ? 'auto' : height + 'px'}`,
73
72
  backgroundColor: 'transparent',
74
73
  }}
75
74
  >
76
75
  {inView ? children : placeholder}
77
76
  </View>
78
77
  )
79
78
  }
80
79
  inViewCallback: null,
80
+ import Taro from '@tarojs/taro'
81
81
  TaroEventType,
82
82
  const {
83
83
  children,
84
84
  placeholder,
85
85
  height,
86
86
  inViewCallback
87
87
  } = props
88
88
  const [componentShowState, setComponentShowState] = useState(false)
89
89
  const [componentRenderShowState, setComponentRenderShowState] =
90
90
  useState(false)
91
91
  const componentLazyRef = useRef<HTMLElement | null>(null)
92
92
  const componentShowStateRef = useRef(false)
93
93
  if (isH5AndJdShopView) {
94
94
  useEffect(() => {
95
95
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
96
96
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
97
97
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
98
98
  !componentShowStateRef.current && dealPageScrollInfo(res)
99
99
  })
100
100
  }, [])
101
101
  useEffect(() => {
102
102
  if (componentShowState) {
103
103
  typeof inViewCallback === 'function' && inViewCallback()
104
104
  console.log('InViewRender -- 店铺H5 展示啦!')
105
105
  }
106
106
  }, [componentShowState])
107
107
 
108
108
  const dealPageScrollInfo = (res) => {
109
109
  if (componentLazyRef.current) {
110
110
  const eleClientRect =
111
111
  componentLazyRef.current.getBoundingClientRect()
112
112
  const getContainerHeightOffSetY = res.displayHeight + res.offSetY
113
113
  const eleOffsetTop = Math.ceil(eleClientRect.top)
114
114
  if (!componentShowStateRef.current) {
115
115
  if (getContainerHeightOffSetY > eleOffsetTop) {
116
116
  componentShowStateRef.current = true
117
117
  setComponentShowState(true)
118
118
  Taro.nextTick(() => {
119
119
  setComponentRenderShowState(true)
120
120
  })
121
121
  }
122
122
  }
123
123
  }
124
124
  }
125
125
  return (
126
126
  <View
127
127
  ref={componentLazyRef}
128
128
  className={classNames(
129
129
  lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
130
130
  'd-app-floor-lazy-load',
131
131
  )}
132
132
  style={{
133
133
  minHeight: `${componentRenderShowState ? 'auto' : height + (typeof height === 'number' ? 'px' : '')
134
134
  }`,
135
135
  backgroundColor: componentRenderShowState
136
136
  ? 'transparent'
137
137
  : '#ffffff',
138
138
  }}
139
139
  >
140
140
  {componentShowState ? children : placeholder}
141
141
  </View>
142
142
  )
143
143
  } else {
144
144
  const rootDom = document.querySelector('#J_shopHomeRoot')
145
145
  const { ref, inView } = useInView({
146
146
  threshold: 0,
147
147
  triggerOnce: true,
148
148
  root: rootDom || null,
149
149
  rootMargin: `0px 0px 0px 0px`,
150
150
  })
151
151
  useEffect(() => {
152
152
  if (inView) {
153
153
  typeof inViewCallback === 'function' && inViewCallback()
154
154
  console.log('InViewRender -- 其它H5 展示啦!')
155
155
  }
156
156
  }, [inView])
157
157
  return (
158
158
  <View
159
159
  ref={ref}
160
160
  style={{
161
161
  minHeight: `${inView ? 'auto' : height + 'px'}`,
162
162
  backgroundColor: 'transparent',
163
163
  }}
164
164
  >
165
165
  {inView ? children : placeholder}
166
166
  </View>
167
167
  )
168
168
  }
169
169
  children: null,
170
170
  placeholder: null,
171
171
  height: 1,
172
172
  className: '',
173
173
  lazyNodeClassName: '',
174
174
  inViewCallback: null,
@@ -1 +1 @@
1
- import { View, Text } from '@tarojs/components'
1
+ import { View, Text } from '@tarojs/components'
@@ -1 +1 @@
1
- import { View, Text } from '@tarojs/components'
1
+ import { View, Text } from '@tarojs/components'
@@ -1 +1 @@
1
- import React from 'react'
2
1
  containerIndex?: number
3
2
  containerData?: any
4
3
  shopTotalInfo?: any
5
4
  selectContainerFn?: Function
6
5
  selectContainerId?: string
7
6
  placeHolderPreContainerId?: string
8
7
  children?: any
9
8
  style?: {
10
9
  [key: string]: any
11
10
  };
12
11
  layoutLeftRightMargin?: number
13
12
  }
13
+ import React from 'react'
14
14
  containerIndex?: number
15
15
  containerData?: any
16
16
  shopTotalInfo?: any
17
17
  selectContainerFn?: Function
18
18
  selectContainerId?: string
19
19
  placeHolderPreContainerId?: string
20
20
  children?: any
21
21
  style?: {
22
22
  [key: string]: any
23
23
  };
24
24
  layoutLeftRightMargin?: number
25
25
  }
@@ -1 +1 @@
1
- export declare namespace JumpEventReportInterFace {
1
+ export declare namespace JumpEventReportInterFace {
2
2
  export interface ShopIdsInfo {
3
3
  shopId?: number | string
4
4
  venderId?: number | string
5
5
  logEventInfo?: object
6
6
  type?: string
7
7
  }
8
8
  export interface RouterInfo {
9
9
  params: any
10
10
  pageParamStr?: string
11
11
  [key: string]: any
12
12
  }
13
13
  export interface JumpMiniPath {
14
14
  shop: string
15
15
  shopx: string
16
16
  detail: string
17
17
  searchCoupon: string
18
18
  h5: string
19
19
  jingGouHome: string
20
20
  shopFans: string
21
21
  shopLight: string
22
22
  couponSearch: string
23
23
  }
24
24
  export interface jumpWebUrl {
25
25
  mshop: string
26
26
  pages: string
27
27
  couponSearch: string
28
28
  shopSecondActivity: string
29
29
  shopLight: string
30
30
  detail: string
31
31
  mobileHome: string
32
32
  rank: string
33
33
  wqShopMember: string
34
34
  wqShopDetail: string
35
35
  wqShopSearch: string
36
36
  shopMember: string
37
37
  shopMemberPointDetail: string
38
38
  shopMemberBenefit: string
39
39
  shopMemberRule: string
40
40
  shopMemberCloseAccount: string
41
41
  shopMemberPointExchange: string
42
42
  shopMemberBonusPurchase: string
43
43
  shopMemberGood: string
44
44
  beanDetail: string
45
45
  totalPromotion: string
46
46
  mLive: string
47
47
  shopHome: string
48
48
  shopIntroduce: string
49
49
  shopSearch: string
50
50
  shopLottery: string
51
51
  shopCoupon: string
52
52
  shopWares: string
53
53
  shopFastShopping: string
54
54
  shopSpeciSeckill: string
55
55
  shopVideos: string
56
56
  shopUseShareOrderUgcContent: string
57
57
  dongDongChat: string
58
58
  samCenter: string
59
59
  samCard: string
60
60
  }
61
61
  export interface EventReportConfig {
62
62
  routerInfo: RouterInfo
63
63
  nativeEvent: any
64
64
  }
65
65
  export interface OptEventLogParams {
66
66
  eventId?: string
67
67
  eventParam?: string | object
68
68
  pTag?: string
69
69
  jsonParam?: {
70
70
  [key: string]: any
71
71
  }
72
72
  skuId?: string | number
73
73
  eventLevel?: string
74
74
  exposureState?: boolean
75
75
  otherParams?: object
76
76
  }
77
77
 
78
78
  export interface JumpH5ReportConfig {
79
79
  shopId?: number | string
80
80
  venderId?: number | string
81
81
  sourceValue?: string
82
82
  sourceType?: string
83
83
  }
84
84
  export interface JumpEventReportInit extends EventReportConfig {
85
85
  getConfig(opt): EventReportConfig
86
86
  updateInfo(routerInfo, logPname): void
87
87
  }
88
88
  export interface CouponUrlParams {
89
89
  batchId: number
90
90
  bindType: number
91
91
  startTime?: number
92
92
  endTime?: number
93
93
  quangoufrom?: number
94
94
  sceneId?: number
95
95
  }
96
96
  export interface JdMiniJumpParams {
97
97
  param: string | object
98
98
  sourceValue: string
99
99
  sourceType: string
100
100
  des?: any
101
101
  logEventInfo?: object
102
102
  }
103
103
  export interface LinkMiniParams {
104
104
  param?: {
105
105
  pageType?: string
106
106
  }
107
107
  appId?: string | number
108
108
  path?: string
109
109
  }
110
110
  export interface JdJumpWxappReportConfig {
111
111
  wxApiVersion: string
112
112
  wxApiUrl: string
113
113
  wqReportUrl: string
114
114
  }
@@ -1 +1 @@
1
- import { ComponentInterFace } from './component'
2
1
  mobileLogin: string
2
+ import { ComponentInterFace } from './component'
3
3
  mobileLogin: string