@aks-dev/easyui 1.0.181 → 1.0.183

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.

Potentially problematic release.


This version of @aks-dev/easyui might be problematic. Click here for more details.

Files changed (53) hide show
  1. package/dist/components/AnimationModal/AnimationModal.js +15 -19
  2. package/dist/components/Badge/Badge.js +13 -18
  3. package/dist/components/DottedLine/DottedLine.js +7 -10
  4. package/dist/components/Echarts/EchartsView.js +14 -18
  5. package/dist/components/Echarts/helper.js +2 -7
  6. package/dist/components/Hud/AlertBottomView/AlertBottomView.js +56 -61
  7. package/dist/components/Hud/AlertSheetView/AlertSheetView.js +42 -47
  8. package/dist/components/Hud/AlertView/AlertView.js +55 -60
  9. package/dist/components/Hud/Hud.js +17 -31
  10. package/dist/components/Hud/Loading/Loading.js +21 -27
  11. package/dist/components/Hud/PopoverView/PopoverView.js +16 -22
  12. package/dist/components/Hud/Scanner/Scanner.js +110 -116
  13. package/dist/components/Hud/Toast/Toast.js +22 -27
  14. package/dist/components/MenuView/MenuView.js +31 -34
  15. package/dist/components/Modal/Modal.js +1 -6
  16. package/dist/components/MutiPictureView/MutiPictureView.js +37 -40
  17. package/dist/components/PictureViewer/PictureViewer.js +12 -17
  18. package/dist/components/RefreshList/RefreshList.js +47 -51
  19. package/dist/components/RichText/RichText.js +17 -20
  20. package/dist/components/StickHeaderView/StickHeaderView.js +7 -10
  21. package/dist/components/TableCell/TableCell.js +30 -33
  22. package/dist/components/TextInputArea/TextInputArea.js +25 -28
  23. package/dist/components/WithLoadingContainer/WithLoadingContainer.js +22 -26
  24. package/dist/components/index.md +15 -0
  25. package/dist/index.js +19 -51
  26. package/dist/jsbridge/RNEasyui.js +11 -18
  27. package/dist/jsbridge/UpgradeModule.js +8 -14
  28. package/dist/jsbridge/index.js +2 -5
  29. package/dist/screen/index.js +2 -5
  30. package/dist/screen/px2dp.js +14 -18
  31. package/dist/screen/px2sp.js +5 -9
  32. package/dist/screen/text-fit.js +7 -10
  33. package/dist/utils/index.js +2 -5
  34. package/dist/utils/lazy.js +25 -50
  35. package/dist/utils/mode.js +8 -13
  36. package/package.json +6 -4
  37. package/readme.md +1 -1
  38. package/dist/assets/back.png +0 -0
  39. package/dist/assets/flashlight-blue.png +0 -0
  40. package/dist/assets/flashlight-white.png +0 -0
  41. package/dist/assets/icon_add_image.png +0 -0
  42. package/dist/assets/icon_back_white.png +0 -0
  43. package/dist/assets/icon_del_image.png +0 -0
  44. package/dist/assets/loading.gif +0 -0
  45. package/dist/assets/loading3.gif +0 -0
  46. /package/dist/{assets → components/Hud/Scanner}/assets/flashlight-blue.png +0 -0
  47. /package/dist/{assets → components/Hud/Scanner}/assets/flashlight-white.png +0 -0
  48. /package/dist/{assets → components/Hud/Scanner}/assets/icon_back_white.png +0 -0
  49. /package/dist/{assets → components/MutiPictureView}/assets/icon_add_image.png +0 -0
  50. /package/dist/{assets → components/MutiPictureView}/assets/icon_del_image.png +0 -0
  51. /package/dist/{assets → components/TableCell}/assets/back.png +0 -0
  52. /package/dist/{assets → components/WithLoadingContainer}/assets/loading.gif +0 -0
  53. /package/dist/{assets → components/WithLoadingContainer}/assets/loading3.gif +0 -0
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hideScanner = exports.showScanner = exports.scannerRef = exports.Scanner = void 0;
4
- const tslib_1 = require("tslib");
5
1
  /*
6
2
  * @Author: shiguo
7
3
  * @Date: 2022-04-24 14:27:02
@@ -9,49 +5,49 @@ const tslib_1 = require("tslib");
9
5
  * @LastEditTime: 2023-03-23 15:04:18
10
6
  * @FilePath: /@aks-dev/easyui/lib/Hud/Scanner/Scanner.tsx
11
7
  */
