@gm-mobile/c-react 3.9.3-beta.27 → 3.9.3-beta.30
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 +5 -5
- package/src/component/custom_tabbar/custom_tabbar.weapp.tsx +6 -1
- package/src/component/layout_root/layout_root.tsx +20 -3
- package/src/component/layout_root/layout_root_v1.tsx +18 -3
- package/src/component/text_field/TextField.tsx +12 -0
- package/src/component/text_field/types.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gm-mobile/c-react",
|
|
3
|
-
"version": "3.9.3-beta.
|
|
3
|
+
"version": "3.9.3-beta.30",
|
|
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.9.3-beta.
|
|
25
|
-
"@gm-mobile/c-tool": "^3.9.3-beta.
|
|
26
|
-
"@gm-mobile/locales": "^3.9.3-beta.
|
|
24
|
+
"@gm-mobile/c-font": "^3.9.3-beta.30",
|
|
25
|
+
"@gm-mobile/c-tool": "^3.9.3-beta.30",
|
|
26
|
+
"@gm-mobile/locales": "^3.9.3-beta.30"
|
|
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": "
|
|
36
|
+
"gitHead": "31da7b0c46139802e33a24a4cd6d016de3996fe6"
|
|
37
37
|
}
|
|
@@ -24,7 +24,12 @@ const CustomTabbar = () => {
|
|
|
24
24
|
return null
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
return
|
|
27
|
+
return (
|
|
28
|
+
<View
|
|
29
|
+
className='custom-tabbar-placeholder'
|
|
30
|
+
style={{ height: `${height}px` }}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
CustomTabbar.getCustomTabbarHeight = getCustomTabbarHeight
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
FC,
|
|
3
|
+
useState,
|
|
4
|
+
ReactNode,
|
|
5
|
+
useEffect,
|
|
6
|
+
HTMLAttributes,
|
|
7
|
+
} from 'react'
|
|
2
8
|
import _ from 'lodash'
|
|
3
9
|
import { is } from '@gm-mobile/c-tool'
|
|
4
10
|
|
|
@@ -13,7 +19,10 @@ import {
|
|
|
13
19
|
|
|
14
20
|
const cbMap: CBMapType = {}
|
|
15
21
|
|
|
16
|
-
const LayoutRoot: FC & LayoutRootStatic = (
|
|
22
|
+
const LayoutRoot: FC<HTMLAttributes<HTMLDivElement>> & LayoutRootStatic = ({
|
|
23
|
+
style,
|
|
24
|
+
...rest
|
|
25
|
+
}) => {
|
|
17
26
|
const [state, setState] = useState<LayoutRootState>({})
|
|
18
27
|
const path: string = getPath()
|
|
19
28
|
|
|
@@ -31,7 +40,15 @@ const LayoutRoot: FC & LayoutRootStatic = () => {
|
|
|
31
40
|
|
|
32
41
|
// 有层级关系
|
|
33
42
|
return (
|
|
34
|
-
<View
|
|
43
|
+
<View
|
|
44
|
+
style={{
|
|
45
|
+
...style,
|
|
46
|
+
display: Object.keys(state).find((k) => !!state[k as 'popup'])
|
|
47
|
+
? 'block'
|
|
48
|
+
: 'none',
|
|
49
|
+
}}
|
|
50
|
+
{...rest}
|
|
51
|
+
>
|
|
35
52
|
{state.innerLayer}
|
|
36
53
|
{state.popup}
|
|
37
54
|
{state.picker}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
FC,
|
|
3
|
+
useState,
|
|
4
|
+
ReactNode,
|
|
5
|
+
useEffect,
|
|
6
|
+
HTMLAttributes,
|
|
7
|
+
} from 'react'
|
|
2
8
|
import _ from 'lodash'
|
|
3
9
|
import { is } from '@gm-mobile/c-tool'
|
|
4
10
|
|
|
@@ -16,7 +22,10 @@ const cbMap: CBMapV1Type = {}
|
|
|
16
22
|
/**
|
|
17
23
|
* @description: 目前仅用于Popup的多层弹窗
|
|
18
24
|
*/
|
|
19
|
-
const LayoutRootV1: FC & LayoutV1RootStatic = (
|
|
25
|
+
const LayoutRootV1: FC<HTMLAttributes<HTMLDivElement>> & LayoutV1RootStatic = ({
|
|
26
|
+
style,
|
|
27
|
+
...rest
|
|
28
|
+
}) => {
|
|
20
29
|
const path = getPath()
|
|
21
30
|
const [state, setState] = useState<LayoutRootState>({})
|
|
22
31
|
|
|
@@ -52,7 +61,13 @@ const LayoutRootV1: FC & LayoutV1RootStatic = () => {
|
|
|
52
61
|
|
|
53
62
|
// 有层级关系
|
|
54
63
|
return (
|
|
55
|
-
<View
|
|
64
|
+
<View
|
|
65
|
+
style={{
|
|
66
|
+
...style,
|
|
67
|
+
display: state.popup && state.popup.length > 0 ? 'block' : 'none',
|
|
68
|
+
}}
|
|
69
|
+
{...rest}
|
|
70
|
+
>
|
|
56
71
|
{/* {state.innerLayer} */}
|
|
57
72
|
{state.popup}
|
|
58
73
|
{/* {state.modal}
|
|
@@ -17,6 +17,8 @@ const ios = mp && wx.getSystemInfoSync().platform === 'ios'
|
|
|
17
17
|
interface TextFieldState {
|
|
18
18
|
/** 是否输入状态 */
|
|
19
19
|
active: boolean
|
|
20
|
+
/** 是否需要清空 */
|
|
21
|
+
needClear: boolean
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
const store = observable({ active: '' })
|
|
@@ -43,6 +45,7 @@ export class TextField extends Component<TextFieldProps, TextFieldState> {
|
|
|
43
45
|
|
|
44
46
|
state = {
|
|
45
47
|
active: false,
|
|
48
|
+
needClear: false,
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
id = uniqueId('textField-')
|
|
@@ -82,12 +85,17 @@ export class TextField extends Component<TextFieldProps, TextFieldState> {
|
|
|
82
85
|
})
|
|
83
86
|
}
|
|
84
87
|
this.props.onClick && this.props.onClick(e)
|
|
88
|
+
this.setState({ ...this.state, needClear: !!this.props.rewriteMode })
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
onInput(e: any) {
|
|
88
92
|
if (this.props.disabled) return
|
|
89
93
|
if (!mp) e.persist()
|
|
90
94
|
let value = mp ? e.detail.value : e.target.value
|
|
95
|
+
if (this.state.needClear) {
|
|
96
|
+
value = value.slice(-1)
|
|
97
|
+
this.setState({ ...this.state, needClear: false })
|
|
98
|
+
}
|
|
91
99
|
const { min, max } = this.props
|
|
92
100
|
if (
|
|
93
101
|
value &&
|
|
@@ -321,3 +329,7 @@ export class TextField extends Component<TextFieldProps, TextFieldState> {
|
|
|
321
329
|
}
|
|
322
330
|
|
|
323
331
|
export default TextField
|
|
332
|
+
|
|
333
|
+
export function AutoPreview_TextField() {
|
|
334
|
+
return <TextField value='test' onChange={() => {}} />
|
|
335
|
+
}
|