@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
@@ -0,0 +1,174 @@
1
+ import * as React from "react";
2
+ import { View, Text, StyleSheet, Platform, StatusBar, TouchableOpacity, Dimensions, } from "react-native";
3
+ import Modal from "react-native-modal";
4
+ import { px2dp, deviceWidth } from "../../../screen/px2dp";
5
+ import { px2sp } from "../../../screen/px2sp";
6
+ export default React.forwardRef((_, ref) => {
7
+ const defaultState = {
8
+ visible: false,
9
+ cancelText: "取消",
10
+ confirmText: "确定",
11
+ };
12
+ const [state, setState] = React.useState(defaultState);
13
+ const cancelCallbackRef = React.useRef(undefined);
14
+ const confirmCallbackRef = React.useRef(undefined);
15
+ React.useImperativeHandle(ref, () => ({
16
+ show: async (options) => {
17
+ setState(Object.assign({}, defaultState, { visible: true }, options));
18
+ cancelCallbackRef.current = options.cancel;
19
+ confirmCallbackRef.current = options.confirm;
20
+ },
21
+ hide,
22
+ }), []);
23
+ const hide = async () => {
24
+ setState(defaultState);
25
+ };
26
+ React.useEffect(() => {
27
+ if (Platform.OS == "android") {
28
+ if (state.visible) {
29
+ StatusBar.setBackgroundColor("black");
30
+ StatusBar.setBarStyle("light-content");
31
+ }
32
+ else {
33
+ StatusBar.setBackgroundColor("transparent");
34
+ StatusBar.setBarStyle("dark-content");
35
+ }
36
+ }
37
+ }, [state.visible]);
38
+ return (<Modal hideModalContentWhileAnimating={true} //通过隐藏模态内容直到动画完成来增强性能
39
+ useNativeDriver={true} //定义动画是否应使用本机驱动程序
40
+ animationIn="slideInUp" animationOut="slideOutDown" onBackButtonPress={() => {
41
+ //按下Android后退按钮时调用
42
+ hide();
43
+ }} onBackdropPress={() => {
44
+ //按下背景时调用
45
+ hide();
46
+ }} isVisible={state.visible} style={{ margin: 0 }} deviceHeight={Dimensions.get("screen").height}>
47
+ <View style={styles.container}>
48
+ <View style={[styles.wrapper, state.wrapperStyle]}>
49
+ {state.title && <Text style={styles.titleText}>{state.title}</Text>}
50
+ <View style={[state.contentContainerStyle]}>
51
+ {(() => {
52
+ if (typeof state.content == "string")
53
+ return <Text style={styles.contentText}>{state.content}</Text>;
54
+ if (React.isValidElement(state.content))
55
+ return state.content;
56
+ return <View />;
57
+ })()}
58
+ </View>
59
+ {(state.cancelText || state.confirmText) && (<View style={styles.action}>
60
+ {state.cancelText && (<TouchableOpacity style={[
61
+ styles.cancel,
62
+ { marginRight: state.confirmText ? px2dp(15) : 0 },
63
+ state.cancelContainerStyle,
64
+ ]} activeOpacity={0.8} onPress={() => {
65
+ hide();
66
+ cancelCallbackRef.current && cancelCallbackRef.current();
67
+ cancelCallbackRef.current = undefined;
68
+ }}>
69
+ <Text style={[styles.cancelText, state.cancelTextStyle]}>
70
+ {state.cancelText}
71
+ </Text>
72
+ </TouchableOpacity>)}
73
+
74
+ {state.confirmText && (<TouchableOpacity style={[
75
+ styles.confirm,
76
+ { marginLeft: state.cancelText ? px2dp(15) : 0 },
77
+ state.confirmContainerStyle,
78
+ ]} activeOpacity={0.8} onPress={() => {
79
+ hide();
80
+ confirmCallbackRef.current && confirmCallbackRef.current();
81
+ confirmCallbackRef.current = undefined;
82
+ }}>
83
+ <Text style={[styles.confirmText, state.confirmTextStyle]}>
84
+ {state.confirmText}
85
+ </Text>
86
+ </TouchableOpacity>)}
87
+ </View>)}
88
+ </View>
89
+ </View>
90
+ </Modal>);
91
+ });
92
+ export const alertBottomViewRef = React.createRef();
93
+ export const showAlertBottomModal = (props) => {
94
+ alertBottomViewRef.current?.show(props);
95
+ };
96
+ // const sleep = (msec?: number) => {
97
+ // return new Promise(resolve => {
98
+ // setTimeout(resolve, msec || 350);
99
+ // });
100
+ // }
101
+ const styles = StyleSheet.create({
102
+ container: {
103
+ display: "flex",
104
+ flexGrow: 1,
105
+ justifyContent: "flex-end",
106
+ alignItems: "center",
107
+ },
108
+ wrapper: {
109
+ flexGrow: 0,
110
+ flexShrink: 0,
111
+ width: "100%",
112
+ backgroundColor: "white",
113
+ overflow: "hidden",
114
+ borderTopLeftRadius: px2dp(10),
115
+ borderTopRightRadius: px2dp(10),
116
+ display: "flex",
117
+ padding: px2dp(15),
118
+ },
119
+ titleText: {
120
+ maxWidth: deviceWidth - px2dp(30),
121
+ fontSize: px2sp(18),
122
+ marginBottom: px2dp(20),
123
+ // backgroundColor: 'red',
124
+ textAlign: "center",
125
+ fontWeight: "bold",
126
+ color: "#1A1A1A",
127
+ },
128
+ contentText: {
129
+ maxWidth: deviceWidth - px2dp(30),
130
+ marginBottom: px2dp(20),
131
+ minHeight: px2dp(40),
132
+ flexGrow: 0,
133
+ flexShrink: 1,
134
+ width: undefined,
135
+ fontSize: px2sp(15),
136
+ // backgroundColor: 'red',
137
+ color: "#1A1A1A",
138
+ textAlign: "center",
139
+ },
140
+ action: {
141
+ display: "flex",
142
+ flexDirection: "row",
143
+ justifyContent: "space-between",
144
+ alignItems: "center",
145
+ // backgroundColor:"red"
146
+ },
147
+ cancel: {
148
+ width: "40%",
149
+ height: px2dp(44),
150
+ display: "flex",
151
+ justifyContent: "center",
152
+ alignItems: "center",
153
+ borderRadius: px2dp(10),
154
+ borderWidth: px2dp(1),
155
+ borderColor: "#A3A9CC",
156
+ },
157
+ confirm: {
158
+ width: "40%",
159
+ height: px2dp(44),
160
+ display: "flex",
161
+ justifyContent: "center",
162
+ alignItems: "center",
163
+ backgroundColor: "#2763FF",
164
+ borderRadius: px2dp(10),
165
+ },
166
+ cancelText: {
167
+ fontSize: px2sp(15),
168
+ color: "#A3A9CC",
169
+ },
170
+ confirmText: {
171
+ fontSize: px2sp(15),
172
+ color: "white",
173
+ },
174
+ });
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import { ColorValue } from "react-native";
3
+ type RefAttributes = {
4
+ show: (options: Partial<AlertSheetViewOptions>) => void;
5
+ hide: () => void;
6
+ };
7
+ type ActionSheet = {
8
+ text: string;
9
+ color?: ColorValue | undefined;
10
+ onClick?: () => void;
11
+ };
12
+ export type AlertSheetViewOptions = {
13
+ actions: ActionSheet[];
14
+ };
15
+ declare const _default: React.ForwardRefExoticComponent<React.RefAttributes<RefAttributes>>;
16
+ export default _default;
17
+ export declare const alertSheetViewRef: React.RefObject<RefAttributes | null>;
18
+ export declare const showAlertSheetModal: (props: Partial<AlertSheetViewOptions>) => void;
19
+ //# sourceMappingURL=AlertSheetView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlertSheetView.d.ts","sourceRoot":"","sources":["../../../../src/components/Hud/AlertSheetView/AlertSheetView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAQL,UAAU,EACX,MAAM,cAAc,CAAC;AAKtB,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAAC;IACxD,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB,CAAC;AACF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AACF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;;AAKF,wBAuFG;AAEH,eAAO,MAAM,iBAAiB,uCAAmC,CAAC;AAElE,eAAO,MAAM,mBAAmB,GAAI,OAAO,OAAO,CAAC,qBAAqB,CAAC,SAExE,CAAC"}
@@ -0,0 +1,117 @@
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 { px2dp } from "../../../screen/px2dp";
5
+ import { px2sp } from "../../../screen/px2sp";
6
+ export default React.forwardRef((_, ref) => {
7
+ const defaultState = {
8
+ visible: false,
9
+ actions: [],
10
+ };
11
+ const [state, setState] = React.useState(defaultState);
12
+ React.useImperativeHandle(ref, () => ({
13
+ show: async (options) => {
14
+ setState(Object.assign({}, defaultState, { visible: true }, options));
15
+ },
16
+ hide,
17
+ }), []);
18
+ const hide = async () => {
19
+ setState(defaultState);
20
+ };
21
+ React.useEffect(() => {
22
+ if (Platform.OS == "android") {
23
+ if (state.visible) {
24
+ StatusBar.setBackgroundColor("black");
25
+ StatusBar.setBarStyle("light-content");
26
+ }
27
+ else {
28
+ StatusBar.setBackgroundColor("transparent");
29
+ StatusBar.setBarStyle("dark-content");
30
+ }
31
+ }
32
+ }, [state.visible]);
33
+ return (<Modal hideModalContentWhileAnimating={true} //通过隐藏模态内容直到动画完成来增强性能
34
+ useNativeDriver={true} //定义动画是否应使用本机驱动程序
35
+ animationIn="slideInUp" animationOut="slideOutDown" onBackButtonPress={() => {
36
+ //按下Android后退按钮时调用
37
+ hide();
38
+ }} onBackdropPress={() => {
39
+ //按下背景时调用
40
+ hide();
41
+ }} isVisible={state.visible} deviceHeight={Dimensions.get("screen").height} style={{ margin: 0 }}>
42
+ <View style={styles.container}>
43
+ <View style={[styles.wrapper]}>
44
+ <View style={styles.itemContainer}>
45
+ {state.actions?.map((i, idx) => (<TouchableOpacity key={`sg-action-${idx}`} style={[styles.item]} activeOpacity={1} onPress={() => {
46
+ hide();
47
+ i.onClick && i.onClick();
48
+ }}>
49
+ <Text style={[styles.itemText, { color: i.color }]} numberOfLines={2}>
50
+ {i.text}
51
+ </Text>
52
+ </TouchableOpacity>))}
53
+ </View>
54
+
55
+ <TouchableOpacity style={[styles.cancel]} activeOpacity={1} onPress={() => {
56
+ hide();
57
+ }}>
58
+ <Text style={[styles.cancelText]}>取消</Text>
59
+ </TouchableOpacity>
60
+ </View>
61
+ </View>
62
+ </Modal>);
63
+ });
64
+ export const alertSheetViewRef = React.createRef();
65
+ export const showAlertSheetModal = (props) => {
66
+ alertSheetViewRef.current?.show(props);
67
+ };
68
+ const styles = StyleSheet.create({
69
+ container: {
70
+ display: "flex",
71
+ flexGrow: 1,
72
+ justifyContent: "flex-end",
73
+ alignItems: "center",
74
+ },
75
+ wrapper: {
76
+ flexGrow: 0,
77
+ flexShrink: 0,
78
+ width: "100%",
79
+ // backgroundColor: 'pink',
80
+ overflow: "hidden",
81
+ borderTopLeftRadius: px2dp(10),
82
+ borderTopRightRadius: px2dp(10),
83
+ display: "flex",
84
+ padding: px2dp(15),
85
+ },
86
+ cancel: {
87
+ height: px2dp(50),
88
+ display: "flex",
89
+ justifyContent: "center",
90
+ alignItems: "center",
91
+ borderRadius: px2dp(10),
92
+ backgroundColor: "white",
93
+ marginTop: px2dp(15),
94
+ },
95
+ cancelText: {
96
+ fontSize: px2sp(15),
97
+ color: "#2763FF",
98
+ },
99
+ itemContainer: {
100
+ display: "flex",
101
+ borderRadius: px2dp(10),
102
+ overflow: "hidden",
103
+ backgroundColor: "#f1f1f1",
104
+ },
105
+ item: {
106
+ height: px2dp(50),
107
+ display: "flex",
108
+ justifyContent: "center",
109
+ alignItems: "center",
110
+ backgroundColor: "white",
111
+ marginTop: px2dp(0.75),
112
+ },
113
+ itemText: {
114
+ fontSize: px2sp(12),
115
+ color: "#666666",
116
+ },
117
+ });
@@ -0,0 +1,25 @@
1
+ import * as React from "react";
2
+ import { StyleProp, TextStyle, ViewStyle } from "react-native";
3
+ export type AlertViewOptions = {
4
+ title: string;
5
+ content: string | React.ReactElement;
6
+ wrapperStyle: StyleProp<ViewStyle>;
7
+ cancelText: string;
8
+ cancelContainerStyle: StyleProp<ViewStyle>;
9
+ cancelTextStyle: StyleProp<TextStyle>;
10
+ cancel: () => void;
11
+ cancelDisabled: boolean;
12
+ confirmText: string;
13
+ confirmContainerStyle: StyleProp<ViewStyle>;
14
+ confirmTextStyle: StyleProp<TextStyle>;
15
+ confirm: () => void;
16
+ };
17
+ type RefAttributes = {
18
+ show: (options: Partial<AlertViewOptions>) => void;
19
+ hide: () => void;
20
+ };
21
+ declare const _default: React.ForwardRefExoticComponent<React.RefAttributes<RefAttributes>>;
22
+ export default _default;
23
+ export declare const alertViewRef: React.RefObject<RefAttributes | null>;
24
+ export declare const showAlertModal: (props: Partial<AlertViewOptions>) => void;
25
+ //# sourceMappingURL=AlertView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlertView.d.ts","sourceRoot":"","sources":["../../../../src/components/Hud/AlertView/AlertView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAUL,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAKtB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC;IACrC,YAAY,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC3C,eAAe,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5C,gBAAgB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACvC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACnD,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB,CAAC;;AAKF,wBA+HG;AAEH,eAAO,MAAM,YAAY,uCAAmC,CAAC;AAE7D,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,CAAC,gBAAgB,CAAC,SAE9D,CAAC"}
@@ -0,0 +1,184 @@
1
+ import * as React from "react";
2
+ import { View, Text, StyleSheet, Platform, Modal, StatusBar, TouchableOpacity, Animated, Easing, } from "react-native";
3
+ import { px2dp, deviceWidth } from "../../../screen/px2dp";
4
+ import { px2sp } from "../../../screen/px2sp";
5
+ export default React.forwardRef((_, ref) => {
6
+ const defaultState = {
7
+ visible: false,
8
+ cancelText: "取消",
9
+ confirmText: "确定",
10
+ };
11
+ const [state, setState] = React.useState(defaultState);
12
+ const cancelCallbackRef = React.useRef(undefined);
13
+ const confirmCallbackRef = React.useRef(undefined);
14
+ React.useImperativeHandle(ref, () => ({
15
+ show: async (options) => {
16
+ setState(Object.assign({}, defaultState, { visible: true }, options));
17
+ cancelCallbackRef.current = options.cancel;
18
+ confirmCallbackRef.current = options.confirm;
19
+ // await sleep(50)
20
+ startAnimate(1);
21
+ },
22
+ hide,
23
+ }), []);
24
+ const hide = async () => {
25
+ startAnimate(0.3);
26
+ // await sleep(50)
27
+ setState(defaultState);
28
+ };
29
+ let scale_anim = React.useRef(new Animated.Value(0.3)).current;
30
+ const startAnimate = (x) => {
31
+ Animated.timing(scale_anim, {
32
+ toValue: x,
33
+ useNativeDriver: true,
34
+ duration: 150,
35
+ easing: Easing.ease,
36
+ }).start();
37
+ };
38
+ React.useEffect(() => {
39
+ if (Platform.OS == "android") {
40
+ if (state.visible) {
41
+ StatusBar.setBackgroundColor("black");
42
+ StatusBar.setBarStyle("light-content");
43
+ }
44
+ else {
45
+ StatusBar.setBackgroundColor("transparent");
46
+ StatusBar.setBarStyle("dark-content");
47
+ }
48
+ }
49
+ }, [state.visible]);
50
+ return (<Modal visible={state.visible} transparent animationType="fade" onRequestClose={() => {
51
+ // hide()
52
+ }}>
53
+ <View style={styles.container}>
54
+ <Animated.View style={[
55
+ styles.wrapper,
56
+ state.wrapperStyle,
57
+ { transform: [{ scale: scale_anim }] },
58
+ ]}>
59
+ {state.title && <Text style={styles.titleText}>{state.title}</Text>}
60
+ {(() => {
61
+ if (typeof state.content == "string")
62
+ return <Text style={styles.contentText}>{state.content}</Text>;
63
+ if (React.isValidElement(state.content))
64
+ return state.content;
65
+ return <View />;
66
+ })()}
67
+
68
+ {(state.cancelText || state.confirmText) && (<View style={styles.action}>
69
+ {state.cancelText && (<TouchableOpacity style={[
70
+ styles.cancel,
71
+ { marginRight: state.confirmText ? px2dp(15) : 0 },
72
+ state.cancelContainerStyle,
73
+ ]} activeOpacity={0.8} disabled={state.cancelDisabled} onPress={() => {
74
+ hide();
75
+ cancelCallbackRef.current && cancelCallbackRef.current();
76
+ cancelCallbackRef.current = undefined;
77
+ }}>
78
+ <Text style={[styles.cancelText, state.cancelTextStyle]}>
79
+ {state.cancelText}
80
+ </Text>
81
+ </TouchableOpacity>)}
82
+
83
+ {state.confirmText && (<TouchableOpacity style={[
84
+ styles.confirm,
85
+ { marginLeft: state.cancelText ? px2dp(15) : 0 },
86
+ state.confirmContainerStyle,
87
+ ]} activeOpacity={0.8} onPress={() => {
88
+ hide();
89
+ confirmCallbackRef.current && confirmCallbackRef.current();
90
+ confirmCallbackRef.current = undefined;
91
+ }}>
92
+ <Text style={[styles.confirmText, state.confirmTextStyle]}>
93
+ {state.confirmText}
94
+ </Text>
95
+ </TouchableOpacity>)}
96
+ </View>)}
97
+ </Animated.View>
98
+ </View>
99
+ </Modal>);
100
+ });
101
+ export const alertViewRef = React.createRef();
102
+ export const showAlertModal = (props) => {
103
+ alertViewRef.current?.show(props);
104
+ };
105
+ // const sleep = (msec?: number) => {
106
+ // return new Promise(resolve => {
107
+ // setTimeout(resolve, msec || 350);
108
+ // });
109
+ // }
110
+ const styles = StyleSheet.create({
111
+ container: {
112
+ display: "flex",
113
+ flexGrow: 1,
114
+ backgroundColor: "#00000088",
115
+ justifyContent: "center",
116
+ alignItems: "center",
117
+ },
118
+ wrapper: {
119
+ flexGrow: 0,
120
+ flexShrink: 0,
121
+ // minWidth: '70%',
122
+ minWidth: deviceWidth - px2dp(60),
123
+ backgroundColor: "white",
124
+ overflow: "hidden",
125
+ borderRadius: px2dp(10),
126
+ display: "flex",
127
+ padding: px2dp(15),
128
+ },
129
+ titleText: {
130
+ maxWidth: deviceWidth - px2dp(90),
131
+ fontSize: px2sp(18),
132
+ marginBottom: px2dp(20),
133
+ // backgroundColor: 'red',
134
+ textAlign: "center",
135
+ fontWeight: "bold",
136
+ color: "#1A1A1A",
137
+ },
138
+ contentText: {
139
+ maxWidth: deviceWidth - px2dp(90),
140
+ marginBottom: px2dp(20),
141
+ minHeight: px2dp(40),
142
+ flexGrow: 0,
143
+ flexShrink: 1,
144
+ width: undefined,
145
+ fontSize: px2sp(15),
146
+ // backgroundColor: 'red',
147
+ color: "#1A1A1A",
148
+ textAlign: "center",
149
+ },
150
+ action: {
151
+ display: "flex",
152
+ flexDirection: "row",
153
+ justifyContent: "space-between",
154
+ alignItems: "center",
155
+ // backgroundColor:"red"
156
+ },
157
+ cancel: {
158
+ width: "40%",
159
+ height: px2dp(44),
160
+ display: "flex",
161
+ justifyContent: "center",
162
+ alignItems: "center",
163
+ borderRadius: px2dp(10),
164
+ borderWidth: px2dp(1),
165
+ borderColor: "#A3A9CC",
166
+ },
167
+ confirm: {
168
+ width: "40%",
169
+ height: px2dp(44),
170
+ display: "flex",
171
+ justifyContent: "center",
172
+ alignItems: "center",
173
+ backgroundColor: "#2763FF",
174
+ borderRadius: px2dp(10),
175
+ },
176
+ cancelText: {
177
+ fontSize: px2sp(15),
178
+ color: "#A3A9CC",
179
+ },
180
+ confirmText: {
181
+ fontSize: px2sp(15),
182
+ color: "white",
183
+ },
184
+ });
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import { showAlertModal } from './AlertView/AlertView';
3
+ import { showAlertBottomModal } from './AlertBottomView/AlertBottomView';
4
+ import { showAlertSheetModal } from './AlertSheetView/AlertSheetView';
5
+ import { hideLoading, showLoading } from './Loading/Loading';
6
+ import { showToast } from './Toast/Toast';
7
+ import { showPopoverView, hidePopoverView } from './PopoverView/PopoverView';
8
+ import { showScanner, hideScanner } from './Scanner/Scanner';
9
+ export declare const Hud: React.FC<{}>;
10
+ export { showAlertModal, showToast, showLoading, hideLoading, showAlertBottomModal, showAlertSheetModal, showPopoverView, hidePopoverView, showScanner, hideScanner, };
11
+ //# sourceMappingURL=Hud.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hud.d.ts","sourceRoot":"","sources":["../../../src/components/Hud/Hud.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACiC,cAAc,EACrD,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAC6C,oBAAoB,EACvE,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAC2C,mBAAmB,EACpE,MAAM,iCAAiC,CAAA;AAExC,OAAO,EACH,WAAW,EAAuB,WAAW,EAChD,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EACH,SAAS,EACZ,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,eAAe,EAAE,eAAe,EAA+B,MAAM,2BAA2B,CAAA;AAGzG,OAAO,EACH,WAAW,EAAE,WAAW,EAC3B,MAAM,mBAAmB,CAAA;AAK1B,eAAO,MAAM,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,EAAE,CAe5B,CAAA;AAGD,OAAO,EACH,cAAc,EACd,SAAS,EACT,WAAW,EAAE,WAAW,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EAAE,eAAe,EAChC,WAAW,EAAC,WAAW,GAC1B,CAAA"}
@@ -0,0 +1,29 @@
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 { alertViewRef, default as AlertView, showAlertModal } from './AlertView/AlertView';
11
+ import { alertBottomViewRef, default as AlertBottomView, showAlertBottomModal } from './AlertBottomView/AlertBottomView';
12
+ import { alertSheetViewRef, default as AlertSheetView, showAlertSheetModal } from './AlertSheetView/AlertSheetView';
13
+ import { hideLoading, Loading, loadingRef, showLoading } from './Loading/Loading';
14
+ import { showToast, Toast, toastRef } from './Toast/Toast';
15
+ import { showPopoverView, hidePopoverView, popoverViewRef, PopoverView } from './PopoverView/PopoverView';
16
+ import { showScanner, hideScanner, scannerRef, Scanner } from './Scanner/Scanner';
17
+ export const Hud = () => React.cloneElement(<></>, {
18
+ // ...StyleSheet.absoluteFillObject,
19
+ // display: 'flex',
20
+ }, [
21
+ <Loading key="hud-0" ref={loadingRef}/>,
22
+ <Toast key="hud-1" ref={toastRef}/>,
23
+ <AlertView key="hud-2" ref={alertViewRef}/>,
24
+ <AlertBottomView key="hud-3-0" ref={alertBottomViewRef}/>,
25
+ <AlertSheetView key="hud-3-1" ref={alertSheetViewRef}/>,
26
+ <PopoverView key="hud-4" ref={popoverViewRef}/>,
27
+ <Scanner key="hud-5" ref={scannerRef}/>,
28
+ ]);
29
+ export { showAlertModal, showToast, showLoading, hideLoading, showAlertBottomModal, showAlertSheetModal, showPopoverView, hidePopoverView, showScanner, hideScanner, };
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ type RefAttributes = {
3
+ showLoading: (content?: string) => void;
4
+ hideLoading: () => void;
5
+ };
6
+ export declare const Loading: React.ForwardRefExoticComponent<React.RefAttributes<RefAttributes>>;
7
+ export declare const loadingRef: React.RefObject<RefAttributes | null>;
8
+ export declare const showLoading: (content?: string) => void | undefined;
9
+ export declare const hideLoading: () => void | undefined;
10
+ export {};
11
+ //# sourceMappingURL=Loading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Loading.d.ts","sourceRoot":"","sources":["../../../../src/components/Hud/Loading/Loading.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAW7D,KAAK,aAAa,GAAG;IACnB,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,OAAO,qEAoClB,CAAC;AAEH,eAAO,MAAM,UAAU,uCAAmC,CAAC;AAC3D,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,qBACF,CAAC;AAC3C,eAAO,MAAM,WAAW,wBAA0C,CAAC"}
@@ -0,0 +1,66 @@
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
+ export const Loading = React.forwardRef((_, ref) => {
11
+ const [show, setShow] = useState(false);
12
+ const [tipText, setTipText] = useState("加载中");
13
+ React.useEffect(() => {
14
+ const onBackPress = () => show;
15
+ BackHandler.addEventListener("hardwareBackPress", onBackPress);
16
+ // return () => BackHandler.removeEventListener('hardwareBackPress', onBackPress);
17
+ }, [show]);
18
+ useImperativeHandle(ref, () => ({
19
+ showLoading: (content) => {
20
+ setShow(true);
21
+ setTipText(content || "加载中");
22
+ },
23
+ hideLoading: () => {
24
+ setShow(false);
25
+ },
26
+ }), [show]);
27
+ if (!show)
28
+ return null;
29
+ return (<TouchableOpacity disabled style={styles.container}>
30
+ <View style={styles.warpper}>
31
+ <ActivityIndicator color="white" size="large"/>
32
+ <Text numberOfLines={5} style={styles.title}>
33
+ {tipText}
34
+ </Text>
35
+ </View>
36
+ </TouchableOpacity>);
37
+ });
38
+ export const loadingRef = React.createRef();
39
+ export const showLoading = (content) => loadingRef.current?.showLoading(content);
40
+ export const hideLoading = () => loadingRef.current?.hideLoading();
41
+ const SCREEN_WIDTH = Dimensions.get("window").width;
42
+ const styles = StyleSheet.create({
43
+ container: {
44
+ ...StyleSheet.absoluteFill,
45
+ display: "flex",
46
+ justifyContent: "center",
47
+ alignItems: "center",
48
+ // backgroundColor:'red'
49
+ },
50
+ warpper: {
51
+ backgroundColor: "#00000088",
52
+ padding: 40,
53
+ paddingVertical: 20,
54
+ borderRadius: 10,
55
+ justifyContent: "center",
56
+ alignItems: "center",
57
+ minWidth: 90,
58
+ },
59
+ title: {
60
+ marginTop: 5,
61
+ fontSize: 13,
62
+ lineHeight: 16,
63
+ color: "white",
64
+ maxWidth: SCREEN_WIDTH * 0.5,
65
+ },
66
+ });
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { ViewStyle, StyleProp } from "react-native";
3
+ type RefAttributes = {
4
+ showPopoverView: (options: Partial<PopoverViewOptions>) => void;
5
+ hidePopoverView: () => void;
6
+ };
7
+ export type PopoverViewOptions = {
8
+ content: React.ReactNode;
9
+ style: StyleProp<ViewStyle>;
10
+ disabled: boolean;
11
+ };
12
+ export declare const PopoverView: React.ForwardRefExoticComponent<React.RefAttributes<RefAttributes>>;
13
+ export declare const popoverViewRef: React.RefObject<RefAttributes | null>;
14
+ export declare const showPopoverView: (options: Partial<PopoverViewOptions>) => void | undefined;
15
+ export declare const hidePopoverView: () => void | undefined;
16
+ export {};
17
+ //# sourceMappingURL=PopoverView.d.ts.map