12
- const react_1 = tslib_1.__importStar(require("react"));
13
- const react_native_1 = require("react-native");
14
- const react_native_vision_camera_1 = require("react-native-vision-camera");
15
- const react_native_permissions_1 = require("react-native-permissions");
16
- const px2dp_1 = require("../../../screen/px2dp");
17
- const px2sp_1 = require("../../../screen/px2sp");
18
- const utils = tslib_1.__importStar(require("../../../utils/lazy"));
19
- const Toast_1 = require("../Toast/Toast");
8
+ import React, { useImperativeHandle, useState } from "react";
9
+ import { Animated, BackHandler, Easing, Image, StyleSheet, Text, TouchableOpacity, View, } from "react-native";
10
+ import { Camera, useCameraDevice, useCameraPermission, useCodeScanner, } from "react-native-vision-camera";
11
+ import { PERMISSIONS, requestMultiple } from "react-native-permissions";
12
+ import { navigationBarHeight, px2dp, statusBarHeight, } from "../../../screen/px2dp";
13
+ import { px2sp } from "../../../screen/px2sp";
14
+ import * as utils from "../../../utils/lazy";
15
+ import { showToast } from "../Toast/Toast";
20
16
  // enum SCANNER_TYPE {
21
17
  // DENIED = -1,//没有开始权限
22
18
  // START = 0,//没有扫描结果,继续扫描
23
19
  // SUCCESS = 1,//已有扫描结果,停止扫描
24
20
  // }
