@aks-dev/easyui 1.0.189 → 1.0.191
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 +9 -6
- package/dist/components/DottedLine/DottedLine.js +4 -10
- package/dist/components/Echarts/EchartsView.js +15 -9
- package/dist/components/Hud/AlertBottomView/AlertBottomView.js +7 -5
- package/dist/components/Hud/AlertSheetView/AlertSheetView.js +9 -6
- package/dist/components/Hud/AlertView/AlertView.js +7 -5
- package/dist/components/Hud/Loading/Loading.js +3 -9
- package/dist/components/Hud/PopoverView/PopoverView.js +5 -9
- package/dist/components/Hud/Scanner/Scanner.js +17 -14
- package/dist/components/Hud/Toast/Toast.js +3 -3
- package/dist/components/MenuView/MenuView.js +25 -38
- package/dist/components/MutiPictureView/MutiPictureView.js +60 -50
- package/dist/components/PictureViewer/PictureViewer.js +4 -9
- package/dist/components/RefreshList/RefreshList.js +10 -8
- package/dist/components/RichText/RichText.js +6 -5
- package/dist/components/TableCell/TableCell.js +6 -8
- package/dist/components/TextInputArea/TextInputArea.js +4 -6
- package/dist/jsbridge/RNEasyui.js +1 -1
- package/dist/jsbridge/UpgradeModule.js +4 -3
- package/dist/screen/text-fit.js +3 -8
- package/dist/utils/lazy.js +8 -5
- package/package.json +3 -7
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @LastEditTime: 2023-09-27 15:17:15
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/lib/AnimationModal/AnimationModal.tsx
|
|
7
7
|
*/
|
|
8
|
+
import { __awaiter } from "tslib";
|
|
8
9
|
import * as React from "react";
|
|
9
10
|
import { View, Animated, Easing, PanResponder, StyleSheet, useWindowDimensions, BackHandler, } from "react-native";
|
|
10
11
|
import * as utils from "../../utils/lazy";
|
|
@@ -36,7 +37,8 @@ export const AnimationModal = React.forwardRef((props, ref) => {
|
|
|
36
37
|
const layoutRef = React.useRef({ h0: 0, h1: 0 });
|
|
37
38
|
const getLayoutPromise = () => {
|
|
38
39
|
return new Promise((resovle, reject) => {
|
|
39
|
-
|
|
40
|
+
var _a;
|
|
41
|
+
(_a = viewRef.current) === null || _a === void 0 ? void 0 : _a.measure((...args) => {
|
|
40
42
|
if (args.length == 6) {
|
|
41
43
|
layoutRef.current.h1 = args[3];
|
|
42
44
|
}
|
|
@@ -53,11 +55,12 @@ export const AnimationModal = React.forwardRef((props, ref) => {
|
|
|
53
55
|
};
|
|
54
56
|
const getData = () => dataRef.current;
|
|
55
57
|
const show = () => {
|
|
56
|
-
setDisplay("flex",
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
setDisplay("flex", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
var _a;
|
|
60
|
+
yield utils.sleep(50);
|
|
61
|
+
yield getLayoutPromise();
|
|
62
|
+
timing(-((_a = layoutRef.current) === null || _a === void 0 ? void 0 : _a.h1));
|
|
63
|
+
}));
|
|
61
64
|
return init();
|
|
62
65
|
};
|
|
63
66
|
const hide = () => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
1
2
|
/*
|
|
2
3
|
* @Author: shiguo
|
|
3
4
|
* @Date: 2022-07-12 15:30:19
|
|
@@ -8,18 +9,11 @@
|
|
|
8
9
|
import React from "react";
|
|
9
10
|
import { StyleSheet, View } from "react-native";
|
|
10
11
|
export default (props) => {
|
|
11
|
-
const { vertical = false, dottedColor, dottedCount = 200,
|
|
12
|
+
const { vertical = false, dottedColor, dottedCount = 200 } = props, rest = __rest(props, ["vertical", "dottedColor", "dottedCount"]);
|
|
12
13
|
const arrs = Array.from({ length: dottedCount }, (k, v) => v);
|
|
13
|
-
return (<View style={{
|
|
14
|
-
...styles.container,
|
|
15
|
-
flexDirection: vertical ? "column" : "row",
|
|
16
|
-
...rest.style,
|
|
17
|
-
}}>
|
|
14
|
+
return (<View style={Object.assign(Object.assign(Object.assign({}, styles.container), { flexDirection: vertical ? "column" : "row" }), rest.style)}>
|
|
18
15
|
{arrs.map((item, index) => {
|
|
19
|
-
return (<View key={`dotted-${index}`} style={{
|
|
20
|
-
...(vertical ? styles.dotted_vertical : styles.dotted_horizontal),
|
|
21
|
-
...(dottedColor && { backgroundColor: dottedColor }),
|
|
22
|
-
}}/>);
|
|
16
|
+
return (<View key={`dotted-${index}`} style={Object.assign(Object.assign({}, (vertical ? styles.dotted_vertical : styles.dotted_horizontal)), (dottedColor && { backgroundColor: dottedColor }))}/>);
|
|
23
17
|
})}
|
|
24
18
|
</View>);
|
|
25
19
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
1
2
|
/*
|
|
2
3
|
* @Author: shiguo
|
|
3
4
|
* @Date: 2022-05-05 14:52:53
|
|
@@ -11,6 +12,7 @@ import { WebView } from "react-native-webview";
|
|
|
11
12
|
import { getHtml, toString } from "./helper";
|
|
12
13
|
// type Reducer = (prevState: State, action: Partial<State>) => State;
|
|
13
14
|
const EchartsView = (props) => {
|
|
15
|
+
var _a, _b;
|
|
14
16
|
const [state, dispatch] = React.useReducer((prevState, ...args) => Object.assign({}, prevState, ...args), {
|
|
15
17
|
width: 0,
|
|
16
18
|
height: 0,
|
|
@@ -21,7 +23,8 @@ const EchartsView = (props) => {
|
|
|
21
23
|
const rootView = React.useRef({ pageX: 0, pageY: 0, width: 0, height: 0 });
|
|
22
24
|
const getRootViewlayoutPromise = () => {
|
|
23
25
|
return new Promise((resovle, reject) => {
|
|
24
|
-
|
|
26
|
+
var _a;
|
|
27
|
+
(_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.measure((...args) => {
|
|
25
28
|
if (args.length == 6) {
|
|
26
29
|
rootView.current = {
|
|
27
30
|
width: args[2],
|
|
@@ -36,9 +39,10 @@ const EchartsView = (props) => {
|
|
|
36
39
|
});
|
|
37
40
|
};
|
|
38
41
|
React.useLayoutEffect(() => {
|
|
39
|
-
(
|
|
42
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
43
|
+
var _a;
|
|
40
44
|
if (state.isLoaded) {
|
|
41
|
-
|
|
45
|
+
yield getRootViewlayoutPromise();
|
|
42
46
|
let height = rootView.current.height
|
|
43
47
|
? `${rootView.current.height}px`
|
|
44
48
|
: "auto";
|
|
@@ -57,8 +61,9 @@ const EchartsView = (props) => {
|
|
|
57
61
|
instance.setOption(${toString(props.option)});
|
|
58
62
|
})();
|
|
59
63
|
`;
|
|
60
|
-
WebViewRef.current
|
|
64
|
+
(_a = WebViewRef.current) === null || _a === void 0 ? void 0 : _a.injectJavaScript(run);
|
|
61
65
|
return () => {
|
|
66
|
+
var _a;
|
|
62
67
|
const run = `
|
|
63
68
|
;(function() {
|
|
64
69
|
var instance = echarts.getInstanceByDom(document.getElementById('main'));
|
|
@@ -68,11 +73,11 @@ const EchartsView = (props) => {
|
|
|
68
73
|
}
|
|
69
74
|
})();
|
|
70
75
|
`;
|
|
71
|
-
WebViewRef.current
|
|
76
|
+
(_a = WebViewRef.current) === null || _a === void 0 ? void 0 : _a.injectJavaScript(run);
|
|
72
77
|
};
|
|
73
78
|
}
|
|
74
79
|
return undefined;
|
|
75
|
-
})().catch((err) => {
|
|
80
|
+
}))().catch((err) => {
|
|
76
81
|
console.log(err);
|
|
77
82
|
});
|
|
78
83
|
}, [props.option, state.isLoaded]);
|
|
@@ -109,14 +114,15 @@ const EchartsView = (props) => {
|
|
|
109
114
|
return (<View style={[styles.container, props.style]} ref={containerRef}>
|
|
110
115
|
<WebView ref={WebViewRef} originWhitelist={["*"]} useWebKit={true} // ios使用最新webkit内核渲染
|
|
111
116
|
allowUniversalAccessFromFileURLs={true} geolocationEnabled={true} mixedContentMode={"always"} renderLoading={() => {
|
|
117
|
+
var _a;
|
|
112
118
|
if (props.renderLoading)
|
|
113
119
|
return props.renderLoading();
|
|
114
120
|
return (<View style={{
|
|
115
|
-
backgroundColor: props.style
|
|
121
|
+
backgroundColor: ((_a = props.style) === null || _a === void 0 ? void 0 : _a.backgroundColor) || "transparent",
|
|
116
122
|
}}/>);
|
|
117
123
|
}} // 设置空View,修复ioswebview闪白
|
|
118
124
|
style={{
|
|
119
|
-
backgroundColor: props.style
|
|
125
|
+
backgroundColor: ((_a = props.style) === null || _a === void 0 ? void 0 : _a.backgroundColor) || "transparent",
|
|
120
126
|
opacity: 0.99, //解决闪退的办法
|
|
121
127
|
}} // 设置背景色透明,修复android闪白
|
|
122
128
|
scrollEnabled={false}
|
|
@@ -133,7 +139,7 @@ const EchartsView = (props) => {
|
|
|
133
139
|
}} source={{
|
|
134
140
|
baseUrl: "",
|
|
135
141
|
html: getHtml({
|
|
136
|
-
backgroundColor: props.style
|
|
142
|
+
backgroundColor: ((_b = props.style) === null || _b === void 0 ? void 0 : _b.backgroundColor) || "transparent",
|
|
137
143
|
}),
|
|
138
144
|
}}/>
|
|
139
145
|
</View>);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { View, Text, StyleSheet, Platform, StatusBar, TouchableOpacity, Dimensions, } from "react-native";
|
|
3
4
|
import Modal from "react-native-modal";
|
|
@@ -13,16 +14,16 @@ export default React.forwardRef((_, ref) => {
|
|
|
13
14
|
const cancelCallbackRef = React.useRef(undefined);
|
|
14
15
|
const confirmCallbackRef = React.useRef(undefined);
|
|
15
16
|
React.useImperativeHandle(ref, () => ({
|
|
16
|
-
show:
|
|
17
|
+
show: (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
18
|
setState(Object.assign({}, defaultState, { visible: true }, options));
|
|
18
19
|
cancelCallbackRef.current = options.cancel;
|
|
19
20
|
confirmCallbackRef.current = options.confirm;
|
|
20
|
-
},
|
|
21
|
+
}),
|
|
21
22
|
hide,
|
|
22
23
|
}), []);
|
|
23
|
-
const hide =
|
|
24
|
+
const hide = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
25
|
setState(defaultState);
|
|
25
|
-
};
|
|
26
|
+
});
|
|
26
27
|
React.useEffect(() => {
|
|
27
28
|
if (Platform.OS == "android") {
|
|
28
29
|
if (state.visible) {
|
|
@@ -91,7 +92,8 @@ export default React.forwardRef((_, ref) => {
|
|
|
91
92
|
});
|
|
92
93
|
export const alertBottomViewRef = React.createRef();
|
|
93
94
|
export const showAlertBottomModal = (props) => {
|
|
94
|
-
|
|
95
|
+
var _a;
|
|
96
|
+
(_a = alertBottomViewRef.current) === null || _a === void 0 ? void 0 : _a.show(props);
|
|
95
97
|
};
|
|
96
98
|
// const sleep = (msec?: number) => {
|
|
97
99
|
// return new Promise(resolve => {
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { Dimensions, Platform, StatusBar, StyleSheet, Text, TouchableOpacity, View, } from "react-native";
|
|
3
4
|
import Modal from "react-native-modal";
|
|
4
5
|
import { px2dp } from "../../../screen/px2dp";
|
|
5
6
|
import { px2sp } from "../../../screen/px2sp";
|
|
6
7
|
export default React.forwardRef((_, ref) => {
|
|
8
|
+
var _a;
|
|
7
9
|
const defaultState = {
|
|
8
10
|
visible: false,
|
|
9
11
|
actions: [],
|
|
10
12
|
};
|
|
11
13
|
const [state, setState] = React.useState(defaultState);
|
|
12
14
|
React.useImperativeHandle(ref, () => ({
|
|
13
|
-
show:
|
|
15
|
+
show: (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
16
|
setState(Object.assign({}, defaultState, { visible: true }, options));
|
|
15
|
-
},
|
|
17
|
+
}),
|
|
16
18
|
hide,
|
|
17
19
|
}), []);
|
|
18
|
-
const hide =
|
|
20
|
+
const hide = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
21
|
setState(defaultState);
|
|
20
|
-
};
|
|
22
|
+
});
|
|
21
23
|
React.useEffect(() => {
|
|
22
24
|
if (Platform.OS == "android") {
|
|
23
25
|
if (state.visible) {
|
|
@@ -42,7 +44,7 @@ export default React.forwardRef((_, ref) => {
|
|
|
42
44
|
<View style={styles.container}>
|
|
43
45
|
<View style={[styles.wrapper]}>
|
|
44
46
|
<View style={styles.itemContainer}>
|
|
45
|
-
{state.actions
|
|
47
|
+
{(_a = state.actions) === null || _a === void 0 ? void 0 : _a.map((i, idx) => (<TouchableOpacity key={`sg-action-${idx}`} style={[styles.item]} activeOpacity={1} onPress={() => {
|
|
46
48
|
hide();
|
|
47
49
|
i.onClick && i.onClick();
|
|
48
50
|
}}>
|
|
@@ -63,7 +65,8 @@ export default React.forwardRef((_, ref) => {
|
|
|
63
65
|
});
|
|
64
66
|
export const alertSheetViewRef = React.createRef();
|
|
65
67
|
export const showAlertSheetModal = (props) => {
|
|
66
|
-
|
|
68
|
+
var _a;
|
|
69
|
+
(_a = alertSheetViewRef.current) === null || _a === void 0 ? void 0 : _a.show(props);
|
|
67
70
|
};
|
|
68
71
|
const styles = StyleSheet.create({
|
|
69
72
|
container: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { View, Text, StyleSheet, Platform, Modal, StatusBar, TouchableOpacity, Animated, Easing, } from "react-native";
|
|
3
4
|
import { px2dp, deviceWidth } from "../../../screen/px2dp";
|
|
@@ -12,20 +13,20 @@ export default React.forwardRef((_, ref) => {
|
|
|
12
13
|
const cancelCallbackRef = React.useRef(undefined);
|
|
13
14
|
const confirmCallbackRef = React.useRef(undefined);
|
|
14
15
|
React.useImperativeHandle(ref, () => ({
|
|
15
|
-
show:
|
|
16
|
+
show: (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
17
|
setState(Object.assign({}, defaultState, { visible: true }, options));
|
|
17
18
|
cancelCallbackRef.current = options.cancel;
|
|
18
19
|
confirmCallbackRef.current = options.confirm;
|
|
19
20
|
// await sleep(50)
|
|
20
21
|
startAnimate(1);
|
|
21
|
-
},
|
|
22
|
+
}),
|
|
22
23
|
hide,
|
|
23
24
|
}), []);
|
|
24
|
-
const hide =
|
|
25
|
+
const hide = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
26
|
startAnimate(0.3);
|
|
26
27
|
// await sleep(50)
|
|
27
28
|
setState(defaultState);
|
|
28
|
-
};
|
|
29
|
+
});
|
|
29
30
|
let scale_anim = React.useRef(new Animated.Value(0.3)).current;
|
|
30
31
|
const startAnimate = (x) => {
|
|
31
32
|
Animated.timing(scale_anim, {
|
|
@@ -100,7 +101,8 @@ export default React.forwardRef((_, ref) => {
|
|
|
100
101
|
});
|
|
101
102
|
export const alertViewRef = React.createRef();
|
|
102
103
|
export const showAlertModal = (props) => {
|
|
103
|
-
|
|
104
|
+
var _a;
|
|
105
|
+
(_a = alertViewRef.current) === null || _a === void 0 ? void 0 : _a.show(props);
|
|
104
106
|
};
|
|
105
107
|
// const sleep = (msec?: number) => {
|
|
106
108
|
// return new Promise(resolve => {
|
|
@@ -36,17 +36,11 @@ export const Loading = React.forwardRef((_, ref) => {
|
|
|
36
36
|
</TouchableOpacity>);
|
|
37
37
|
});
|
|
38
38
|
export const loadingRef = React.createRef();
|
|
39
|
-
export const showLoading = (content) => loadingRef.current
|
|
40
|
-
export const hideLoading = () => loadingRef.current
|
|
39
|
+
export const showLoading = (content) => { var _a; return (_a = loadingRef.current) === null || _a === void 0 ? void 0 : _a.showLoading(content); };
|
|
40
|
+
export const hideLoading = () => { var _a; return (_a = loadingRef.current) === null || _a === void 0 ? void 0 : _a.hideLoading(); };
|
|
41
41
|
const SCREEN_WIDTH = Dimensions.get("window").width;
|
|
42
42
|
const styles = StyleSheet.create({
|
|
43
|
-
container: {
|
|
44
|
-
...StyleSheet.absoluteFill,
|
|
45
|
-
display: "flex",
|
|
46
|
-
justifyContent: "center",
|
|
47
|
-
alignItems: "center",
|
|
48
|
-
// backgroundColor:'red'
|
|
49
|
-
},
|
|
43
|
+
container: Object.assign(Object.assign({}, StyleSheet.absoluteFill), { display: "flex", justifyContent: "center", alignItems: "center" }),
|
|
50
44
|
warpper: {
|
|
51
45
|
backgroundColor: "#00000088",
|
|
52
46
|
padding: 40,
|
|
@@ -27,21 +27,17 @@ export const PopoverView = React.forwardRef((_, ref) => {
|
|
|
27
27
|
}), [visible]);
|
|
28
28
|
if (!visible)
|
|
29
29
|
return null;
|
|
30
|
-
return (<TouchableOpacity activeOpacity={1} style={[styles.container, options
|
|
30
|
+
return (<TouchableOpacity activeOpacity={1} style={[styles.container, options === null || options === void 0 ? void 0 : options.style]} disabled={options === null || options === void 0 ? void 0 : options.disabled} onPress={(e) => {
|
|
31
31
|
setVisible(false);
|
|
32
32
|
setOptions(undefined);
|
|
33
33
|
// e.stopPropagation()
|
|
34
34
|
}}>
|
|
35
|
-
{React.isValidElement(options
|
|
35
|
+
{React.isValidElement(options === null || options === void 0 ? void 0 : options.content) && (options === null || options === void 0 ? void 0 : options.content)}
|
|
36
36
|
</TouchableOpacity>);
|
|
37
37
|
});
|
|
38
38
|
export const popoverViewRef = React.createRef();
|
|
39
|
-
export const showPopoverView = (options) => popoverViewRef.current
|
|
40
|
-
export const hidePopoverView = () => popoverViewRef.current
|
|
39
|
+
export const showPopoverView = (options) => { var _a; return (_a = popoverViewRef.current) === null || _a === void 0 ? void 0 : _a.showPopoverView(options); };
|
|
40
|
+
export const hidePopoverView = () => { var _a; return (_a = popoverViewRef.current) === null || _a === void 0 ? void 0 : _a.hidePopoverView(); };
|
|
41
41
|
const styles = StyleSheet.create({
|
|
42
|
-
container: {
|
|
43
|
-
...StyleSheet.absoluteFill,
|
|
44
|
-
display: "flex",
|
|
45
|
-
// backgroundColor:'red'
|
|
46
|
-
},
|
|
42
|
+
container: Object.assign(Object.assign({}, StyleSheet.absoluteFill), { display: "flex" }),
|
|
47
43
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
1
2
|
/*
|
|
2
3
|
* @Author: shiguo
|
|
3
4
|
* @Date: 2022-04-24 14:27:02
|
|
@@ -41,8 +42,8 @@ export const Scanner = React.forwardRef((_, ref) => {
|
|
|
41
42
|
showScanner: _showScanner,
|
|
42
43
|
hideScanner: _hideScanner,
|
|
43
44
|
}), [show]);
|
|
44
|
-
const _showScanner =
|
|
45
|
-
let res =
|
|
45
|
+
const _showScanner = (cb) => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
let res = yield requestMultiple([
|
|
46
47
|
PERMISSIONS.IOS.CAMERA,
|
|
47
48
|
PERMISSIONS.ANDROID.CAMERA,
|
|
48
49
|
]);
|
|
@@ -51,7 +52,7 @@ export const Scanner = React.forwardRef((_, ref) => {
|
|
|
51
52
|
_scanerResultRef.current = null;
|
|
52
53
|
setShow(true);
|
|
53
54
|
setPointStyle({});
|
|
54
|
-
|
|
55
|
+
yield utils.sleep();
|
|
55
56
|
animationStart();
|
|
56
57
|
_cbRef.current = cb;
|
|
57
58
|
}
|
|
@@ -59,12 +60,12 @@ export const Scanner = React.forwardRef((_, ref) => {
|
|
|
59
60
|
_hideScanner();
|
|
60
61
|
showToast("您未开启相机权限,暂不能使用此功能");
|
|
61
62
|
}
|
|
62
|
-
};
|
|
63
|
-
const _hideScanner =
|
|
63
|
+
});
|
|
64
|
+
const _hideScanner = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
65
|
animationStop();
|
|
65
|
-
|
|
66
|
+
yield utils.sleep();
|
|
66
67
|
setShow(false);
|
|
67
|
-
};
|
|
68
|
+
});
|
|
68
69
|
const animation = Animated.loop(Animated.sequence([
|
|
69
70
|
Animated.timing(moveAnim, {
|
|
70
71
|
toValue: px2dp(222),
|
|
@@ -79,8 +80,9 @@ export const Scanner = React.forwardRef((_, ref) => {
|
|
|
79
80
|
useNativeDriver: true,
|
|
80
81
|
}),
|
|
81
82
|
]));
|
|
82
|
-
const animationStart =
|
|
83
|
-
|
|
83
|
+
const animationStart = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
+
var _a;
|
|
85
|
+
(_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.resumePreview();
|
|
84
86
|
animation.start(({ finished }) => {
|
|
85
87
|
// console.log('animationStart finished', finished)
|
|
86
88
|
if (finished) {
|
|
@@ -88,9 +90,10 @@ export const Scanner = React.forwardRef((_, ref) => {
|
|
|
88
90
|
animation.start();
|
|
89
91
|
}
|
|
90
92
|
});
|
|
91
|
-
};
|
|
93
|
+
});
|
|
92
94
|
const animationStop = (result) => {
|
|
93
|
-
|
|
95
|
+
var _a;
|
|
96
|
+
(_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.pausePreview();
|
|
94
97
|
animation.stop();
|
|
95
98
|
};
|
|
96
99
|
const codeScanner = useCodeScanner({
|
|
@@ -98,7 +101,7 @@ export const Scanner = React.forwardRef((_, ref) => {
|
|
|
98
101
|
onCodeScanned: (codes) => {
|
|
99
102
|
console.log(`Scanned ${codes.length} codes!`);
|
|
100
103
|
let code = codes.find((i) => i.value);
|
|
101
|
-
if (code
|
|
104
|
+
if ((code === null || code === void 0 ? void 0 : code.value) && _scanerResultRef.current == undefined) {
|
|
102
105
|
_scanerResultRef.current = code.value;
|
|
103
106
|
_cbRef.current(code.value);
|
|
104
107
|
_hideScanner();
|
|
@@ -297,5 +300,5 @@ const styles = StyleSheet.create({
|
|
|
297
300
|
grantedText: { lineHeight: px2dp(30), color: lineColor, fontWeight: "bold" },
|
|
298
301
|
});
|
|
299
302
|
export const scannerRef = React.createRef();
|
|
300
|
-
export const showScanner = (cb) => scannerRef.current
|
|
301
|
-
export const hideScanner = () => scannerRef.current
|
|
303
|
+
export const showScanner = (cb) => { var _a; return (_a = scannerRef.current) === null || _a === void 0 ? void 0 : _a.showScanner(cb); };
|
|
304
|
+
export const hideScanner = () => { var _a; return (_a = scannerRef.current) === null || _a === void 0 ? void 0 : _a.hideScanner(); };
|
|
@@ -33,16 +33,16 @@ export const Toast = React.forwardRef((_, ref) => {
|
|
|
33
33
|
fadeAnimation.start();
|
|
34
34
|
},
|
|
35
35
|
}));
|
|
36
|
-
return (<Animated.View style={{
|
|
36
|
+
return (<Animated.View style={Object.assign(Object.assign({}, styles.toastContainer), { opacity: fade })}>
|
|
37
37
|
<View style={styles.toastTipsContainer}>
|
|
38
|
-
<Text numberOfLines={5} style={{
|
|
38
|
+
<Text numberOfLines={5} style={Object.assign({}, styles.toastTitle)}>
|
|
39
39
|
{tipText}{" "}
|
|
40
40
|
</Text>
|
|
41
41
|
</View>
|
|
42
42
|
</Animated.View>);
|
|
43
43
|
});
|
|
44
44
|
export const toastRef = React.createRef();
|
|
45
|
-
export const showToast = (content) => toastRef.current
|
|
45
|
+
export const showToast = (content) => { var _a; return (_a = toastRef.current) === null || _a === void 0 ? void 0 : _a.showToast(content); };
|
|
46
46
|
const SCREEN_WIDTH = Dimensions.get("window").width;
|
|
47
47
|
const styles = StyleSheet.create({
|
|
48
48
|
toastContainer: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { Image, ScrollView, Text, TouchableOpacity, View, } from "react-native";
|
|
3
4
|
import { deviceHeight, deviceWidth } from "../../screen/px2dp";
|
|
@@ -29,7 +30,8 @@ export default (props) => {
|
|
|
29
30
|
// })
|
|
30
31
|
const getRootViewlayoutPromise = () => {
|
|
31
32
|
return new Promise((resovle, reject) => {
|
|
32
|
-
|
|
33
|
+
var _a;
|
|
34
|
+
(_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.measure((...args) => {
|
|
33
35
|
if (args.length == 6) {
|
|
34
36
|
rootView.current = {
|
|
35
37
|
width: args[2],
|
|
@@ -44,6 +46,7 @@ export default (props) => {
|
|
|
44
46
|
});
|
|
45
47
|
};
|
|
46
48
|
const getLayoutInfos = () => {
|
|
49
|
+
var _a;
|
|
47
50
|
let alignVertical = defaultAlignVertical;
|
|
48
51
|
let alignHorizontal = defaultAlignHorizontal;
|
|
49
52
|
let width = rootView.current.width;
|
|
@@ -59,7 +62,7 @@ export default (props) => {
|
|
|
59
62
|
}
|
|
60
63
|
/**todo: target_width的获取是延迟的,所以这里又问题 */
|
|
61
64
|
const target_width = sc.current.width;
|
|
62
|
-
const target_height = CELL_HEIGHT * (Math.min(props.data
|
|
65
|
+
const target_height = CELL_HEIGHT * (Math.min(((_a = props.data) === null || _a === void 0 ? void 0 : _a.length) || 0, 5) || 0);
|
|
63
66
|
return {
|
|
64
67
|
alignVertical,
|
|
65
68
|
alignHorizontal,
|
|
@@ -113,53 +116,37 @@ export default (props) => {
|
|
|
113
116
|
const PADDING = 10;
|
|
114
117
|
const ARROW_HEIGHT = 12;
|
|
115
118
|
const CELL_HEIGHT = 36;
|
|
116
|
-
const show =
|
|
119
|
+
const show = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
120
|
+
var _a, _b;
|
|
117
121
|
props.onContainerClick && props.onContainerClick();
|
|
118
|
-
if (props.data == undefined || props.data
|
|
122
|
+
if (props.data == undefined || ((_a = props.data) === null || _a === void 0 ? void 0 : _a.length) == 0)
|
|
119
123
|
return;
|
|
120
124
|
/**重新获取rootview的定位 */
|
|
121
|
-
|
|
125
|
+
yield getRootViewlayoutPromise();
|
|
122
126
|
/**重新获取rootview的定位 */
|
|
123
127
|
showPopoverView({
|
|
124
|
-
content: (<TouchableOpacity activeOpacity={1} style={{
|
|
125
|
-
position: "absolute",
|
|
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",
|
|
128
|
+
content: (<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",
|
|
132
129
|
// overflow: 'hidden' ,
|
|
133
|
-
padding: PADDING,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return { left: "20%", top: -5 };
|
|
147
|
-
if (alignVertical == "bottom" && alignHorizontal == "right")
|
|
148
|
-
return { right: "20%", top: -5 };
|
|
149
|
-
if (alignVertical == "top" && alignHorizontal == "left")
|
|
150
|
-
return { left: "20%", bottom: -5 };
|
|
151
|
-
if (alignVertical == "top" && alignHorizontal == "right")
|
|
152
|
-
return { right: "20%", bottom: -5 };
|
|
153
|
-
return {};
|
|
154
|
-
})(),
|
|
155
|
-
}}/>
|
|
130
|
+
padding: PADDING }, reLayout())}>
|
|
131
|
+
<View style={Object.assign({ width: ARROW_HEIGHT, height: ARROW_HEIGHT, backgroundColor: "#000000ee", position: "absolute", zIndex: 1, transform: [{ rotateZ: "45deg" }] }, (() => {
|
|
132
|
+
const { alignVertical, alignHorizontal } = getLayoutInfos();
|
|
133
|
+
if (alignVertical == "bottom" && alignHorizontal == "left")
|
|
134
|
+
return { left: "20%", top: -5 };
|
|
135
|
+
if (alignVertical == "bottom" && alignHorizontal == "right")
|
|
136
|
+
return { right: "20%", top: -5 };
|
|
137
|
+
if (alignVertical == "top" && alignHorizontal == "left")
|
|
138
|
+
return { left: "20%", bottom: -5 };
|
|
139
|
+
if (alignVertical == "top" && alignHorizontal == "right")
|
|
140
|
+
return { right: "20%", bottom: -5 };
|
|
141
|
+
return {};
|
|
142
|
+
})())}/>
|
|
156
143
|
|
|
157
144
|
<ScrollView onLayout={(e) => {
|
|
158
145
|
// console.log('target onLayout', e.nativeEvent.layout)
|
|
159
146
|
let _sc = e.nativeEvent.layout;
|
|
160
147
|
sc.current = _sc;
|
|
161
148
|
}}>
|
|
162
|
-
{props.data
|
|
149
|
+
{(_b = props.data) === null || _b === void 0 ? void 0 : _b.map((i, idx) => {
|
|
163
150
|
return (<TouchableOpacity activeOpacity={0.7} key={`sg-memnu-${idx}`} style={{
|
|
164
151
|
height: CELL_HEIGHT,
|
|
165
152
|
display: "flex",
|
|
@@ -179,6 +166,6 @@ export default (props) => {
|
|
|
179
166
|
</ScrollView>
|
|
180
167
|
</TouchableOpacity>),
|
|
181
168
|
});
|
|
182
|
-
};
|
|
169
|
+
});
|
|
183
170
|
return (<TouchableOpacity ref={containerRef} onPress={(e) => show()} {...props}/>);
|
|
184
171
|
};
|
|
@@ -13,19 +13,21 @@ import SYImagePicker from "@aks-dev/react-native-syan-image-picker";
|
|
|
13
13
|
let icon_add_image = require("./assets/icon_add_image.png");
|
|
14
14
|
let icon_del_image = require("./assets/icon_del_image.png");
|
|
15
15
|
const MutiPictureView = (props) => {
|
|
16
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
16
17
|
const { bind, maxCount = 6, type = "showImagePicker", addIcon, addIconStyle, addIconContainerStyle, //borderWidth: 1, borderStyle: 'dashed', borderColor: assets.color_A3A9CC 虚线框
|
|
17
18
|
itemContainerStyle, emptyPlaceHolderStyle, delIcon, delIconStyle, spacingHorizontal = px2dp(15), spacingInner = px2dp(8), editable = true, showEmptyPlaceHolder = false, } = props;
|
|
18
19
|
const { viewModel, setViewModel } = bind;
|
|
19
20
|
React.useEffect(() => { }, []);
|
|
20
21
|
const [sideLength, setSideLength] = React.useState(0);
|
|
21
22
|
const addPhoto = () => {
|
|
23
|
+
var _a, _b;
|
|
22
24
|
let images = viewModel.photos || [];
|
|
23
25
|
if (!images) {
|
|
24
26
|
throw new Error("viewModel没有定义photos字段");
|
|
25
27
|
}
|
|
26
28
|
if (type == "showImagePicker") {
|
|
27
29
|
SYImagePicker.showImagePicker({
|
|
28
|
-
imageCount: maxCount - (viewModel.photos
|
|
30
|
+
imageCount: maxCount - (((_a = viewModel.photos) === null || _a === void 0 ? void 0 : _a.length) || 0),
|
|
29
31
|
isCrop: false,
|
|
30
32
|
isRecordSelected: false,
|
|
31
33
|
quality: 20,
|
|
@@ -41,7 +43,7 @@ const MutiPictureView = (props) => {
|
|
|
41
43
|
}
|
|
42
44
|
if (type == "openCamera") {
|
|
43
45
|
SYImagePicker.openCamera({
|
|
44
|
-
imageCount: maxCount - (viewModel.photos
|
|
46
|
+
imageCount: maxCount - (((_b = viewModel.photos) === null || _b === void 0 ? void 0 : _b.length) || 0),
|
|
45
47
|
isCrop: false,
|
|
46
48
|
isRecordSelected: false,
|
|
47
49
|
quality: 20,
|
|
@@ -66,11 +68,12 @@ const MutiPictureView = (props) => {
|
|
|
66
68
|
setViewModel({ photos: photos });
|
|
67
69
|
};
|
|
68
70
|
const showPhoto = (index) => {
|
|
71
|
+
var _a;
|
|
69
72
|
Keyboard.dismiss();
|
|
70
|
-
let imgs = (props.value || viewModel.photos)
|
|
73
|
+
let imgs = ((_a = (props.value || viewModel.photos)) === null || _a === void 0 ? void 0 : _a.filter((it) => {
|
|
71
74
|
return ((typeof it === "string" && it.indexOf("http") >= 0) ||
|
|
72
75
|
typeof it == "object");
|
|
73
|
-
}) || [];
|
|
76
|
+
})) || [];
|
|
74
77
|
let images = [];
|
|
75
78
|
// console.log('viewModel', viewModel, imgs)
|
|
76
79
|
imgs.forEach((it) => {
|
|
@@ -110,7 +113,8 @@ const MutiPictureView = (props) => {
|
|
|
110
113
|
};
|
|
111
114
|
const containerRef = React.useRef(null);
|
|
112
115
|
React.useEffect(() => {
|
|
113
|
-
|
|
116
|
+
var _a;
|
|
117
|
+
(_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.measure((...args) => {
|
|
114
118
|
// console.log('measure', args[2])
|
|
115
119
|
if (args.length > 3) {
|
|
116
120
|
let _sideLength = +((args[2] - spacingHorizontal * 2 - spacingInner * 2) /
|
|
@@ -119,48 +123,51 @@ const MutiPictureView = (props) => {
|
|
|
119
123
|
}
|
|
120
124
|
});
|
|
121
125
|
});
|
|
122
|
-
if (props.value && props.value
|
|
126
|
+
if (props.value && ((_a = props.value) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
123
127
|
return (<View style={[styles.container, props.style]} ref={containerRef}>
|
|
124
128
|
{props.value instanceof Array &&
|
|
125
|
-
props.value
|
|
129
|
+
((_b = props.value) === null || _b === void 0 ? void 0 : _b.map((item, index) => {
|
|
126
130
|
return (<ItemView key={index} source={typeof item === "string" ? { uri: item } : item} index={index}/>);
|
|
127
|
-
})}
|
|
131
|
+
}))}
|
|
128
132
|
|
|
129
133
|
{showEmptyPlaceHolder &&
|
|
130
|
-
maxCount - (props.value
|
|
134
|
+
maxCount - (((_c = props.value) === null || _c === void 0 ? void 0 : _c.length) || 0) - 1 > 0 &&
|
|
131
135
|
Array.from({
|
|
132
|
-
length: maxCount - (props.value
|
|
133
|
-
}, (_, k) =>
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
: 0
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
0
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
136
|
+
length: maxCount - (((_d = props.value) === null || _d === void 0 ? void 0 : _d.length) || 0) - (editable ? 1 : 0),
|
|
137
|
+
}, (_, k) => {
|
|
138
|
+
var _a, _b;
|
|
139
|
+
return (<View key={`sg-showEmptyPlaceHolder-${k}`} style={[
|
|
140
|
+
styles.empty_place_container,
|
|
141
|
+
emptyPlaceHolderStyle,
|
|
142
|
+
itemContainerStyle,
|
|
143
|
+
{
|
|
144
|
+
marginTop: k + (editable ? 1 : 0) + (((_a = props.value) === null || _a === void 0 ? void 0 : _a.length) || 0) > 2
|
|
145
|
+
? spacingInner
|
|
146
|
+
: 0,
|
|
147
|
+
marginLeft: (k + (editable ? 1 : 0) + (((_b = props.value) === null || _b === void 0 ? void 0 : _b.length) || 0)) %
|
|
148
|
+
3 ==
|
|
149
|
+
0
|
|
150
|
+
? spacingHorizontal
|
|
151
|
+
: spacingInner,
|
|
152
|
+
width: sideLength,
|
|
153
|
+
height: sideLength,
|
|
154
|
+
},
|
|
155
|
+
]}/>);
|
|
156
|
+
})}
|
|
150
157
|
</View>);
|
|
151
158
|
}
|
|
152
159
|
return (<View style={[styles.container, props.style]} ref={containerRef}>
|
|
153
|
-
{viewModel
|
|
160
|
+
{(viewModel === null || viewModel === void 0 ? void 0 : viewModel.photos) instanceof Array &&
|
|
154
161
|
viewModel.photos.map((item, index) => {
|
|
155
162
|
return (<ItemView key={index} source={typeof item === "string" ? { uri: item } : item} index={index}/>);
|
|
156
163
|
})}
|
|
157
164
|
|
|
158
|
-
{!(viewModel
|
|
165
|
+
{!(((_e = viewModel === null || viewModel === void 0 ? void 0 : viewModel.photos) === null || _e === void 0 ? void 0 : _e.length) == maxCount) && editable && (<TouchableOpacity style={[
|
|
159
166
|
styles.item_container,
|
|
160
167
|
itemContainerStyle,
|
|
161
168
|
{
|
|
162
|
-
marginTop: (viewModel
|
|
163
|
-
marginLeft: (viewModel
|
|
169
|
+
marginTop: (((_f = viewModel === null || viewModel === void 0 ? void 0 : viewModel.photos) === null || _f === void 0 ? void 0 : _f.length) || 0) >= 3 ? spacingInner : 0,
|
|
170
|
+
marginLeft: (((_g = viewModel === null || viewModel === void 0 ? void 0 : viewModel.photos) === null || _g === void 0 ? void 0 : _g.length) || 0) % 3 == 0
|
|
164
171
|
? spacingHorizontal
|
|
165
172
|
: spacingInner,
|
|
166
173
|
width: sideLength,
|
|
@@ -181,26 +188,29 @@ const MutiPictureView = (props) => {
|
|
|
181
188
|
</Text>)}
|
|
182
189
|
</TouchableOpacity>)}
|
|
183
190
|
{showEmptyPlaceHolder &&
|
|
184
|
-
maxCount - (viewModel.photos
|
|
191
|
+
maxCount - (((_h = viewModel.photos) === null || _h === void 0 ? void 0 : _h.length) || 0) - 1 > 0 &&
|
|
185
192
|
Array.from({
|
|
186
|
-
length: maxCount - (viewModel.photos
|
|
187
|
-
}, (_, k) =>
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
: 0
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
0
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
193
|
+
length: maxCount - (((_j = viewModel.photos) === null || _j === void 0 ? void 0 : _j.length) || 0) - (editable ? 1 : 0),
|
|
194
|
+
}, (_, k) => {
|
|
195
|
+
var _a, _b;
|
|
196
|
+
return (<View key={`sg-showEmptyPlaceHolder-${k}`} style={[
|
|
197
|
+
styles.empty_place_container,
|
|
198
|
+
emptyPlaceHolderStyle,
|
|
199
|
+
itemContainerStyle,
|
|
200
|
+
{
|
|
201
|
+
marginTop: k + (editable ? 1 : 0) + (((_a = viewModel.photos) === null || _a === void 0 ? void 0 : _a.length) || 0) > 2
|
|
202
|
+
? spacingInner
|
|
203
|
+
: 0,
|
|
204
|
+
marginLeft: (k + (editable ? 1 : 0) + (((_b = viewModel.photos) === null || _b === void 0 ? void 0 : _b.length) || 0)) %
|
|
205
|
+
3 ==
|
|
206
|
+
0
|
|
207
|
+
? spacingHorizontal
|
|
208
|
+
: spacingInner,
|
|
209
|
+
width: sideLength,
|
|
210
|
+
height: sideLength,
|
|
211
|
+
},
|
|
212
|
+
]}/>);
|
|
213
|
+
})}
|
|
204
214
|
</View>);
|
|
205
215
|
};
|
|
206
216
|
const styles = StyleSheet.create({
|
|
@@ -9,9 +9,10 @@ import * as React from "react";
|
|
|
9
9
|
import { Modal, StatusBar, Platform } from "react-native";
|
|
10
10
|
import ImageViewer from "react-native-image-zoom-viewer";
|
|
11
11
|
export const PictureViewer = ({ bind, }) => {
|
|
12
|
+
var _a;
|
|
12
13
|
const { viewModel, setViewModel } = bind;
|
|
13
14
|
const visible = viewModel.imageViewer.visible;
|
|
14
|
-
const imgs = viewModel.imageViewer.imageUrls
|
|
15
|
+
const imgs = (_a = viewModel.imageViewer.imageUrls) === null || _a === void 0 ? void 0 : _a.map((item) => ({ url: item }));
|
|
15
16
|
const index = viewModel.imageViewer.index;
|
|
16
17
|
React.useEffect(() => {
|
|
17
18
|
if (Platform.OS == "android") {
|
|
@@ -32,10 +33,7 @@ export const PictureViewer = ({ bind, }) => {
|
|
|
32
33
|
* 请务必注意本属性在 Android 平台上为必填,且会在 modal 处于开启状态时阻止BackHandler事件。
|
|
33
34
|
*/
|
|
34
35
|
setViewModel({
|
|
35
|
-
imageViewer: {
|
|
36
|
-
...viewModel.imageViewer,
|
|
37
|
-
visible: false,
|
|
38
|
-
},
|
|
36
|
+
imageViewer: Object.assign(Object.assign({}, viewModel.imageViewer), { visible: false }),
|
|
39
37
|
});
|
|
40
38
|
}} style={{ margin: 0, backgroundColor: "red" }}>
|
|
41
39
|
<ImageViewer imageUrls={imgs} index={index} onSwipeDown={() => {
|
|
@@ -44,10 +42,7 @@ export const PictureViewer = ({ bind, }) => {
|
|
|
44
42
|
// onMove={data => console.log(data)}
|
|
45
43
|
useNativeDriver={true} enableSwipeDown={true} onClick={() => {
|
|
46
44
|
setViewModel({
|
|
47
|
-
imageViewer: {
|
|
48
|
-
...viewModel.imageViewer,
|
|
49
|
-
visible: false,
|
|
50
|
-
},
|
|
45
|
+
imageViewer: Object.assign(Object.assign({}, viewModel.imageViewer), { visible: false }),
|
|
51
46
|
});
|
|
52
47
|
}}/>
|
|
53
48
|
</Modal>);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { View, Text, Animated, StyleSheet, ActivityIndicator, TouchableOpacity, } from "react-native";
|
|
3
4
|
import { SwipeListView } from "react-native-swipe-list-view";
|
|
@@ -20,7 +21,8 @@ export var RefreshState;
|
|
|
20
21
|
RefreshState["None"] = "None";
|
|
21
22
|
})(RefreshState || (RefreshState = {}));
|
|
22
23
|
export default React.forwardRef((props, ref) => {
|
|
23
|
-
|
|
24
|
+
var _a, _b;
|
|
25
|
+
const { mode = "FlatList", refreshState, onHeaderRefresh, onFooterRefresh, reload } = props, rest = __rest(props, ["mode", "refreshState", "onHeaderRefresh", "onFooterRefresh", "reload"]);
|
|
24
26
|
const seed = React.useRef(Math.random()).current;
|
|
25
27
|
let onRefresh = () => {
|
|
26
28
|
if (refreshState == RefreshState.HeaderRefreshing)
|
|
@@ -55,7 +57,7 @@ export default React.forwardRef((props, ref) => {
|
|
|
55
57
|
let flatListProps = props;
|
|
56
58
|
return (<Animated.FlatList {...rest} ref={ref} refreshing={refreshState == RefreshState.HeaderRefreshing} keyExtractor={(_, index) => {
|
|
57
59
|
return `sg-index-FlatList-${seed}-${index}`;
|
|
58
|
-
}} contentContainerStyle={flatListProps.data
|
|
60
|
+
}} contentContainerStyle={((_a = flatListProps.data) === null || _a === void 0 ? void 0 : _a.length) ? {} : { height: "100%" }} onRefresh={onRefresh} onEndReachedThreshold={0.1} onEndReached={onEndReached} showsVerticalScrollIndicator={false} ListHeaderComponent={(_) => (<View style={{ display: "flex", flexDirection: "column" }}>
|
|
59
61
|
<ListHeaderComponent {...flatListProps}/>
|
|
60
62
|
{/* {flatListProps.ListHeaderComponent} */}
|
|
61
63
|
</View>)}
|
|
@@ -67,7 +69,7 @@ export default React.forwardRef((props, ref) => {
|
|
|
67
69
|
const { ItemSeparatorComponent = (_) => <View style={{ height: 1 }}/>, } = sectionListProps;
|
|
68
70
|
return (<Animated.SectionList {...rest} ref={ref} refreshing={refreshState == RefreshState.HeaderRefreshing} onRefresh={onRefresh} keyExtractor={(_, index) => {
|
|
69
71
|
return `sg-index-SectionList-${seed}-${index}`;
|
|
70
|
-
}} contentContainerStyle={sectionListProps.sections
|
|
72
|
+
}} contentContainerStyle={((_b = sectionListProps.sections) === null || _b === void 0 ? void 0 : _b.length) > 0 ? {} : { height: "100%" }} ItemSeparatorComponent={ItemSeparatorComponent} onEndReachedThreshold={0.1} onEndReached={onEndReached} showsVerticalScrollIndicator={false}
|
|
71
73
|
// ListHeaderComponent={(_) => <ListHeaderComponent {...sectionListProps} />}
|
|
72
74
|
ListHeaderComponent={(_) => (<View style={{ display: "flex", flexDirection: "column" }}>
|
|
73
75
|
<ListHeaderComponent {...sectionListProps}/>
|
|
@@ -97,15 +99,15 @@ const ListFooterComponent = React.memo((props) => {
|
|
|
97
99
|
switch (refreshState) {
|
|
98
100
|
case RefreshState.Idle:
|
|
99
101
|
case RefreshState.FooterRefreshing:
|
|
100
|
-
return (<View style={{
|
|
102
|
+
return (<View style={Object.assign(Object.assign({}, styles.container), { flexDirection: "row" })}>
|
|
101
103
|
<ActivityIndicator color={"gray"}/>
|
|
102
|
-
<Text style={{
|
|
104
|
+
<Text style={Object.assign(Object.assign({}, styles.text), { marginLeft: 5 })}>
|
|
103
105
|
{RefreshText.FooterRefreshing}
|
|
104
106
|
</Text>
|
|
105
107
|
</View>);
|
|
106
108
|
case RefreshState.NoMoreData:
|
|
107
109
|
return (<View style={styles.container}>
|
|
108
|
-
<Text style={{
|
|
110
|
+
<Text style={Object.assign(Object.assign({}, styles.text), { color: "#999999" })}>
|
|
109
111
|
{RefreshText.NoMoreData}
|
|
110
112
|
</Text>
|
|
111
113
|
</View>);
|
|
@@ -131,8 +133,8 @@ const ListHeaderComponent = React.memo((props) => {
|
|
|
131
133
|
const { refreshState } = props;
|
|
132
134
|
switch (refreshState) {
|
|
133
135
|
case RefreshState.HeaderRefreshing:
|
|
134
|
-
return (<View style={{
|
|
135
|
-
<Text style={{
|
|
136
|
+
return (<View style={Object.assign({}, styles.container)}>
|
|
137
|
+
<Text style={Object.assign({}, styles.text)}>{RefreshText.HeaderRefreshing}</Text>
|
|
136
138
|
</View>);
|
|
137
139
|
default:
|
|
138
140
|
return <View />;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
1
2
|
/*
|
|
2
3
|
* @Author: shiguo
|
|
3
4
|
* @Date: 2022-07-11 15:42:16
|
|
@@ -10,7 +11,7 @@ import { StyleSheet, Text } from "react-native";
|
|
|
10
11
|
import { px2sp } from "../../screen/px2sp";
|
|
11
12
|
import * as utils from "../../utils/lazy";
|
|
12
13
|
export default (props) => {
|
|
13
|
-
const { rich, richStyle, text, suffix, prefix,
|
|
14
|
+
const { rich, richStyle, text, suffix, prefix } = props, rest = __rest(props, ["rich", "richStyle", "text", "suffix", "prefix"]);
|
|
14
15
|
let textStr = "";
|
|
15
16
|
let richStr = "";
|
|
16
17
|
if (utils.isString(text) || utils.isNumber(text)) {
|
|
@@ -21,25 +22,25 @@ export default (props) => {
|
|
|
21
22
|
}
|
|
22
23
|
let positionStart = 0;
|
|
23
24
|
let positionEnd = 0;
|
|
24
|
-
if (textStr
|
|
25
|
+
if ((textStr === null || textStr === void 0 ? void 0 : textStr.indexOf(richStr)) >= 0) {
|
|
25
26
|
positionStart = textStr.indexOf(richStr);
|
|
26
27
|
positionEnd = positionStart + richStr.length;
|
|
27
28
|
}
|
|
28
29
|
if (prefix) {
|
|
29
30
|
return (<Text style={styles.container} {...rest}>
|
|
30
|
-
<Text style={{
|
|
31
|
+
<Text style={Object.assign(Object.assign({}, styles.defaultRich), richStyle)}>{richStr}</Text>
|
|
31
32
|
{textStr}
|
|
32
33
|
</Text>);
|
|
33
34
|
}
|
|
34
35
|
if (suffix) {
|
|
35
36
|
return (<Text style={styles.container} {...rest}>
|
|
36
37
|
{textStr}
|
|
37
|
-
<Text style={{
|
|
38
|
+
<Text style={Object.assign(Object.assign({}, styles.defaultRich), richStyle)}>{richStr}</Text>
|
|
38
39
|
</Text>);
|
|
39
40
|
}
|
|
40
41
|
return (<Text style={styles.container} {...rest}>
|
|
41
42
|
{textStr.substring(0, positionStart)}
|
|
42
|
-
{positionEnd > 0 && (<Text style={{
|
|
43
|
+
{positionEnd > 0 && (<Text style={Object.assign(Object.assign({}, styles.defaultRich), richStyle)}>{richStr}</Text>)}
|
|
43
44
|
{textStr.substring(positionEnd, textStr.length)}
|
|
44
45
|
</Text>);
|
|
45
46
|
};
|
|
@@ -8,13 +8,9 @@ export default (props) => {
|
|
|
8
8
|
<View style={[
|
|
9
9
|
styles.warpper,
|
|
10
10
|
props.showUnderline
|
|
11
|
-
? {
|
|
12
|
-
borderBottomColor: "#f2f2f2",
|
|
11
|
+
? Object.assign({ borderBottomColor: "#f2f2f2",
|
|
13
12
|
// borderBottomWidth: StyleSheet.hairlineWidth,
|
|
14
|
-
borderBottomWidth: px2dp(1),
|
|
15
|
-
...props.underlineStyle,
|
|
16
|
-
}
|
|
17
|
-
: {},
|
|
13
|
+
borderBottomWidth: px2dp(1) }, props.underlineStyle) : {},
|
|
18
14
|
]}>
|
|
19
15
|
{props.icon && (<Image style={[
|
|
20
16
|
{ width: px2dp(20), height: px2dp(20), marginRight: px2dp(8) },
|
|
@@ -23,9 +19,10 @@ export default (props) => {
|
|
|
23
19
|
<View style={[styles.middle, props.middleContaierStyle]}>
|
|
24
20
|
{/* 标题 */}
|
|
25
21
|
{(() => {
|
|
22
|
+
var _a;
|
|
26
23
|
if (typeof props.title === "string" ||
|
|
27
24
|
typeof props.title === "number") {
|
|
28
|
-
return (<Text numberOfLines={1} {...props.titleOptions} style={[styles.title, props.titleOptions
|
|
25
|
+
return (<Text numberOfLines={1} {...props.titleOptions} style={[styles.title, (_a = props.titleOptions) === null || _a === void 0 ? void 0 : _a.style]}>
|
|
29
26
|
{props.title}
|
|
30
27
|
</Text>);
|
|
31
28
|
}
|
|
@@ -35,9 +32,10 @@ export default (props) => {
|
|
|
35
32
|
})()}
|
|
36
33
|
|
|
37
34
|
{(() => {
|
|
35
|
+
var _a;
|
|
38
36
|
if (typeof props.content === "string" ||
|
|
39
37
|
typeof props.content === "number") {
|
|
40
|
-
return (<Text numberOfLines={1} {...props.contentOptions} style={[styles.content, props.contentOptions
|
|
38
|
+
return (<Text numberOfLines={1} {...props.contentOptions} style={[styles.content, (_a = props.contentOptions) === null || _a === void 0 ? void 0 : _a.style]}>
|
|
41
39
|
{props.content}
|
|
42
40
|
</Text>);
|
|
43
41
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
1
2
|
/*
|
|
2
3
|
* @Author: shiguo
|
|
3
4
|
* @Date: 2022-04-24 13:56:47
|
|
@@ -10,7 +11,7 @@ import { View, Text, TextInput, StyleSheet, } from "react-native";
|
|
|
10
11
|
import { px2dp } from "../../screen/px2dp";
|
|
11
12
|
import { px2sp } from "../../screen/px2sp";
|
|
12
13
|
export default React.forwardRef((props, ref) => {
|
|
13
|
-
const { defaultValue, placeholder, maxLength = 200, on,
|
|
14
|
+
const { defaultValue, placeholder, maxLength = 200, on } = props, rest = __rest(props, ["defaultValue", "placeholder", "maxLength", "on"]);
|
|
14
15
|
const [value, setValue] = React.useState(defaultValue);
|
|
15
16
|
React.useLayoutEffect(() => {
|
|
16
17
|
setValue(defaultValue);
|
|
@@ -26,11 +27,8 @@ export default React.forwardRef((props, ref) => {
|
|
|
26
27
|
|
|
27
28
|
<View style={styles.corner}>
|
|
28
29
|
<Text style={styles.limit}>
|
|
29
|
-
<Text style={{
|
|
30
|
-
|
|
31
|
-
color: value && value?.length > maxLength - 5 ? "red" : "#AFAFAF",
|
|
32
|
-
}}>
|
|
33
|
-
{value?.length || 0}
|
|
30
|
+
<Text style={Object.assign(Object.assign({}, styles.limit), { color: value && (value === null || value === void 0 ? void 0 : value.length) > maxLength - 5 ? "red" : "#AFAFAF" })}>
|
|
31
|
+
{(value === null || value === void 0 ? void 0 : value.length) || 0}
|
|
34
32
|
</Text>
|
|
35
33
|
/{maxLength}
|
|
36
34
|
</Text>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
1
2
|
/*
|
|
2
3
|
* @Author: shiguo
|
|
3
4
|
* @Date: 2022-05-05 14:19:39
|
|
@@ -20,11 +21,11 @@ export const getAppVersion = () => UpgradeModule.getAppVersion();
|
|
|
20
21
|
* @return {*}
|
|
21
22
|
*/
|
|
22
23
|
export const getOSVersion = () => UpgradeModule.getOSVersion();
|
|
23
|
-
export const upgrade =
|
|
24
|
+
export const upgrade = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
25
|
const { title = "提示" } = options;
|
|
25
26
|
if (Platform.OS == "android") {
|
|
26
27
|
try {
|
|
27
|
-
const granted =
|
|
28
|
+
const granted = yield PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE, {
|
|
28
29
|
title: "提示",
|
|
29
30
|
message: "应用升级需要获取APP的写入权限",
|
|
30
31
|
buttonNeutral: "稍后再询问",
|
|
@@ -41,4 +42,4 @@ export const upgrade = async (options) => {
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
return UpgradeModule.upgrade(options);
|
|
44
|
-
};
|
|
45
|
+
});
|
package/dist/screen/text-fit.js
CHANGED
|
@@ -12,14 +12,9 @@ import React from 'react';
|
|
|
12
12
|
import { Platform, Text as Text_spaceName, TextInput as TextInput_spaceName } from 'react-native';
|
|
13
13
|
const Text = Text_spaceName;
|
|
14
14
|
const TextInput = TextInput_spaceName;
|
|
15
|
-
const textDefaultStyle = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}),
|
|
19
|
-
allowFontScaling: false,
|
|
20
|
-
paddingVertical: 0,
|
|
21
|
-
paddingHorizontal: 0,
|
|
22
|
-
};
|
|
15
|
+
const textDefaultStyle = Object.assign(Object.assign({}, Platform.select({
|
|
16
|
+
android: { fontFamily: 'DroidSansFallback' }
|
|
17
|
+
})), { allowFontScaling: false, paddingVertical: 0, paddingHorizontal: 0 });
|
|
23
18
|
const textRender = Text.render;
|
|
24
19
|
Text.render = function (...args) {
|
|
25
20
|
const origin = textRender.call(this, ...args);
|
package/dist/utils/lazy.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @LastEditTime: 2023-03-23 15:07:44
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/utils/lazy.ts
|
|
7
7
|
*/
|
|
8
|
+
import { __awaiter } from "tslib";
|
|
8
9
|
/**
|
|
9
10
|
* @description: 睡眠时间
|
|
10
11
|
* @param {*}毫秒值
|
|
@@ -28,19 +29,19 @@ export const randomcolor = () => {
|
|
|
28
29
|
* @param {*} dataList:数据源
|
|
29
30
|
* @return {*}
|
|
30
31
|
*/
|
|
31
|
-
export const syncLoop =
|
|
32
|
+
export const syncLoop = (dataList, callback) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
33
|
const length = dataList.length;
|
|
33
34
|
const O = Object(dataList);
|
|
34
35
|
let k = 0;
|
|
35
36
|
while (k < length) {
|
|
36
37
|
if (k in O) {
|
|
37
38
|
const kValue = O[k];
|
|
38
|
-
|
|
39
|
+
yield callback(kValue, k);
|
|
39
40
|
}
|
|
40
41
|
k++;
|
|
41
42
|
}
|
|
42
43
|
return Promise.resolve("SyncForeach loop over");
|
|
43
|
-
};
|
|
44
|
+
});
|
|
44
45
|
/**
|
|
45
46
|
* @description: 对11位手机号码加*
|
|
46
47
|
* @return {*}
|
|
@@ -253,14 +254,16 @@ export const isChainChar = (str) => {
|
|
|
253
254
|
return true;
|
|
254
255
|
};
|
|
255
256
|
export const isHaveChartCount = (str) => {
|
|
257
|
+
var _a;
|
|
256
258
|
if (/[a-z]/i.test(str)) {
|
|
257
|
-
return str.match(/[a-z]/gi)
|
|
259
|
+
return (_a = str.match(/[a-z]/gi)) === null || _a === void 0 ? void 0 : _a.length;
|
|
258
260
|
}
|
|
259
261
|
return 0;
|
|
260
262
|
};
|
|
261
263
|
export const isHaveNumberCount = (str) => {
|
|
264
|
+
var _a;
|
|
262
265
|
if (/[0-9]/i.test(str)) {
|
|
263
|
-
return str.match(/[0-9]/gi)
|
|
266
|
+
return (_a = str.match(/[0-9]/gi)) === null || _a === void 0 ? void 0 : _a.length;
|
|
264
267
|
}
|
|
265
268
|
return 0;
|
|
266
269
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aks-dev/easyui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.191",
|
|
4
4
|
"description": "工具箱",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
"types": "./types/index.d.ts",
|
|
8
|
-
"import": "./dist/index.js"
|
|
9
|
-
}
|
|
10
|
-
},
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./types/index.d.ts",
|
|
11
7
|
"scripts": {
|
|
12
8
|
"test": "yarn run lint",
|
|
13
9
|
"release": "yarn semantic-release",
|