@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.
- 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,16 +1,8 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: shiguo
|
|
3
|
-
* @Date: 2022-04-29 10:22:16
|
|
4
|
-
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-04-29 10:27:44
|
|
6
|
-
* @FilePath: /@aks/easyui/lib/StickHeaderView/StickHeaderView.tsx
|
|
7
|
-
*/
|
|
8
1
|
import * as React from "react";
|
|
9
2
|
import { StyleSheet, Animated, } from "react-native";
|
|
10
3
|
const App = (props) => {
|
|
11
4
|
const { style, children, stickyHeaderY = -1, stickyScrollY = new Animated.Value(0), } = props;
|
|
12
5
|
const [stickyLayoutY, setStickyLayoutY] = React.useState(0);
|
|
13
|
-
// 兼容代码,防止没有传头部高度
|
|
14
6
|
const _onLayout = (event) => {
|
|
15
7
|
setStickyLayoutY(event.nativeEvent.layout.y);
|
|
16
8
|
};
|
|
@@ -21,13 +13,11 @@ const App = (props) => {
|
|
|
21
13
|
outputRange: [0, 0, 0, 1],
|
|
22
14
|
});
|
|
23
15
|
};
|
|
24
|
-
return (
|
|
16
|
+
return (React.createElement(Animated.View, { onLayout: _onLayout, style: [
|
|
25
17
|
style,
|
|
26
18
|
styles.container,
|
|
27
19
|
{ transform: [{ translateY: translateY() }] },
|
|
28
|
-
]}
|
|
29
|
-
{children}
|
|
30
|
-
</Animated.View>);
|
|
20
|
+
] }, children));
|
|
31
21
|
};
|
|
32
22
|
const styles = StyleSheet.create({
|
|
33
23
|
container: {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleSheet, TouchableOpacity, Text, Animated, } from "react-native";
|
|
3
|
+
import { px2dp } from "../../screen/px2dp";
|
|
4
|
+
import { px2sp } from "../../screen/px2sp";
|
|
5
|
+
import StickHeaderView from "./StickHeaderView";
|
|
6
|
+
import WithLoadingContainer from "../WithLoadingContainer/WithLoadingContainer";
|
|
7
|
+
import { Status } from "../WithLoadingContainer/WithLoadingContainer";
|
|
8
|
+
export default ({}) => {
|
|
9
|
+
var _a;
|
|
10
|
+
const scrollY = React.useRef(new Animated.Value(0)).current;
|
|
11
|
+
const headHeight = React.useRef(-1);
|
|
12
|
+
return (React.createElement(View, { style: styles.container },
|
|
13
|
+
React.createElement(Animated.ScrollView, { style: { flex: 1 }, onScroll: Animated.event([
|
|
14
|
+
{
|
|
15
|
+
nativeEvent: { contentOffset: { y: scrollY } },
|
|
16
|
+
},
|
|
17
|
+
]), scrollEventThrottle: 1 },
|
|
18
|
+
React.createElement(View, { onLayout: (e) => {
|
|
19
|
+
let { height } = e.nativeEvent.layout;
|
|
20
|
+
headHeight.current = height;
|
|
21
|
+
} }),
|
|
22
|
+
React.createElement(StickHeaderView, { stickyHeaderY: headHeight.current, stickyScrollY: scrollY },
|
|
23
|
+
React.createElement(View, null,
|
|
24
|
+
React.createElement(Text, { style: {
|
|
25
|
+
fontSize: px2sp(16),
|
|
26
|
+
color: "#333",
|
|
27
|
+
marginLeft: px2dp(30),
|
|
28
|
+
} }, "\u5F53\u65E5\u8BA1\u5212"))),
|
|
29
|
+
React.createElement(WithLoadingContainer, { status: Status.SUCCESS, emptyText: "今日无需巡检" }, (_a = Array(30)
|
|
30
|
+
.fill("")) === null || _a === void 0 ? void 0 : _a.map((i, index) => (React.createElement(Item, { key: `sg-item-${index}`, item: i, index: index })))))));
|
|
31
|
+
};
|
|
32
|
+
const Item = (props) => {
|
|
33
|
+
return React.createElement(TouchableOpacity, null);
|
|
34
|
+
};
|
|
35
|
+
const styles = StyleSheet.create({
|
|
36
|
+
container: {},
|
|
37
|
+
});
|
|
@@ -4,56 +4,43 @@ import { px2dp } from "../../screen/px2dp";
|
|
|
4
4
|
import { px2sp } from "../../screen/px2sp";
|
|
5
5
|
export default (props) => {
|
|
6
6
|
const { showNav = false, activeOpacity = 0.8 } = props;
|
|
7
|
-
return (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (React.isValidElement(props.content))
|
|
45
|
-
return props.content;
|
|
46
|
-
return undefined;
|
|
47
|
-
})()}
|
|
48
|
-
</View>
|
|
49
|
-
{showNav &&
|
|
50
|
-
(props.nav || (<Image style={{
|
|
51
|
-
width: px2dp(9),
|
|
52
|
-
height: px2dp(16),
|
|
53
|
-
marginLeft: px2dp(8),
|
|
54
|
-
}} source={require("./assets/back.png")}/>))}
|
|
55
|
-
</View>
|
|
56
|
-
</TouchableOpacity>);
|
|
7
|
+
return (React.createElement(TouchableOpacity, { activeOpacity: props.onPress == undefined ? activeOpacity : 1, style: [styles.container, props.style], disabled: props.onPress == undefined, onPress: () => props.onPress && props.onPress() },
|
|
8
|
+
React.createElement(View, { style: [
|
|
9
|
+
styles.warpper,
|
|
10
|
+
props.showUnderline
|
|
11
|
+
? Object.assign({ borderBottomColor: "#f2f2f2", borderBottomWidth: px2dp(1) }, props.underlineStyle) : {},
|
|
12
|
+
] },
|
|
13
|
+
props.icon && (React.createElement(Image, { style: [
|
|
14
|
+
{ width: px2dp(20), height: px2dp(20), marginRight: px2dp(8) },
|
|
15
|
+
props.iconStyle,
|
|
16
|
+
], resizeMode: "contain", source: props.icon })),
|
|
17
|
+
React.createElement(View, { style: [styles.middle, props.middleContaierStyle] },
|
|
18
|
+
(() => {
|
|
19
|
+
var _a;
|
|
20
|
+
if (typeof props.title === "string" ||
|
|
21
|
+
typeof props.title === "number") {
|
|
22
|
+
return (React.createElement(Text, Object.assign({ numberOfLines: 1 }, props.titleOptions, { style: [styles.title, (_a = props.titleOptions) === null || _a === void 0 ? void 0 : _a.style] }), props.title));
|
|
23
|
+
}
|
|
24
|
+
if (React.isValidElement(props.title))
|
|
25
|
+
return props.title;
|
|
26
|
+
return React.createElement(View, { style: styles.title });
|
|
27
|
+
})(),
|
|
28
|
+
(() => {
|
|
29
|
+
var _a;
|
|
30
|
+
if (typeof props.content === "string" ||
|
|
31
|
+
typeof props.content === "number") {
|
|
32
|
+
return (React.createElement(Text, Object.assign({ numberOfLines: 1 }, props.contentOptions, { style: [styles.content, (_a = props.contentOptions) === null || _a === void 0 ? void 0 : _a.style] }), props.content));
|
|
33
|
+
}
|
|
34
|
+
if (React.isValidElement(props.content))
|
|
35
|
+
return props.content;
|
|
36
|
+
return undefined;
|
|
37
|
+
})()),
|
|
38
|
+
showNav &&
|
|
39
|
+
(props.nav || (React.createElement(Image, { style: {
|
|
40
|
+
width: px2dp(9),
|
|
41
|
+
height: px2dp(16),
|
|
42
|
+
marginLeft: px2dp(8),
|
|
43
|
+
}, source: require("./assets/back.png") }))))));
|
|
57
44
|
};
|
|
58
45
|
const styles = StyleSheet.create({
|
|
59
46
|
container: {
|
|
@@ -77,17 +64,14 @@ const styles = StyleSheet.create({
|
|
|
77
64
|
flexDirection: "row",
|
|
78
65
|
alignItems: "center",
|
|
79
66
|
justifyContent: "space-between",
|
|
80
|
-
// backgroundColor: 'cyan'
|
|
81
67
|
},
|
|
82
68
|
title: {
|
|
83
|
-
// backgroundColor: 'red',
|
|
84
69
|
flexGrow: 0,
|
|
85
70
|
flexShrink: 0,
|
|
86
71
|
fontSize: px2sp(14),
|
|
87
72
|
color: "#333333",
|
|
88
73
|
},
|
|
89
74
|
content: {
|
|
90
|
-
// backgroundColor: 'yellow',
|
|
91
75
|
flexGrow: 1,
|
|
92
76
|
flexShrink: 1,
|
|
93
77
|
fontSize: px2sp(14),
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
8
12
|
import React from "react";
|
|
9
13
|
import { View, Text, TextInput, StyleSheet, } from "react-native";
|
|
10
14
|
import { px2dp } from "../../screen/px2dp";
|
|
11
15
|
import { px2sp } from "../../screen/px2sp";
|
|
12
16
|
export default React.forwardRef((props, ref) => {
|
|
13
|
-
const { defaultValue, placeholder, maxLength = 200, on,
|
|
17
|
+
const { defaultValue, placeholder, maxLength = 200, on } = props, rest = __rest(props, ["defaultValue", "placeholder", "maxLength", "on"]);
|
|
14
18
|
const [value, setValue] = React.useState(defaultValue);
|
|
15
19
|
React.useLayoutEffect(() => {
|
|
16
20
|
setValue(defaultValue);
|
|
@@ -18,30 +22,20 @@ export default React.forwardRef((props, ref) => {
|
|
|
18
22
|
React.useImperativeHandle(ref, () => ({
|
|
19
23
|
value: value,
|
|
20
24
|
}), [value]);
|
|
21
|
-
return (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
color: value && value?.length > maxLength - 5 ? "red" : "#AFAFAF",
|
|
32
|
-
}}>
|
|
33
|
-
{value?.length || 0}
|
|
34
|
-
</Text>
|
|
35
|
-
/{maxLength}
|
|
36
|
-
</Text>
|
|
37
|
-
</View>
|
|
38
|
-
</View>);
|
|
25
|
+
return (React.createElement(View, { style: [styles.container, rest.style] },
|
|
26
|
+
React.createElement(TextInput, Object.assign({}, rest, { style: [styles.textInput, rest.textInputStyle], value: value, onChangeText: (txt) => {
|
|
27
|
+
setValue(txt);
|
|
28
|
+
on && on(txt);
|
|
29
|
+
}, multiline: true, textAlignVertical: "top", maxLength: maxLength, placeholder: placeholder })),
|
|
30
|
+
React.createElement(View, { style: styles.corner },
|
|
31
|
+
React.createElement(Text, { style: styles.limit },
|
|
32
|
+
React.createElement(Text, { style: Object.assign(Object.assign({}, styles.limit), { color: value && (value === null || value === void 0 ? void 0 : value.length) > maxLength - 5 ? "red" : "#AFAFAF" }) }, (value === null || value === void 0 ? void 0 : value.length) || 0),
|
|
33
|
+
"/",
|
|
34
|
+
maxLength))));
|
|
39
35
|
});
|
|
40
36
|
const styles = StyleSheet.create({
|
|
41
37
|
container: {
|
|
42
|
-
// backgroundColor: '#F5F5F5',
|
|
43
38
|
minHeight: px2dp(200),
|
|
44
|
-
// borderRadius: px2dp(10),
|
|
45
39
|
backgroundColor: "white",
|
|
46
40
|
},
|
|
47
41
|
textInput: {
|
|
@@ -49,11 +43,8 @@ const styles = StyleSheet.create({
|
|
|
49
43
|
margin: px2dp(15),
|
|
50
44
|
marginBottom: px2dp(8),
|
|
51
45
|
fontSize: px2sp(14),
|
|
52
|
-
// backgroundColor: 'red'
|
|
53
46
|
},
|
|
54
47
|
corner: {
|
|
55
|
-
// position: 'absolute',
|
|
56
|
-
// backgroundColor:'cyan',
|
|
57
48
|
marginHorizontal: px2dp(15),
|
|
58
49
|
marginBottom: px2dp(8),
|
|
59
50
|
},
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: shiguo
|
|
3
|
-
* @Date: 2022-04-20 14:56:47
|
|
4
|
-
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-05-09 14:35:04
|
|
6
|
-
* @FilePath: /@aks/easyui/lib/WithLoadingContainer/WithLoadingContainer.tsx
|
|
7
|
-
*/
|
|
8
1
|
import React from "react";
|
|
9
2
|
import { View, Image, Text, StyleSheet, TouchableOpacity, } from "react-native";
|
|
10
3
|
const loading = require("./assets/loading.gif");
|
|
@@ -20,52 +13,42 @@ export var Status;
|
|
|
20
13
|
})(Status || (Status = {}));
|
|
21
14
|
export default (props) => {
|
|
22
15
|
const { status = Status.NONE, renderFailComponent, renderEmptyComponent, renderNomoreComponent, reload, failText = "网络请求失败,点击重新加载~", emptyText = "暂无数据", nomoreText = "没有更多数据了~", } = props;
|
|
23
|
-
return (
|
|
24
|
-
|
|
25
|
-
{(() => {
|
|
16
|
+
return (React.createElement(View, { style: props.style },
|
|
17
|
+
React.createElement(React.Fragment, null, (() => {
|
|
26
18
|
switch (status) {
|
|
27
19
|
case Status.NONE:
|
|
28
20
|
return undefined;
|
|
29
21
|
case Status.SUCCESS:
|
|
30
22
|
return props.children;
|
|
31
23
|
case Status.LOADING:
|
|
32
|
-
return
|
|
24
|
+
return React.createElement(Loading, null);
|
|
33
25
|
case Status.FAIL:
|
|
34
26
|
if (renderFailComponent)
|
|
35
27
|
return renderFailComponent();
|
|
36
|
-
return (
|
|
37
|
-
|
|
38
|
-
</TouchableOpacity>);
|
|
28
|
+
return (React.createElement(TouchableOpacity, { disabled: !reload, onPress: reload, style: styles.container },
|
|
29
|
+
React.createElement(Text, { style: styles.text }, failText)));
|
|
39
30
|
case Status.EMPTY:
|
|
40
31
|
if (renderEmptyComponent)
|
|
41
32
|
return renderEmptyComponent();
|
|
42
|
-
return (
|
|
43
|
-
|
|
44
|
-
</TouchableOpacity>);
|
|
33
|
+
return (React.createElement(TouchableOpacity, { disabled: !reload, onPress: reload, style: styles.container },
|
|
34
|
+
React.createElement(Text, { style: styles.text }, emptyText)));
|
|
45
35
|
case Status.NOMORE:
|
|
46
|
-
return (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</>);
|
|
36
|
+
return (React.createElement(React.Fragment, null,
|
|
37
|
+
props.children,
|
|
38
|
+
renderNomoreComponent ? (renderNomoreComponent()) : (React.createElement(Text, { style: styles.text }, nomoreText))));
|
|
50
39
|
default:
|
|
51
|
-
return (
|
|
52
|
-
(^_^)∠※ 送你一束小花
|
|
53
|
-
</Text>);
|
|
40
|
+
return (React.createElement(Text, { style: [styles.text, { lineHeight: 44 }] }, "(^_^)\u2220\u203B \u9001\u4F60\u4E00\u675F\u5C0F\u82B1"));
|
|
54
41
|
}
|
|
55
|
-
})()
|
|
56
|
-
</>
|
|
57
|
-
</View>);
|
|
42
|
+
})())));
|
|
58
43
|
};
|
|
59
44
|
const Loading = () => {
|
|
60
|
-
return (
|
|
61
|
-
|
|
62
|
-
</View>);
|
|
45
|
+
return (React.createElement(View, { style: styles.container },
|
|
46
|
+
React.createElement(Image, { source: loading3, style: { width: 20, height: 20 }, resizeMode: "contain" })));
|
|
63
47
|
};
|
|
64
48
|
const styles = StyleSheet.create({
|
|
65
49
|
text: {
|
|
66
50
|
color: "#999999",
|
|
67
51
|
fontSize: 14,
|
|
68
|
-
// textAlign: 'center',
|
|
69
52
|
},
|
|
70
53
|
container: {
|
|
71
54
|
display: "flex",
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: shiguo
|
|
3
|
-
* @Date: 2022-04-13 12:47:34
|
|
4
|
-
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2023-03-23 15:26:14
|
|
6
|
-
* @FilePath: /@aks-dev/easyui/src/index.ts
|
|
7
|
-
*/
|
|
8
|
-
/// 组件
|
|
9
1
|
export * from "./components/Badge/Badge";
|
|
10
2
|
export { Hud, showLoading, hideLoading, showToast, showAlertModal, showAlertBottomModal, showAlertSheetModal, showPopoverView, hidePopoverView, showScanner, hideScanner, } from "./components/Hud/Hud";
|
|
11
3
|
export * from "./components/Modal/Modal";
|
|
@@ -21,10 +13,7 @@ export { default as RichText } from "./components/RichText/RichText";
|
|
|
21
13
|
export { default as DottedLine } from "./components/DottedLine/DottedLine";
|
|
22
14
|
export { default as MenuView } from "./components/MenuView/MenuView";
|
|
23
15
|
export { AnimationModal } from "./components/AnimationModal/AnimationModal";
|
|
24
|
-
/// 全局适配
|
|
25
16
|
export * from "./screen";
|
|
26
|
-
/// 工具
|
|
27
17
|
import * as utils from "./utils";
|
|
28
|
-
/// 桥接
|
|
29
18
|
import * as jsbridge from "./jsbridge";
|
|
30
19
|
export { utils, jsbridge };
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: shiguo
|
|
3
|
-
* @Date: 2022-04-19 10:23:01
|
|
4
|
-
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2023-03-10 14:05:17
|
|
6
|
-
* @FilePath: /@aks-dev/easyui/jsbridge/RNEasyui.ts
|
|
7
|
-
*/
|
|
8
1
|
import { Dimensions, NativeModules, Platform } from "react-native";
|
|
9
2
|
const { RNEasyui } = NativeModules;
|
|
10
|
-
/**
|
|
11
|
-
* @description: 获取设备品牌
|
|
12
|
-
* @return {*}
|
|
13
|
-
*/
|
|
14
3
|
export const getDeviceBrand = () => RNEasyui.getDeviceBrand();
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated 测量不准确,已放弃
|
|
17
|
-
* @description: 获取status_bar_height
|
|
18
|
-
* @return {*}
|
|
19
|
-
*/
|
|
20
4
|
export const getStatusBarHeight = () => {
|
|
21
5
|
if (Platform.OS == "android")
|
|
22
6
|
return RNEasyui.getStatusBarHeight();
|
|
@@ -26,21 +10,12 @@ export const getStatusBarHeight = () => {
|
|
|
26
10
|
return Promise.resolve(44);
|
|
27
11
|
return Promise.resolve(20);
|
|
28
12
|
};
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated 测量不准确,已放弃
|
|
31
|
-
* @description: 获取navigation_bar_height
|
|
32
|
-
* @return {*}
|
|
33
|
-
*/
|
|
34
13
|
export const getNavigationBarHeight = () => {
|
|
35
14
|
if (Platform.OS == "android")
|
|
36
15
|
return RNEasyui.getNavigationBarHeight();
|
|
37
16
|
return Promise.resolve(44);
|
|
38
17
|
};
|
|
39
|
-
/**
|
|
40
|
-
* only android
|
|
41
|
-
* 返回桌面
|
|
42
|
-
*/
|
|
43
18
|
export const gotoDesktop = () => {
|
|
44
19
|
if (Platform.OS == "android")
|
|
45
|
-
RNEasyui
|
|
20
|
+
RNEasyui === null || RNEasyui === void 0 ? void 0 : RNEasyui.gotoDesktop();
|
|
46
21
|
};
|
|
@@ -1,30 +1,21 @@
|
|
|
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 { NativeModules, PermissionsAndroid, Platform } from "react-native";
|
|
9
11
|
const { UpgradeModule } = NativeModules;
|
|
10
|
-
/**
|
|
11
|
-
* @description: 获取App版本号
|
|
12
|
-
* @param {*}
|
|
13
|
-
* @return {*}
|
|
14
|
-
*/
|
|
15
12
|
export const getAppVersion = () => UpgradeModule.getAppVersion();
|
|
16
|
-
/**
|
|
17
|
-
* @description: 获取操作系统版本
|
|
18
|
-
*
|
|
19
|
-
react-native-device-info
|
|
20
|
-
* @return {*}
|
|
21
|
-
*/
|
|
22
13
|
export const getOSVersion = () => UpgradeModule.getOSVersion();
|
|
23
|
-
export const upgrade =
|
|
14
|
+
export const upgrade = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
15
|
const { title = "提示" } = options;
|
|
25
16
|
if (Platform.OS == "android") {
|
|
26
17
|
try {
|
|
27
|
-
const granted =
|
|
18
|
+
const granted = yield PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE, {
|
|
28
19
|
title: "提示",
|
|
29
20
|
message: "应用升级需要获取APP的写入权限",
|
|
30
21
|
buttonNeutral: "稍后再询问",
|
|
@@ -41,4 +32,4 @@ export const upgrade = async (options) => {
|
|
|
41
32
|
}
|
|
42
33
|
}
|
|
43
34
|
return UpgradeModule.upgrade(options);
|
|
44
|
-
};
|
|
35
|
+
});
|
package/dist/jsbridge/index.js
CHANGED
package/dist/screen/index.js
CHANGED
package/dist/screen/px2dp.js
CHANGED
|
@@ -1,31 +1,13 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: shiguo
|
|
3
|
-
* @Date: 2022-04-18 14:32:25
|
|
4
|
-
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-09-09 10:35:02
|
|
6
|
-
* @FilePath: /@aks-dev/easyui/screen/px2dp.ts
|
|
7
|
-
*/
|
|
8
1
|
import { Dimensions, Platform, StatusBar } from "react-native";
|
|
9
|
-
|
|
10
|
-
export const
|
|
11
|
-
export const deviceHeight = Dimensions.get("screen").height; //设备的高度
|
|
2
|
+
export const deviceWidth = Dimensions.get("screen").width;
|
|
3
|
+
export const deviceHeight = Dimensions.get("screen").height;
|
|
12
4
|
export const isAndroid = Platform.OS === "android";
|
|
13
5
|
export const isIos = Platform.OS === "ios";
|
|
14
6
|
export const isiPhoneX = isIos && deviceHeight > 736;
|
|
15
|
-
/**
|
|
16
|
-
* 375px/667px
|
|
17
|
-
* */
|
|
18
7
|
const uiWidthPx = 375;
|
|
19
|
-
// const pixelRatio = PixelRatio.get()
|
|
20
|
-
// const deviceWidthPx = PixelRatio.getPixelSizeForLayoutSize(deviceWidth);
|
|
21
8
|
export const px2dp = (uiElePx) => {
|
|
22
9
|
return Math.round((uiElePx * deviceWidth) / uiWidthPx);
|
|
23
10
|
};
|
|
24
|
-
/**
|
|
25
|
-
* @description: 状态栏的高度
|
|
26
|
-
* @param {*}
|
|
27
|
-
* @return {*}
|
|
28
|
-
*/
|
|
29
11
|
export const statusBarHeight = (() => {
|
|
30
12
|
if (isAndroid)
|
|
31
13
|
return StatusBar.currentHeight || 24;
|
|
@@ -33,11 +15,6 @@ export const statusBarHeight = (() => {
|
|
|
33
15
|
return 44;
|
|
34
16
|
return 20;
|
|
35
17
|
})();
|
|
36
|
-
/**
|
|
37
|
-
* @description: 顶部导航条的高度,高度不包含statusBarHeight
|
|
38
|
-
* @param {*}
|
|
39
|
-
* @return {*}
|
|
40
|
-
*/
|
|
41
18
|
export const navigationBarHeight = (() => {
|
|
42
19
|
if (isAndroid)
|
|
43
20
|
return 56;
|
package/dist/screen/px2sp.js
CHANGED
|
@@ -1,73 +1,43 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: shiguo
|
|
3
|
-
* @Date: 2021-04-27 10:40:36
|
|
4
|
-
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-10-28 17:14:14
|
|
6
|
-
* @FilePath: /@aks-dev/easyui/screen/px2sp.ts
|
|
7
|
-
*/
|
|
8
1
|
import { Dimensions, PixelRatio } from 'react-native';
|
|
9
2
|
const pixelRatio = PixelRatio.get();
|
|
10
|
-
const width = Dimensions.get('window').width;
|
|
11
|
-
const height = Dimensions.get('window').height;
|
|
3
|
+
const width = Dimensions.get('window').width;
|
|
4
|
+
const height = Dimensions.get('window').height;
|
|
12
5
|
export const px2sp = (size) => {
|
|
13
|
-
// console.log({
|
|
14
|
-
// pixelRatio,
|
|
15
|
-
// width,
|
|
16
|
-
// height
|
|
17
|
-
// })
|
|
18
6
|
if (pixelRatio === 2) {
|
|
19
|
-
// iphone 5s and older Androids
|
|
20
7
|
if (width < 360) {
|
|
21
8
|
return size * 0.95;
|
|
22
9
|
}
|
|
23
|
-
// iphone 5
|
|
24
10
|
if (height < 667) {
|
|
25
11
|
return size;
|
|
26
|
-
// iphone 6-6s
|
|
27
12
|
}
|
|
28
13
|
else if (height >= 667 && height <= 735) {
|
|
29
14
|
return size * 1.15;
|
|
30
15
|
}
|
|
31
|
-
// older phablets
|
|
32
16
|
return size * 1.25;
|
|
33
17
|
}
|
|
34
18
|
if (pixelRatio === 3) {
|
|
35
|
-
// catch Android font scaling on small machines
|
|
36
|
-
// where pixel ratio / font scale ratio => 3:3
|
|
37
19
|
if (width <= 360) {
|
|
38
20
|
return size;
|
|
39
21
|
}
|
|
40
|
-
// Catch other weird android width sizings
|
|
41
22
|
if (height < 667) {
|
|
42
23
|
return size * 1.15;
|
|
43
|
-
// catch in-between size Androids and scale font up
|
|
44
|
-
// a tad but not too much
|
|
45
24
|
}
|
|
46
25
|
if (height >= 667 && height <= 735) {
|
|
47
26
|
return size * 1.2;
|
|
48
27
|
}
|
|
49
|
-
// catch larger devices
|
|
50
|
-
// ie iphone 6s plus / 7 plus / mi note 等等
|
|
51
28
|
return size * 1.27;
|
|
52
29
|
}
|
|
53
30
|
if (pixelRatio === 3.5) {
|
|
54
|
-
// catch Android font scaling on small machines
|
|
55
|
-
// where pixel ratio / font scale ratio => 3:3
|
|
56
31
|
if (width <= 360) {
|
|
57
32
|
return size;
|
|
58
|
-
// Catch other smaller android height sizings
|
|
59
33
|
}
|
|
60
34
|
if (height < 667) {
|
|
61
|
-
return size * 1.15;
|
|
62
|
-
// catch in-between size Androids and scale font up
|
|
63
|
-
// a tad but not too much
|
|
35
|
+
return size * 1.15;
|
|
64
36
|
}
|
|
65
37
|
if (height >= 667 && height <= 735) {
|
|
66
|
-
return size * 1.20;
|
|
38
|
+
return size * 1.20;
|
|
67
39
|
}
|
|
68
|
-
|
|
69
|
-
return size * 1.25; //older:1.30
|
|
40
|
+
return size * 1.25;
|
|
70
41
|
}
|
|
71
|
-
// if older device ie pixelRatio !== 2 || 3 || 3.5
|
|
72
42
|
return size;
|
|
73
43
|
};
|