@aks-dev/easyui 1.0.163 → 1.1.5

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.
Files changed (176) hide show
  1. package/dist/components/AnimationModal/AnimationModal.d.ts +27 -0
  2. package/dist/components/AnimationModal/AnimationModal.d.ts.map +1 -0
  3. package/dist/components/AnimationModal/AnimationModal.js +151 -0
  4. package/dist/components/Badge/Badge.d.ts +8 -0
  5. package/dist/components/Badge/Badge.d.ts.map +1 -0
  6. package/dist/components/Badge/Badge.js +35 -0
  7. package/dist/components/DottedLine/DottedLine.d.ts +10 -0
  8. package/dist/components/DottedLine/DottedLine.d.ts.map +1 -0
  9. package/dist/components/DottedLine/DottedLine.js +50 -0
  10. package/dist/components/EchartsView/EchartsView.d.ts +10 -0
  11. package/dist/components/EchartsView/EchartsView.d.ts.map +1 -0
  12. package/{lib/Echarts/EchartsView.tsx → dist/components/EchartsView/EchartsView.js} +74 -113
  13. package/dist/components/EchartsView/helper.d.ts +10 -0
  14. package/dist/components/EchartsView/helper.d.ts.map +1 -0
  15. package/{lib/Echarts/helper.tsx → dist/components/EchartsView/helper.js} +17 -24
  16. package/dist/components/Hud/AlertBottomView/AlertBottomView.d.ts +25 -0
  17. package/dist/components/Hud/AlertBottomView/AlertBottomView.d.ts.map +1 -0
  18. package/dist/components/Hud/AlertBottomView/AlertBottomView.js +174 -0
  19. package/dist/components/Hud/AlertSheetView/AlertSheetView.d.ts +19 -0
  20. package/dist/components/Hud/AlertSheetView/AlertSheetView.d.ts.map +1 -0
  21. package/dist/components/Hud/AlertSheetView/AlertSheetView.js +117 -0
  22. package/dist/components/Hud/AlertView/AlertView.d.ts +25 -0
  23. package/dist/components/Hud/AlertView/AlertView.d.ts.map +1 -0
  24. package/dist/components/Hud/AlertView/AlertView.js +184 -0
  25. package/dist/components/Hud/Hud.d.ts +11 -0
  26. package/dist/components/Hud/Hud.d.ts.map +1 -0
  27. package/dist/components/Hud/Hud.js +29 -0
  28. package/dist/components/Hud/Loading/Loading.d.ts +11 -0
  29. package/dist/components/Hud/Loading/Loading.d.ts.map +1 -0
  30. package/dist/components/Hud/Loading/Loading.js +66 -0
  31. package/dist/components/Hud/PopoverView/PopoverView.d.ts +17 -0
  32. package/dist/components/Hud/PopoverView/PopoverView.d.ts.map +1 -0
  33. package/dist/components/Hud/PopoverView/PopoverView.js +47 -0
  34. package/dist/components/Hud/Scanner/Scanner.d.ts +12 -0
  35. package/dist/components/Hud/Scanner/Scanner.d.ts.map +1 -0
  36. package/dist/components/Hud/Scanner/Scanner.js +301 -0
  37. package/dist/components/Hud/Toast/Toast.d.ts +9 -0
  38. package/dist/components/Hud/Toast/Toast.d.ts.map +1 -0
  39. package/dist/components/Hud/Toast/Toast.js +71 -0
  40. package/dist/components/MenuView/MenuView.d.ts +21 -0
  41. package/dist/components/MenuView/MenuView.d.ts.map +1 -0
  42. package/dist/components/MenuView/MenuView.js +184 -0
  43. package/dist/components/Modal/Modal.d.ts +2 -0
  44. package/dist/components/Modal/Modal.d.ts.map +1 -0
  45. package/{lib/Modal/Modal.tsx → dist/components/Modal/Modal.js} +1 -4
  46. package/{lib/MutiPictureView/index.ts → dist/components/MutiPictureView/MutiPictureView.d.ts} +18 -31
  47. package/dist/components/MutiPictureView/MutiPictureView.d.ts.map +1 -0
  48. package/dist/components/MutiPictureView/MutiPictureView.js +243 -0
  49. package/dist/components/PictureViewer/PictureViewer.d.ts +17 -0
  50. package/dist/components/PictureViewer/PictureViewer.d.ts.map +1 -0
  51. package/dist/components/PictureViewer/PictureViewer.js +54 -0
  52. package/dist/components/RefreshList/RefreshList.d.ts +45 -0
  53. package/dist/components/RefreshList/RefreshList.d.ts.map +1 -0
  54. package/dist/components/RefreshList/RefreshList.js +155 -0
  55. package/dist/components/RichText/RichText.d.ts +12 -0
  56. package/dist/components/RichText/RichText.d.ts.map +1 -0
  57. package/dist/components/RichText/RichText.js +56 -0
  58. package/dist/components/StickHeaderView/StickHeaderView.d.ts +15 -0
  59. package/dist/components/StickHeaderView/StickHeaderView.d.ts.map +1 -0
  60. package/dist/components/StickHeaderView/StickHeaderView.js +37 -0
  61. package/{lib/TableCell/index.ts → dist/components/TableCell/TableCell.d.ts} +8 -30
  62. package/dist/components/TableCell/TableCell.d.ts.map +1 -0
  63. package/dist/components/TableCell/TableCell.js +97 -0
  64. package/dist/components/TextInputArea/TextInputArea.d.ts +17 -0
  65. package/dist/components/TextInputArea/TextInputArea.d.ts.map +1 -0
  66. package/dist/components/TextInputArea/TextInputArea.js +65 -0
  67. package/dist/components/WithLoadingContainer/WithLoadingContainer.d.ts +23 -0
  68. package/dist/components/WithLoadingContainer/WithLoadingContainer.d.ts.map +1 -0
  69. package/dist/components/WithLoadingContainer/WithLoadingContainer.js +77 -0
  70. package/dist/index.d.ts +23 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +32 -0
  73. package/dist/jsbridge/RNEasyui.d.ts +23 -0
  74. package/dist/jsbridge/RNEasyui.d.ts.map +1 -0
  75. package/dist/jsbridge/RNEasyui.js +46 -0
  76. package/dist/jsbridge/UpgradeModule.d.ts +26 -0
  77. package/dist/jsbridge/UpgradeModule.d.ts.map +1 -0
  78. package/{jsbridge/UpgradeModule.ts → dist/jsbridge/UpgradeModule.js} +25 -23
  79. package/dist/jsbridge/index.d.ts +3 -0
  80. package/dist/jsbridge/index.d.ts.map +1 -0
  81. package/{jsbridge/index.ts → dist/jsbridge/index.js} +2 -2
  82. package/dist/screen/index.d.ts +3 -0
  83. package/dist/screen/index.d.ts.map +1 -0
  84. package/{screen/index.ts → dist/screen/index.js} +2 -2
  85. package/{screen/index.d.ts → dist/screen/px2dp.d.ts} +6 -12
  86. package/dist/screen/px2dp.d.ts.map +1 -0
  87. package/dist/screen/px2dp.js +45 -0
  88. package/dist/screen/px2sp.d.ts +2 -0
  89. package/dist/screen/px2sp.d.ts.map +1 -0
  90. package/{screen/px2sp.ts → dist/screen/px2sp.js} +13 -20
  91. package/dist/screen/text-fit.d.ts +5 -0
  92. package/dist/screen/text-fit.d.ts.map +1 -0
  93. package/{screen/text-fit.ts → dist/screen/text-fit.js} +10 -20
  94. package/dist/utils/index.d.ts +3 -0
  95. package/dist/utils/index.d.ts.map +1 -0
  96. package/{utils/index.ts → dist/utils/index.js} +2 -2
  97. package/{utils/index.d.ts → dist/utils/lazy.d.ts} +15 -53
  98. package/dist/utils/lazy.d.ts.map +1 -0
  99. package/{utils/lazy.ts → dist/utils/lazy.js} +164 -165
  100. package/dist/utils/mode.d.ts +24 -0
  101. package/dist/utils/mode.d.ts.map +1 -0
  102. package/dist/utils/mode.js +50 -0
  103. package/package.json +32 -22
  104. package/readme.md +3 -3
  105. package/android/.DS_Store +0 -0
  106. package/android/src/.DS_Store +0 -0
  107. package/android/src/main/.DS_Store +0 -0
  108. package/android/src/main/java/.DS_Store +0 -0
  109. package/android/src/main/java/com/.DS_Store +0 -0
  110. package/android/src/main/java/com/easyui/.DS_Store +0 -0
  111. package/i.sh +0 -23
  112. package/ios/.DS_Store +0 -0
  113. package/ios/assets/.DS_Store +0 -0
  114. package/ios/views/.DS_Store +0 -0
  115. package/jsbridge/RNEasyui.ts +0 -42
  116. package/jsbridge/index.d.ts +0 -67
  117. package/lib/.DS_Store +0 -0
  118. package/lib/AnimationModal/AnimationModal.tsx +0 -201
  119. package/lib/AnimationModal/index.d.ts +0 -41
  120. package/lib/Badge/Badge.tsx +0 -40
  121. package/lib/Badge/index.ts +0 -21
  122. package/lib/DottedLine/DottedLine.tsx +0 -66
  123. package/lib/DottedLine/index.ts +0 -18
  124. package/lib/Echarts/demo.tsx +0 -235
  125. package/lib/Echarts/index.ts +0 -29
  126. package/lib/Hud/.DS_Store +0 -0
  127. package/lib/Hud/AlertBottomView/AlertBottomView.tsx +0 -228
  128. package/lib/Hud/AlertBottomView/index.d.ts +0 -42
  129. package/lib/Hud/AlertSheetView/AlertSheetView.tsx +0 -179
  130. package/lib/Hud/AlertSheetView/index.d.ts +0 -35
  131. package/lib/Hud/AlertView/AlertView.tsx +0 -234
  132. package/lib/Hud/AlertView/index.d.ts +0 -46
  133. package/lib/Hud/Hud.tsx +0 -67
  134. package/lib/Hud/Loading/Loading.tsx +0 -87
  135. package/lib/Hud/Loading/index.d.ts +0 -38
  136. package/lib/Hud/PopoverView/PopoverView.tsx +0 -66
  137. package/lib/Hud/PopoverView/index.d.ts +0 -39
  138. package/lib/Hud/Scanner/Scanner.tsx +0 -250
  139. package/lib/Hud/Scanner/index.d.ts +0 -42
  140. package/lib/Hud/Toast/Toast.tsx +0 -86
  141. package/lib/Hud/Toast/index.d.ts +0 -22
  142. package/lib/Hud/index.ts +0 -20
  143. package/lib/MenuView/MenuView.tsx +0 -252
  144. package/lib/MenuView/index.ts +0 -31
  145. package/lib/Modal/index.ts +0 -10
  146. package/lib/MutiPictureView/MutiPictureView.tsx +0 -259
  147. package/lib/PictureViewer/PictureViewer.tsx +0 -80
  148. package/lib/PictureViewer/index.ts +0 -26
  149. package/lib/RefreshList/RefreshList.tsx +0 -235
  150. package/lib/RefreshList/demo.tsx +0 -30
  151. package/lib/RefreshList/demo1.tsx +0 -60
  152. package/lib/RefreshList/demo2.tsx +0 -46
  153. package/lib/RefreshList/index.ts +0 -84
  154. package/lib/RichText/RichText.tsx +0 -82
  155. package/lib/RichText/index.ts +0 -21
  156. package/lib/StickHeaderView/StickHeaderView.tsx +0 -65
  157. package/lib/StickHeaderView/demo.tsx +0 -104
  158. package/lib/StickHeaderView/index.ts +0 -26
  159. package/lib/TableCell/TableCell.tsx +0 -118
  160. package/lib/TextInputArea/TextInputArea.tsx +0 -89
  161. package/lib/TextInputArea/index.d.ts +0 -33
  162. package/lib/WithLoadingContainer/WithLoadingContainer.tsx +0 -93
  163. package/lib/WithLoadingContainer/index.ts +0 -36
  164. package/screen/px2dp.ts +0 -51
  165. package/src/index.d.ts +0 -42
  166. package/src/index.ts +0 -54
  167. package/utils/mode.ts +0 -48
  168. /package/{lib/Hud/Scanner → dist/components/Hud/Scanner/assets}/flashlight-blue.png +0 -0
  169. /package/{lib/Hud/Scanner → dist/components/Hud/Scanner/assets}/flashlight-white.png +0 -0
  170. /package/{lib/Hud/Scanner → dist/components/Hud/Scanner/assets}/icon_back_white.png +0 -0
  171. /package/{lib/MutiPictureView → dist/components/MutiPictureView/assets}/icon_add_image.png +0 -0
  172. /package/{lib/MutiPictureView → dist/components/MutiPictureView/assets}/icon_del_image.png +0 -0
  173. /package/{lib/TableCell → dist/components/TableCell/assets}/back.png +0 -0
  174. /package/{lib/WithLoadingContainer → dist/components/WithLoadingContainer/assets}/loading.gif +0 -0
  175. /package/{lib/WithLoadingContainer → dist/components/WithLoadingContainer/assets}/loading3.gif +0 -0
  176. /package/{lib → dist/components}/index.md +0 -0
