@aks-dev/easyui 1.0.192 → 1.0.193
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 +36 -15
- package/dist/components/Badge/Badge.js +16 -7
- package/dist/components/DottedLine/DottedLine.js +13 -14
- package/dist/components/Echarts/EchartsView.js +73 -30
- package/dist/components/Echarts/helper.js +16 -1
- package/dist/components/Hud/AlertBottomView/AlertBottomView.js +60 -43
- package/dist/components/Hud/AlertSheetView/AlertSheetView.js +30 -23
- package/dist/components/Hud/AlertView/AlertView.js +62 -46
- package/dist/components/Hud/Hud.js +19 -8
- package/dist/components/Hud/Loading/Loading.js +16 -4
- package/dist/components/Hud/PopoverView/PopoverView.js +13 -2
- package/dist/components/Hud/Scanner/Scanner.js +86 -55
- package/dist/components/Hud/Toast/Toast.js +15 -5
- package/dist/components/MenuView/MenuView.js +61 -33
- package/dist/components/Modal/Modal.js +7 -0
- package/dist/components/MutiPictureView/MutiPictureView.js +47 -27
- package/dist/components/PictureViewer/PictureViewer.js +24 -8
- package/dist/components/RefreshList/RefreshList.js +52 -41
- package/dist/components/RichText/RichText.js +22 -21
- package/dist/components/StickHeaderView/StickHeaderView.js +12 -2
- package/dist/components/TableCell/TableCell.js +51 -37
- package/dist/components/TextInputArea/TextInputArea.js +28 -21
- package/dist/components/WithLoadingContainer/WithLoadingContainer.js +31 -14
- package/dist/index.js +11 -0
- package/dist/jsbridge/RNEasyui.js +25 -0
- package/dist/jsbridge/UpgradeModule.js +19 -9
- 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 +13 -2
- package/dist/utils/index.js +7 -0
- package/dist/utils/lazy.js +67 -12
- package/dist/utils/mode.js +21 -0
- package/package.json +10 -6
- 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/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 +33 -0
- 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/i.sh +0 -25
- 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,22 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
10
2
|
import React from "react";
|
|
11
3
|
import { Image, ScrollView, Text, TouchableOpacity, View, } from "react-native";
|
|
12
4
|
import { deviceHeight, deviceWidth } from "../../screen/px2dp";
|
|
5
|
+
// import * as utils from '../../utils/lazy';
|
|
13
6
|
import { hidePopoverView, showPopoverView } from "../Hud/Hud";
|
|
7
|
+
// type Reducer = (prevState: State, action: Partial<State>) => State
|
|
14
8
|
export default (props) => {
|
|
15
9
|
const { defaultAlignHorizontal = "left", defaultAlignVertical = "bottom" } = props;
|
|
16
10
|
const [state, dispatch] = React.useReducer((prevState, action) => Object.assign({}, prevState, action), {});
|
|
11
|
+
// const containerRef = React.useRef<{ measureInWindow: (callback: MeasureInWindowOnSuccessCallback) => void }>()
|
|
17
12
|
const containerRef = React.useRef(null);
|
|
18
13
|
const rootView = React.useRef({ pageX: 0, pageY: 0, width: 0, height: 0 });
|
|
19
14
|
const sc = React.useRef({ x: 0, y: 0, width: 0, height: 0 });
|
|
15
|
+
// React.useEffect(() => {
|
|
16
|
+
// ; (async () => {
|
|
17
|
+
// await utils.sleep()
|
|
18
|
+
// containerRef.current?.measure((...args) => {
|
|
19
|
+
// console.log('containerRef', args)
|
|
20
|
+
// if (args.length == 6) {
|
|
21
|
+
// _container.current = {
|
|
22
|
+
// x: args[4],
|
|
23
|
+
// y: args[5],
|
|
24
|
+
// width: args[2],
|
|
25
|
+
// height: args[3],
|
|
26
|
+
// }
|
|
27
|
+
// }
|
|
28
|
+
// })
|
|
29
|
+
// })()
|
|
30
|
+
// })
|
|
20
31
|
const getRootViewlayoutPromise = () => {
|
|
21
32
|
return new Promise((resovle, reject) => {
|
|
22
33
|
var _a;
|
|
@@ -29,6 +40,7 @@ export default (props) => {
|
|
|
29
40
|
pageY: args[5],
|
|
30
41
|
};
|
|
31
42
|
}
|
|
43
|
+
// console.log('RootView', rootView.current)
|
|
32
44
|
resovle(args);
|
|
33
45
|
});
|
|
34
46
|
});
|
|
@@ -40,6 +52,7 @@ export default (props) => {
|
|
|
40
52
|
let width = rootView.current.width;
|
|
41
53
|
let height = rootView.current.height;
|
|
42
54
|
let x = rootView.current.pageX;
|
|
55
|
+
// let y = (StatusBar.currentHeight || 0) + _container.current.y + height
|
|
43
56
|
let y = rootView.current.pageY + height;
|
|
44
57
|
if (x > Math.abs(deviceWidth - width - x)) {
|
|
45
58
|
alignHorizontal = "right";
|
|
@@ -47,6 +60,7 @@ export default (props) => {
|
|
|
47
60
|
if (y > deviceHeight * 0.5) {
|
|
48
61
|
alignVertical = "top";
|
|
49
62
|
}
|
|
63
|
+
/**todo: target_width的获取是延迟的,所以这里又问题 */
|
|
50
64
|
const target_width = sc.current.width;
|
|
51
65
|
const target_height = CELL_HEIGHT * (Math.min(((_a = props.data) === null || _a === void 0 ? void 0 : _a.length) || 0, 5) || 0);
|
|
52
66
|
return {
|
|
@@ -62,6 +76,7 @@ export default (props) => {
|
|
|
62
76
|
};
|
|
63
77
|
const reLayout = () => {
|
|
64
78
|
let { alignVertical, alignHorizontal, width, height, x, y, target_width, target_height, } = getLayoutInfos();
|
|
79
|
+
// console.log({ getLayoutInfos: getLayoutInfos() })
|
|
65
80
|
const layout = () => {
|
|
66
81
|
if (alignHorizontal == "left") {
|
|
67
82
|
if (target_width + x > deviceWidth) {
|
|
@@ -106,38 +121,51 @@ export default (props) => {
|
|
|
106
121
|
props.onContainerClick && props.onContainerClick();
|
|
107
122
|
if (props.data == undefined || ((_a = props.data) === null || _a === void 0 ? void 0 : _a.length) == 0)
|
|
108
123
|
return;
|
|
124
|
+
/**重新获取rootview的定位 */
|
|
109
125
|
yield getRootViewlayoutPromise();
|
|
126
|
+
/**重新获取rootview的定位 */
|
|
110
127
|
showPopoverView({
|
|
111
|
-
content: (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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",
|
|
129
|
+
// overflow: 'hidden' ,
|
|
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
|
+
})())}/>
|
|
143
|
+
|
|
144
|
+
<ScrollView onLayout={(e) => {
|
|
145
|
+
// console.log('target onLayout', e.nativeEvent.layout)
|
|
146
|
+
let _sc = e.nativeEvent.layout;
|
|
147
|
+
sc.current = _sc;
|
|
148
|
+
}}>
|
|
149
|
+
{(_b = props.data) === null || _b === void 0 ? void 0 : _b.map((i, idx) => {
|
|
150
|
+
return (<TouchableOpacity activeOpacity={0.7} key={`sg-memnu-${idx}`} style={{
|
|
129
151
|
height: CELL_HEIGHT,
|
|
130
152
|
display: "flex",
|
|
131
153
|
flexDirection: "row",
|
|
132
154
|
alignItems: "center",
|
|
133
|
-
|
|
155
|
+
// ,backgroundColor:utils.randomcolor()
|
|
156
|
+
}} onPress={(e) => {
|
|
134
157
|
props.onItemClick && props.onItemClick(idx, i.extra);
|
|
135
158
|
hidePopoverView();
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
159
|
+
}}>
|
|
160
|
+
{i.icon && (<Image style={{ width: 18, height: 18, marginRight: 4 }} source={i.icon}/>)}
|
|
161
|
+
<Text style={{ flexShrink: 1, fontSize: 14, color: "white" }}>
|
|
162
|
+
{i.text}
|
|
163
|
+
</Text>
|
|
164
|
+
</TouchableOpacity>);
|
|
165
|
+
})}
|
|
166
|
+
</ScrollView>
|
|
167
|
+
</TouchableOpacity>),
|
|
140
168
|
});
|
|
141
169
|
});
|
|
142
|
-
return (
|
|
170
|
+
return (<TouchableOpacity ref={containerRef} onPress={(e) => show()} {...props}/>);
|
|
143
171
|
};
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: OBKoro1
|
|
3
|
+
* @Date: 2022-04-24 17:38:27
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-11-14 11:33:33
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/lib/MutiPictureView/MutiPictureView.tsx
|
|
7
|
+
*/
|
|
1
8
|
import * as React from "react";
|
|
2
9
|
import { Image, View, StyleSheet, Keyboard, TouchableOpacity, Text, } from "react-native";
|
|
3
10
|
import { px2dp } from "../../screen/px2dp";
|
|
@@ -7,7 +14,8 @@ let icon_add_image = require("./assets/icon_add_image.png");
|
|
|
7
14
|
let icon_del_image = require("./assets/icon_del_image.png");
|
|
8
15
|
const MutiPictureView = (props) => {
|
|
9
16
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
10
|
-
const { bind, maxCount = 6, type = "showImagePicker", addIcon, addIconStyle, addIconContainerStyle,
|
|
17
|
+
const { bind, maxCount = 6, type = "showImagePicker", addIcon, addIconStyle, addIconContainerStyle, //borderWidth: 1, borderStyle: 'dashed', borderColor: assets.color_A3A9CC 虚线框
|
|
18
|
+
itemContainerStyle, emptyPlaceHolderStyle, delIcon, delIconStyle, spacingHorizontal = px2dp(15), spacingInner = px2dp(8), editable = true, showEmptyPlaceHolder = false, } = props;
|
|
11
19
|
const { viewModel, setViewModel } = bind;
|
|
12
20
|
React.useEffect(() => { }, []);
|
|
13
21
|
const [sideLength, setSideLength] = React.useState(0);
|
|
@@ -67,6 +75,7 @@ const MutiPictureView = (props) => {
|
|
|
67
75
|
typeof it == "object");
|
|
68
76
|
})) || [];
|
|
69
77
|
let images = [];
|
|
78
|
+
// console.log('viewModel', viewModel, imgs)
|
|
70
79
|
imgs.forEach((it) => {
|
|
71
80
|
if (typeof it === "string") {
|
|
72
81
|
images.push({ uri: it });
|
|
@@ -86,7 +95,7 @@ const MutiPictureView = (props) => {
|
|
|
86
95
|
});
|
|
87
96
|
};
|
|
88
97
|
const ItemView = ({ source, index, }) => {
|
|
89
|
-
return (
|
|
98
|
+
return (<TouchableOpacity style={[
|
|
90
99
|
styles.item_container,
|
|
91
100
|
itemContainerStyle,
|
|
92
101
|
{
|
|
@@ -95,15 +104,18 @@ const MutiPictureView = (props) => {
|
|
|
95
104
|
width: sideLength,
|
|
96
105
|
height: sideLength,
|
|
97
106
|
},
|
|
98
|
-
]
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
]} activeOpacity={0.8} onPress={() => showPhoto(index)}>
|
|
108
|
+
<Image source={source} style={{ width: "100%", height: "100%" }} resizeMode="cover"/>
|
|
109
|
+
{editable && !props.value && (<TouchableOpacity onPress={() => deletePhoto(index)} style={[styles.del_img_container, delIconStyle]}>
|
|
110
|
+
<Image source={delIcon ? delIcon : icon_del_image} resizeMode="contain" style={{ width: "100%", height: "100%" }}/>
|
|
111
|
+
</TouchableOpacity>)}
|
|
112
|
+
</TouchableOpacity>);
|
|
102
113
|
};
|
|
103
114
|
const containerRef = React.useRef(null);
|
|
104
115
|
React.useEffect(() => {
|
|
105
116
|
var _a;
|
|
106
117
|
(_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.measure((...args) => {
|
|
118
|
+
// console.log('measure', args[2])
|
|
107
119
|
if (args.length > 3) {
|
|
108
120
|
let _sideLength = +((args[2] - spacingHorizontal * 2 - spacingInner * 2) /
|
|
109
121
|
3).toFixed(1);
|
|
@@ -112,18 +124,19 @@ const MutiPictureView = (props) => {
|
|
|
112
124
|
});
|
|
113
125
|
});
|
|
114
126
|
if (props.value && ((_a = props.value) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
115
|
-
return (
|
|
116
|
-
|
|
127
|
+
return (<View style={[styles.container, props.style]} ref={containerRef}>
|
|
128
|
+
{props.value instanceof Array &&
|
|
117
129
|
((_b = props.value) === null || _b === void 0 ? void 0 : _b.map((item, index) => {
|
|
118
|
-
return (
|
|
119
|
-
}))
|
|
120
|
-
|
|
130
|
+
return (<ItemView key={index} source={typeof item === "string" ? { uri: item } : item} index={index}/>);
|
|
131
|
+
}))}
|
|
132
|
+
|
|
133
|
+
{showEmptyPlaceHolder &&
|
|
121
134
|
maxCount - (((_c = props.value) === null || _c === void 0 ? void 0 : _c.length) || 0) - 1 > 0 &&
|
|
122
135
|
Array.from({
|
|
123
136
|
length: maxCount - (((_d = props.value) === null || _d === void 0 ? void 0 : _d.length) || 0) - (editable ? 1 : 0),
|
|
124
137
|
}, (_, k) => {
|
|
125
138
|
var _a, _b;
|
|
126
|
-
return (
|
|
139
|
+
return (<View key={`sg-showEmptyPlaceHolder-${k}`} style={[
|
|
127
140
|
styles.empty_place_container,
|
|
128
141
|
emptyPlaceHolderStyle,
|
|
129
142
|
itemContainerStyle,
|
|
@@ -139,15 +152,17 @@ const MutiPictureView = (props) => {
|
|
|
139
152
|
width: sideLength,
|
|
140
153
|
height: sideLength,
|
|
141
154
|
},
|
|
142
|
-
]
|
|
143
|
-
})
|
|
155
|
+
]}/>);
|
|
156
|
+
})}
|
|
157
|
+
</View>);
|
|
144
158
|
}
|
|
145
|
-
return (
|
|
146
|
-
|
|
159
|
+
return (<View style={[styles.container, props.style]} ref={containerRef}>
|
|
160
|
+
{(viewModel === null || viewModel === void 0 ? void 0 : viewModel.photos) instanceof Array &&
|
|
147
161
|
viewModel.photos.map((item, index) => {
|
|
148
|
-
return (
|
|
149
|
-
})
|
|
150
|
-
|
|
162
|
+
return (<ItemView key={index} source={typeof item === "string" ? { uri: item } : item} index={index}/>);
|
|
163
|
+
})}
|
|
164
|
+
|
|
165
|
+
{!(((_e = viewModel === null || viewModel === void 0 ? void 0 : viewModel.photos) === null || _e === void 0 ? void 0 : _e.length) == maxCount) && editable && (<TouchableOpacity style={[
|
|
151
166
|
styles.item_container,
|
|
152
167
|
itemContainerStyle,
|
|
153
168
|
{
|
|
@@ -159,23 +174,26 @@ const MutiPictureView = (props) => {
|
|
|
159
174
|
height: sideLength,
|
|
160
175
|
},
|
|
161
176
|
addIconContainerStyle,
|
|
162
|
-
]
|
|
163
|
-
|
|
164
|
-
|
|
177
|
+
]} activeOpacity={0.8} onPress={() => addPhoto()}>
|
|
178
|
+
<Image source={addIcon ? addIcon : icon_add_image} style={[{ width: "25%", height: "25%" }, addIconStyle]} resizeMode="contain"/>
|
|
179
|
+
{props.addText && (<Text style={[
|
|
165
180
|
{
|
|
166
181
|
fontSize: px2sp(12),
|
|
167
182
|
color: "lightgrey",
|
|
168
183
|
marginTop: px2dp(2),
|
|
169
184
|
},
|
|
170
185
|
props.addTextStyle,
|
|
171
|
-
]
|
|
172
|
-
|
|
186
|
+
]}>
|
|
187
|
+
{props.addText}
|
|
188
|
+
</Text>)}
|
|
189
|
+
</TouchableOpacity>)}
|
|
190
|
+
{showEmptyPlaceHolder &&
|
|
173
191
|
maxCount - (((_h = viewModel.photos) === null || _h === void 0 ? void 0 : _h.length) || 0) - 1 > 0 &&
|
|
174
192
|
Array.from({
|
|
175
193
|
length: maxCount - (((_j = viewModel.photos) === null || _j === void 0 ? void 0 : _j.length) || 0) - (editable ? 1 : 0),
|
|
176
194
|
}, (_, k) => {
|
|
177
195
|
var _a, _b;
|
|
178
|
-
return (
|
|
196
|
+
return (<View key={`sg-showEmptyPlaceHolder-${k}`} style={[
|
|
179
197
|
styles.empty_place_container,
|
|
180
198
|
emptyPlaceHolderStyle,
|
|
181
199
|
itemContainerStyle,
|
|
@@ -191,8 +209,9 @@ const MutiPictureView = (props) => {
|
|
|
191
209
|
width: sideLength,
|
|
192
210
|
height: sideLength,
|
|
193
211
|
},
|
|
194
|
-
]
|
|
195
|
-
})
|
|
212
|
+
]}/>);
|
|
213
|
+
})}
|
|
214
|
+
</View>);
|
|
196
215
|
};
|
|
197
216
|
const styles = StyleSheet.create({
|
|
198
217
|
container: {
|
|
@@ -202,6 +221,7 @@ const styles = StyleSheet.create({
|
|
|
202
221
|
display: "flex",
|
|
203
222
|
flexDirection: "row",
|
|
204
223
|
flexWrap: "wrap",
|
|
224
|
+
// borderRadius: px2dp(10),
|
|
205
225
|
},
|
|
206
226
|
item_container: {
|
|
207
227
|
overflow: "hidden",
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: shiguo
|
|
3
|
+
* @Date: 2022-04-24 15:58:39
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-04-26 12:38:13
|
|
6
|
+
* @FilePath: /@aks/easy/lib/PictureViewer/PictureViewer.tsx
|
|
7
|
+
*/
|
|
1
8
|
import * as React from "react";
|
|
2
9
|
import { Modal, StatusBar, Platform } from "react-native";
|
|
3
10
|
import ImageViewer from "react-native-image-zoom-viewer";
|
|
@@ -19,15 +26,24 @@ export const PictureViewer = ({ bind, }) => {
|
|
|
19
26
|
}
|
|
20
27
|
}
|
|
21
28
|
}, [visible]);
|
|
22
|
-
return (
|
|
29
|
+
return (<Modal presentationStyle="overFullScreen" visible={visible} transparent={false} onRequestClose={() => {
|
|
30
|
+
/**
|
|
31
|
+
* 【官方文档】
|
|
32
|
+
* onRequestClose回调会在用户按下 Android 设备上的后退按键或是 Apple TV 上的菜单键时触发。
|
|
33
|
+
* 请务必注意本属性在 Android 平台上为必填,且会在 modal 处于开启状态时阻止BackHandler事件。
|
|
34
|
+
*/
|
|
23
35
|
setViewModel({
|
|
24
36
|
imageViewer: Object.assign(Object.assign({}, viewModel.imageViewer), { visible: false }),
|
|
25
37
|
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
}} style={{ margin: 0, backgroundColor: "red" }}>
|
|
39
|
+
<ImageViewer imageUrls={imgs} index={index} onSwipeDown={() => {
|
|
40
|
+
// console.log('onSwipeDown');
|
|
41
|
+
}} saveToLocalByLongPress={false}
|
|
42
|
+
// onMove={data => console.log(data)}
|
|
43
|
+
useNativeDriver={true} enableSwipeDown={true} onClick={() => {
|
|
44
|
+
setViewModel({
|
|
45
|
+
imageViewer: Object.assign(Object.assign({}, viewModel.imageViewer), { visible: false }),
|
|
46
|
+
});
|
|
47
|
+
}}/>
|
|
48
|
+
</Modal>);
|
|
33
49
|
};
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
};
|
|
1
|
+
import { __rest } from "tslib";
|
|
12
2
|
import * as React from "react";
|
|
13
3
|
import { View, Text, Animated, StyleSheet, ActivityIndicator, TouchableOpacity, } from "react-native";
|
|
14
4
|
import { SwipeListView } from "react-native-swipe-list-view";
|
|
@@ -65,33 +55,42 @@ export default React.forwardRef((props, ref) => {
|
|
|
65
55
|
switch (mode) {
|
|
66
56
|
case "FlatList": {
|
|
67
57
|
let flatListProps = props;
|
|
68
|
-
return (
|
|
58
|
+
return (<Animated.FlatList {...rest} ref={ref} refreshing={refreshState == RefreshState.HeaderRefreshing} keyExtractor={(_, index) => {
|
|
69
59
|
return `sg-index-FlatList-${seed}-${index}`;
|
|
70
|
-
}
|
|
71
|
-
|
|
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" }}>
|
|
61
|
+
<ListHeaderComponent {...flatListProps}/>
|
|
62
|
+
{/* {flatListProps.ListHeaderComponent} */}
|
|
63
|
+
</View>)}
|
|
64
|
+
// ListHeaderComponent={flatListProps.ListHeaderComponent}
|
|
65
|
+
ListFooterComponent={(_) => (<ListFooterComponent {...flatListProps}/>)}/>);
|
|
72
66
|
}
|
|
73
67
|
case "SectionList": {
|
|
74
68
|
let sectionListProps = props;
|
|
75
|
-
const { ItemSeparatorComponent = (_) =>
|
|
76
|
-
return (
|
|
69
|
+
const { ItemSeparatorComponent = (_) => <View style={{ height: 1 }}/>, } = sectionListProps;
|
|
70
|
+
return (<Animated.SectionList {...rest} ref={ref} refreshing={refreshState == RefreshState.HeaderRefreshing} onRefresh={onRefresh} keyExtractor={(_, index) => {
|
|
77
71
|
return `sg-index-SectionList-${seed}-${index}`;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
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}
|
|
73
|
+
// ListHeaderComponent={(_) => <ListHeaderComponent {...sectionListProps} />}
|
|
74
|
+
ListHeaderComponent={(_) => (<View style={{ display: "flex", flexDirection: "column" }}>
|
|
75
|
+
<ListHeaderComponent {...sectionListProps}/>
|
|
76
|
+
{sectionListProps.ListHeaderComponent}
|
|
77
|
+
</View>)} ListFooterComponent={(_) => (<ListFooterComponent {...sectionListProps}/>)} renderSectionHeader={sectionListProps.renderSectionHeader}/>);
|
|
81
78
|
}
|
|
82
79
|
case "SwipeList": {
|
|
83
80
|
let swipeListProps = props;
|
|
84
|
-
const { ItemSeparatorComponent = (_) =>
|
|
85
|
-
const { renderHiddenItem = (data, rowMap) => (
|
|
81
|
+
const { ItemSeparatorComponent = (_) => <View style={{ height: 1 }}/>, } = swipeListProps;
|
|
82
|
+
const { renderHiddenItem = (data, rowMap) => (<View style={{
|
|
86
83
|
backgroundColor: "red",
|
|
87
84
|
height: "100%",
|
|
88
85
|
alignItems: "flex-end",
|
|
89
86
|
justifyContent: "center",
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
}}>
|
|
88
|
+
<Text>Right </Text>
|
|
89
|
+
</View>), } = swipeListProps;
|
|
90
|
+
return (<SwipeListView {...rest} rightOpenValue={-100} leftOpenValue={0} ref={ref} disableLeftSwipe={false} disableRightSwipe={true} onRefresh={onRefresh} refreshing={refreshState == RefreshState.HeaderRefreshing} ItemSeparatorComponent={ItemSeparatorComponent} onEndReachedThreshold={0.1} onEndReached={onEndReached} showsVerticalScrollIndicator={false} ListHeaderComponent={(_) => (<View style={{ display: "flex", flexDirection: "column" }}>
|
|
91
|
+
<ListHeaderComponent {...swipeListProps}/>
|
|
92
|
+
{swipeListProps.ListHeaderComponent}
|
|
93
|
+
</View>)} ListFooterComponent={(args) => (<ListFooterComponent {...swipeListProps}/>)} renderHiddenItem={renderHiddenItem}/>);
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
});
|
|
@@ -100,34 +99,45 @@ const ListFooterComponent = React.memo((props) => {
|
|
|
100
99
|
switch (refreshState) {
|
|
101
100
|
case RefreshState.Idle:
|
|
102
101
|
case RefreshState.FooterRefreshing:
|
|
103
|
-
return (
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
return (<View style={Object.assign(Object.assign({}, styles.container), { flexDirection: "row" })}>
|
|
103
|
+
<ActivityIndicator color={"gray"}/>
|
|
104
|
+
<Text style={Object.assign(Object.assign({}, styles.text), { marginLeft: 5 })}>
|
|
105
|
+
{RefreshText.FooterRefreshing}
|
|
106
|
+
</Text>
|
|
107
|
+
</View>);
|
|
106
108
|
case RefreshState.NoMoreData:
|
|
107
|
-
return (
|
|
108
|
-
|
|
109
|
+
return (<View style={styles.container}>
|
|
110
|
+
<Text style={Object.assign(Object.assign({}, styles.text), { color: "#999999" })}>
|
|
111
|
+
{RefreshText.NoMoreData}
|
|
112
|
+
</Text>
|
|
113
|
+
</View>);
|
|
109
114
|
case RefreshState.Failure:
|
|
110
|
-
return (
|
|
111
|
-
|
|
112
|
-
|
|
115
|
+
return (<View style={styles.container}>
|
|
116
|
+
<TouchableOpacity onPress={() => reload && reload()}>
|
|
117
|
+
<Text style={styles.text}>{RefreshText.Failure}</Text>
|
|
118
|
+
</TouchableOpacity>
|
|
119
|
+
</View>);
|
|
113
120
|
case RefreshState.EmptyData:
|
|
114
121
|
if (props.renderListEmptyComponent)
|
|
115
122
|
return props.renderListEmptyComponent();
|
|
116
|
-
return (
|
|
117
|
-
|
|
118
|
-
|
|
123
|
+
return (<View style={styles.container}>
|
|
124
|
+
<TouchableOpacity onPress={() => reload && reload()}>
|
|
125
|
+
<Text style={styles.text}>{RefreshText.EmptyData}</Text>
|
|
126
|
+
</TouchableOpacity>
|
|
127
|
+
</View>);
|
|
119
128
|
default:
|
|
120
|
-
return
|
|
129
|
+
return <View />;
|
|
121
130
|
}
|
|
122
131
|
});
|
|
123
132
|
const ListHeaderComponent = React.memo((props) => {
|
|
124
133
|
const { refreshState } = props;
|
|
125
134
|
switch (refreshState) {
|
|
126
135
|
case RefreshState.HeaderRefreshing:
|
|
127
|
-
return (
|
|
128
|
-
|
|
136
|
+
return (<View style={Object.assign({}, styles.container)}>
|
|
137
|
+
<Text style={Object.assign({}, styles.text)}>{RefreshText.HeaderRefreshing}</Text>
|
|
138
|
+
</View>);
|
|
129
139
|
default:
|
|
130
|
-
return
|
|
140
|
+
return <View />;
|
|
131
141
|
}
|
|
132
142
|
});
|
|
133
143
|
const styles = StyleSheet.create({
|
|
@@ -137,6 +147,7 @@ const styles = StyleSheet.create({
|
|
|
137
147
|
justifyContent: "center",
|
|
138
148
|
alignItems: "center",
|
|
139
149
|
height: 44,
|
|
150
|
+
// backgroundColor:'cyan'
|
|
140
151
|
},
|
|
141
152
|
text: {
|
|
142
153
|
color: "gray",
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
/*
|
|
3
|
+
* @Author: shiguo
|
|
4
|
+
* @Date: 2022-07-11 15:42:16
|
|
5
|
+
* @LastEditors: shiguo
|
|
6
|
+
* @LastEditTime: 2022-07-11 16:15:02
|
|
7
|
+
* @FilePath: /@aks-dev/easyui/lib/RichText/RichText.tsx
|
|
8
|
+
*/
|
|
12
9
|
import React from "react";
|
|
13
10
|
import { StyleSheet, Text } from "react-native";
|
|
14
11
|
import { px2sp } from "../../screen/px2sp";
|
|
@@ -30,19 +27,22 @@ export default (props) => {
|
|
|
30
27
|
positionEnd = positionStart + richStr.length;
|
|
31
28
|
}
|
|
32
29
|
if (prefix) {
|
|
33
|
-
return (
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
return (<Text style={styles.container} {...rest}>
|
|
31
|
+
<Text style={Object.assign(Object.assign({}, styles.defaultRich), richStyle)}>{richStr}</Text>
|
|
32
|
+
{textStr}
|
|
33
|
+
</Text>);
|
|
36
34
|
}
|
|
37
35
|
if (suffix) {
|
|
38
|
-
return (
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
return (<Text style={styles.container} {...rest}>
|
|
37
|
+
{textStr}
|
|
38
|
+
<Text style={Object.assign(Object.assign({}, styles.defaultRich), richStyle)}>{richStr}</Text>
|
|
39
|
+
</Text>);
|
|
41
40
|
}
|
|
42
|
-
return (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
return (<Text style={styles.container} {...rest}>
|
|
42
|
+
{textStr.substring(0, positionStart)}
|
|
43
|
+
{positionEnd > 0 && (<Text style={Object.assign(Object.assign({}, styles.defaultRich), richStyle)}>{richStr}</Text>)}
|
|
44
|
+
{textStr.substring(positionEnd, textStr.length)}
|
|
45
|
+
</Text>);
|
|
46
46
|
};
|
|
47
47
|
const styles = StyleSheet.create({
|
|
48
48
|
container: {
|
|
@@ -52,5 +52,6 @@ const styles = StyleSheet.create({
|
|
|
52
52
|
defaultRich: {
|
|
53
53
|
color: "red",
|
|
54
54
|
fontSize: px2sp(14),
|
|
55
|
+
// fontWeight: 'bold'
|
|
55
56
|
},
|
|
56
57
|
});
|
|
@@ -1,8 +1,16 @@
|
|
|
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
|
+
*/
|
|
1
8
|
import * as React from "react";
|
|
2
9
|
import { StyleSheet, Animated, } from "react-native";
|
|
3
10
|
const App = (props) => {
|
|
4
11
|
const { style, children, stickyHeaderY = -1, stickyScrollY = new Animated.Value(0), } = props;
|
|
5
12
|
const [stickyLayoutY, setStickyLayoutY] = React.useState(0);
|
|
13
|
+
// 兼容代码,防止没有传头部高度
|
|
6
14
|
const _onLayout = (event) => {
|
|
7
15
|
setStickyLayoutY(event.nativeEvent.layout.y);
|
|
8
16
|
};
|
|
@@ -13,11 +21,13 @@ const App = (props) => {
|
|
|
13
21
|
outputRange: [0, 0, 0, 1],
|
|
14
22
|
});
|
|
15
23
|
};
|
|
16
|
-
return (
|
|
24
|
+
return (<Animated.View onLayout={_onLayout} style={[
|
|
17
25
|
style,
|
|
18
26
|
styles.container,
|
|
19
27
|
{ transform: [{ translateY: translateY() }] },
|
|
20
|
-
]
|
|
28
|
+
]}>
|
|
29
|
+
{children}
|
|
30
|
+
</Animated.View>);
|
|
21
31
|
};
|
|
22
32
|
const styles = StyleSheet.create({
|
|
23
33
|
container: {
|