25
- exports.Scanner = react_1.default.forwardRef((_, ref) => {
26
- const [show, setShow] = (0, react_1.useState)(false);
27
- const moveAnim = react_1.default.useRef(new react_native_1.Animated.Value(0)).current;
28
- const [pointStyle, setPointStyle] = react_1.default.useState();
29
- const cameraRef = react_1.default.useRef(null);
30
- const _cbRef = react_1.default.useRef(null);
31
- const _scanerResultRef = react_1.default.useRef(null);
32
- const device = (0, react_native_vision_camera_1.useCameraDevice)("back");
33
- const { hasPermission } = (0, react_native_vision_camera_1.useCameraPermission)();
34
- react_1.default.useEffect(() => {
21
+ export const Scanner = React.forwardRef((_, ref) => {
22
+ const [show, setShow] = useState(false);
23
+ const moveAnim = React.useRef(new Animated.Value(0)).current;
24
+ const [pointStyle, setPointStyle] = React.useState();
25
+ const cameraRef = React.useRef(null);
26
+ const _cbRef = React.useRef(null);
27
+ const _scanerResultRef = React.useRef(null);
28
+ const device = useCameraDevice("back");
29
+ const { hasPermission } = useCameraPermission();
30
+ React.useEffect(() => {
35
31
  const onBackPress = () => {
36
32
  if (show) {
37
33
  _hideScanner();
38
34
  }
39
35
  return true;
40
36
  };
41
- react_native_1.BackHandler.addEventListener("hardwareBackPress", onBackPress);
37
+ BackHandler.addEventListener("hardwareBackPress", onBackPress);
42
38
  // return () => BackHandler.removeEventListener('hardwareBackPress', onBackPress);
43
39
  }, [show]);
44
- (0, react_1.useImperativeHandle)(ref, () => ({
40
+ useImperativeHandle(ref, () => ({
45
41
  showScanner: _showScanner,
46
42
  hideScanner: _hideScanner,
47
43
  }), [show]);
48
44
  const _showScanner = async (cb) => {
49
- let res = await (0, react_native_permissions_1.requestMultiple)([
50
- react_native_permissions_1.PERMISSIONS.IOS.CAMERA,
51
- react_native_permissions_1.PERMISSIONS.ANDROID.CAMERA,
45
+ let res = await requestMultiple([
46
+ PERMISSIONS.IOS.CAMERA,
47
+ PERMISSIONS.ANDROID.CAMERA,
52
48
  ]);
53
- if (res[react_native_permissions_1.PERMISSIONS.ANDROID.CAMERA] == "granted" ||
54
- res[react_native_permissions_1.PERMISSIONS.IOS.CAMERA] == "granted") {
49
+ if (res[PERMISSIONS.ANDROID.CAMERA] == "granted" ||
50
+ res[PERMISSIONS.IOS.CAMERA] == "granted") {
55
51
  _scanerResultRef.current = null;
56
52
  setShow(true);
57
53
  setPointStyle({});
@@ -61,7 +57,7 @@ exports.Scanner = react_1.default.forwardRef((_, ref) => {
61
57
  }
62
58
  else {
63
59
  _hideScanner();
64
- (0, Toast_1.showToast)("您未开启相机权限,暂不能使用此功能");
60
+ showToast("您未开启相机权限,暂不能使用此功能");
65
61
  }
66
62
  };
67
63
  const _hideScanner = async () => {
@@ -69,17 +65,17 @@ exports.Scanner = react_1.default.forwardRef((_, ref) => {
69
65
  await utils.sleep();
70
66
  setShow(false);
71
67
  };
72
- const animation = react_native_1.Animated.loop(react_native_1.Animated.sequence([
73
- react_native_1.Animated.timing(moveAnim, {
74
- toValue: (0, px2dp_1.px2dp)(222),
68
+ const animation = Animated.loop(Animated.sequence([
69
+ Animated.timing(moveAnim, {
70
+ toValue: px2dp(222),
75
71
  duration: 3000,
76
- easing: react_native_1.Easing.linear,
72
+ easing: Easing.linear,
77
73
  useNativeDriver: true,
78
74
  }),
79
- react_native_1.Animated.timing(moveAnim, {
75
+ Animated.timing(moveAnim, {
80
76
  toValue: 0,
81
77
  duration: 3000,
82
- easing: react_native_1.Easing.linear,
78
+ easing: Easing.linear,
83
79
  useNativeDriver: true,
84
80
  }),
85
81
  ]));
@@ -97,7 +93,7 @@ exports.Scanner = react_1.default.forwardRef((_, ref) => {
97
93
  cameraRef.current?.pausePreview();
98
94
  animation.stop();
99
95
  };
100
- const codeScanner = (0, react_native_vision_camera_1.useCodeScanner)({
96
+ const codeScanner = useCodeScanner({
101
97
  codeTypes: ["qr", "ean-13"],
102
98
  onCodeScanned: (codes) => {
103
99
  console.log(`Scanned ${codes.length} codes!`);
@@ -112,85 +108,85 @@ exports.Scanner = react_1.default.forwardRef((_, ref) => {
112
108
  if (!show)
113
109
  return null;
114
110
  if (!hasPermission)
115
- return <react_native_1.Text>PermissionsPage</react_native_1.Text>;
111
+ return <Text>PermissionsPage</Text>;
116
112
  if (device == null)
117
- return <react_native_1.Text>NoCameraDeviceError</react_native_1.Text>;
118
- return (<react_native_1.TouchableOpacity disabled style={react_native_1.StyleSheet.absoluteFillObject}>
119
- <react_native_vision_camera_1.Camera ref={cameraRef} style={styles.camera} device={device} codeScanner={codeScanner} isActive={true}>
113
+ return <Text>NoCameraDeviceError</Text>;
114
+ return (<TouchableOpacity disabled style={StyleSheet.absoluteFillObject}>
115
+ <Camera ref={cameraRef} style={styles.camera} device={device} codeScanner={codeScanner} isActive={true}>
120
116
  {/* 导航栏 */}
121
- <react_native_1.View style={{
117
+ <View style={{
122
118
  display: "flex",
123
119
  justifyContent: "center",
124
120
  alignItems: "center",
125
- height: px2dp_1.navigationBarHeight,
126
- marginTop: px2dp_1.statusBarHeight,
121
+ height: navigationBarHeight,
122
+ marginTop: statusBarHeight,
127
123
  position: "relative",
128
124
  }}>
129
- <react_native_1.TouchableOpacity onPress={() => _hideScanner()} style={{
130
- height: px2dp_1.navigationBarHeight,
131
- width: (0, px2dp_1.px2dp)(50),
132
- paddingLeft: (0, px2dp_1.px2dp)(15),
125
+ <TouchableOpacity onPress={() => _hideScanner()} style={{
126
+ height: navigationBarHeight,
127
+ width: px2dp(50),
128
+ paddingLeft: px2dp(15),
133
129
  position: "absolute",
134
130
  left: 0,
135
131
  display: "flex",
136
132
  justifyContent: "center",
137
133
  }}>
138
- <react_native_1.Image source={require("../../../assets/icon_back_white.png")} style={{ width: (0, px2dp_1.px2dp)(20), height: (0, px2dp_1.px2dp)(20) }} resizeMode="contain"/>
139
- </react_native_1.TouchableOpacity>
140
- <react_native_1.Text style={{
141
- fontSize: (0, px2sp_1.px2sp)(16),
134
+ <Image source={require("./assets/icon_back_white.png")} style={{ width: px2dp(20), height: px2dp(20) }} resizeMode="contain"/>
135
+ </TouchableOpacity>
136
+ <Text style={{
137
+ fontSize: px2sp(16),
142
138
  color: "white",
143
139
  fontWeight: "bold",
144
140
  }}>
145
141
  扫一扫
146
- </react_native_1.Text>
147
- </react_native_1.View>
142
+ </Text>
143
+ </View>
148
144
 
149
145
  {/* 动画框 */}
150
- <react_native_1.View style={styles.scanContainer}>
151
- <react_native_1.View style={styles.rectangle}>
152
- <react_native_1.View style={styles.rectangleLeft}/>
153
- <react_native_1.View style={styles.cameraBackground}>
154
- <react_native_1.Animated.View style={[
146
+ <View style={styles.scanContainer}>
147
+ <View style={styles.rectangle}>
148
+ <View style={styles.rectangleLeft}/>
149
+ <View style={styles.cameraBackground}>
150
+ <Animated.View style={[
155
151
  styles.scanLine,
156
152
  { transform: [{ translateY: moveAnim }] },
157
153
  ]}/>
158
- <react_native_1.View style={styles.reactLineTopLeftX}/>
159
- <react_native_1.View style={styles.reactLineTopLeftY}/>
160
- <react_native_1.View style={styles.reactLineTopRightX}/>
161
- <react_native_1.View style={styles.reactLineTopRightY}/>
162
- <react_native_1.View style={styles.reactLineBottomLeftX}/>
163
- <react_native_1.View style={styles.reactLineBottomLeftY}/>
164
- <react_native_1.View style={styles.reactLineBottomRightX}/>
165
- <react_native_1.View style={styles.reactLineBottomRightY}/>
166
- </react_native_1.View>
167
- <react_native_1.View style={styles.rectangleRight}/>
168
- </react_native_1.View>
154
+ <View style={styles.reactLineTopLeftX}/>
155
+ <View style={styles.reactLineTopLeftY}/>
156
+ <View style={styles.reactLineTopRightX}/>
157
+ <View style={styles.reactLineTopRightY}/>
158
+ <View style={styles.reactLineBottomLeftX}/>
159
+ <View style={styles.reactLineBottomLeftY}/>
160
+ <View style={styles.reactLineBottomRightX}/>
161
+ <View style={styles.reactLineBottomRightY}/>
162
+ </View>
163
+ <View style={styles.rectangleRight}/>
164
+ </View>
169
165
 
170
166
  {/* <TouchableOpacity onPress={() => setTorchOn(!torchOn)}>
171
167
  <Image
172
168
  source={
173
169
  torchOn
174
- ? require("../../../assets/flashlight-blue.png")
175
- : require("../../../assets/flashlight-white.png")
170
+ ? require("./assets/flashlight-blue.png")
171
+ : require("./assets/flashlight-white.png")
176
172
  }
177
173
  style={styles.flashlight}
178
174
  />
179
175
  </TouchableOpacity> */}
180
- <react_native_1.Text style={styles.rectangleText}>
176
+ <Text style={styles.rectangleText}>
181
177
  将二维码/条码放入框内,即可自动扫描
182
- </react_native_1.Text>
183
- </react_native_1.View>
184
- <react_native_1.View style={pointStyle}/>
185
- </react_native_vision_camera_1.Camera>
186
- </react_native_1.TouchableOpacity>);
178
+ </Text>
179
+ </View>
180
+ <View style={pointStyle}/>
181
+ </Camera>
182
+ </TouchableOpacity>);
187
183
  });
188
184
  const transparent = "#00000000";
189
185
  const lineColor = "#6ab3ff";
190
186
  const scanW = 225;
191
187
  const scanCornerLineLength = 15;
192
188
  const scanCornerLineHeight = 3;
193
- const styles = react_native_1.StyleSheet.create({
189
+ const styles = StyleSheet.create({
194
190
  camera: {
195
191
  display: "flex",
196
192
  flex: 1,
@@ -198,8 +194,8 @@ const styles = react_native_1.StyleSheet.create({
198
194
  backgroundColor: "red",
199
195
  },
200
196
  cameraBackground: {
201
- width: (0, px2dp_1.px2dp)(scanW),
202
- height: (0, px2dp_1.px2dp)(scanW),
197
+ width: px2dp(scanW),
198
+ height: px2dp(scanW),
203
199
  backgroundColor: transparent,
204
200
  },
205
201
  scanContainer: {
@@ -211,97 +207,95 @@ const styles = react_native_1.StyleSheet.create({
211
207
  rectangle: { flexDirection: "row", overflow: "hidden" },
212
208
  rectangleLeft: {
213
209
  backgroundColor: transparent,
214
- height: (0, px2dp_1.px2dp)(scanW),
215
- width: (0, px2dp_1.px2dp)(scanW),
210
+ height: px2dp(scanW),
211
+ width: px2dp(scanW),
216
212
  },
217
213
  rectangleRight: {
218
214
  backgroundColor: transparent,
219
- height: (0, px2dp_1.px2dp)(scanW),
220
- width: (0, px2dp_1.px2dp)(scanW),
215
+ height: px2dp(scanW),
216
+ width: px2dp(scanW),
221
217
  },
222
- rectangleText: { color: "#fff", lineHeight: (0, px2dp_1.px2dp)(15) },
218
+ rectangleText: { color: "#fff", lineHeight: px2dp(15) },
223
219
  scanLine: {
224
- width: (0, px2dp_1.px2dp)(scanW),
225
- height: (0, px2dp_1.px2dp)(scanCornerLineHeight),
226
- borderRadius: (0, px2dp_1.px2dp)(25),
220
+ width: px2dp(scanW),
221
+ height: px2dp(scanCornerLineHeight),
222
+ borderRadius: px2dp(25),
227
223
  backgroundColor: lineColor,
228
224
  },
229
225
  reactLineTopLeftX: {
230
226
  position: "absolute",
231
227
  top: 0,
232
228
  left: 0,
233
- width: (0, px2dp_1.px2dp)(scanCornerLineLength),
234
- height: (0, px2dp_1.px2dp)(scanCornerLineHeight),
229
+ width: px2dp(scanCornerLineLength),
230
+ height: px2dp(scanCornerLineHeight),
235
231
  backgroundColor: lineColor,
236
232
  },
237
233
  reactLineTopLeftY: {
238
234
  position: "absolute",
239
235
  top: 0,
240
236
  left: 0,
241
- width: (0, px2dp_1.px2dp)(scanCornerLineHeight),
242
- height: (0, px2dp_1.px2dp)(scanCornerLineLength),
237
+ width: px2dp(scanCornerLineHeight),
238
+ height: px2dp(scanCornerLineLength),
243
239
  backgroundColor: lineColor,
244
240
  },
245
241
  reactLineTopRightX: {
246
242
  position: "absolute",
247
243
  top: 0,
248
244
  right: 0,
249
- width: (0, px2dp_1.px2dp)(scanCornerLineLength),
250
- height: (0, px2dp_1.px2dp)(scanCornerLineHeight),
245
+ width: px2dp(scanCornerLineLength),
246
+ height: px2dp(scanCornerLineHeight),
251
247
  backgroundColor: lineColor,
252
248
  },
253
249
  reactLineTopRightY: {
254
250
  position: "absolute",
255
251
  top: 0,
256
252
  right: 0,
257
- width: (0, px2dp_1.px2dp)(scanCornerLineHeight),
258
- height: (0, px2dp_1.px2dp)(scanCornerLineLength),
253
+ width: px2dp(scanCornerLineHeight),
254
+ height: px2dp(scanCornerLineLength),
259
255
  backgroundColor: lineColor,
260
256
  },
261
257
  reactLineBottomLeftX: {
262
258
  position: "absolute",
263
259
  bottom: 0,
264
260
  left: 0,
265
- width: (0, px2dp_1.px2dp)(scanCornerLineLength),
266
- height: (0, px2dp_1.px2dp)(scanCornerLineHeight),
261
+ width: px2dp(scanCornerLineLength),
262
+ height: px2dp(scanCornerLineHeight),
267
263
  backgroundColor: lineColor,
268
264
  },
269
265
  reactLineBottomLeftY: {
270
266
  position: "absolute",
271
267
  bottom: 0,
272
268
  left: 0,
273
- width: (0, px2dp_1.px2dp)(scanCornerLineHeight),
274
- height: (0, px2dp_1.px2dp)(scanCornerLineLength),
269
+ width: px2dp(scanCornerLineHeight),
270
+ height: px2dp(scanCornerLineLength),
275
271
  backgroundColor: lineColor,
276
272
  },
277
273
  reactLineBottomRightX: {
278
274
  position: "absolute",
279
275
  bottom: 0,
280
276
  right: 0,
281
- width: (0, px2dp_1.px2dp)(scanCornerLineLength),
282
- height: (0, px2dp_1.px2dp)(scanCornerLineHeight),
277
+ width: px2dp(scanCornerLineLength),
278
+ height: px2dp(scanCornerLineHeight),
283
279
  backgroundColor: lineColor,
284
280
  },
285
281
  reactLineBottomRightY: {
286
282
  position: "absolute",
287
283
  bottom: 0,
288
284
  right: 0,
289
- width: (0, px2dp_1.px2dp)(scanCornerLineHeight),
290
- height: (0, px2dp_1.px2dp)(scanCornerLineLength),
285
+ width: px2dp(scanCornerLineHeight),
286
+ height: px2dp(scanCornerLineLength),
291
287
  backgroundColor: lineColor,
292
288
  },
293
289
  flashlight: {
294
- width: (0, px2dp_1.px2dp)(30),
295
- height: (0, px2dp_1.px2dp)(30),
290
+ width: px2dp(30),
291
+ height: px2dp(30),
296
292
  resizeMode: "contain",
297
- marginTop: (0, px2dp_1.px2dp)(50),
298
- marginBottom: (0, px2dp_1.px2dp)(15),
299
- marginHorizontal: (0, px2dp_1.px2dp)(15),
293
+ marginTop: px2dp(50),
294
+ marginBottom: px2dp(15),
295
+ marginHorizontal: px2dp(15),
300
296
  },
301
- grantedText: { lineHeight: (0, px2dp_1.px2dp)(30), color: lineColor, fontWeight: "bold" },
297
+ grantedText: { lineHeight: px2dp(30), color: lineColor, fontWeight: "bold" },
302
298
  });
303
- exports.scannerRef = react_1.default.createRef();
304
- const showScanner = (cb) => exports.scannerRef.current?.showScanner(cb);
305
- exports.showScanner = showScanner;
306
- const hideScanner = () => exports.scannerRef.current?.hideScanner();
307
- exports.hideScanner = hideScanner;
299
+ export const scannerRef = React.createRef();
300
+ export const showScanner = (cb) => scannerRef.current?.showScanner(cb);
301
+ export const hideScanner = () => scannerRef.current?.hideScanner();
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.showToast = exports.toastRef = exports.Toast = void 0;
4
- const tslib_1 = require("tslib");
5
1
  /*
6
2
  * @Author: shiguo
7
3
  * @Date: 2021-04-27 10:38:04
@@ -9,47 +5,46 @@ const tslib_1 = require("tslib");
9
5
  * @LastEditTime: 2022-09-09 10:58:34
10
6
  * @FilePath: /@aks-dev/easyui/lib/Hud/Toast/Toast.tsx
11
7
  */
12
- const react_1 = tslib_1.__importStar(require("react"));
13
- const react_native_1 = require("react-native");
8
+ import React, { useImperativeHandle, useState, useRef } from "react";
9
+ import { View, StyleSheet, Text, Dimensions, Animated, Easing, } from "react-native";
14
10
  const errorMsg = "(^_^)∠※ 送你一束小花";
15
- exports.Toast = react_1.default.forwardRef((_, ref) => {
16
- const [tipText, setTipText] = (0, react_1.useState)(errorMsg);
17
- const fade = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
18
- const fadeAnimation = react_native_1.Animated.sequence([
19
- react_native_1.Animated.timing(fade, {
11
+ export const Toast = React.forwardRef((_, ref) => {
12
+ const [tipText, setTipText] = useState(errorMsg);
13
+ const fade = useRef(new Animated.Value(0)).current;
14
+ const fadeAnimation = Animated.sequence([
15
+ Animated.timing(fade, {
20
16
  toValue: 1,
21
17
  duration: 750,
22
18
  useNativeDriver: true,
23
- easing: react_native_1.Easing.linear,
19
+ easing: Easing.linear,
24
20
  }),
25
- react_native_1.Animated.delay(3000),
26
- react_native_1.Animated.timing(fade, {
21
+ Animated.delay(3000),
22
+ Animated.timing(fade, {
27
23
  toValue: 0,
28
24
  duration: 750,
29
25
  useNativeDriver: true,
30
- easing: react_native_1.Easing.linear,
26
+ easing: Easing.linear,
31
27
  }),
32
28
  ]);
33
- (0, react_1.useImperativeHandle)(ref, () => ({
29
+ useImperativeHandle(ref, () => ({
34
30
  showToast: (content) => {
35
31
  setTipText(content || errorMsg);
36
32
  fadeAnimation.reset();
37
33
  fadeAnimation.start();
38
34
  },
39
35
  }));
40
- return (<react_native_1.Animated.View style={{ ...styles.toastContainer, opacity: fade }}>
41
- <react_native_1.View style={styles.toastTipsContainer}>
42
- <react_native_1.Text numberOfLines={5} style={{ ...styles.toastTitle }}>
36
+ return (<Animated.View style={{ ...styles.toastContainer, opacity: fade }}>
37
+ <View style={styles.toastTipsContainer}>
38
+ <Text numberOfLines={5} style={{ ...styles.toastTitle }}>
43
39
  {tipText}{" "}
44
- </react_native_1.Text>
45
- </react_native_1.View>
46
- </react_native_1.Animated.View>);
40
+ </Text>
41
+ </View>
42
+ </Animated.View>);
47
43
  });
48
- exports.toastRef = react_1.default.createRef();
49
- const showToast = (content) => exports.toastRef.current?.showToast(content);
50
- exports.showToast = showToast;
51
- const SCREEN_WIDTH = react_native_1.Dimensions.get("window").width;
52
- const styles = react_native_1.StyleSheet.create({
44
+ export const toastRef = React.createRef();
45
+ export const showToast = (content) => toastRef.current?.showToast(content);
46
+ const SCREEN_WIDTH = Dimensions.get("window").width;
47
+ const styles = StyleSheet.create({
53
48
  toastContainer: {
54
49
  position: "absolute",
55
50
  bottom: 100,
@@ -1,19 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const react_1 = tslib_1.__importDefault(require("react"));
5
- const react_native_1 = require("react-native");
6
- const px2dp_1 = require("../../screen/px2dp");
1
+ import React from "react";
2
+ import { Image, ScrollView, Text, TouchableOpacity, View, } from "react-native";
3
+ import { deviceHeight, deviceWidth } from "../../screen/px2dp";
7
4
  // import * as utils from '../../utils/lazy';
8
- const Hud_1 = require("../Hud/Hud");
5
+ import { hidePopoverView, showPopoverView } from "../Hud/Hud";
9
6
  // type Reducer = (prevState: State, action: Partial<State>) => State
10
- exports.default = (props) => {
7
+ export default (props) => {
11
8
  const { defaultAlignHorizontal = "left", defaultAlignVertical = "bottom" } = props;
12
- const [state, dispatch] = react_1.default.useReducer((prevState, action) => Object.assign({}, prevState, action), {});
9
+ const [state, dispatch] = React.useReducer((prevState, action) => Object.assign({}, prevState, action), {});
13
10
  // const containerRef = React.useRef<{ measureInWindow: (callback: MeasureInWindowOnSuccessCallback) => void }>()
14
- const containerRef = react_1.default.useRef(null);
15
- const rootView = react_1.default.useRef({ pageX: 0, pageY: 0, width: 0, height: 0 });
16
- const sc = react_1.default.useRef({ x: 0, y: 0, width: 0, height: 0 });
11
+ const containerRef = React.useRef(null);
12
+ const rootView = React.useRef({ pageX: 0, pageY: 0, width: 0, height: 0 });
13
+ const sc = React.useRef({ x: 0, y: 0, width: 0, height: 0 });
17
14
  // React.useEffect(() => {
18
15
  // ; (async () => {
19
16
  // await utils.sleep()
@@ -54,10 +51,10 @@ exports.default = (props) => {
54
51
  let x = rootView.current.pageX;
55
52
  // let y = (StatusBar.currentHeight || 0) + _container.current.y + height
56
53
  let y = rootView.current.pageY + height;
57
- if (x > Math.abs(px2dp_1.deviceWidth - width - x)) {
54
+ if (x > Math.abs(deviceWidth - width - x)) {
58
55
  alignHorizontal = "right";
59
56
  }
60
- if (y > px2dp_1.deviceHeight * 0.5) {
57
+ if (y > deviceHeight * 0.5) {
61
58
  alignVertical = "top";
62
59
  }
63
60
  /**todo: target_width的获取是延迟的,所以这里又问题 */
@@ -79,9 +76,9 @@ exports.default = (props) => {
79
76
  // console.log({ getLayoutInfos: getLayoutInfos() })
80
77
  const layout = () => {
81
78
  if (alignHorizontal == "left") {
82
- if (target_width + x > px2dp_1.deviceWidth) {
79
+ if (target_width + x > deviceWidth) {
83
80
  return {
84
- left: Math.abs(px2dp_1.deviceWidth - target_width) * 0.7,
81
+ left: Math.abs(deviceWidth - target_width) * 0.7,
85
82
  top: y,
86
83
  };
87
84
  }
@@ -91,10 +88,10 @@ exports.default = (props) => {
91
88
  };
92
89
  }
93
90
  else {
94
- let _x = px2dp_1.deviceWidth - x - width;
95
- if (target_width + _x > px2dp_1.deviceWidth) {
91
+ let _x = deviceWidth - x - width;
92
+ if (target_width + _x > deviceWidth) {
96
93
  return {
97
- right: Math.abs(px2dp_1.deviceWidth - target_width) * 0.7,
94
+ right: Math.abs(deviceWidth - target_width) * 0.7,
98
95
  top: y,
99
96
  };
100
97
  }
@@ -123,11 +120,11 @@ exports.default = (props) => {
123
120
  /**重新获取rootview的定位 */
124
121
  await getRootViewlayoutPromise();
125
122
  /**重新获取rootview的定位 */
126
- (0, Hud_1.showPopoverView)({
127
- content: (<react_native_1.TouchableOpacity activeOpacity={1} style={{
123
+ showPopoverView({
124
+ content: (<TouchableOpacity activeOpacity={1} style={{
128
125
  position: "absolute",
129
- minWidth: px2dp_1.deviceWidth * 0.36,
130
- maxWidth: px2dp_1.deviceWidth * 0.8,
126
+ minWidth: deviceWidth * 0.36,
127
+ maxWidth: deviceWidth * 0.8,
131
128
  minHeight: CELL_HEIGHT + PADDING * 2,
132
129
  maxHeight: CELL_HEIGHT * 5 + PADDING * 2,
133
130
  borderRadius: 6,
@@ -136,7 +133,7 @@ exports.default = (props) => {
136
133
  padding: PADDING,
137
134
  ...reLayout(),
138
135
  }}>
139
- <react_native_1.View style={{
136
+ <View style={{
140
137
  width: ARROW_HEIGHT,
141
138
  height: ARROW_HEIGHT,
142
139
  backgroundColor: "#000000ee",
@@ -157,13 +154,13 @@ exports.default = (props) => {
157
154
  })(),
158
155
  }}/>
159
156
 
160
- <react_native_1.ScrollView onLayout={(e) => {
157
+ <ScrollView onLayout={(e) => {
161
158
  // console.log('target onLayout', e.nativeEvent.layout)
162
159
  let _sc = e.nativeEvent.layout;
163
160
  sc.current = _sc;
164
161
  }}>
165
162
  {props.data?.map((i, idx) => {
166
- return (<react_native_1.TouchableOpacity activeOpacity={0.7} key={`sg-memnu-${idx}`} style={{
163
+ return (<TouchableOpacity activeOpacity={0.7} key={`sg-memnu-${idx}`} style={{
167
164
  height: CELL_HEIGHT,
168
165
  display: "flex",
169
166
  flexDirection: "row",
@@ -171,17 +168,17 @@ exports.default = (props) => {
171
168
  // ,backgroundColor:utils.randomcolor()
172
169
  }} onPress={(e) => {
173
170
  props.onItemClick && props.onItemClick(idx, i.extra);
174
- (0, Hud_1.hidePopoverView)();
171
+ hidePopoverView();
175
172
  }}>
176
- {i.icon && (<react_native_1.Image style={{ width: 18, height: 18, marginRight: 4 }} source={i.icon}/>)}
177
- <react_native_1.Text style={{ flexShrink: 1, fontSize: 14, color: "white" }}>
173
+ {i.icon && (<Image style={{ width: 18, height: 18, marginRight: 4 }} source={i.icon}/>)}
174
+ <Text style={{ flexShrink: 1, fontSize: 14, color: "white" }}>
178
175
  {i.text}
179
- </react_native_1.Text>
180
- </react_native_1.TouchableOpacity>);
176
+ </Text>
177
+ </TouchableOpacity>);
181
178
  })}
182
- </react_native_1.ScrollView>
183
- </react_native_1.TouchableOpacity>),
179
+ </ScrollView>
180
+ </TouchableOpacity>),
184
181
  });
185
182
  };
186
- return (<react_native_1.TouchableOpacity ref={containerRef} onPress={(e) => show()} {...props}/>);
183
+ return (<TouchableOpacity ref={containerRef} onPress={(e) => show()} {...props}/>);
187
184
  };
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /*
3
2
  * @Author: shiguo
4
3
  * @Date: 2022-04-26 11:30:34
@@ -6,8 +5,4 @@
6
5
  * @LastEditTime: 2022-10-27 16:37:32
7
6
  * @FilePath: /@aks-dev/easyui/lib/Modal/Modal.tsx
8
7
  */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.Modal = void 0;
11
- const tslib_1 = require("tslib");
12
- var react_native_modal_1 = require("react-native-modal");
13
- Object.defineProperty(exports, "Modal", { enumerable: true, get: function () { return tslib_1.__importDefault(react_native_modal_1).default; } });
8
+ export { default as Modal } from 'react-native-modal';