@gm-mobile/c-react 3.10.2 → 3.11.0-beta.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gm-mobile/c-react",
3
- "version": "3.10.2",
3
+ "version": "3.11.0-beta.0",
4
4
  "description": "> TODO: description",
5
5
  "author": "liyatang <liyatang@qq.com>",
6
6
  "homepage": "https://github.com/gmfe/gm-mobile#readme",
@@ -21,9 +21,9 @@
21
21
  "url": "https://github.com/gmfe/gm-mobile/issues"
22
22
  },
23
23
  "dependencies": {
24
- "@gm-mobile/c-font": "^3.10.2",
25
- "@gm-mobile/c-tool": "^3.10.2",
26
- "@gm-mobile/locales": "^3.10.2"
24
+ "@gm-mobile/c-font": "^3.11.0-beta.0",
25
+ "@gm-mobile/c-tool": "^3.11.0-beta.0",
26
+ "@gm-mobile/locales": "^3.11.0-beta.0"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@tarojs/components": "3.0.18",
@@ -33,5 +33,5 @@
33
33
  "prop-types": "^15.7.2",
34
34
  "react": "^16.13.1"
35
35
  },
36
- "gitHead": "36b2d1e86cc9234ad829116299d3c61a2faaee6c"
36
+ "gitHead": "649f56a77dba3b7aeb46446d2fbef2338270ee8a"
37
37
  }
@@ -24,6 +24,8 @@ export interface ChooseProps {
24
24
  /** 搜索功能 */
25
25
  // search?: boolean
26
26
  maxHeight?: string
27
+ /** 高度 */
28
+ height?: string
27
29
  onCancel?: () => void
28
30
  }
29
31
 
