@aks-dev/easyui 1.0.100 → 1.0.101
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/lib/Hud/AlertBottomView/AlertBottomView.tsx +6 -5
- package/lib/Hud/AlertBottomView/index.ts +4 -4
- package/lib/Hud/AlertSheetView/AlertSheetView.tsx +176 -0
- package/lib/Hud/AlertSheetView/index.ts +35 -0
- package/lib/Hud/AlertView/AlertView.tsx +4 -4
- package/lib/Hud/AlertView/index.ts +5 -5
- package/lib/Hud/Hud.tsx +12 -8
- package/lib/Hud/Loading/Loading.tsx +5 -5
- package/lib/Hud/Loading/index.ts +5 -5
- package/lib/Hud/PopoverView/PopoverView.tsx +5 -5
- package/lib/Hud/PopoverView/index.ts +5 -5
- package/lib/Hud/Toast/Toast.tsx +10 -12
- package/lib/Hud/Toast/index.ts +7 -7
- package/lib/Hud/index.ts +3 -3
- package/lib/TextInputArea/TextInputArea.tsx +2 -2
- package/lib/TextInputArea/index.ts +1 -3
- package/package.json +1 -1
- package/screen/px2dp.ts +4 -4
- package/src/index.ts +10 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
-
import { View, Text, StyleSheet, Platform, StatusBar, TouchableOpacity, } from 'react-native'
|
|
2
|
+
import { View, Text, StyleSheet, Platform, StatusBar, TouchableOpacity,Dimensions } from 'react-native'
|
|
3
3
|
import Modal from 'react-native-modal'
|
|
4
4
|
|
|
5
5
|
import { px2dp, deviceWidth } from '../../../screen/px2dp'
|
|
6
6
|
import { px2sp } from '../../../screen/px2sp'
|
|
7
7
|
|
|
8
|
-
import { AlertBottomViewOptions,
|
|
8
|
+
import { AlertBottomViewOptions, AlertBottomViewCurrent } from '.'
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -18,7 +18,7 @@ type State = {
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
export default React.forwardRef<
|
|
21
|
+
export default React.forwardRef<AlertBottomViewCurrent, {}>((_, ref) => {
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
const defaultState: Partial<State> = {
|
|
@@ -32,7 +32,7 @@ export default React.forwardRef<AlertBottomViewRefAttributes, {}>((_, ref) => {
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
React.useImperativeHandle<unknown,
|
|
35
|
+
React.useImperativeHandle<unknown, AlertBottomViewCurrent>(ref, () => ({
|
|
36
36
|
show: async (options: Partial<AlertBottomViewOptions>) => {
|
|
37
37
|
|
|
38
38
|
setState(Object.assign({}, defaultState, { visible: true }, options))
|
|
@@ -77,6 +77,7 @@ export default React.forwardRef<AlertBottomViewRefAttributes, {}>((_, ref) => {
|
|
|
77
77
|
}}
|
|
78
78
|
isVisible={state.visible}
|
|
79
79
|
style={{ margin: 0 }}
|
|
80
|
+
deviceHeight={Dimensions.get('screen').height}
|
|
80
81
|
>
|
|
81
82
|
<View style={styles.container}>
|
|
82
83
|
<View style={[styles.wrapper, state.wrapperStyle]}>
|
|
@@ -129,7 +130,7 @@ export default React.forwardRef<AlertBottomViewRefAttributes, {}>((_, ref) => {
|
|
|
129
130
|
|
|
130
131
|
|
|
131
132
|
|
|
132
|
-
export const alertBottomViewRef = React.createRef<
|
|
133
|
+
export const alertBottomViewRef = React.createRef<AlertBottomViewCurrent>();
|
|
133
134
|
|
|
134
135
|
|
|
135
136
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-22 17:30:32
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-07-12 19:39:48
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/lib/Hud/AlertBottomView/index.ts
|
|
7
7
|
*/
|
|
8
8
|
import * as React from 'react'
|
|
@@ -31,12 +31,12 @@ export declare const showAlertBottomModal: (props: Partial<AlertBottomViewOption
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
export declare type
|
|
34
|
+
export declare type AlertBottomViewCurrent = {
|
|
35
35
|
show: (options: Partial<AlertBottomViewOptions>) => void;
|
|
36
36
|
hide: () => void;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
export declare const AlertBottomView: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<
|
|
40
|
+
export declare const AlertBottomView: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<AlertBottomViewCurrent>>;
|
|
41
41
|
|
|
42
|
-
export declare const AlertBottomViewRef: React.RefObject<
|
|
42
|
+
export declare const AlertBottomViewRef: React.RefObject<AlertBottomViewCurrent>
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { Dimensions, Platform, StatusBar, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import Modal from 'react-native-modal'
|
|
4
|
+
import { AlertSheetViewOptions, AlertSheetViewRefAttributes } from '.'
|
|
5
|
+
import { px2dp } from '../../../screen/px2dp'
|
|
6
|
+
import { px2sp } from '../../../screen/px2sp'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
type State = {
|
|
13
|
+
visible: boolean;
|
|
14
|
+
} & AlertSheetViewOptions
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export default React.forwardRef<AlertSheetViewRefAttributes, {}>((_, ref) => {
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
const defaultState: Partial<State> = {
|
|
24
|
+
visible: false,
|
|
25
|
+
actions: []
|
|
26
|
+
}
|
|
27
|
+
const [state, setState] = React.useState<Partial<State>>(defaultState)
|
|
28
|
+
|
|
29
|
+
React.useImperativeHandle<unknown, AlertSheetViewRefAttributes>(ref, () => ({
|
|
30
|
+
show: async (options: Partial<AlertSheetViewOptions>) => {
|
|
31
|
+
setState(Object.assign({}, defaultState, { visible: true }, options))
|
|
32
|
+
},
|
|
33
|
+
hide
|
|
34
|
+
}), [])
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
const hide = async () => {
|
|
38
|
+
setState(defaultState)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
if (Platform.OS == 'android') {
|
|
44
|
+
if (state.visible) {
|
|
45
|
+
StatusBar.setBackgroundColor('black')
|
|
46
|
+
StatusBar.setBarStyle('light-content')
|
|
47
|
+
} else {
|
|
48
|
+
StatusBar.setBackgroundColor('transparent')
|
|
49
|
+
StatusBar.setBarStyle('dark-content')
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}, [state.visible])
|
|
54
|
+
return (
|
|
55
|
+
<Modal
|
|
56
|
+
hideModalContentWhileAnimating={true}//通过隐藏模态内容直到动画完成来增强性能
|
|
57
|
+
useNativeDriver={true}//定义动画是否应使用本机驱动程序
|
|
58
|
+
animationIn='slideInUp'
|
|
59
|
+
animationOut='slideOutDown'
|
|
60
|
+
onBackButtonPress={() => {
|
|
61
|
+
//按下Android后退按钮时调用
|
|
62
|
+
hide()
|
|
63
|
+
}}
|
|
64
|
+
onBackdropPress={() => {
|
|
65
|
+
//按下背景时调用
|
|
66
|
+
hide()
|
|
67
|
+
}}
|
|
68
|
+
isVisible={state.visible}
|
|
69
|
+
deviceHeight={Dimensions.get('screen').height}
|
|
70
|
+
style={{ margin: 0}}
|
|
71
|
+
>
|
|
72
|
+
<View style={styles.container}>
|
|
73
|
+
<View style={[styles.wrapper]}>
|
|
74
|
+
<View style={styles.itemContainer}>
|
|
75
|
+
{state.actions?.map((i, idx) =>
|
|
76
|
+
<TouchableOpacity
|
|
77
|
+
|
|
78
|
+
key={`sg-action-${idx}`}
|
|
79
|
+
style={[styles.item]}
|
|
80
|
+
activeOpacity={1}
|
|
81
|
+
onPress={() => i.onClick && i.onClick()}>
|
|
82
|
+
<Text style={[styles.itemText,{color:i.color}]} numberOfLines={2}>{i.text}</Text>
|
|
83
|
+
</TouchableOpacity>
|
|
84
|
+
)}
|
|
85
|
+
</View>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
<TouchableOpacity
|
|
90
|
+
style={[styles.cancel]}
|
|
91
|
+
activeOpacity={1}
|
|
92
|
+
onPress={() => {
|
|
93
|
+
hide()
|
|
94
|
+
}}>
|
|
95
|
+
<Text style={[styles.cancelText]}>取消</Text>
|
|
96
|
+
</TouchableOpacity>
|
|
97
|
+
</View>
|
|
98
|
+
|
|
99
|
+
</View>
|
|
100
|
+
</Modal>
|
|
101
|
+
)
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
export const alertSheetViewRef = React.createRef<AlertSheetViewRefAttributes>();
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
export const showAlertSheetModal = (props: Partial<AlertSheetViewOptions>) => {
|
|
111
|
+
alertSheetViewRef.current?.show(props)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
const styles = StyleSheet.create({
|
|
120
|
+
container: {
|
|
121
|
+
display: 'flex',
|
|
122
|
+
flexGrow: 1,
|
|
123
|
+
justifyContent: 'flex-end',
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
wrapper: {
|
|
129
|
+
flexGrow: 0,
|
|
130
|
+
flexShrink: 0,
|
|
131
|
+
width: '100%',
|
|
132
|
+
// backgroundColor: 'pink',
|
|
133
|
+
overflow: 'hidden',
|
|
134
|
+
borderTopLeftRadius: px2dp(10),
|
|
135
|
+
borderTopRightRadius: px2dp(10),
|
|
136
|
+
display: 'flex',
|
|
137
|
+
padding: px2dp(15),
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
cancel: {
|
|
141
|
+
height: px2dp(50),
|
|
142
|
+
display: 'flex',
|
|
143
|
+
justifyContent: 'center',
|
|
144
|
+
alignItems: 'center',
|
|
145
|
+
borderRadius: px2dp(10),
|
|
146
|
+
backgroundColor: 'white',
|
|
147
|
+
marginTop: px2dp(15),
|
|
148
|
+
},
|
|
149
|
+
cancelText: {
|
|
150
|
+
fontSize: px2sp(15),
|
|
151
|
+
color: '#2763FF',
|
|
152
|
+
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
itemContainer: {
|
|
156
|
+
display: 'flex',
|
|
157
|
+
borderRadius: px2dp(10),
|
|
158
|
+
overflow: 'hidden',
|
|
159
|
+
backgroundColor:'#f1f1f1'
|
|
160
|
+
},
|
|
161
|
+
item: {
|
|
162
|
+
height: px2dp(50),
|
|
163
|
+
display: 'flex',
|
|
164
|
+
justifyContent: 'center',
|
|
165
|
+
alignItems: 'center',
|
|
166
|
+
|
|
167
|
+
backgroundColor: 'white',
|
|
168
|
+
marginTop: px2dp(0.5)
|
|
169
|
+
},
|
|
170
|
+
itemText: {
|
|
171
|
+
fontSize: px2sp(12),
|
|
172
|
+
color: '#666666',
|
|
173
|
+
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-22 17:30:32
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-09-09 10:11:11
|
|
6
|
+
* @FilePath: /cmwy-device-app/node_modules/@aks-dev/easyui/lib/Hud/AlertSheetView/index.ts
|
|
7
|
+
*/
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { ColorValue } from 'react-native';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
type ActionSheet = {
|
|
14
|
+
text: string;
|
|
15
|
+
color?: ColorValue | undefined;
|
|
16
|
+
onClick?: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare type AlertSheetViewOptions = {
|
|
19
|
+
actions:ActionSheet[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export declare const showAlertSheetModal: (props: Partial<AlertSheetViewOptions>) => void;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
export declare type AlertSheetViewRefAttributes = {
|
|
28
|
+
show: (options: Partial<AlertSheetViewOptions>) => void;
|
|
29
|
+
hide: () => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
export declare const AlertSheetView: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<AlertSheetViewRefAttributes>>;
|
|
34
|
+
|
|
35
|
+
export declare const AlertSheetViewRef: React.RefObject<AlertSheetViewRefAttributes>
|
|
@@ -5,7 +5,7 @@ import { View, Text, StyleSheet, Platform, Modal, StatusBar, TouchableOpacity, A
|
|
|
5
5
|
import { px2dp, deviceWidth } from '../../../screen/px2dp'
|
|
6
6
|
import { px2sp } from '../../../screen/px2sp'
|
|
7
7
|
|
|
8
|
-
import { AlertViewOptions,
|
|
8
|
+
import { AlertViewOptions, AlertViewCurrent } from '.'
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -18,7 +18,7 @@ type State = {
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
export default React.forwardRef<
|
|
21
|
+
export default React.forwardRef<AlertViewCurrent, {}>((_, ref) => {
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
const defaultState: Partial<State> = {
|
|
@@ -32,7 +32,7 @@ export default React.forwardRef<AlertViewRefAttributes, {}>((_, ref) => {
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
React.useImperativeHandle<unknown,
|
|
35
|
+
React.useImperativeHandle<unknown, AlertViewCurrent>(ref, () => ({
|
|
36
36
|
show: async (options: Partial<AlertViewOptions>) => {
|
|
37
37
|
|
|
38
38
|
setState(Object.assign({}, defaultState, { visible: true }, options))
|
|
@@ -134,7 +134,7 @@ export default React.forwardRef<AlertViewRefAttributes, {}>((_, ref) => {
|
|
|
134
134
|
|
|
135
135
|
|
|
136
136
|
|
|
137
|
-
export const alertViewRef = React.createRef<
|
|
137
|
+
export const alertViewRef = React.createRef<AlertViewCurrent>();
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-22 17:30:32
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-
|
|
6
|
-
* @FilePath: /@aks-dev/easyui/lib/Hud/AlertView/index.ts
|
|
5
|
+
* @LastEditTime: 2022-07-12 19:06:29
|
|
6
|
+
* @FilePath: /cmwy-device-app/node_modules/@aks-dev/easyui/lib/Hud/AlertView/index.ts
|
|
7
7
|
*/
|
|
8
8
|
import * as React from 'react'
|
|
9
9
|
|
|
@@ -30,12 +30,12 @@ export declare const showAlertModal: (props: Partial<AlertViewOptions>) => void;
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
export declare type
|
|
33
|
+
export declare type AlertViewCurrent = {
|
|
34
34
|
show: (options: Partial<AlertViewOptions>) => void;
|
|
35
35
|
hide: () => void;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
export declare const AlertView: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<
|
|
39
|
+
export declare const AlertView: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<AlertViewCurrent>>;
|
|
40
40
|
|
|
41
|
-
export declare const alertViewRef: React.RefObject<
|
|
41
|
+
export declare const alertViewRef: React.RefObject<AlertViewCurrent>
|
package/lib/Hud/Hud.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-24 14:10:04
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-09-09 09:55:01
|
|
6
6
|
* @FilePath: /cmwy-device-app/node_modules/@aks-dev/easyui/lib/Hud/Hud.tsx
|
|
7
7
|
*/
|
|
8
8
|
import * as React from 'react'
|
|
@@ -14,6 +14,9 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
alertBottomViewRef, default as AlertBottomView, showAlertBottomModal
|
|
16
16
|
} from './AlertBottomView/AlertBottomView'
|
|
17
|
+
import {
|
|
18
|
+
alertSheetViewRef, default as AlertSheetView, showAlertSheetModal
|
|
19
|
+
} from './AlertSheetView/AlertSheetView'
|
|
17
20
|
|
|
18
21
|
import {
|
|
19
22
|
hideLoading, Loading, loadingRef, showLoading
|
|
@@ -25,7 +28,7 @@ import {
|
|
|
25
28
|
} from './Toast/Toast'
|
|
26
29
|
|
|
27
30
|
|
|
28
|
-
import {showPopoverView,hidePopoverView,popoverViewRef,PopoverView} from './PopoverView/PopoverView'
|
|
31
|
+
import { showPopoverView, hidePopoverView, popoverViewRef, PopoverView } from './PopoverView/PopoverView'
|
|
29
32
|
|
|
30
33
|
|
|
31
34
|
|
|
@@ -42,8 +45,9 @@ export const Hud: React.FC<{}> = () => React.cloneElement(
|
|
|
42
45
|
<Loading key="hud-0" ref={loadingRef} />,
|
|
43
46
|
<Toast key="hud-1" ref={toastRef} />,
|
|
44
47
|
<AlertView key="hud-2" ref={alertViewRef} />,
|
|
45
|
-
<AlertBottomView key="hud-3" ref={alertBottomViewRef} />,
|
|
46
|
-
<
|
|
48
|
+
<AlertBottomView key="hud-3-0" ref={alertBottomViewRef} />,
|
|
49
|
+
<AlertSheetView key="hud-3-1" ref={alertSheetViewRef} />,
|
|
50
|
+
<PopoverView key="hud-4" ref={popoverViewRef} />,
|
|
47
51
|
]
|
|
48
52
|
)
|
|
49
53
|
|
|
@@ -51,9 +55,9 @@ export const Hud: React.FC<{}> = () => React.cloneElement(
|
|
|
51
55
|
export {
|
|
52
56
|
showAlertModal,
|
|
53
57
|
showToast,
|
|
54
|
-
showLoading,
|
|
55
|
-
hideLoading,
|
|
58
|
+
showLoading, hideLoading,
|
|
56
59
|
showAlertBottomModal,
|
|
57
|
-
|
|
58
|
-
hidePopoverView
|
|
60
|
+
showAlertSheetModal,
|
|
61
|
+
showPopoverView, hidePopoverView
|
|
62
|
+
|
|
59
63
|
}
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-24 14:27:02
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-07-15 14:21:00
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/lib/Hud/Loading/Loading.tsx
|
|
7
7
|
*/
|
|
8
8
|
import React, { useImperativeHandle, useState } from 'react';
|
|
9
9
|
import { View, ActivityIndicator, StyleSheet, Text, Dimensions, TouchableOpacity, BackHandler } from 'react-native';
|
|
10
10
|
|
|
11
|
-
import type {
|
|
11
|
+
import type { LoadingCurrent } from '.'
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
export const Loading = React.forwardRef<
|
|
17
|
+
export const Loading = React.forwardRef<LoadingCurrent, {}>((_, ref) => {
|
|
18
18
|
const [show, setShow] = useState(false);
|
|
19
19
|
const [tipText, setTipText] = useState('加载中');
|
|
20
20
|
|
|
@@ -26,7 +26,7 @@ export const Loading = React.forwardRef<LoadingRefAttributes, {}>((_, ref) => {
|
|
|
26
26
|
}, [show])
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
useImperativeHandle<unknown,
|
|
29
|
+
useImperativeHandle<unknown, LoadingCurrent>(ref, () => ({
|
|
30
30
|
showLoading: (content?: string) => {
|
|
31
31
|
setShow(true);
|
|
32
32
|
setTipText(content || '加载中')
|
|
@@ -50,7 +50,7 @@ export const Loading = React.forwardRef<LoadingRefAttributes, {}>((_, ref) => {
|
|
|
50
50
|
)
|
|
51
51
|
})
|
|
52
52
|
|
|
53
|
-
export const loadingRef = React.createRef<
|
|
53
|
+
export const loadingRef = React.createRef<LoadingCurrent>();
|
|
54
54
|
export const showLoading = (content?: string) => loadingRef.current?.showLoading(content)
|
|
55
55
|
export const hideLoading = () => loadingRef.current?.hideLoading()
|
|
56
56
|
|
package/lib/Hud/Loading/index.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* @Author: shiguo
|
|
4
4
|
* @Date: 2022-04-24 14:27:02
|
|
5
5
|
* @LastEditors: shiguo
|
|
6
|
-
* @LastEditTime: 2022-
|
|
7
|
-
* @FilePath: /@aks
|
|
6
|
+
* @LastEditTime: 2022-05-12 11:32:41
|
|
7
|
+
* @FilePath: /@aks/easyui/lib/Easy-Hud/Loading/index.ts
|
|
8
8
|
*/
|
|
9
9
|
import * as React from 'react'
|
|
10
10
|
|
|
@@ -15,7 +15,7 @@ import * as React from 'react'
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
export declare type
|
|
18
|
+
export declare type LoadingCurrent = {
|
|
19
19
|
showLoading: (content?: string) => void;
|
|
20
20
|
hideLoading: () => void;
|
|
21
21
|
}
|
|
@@ -29,7 +29,7 @@ export declare const showLoading: (content?: string) => void;
|
|
|
29
29
|
export declare const hideLoading: () => void;
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
export declare const loadingRef: React.RefObject<
|
|
32
|
+
export declare const loadingRef: React.RefObject<LoadingCurrent>;
|
|
33
33
|
|
|
34
|
-
export declare const Loading: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<
|
|
34
|
+
export declare const Loading: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<LoadingCurrent>>
|
|
35
35
|
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-24 14:27:02
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-07-15 14:20:40
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/lib/Hud/PopoverView/PopoverView.tsx
|
|
7
7
|
*/
|
|
8
8
|
import React, { useImperativeHandle, useState } from 'react';
|
|
9
9
|
import { StyleSheet, TouchableOpacity, BackHandler } from 'react-native';
|
|
10
|
-
import type {
|
|
10
|
+
import type { PopoverViewCurrent, PopoverViewOptions } from '.';
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
export const PopoverView = React.forwardRef<
|
|
17
|
+
export const PopoverView = React.forwardRef<PopoverViewCurrent, {}>((_, ref) => {
|
|
18
18
|
const [visible, setVisible] = useState<boolean>(false);
|
|
19
19
|
const [options, setOptions] = useState<Partial<PopoverViewOptions> | undefined>()
|
|
20
20
|
|
|
@@ -25,7 +25,7 @@ export const PopoverView = React.forwardRef<PopoverViewRefAttributes, {}>((_, re
|
|
|
25
25
|
}, [visible])
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
useImperativeHandle<unknown,
|
|
28
|
+
useImperativeHandle<unknown, PopoverViewCurrent>(ref, () => ({
|
|
29
29
|
showPopoverView: (options: Partial<PopoverViewOptions>) => {
|
|
30
30
|
setVisible(true);
|
|
31
31
|
setOptions(options)
|
|
@@ -51,7 +51,7 @@ export const PopoverView = React.forwardRef<PopoverViewRefAttributes, {}>((_, re
|
|
|
51
51
|
)
|
|
52
52
|
})
|
|
53
53
|
|
|
54
|
-
export const popoverViewRef = React.createRef<
|
|
54
|
+
export const popoverViewRef = React.createRef<PopoverViewCurrent>();
|
|
55
55
|
export const showPopoverView = (options: Partial<PopoverViewOptions>) => popoverViewRef.current?.showPopoverView(options)
|
|
56
56
|
export const hidePopoverView = () => popoverViewRef.current?.hidePopoverView()
|
|
57
57
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* @Author: shiguo
|
|
4
4
|
* @Date: 2022-04-24 14:27:02
|
|
5
5
|
* @LastEditors: shiguo
|
|
6
|
-
* @LastEditTime: 2022-
|
|
7
|
-
* @FilePath: /@aks-dev/easyui/lib/Hud/PopoverView/index.ts
|
|
6
|
+
* @LastEditTime: 2022-07-15 10:07:56
|
|
7
|
+
* @FilePath: /cmwy-device-app/node_modules/@aks-dev/easyui/lib/Hud/PopoverView/index.ts
|
|
8
8
|
*/
|
|
9
9
|
import * as React from 'react'
|
|
10
10
|
|
|
@@ -18,7 +18,7 @@ export type PopoverViewOptions = {
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
export declare type
|
|
21
|
+
export declare type PopoverViewCurrent = {
|
|
22
22
|
showPopoverView: (options:Partial<PopoverViewOptions>) => void;
|
|
23
23
|
hidePopoverView: () => void;
|
|
24
24
|
}
|
|
@@ -32,7 +32,7 @@ export declare const showPopoverView: (options:Partial<PopoverViewOptions>) => v
|
|
|
32
32
|
export declare const hidePopoverView: () => void;
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
export declare const popoverViewRef: React.RefObject<
|
|
35
|
+
export declare const popoverViewRef: React.RefObject<PopoverViewCurrent>;
|
|
36
36
|
|
|
37
|
-
export declare const PopoverView: React.ForwardRefExoticComponent<React.PropsWithoutRef<PopoverViewOptions> & React.RefAttributes<
|
|
37
|
+
export declare const PopoverView: React.ForwardRefExoticComponent<React.PropsWithoutRef<PopoverViewOptions> & React.RefAttributes<PopoverViewCurrent>>
|
|
38
38
|
|
package/lib/Hud/Toast/Toast.tsx
CHANGED
|
@@ -2,21 +2,20 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2021-04-27 10:38:04
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-
|
|
6
|
-
* @FilePath: /@aks
|
|
5
|
+
* @LastEditTime: 2022-05-12 11:33:40
|
|
6
|
+
* @FilePath: /@aks/easyui/lib/Easy-Hud/Toast/Toast.tsx
|
|
7
7
|
*/
|
|
8
8
|
import React, { useImperativeHandle, useState, useRef } from 'react';
|
|
9
9
|
import { View, StyleSheet, Text, Dimensions, Animated, Easing } from 'react-native';
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
import type {
|
|
12
|
+
import type { ToastCurrent } from '.'
|
|
13
13
|
|
|
14
14
|
const errorMsg = '(^_^)∠※ 送你一束小花'
|
|
15
15
|
|
|
16
|
-
export const Toast = React.forwardRef<
|
|
16
|
+
export const Toast = React.forwardRef<ToastCurrent, {}>((_, ref) => {
|
|
17
17
|
const [tipText, setTipText] = useState(errorMsg);
|
|
18
18
|
const fade = useRef(new Animated.Value(0)).current;
|
|
19
|
-
const [tipTheme, setTipTheme] = useState<'black' | 'white'>('black')
|
|
20
19
|
|
|
21
20
|
const fadeAnimation = Animated.sequence([
|
|
22
21
|
Animated.timing(fade, {
|
|
@@ -34,10 +33,9 @@ export const Toast = React.forwardRef<ToastRefAttributes, {}>((_, ref) => {
|
|
|
34
33
|
})
|
|
35
34
|
])
|
|
36
35
|
|
|
37
|
-
useImperativeHandle<unknown,
|
|
38
|
-
showToast: (content: string
|
|
36
|
+
useImperativeHandle<unknown, ToastCurrent>(ref, () => ({
|
|
37
|
+
showToast: (content: string) => {
|
|
39
38
|
setTipText(content || errorMsg)
|
|
40
|
-
setTipTheme(theme ? theme : 'black')
|
|
41
39
|
fadeAnimation.reset()
|
|
42
40
|
fadeAnimation.start()
|
|
43
41
|
},
|
|
@@ -45,17 +43,17 @@ export const Toast = React.forwardRef<ToastRefAttributes, {}>((_, ref) => {
|
|
|
45
43
|
|
|
46
44
|
return (
|
|
47
45
|
<Animated.View style={{ ...styles.toastContainer, opacity: fade }}>
|
|
48
|
-
<View style={
|
|
49
|
-
<Text numberOfLines={5} style={
|
|
46
|
+
<View style={styles.toastTipsContainer}>
|
|
47
|
+
<Text numberOfLines={5} style={{ ...styles.toastTitle, }}>{tipText} </Text>
|
|
50
48
|
</View>
|
|
51
49
|
</Animated.View>
|
|
52
50
|
|
|
53
51
|
)
|
|
54
52
|
})
|
|
55
53
|
|
|
56
|
-
export const toastRef = React.createRef<
|
|
54
|
+
export const toastRef = React.createRef<ToastCurrent>();
|
|
57
55
|
|
|
58
|
-
export const showToast = (content: string
|
|
56
|
+
export const showToast = (content: string) => toastRef.current?.showToast(content)
|
|
59
57
|
|
|
60
58
|
|
|
61
59
|
|
package/lib/Hud/Toast/index.ts
CHANGED
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-18 19:18:03
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-
|
|
6
|
-
* @FilePath: /@aks
|
|
5
|
+
* @LastEditTime: 2022-05-12 11:33:32
|
|
6
|
+
* @FilePath: /@aks/easyui/lib/Easy-Hud/Toast/index.ts
|
|
7
7
|
*/
|
|
8
8
|
import * as React from 'react'
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
export declare type
|
|
14
|
-
showToast: (content: string
|
|
13
|
+
export declare type ToastCurrent = {
|
|
14
|
+
showToast: (content: string) => void;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export declare const showToast: (content: string
|
|
17
|
+
export declare const showToast: (content: string) => void;
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
export declare const toastRef: React.RefObject<
|
|
20
|
+
export declare const toastRef: React.RefObject<ToastCurrent>;
|
|
21
21
|
|
|
22
|
-
export declare const Toast: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<
|
|
22
|
+
export declare const Toast: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<ToastCurrent>>;
|
package/lib/Hud/index.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-24 14:14:42
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-
|
|
6
|
-
* @FilePath: /@aks-dev/easyui/lib/Hud/index.ts
|
|
5
|
+
* @LastEditTime: 2022-09-09 09:55:43
|
|
6
|
+
* @FilePath: /cmwy-device-app/node_modules/@aks-dev/easyui/lib/Hud/index.ts
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
|
|
@@ -14,6 +14,6 @@ export * from './AlertView'
|
|
|
14
14
|
export * from './Loading'
|
|
15
15
|
export * from './Toast'
|
|
16
16
|
export * from './AlertBottomView'
|
|
17
|
+
export * from './AlertSheetView'
|
|
17
18
|
export * from './PopoverView'
|
|
18
|
-
|
|
19
19
|
export declare const Hud: React.FC<{}>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-24 13:56:47
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-09-07 18:
|
|
5
|
+
* @LastEditTime: 2022-09-07 18:37:00
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/lib/TextInputArea/TextInputArea.tsx
|
|
7
7
|
*/
|
|
8
8
|
import React from 'react'
|
|
@@ -11,7 +11,7 @@ import {px2dp} from '../../screen/px2dp'
|
|
|
11
11
|
import {px2sp} from '../../screen/px2sp'
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
import type { TextInputAreaProps,
|
|
14
|
+
import type { TextInputAreaProps ,TextInputAreaRefAttributes} from '.'
|
|
15
15
|
|
|
16
16
|
export default React.forwardRef<TextInputAreaRefAttributes, Partial<TextInputAreaProps>>((props, ref) => {
|
|
17
17
|
const { defaultValue, placeholder, maxLength = 200, on, ...rest } = props
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-24 13:59:32
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-09-07 18:
|
|
5
|
+
* @LastEditTime: 2022-09-07 18:38:10
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/lib/TextInputArea/index.ts
|
|
7
7
|
*/
|
|
8
8
|
import * as React from 'react'
|
|
@@ -21,8 +21,6 @@ export type TextInputAreaProps = {
|
|
|
21
21
|
} & TextInputProps
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
24
|
export type TextInputAreaRefAttributes = {
|
|
27
25
|
value: string | undefined;
|
|
28
26
|
}
|
package/package.json
CHANGED
package/screen/px2dp.ts
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* @Author: shiguo
|
|
3
3
|
* @Date: 2022-04-18 14:32:25
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-09-09 10:35:02
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/screen/px2dp.ts
|
|
7
7
|
*/
|
|
8
8
|
import { Dimensions, Platform, StatusBar } from 'react-native';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
// 设备宽度,单位 dp
|
|
12
|
-
export const deviceWidth = Dimensions.get('
|
|
13
|
-
export const deviceHeight = Dimensions.get('
|
|
12
|
+
export const deviceWidth = Dimensions.get('screen').width; //设备的宽度
|
|
13
|
+
export const deviceHeight = Dimensions.get('screen').height; //设备的高度
|
|
14
14
|
export const isAndroid = Platform.OS === "android"
|
|
15
15
|
export const isIos = Platform.OS === 'ios'
|
|
16
16
|
export const isiPhoneX = isIos && (deviceHeight > 736)
|
|
@@ -43,7 +43,7 @@ export const statusBarHeight = (() => {
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
export const navigationBarHeight = (() => {
|
|
46
|
+
export const navigationBarHeight = ( () => {
|
|
47
47
|
if (isAndroid) return 56
|
|
48
48
|
return 44
|
|
49
49
|
})()
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @Author: shiguo
|
|
4
4
|
* @Date: 2022-04-13 12:47:34
|
|
5
5
|
* @LastEditors: shiguo
|
|
6
|
-
* @LastEditTime: 2022-
|
|
6
|
+
* @LastEditTime: 2022-09-09 10:37:09
|
|
7
7
|
* @FilePath: /@aks-dev/easyui/src/index.ts
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -14,7 +14,15 @@
|
|
|
14
14
|
|
|
15
15
|
export * from '../lib/Badge/Badge'
|
|
16
16
|
|
|
17
|
-
export {
|
|
17
|
+
export {
|
|
18
|
+
Hud,
|
|
19
|
+
showLoading, hideLoading,
|
|
20
|
+
showToast,
|
|
21
|
+
showAlertModal,
|
|
22
|
+
showAlertBottomModal,
|
|
23
|
+
showAlertSheetModal,
|
|
24
|
+
showPopoverView, hidePopoverView
|
|
25
|
+
} from '../lib/Hud/Hud'
|
|
18
26
|
|
|
19
27
|
export * from '../lib/Modal/Modal'
|
|
20
28
|
|