@aks-dev/easyui 1.0.182 → 1.0.183
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @aks-dev/easyui might be problematic. Click here for more details.
- package/dist/components/AnimationModal/AnimationModal.js +15 -19
- package/dist/components/Badge/Badge.js +13 -18
- package/dist/components/DottedLine/DottedLine.js +7 -10
- package/dist/components/Echarts/EchartsView.js +14 -18
- package/dist/components/Echarts/helper.js +2 -7
- package/dist/components/Hud/AlertBottomView/AlertBottomView.js +56 -61
- package/dist/components/Hud/AlertSheetView/AlertSheetView.js +42 -47
- package/dist/components/Hud/AlertView/AlertView.js +55 -60
- package/dist/components/Hud/Hud.js +17 -31
- package/dist/components/Hud/Loading/Loading.js +21 -27
- package/dist/components/Hud/PopoverView/PopoverView.js +16 -22
- package/dist/components/Hud/Scanner/Scanner.js +108 -114
- package/dist/components/Hud/Toast/Toast.js +22 -27
- package/dist/components/MenuView/MenuView.js +31 -34
- package/dist/components/Modal/Modal.js +1 -6
- package/dist/components/MutiPictureView/MutiPictureView.js +35 -38
- package/dist/components/PictureViewer/PictureViewer.js +12 -17
- package/dist/components/RefreshList/RefreshList.js +47 -51
- package/dist/components/RichText/RichText.js +17 -20
- package/dist/components/StickHeaderView/StickHeaderView.js +7 -10
- package/dist/components/TableCell/TableCell.js +29 -32
- package/dist/components/TextInputArea/TextInputArea.js +25 -28
- package/dist/components/WithLoadingContainer/WithLoadingContainer.js +20 -24
- package/dist/index.js +19 -51
- package/dist/jsbridge/RNEasyui.js +11 -18
- package/dist/jsbridge/UpgradeModule.js +8 -14
- package/dist/jsbridge/index.js +2 -5
- package/dist/screen/index.js +2 -5
- package/dist/screen/px2dp.js +14 -18
- package/dist/screen/px2sp.js +5 -9
- package/dist/screen/text-fit.js +7 -10
- package/dist/utils/index.js +2 -5
- package/dist/utils/lazy.js +25 -50
- package/dist/utils/mode.js +8 -13
- package/package.json +2 -2
- package/readme.md +1 -1
|
@@ -1,69 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const px2dp_1 = require("../../screen/px2dp");
|
|
7
|
-
const px2sp_1 = require("../../screen/px2sp");
|
|
8
|
-
exports.default = (props) => {
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { View, Text, StyleSheet, TouchableOpacity, Image, } from "react-native";
|
|
3
|
+
import { px2dp } from "../../screen/px2dp";
|
|
4
|
+
import { px2sp } from "../../screen/px2sp";
|
|
5
|
+
export default (props) => {
|
|
9
6
|
const { showNav = false, activeOpacity = 0.8 } = props;
|
|
10
|
-
return (<
|
|
11
|
-
<
|
|
7
|
+
return (<TouchableOpacity activeOpacity={props.onPress == undefined ? activeOpacity : 1} style={[styles.container, props.style]} disabled={props.onPress == undefined} onPress={() => props.onPress && props.onPress()}>
|
|
8
|
+
<View style={[
|
|
12
9
|
styles.warpper,
|
|
13
10
|
props.showUnderline
|
|
14
11
|
? {
|
|
15
12
|
borderBottomColor: "#f2f2f2",
|
|
16
13
|
// borderBottomWidth: StyleSheet.hairlineWidth,
|
|
17
|
-
borderBottomWidth:
|
|
14
|
+
borderBottomWidth: px2dp(1),
|
|
18
15
|
...props.underlineStyle,
|
|
19
16
|
}
|
|
20
17
|
: {},
|
|
21
18
|
]}>
|
|
22
|
-
{props.icon && (<
|
|
23
|
-
{ width:
|
|
19
|
+
{props.icon && (<Image style={[
|
|
20
|
+
{ width: px2dp(20), height: px2dp(20), marginRight: px2dp(8) },
|
|
24
21
|
props.iconStyle,
|
|
25
22
|
]} resizeMode="contain" source={props.icon}/>)}
|
|
26
|
-
<
|
|
23
|
+
<View style={[styles.middle, props.middleContaierStyle]}>
|
|
27
24
|
{/* 标题 */}
|
|
28
25
|
{(() => {
|
|
29
26
|
if (typeof props.title === "string" ||
|
|
30
27
|
typeof props.title === "number") {
|
|
31
|
-
return (<
|
|
28
|
+
return (<Text numberOfLines={1} {...props.titleOptions} style={[styles.title, props.titleOptions?.style]}>
|
|
32
29
|
{props.title}
|
|
33
|
-
</
|
|
30
|
+
</Text>);
|
|
34
31
|
}
|
|
35
32
|
if (React.isValidElement(props.title))
|
|
36
33
|
return props.title;
|
|
37
|
-
return <
|
|
34
|
+
return <View style={styles.title}/>;
|
|
38
35
|
})()}
|
|
39
36
|
|
|
40
37
|
{(() => {
|
|
41
38
|
if (typeof props.content === "string" ||
|
|
42
39
|
typeof props.content === "number") {
|
|
43
|
-
return (<
|
|
40
|
+
return (<Text numberOfLines={1} {...props.contentOptions} style={[styles.content, props.contentOptions?.style]}>
|
|
44
41
|
{props.content}
|
|
45
|
-
</
|
|
42
|
+
</Text>);
|
|
46
43
|
}
|
|
47
44
|
if (React.isValidElement(props.content))
|
|
48
45
|
return props.content;
|
|
49
46
|
return undefined;
|
|
50
47
|
})()}
|
|
51
|
-
</
|
|
48
|
+
</View>
|
|
52
49
|
{showNav &&
|
|
53
|
-
(props.nav || (<
|
|
54
|
-
width:
|
|
55
|
-
height:
|
|
56
|
-
marginLeft:
|
|
50
|
+
(props.nav || (<Image style={{
|
|
51
|
+
width: px2dp(9),
|
|
52
|
+
height: px2dp(16),
|
|
53
|
+
marginLeft: px2dp(8),
|
|
57
54
|
}} source={require("./assets/back.png")}/>))}
|
|
58
|
-
</
|
|
59
|
-
</
|
|
55
|
+
</View>
|
|
56
|
+
</TouchableOpacity>);
|
|
60
57
|
};
|
|
61
|
-
const styles =
|
|
58
|
+
const styles = StyleSheet.create({
|
|
62
59
|
container: {
|
|
63
60
|
display: "flex",
|
|
64
|
-
minHeight:
|
|
65
|
-
paddingLeft:
|
|
66
|
-
paddingRight:
|
|
61
|
+
minHeight: px2dp(44),
|
|
62
|
+
paddingLeft: px2dp(15),
|
|
63
|
+
paddingRight: px2dp(10),
|
|
67
64
|
backgroundColor: "white",
|
|
68
65
|
},
|
|
69
66
|
warpper: {
|
|
@@ -86,14 +83,14 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
86
83
|
// backgroundColor: 'red',
|
|
87
84
|
flexGrow: 0,
|
|
88
85
|
flexShrink: 0,
|
|
89
|
-
fontSize:
|
|
86
|
+
fontSize: px2sp(14),
|
|
90
87
|
color: "#333333",
|
|
91
88
|
},
|
|
92
89
|
content: {
|
|
93
90
|
// backgroundColor: 'yellow',
|
|
94
91
|
flexGrow: 1,
|
|
95
92
|
flexShrink: 1,
|
|
96
|
-
fontSize:
|
|
93
|
+
fontSize: px2sp(14),
|
|
97
94
|
color: "#666666",
|
|
98
95
|
textAlign: "right",
|
|
99
96
|
},
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
1
|
/*
|
|
5
2
|
* @Author: shiguo
|
|
6
3
|
* @Date: 2022-04-24 13:56:47
|
|
@@ -8,61 +5,61 @@ const tslib_1 = require("tslib");
|
|
|
8
5
|
* @LastEditTime: 2022-09-09 10:59:38
|
|
9
6
|
* @FilePath: /@aks-dev/easyui/lib/TextInputArea/TextInputArea.tsx
|
|
10
7
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
import React from "react";
|
|
9
|
+
import { View, Text, TextInput, StyleSheet, } from "react-native";
|
|
10
|
+
import { px2dp } from "../../screen/px2dp";
|
|
11
|
+
import { px2sp } from "../../screen/px2sp";
|
|
12
|
+
export default React.forwardRef((props, ref) => {
|
|
16
13
|
const { defaultValue, placeholder, maxLength = 200, on, ...rest } = props;
|
|
17
|
-
const [value, setValue] =
|
|
18
|
-
|
|
14
|
+
const [value, setValue] = React.useState(defaultValue);
|
|
15
|
+
React.useLayoutEffect(() => {
|
|
19
16
|
setValue(defaultValue);
|
|
20
17
|
}, [defaultValue]);
|
|
21
|
-
|
|
18
|
+
React.useImperativeHandle(ref, () => ({
|
|
22
19
|
value: value,
|
|
23
20
|
}), [value]);
|
|
24
|
-
return (<
|
|
25
|
-
<
|
|
21
|
+
return (<View style={[styles.container, rest.style]}>
|
|
22
|
+
<TextInput {...rest} style={[styles.textInput, rest.textInputStyle]} value={value} onChangeText={(txt) => {
|
|
26
23
|
setValue(txt);
|
|
27
24
|
on && on(txt);
|
|
28
25
|
}} multiline={true} textAlignVertical={"top"} maxLength={maxLength} placeholder={placeholder}/>
|
|
29
26
|
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
<
|
|
27
|
+
<View style={styles.corner}>
|
|
28
|
+
<Text style={styles.limit}>
|
|
29
|
+
<Text style={{
|
|
33
30
|
...styles.limit,
|
|
34
31
|
color: value && value?.length > maxLength - 5 ? "red" : "#AFAFAF",
|
|
35
32
|
}}>
|
|
36
33
|
{value?.length || 0}
|
|
37
|
-
</
|
|
34
|
+
</Text>
|
|
38
35
|
/{maxLength}
|
|
39
|
-
</
|
|
40
|
-
</
|
|
41
|
-
</
|
|
36
|
+
</Text>
|
|
37
|
+
</View>
|
|
38
|
+
</View>);
|
|
42
39
|
});
|
|
43
|
-
const styles =
|
|
40
|
+
const styles = StyleSheet.create({
|
|
44
41
|
container: {
|
|
45
42
|
// backgroundColor: '#F5F5F5',
|
|
46
|
-
minHeight:
|
|
43
|
+
minHeight: px2dp(200),
|
|
47
44
|
// borderRadius: px2dp(10),
|
|
48
45
|
backgroundColor: "white",
|
|
49
46
|
},
|
|
50
47
|
textInput: {
|
|
51
48
|
flex: 1,
|
|
52
|
-
margin:
|
|
53
|
-
marginBottom:
|
|
54
|
-
fontSize:
|
|
49
|
+
margin: px2dp(15),
|
|
50
|
+
marginBottom: px2dp(8),
|
|
51
|
+
fontSize: px2sp(14),
|
|
55
52
|
// backgroundColor: 'red'
|
|
56
53
|
},
|
|
57
54
|
corner: {
|
|
58
55
|
// position: 'absolute',
|
|
59
56
|
// backgroundColor:'cyan',
|
|
60
|
-
marginHorizontal:
|
|
61
|
-
marginBottom:
|
|
57
|
+
marginHorizontal: px2dp(15),
|
|
58
|
+
marginBottom: px2dp(8),
|
|
62
59
|
},
|
|
63
60
|
limit: {
|
|
64
61
|
textAlign: "right",
|
|
65
|
-
fontSize:
|
|
62
|
+
fontSize: px2sp(10),
|
|
66
63
|
color: "#AFAFAF",
|
|
67
64
|
},
|
|
68
65
|
});
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Status = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
1
|
/*
|
|
6
2
|
* @Author: shiguo
|
|
7
3
|
* @Date: 2022-04-20 14:56:47
|
|
@@ -9,11 +5,11 @@ const tslib_1 = require("tslib");
|
|
|
9
5
|
* @LastEditTime: 2022-05-09 14:35:04
|
|
10
6
|
* @FilePath: /@aks/easyui/lib/WithLoadingContainer/WithLoadingContainer.tsx
|
|
11
7
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
import React from "react";
|
|
9
|
+
import { View, Image, Text, StyleSheet, TouchableOpacity, } from "react-native";
|
|
14
10
|
const loading = require("./assets/loading.gif");
|
|
15
11
|
const loading3 = require("./assets/loading3.gif");
|
|
16
|
-
var Status;
|
|
12
|
+
export var Status;
|
|
17
13
|
(function (Status) {
|
|
18
14
|
Status["NONE"] = "NONE";
|
|
19
15
|
Status["LOADING"] = "LOADING";
|
|
@@ -21,10 +17,10 @@ var Status;
|
|
|
21
17
|
Status["SUCCESS"] = "SUCCESS";
|
|
22
18
|
Status["EMPTY"] = "EMPTY";
|
|
23
19
|
Status["NOMORE"] = "NOMORE";
|
|
24
|
-
})(Status || (
|
|
25
|
-
|
|
20
|
+
})(Status || (Status = {}));
|
|
21
|
+
export default (props) => {
|
|
26
22
|
const { status = Status.NONE, renderFailComponent, renderEmptyComponent, renderNomoreComponent, reload, failText = "网络请求失败,点击重新加载~", emptyText = "暂无数据", nomoreText = "没有更多数据了~", } = props;
|
|
27
|
-
return (<
|
|
23
|
+
return (<View style={props.style}>
|
|
28
24
|
<>
|
|
29
25
|
{(() => {
|
|
30
26
|
switch (status) {
|
|
@@ -37,35 +33,35 @@ exports.default = (props) => {
|
|
|
37
33
|
case Status.FAIL:
|
|
38
34
|
if (renderFailComponent)
|
|
39
35
|
return renderFailComponent();
|
|
40
|
-
return (<
|
|
41
|
-
<
|
|
42
|
-
</
|
|
36
|
+
return (<TouchableOpacity disabled={!reload} onPress={reload} style={styles.container}>
|
|
37
|
+
<Text style={styles.text}>{failText}</Text>
|
|
38
|
+
</TouchableOpacity>);
|
|
43
39
|
case Status.EMPTY:
|
|
44
40
|
if (renderEmptyComponent)
|
|
45
41
|
return renderEmptyComponent();
|
|
46
|
-
return (<
|
|
47
|
-
<
|
|
48
|
-
</
|
|
42
|
+
return (<TouchableOpacity disabled={!reload} onPress={reload} style={styles.container}>
|
|
43
|
+
<Text style={styles.text}>{emptyText}</Text>
|
|
44
|
+
</TouchableOpacity>);
|
|
49
45
|
case Status.NOMORE:
|
|
50
46
|
return (<>
|
|
51
47
|
{props.children}
|
|
52
|
-
{renderNomoreComponent ? (renderNomoreComponent()) : (<
|
|
48
|
+
{renderNomoreComponent ? (renderNomoreComponent()) : (<Text style={styles.text}>{nomoreText}</Text>)}
|
|
53
49
|
</>);
|
|
54
50
|
default:
|
|
55
|
-
return (<
|
|
51
|
+
return (<Text style={[styles.text, { lineHeight: 44 }]}>
|
|
56
52
|
(^_^)∠※ 送你一束小花
|
|
57
|
-
</
|
|
53
|
+
</Text>);
|
|
58
54
|
}
|
|
59
55
|
})()}
|
|
60
56
|
</>
|
|
61
|
-
</
|
|
57
|
+
</View>);
|
|
62
58
|
};
|
|
63
59
|
const Loading = () => {
|
|
64
|
-
return (<
|
|
65
|
-
<
|
|
66
|
-
</
|
|
60
|
+
return (<View style={styles.container}>
|
|
61
|
+
<Image source={loading3} style={{ width: 20, height: 20 }} resizeMode="contain"/>
|
|
62
|
+
</View>);
|
|
67
63
|
};
|
|
68
|
-
const styles =
|
|
64
|
+
const styles = StyleSheet.create({
|
|
69
65
|
text: {
|
|
70
66
|
color: "#999999",
|
|
71
67
|
fontSize: 14,
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* @Author: shiguo
|
|
4
3
|
* @Date: 2022-04-13 12:47:34
|
|
@@ -6,57 +5,26 @@
|
|
|
6
5
|
* @LastEditTime: 2023-03-23 15:26:14
|
|
7
6
|
* @FilePath: /@aks-dev/easyui/src/index.ts
|
|
8
7
|
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.jsbridge = exports.utils = exports.AnimationModal = exports.MenuView = exports.DottedLine = exports.RichText = exports.echarts = exports.EchartsView = exports.StickHeaderView = exports.Status = exports.WithLoadingContainer = exports.TextInputArea = exports.TableCell = exports.RefreshText = exports.RefreshState = exports.RefreshList = exports.PictureViewer = exports.MutiPictureView = exports.hideScanner = exports.showScanner = exports.hidePopoverView = exports.showPopoverView = exports.showAlertSheetModal = exports.showAlertBottomModal = exports.showAlertModal = exports.showToast = exports.hideLoading = exports.showLoading = exports.Hud = void 0;
|
|
11
|
-
const tslib_1 = require("tslib");
|
|
12
8
|
/// 组件
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Object.defineProperty(exports, "MutiPictureView", { enumerable: true, get: function () { return tslib_1.__importDefault(MutiPictureView_1).default; } });
|
|
29
|
-
var PictureViewer_1 = require("./components/PictureViewer/PictureViewer");
|
|
30
|
-
Object.defineProperty(exports, "PictureViewer", { enumerable: true, get: function () { return PictureViewer_1.PictureViewer; } });
|
|
31
|
-
var RefreshList_1 = require("./components/RefreshList/RefreshList");
|
|
32
|
-
Object.defineProperty(exports, "RefreshList", { enumerable: true, get: function () { return tslib_1.__importDefault(RefreshList_1).default; } });
|
|
33
|
-
Object.defineProperty(exports, "RefreshState", { enumerable: true, get: function () { return RefreshList_1.RefreshState; } });
|
|
34
|
-
Object.defineProperty(exports, "RefreshText", { enumerable: true, get: function () { return RefreshList_1.RefreshText; } });
|
|
35
|
-
var TableCell_1 = require("./components/TableCell/TableCell");
|
|
36
|
-
Object.defineProperty(exports, "TableCell", { enumerable: true, get: function () { return tslib_1.__importDefault(TableCell_1).default; } });
|
|
37
|
-
var TextInputArea_1 = require("./components/TextInputArea/TextInputArea");
|
|
38
|
-
Object.defineProperty(exports, "TextInputArea", { enumerable: true, get: function () { return tslib_1.__importDefault(TextInputArea_1).default; } });
|
|
39
|
-
var WithLoadingContainer_1 = require("./components/WithLoadingContainer/WithLoadingContainer");
|
|
40
|
-
Object.defineProperty(exports, "WithLoadingContainer", { enumerable: true, get: function () { return tslib_1.__importDefault(WithLoadingContainer_1).default; } });
|
|
41
|
-
Object.defineProperty(exports, "Status", { enumerable: true, get: function () { return WithLoadingContainer_1.Status; } });
|
|
42
|
-
var StickHeaderView_1 = require("./components/StickHeaderView/StickHeaderView");
|
|
43
|
-
Object.defineProperty(exports, "StickHeaderView", { enumerable: true, get: function () { return tslib_1.__importDefault(StickHeaderView_1).default; } });
|
|
44
|
-
var EchartsView_1 = require("./components/Echarts/EchartsView");
|
|
45
|
-
Object.defineProperty(exports, "EchartsView", { enumerable: true, get: function () { return tslib_1.__importDefault(EchartsView_1).default; } });
|
|
46
|
-
Object.defineProperty(exports, "echarts", { enumerable: true, get: function () { return EchartsView_1.echarts; } });
|
|
47
|
-
var RichText_1 = require("./components/RichText/RichText");
|
|
48
|
-
Object.defineProperty(exports, "RichText", { enumerable: true, get: function () { return tslib_1.__importDefault(RichText_1).default; } });
|
|
49
|
-
var DottedLine_1 = require("./components/DottedLine/DottedLine");
|
|
50
|
-
Object.defineProperty(exports, "DottedLine", { enumerable: true, get: function () { return tslib_1.__importDefault(DottedLine_1).default; } });
|
|
51
|
-
var MenuView_1 = require("./components/MenuView/MenuView");
|
|
52
|
-
Object.defineProperty(exports, "MenuView", { enumerable: true, get: function () { return tslib_1.__importDefault(MenuView_1).default; } });
|
|
53
|
-
var AnimationModal_1 = require("./components/AnimationModal/AnimationModal");
|
|
54
|
-
Object.defineProperty(exports, "AnimationModal", { enumerable: true, get: function () { return AnimationModal_1.AnimationModal; } });
|
|
9
|
+
export * from "./components/Badge/Badge";
|
|
10
|
+
export { Hud, showLoading, hideLoading, showToast, showAlertModal, showAlertBottomModal, showAlertSheetModal, showPopoverView, hidePopoverView, showScanner, hideScanner, } from "./components/Hud/Hud";
|
|
11
|
+
export * from "./components/Modal/Modal";
|
|
12
|
+
export { default as MutiPictureView } from "./components/MutiPictureView/MutiPictureView";
|
|
13
|
+
export { PictureViewer } from "./components/PictureViewer/PictureViewer";
|
|
14
|
+
export { default as RefreshList, RefreshState, RefreshText, } from "./components/RefreshList/RefreshList";
|
|
15
|
+
export { default as TableCell } from "./components/TableCell/TableCell";
|
|
16
|
+
export { default as TextInputArea } from "./components/TextInputArea/TextInputArea";
|
|
17
|
+
export { default as WithLoadingContainer, Status, } from "./components/WithLoadingContainer/WithLoadingContainer";
|
|
18
|
+
export { default as StickHeaderView } from "./components/StickHeaderView/StickHeaderView";
|
|
19
|
+
export { default as EchartsView, echarts, } from "./components/Echarts/EchartsView";
|
|
20
|
+
export { default as RichText } from "./components/RichText/RichText";
|
|
21
|
+
export { default as DottedLine } from "./components/DottedLine/DottedLine";
|
|
22
|
+
export { default as MenuView } from "./components/MenuView/MenuView";
|
|
23
|
+
export { AnimationModal } from "./components/AnimationModal/AnimationModal";
|
|
55
24
|
/// 全局适配
|
|
56
|
-
|
|
25
|
+
export * from "./screen";
|
|
57
26
|
/// 工具
|
|
58
|
-
|
|
59
|
-
exports.utils = utils;
|
|
27
|
+
import * as utils from "./utils";
|
|
60
28
|
/// 桥接
|
|
61
|
-
|
|
62
|
-
|
|
29
|
+
import * as jsbridge from "./jsbridge";
|
|
30
|
+
export { utils, jsbridge };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* @Author: shiguo
|
|
4
3
|
* @Date: 2022-04-19 10:23:01
|
|
@@ -6,48 +5,42 @@
|
|
|
6
5
|
* @LastEditTime: 2023-03-10 14:05:17
|
|
7
6
|
* @FilePath: /@aks-dev/easyui/jsbridge/RNEasyui.ts
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const react_native_1 = require("react-native");
|
|
12
|
-
const { RNEasyui } = react_native_1.NativeModules;
|
|
8
|
+
import { Dimensions, NativeModules, Platform } from "react-native";
|
|
9
|
+
const { RNEasyui } = NativeModules;
|
|
13
10
|
/**
|
|
14
11
|
* @description: 获取设备品牌
|
|
15
12
|
* @return {*}
|
|
16
13
|
*/
|
|
17
|
-
const getDeviceBrand = () => RNEasyui.getDeviceBrand();
|
|
18
|
-
exports.getDeviceBrand = getDeviceBrand;
|
|
14
|
+
export const getDeviceBrand = () => RNEasyui.getDeviceBrand();
|
|
19
15
|
/**
|
|
20
16
|
* @deprecated 测量不准确,已放弃
|
|
21
17
|
* @description: 获取status_bar_height
|
|
22
18
|
* @return {*}
|
|
23
19
|
*/
|
|
24
|
-
const getStatusBarHeight = () => {
|
|
25
|
-
if (
|
|
20
|
+
export const getStatusBarHeight = () => {
|
|
21
|
+
if (Platform.OS == "android")
|
|
26
22
|
return RNEasyui.getStatusBarHeight();
|
|
27
|
-
const deviceHeight =
|
|
28
|
-
const isiPhoneX =
|
|
23
|
+
const deviceHeight = Dimensions.get("window").height;
|
|
24
|
+
const isiPhoneX = Platform.OS == "ios" && deviceHeight > 736;
|
|
29
25
|
if (isiPhoneX)
|
|
30
26
|
return Promise.resolve(44);
|
|
31
27
|
return Promise.resolve(20);
|
|
32
28
|
};
|
|
33
|
-
exports.getStatusBarHeight = getStatusBarHeight;
|
|
34
29
|
/**
|
|
35
30
|
* @deprecated 测量不准确,已放弃
|
|
36
31
|
* @description: 获取navigation_bar_height
|
|
37
32
|
* @return {*}
|
|
38
33
|
*/
|
|
39
|
-
const getNavigationBarHeight = () => {
|
|
40
|
-
if (
|
|
34
|
+
export const getNavigationBarHeight = () => {
|
|
35
|
+
if (Platform.OS == "android")
|
|
41
36
|
return RNEasyui.getNavigationBarHeight();
|
|
42
37
|
return Promise.resolve(44);
|
|
43
38
|
};
|
|
44
|
-
exports.getNavigationBarHeight = getNavigationBarHeight;
|
|
45
39
|
/**
|
|
46
40
|
* only android
|
|
47
41
|
* 返回桌面
|
|
48
42
|
*/
|
|
49
|
-
const gotoDesktop = () => {
|
|
50
|
-
if (
|
|
43
|
+
export const gotoDesktop = () => {
|
|
44
|
+
if (Platform.OS == "android")
|
|
51
45
|
RNEasyui?.gotoDesktop();
|
|
52
46
|
};
|
|
53
|
-
exports.gotoDesktop = gotoDesktop;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.upgrade = exports.getOSVersion = exports.getAppVersion = void 0;
|
|
4
1
|
/*
|
|
5
2
|
* @Author: shiguo
|
|
6
3
|
* @Date: 2022-05-05 14:19:39
|
|
@@ -8,35 +5,33 @@ exports.upgrade = exports.getOSVersion = exports.getAppVersion = void 0;
|
|
|
8
5
|
* @LastEditTime: 2023-03-23 15:15:06
|
|
9
6
|
* @FilePath: /@aks-dev/easyui/jsbridge/UpgradeModule.ts
|
|
10
7
|
*/
|
|
11
|
-
|
|
12
|
-
const { UpgradeModule } =
|
|
8
|
+
import { NativeModules, PermissionsAndroid, Platform } from "react-native";
|
|
9
|
+
const { UpgradeModule } = NativeModules;
|
|
13
10
|
/**
|
|
14
11
|
* @description: 获取App版本号
|
|
15
12
|
* @param {*}
|
|
16
13
|
* @return {*}
|
|
17
14
|
*/
|
|
18
|
-
const getAppVersion = () => UpgradeModule.getAppVersion();
|
|
19
|
-
exports.getAppVersion = getAppVersion;
|
|
15
|
+
export const getAppVersion = () => UpgradeModule.getAppVersion();
|
|
20
16
|
/**
|
|
21
17
|
* @description: 获取操作系统版本
|
|
22
18
|
*
|
|
23
19
|
react-native-device-info
|
|
24
20
|
* @return {*}
|
|
25
21
|
*/
|
|
26
|
-
const getOSVersion = () => UpgradeModule.getOSVersion();
|
|
27
|
-
|
|
28
|
-
const upgrade = async (options) => {
|
|
22
|
+
export const getOSVersion = () => UpgradeModule.getOSVersion();
|
|
23
|
+
export const upgrade = async (options) => {
|
|
29
24
|
const { title = "提示" } = options;
|
|
30
|
-
if (
|
|
25
|
+
if (Platform.OS == "android") {
|
|
31
26
|
try {
|
|
32
|
-
const granted = await
|
|
27
|
+
const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE, {
|
|
33
28
|
title: "提示",
|
|
34
29
|
message: "应用升级需要获取APP的写入权限",
|
|
35
30
|
buttonNeutral: "稍后再询问",
|
|
36
31
|
buttonNegative: "取消",
|
|
37
32
|
buttonPositive: "确定",
|
|
38
33
|
});
|
|
39
|
-
if (granted ===
|
|
34
|
+
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
|
40
35
|
return UpgradeModule.upgrade(options);
|
|
41
36
|
}
|
|
42
37
|
return Promise.reject("没有应用升级权限!");
|
|
@@ -47,4 +42,3 @@ const upgrade = async (options) => {
|
|
|
47
42
|
}
|
|
48
43
|
return UpgradeModule.upgrade(options);
|
|
49
44
|
};
|
|
50
|
-
exports.upgrade = upgrade;
|
package/dist/jsbridge/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
1
|
/*
|
|
5
2
|
* @Author: shiguo
|
|
6
3
|
* @Date: 2022-04-19 10:23:01
|
|
@@ -8,5 +5,5 @@ const tslib_1 = require("tslib");
|
|
|
8
5
|
* @LastEditTime: 2023-03-23 15:14:55
|
|
9
6
|
* @FilePath: /@aks-dev/easyui/jsbridge/index.ts
|
|
10
7
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export * from './RNEasyui';
|
|
9
|
+
export * from './UpgradeModule';
|
package/dist/screen/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
1
|
/*
|
|
5
2
|
* @Author: shiguo
|
|
6
3
|
* @Date: 2022-04-19 10:25:14
|
|
@@ -9,5 +6,5 @@ const tslib_1 = require("tslib");
|
|
|
9
6
|
* @FilePath: /@aks-dev/easyui/screen/index.ts
|
|
10
7
|
*/
|
|
11
8
|
/// 全局适配
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
export * from '../screen/px2dp';
|
|
10
|
+
export * from '../screen/px2sp';
|
package/dist/screen/px2dp.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.navigationBarHeight = exports.statusBarHeight = exports.px2dp = exports.isiPhoneX = exports.isIos = exports.isAndroid = exports.deviceHeight = exports.deviceWidth = void 0;
|
|
4
1
|
/*
|
|
5
2
|
* @Author: shiguo
|
|
6
3
|
* @Date: 2022-04-18 14:32:25
|
|
@@ -8,32 +5,31 @@ exports.navigationBarHeight = exports.statusBarHeight = exports.px2dp = exports.
|
|
|
8
5
|
* @LastEditTime: 2022-09-09 10:35:02
|
|
9
6
|
* @FilePath: /@aks-dev/easyui/screen/px2dp.ts
|
|
10
7
|
*/
|
|
11
|
-
|
|
8
|
+
import { Dimensions, Platform, StatusBar } from "react-native";
|
|
12
9
|
/**设备宽度,单位 dp */
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
export const deviceWidth = Dimensions.get("screen").width; //设备的宽度
|
|
11
|
+
export const deviceHeight = Dimensions.get("screen").height; //设备的高度
|
|
12
|
+
export const isAndroid = Platform.OS === "android";
|
|
13
|
+
export const isIos = Platform.OS === "ios";
|
|
14
|
+
export const isiPhoneX = isIos && deviceHeight > 736;
|
|
18
15
|
/**
|
|
19
16
|
* 375px/667px
|
|
20
17
|
* */
|
|
21
18
|
const uiWidthPx = 375;
|
|
22
19
|
// const pixelRatio = PixelRatio.get()
|
|
23
20
|
// const deviceWidthPx = PixelRatio.getPixelSizeForLayoutSize(deviceWidth);
|
|
24
|
-
const px2dp = (uiElePx) => {
|
|
25
|
-
return Math.round((uiElePx *
|
|
21
|
+
export const px2dp = (uiElePx) => {
|
|
22
|
+
return Math.round((uiElePx * deviceWidth) / uiWidthPx);
|
|
26
23
|
};
|
|
27
|
-
exports.px2dp = px2dp;
|
|
28
24
|
/**
|
|
29
25
|
* @description: 状态栏的高度
|
|
30
26
|
* @param {*}
|
|
31
27
|
* @return {*}
|
|
32
28
|
*/
|
|
33
|
-
|
|
34
|
-
if (
|
|
35
|
-
return
|
|
36
|
-
if (
|
|
29
|
+
export const statusBarHeight = (() => {
|
|
30
|
+
if (isAndroid)
|
|
31
|
+
return StatusBar.currentHeight || 24;
|
|
32
|
+
if (isiPhoneX)
|
|
37
33
|
return 44;
|
|
38
34
|
return 20;
|
|
39
35
|
})();
|
|
@@ -42,8 +38,8 @@ exports.statusBarHeight = (() => {
|
|
|
42
38
|
* @param {*}
|
|
43
39
|
* @return {*}
|
|
44
40
|
*/
|
|
45
|
-
|
|
46
|
-
if (
|
|
41
|
+
export const navigationBarHeight = (() => {
|
|
42
|
+
if (isAndroid)
|
|
47
43
|
return 56;
|
|
48
44
|
return 44;
|
|
49
45
|
})();
|
package/dist/screen/px2sp.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.px2sp = void 0;
|
|
4
1
|
/*
|
|
5
2
|
* @Author: shiguo
|
|
6
3
|
* @Date: 2021-04-27 10:40:36
|
|
@@ -8,11 +5,11 @@ exports.px2sp = void 0;
|
|
|
8
5
|
* @LastEditTime: 2022-10-28 17:14:14
|
|
9
6
|
* @FilePath: /@aks-dev/easyui/screen/px2sp.ts
|
|
10
7
|
*/
|
|
11
|
-
|
|
12
|
-
const pixelRatio =
|
|
13
|
-
const width =
|
|
14
|
-
const height =
|
|
15
|
-
const px2sp = (size) => {
|
|
8
|
+
import { Dimensions, PixelRatio } from 'react-native';
|
|
9
|
+
const pixelRatio = PixelRatio.get();
|
|
10
|
+
const width = Dimensions.get('window').width; //设备的宽度
|
|
11
|
+
const height = Dimensions.get('window').height; //设备的高度
|
|
12
|
+
export const px2sp = (size) => {
|
|
16
13
|
// console.log({
|
|
17
14
|
// pixelRatio,
|
|
18
15
|
// width,
|
|
@@ -74,4 +71,3 @@ const px2sp = (size) => {
|
|
|
74
71
|
// if older device ie pixelRatio !== 2 || 3 || 3.5
|
|
75
72
|
return size;
|
|
76
73
|
};
|
|
77
|
-
exports.px2sp = px2sp;
|