@@ -1,35 +0,0 @@
1
- /*
2
- * @Author: shiguo
3
- * @Date: 2022-04-22 17:30:32
4
- * @LastEditors: shiguo
5
- * @LastEditTime: 2022-09-09 10:51:19
6
- * @FilePath: /@aks-dev/easyui/lib/Hud/AlertSheetView/index.d.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
- declare namespace AlertSheetViewOptions {
27
- type RefAttributes = {
28
- show: (options: Partial<AlertSheetViewOptions>) => void;
29
- hide: () => void;
30
- }
31
- }
32
-
33
- export declare const AlertSheetView: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<AlertSheetViewOptions.RefAttributes>>;
34
-
35
- export declare const AlertSheetViewRef: React.RefObject<AlertSheetViewOptions.RefAttributes>
@@ -1,234 +0,0 @@
1
- import * as React from 'react'
2
- import { View, Text, StyleSheet, Platform, Modal, StatusBar, TouchableOpacity, Animated, Easing } from 'react-native'
3
-
4
-
5
- import { px2dp, deviceWidth } from '../../../screen/px2dp'
6
- import { px2sp } from '../../../screen/px2sp'
7
-
8
- import { AlertViewOptions } from '.'
9
-
10
-
11
-
12
- type State = {
13
- visible: boolean;
14
-
15
- } & Omit<AlertViewOptions, 'cancel' | 'confirm'>
16
-
17
-
18
-
19
-
20
-
21
- export default React.forwardRef<AlertViewOptions.RefAttributes, {}>((_, ref) => {
22
-
23
-
24
- const defaultState: Partial<State> = {
25
- visible: false,
26
- cancelText: '取消',
27
- confirmText: '确定',
28
- }
29
- const [state, setState] = React.useState<Partial<State>>(defaultState)
30
- const cancelCallbackRef = React.useRef<Function>();
31
- const confirmCallbackRef = React.useRef<Function>();
32
-
33
-
34
-
35
- React.useImperativeHandle<unknown, AlertViewOptions.RefAttributes>(ref, () => ({
36
- show: async (options: Partial<AlertViewOptions>) => {
37
-
38
- setState(Object.assign({}, defaultState, { visible: true }, options))
39
- cancelCallbackRef.current = options.cancel;
40
- confirmCallbackRef.current = options.confirm;
41
- // await sleep(50)
42
- startAnimate(1)
43
- },
44
- hide
45
- }), [])
46
-
47
-
48
- const hide = async () => {
49
- startAnimate(0.3)
50
- // await sleep(50)
51
- setState(defaultState)
52
-
53
- }
54
-
55
- let scale_anim = React.useRef(new Animated.Value(0.3)).current
56
- const startAnimate = (x: number) => {
57
- Animated.timing(scale_anim, {
58
- toValue: x,
59
- useNativeDriver: true,
60
- duration: 150,
61
- easing: Easing.ease
62
- }).start()
63
- }
64
- React.useEffect(() => {
65
- if (Platform.OS == 'android') {
66
- if (state.visible) {
67
- StatusBar.setBackgroundColor('black')
68
- StatusBar.setBarStyle('light-content')
69
- } else {
70
- StatusBar.setBackgroundColor('transparent')
71
- StatusBar.setBarStyle('dark-content')
72
- }
73
- }
74
-
75
- }, [state.visible])
76
- return (
77
- <Modal
78
- visible={state.visible}
79
- transparent animationType="fade"
80
- onRequestClose={() => {
81
- // hide()
82
- }}
83
- // style={{
84
- // margin: 0,
85
- // }}
86
- >
87
- <View style={styles.container}>
88
- <Animated.View style={[styles.wrapper, state.wrapperStyle, { transform: [{ scale: scale_anim }] }]}>
89
- {state.title && <Text style={styles.titleText}>{state.title}</Text>}
90
- {(() => {
91
- if (typeof state.content == 'string') return <Text style={styles.contentText}>{state.content}</Text>
92
- if (React.isValidElement(state.content)) return state.content;
93
- return <View />
94
- })()}
95
-
96
- {
97
- (state.cancelText || state.confirmText) &&
98
- <View style={styles.action}>
99
- {state.cancelText &&
100
- <TouchableOpacity
101
- style={[styles.cancel, { marginRight: state.confirmText ? px2dp(15) : 0 }, state.cancelContainerStyle]}
102
- activeOpacity={0.8}
103
- disabled={state.cancelDisabled}
104
- onPress={() => {
105
- hide()
106
- cancelCallbackRef.current && cancelCallbackRef.current()
107
- cancelCallbackRef.current = undefined;
108
-
109
- }}>
110
- <Text style={[styles.cancelText, state.cancelTextStyle]}>{state.cancelText}</Text>
111
- </TouchableOpacity>
112
- }
113
-
114
- {state.confirmText &&
115
- <TouchableOpacity
116
- style={[styles.confirm, { marginLeft: state.cancelText ? px2dp(15) : 0 }, state.confirmContainerStyle]}
117
- activeOpacity={0.8}
118
- onPress={() => {
119
- hide()
120
- confirmCallbackRef.current && confirmCallbackRef.current()
121
- confirmCallbackRef.current = undefined;
122
- }}>
123
- <Text style={[styles.confirmText, state.confirmTextStyle]}>{state.confirmText}</Text>
124
- </TouchableOpacity>
125
- }
126
- </View>
127
- }
128
-
129
- </Animated.View>
130
-
131
- </View>
132
- </Modal>
133
- )
134
- })
135
-
136
-
137
-
138
- export const alertViewRef = React.createRef<AlertViewOptions.RefAttributes>();
139
-
140
-
141
-
142
- export const showAlertModal = (props: Partial<AlertViewOptions>) => {
143
- alertViewRef.current?.show(props)
144
- }
145
-
146
-
147
-
148
- // const sleep = (msec?: number) => {
149
- // return new Promise(resolve => {
150
- // setTimeout(resolve, msec || 350);
151
- // });
152
- // }
153
-
154
-
155
-
156
- const styles = StyleSheet.create({
157
- container: {
158
- display: 'flex',
159
- flexGrow: 1,
160
- backgroundColor: '#00000088',
161
- justifyContent: 'center',
162
- alignItems: 'center',
163
-
164
- },
165
-
166
- wrapper: {
167
- flexGrow: 0,
168
- flexShrink: 0,
169
- // minWidth: '70%',
170
- minWidth: deviceWidth - px2dp(60),
171
- backgroundColor: 'white',
172
- overflow: 'hidden',
173
- borderRadius: px2dp(10),
174
- display: 'flex',
175
- padding: px2dp(15),
176
- },
177
- titleText: {
178
- maxWidth: deviceWidth - px2dp(90),
179
- fontSize: px2sp(18),
180
- marginBottom: px2dp(20),
181
- // backgroundColor: 'red',
182
- textAlign: 'center',
183
- fontWeight: 'bold',
184
- color: '#1A1A1A'
185
- },
186
- contentText: {
187
- maxWidth: deviceWidth - px2dp(90),
188
- marginBottom: px2dp(20),
189
- minHeight: px2dp(40),
190
- flexGrow: 0,
191
- flexShrink: 1,
192
- width: undefined,
193
- fontSize: px2sp(15),
194
- // backgroundColor: 'red',
195
- color: '#1A1A1A',
196
- textAlign: 'center'
197
- },
198
- action: {
199
- display: 'flex',
200
- flexDirection: 'row',
201
- justifyContent: 'space-between',
202
- alignItems: 'center',
203
- // backgroundColor:"red"
204
- },
205
- cancel: {
206
- width: '40%',
207
- height: px2dp(44),
208
- display: 'flex',
209
- justifyContent: 'center',
210
- alignItems: 'center',
211
- borderRadius: px2dp(10),
212
- borderWidth: px2dp(1),
213
- borderColor: '#A3A9CC'
214
- },
215
-
216
- confirm: {
217
- width: '40%',
218
- height: px2dp(44),
219
- display: 'flex',
220
- justifyContent: 'center',
221
- alignItems: 'center',
222
- backgroundColor: '#2763FF',
223
- borderRadius: px2dp(10)
224
- },
225
- cancelText: {
226
- fontSize: px2sp(15),
227
- color: '#A3A9CC',
228
-
229
- },
230
- confirmText: {
231
- fontSize: px2sp(15),
232
- color: 'white'
233
- },
234
- })
@@ -1,46 +0,0 @@
1
- /*
2
- * @Author: shiguo
3
- * @Date: 2022-04-22 17:30:32
4
- * @LastEditors: shiguo
5
- * @LastEditTime: 2023-03-10 12:21:30
6
- * @FilePath: /@aks-dev/easyui/lib/Hud/AlertView/index.d.ts
7
- */
8
- import * as React from 'react'
9
-
10
-
11
- import { StyleProp, ViewStyle, TextStyle } from 'react-native'
12
-
13
-
14
- export declare type AlertViewOptions = {
15
- title: string;
16
- content: string | React.ReactElement;
17
- wrapperStyle: StyleProp<ViewStyle>;
18
- cancelText: string;
19
- cancelContainerStyle: StyleProp<ViewStyle>;
20
- cancelTextStyle: StyleProp<TextStyle>;
21
- cancel: () => void;
22
- cancelDisabled:boolean;
23
- confirmText: string;
24
- confirmContainerStyle: StyleProp<ViewStyle>;
25
- confirmTextStyle: StyleProp<TextStyle>;
26
- confirm: () => void;
27
- }
28
-
29
-
30
- export declare const showAlertModal: (props: Partial<AlertViewOptions>) => void;
31
-
32
-
33
-
34
- declare namespace AlertViewOptions {
35
- type RefAttributes = {
36
- show: (options: Partial<AlertViewOptions>) => void;
37
- hide: () => void;
38
- }
39
- }
40
-
41
-
42
-
43
-
44
- export declare const AlertView: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<AlertViewOptions.RefAttributes>>;
45
-
46
- export declare const alertViewRef: React.RefObject<AlertViewOptions.RefAttributes>
package/lib/Hud/Hud.tsx DELETED
@@ -1,67 +0,0 @@
1
- /*
2
- * @Author: shiguo
3
- * @Date: 2022-04-24 14:10:04
4
- * @LastEditors: shiguo
5
- * @LastEditTime: 2023-03-23 11:13:55
6
- * @FilePath: /aks-fire-app/node_modules/@aks-dev/easyui/lib/Hud/Hud.tsx
7
- */
8
- import * as React from 'react'
9
- // import { StyleSheet } from 'react-native'
10
- import {
11
- alertViewRef, default as AlertView, showAlertModal
12
- } from './AlertView/AlertView'
13
-
14
- import {
15
- alertBottomViewRef, default as AlertBottomView, showAlertBottomModal
16
- } from './AlertBottomView/AlertBottomView'
17
- import {
18
- alertSheetViewRef, default as AlertSheetView, showAlertSheetModal
19
- } from './AlertSheetView/AlertSheetView'
20
-
21
- import {
22
- hideLoading, Loading, loadingRef, showLoading
23
- } from './Loading/Loading'
24
-
25
-
26
- import {
27
- showToast, Toast, toastRef
28
- } from './Toast/Toast'
29
-
30
-
31
- import { showPopoverView, hidePopoverView, popoverViewRef, PopoverView } from './PopoverView/PopoverView'
32
-
33
-
34
- import {
35
- showScanner, hideScanner, scannerRef, Scanner
36
- } from './Scanner/Scanner'
37
-
38
-
39
-
40
-
41
- export const Hud: React.FC<{}> = () => React.cloneElement(
42
- <></>,
43
- {
44
- // ...StyleSheet.absoluteFillObject,
45
- // display: 'flex',
46
- },
47
- [
48
- <Loading key="hud-0" ref={loadingRef} />,
49
- <Toast key="hud-1" ref={toastRef} />,
50
- <AlertView key="hud-2" ref={alertViewRef} />,
51
- <AlertBottomView key="hud-3-0" ref={alertBottomViewRef} />,
52
- <AlertSheetView key="hud-3-1" ref={alertSheetViewRef} />,
53
- <PopoverView key="hud-4" ref={popoverViewRef} />,
54
- <Scanner key="hud-5" ref={scannerRef} />,
55
- ]
56
- )
57
-
58
-
59
- export {
60
- showAlertModal,
61
- showToast,
62
- showLoading, hideLoading,
63
- showAlertBottomModal,
64
- showAlertSheetModal,
65
- showPopoverView, hidePopoverView,
66
- showScanner,hideScanner,
67
- }
@@ -1,87 +0,0 @@
1
- /*
2
- * @Author: shiguo
3
- * @Date: 2022-04-24 14:27:02
4
- * @LastEditors: shiguo
5
- * @LastEditTime: 2022-09-09 10:55:48
6
- * @FilePath: /@aks-dev/easyui/lib/Hud/Loading/Loading.tsx
7
- */
8
- import React, { useImperativeHandle, useState } from 'react';
9
- import { View, ActivityIndicator, StyleSheet, Text, Dimensions, TouchableOpacity, BackHandler } from 'react-native';
10
-
11
- import { LoadingOptions } from '.'
12
-
13
-
14
-
15
-
16
-
17
- export const Loading = React.forwardRef<LoadingOptions.RefAttributes, {}>((_, ref) => {
18
- const [show, setShow] = useState(false);
19
- const [tipText, setTipText] = useState('加载中');
20
-
21
-
22
- React.useEffect(() => {
23
- const onBackPress = () => show;
24
- BackHandler.addEventListener('hardwareBackPress', onBackPress);
25
- return () => BackHandler.removeEventListener('hardwareBackPress', onBackPress);
26
- }, [show])
27
-
28
-
29
- useImperativeHandle<unknown, LoadingOptions.RefAttributes>(ref, () => ({
30
- showLoading: (content?: string) => {
31
- setShow(true);
32
- setTipText(content || '加载中')
33
- },
34
- hideLoading: () => {
35
- setShow(false);
36
- }
37
- }), [show])
38
-
39
- if (!show)
40
- return null;
41
-
42
- return (
43
- <TouchableOpacity disabled style={styles.container}>
44
- <View style={styles.warpper}>
45
- <ActivityIndicator color="white" size='large' />
46
- <Text numberOfLines={5} style={styles.title}>{tipText}
47
- </Text>
48
- </View>
49
- </TouchableOpacity>
50
- )
51
- })
52
-
53
- export const loadingRef = React.createRef<LoadingOptions.RefAttributes>();
54
- export const showLoading = (content?: string) => loadingRef.current?.showLoading(content)
55
- export const hideLoading = () => loadingRef.current?.hideLoading()
56
-
57
-
58
-
59
- const SCREEN_WIDTH = Dimensions.get('window').width;
60
- const styles = StyleSheet.create({
61
- container: {
62
- ...StyleSheet.absoluteFillObject,
63
- display: 'flex',
64
- justifyContent: 'center',
65
- alignItems: 'center',
66
- // backgroundColor:'red'
67
- },
68
-
69
- warpper: {
70
- backgroundColor: '#00000088',
71
- padding: 40,
72
- paddingVertical: 20,
73
- borderRadius: 10,
74
- justifyContent: 'center',
75
- alignItems: 'center',
76
- minWidth: 90
77
- },
78
- title: {
79
- marginTop: 5,
80
- fontSize: 13,
81
- lineHeight: 16,
82
- color: 'white',
83
- maxWidth: SCREEN_WIDTH * 0.5,
84
-
85
- }
86
-
87
- })
@@ -1,38 +0,0 @@
1
-
2
- /*
3
- * @Author: shiguo
4
- * @Date: 2022-04-24 14:27:02
5
- * @LastEditors: shiguo
6
- * @LastEditTime: 2022-09-09 10:55:28
7
- * @FilePath: /@aks-dev/easyui/lib/Hud/Loading/index.ts
8
- */
9
- import * as React from 'react'
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
- declare namespace LoadingOptions {
21
- type RefAttributes = {
22
- showLoading: (content?: string) => void;
23
- hideLoading: () => void;
24
- }
25
- }
26
-
27
-
28
-
29
- export declare const showLoading: (content?: string) => void;
30
-
31
-
32
- export declare const hideLoading: () => void;
33
-
34
-
35
- export declare const loadingRef: React.RefObject<LoadingOptions.RefAttributes>;
36
-
37
- export declare const Loading: React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<LoadingOptions.RefAttributes>>
38
-
@@ -1,66 +0,0 @@
1
- /*
2
- * @Author: shiguo
3
- * @Date: 2022-04-24 14:27:02
4
- * @LastEditors: shiguo
5
- * @LastEditTime: 2022-12-21 15:36:06
6
- * @FilePath: /@aks-dev/easyui/lib/Hud/PopoverView/PopoverView.tsx
7
- */
8
- import React, { useImperativeHandle, useState } from 'react';
9
- import { StyleSheet, TouchableOpacity, BackHandler } from 'react-native';
10
- import type {PopoverViewOptions } from '.';
11
-
12
-
13
-
14
-
15
-
16
-
17
- export const PopoverView = React.forwardRef<PopoverViewOptions.RefAttributes, {}>((_, ref) => {
18
- const [visible, setVisible] = useState<boolean>(false);
19
- const [options, setOptions] = useState<Partial<PopoverViewOptions> | undefined>()
20
-
21
- React.useEffect(() => {
22
- const onBackPress = () => visible;
23
- BackHandler.addEventListener('hardwareBackPress', onBackPress);
24
- return () => BackHandler.removeEventListener('hardwareBackPress', onBackPress);
25
- }, [visible])
26
-
27
-
28
- useImperativeHandle<unknown, PopoverViewOptions.RefAttributes>(ref, () => ({
29
- showPopoverView: (options: Partial<PopoverViewOptions>) => {
30
- setVisible(true);
31
- setOptions(options)
32
-
33
- },
34
- hidePopoverView: () => {
35
- setVisible(false);
36
- setOptions(undefined)
37
- }
38
- }), [visible])
39
-
40
- if (!visible)
41
- return null;
42
-
43
- return (
44
- <TouchableOpacity activeOpacity={1} style={[styles.container, options?.style]} disabled={options?.disabled} onPress={e => {
45
- setVisible(false);
46
- setOptions(undefined)
47
- // e.stopPropagation()
48
- }}>
49
- {React.isValidElement(options?.content) && options?.content}
50
- </TouchableOpacity>
51
- )
52
- })
53
-
54
- export const popoverViewRef = React.createRef<PopoverViewOptions.RefAttributes>();
55
- export const showPopoverView = (options: Partial<PopoverViewOptions>) => popoverViewRef.current?.showPopoverView(options)
56
- export const hidePopoverView = () => popoverViewRef.current?.hidePopoverView()
57
-
58
-
59
- const styles = StyleSheet.create({
60
- container: {
61
- ...StyleSheet.absoluteFillObject,
62
- display: 'flex',
63
-
64
- // backgroundColor:'red'
65
- },
66
- })
@@ -1,39 +0,0 @@
1
-
2
- /*
3
- * @Author: shiguo
4
- * @Date: 2022-04-24 14:27:02
5
- * @LastEditors: shiguo
6
- * @LastEditTime: 2022-10-28 12:09:52
7
- * @FilePath: /@aks-dev/easyui/lib/Hud/PopoverView/index.d.ts
8
- */
9
- import * as React from 'react'
10
-
11
- import {StyleProp,ViewStyle} from 'react-native'
12
-
13
-
14
- export type PopoverViewOptions = {
15
- content: React.ReactNode;
16
- style: StyleProp<ViewStyle>;
17
- disabled:boolean;
18
- }
19
-
20
-
21
-
22
- declare namespace PopoverViewOptions {
23
- type RefAttributes = {
24
- showPopoverView: (options:Partial<PopoverViewOptions>) => void;
25
- hidePopoverView: () => void;
26
- }
27
- }
28
-
29
-
30
- export declare const showPopoverView: (options:Partial<PopoverViewOptions>) => void;
31
-
32
-
33
- export declare const hidePopoverView: () => void;
34
-
35
-
36
- export declare const popoverViewRef: React.RefObject<PopoverViewOptions.RefAttributes>;
37
-
38
- export declare const PopoverView: React.ForwardRefExoticComponent<React.PropsWithoutRef<PopoverViewOptions> & React.RefAttributes<PopoverViewOptions.RefAttributes>>
39
-