@aks-dev/easyui 1.0.196 → 1.0.198
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 +41 -23
- package/dist/components/Badge/Badge.js +16 -7
- package/dist/components/DottedLine/DottedLine.js +20 -15
- package/dist/components/Echarts/EchartsView.js +77 -40
- package/dist/components/Echarts/helper.js +16 -1
- package/dist/components/Hud/AlertBottomView/AlertBottomView.js +64 -49
- package/dist/components/Hud/AlertSheetView/AlertSheetView.js +34 -30
- package/dist/components/Hud/AlertView/AlertView.js +66 -52
- package/dist/components/Hud/Hud.js +19 -8
- package/dist/components/Hud/Loading/Loading.js +25 -7
- package/dist/components/Hud/PopoverView/PopoverView.js +20 -5
- package/dist/components/Hud/Scanner/Scanner.js +99 -71
- package/dist/components/Hud/Toast/Toast.js +16 -6
- package/dist/components/MenuView/MenuView.js +73 -32
- package/dist/components/Modal/Modal.js +7 -0
- package/dist/components/MutiPictureView/MutiPictureView.js +88 -78
- package/dist/components/PictureViewer/PictureViewer.js +32 -11
- package/dist/components/RefreshList/RefreshList.js +52 -43
- package/dist/components/RichText/RichText.js +23 -23
- package/dist/components/StickHeaderView/StickHeaderView.js +12 -2
- package/dist/components/TableCell/TableCell.js +53 -37
- package/dist/components/TextInputArea/TextInputArea.js +31 -22
- package/dist/components/WithLoadingContainer/WithLoadingContainer.js +31 -14
- package/dist/index.js +11 -0
- package/dist/jsbridge/RNEasyui.js +26 -1
- package/dist/jsbridge/UpgradeModule.js +21 -12
- package/dist/jsbridge/index.js +7 -0
- package/dist/screen/index.js +8 -0
- package/dist/screen/px2dp.js +25 -2
- package/dist/screen/px2sp.js +35 -5
- package/dist/screen/text-fit.js +21 -5
- package/dist/utils/index.js +7 -0
- package/dist/utils/lazy.js +71 -19
- package/dist/utils/mode.js +21 -0
- package/package.json +1 -2
- package/types/components/AnimationModal/AnimationModal.d.ts +8 -0
- package/types/components/AnimationModal/AnimationModal.d.ts.map +1 -1
- package/types/components/Echarts/helper.d.ts +5 -0
- package/types/components/Echarts/helper.d.ts.map +1 -1
- package/types/components/Hud/AlertBottomView/AlertBottomView.d.ts +1 -1
- package/types/components/Hud/AlertBottomView/AlertBottomView.d.ts.map +1 -1
- package/types/components/Hud/AlertSheetView/AlertSheetView.d.ts +1 -1
- package/types/components/Hud/AlertSheetView/AlertSheetView.d.ts.map +1 -1
- package/types/components/Hud/AlertView/AlertView.d.ts +1 -1
- package/types/components/Hud/AlertView/AlertView.d.ts.map +1 -1
- package/types/components/Hud/Loading/Loading.d.ts +3 -3
- package/types/components/Hud/Loading/Loading.d.ts.map +1 -1
- package/types/components/Hud/PopoverView/PopoverView.d.ts +3 -3
- package/types/components/Hud/PopoverView/PopoverView.d.ts.map +1 -1
- package/types/components/Hud/Scanner/Scanner.d.ts +3 -3
- package/types/components/Hud/Scanner/Scanner.d.ts.map +1 -1
- package/types/components/Hud/Toast/Toast.d.ts +2 -2
- package/types/components/Hud/Toast/Toast.d.ts.map +1 -1
- package/types/components/MutiPictureView/MutiPictureView.d.ts +9 -0
- package/types/components/MutiPictureView/MutiPictureView.d.ts.map +1 -1
- package/types/components/StickHeaderView/StickHeaderView.d.ts +6 -0
- package/types/components/StickHeaderView/StickHeaderView.d.ts.map +1 -1
- package/types/components/TextInputArea/TextInputArea.d.ts +1 -0
- package/types/components/TextInputArea/TextInputArea.d.ts.map +1 -1
- package/types/jsbridge/RNEasyui.d.ts +18 -0
- package/types/jsbridge/RNEasyui.d.ts.map +1 -1
- package/types/jsbridge/UpgradeModule.d.ts +15 -0
- package/types/jsbridge/UpgradeModule.d.ts.map +1 -1
- package/types/screen/px2dp.d.ts +11 -0
- package/types/screen/px2dp.d.ts.map +1 -1
- package/types/screen/text-fit.d.ts +3 -0
- package/types/screen/text-fit.d.ts.map +1 -1
- package/types/utils/lazy.d.ts +35 -2
- package/types/utils/lazy.d.ts.map +1 -1
- package/types/utils/mode.d.ts +14 -0
- package/types/utils/mode.d.ts.map +1 -1
- package/dist/components/Echarts/demo.js +0 -201
- package/dist/components/RefreshList/demo.js +0 -9
- package/dist/components/RefreshList/demo1.js +0 -27
- package/dist/components/RefreshList/demo2.js +0 -9
- package/dist/components/StickHeaderView/demo.js +0 -37
- package/types/components/Echarts/demo.d.ts +0 -4
- package/types/components/Echarts/demo.d.ts.map +0 -1
- package/types/components/RefreshList/demo.d.ts +0 -2
- package/types/components/RefreshList/demo.d.ts.map +0 -1
- package/types/components/RefreshList/demo1.d.ts +0 -2
- package/types/components/RefreshList/demo1.d.ts.map +0 -1
- package/types/components/RefreshList/demo2.d.ts +0 -2
- package/types/components/RefreshList/demo2.d.ts.map +0 -1
- package/types/components/StickHeaderView/demo.d.ts +0 -4
- package/types/components/StickHeaderView/demo.d.ts.map +0 -1
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
});
|
|
9
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-05-17 15:22:06
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2023-09-27 15:17:15
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/lib/AnimationModal/AnimationModal.tsx
|
|
7
|
+
*/
|
|
10
8
|
import * as React from "react";
|
|
11
9
|
import { View, Animated, Easing, PanResponder, StyleSheet, useWindowDimensions, BackHandler, } from "react-native";
|
|
12
10
|
import * as utils from "../../utils/lazy";
|
|
11
|
+
// type State = {
|
|
12
|
+
// display: 'flex' | 'none';
|
|
13
|
+
// }
|
|
14
|
+
// type StateReducerProps = (state: State, action: Partial<State>) => State
|
|
13
15
|
export const AnimationModal = React.forwardRef((props, ref) => {
|
|
14
16
|
const { animationType = "from-bottom", mask = false } = props || {};
|
|
15
17
|
const { height } = useWindowDimensions();
|
|
18
|
+
// const [state, dispatch] = React.useReducer<StateReducerProps>(
|
|
19
|
+
// (state, action) => ({ ...state, ...action }),
|
|
20
|
+
// {
|
|
21
|
+
// display: 'none'
|
|
22
|
+
// })
|
|
16
23
|
const [display, setDisplay] = useCallbackState("none");
|
|
17
24
|
const animatedValue = React.useRef(new Animated.Value(0)).current;
|
|
18
25
|
const timing = (value) => {
|
|
@@ -22,14 +29,14 @@ export const AnimationModal = React.forwardRef((props, ref) => {
|
|
|
22
29
|
useNativeDriver: true,
|
|
23
30
|
easing: Easing.ease,
|
|
24
31
|
}).start(({ finished }) => {
|
|
32
|
+
/* 动画完成的回调函数 */
|
|
25
33
|
});
|
|
26
34
|
};
|
|
27
35
|
const viewRef = React.useRef(null);
|
|
28
36
|
const layoutRef = React.useRef({ h0: 0, h1: 0 });
|
|
29
37
|
const getLayoutPromise = () => {
|
|
30
38
|
return new Promise((resovle, reject) => {
|
|
31
|
-
|
|
32
|
-
(_a = viewRef.current) === null || _a === void 0 ? void 0 : _a.measure((...args) => {
|
|
39
|
+
viewRef.current?.measure((...args) => {
|
|
33
40
|
if (args.length == 6) {
|
|
34
41
|
layoutRef.current.h1 = args[3];
|
|
35
42
|
}
|
|
@@ -46,12 +53,11 @@ export const AnimationModal = React.forwardRef((props, ref) => {
|
|
|
46
53
|
};
|
|
47
54
|
const getData = () => dataRef.current;
|
|
48
55
|
const show = () => {
|
|
49
|
-
setDisplay("flex", () =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}));
|
|
56
|
+
setDisplay("flex", async () => {
|
|
57
|
+
await utils.sleep(50);
|
|
58
|
+
await getLayoutPromise();
|
|
59
|
+
timing(-layoutRef.current?.h1);
|
|
60
|
+
});
|
|
55
61
|
return init();
|
|
56
62
|
};
|
|
57
63
|
const hide = () => {
|
|
@@ -69,9 +75,9 @@ export const AnimationModal = React.forwardRef((props, ref) => {
|
|
|
69
75
|
addEventListener.remove();
|
|
70
76
|
};
|
|
71
77
|
}, [display]);
|
|
72
|
-
return (
|
|
78
|
+
return (<View style={Object.assign({
|
|
73
79
|
display: display,
|
|
74
|
-
}, styles.container, props.style)
|
|
80
|
+
}, styles.container, props.style)} {...PanResponder.create({
|
|
75
81
|
onStartShouldSetPanResponder: (e, gestureState) => {
|
|
76
82
|
let pageY = e.nativeEvent.pageY;
|
|
77
83
|
let topY = height - layoutRef.current.h1;
|
|
@@ -81,6 +87,7 @@ export const AnimationModal = React.forwardRef((props, ref) => {
|
|
|
81
87
|
return false;
|
|
82
88
|
},
|
|
83
89
|
onPanResponderGrant: (e, gestureState) => {
|
|
90
|
+
// console.log({e})
|
|
84
91
|
let pageY = e.nativeEvent.pageY;
|
|
85
92
|
let topY = height - layoutRef.current.h1;
|
|
86
93
|
if (pageY <= topY && !mask) {
|
|
@@ -88,10 +95,18 @@ export const AnimationModal = React.forwardRef((props, ref) => {
|
|
|
88
95
|
hide();
|
|
89
96
|
}
|
|
90
97
|
},
|
|
91
|
-
}).panHandlers
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
}).panHandlers}>
|
|
99
|
+
<Animated.View style={Object.assign({}, styles.wrapper, {
|
|
100
|
+
transform: [{ translateY: animatedValue }],
|
|
101
|
+
})}
|
|
102
|
+
// onLayout={e => {
|
|
103
|
+
// let target: LayoutRectangle = e.nativeEvent.layout
|
|
104
|
+
// layoutRef.current.h1 = target.height
|
|
105
|
+
// }}
|
|
106
|
+
ref={viewRef}>
|
|
107
|
+
{props.children}
|
|
108
|
+
</Animated.View>
|
|
109
|
+
</View>);
|
|
95
110
|
});
|
|
96
111
|
const styles = StyleSheet.create({
|
|
97
112
|
container: {
|
|
@@ -101,6 +116,7 @@ const styles = StyleSheet.create({
|
|
|
101
116
|
top: 0,
|
|
102
117
|
bottom: 0,
|
|
103
118
|
zIndex: 999,
|
|
119
|
+
// display: 'flex',
|
|
104
120
|
flexDirection: "column",
|
|
105
121
|
backgroundColor: "#00000055",
|
|
106
122
|
overflow: "hidden",
|
|
@@ -109,12 +125,14 @@ const styles = StyleSheet.create({
|
|
|
109
125
|
position: "absolute",
|
|
110
126
|
display: "flex",
|
|
111
127
|
flexDirection: "column",
|
|
128
|
+
// backgroundColor: 'pink',
|
|
112
129
|
width: "100%",
|
|
113
130
|
top: "100%",
|
|
114
131
|
},
|
|
115
132
|
empty: {
|
|
116
133
|
flex: 1,
|
|
117
134
|
position: "relative",
|
|
135
|
+
// backgroundColor: 'cyan'
|
|
118
136
|
},
|
|
119
137
|
});
|
|
120
138
|
const useCallbackState = (od) => {
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-21 14:40:29
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-07-08 15:40:21
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/lib/Badge/Badge.tsx
|
|
7
|
+
*/
|
|
1
8
|
import React from "react";
|
|
2
9
|
import { View, Text } from "react-native";
|
|
3
10
|
import { px2dp } from "../../screen/px2dp";
|
|
4
11
|
import { px2sp } from "../../screen/px2sp";
|
|
5
12
|
export const Badge = (props) => {
|
|
6
13
|
if (isNaN(+props.count) || Number(props.count) == 0)
|
|
7
|
-
return
|
|
8
|
-
return (
|
|
14
|
+
return <View />;
|
|
15
|
+
return (<View style={[
|
|
9
16
|
{
|
|
10
17
|
flexGrow: 0,
|
|
11
18
|
flexShrink: 1,
|
|
12
19
|
zIndex: 1,
|
|
20
|
+
// paddingHorizontal: px2dp(0),
|
|
13
21
|
height: px2dp(16),
|
|
14
22
|
minWidth: px2dp(16),
|
|
15
23
|
borderRadius: px2dp(8),
|
|
@@ -18,9 +26,10 @@ export const Badge = (props) => {
|
|
|
18
26
|
backgroundColor: "red",
|
|
19
27
|
},
|
|
20
28
|
props.style,
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
]}>
|
|
30
|
+
<Text style={{ fontSize: px2sp(12), color: "white", textAlign: "center" }}>
|
|
31
|
+
{" "}
|
|
32
|
+
{Number(props.count) > 99 ? "+99" : props.count}{" "}
|
|
33
|
+
</Text>
|
|
34
|
+
</View>);
|
|
26
35
|
};
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-07-12 15:30:19
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-07-12 15:33:06
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/lib/DottedLine/DottedLine.tsx
|
|
7
|
+
*/
|
|
12
8
|
import React from "react";
|
|
13
9
|
import { StyleSheet, View } from "react-native";
|
|
14
10
|
export default (props) => {
|
|
15
|
-
const { vertical = false, dottedColor, dottedCount = 200
|
|
11
|
+
const { vertical = false, dottedColor, dottedCount = 200, ...rest } = props;
|
|
16
12
|
const arrs = Array.from({ length: dottedCount }, (k, v) => v);
|
|
17
|
-
return (
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
return (<View style={{
|
|
14
|
+
...styles.container,
|
|
15
|
+
flexDirection: vertical ? "column" : "row",
|
|
16
|
+
...rest.style,
|
|
17
|
+
}}>
|
|
18
|
+
{arrs.map((item, index) => {
|
|
19
|
+
return (<View key={`dotted-${index}`} style={{
|
|
20
|
+
...(vertical ? styles.dotted_vertical : styles.dotted_horizontal),
|
|
21
|
+
...(dottedColor && { backgroundColor: dottedColor }),
|
|
22
|
+
}}/>);
|
|
23
|
+
})}
|
|
24
|
+
</View>);
|
|
20
25
|
};
|
|
21
26
|
const styles = StyleSheet.create({
|
|
22
27
|
container: {
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
});
|
|
9
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-05-05 14:52:53
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2023-01-03 17:50:43
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/lib/Echarts/EchartsView.tsx
|
|
7
|
+
*/
|
|
10
8
|
import * as React from "react";
|
|
11
9
|
import { StyleSheet, View, } from "react-native";
|
|
12
10
|
import { WebView } from "react-native-webview";
|
|
13
11
|
import { getHtml, toString } from "./helper";
|
|
12
|
+
// type Reducer = (prevState: State, action: Partial<State>) => State;
|
|
14
13
|
const EchartsView = (props) => {
|
|
15
|
-
var _a, _b;
|
|
16
14
|
const [state, dispatch] = React.useReducer((prevState, ...args) => Object.assign({}, prevState, ...args), {
|
|
17
15
|
width: 0,
|
|
18
16
|
height: 0,
|
|
@@ -23,8 +21,7 @@ const EchartsView = (props) => {
|
|
|
23
21
|
const rootView = React.useRef({ pageX: 0, pageY: 0, width: 0, height: 0 });
|
|
24
22
|
const getRootViewlayoutPromise = () => {
|
|
25
23
|
return new Promise((resovle, reject) => {
|
|
26
|
-
|
|
27
|
-
(_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.measure((...args) => {
|
|
24
|
+
containerRef.current?.measure((...args) => {
|
|
28
25
|
if (args.length == 6) {
|
|
29
26
|
rootView.current = {
|
|
30
27
|
width: args[2],
|
|
@@ -33,15 +30,15 @@ const EchartsView = (props) => {
|
|
|
33
30
|
pageY: args[5],
|
|
34
31
|
};
|
|
35
32
|
}
|
|
33
|
+
// console.log('RootView', rootView.current)
|
|
36
34
|
resovle(args);
|
|
37
35
|
});
|
|
38
36
|
});
|
|
39
37
|
};
|
|
40
38
|
React.useLayoutEffect(() => {
|
|
41
|
-
(() =>
|
|
42
|
-
var _a;
|
|
39
|
+
(async () => {
|
|
43
40
|
if (state.isLoaded) {
|
|
44
|
-
|
|
41
|
+
await getRootViewlayoutPromise();
|
|
45
42
|
let height = rootView.current.height
|
|
46
43
|
? `${rootView.current.height}px`
|
|
47
44
|
: "auto";
|
|
@@ -60,9 +57,8 @@ const EchartsView = (props) => {
|
|
|
60
57
|
instance.setOption(${toString(props.option)});
|
|
61
58
|
})();
|
|
62
59
|
`;
|
|
63
|
-
|
|
60
|
+
WebViewRef.current?.injectJavaScript(run);
|
|
64
61
|
return () => {
|
|
65
|
-
var _a;
|
|
66
62
|
const run = `
|
|
67
63
|
;(function() {
|
|
68
64
|
var instance = echarts.getInstanceByDom(document.getElementById('main'));
|
|
@@ -72,35 +68,75 @@ const EchartsView = (props) => {
|
|
|
72
68
|
}
|
|
73
69
|
})();
|
|
74
70
|
`;
|
|
75
|
-
|
|
71
|
+
WebViewRef.current?.injectJavaScript(run);
|
|
76
72
|
};
|
|
77
73
|
}
|
|
78
74
|
return undefined;
|
|
79
|
-
})
|
|
75
|
+
})().catch((err) => {
|
|
80
76
|
console.log(err);
|
|
81
77
|
});
|
|
82
78
|
}, [props.option, state.isLoaded]);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
79
|
+
// const injectedJavaScript = (): string => {
|
|
80
|
+
// console.log('injectedJavaScript', props.option.xAxis.data)
|
|
81
|
+
// let height = state.height ? `${state.height}px` : 'auto'
|
|
82
|
+
// let width = state.width ? `${state.width}px` : 'auto'
|
|
83
|
+
// return `
|
|
84
|
+
// ;(function() {
|
|
85
|
+
// document.getElementById('main').style.height = "${height}";
|
|
86
|
+
// document.getElementById('main').style.width = "${width}";
|
|
87
|
+
// var instance = echarts.getInstanceByDom(document.getElementById('main'));
|
|
88
|
+
// if(instance == null){
|
|
89
|
+
// instance = echarts.init(document.getElementById('main'));
|
|
90
|
+
// }
|
|
91
|
+
// instance.clear();
|
|
92
|
+
// instance.setOption(${toString(props.option)});
|
|
93
|
+
// instance.on('click', function(params) {
|
|
94
|
+
// var seen = [];
|
|
95
|
+
// var paramsString = JSON.stringify(params, function(key, val) {
|
|
96
|
+
// if (val != null && typeof val == "object") {
|
|
97
|
+
// if (seen.indexOf(val) >= 0) {
|
|
98
|
+
// return;
|
|
99
|
+
// }
|
|
100
|
+
// seen.push(val);
|
|
101
|
+
// }
|
|
102
|
+
// return val;
|
|
103
|
+
// });
|
|
104
|
+
// // window.ReactNativeWebView.postMessage(JSON.stringify({"types":"ON_PRESS","payload": paramsString}));
|
|
105
|
+
// });
|
|
106
|
+
// })();
|
|
107
|
+
// `
|
|
108
|
+
// }
|
|
109
|
+
return (<View style={[styles.container, props.style]} ref={containerRef}>
|
|
110
|
+
<WebView ref={WebViewRef} originWhitelist={["*"]} useWebKit={true} // ios使用最新webkit内核渲染
|
|
111
|
+
allowUniversalAccessFromFileURLs={true} geolocationEnabled={true} mixedContentMode={"always"} renderLoading={() => {
|
|
112
|
+
if (props.renderLoading)
|
|
113
|
+
return props.renderLoading();
|
|
114
|
+
return (<View style={{
|
|
115
|
+
backgroundColor: props.style?.backgroundColor || "transparent",
|
|
116
|
+
}}/>);
|
|
117
|
+
}} // 设置空View,修复ioswebview闪白
|
|
118
|
+
style={{
|
|
119
|
+
backgroundColor: props.style?.backgroundColor || "transparent",
|
|
120
|
+
opacity: 0.99, //解决闪退的办法
|
|
121
|
+
}} // 设置背景色透明,修复android闪白
|
|
122
|
+
scrollEnabled={false}
|
|
123
|
+
// onMessage={e=>{
|
|
124
|
+
// console.log(e)
|
|
125
|
+
// }}
|
|
126
|
+
javaScriptEnabled={true}
|
|
127
|
+
// injectedJavaScript={injectedJavaScript()}
|
|
128
|
+
startInLoadingState={false} onLoadEnd={(_) => {
|
|
129
|
+
dispatch({ isLoaded: true });
|
|
130
|
+
// console.log('onLoadEnd')
|
|
131
|
+
}} onError={(e) => {
|
|
132
|
+
console.log("onError", e);
|
|
133
|
+
}} source={{
|
|
134
|
+
baseUrl: "",
|
|
135
|
+
html: getHtml({
|
|
136
|
+
backgroundColor: props.style?.backgroundColor || "transparent",
|
|
137
|
+
}),
|
|
138
|
+
}}/>
|
|
139
|
+
</View>);
|
|
104
140
|
};
|
|
105
141
|
const styles = StyleSheet.create({
|
|
106
142
|
container: {
|
|
@@ -110,5 +146,6 @@ const styles = StyleSheet.create({
|
|
|
110
146
|
},
|
|
111
147
|
});
|
|
112
148
|
export default EchartsView;
|
|
149
|
+
// React.memo(EchartsView)
|
|
113
150
|
import * as echarts from "echarts/core";
|
|
114
151
|
export { echarts };
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-05-05 15:56:21
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2023-01-03 17:02:57
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/lib/Echarts/helper.tsx
|
|
7
|
+
*/
|
|
1
8
|
export const getHtml = (props) => {
|
|
2
9
|
return `
|
|
3
10
|
<!DOCTYPE html>
|
|
@@ -35,15 +42,23 @@ export const getHtml = (props) => {
|
|
|
35
42
|
</html>
|
|
36
43
|
`;
|
|
37
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* https://res.actiiot.com/echarts/5.0.2/echarts.min.js
|
|
47
|
+
*
|
|
48
|
+
* https://cdnjs.cloudflare.com/ajax/libs/echarts/5.4.1/echarts.min.js
|
|
49
|
+
*/
|
|
38
50
|
export const toString = (obj) => {
|
|
39
51
|
let result = JSON.stringify(obj, function (key, val) {
|
|
52
|
+
// 对function进行特殊处理
|
|
40
53
|
if (typeof val === 'function') {
|
|
41
54
|
return `~ha~${val}~ha~`;
|
|
42
55
|
}
|
|
43
56
|
return val;
|
|
44
57
|
});
|
|
58
|
+
// 再进行还原
|
|
45
59
|
do {
|
|
46
|
-
result = result.replace('\"~ha~', '').replace('~ha~\"', '').replace(/\\\"/g, "\"");
|
|
60
|
+
result = result.replace('\"~ha~', '').replace('~ha~\"', '').replace(/\\\"/g, "\""); //最后一个replace将release模式中莫名生成的\"转换成"
|
|
47
61
|
} while (result.indexOf('~ha~') >= 0);
|
|
48
62
|
return result;
|
|
49
63
|
};
|
|
64
|
+
///.replace(/\\n/g, '')
|
|
@@ -1,12 +1,3 @@
|
|
|
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
|
-
};
|
|
10
1
|
import * as React from "react";
|
|
11
2
|
import { View, Text, StyleSheet, Platform, StatusBar, TouchableOpacity, Dimensions, } from "react-native";
|
|
12
3
|
import Modal from "react-native-modal";
|
|
@@ -22,16 +13,16 @@ export default React.forwardRef((_, ref) => {
|
|
|
22
13
|
const cancelCallbackRef = React.useRef(undefined);
|
|
23
14
|
const confirmCallbackRef = React.useRef(undefined);
|
|
24
15
|
React.useImperativeHandle(ref, () => ({
|
|
25
|
-
show: (options) =>
|
|
16
|
+
show: async (options) => {
|
|
26
17
|
setState(Object.assign({}, defaultState, { visible: true }, options));
|
|
27
18
|
cancelCallbackRef.current = options.cancel;
|
|
28
19
|
confirmCallbackRef.current = options.confirm;
|
|
29
|
-
}
|
|
20
|
+
},
|
|
30
21
|
hide,
|
|
31
22
|
}), []);
|
|
32
|
-
const hide = () =>
|
|
23
|
+
const hide = async () => {
|
|
33
24
|
setState(defaultState);
|
|
34
|
-
}
|
|
25
|
+
};
|
|
35
26
|
React.useEffect(() => {
|
|
36
27
|
if (Platform.OS == "android") {
|
|
37
28
|
if (state.visible) {
|
|
@@ -44,48 +35,69 @@ export default React.forwardRef((_, ref) => {
|
|
|
44
35
|
}
|
|
45
36
|
}
|
|
46
37
|
}, [state.visible]);
|
|
47
|
-
return (
|
|
38
|
+
return (<Modal hideModalContentWhileAnimating={true} //通过隐藏模态内容直到动画完成来增强性能
|
|
39
|
+
useNativeDriver={true} //定义动画是否应使用本机驱动程序
|
|
40
|
+
animationIn="slideInUp" animationOut="slideOutDown" onBackButtonPress={() => {
|
|
41
|
+
//按下Android后退按钮时调用
|
|
48
42
|
hide();
|
|
49
|
-
}
|
|
43
|
+
}} onBackdropPress={() => {
|
|
44
|
+
//按下背景时调用
|
|
50
45
|
hide();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
46
|
+
}} isVisible={state.visible} style={{ margin: 0 }} deviceHeight={Dimensions.get("screen").height}>
|
|
47
|
+
<View style={styles.container}>
|
|
48
|
+
<View style={[styles.wrapper, state.wrapperStyle]}>
|
|
49
|
+
{state.title && <Text style={styles.titleText}>{state.title}</Text>}
|
|
50
|
+
<View style={[state.contentContainerStyle]}>
|
|
51
|
+
{(() => {
|
|
52
|
+
if (typeof state.content == "string")
|
|
53
|
+
return <Text style={styles.contentText}>{state.content}</Text>;
|
|
54
|
+
if (React.isValidElement(state.content))
|
|
55
|
+
return state.content;
|
|
56
|
+
return <View />;
|
|
57
|
+
})()}
|
|
58
|
+
</View>
|
|
59
|
+
{(state.cancelText || state.confirmText) && (<View style={styles.action}>
|
|
60
|
+
{state.cancelText && (<TouchableOpacity style={[
|
|
61
|
+
styles.cancel,
|
|
62
|
+
{ marginRight: state.confirmText ? px2dp(15) : 0 },
|
|
63
|
+
state.cancelContainerStyle,
|
|
64
|
+
]} activeOpacity={0.8} onPress={() => {
|
|
65
|
+
hide();
|
|
66
|
+
cancelCallbackRef.current && cancelCallbackRef.current();
|
|
67
|
+
cancelCallbackRef.current = undefined;
|
|
68
|
+
}}>
|
|
69
|
+
<Text style={[styles.cancelText, state.cancelTextStyle]}>
|
|
70
|
+
{state.cancelText}
|
|
71
|
+
</Text>
|
|
72
|
+
</TouchableOpacity>)}
|
|
73
|
+
|
|
74
|
+
{state.confirmText && (<TouchableOpacity style={[
|
|
75
|
+
styles.confirm,
|
|
76
|
+
{ marginLeft: state.cancelText ? px2dp(15) : 0 },
|
|
77
|
+
state.confirmContainerStyle,
|
|
78
|
+
]} activeOpacity={0.8} onPress={() => {
|
|
79
|
+
hide();
|
|
80
|
+
confirmCallbackRef.current && confirmCallbackRef.current();
|
|
81
|
+
confirmCallbackRef.current = undefined;
|
|
82
|
+
}}>
|
|
83
|
+
<Text style={[styles.confirmText, state.confirmTextStyle]}>
|
|
84
|
+
{state.confirmText}
|
|
85
|
+
</Text>
|
|
86
|
+
</TouchableOpacity>)}
|
|
87
|
+
</View>)}
|
|
88
|
+
</View>
|
|
89
|
+
</View>
|
|
90
|
+
</Modal>);
|
|
83
91
|
});
|
|
84
92
|
export const alertBottomViewRef = React.createRef();
|
|
85
93
|
export const showAlertBottomModal = (props) => {
|
|
86
|
-
|
|
87
|
-
(_a = alertBottomViewRef.current) === null || _a === void 0 ? void 0 : _a.show(props);
|
|
94
|
+
alertBottomViewRef.current?.show(props);
|
|
88
95
|
};
|
|
96
|
+
// const sleep = (msec?: number) => {
|
|
97
|
+
// return new Promise(resolve => {
|
|
98
|
+
// setTimeout(resolve, msec || 350);
|
|
99
|
+
// });
|
|
100
|
+
// }
|
|
89
101
|
const styles = StyleSheet.create({
|
|
90
102
|
container: {
|
|
91
103
|
display: "flex",
|
|
@@ -108,6 +120,7 @@ const styles = StyleSheet.create({
|
|
|
108
120
|
maxWidth: deviceWidth - px2dp(30),
|
|
109
121
|
fontSize: px2sp(18),
|
|
110
122
|
marginBottom: px2dp(20),
|
|
123
|
+
// backgroundColor: 'red',
|
|
111
124
|
textAlign: "center",
|
|
112
125
|
fontWeight: "bold",
|
|
113
126
|
color: "#1A1A1A",
|
|
@@ -120,6 +133,7 @@ const styles = StyleSheet.create({
|
|
|
120
133
|
flexShrink: 1,
|
|
121
134
|
width: undefined,
|
|
122
135
|
fontSize: px2sp(15),
|
|
136
|
+
// backgroundColor: 'red',
|
|
123
137
|
color: "#1A1A1A",
|
|
124
138
|
textAlign: "center",
|
|
125
139
|
},
|
|
@@ -128,6 +142,7 @@ const styles = StyleSheet.create({
|
|
|
128
142
|
flexDirection: "row",
|
|
129
143
|
justifyContent: "space-between",
|
|
130
144
|
alignItems: "center",
|
|
145
|
+
// backgroundColor:"red"
|
|
131
146
|
},
|
|
132
147
|
cancel: {
|
|
133
148
|
width: "40%",
|