@@ -35,6 +37,7 @@ export default function ({
35
37
  multiSelect = false,
36
38
  defaultSelected = [],
37
39
  maxHeight = '50vh',
40
+ height,
38
41
  onCancel,
39
42
  }: ChooseProps) {
40
43
  if (multiSelect) needConfirm = true
@@ -45,7 +48,8 @@ export default function ({
45
48
  <View
46
49
  className='m-padding-tb-5'
47
50
  style={{
48
- maxHeight: maxHeight,
51
+ maxHeight,
52
+ height,
49
53
  overflow: 'auto',
50
54
  }}
51
55
  >
@@ -1,7 +1,6 @@
1
1
  import React, { FC } from 'react'
2
2
  import classNames from 'classnames'
3
3
  import _ from 'lodash'
4
- import { devWarnForHook } from '@gm-mobile/c-tool'
5
4
 
6
5
  import { Flex } from '../flex'
7
6
  import { Mask } from '../mask'
@@ -40,7 +39,7 @@ const PopupBase: FC<PopupV1Props> = ({
40
39
  style,
41
40
  id,
42
41
  onHide = _.noop,
43
- isPickPopup,
42
+ isPickPopup = true,
44
43
  disabledHeader,
45
44
  disabledMask,
46
45
  /** 动画有卡顿现象,先禁用 */
@@ -52,35 +51,31 @@ const PopupBase: FC<PopupV1Props> = ({
52
51
  titleCenter,
53
52
  clickMaskClose = true,
54
53
  disableBottomSafeArea,
54
+ direction = 'bottom',
55
55
  ...rest
56
56
  }) => {
57
- devWarnForHook(() => {
58
- if (!left && !right && !bottom) {
59
- console.error('need oneOf left right bottom')
60
- }
61
- })
62
-
57
+ const isLeft = left || direction === 'left'
58
+ const isRight = right || direction === 'right'
59
+ const isBottom = bottom || direction === 'bottom'
60
+ const isCenter = center || direction === 'center'
63
61
  const cn = classNames(
64
62
  'm-popup',
65
63
  {
66
- 'm-popup-left': left,
67
- 'm-popup-right': right,
68
- 'm-popup-bottom': bottom,
69
- 'm-popup-center': center,
64
+ 'm-popup-left m-animated-slide-in-left': isLeft,
65
+ 'm-popup-right m-animated-slide-in-right': isRight,
66
+ 'm-popup-bottom m-animated-slide-in-bottom': isBottom,
67
+ 'm-popup-center': isCenter,
70
68
  'm-popup-box-shadow': opacity === 0 || disabledMask,
71
69
  'm-animated': !disabledAnimate,
72
- 'm-animated-slide-in-left': left,
73
- 'm-animated-slide-in-right': right,
74
- 'm-animated-slide-in-bottom': bottom,
75
70
  'm-bottom-safe-area': !disableBottomSafeArea,
76
71
  },
77
72
  className
78
73
  )
79
74
 
80
75
  const s = Object.assign({}, style)
81
- if ((left || right) && width) {
76
+ if ((isLeft || isRight) && width) {
82
77
  s.width = width
83
- } else if (bottom) {
78
+ } else if (isBottom) {
84
79
  s.height = height
85
80
  }
86
81
 
@@ -90,17 +90,15 @@ export const PopupV1 = () => {
90
90
  onClick={() => {
91
91
  TempPopupV1.render({
92
92
  title:
93
- '啦啦啦1(加了headerClassName: m-flex-justify-center m-bg-back)',
93
+ '啦啦啦1 height: 60vh,(加了headerClassName: m-flex-justify-center m-bg-back)',
94
94
  headerClassName: 'm-flex-justify-center m-bg-back',
95
95
  titleCenter: true,
96
- bottom: true,
97
96
  children: (
98
97
  <View>
99
98
  <Button
100
99
  onClick={() => {
101
100
  TempPopupV1.render({
102
- title: '啦啦啦2',
103
- bottom: true,
101
+ title: '啦啦啦2,height: 50vh',
104
102
  children: (
105
103
  <View>
106
104
  点击关闭会提示【检测到弹窗关闭了,看要做什么回调】
@@ -108,21 +106,20 @@ export const PopupV1 = () => {
108
106
  onClick={() => {
109
107
  TempPopupV1.render({
110
108
  title: '啦啦啦3',
111
- bottom: true,
112
109
  children: (
113
110
  <View>
114
111
  <Button
115
112
  onClick={() => {
116
113
  const hdeId4 = TempPopupV1.render({
117
114
  title: '啦啦啦4',
118
- left: true,
115
+ direction: 'left',
119
116
  children: (
120
117
  <Button
121
118
  type='primary'
122
119
  onClick={() => {
123
120
  TempPopupV1.render({
124
121
  title: '啦啦啦5',
125
- right: true,
122
+ direction: 'right',
126
123
  children: (
127
124
  <Button
128
125
  type='primary'
@@ -132,7 +129,7 @@ export const PopupV1 = () => {
132
129
  </Button>
133
130
  ),
134
131
  // onHide: Popup.hide,
135
- height: '60vh',
132
+ height: '40vh',
136
133
  className: 'xxxx',
137
134
  closeText: (
138
135
  <Text
@@ -165,7 +162,7 @@ export const PopupV1 = () => {
165
162
  </Button>
166
163
  </View>
167
164
  ),
168
- height: '60vh',
165
+ height: '40vh',
169
166
  })
170
167
  }}
171
168
  >
@@ -176,7 +173,7 @@ export const PopupV1 = () => {
176
173
  onHide: () => {
177
174
  Toast.tip('检测到弹窗关闭了,看要做什么回调')
178
175
  },
179
- height: '60vh',
176
+ height: '50vh',
180
177
  })
181
178
  }}
182
179
  >
@@ -29,8 +29,9 @@ interface PopupStaticsTypes {
29
29
  render: (options: PopupProps) => void
30
30
  hide: () => void
31
31
  }
32
-
33
- interface PopupV1Props extends Omit<PopupProps, 'onHide'> {
32
+ type PopupDirection = 'bottom' | 'left' | 'right' | 'center'
33
+ interface PopupV1Props
34
+ extends Omit<PopupProps, 'onHide' | 'left' | 'right' | 'bottom'> {
34
35
  /** 默认关闭是个icon,如果不满足可自定义传入 */
35
36
  closeText?: ReactNode
36
37
  /** header的class,针对的是整个container */
@@ -41,9 +42,18 @@ interface PopupV1Props extends Omit<PopupProps, 'onHide'> {
41
42
  titleCenter?: boolean
42
43
  /** onHide是监听关闭后的回调,而不是关闭Popup的命令,如果要几秒后关闭弹窗可以返回一个Promise */
43
44
  onHide?: () => Promise<any> | void
44
- center?: boolean
45
45
  /** 点击mask是否关闭弹窗 */
46
46
  clickMaskClose?: boolean
47
+ /** @deprecated 弃用,请用direction='left' 左侧弹出 */
48
+ left?: boolean
49
+ /** @deprecated 弃用,请用direction='right' 右侧弹出 */
50
+ right?: boolean
51
+ /** @deprecated 弃用,请用direction='bottom' 底部弹出 */
52
+ bottom?: boolean
53
+ /** @deprecated 弃用,请用direction='center' 中心弹出 */
54
+ center?: boolean
55
+ /** 从哪个方向弹出,默认从底部 */
56
+ direction?: PopupDirection
47
57
  }
48
58
 
49
59
  interface PopupStaticsV1Types {