@aks-dev/easyui 1.0.190 → 1.0.192
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.
- package/dist/components/AnimationModal/AnimationModal.js +23 -41
- package/dist/components/Badge/Badge.js +7 -16
- package/dist/components/DottedLine/DottedLine.js +15 -20
- package/dist/components/Echarts/EchartsView.js +40 -77
- package/dist/components/Echarts/demo.js +201 -0
- package/dist/components/Echarts/helper.js +1 -16
- package/dist/components/Hud/AlertBottomView/AlertBottomView.js +49 -64
- package/dist/components/Hud/AlertSheetView/AlertSheetView.js +30 -34
- package/dist/components/Hud/AlertView/AlertView.js +52 -66
- package/dist/components/Hud/Hud.js +8 -19
- package/dist/components/Hud/Loading/Loading.js +7 -25
- package/dist/components/Hud/PopoverView/PopoverView.js +5 -20
- package/dist/components/Hud/Scanner/Scanner.js +71 -99
- package/dist/components/Hud/Toast/Toast.js +6 -16
- package/dist/components/MenuView/MenuView.js +32 -73
- package/dist/components/Modal/Modal.js +0 -7
- package/dist/components/MutiPictureView/MutiPictureView.js +78 -88
- package/dist/components/PictureViewer/PictureViewer.js +11 -32
- package/dist/components/RefreshList/RefreshList.js +43 -52
- package/dist/components/RefreshList/demo.js +9 -0
- package/dist/components/RefreshList/demo1.js +27 -0
- package/dist/components/RefreshList/demo2.js +9 -0
- package/dist/components/RichText/RichText.js +23 -23
- package/dist/components/StickHeaderView/StickHeaderView.js +2 -12
- package/dist/components/StickHeaderView/demo.js +37 -0
- package/dist/components/TableCell/TableCell.js +37 -53
- package/dist/components/TextInputArea/TextInputArea.js +22 -31
- package/dist/components/WithLoadingContainer/WithLoadingContainer.js +14 -31
- package/dist/index.js +0 -11
- package/dist/jsbridge/RNEasyui.js +1 -26
- package/dist/jsbridge/UpgradeModule.js +12 -21
- package/dist/jsbridge/index.js +0 -7
- package/dist/screen/index.js +0 -8
- package/dist/screen/px2dp.js +2 -25
- package/dist/screen/px2sp.js +5 -35
- package/dist/screen/text-fit.js +5 -21
- package/dist/utils/index.js +0 -7
- package/dist/utils/lazy.js +19 -71
- package/dist/utils/mode.js +0 -21
- package/package.json +3 -7
- package/types/components/AnimationModal/AnimationModal.d.ts +0 -8
- package/types/components/AnimationModal/AnimationModal.d.ts.map +1 -1
- package/types/components/Echarts/demo.d.ts +4 -0
- package/types/components/Echarts/demo.d.ts.map +1 -0
- package/types/components/Echarts/helper.d.ts +0 -5
- package/types/components/Echarts/helper.d.ts.map +1 -1
- package/types/components/MutiPictureView/MutiPictureView.d.ts +0 -9
- package/types/components/MutiPictureView/MutiPictureView.d.ts.map +1 -1
- package/types/components/RefreshList/demo.d.ts +2 -0
- package/types/components/RefreshList/demo.d.ts.map +1 -0
- package/types/components/RefreshList/demo1.d.ts +2 -0
- package/types/components/RefreshList/demo1.d.ts.map +1 -0
- package/types/components/RefreshList/demo2.d.ts +2 -0
- package/types/components/RefreshList/demo2.d.ts.map +1 -0
- package/types/components/StickHeaderView/StickHeaderView.d.ts +0 -6
- package/types/components/StickHeaderView/StickHeaderView.d.ts.map +1 -1
- package/types/components/StickHeaderView/demo.d.ts +4 -0
- package/types/components/StickHeaderView/demo.d.ts.map +1 -0
- package/types/components/TextInputArea/TextInputArea.d.ts +0 -1
- package/types/components/TextInputArea/TextInputArea.d.ts.map +1 -1
- package/types/jsbridge/RNEasyui.d.ts +0 -18
- package/types/jsbridge/RNEasyui.d.ts.map +1 -1
- package/types/jsbridge/UpgradeModule.d.ts +0 -15
- package/types/jsbridge/UpgradeModule.d.ts.map +1 -1
- package/types/screen/px2dp.d.ts +0 -11
- package/types/screen/px2dp.d.ts.map +1 -1
- package/types/screen/text-fit.d.ts +0 -3
- package/types/screen/text-fit.d.ts.map +1 -1
- package/types/utils/lazy.d.ts +0 -33
- package/types/utils/lazy.d.ts.map +1 -1
- package/types/utils/mode.d.ts +0 -14
- package/types/utils/mode.d.ts.map +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
8
10
|
import React, { useImperativeHandle, useState } from "react";
|
|
9
11
|
import { Animated, BackHandler, Easing, Image, StyleSheet, Text, TouchableOpacity, View, } from "react-native";
|
|
10
12
|
import { Camera, useCameraDevice, useCameraPermission, useCodeScanner, } from "react-native-vision-camera";
|
|
@@ -13,11 +15,6 @@ import { navigationBarHeight, px2dp, statusBarHeight, } from "../../../screen/px
|
|
|
13
15
|
import { px2sp } from "../../../screen/px2sp";
|
|
14
16
|
import * as utils from "../../../utils/lazy";
|
|
15
17
|
import { showToast } from "../Toast/Toast";
|
|
16
|
-
// enum SCANNER_TYPE {
|
|
17
|
-
// DENIED = -1,//没有开始权限
|
|
18
|
-
// START = 0,//没有扫描结果,继续扫描
|
|
19
|
-
// SUCCESS = 1,//已有扫描结果,停止扫描
|
|
20
|
-
// }
|
|
21
18
|
export const Scanner = React.forwardRef((_, ref) => {
|
|
22
19
|
const [show, setShow] = useState(false);
|
|
23
20
|
const moveAnim = React.useRef(new Animated.Value(0)).current;
|
|
@@ -35,14 +32,13 @@ export const Scanner = React.forwardRef((_, ref) => {
|
|
|
35
32
|
return true;
|
|
36
33
|
};
|
|
37
34
|
BackHandler.addEventListener("hardwareBackPress", onBackPress);
|
|
38
|
-
// return () => BackHandler.removeEventListener('hardwareBackPress', onBackPress);
|
|
39
35
|
}, [show]);
|
|
40
36
|
useImperativeHandle(ref, () => ({
|
|
41
37
|
showScanner: _showScanner,
|
|
42
38
|
hideScanner: _hideScanner,
|
|
43
39
|
}), [show]);
|
|
44
|
-
const _showScanner =
|
|
45
|
-
let res =
|
|
40
|
+
const _showScanner = (cb) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
let res = yield requestMultiple([
|
|
46
42
|
PERMISSIONS.IOS.CAMERA,
|
|
47
43
|
PERMISSIONS.ANDROID.CAMERA,
|
|
48
44
|
]);
|
|
@@ -51,7 +47,7 @@ export const Scanner = React.forwardRef((_, ref) => {
|
|
|
51
47
|
_scanerResultRef.current = null;
|
|
52
48
|
setShow(true);
|
|
53
49
|
setPointStyle({});
|
|
54
|
-
|
|
50
|
+
yield utils.sleep();
|
|
55
51
|
animationStart();
|
|
56
52
|
_cbRef.current = cb;
|
|
57
53
|
}
|
|
@@ -59,12 +55,12 @@ export const Scanner = React.forwardRef((_, ref) => {
|
|
|
59
55
|
_hideScanner();
|
|
60
56
|
showToast("您未开启相机权限,暂不能使用此功能");
|
|
61
57
|
}
|
|
62
|
-
};
|
|
63
|
-
const _hideScanner =
|
|
58
|
+
});
|
|
59
|
+
const _hideScanner = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
60
|
animationStop();
|
|
65
|
-
|
|
61
|
+
yield utils.sleep();
|
|
66
62
|
setShow(false);
|
|
67
|
-
};
|
|
63
|
+
});
|
|
68
64
|
const animation = Animated.loop(Animated.sequence([
|
|
69
65
|
Animated.timing(moveAnim, {
|
|
70
66
|
toValue: px2dp(222),
|
|
@@ -79,18 +75,19 @@ export const Scanner = React.forwardRef((_, ref) => {
|
|
|
79
75
|
useNativeDriver: true,
|
|
80
76
|
}),
|
|
81
77
|
]));
|
|
82
|
-
const animationStart =
|
|
83
|
-
|
|
78
|
+
const animationStart = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
79
|
+
var _a;
|
|
80
|
+
(_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.resumePreview();
|
|
84
81
|
animation.start(({ finished }) => {
|
|
85
|
-
// console.log('animationStart finished', finished)
|
|
86
82
|
if (finished) {
|
|
87
83
|
animation.reset();
|
|
88
84
|
animation.start();
|
|
89
85
|
}
|
|
90
86
|
});
|
|
91
|
-
};
|
|
87
|
+
});
|
|
92
88
|
const animationStop = (result) => {
|
|
93
|
-
|
|
89
|
+
var _a;
|
|
90
|
+
(_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.pausePreview();
|
|
94
91
|
animation.stop();
|
|
95
92
|
};
|
|
96
93
|
const codeScanner = useCodeScanner({
|
|
@@ -98,7 +95,7 @@ export const Scanner = React.forwardRef((_, ref) => {
|
|
|
98
95
|
onCodeScanned: (codes) => {
|
|
99
96
|
console.log(`Scanned ${codes.length} codes!`);
|
|
100
97
|
let code = codes.find((i) => i.value);
|
|
101
|
-
if (code
|
|
98
|
+
if ((code === null || code === void 0 ? void 0 : code.value) && _scanerResultRef.current == undefined) {
|
|
102
99
|
_scanerResultRef.current = code.value;
|
|
103
100
|
_cbRef.current(code.value);
|
|
104
101
|
_hideScanner();
|
|
@@ -108,78 +105,53 @@ export const Scanner = React.forwardRef((_, ref) => {
|
|
|
108
105
|
if (!show)
|
|
109
106
|
return null;
|
|
110
107
|
if (!hasPermission)
|
|
111
|
-
return
|
|
108
|
+
return React.createElement(Text, null, "PermissionsPage");
|
|
112
109
|
if (device == null)
|
|
113
|
-
return
|
|
114
|
-
return (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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>
|
|
165
|
-
|
|
166
|
-
{/* <TouchableOpacity onPress={() => setTorchOn(!torchOn)}>
|
|
167
|
-
<Image
|
|
168
|
-
source={
|
|
169
|
-
torchOn
|
|
170
|
-
? require("./assets/flashlight-blue.png")
|
|
171
|
-
: require("./assets/flashlight-white.png")
|
|
172
|
-
}
|
|
173
|
-
style={styles.flashlight}
|
|
174
|
-
/>
|
|
175
|
-
</TouchableOpacity> */}
|
|
176
|
-
<Text style={styles.rectangleText}>
|
|
177
|
-
将二维码/条码放入框内,即可自动扫描
|
|
178
|
-
</Text>
|
|
179
|
-
</View>
|
|
180
|
-
<View style={pointStyle}/>
|
|
181
|
-
</Camera>
|
|
182
|
-
</TouchableOpacity>);
|
|
110
|
+
return React.createElement(Text, null, "NoCameraDeviceError");
|
|
111
|
+
return (React.createElement(TouchableOpacity, { disabled: true, style: StyleSheet.absoluteFillObject },
|
|
112
|
+
React.createElement(Camera, { ref: cameraRef, style: styles.camera, device: device, codeScanner: codeScanner, isActive: true },
|
|
113
|
+
React.createElement(View, { style: {
|
|
114
|
+
display: "flex",
|
|
115
|
+
justifyContent: "center",
|
|
116
|
+
alignItems: "center",
|
|
117
|
+
height: navigationBarHeight,
|
|
118
|
+
marginTop: statusBarHeight,
|
|
119
|
+
position: "relative",
|
|
120
|
+
} },
|
|
121
|
+
React.createElement(TouchableOpacity, { onPress: () => _hideScanner(), style: {
|
|
122
|
+
height: navigationBarHeight,
|
|
123
|
+
width: px2dp(50),
|
|
124
|
+
paddingLeft: px2dp(15),
|
|
125
|
+
position: "absolute",
|
|
126
|
+
left: 0,
|
|
127
|
+
display: "flex",
|
|
128
|
+
justifyContent: "center",
|
|
129
|
+
} },
|
|
130
|
+
React.createElement(Image, { source: require("./assets/icon_back_white.png"), style: { width: px2dp(20), height: px2dp(20) }, resizeMode: "contain" })),
|
|
131
|
+
React.createElement(Text, { style: {
|
|
132
|
+
fontSize: px2sp(16),
|
|
133
|
+
color: "white",
|
|
134
|
+
fontWeight: "bold",
|
|
135
|
+
} }, "\u626B\u4E00\u626B")),
|
|
136
|
+
React.createElement(View, { style: styles.scanContainer },
|
|
137
|
+
React.createElement(View, { style: styles.rectangle },
|
|
138
|
+
React.createElement(View, { style: styles.rectangleLeft }),
|
|
139
|
+
React.createElement(View, { style: styles.cameraBackground },
|
|
140
|
+
React.createElement(Animated.View, { style: [
|
|
141
|
+
styles.scanLine,
|
|
142
|
+
{ transform: [{ translateY: moveAnim }] },
|
|
143
|
+
] }),
|
|
144
|
+
React.createElement(View, { style: styles.reactLineTopLeftX }),
|
|
145
|
+
React.createElement(View, { style: styles.reactLineTopLeftY }),
|
|
146
|
+
React.createElement(View, { style: styles.reactLineTopRightX }),
|
|
147
|
+
React.createElement(View, { style: styles.reactLineTopRightY }),
|
|
148
|
+
React.createElement(View, { style: styles.reactLineBottomLeftX }),
|
|
149
|
+
React.createElement(View, { style: styles.reactLineBottomLeftY }),
|
|
150
|
+
React.createElement(View, { style: styles.reactLineBottomRightX }),
|
|
151
|
+
React.createElement(View, { style: styles.reactLineBottomRightY })),
|
|
152
|
+
React.createElement(View, { style: styles.rectangleRight })),
|
|
153
|
+
React.createElement(Text, { style: styles.rectangleText }, "\u5C06\u4E8C\u7EF4\u7801/\u6761\u7801\u653E\u5165\u6846\u5185\uFF0C\u5373\u53EF\u81EA\u52A8\u626B\u63CF")),
|
|
154
|
+
React.createElement(View, { style: pointStyle }))));
|
|
183
155
|
});
|
|
184
156
|
const transparent = "#00000000";
|
|
185
157
|
const lineColor = "#6ab3ff";
|
|
@@ -297,5 +269,5 @@ const styles = StyleSheet.create({
|
|
|
297
269
|
grantedText: { lineHeight: px2dp(30), color: lineColor, fontWeight: "bold" },
|
|
298
270
|
});
|
|
299
271
|
export const scannerRef = React.createRef();
|
|
300
|
-
export const showScanner = (cb) => scannerRef.current
|
|
301
|
-
export const hideScanner = () => scannerRef.current
|
|
272
|
+
export const showScanner = (cb) => { var _a; return (_a = scannerRef.current) === null || _a === void 0 ? void 0 : _a.showScanner(cb); };
|
|
273
|
+
export const hideScanner = () => { var _a; return (_a = scannerRef.current) === null || _a === void 0 ? void 0 : _a.hideScanner(); };
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: shiguo
|
|
3
|
-
* @Date: 2021-04-27 10:38:04
|
|
4
|
-
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-09-09 10:58:34
|
|
6
|
-
* @FilePath: /@aks-dev/easyui/lib/Hud/Toast/Toast.tsx
|
|
7
|
-
*/
|
|
8
1
|
import React, { useImperativeHandle, useState, useRef } from "react";
|
|
9
2
|
import { View, StyleSheet, Text, Dimensions, Animated, Easing, } from "react-native";
|
|
10
3
|
const errorMsg = "(^_^)∠※ 送你一束小花";
|
|
@@ -33,16 +26,14 @@ export const Toast = React.forwardRef((_, ref) => {
|
|
|
33
26
|
fadeAnimation.start();
|
|
34
27
|
},
|
|
35
28
|
}));
|
|
36
|
-
return (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</View>
|
|
42
|
-
</Animated.View>);
|
|
29
|
+
return (React.createElement(Animated.View, { style: Object.assign(Object.assign({}, styles.toastContainer), { opacity: fade }) },
|
|
30
|
+
React.createElement(View, { style: styles.toastTipsContainer },
|
|
31
|
+
React.createElement(Text, { numberOfLines: 5, style: Object.assign({}, styles.toastTitle) },
|
|
32
|
+
tipText,
|
|
33
|
+
" "))));
|
|
43
34
|
});
|
|
44
35
|
export const toastRef = React.createRef();
|
|
45
|
-
export const showToast = (content) => toastRef.current
|
|
36
|
+
export const showToast = (content) => { var _a; return (_a = toastRef.current) === null || _a === void 0 ? void 0 : _a.showToast(content); };
|
|
46
37
|
const SCREEN_WIDTH = Dimensions.get("window").width;
|
|
47
38
|
const styles = StyleSheet.create({
|
|
48
39
|
toastContainer: {
|
|
@@ -56,7 +47,6 @@ const styles = StyleSheet.create({
|
|
|
56
47
|
position: "absolute",
|
|
57
48
|
backgroundColor: "#00000088",
|
|
58
49
|
padding: 10,
|
|
59
|
-
// paddingVertical: 4,
|
|
60
50
|
borderRadius: 2,
|
|
61
51
|
justifyContent: "center",
|
|
62
52
|
alignItems: "center",
|
|
@@ -1,35 +1,26 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import React from "react";
|
|
2
11
|
import { Image, ScrollView, Text, TouchableOpacity, View, } from "react-native";
|
|
3
12
|
import { deviceHeight, deviceWidth } from "../../screen/px2dp";
|
|
4
|
-
// import * as utils from '../../utils/lazy';
|
|
5
13
|
import { hidePopoverView, showPopoverView } from "../Hud/Hud";
|
|
6
|
-
// type Reducer = (prevState: State, action: Partial<State>) => State
|
|
7
14
|
export default (props) => {
|
|
8
15
|
const { defaultAlignHorizontal = "left", defaultAlignVertical = "bottom" } = props;
|
|
9
16
|
const [state, dispatch] = React.useReducer((prevState, action) => Object.assign({}, prevState, action), {});
|
|
10
|
-
// const containerRef = React.useRef<{ measureInWindow: (callback: MeasureInWindowOnSuccessCallback) => void }>()
|
|
11
17
|
const containerRef = React.useRef(null);
|
|
12
18
|
const rootView = React.useRef({ pageX: 0, pageY: 0, width: 0, height: 0 });
|
|
13
19
|
const sc = React.useRef({ x: 0, y: 0, width: 0, height: 0 });
|
|
14
|
-
// React.useEffect(() => {
|
|
15
|
-
// ; (async () => {
|
|
16
|
-
// await utils.sleep()
|
|
17
|
-
// containerRef.current?.measure((...args) => {
|
|
18
|
-
// console.log('containerRef', args)
|
|
19
|
-
// if (args.length == 6) {
|
|
20
|
-
// _container.current = {
|
|
21
|
-
// x: args[4],
|
|
22
|
-
// y: args[5],
|
|
23
|
-
// width: args[2],
|
|
24
|
-
// height: args[3],
|
|
25
|
-
// }
|
|
26
|
-
// }
|
|
27
|
-
// })
|
|
28
|
-
// })()
|
|
29
|
-
// })
|
|
30
20
|
const getRootViewlayoutPromise = () => {
|
|
31
21
|
return new Promise((resovle, reject) => {
|
|
32
|
-
|
|
22
|
+
var _a;
|
|
23
|
+
(_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.measure((...args) => {
|
|
33
24
|
if (args.length == 6) {
|
|
34
25
|
rootView.current = {
|
|
35
26
|
width: args[2],
|
|
@@ -38,18 +29,17 @@ export default (props) => {
|
|
|
38
29
|
pageY: args[5],
|
|
39
30
|
};
|
|
40
31
|
}
|
|
41
|
-
// console.log('RootView', rootView.current)
|
|
42
32
|
resovle(args);
|
|
43
33
|
});
|
|
44
34
|
});
|
|
45
35
|
};
|
|
46
36
|
const getLayoutInfos = () => {
|
|
37
|
+
var _a;
|
|
47
38
|
let alignVertical = defaultAlignVertical;
|
|
48
39
|
let alignHorizontal = defaultAlignHorizontal;
|
|
49
40
|
let width = rootView.current.width;
|
|
50
41
|
let height = rootView.current.height;
|
|
51
42
|
let x = rootView.current.pageX;
|
|
52
|
-
// let y = (StatusBar.currentHeight || 0) + _container.current.y + height
|
|
53
43
|
let y = rootView.current.pageY + height;
|
|
54
44
|
if (x > Math.abs(deviceWidth - width - x)) {
|
|
55
45
|
alignHorizontal = "right";
|
|
@@ -57,9 +47,8 @@ export default (props) => {
|
|
|
57
47
|
if (y > deviceHeight * 0.5) {
|
|
58
48
|
alignVertical = "top";
|
|
59
49
|
}
|
|
60
|
-
/**todo: target_width的获取是延迟的,所以这里又问题 */
|
|
61
50
|
const target_width = sc.current.width;
|
|
62
|
-
const target_height = CELL_HEIGHT * (Math.min(props.data
|
|
51
|
+
const target_height = CELL_HEIGHT * (Math.min(((_a = props.data) === null || _a === void 0 ? void 0 : _a.length) || 0, 5) || 0);
|
|
63
52
|
return {
|
|
64
53
|
alignVertical,
|
|
65
54
|
alignHorizontal,
|
|
@@ -73,7 +62,6 @@ export default (props) => {
|
|
|
73
62
|
};
|
|
74
63
|
const reLayout = () => {
|
|
75
64
|
let { alignVertical, alignHorizontal, width, height, x, y, target_width, target_height, } = getLayoutInfos();
|
|
76
|
-
// console.log({ getLayoutInfos: getLayoutInfos() })
|
|
77
65
|
const layout = () => {
|
|
78
66
|
if (alignHorizontal == "left") {
|
|
79
67
|
if (target_width + x > deviceWidth) {
|
|
@@ -113,34 +101,15 @@ export default (props) => {
|
|
|
113
101
|
const PADDING = 10;
|
|
114
102
|
const ARROW_HEIGHT = 12;
|
|
115
103
|
const CELL_HEIGHT = 36;
|
|
116
|
-
const show =
|
|
104
|
+
const show = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
105
|
+
var _a, _b;
|
|
117
106
|
props.onContainerClick && props.onContainerClick();
|
|
118
|
-
if (props.data == undefined || props.data
|
|
107
|
+
if (props.data == undefined || ((_a = props.data) === null || _a === void 0 ? void 0 : _a.length) == 0)
|
|
119
108
|
return;
|
|
120
|
-
|
|
121
|
-
await getRootViewlayoutPromise();
|
|
122
|
-
/**重新获取rootview的定位 */
|
|
109
|
+
yield getRootViewlayoutPromise();
|
|
123
110
|
showPopoverView({
|
|
124
|
-
content: (
|
|
125
|
-
|
|
126
|
-
minWidth: deviceWidth * 0.36,
|
|
127
|
-
maxWidth: deviceWidth * 0.8,
|
|
128
|
-
minHeight: CELL_HEIGHT + PADDING * 2,
|
|
129
|
-
maxHeight: CELL_HEIGHT * 5 + PADDING * 2,
|
|
130
|
-
borderRadius: 6,
|
|
131
|
-
backgroundColor: "#000000ee",
|
|
132
|
-
// overflow: 'hidden' ,
|
|
133
|
-
padding: PADDING,
|
|
134
|
-
...reLayout(),
|
|
135
|
-
}}>
|
|
136
|
-
<View style={{
|
|
137
|
-
width: ARROW_HEIGHT,
|
|
138
|
-
height: ARROW_HEIGHT,
|
|
139
|
-
backgroundColor: "#000000ee",
|
|
140
|
-
position: "absolute",
|
|
141
|
-
zIndex: 1,
|
|
142
|
-
transform: [{ rotateZ: "45deg" }],
|
|
143
|
-
...(() => {
|
|
111
|
+
content: (React.createElement(TouchableOpacity, { activeOpacity: 1, style: Object.assign({ position: "absolute", minWidth: deviceWidth * 0.36, maxWidth: deviceWidth * 0.8, minHeight: CELL_HEIGHT + PADDING * 2, maxHeight: CELL_HEIGHT * 5 + PADDING * 2, borderRadius: 6, backgroundColor: "#000000ee", padding: PADDING }, reLayout()) },
|
|
112
|
+
React.createElement(View, { style: Object.assign({ width: ARROW_HEIGHT, height: ARROW_HEIGHT, backgroundColor: "#000000ee", position: "absolute", zIndex: 1, transform: [{ rotateZ: "45deg" }] }, (() => {
|
|
144
113
|
const { alignVertical, alignHorizontal } = getLayoutInfos();
|
|
145
114
|
if (alignVertical == "bottom" && alignHorizontal == "left")
|
|
146
115
|
return { left: "20%", top: -5 };
|
|
@@ -151,34 +120,24 @@ export default (props) => {
|
|
|
151
120
|
if (alignVertical == "top" && alignHorizontal == "right")
|
|
152
121
|
return { right: "20%", bottom: -5 };
|
|
153
122
|
return {};
|
|
154
|
-
})(),
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
sc.current = _sc;
|
|
161
|
-
}}>
|
|
162
|
-
{props.data?.map((i, idx) => {
|
|
163
|
-
return (<TouchableOpacity activeOpacity={0.7} key={`sg-memnu-${idx}`} style={{
|
|
123
|
+
})()) }),
|
|
124
|
+
React.createElement(ScrollView, { onLayout: (e) => {
|
|
125
|
+
let _sc = e.nativeEvent.layout;
|
|
126
|
+
sc.current = _sc;
|
|
127
|
+
} }, (_b = props.data) === null || _b === void 0 ? void 0 : _b.map((i, idx) => {
|
|
128
|
+
return (React.createElement(TouchableOpacity, { activeOpacity: 0.7, key: `sg-memnu-${idx}`, style: {
|
|
164
129
|
height: CELL_HEIGHT,
|
|
165
130
|
display: "flex",
|
|
166
131
|
flexDirection: "row",
|
|
167
132
|
alignItems: "center",
|
|
168
|
-
|
|
169
|
-
}} onPress={(e) => {
|
|
133
|
+
}, onPress: (e) => {
|
|
170
134
|
props.onItemClick && props.onItemClick(idx, i.extra);
|
|
171
135
|
hidePopoverView();
|
|
172
|
-
}}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
</Text>
|
|
177
|
-
</TouchableOpacity>);
|
|
178
|
-
})}
|
|
179
|
-
</ScrollView>
|
|
180
|
-
</TouchableOpacity>),
|
|
136
|
+
} },
|
|
137
|
+
i.icon && (React.createElement(Image, { style: { width: 18, height: 18, marginRight: 4 }, source: i.icon })),
|
|
138
|
+
React.createElement(Text, { style: { flexShrink: 1, fontSize: 14, color: "white" } }, i.text)));
|
|
139
|
+
})))),
|
|
181
140
|
});
|
|
182
|
-
};
|
|
183
|
-
return (
|
|
141
|
+
});
|
|
142
|
+
return (React.createElement(TouchableOpacity, Object.assign({ ref: containerRef, onPress: (e) => show() }, props)));
|
|
184
143
|
};
|