@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,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";
|
|
@@ -6,20 +13,19 @@ import SYImagePicker from "@aks-dev/react-native-syan-image-picker";
|
|
|
6
13
|
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
|
-
|
|
10
|
-
|
|
16
|
+
const { bind, maxCount = 6, type = "showImagePicker", addIcon, addIconStyle, addIconContainerStyle, //borderWidth: 1, borderStyle: 'dashed', borderColor: assets.color_A3A9CC 虚线框
|
|
17
|
+
itemContainerStyle, emptyPlaceHolderStyle, delIcon, delIconStyle, spacingHorizontal = px2dp(15), spacingInner = px2dp(8), editable = true, showEmptyPlaceHolder = false, } = props;
|
|
11
18
|
const { viewModel, setViewModel } = bind;
|
|
12
19
|
React.useEffect(() => { }, []);
|
|
13
20
|
const [sideLength, setSideLength] = React.useState(0);
|
|
14
21
|
const addPhoto = () => {
|
|
15
|
-
var _a, _b;
|
|
16
22
|
let images = viewModel.photos || [];
|
|
17
23
|
if (!images) {
|
|
18
24
|
throw new Error("viewModel没有定义photos字段");
|
|
19
25
|
}
|
|
20
26
|
if (type == "showImagePicker") {
|
|
21
27
|
SYImagePicker.showImagePicker({
|
|
22
|
-
imageCount: maxCount - (
|
|
28
|
+
imageCount: maxCount - (viewModel.photos?.length || 0),
|
|
23
29
|
isCrop: false,
|
|
24
30
|
isRecordSelected: false,
|
|
25
31
|
quality: 20,
|
|
@@ -35,7 +41,7 @@ const MutiPictureView = (props) => {
|
|
|
35
41
|
}
|
|
36
42
|
if (type == "openCamera") {
|
|
37
43
|
SYImagePicker.openCamera({
|
|
38
|
-
imageCount: maxCount - (
|
|
44
|
+
imageCount: maxCount - (viewModel.photos?.length || 0),
|
|
39
45
|
isCrop: false,
|
|
40
46
|
isRecordSelected: false,
|
|
41
47
|
quality: 20,
|
|
@@ -60,13 +66,13 @@ const MutiPictureView = (props) => {
|
|
|
60
66
|
setViewModel({ photos: photos });
|
|
61
67
|
};
|
|
62
68
|
const showPhoto = (index) => {
|
|
63
|
-
var _a;
|
|
64
69
|
Keyboard.dismiss();
|
|
65
|
-
let imgs = (
|
|
70
|
+
let imgs = (props.value || viewModel.photos)?.filter((it) => {
|
|
66
71
|
return ((typeof it === "string" && it.indexOf("http") >= 0) ||
|
|
67
72
|
typeof it == "object");
|
|
68
|
-
})
|
|
73
|
+
}) || [];
|
|
69
74
|
let images = [];
|
|
75
|
+
// console.log('viewModel', viewModel, imgs)
|
|
70
76
|
imgs.forEach((it) => {
|
|
71
77
|
if (typeof it === "string") {
|
|
72
78
|
images.push({ uri: it });
|
|
@@ -86,7 +92,7 @@ const MutiPictureView = (props) => {
|
|
|
86
92
|
});
|
|
87
93
|
};
|
|
88
94
|
const ItemView = ({ source, index, }) => {
|
|
89
|
-
return (
|
|
95
|
+
return (<TouchableOpacity style={[
|
|
90
96
|
styles.item_container,
|
|
91
97
|
itemContainerStyle,
|
|
92
98
|
{
|
|
@@ -95,15 +101,17 @@ const MutiPictureView = (props) => {
|
|
|
95
101
|
width: sideLength,
|
|
96
102
|
height: sideLength,
|
|
97
103
|
},
|
|
98
|
-
]
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
]} activeOpacity={0.8} onPress={() => showPhoto(index)}>
|
|
105
|
+
<Image source={source} style={{ width: "100%", height: "100%" }} resizeMode="cover"/>
|
|
106
|
+
{editable && !props.value && (<TouchableOpacity onPress={() => deletePhoto(index)} style={[styles.del_img_container, delIconStyle]}>
|
|
107
|
+
<Image source={delIcon ? delIcon : icon_del_image} resizeMode="contain" style={{ width: "100%", height: "100%" }}/>
|
|
108
|
+
</TouchableOpacity>)}
|
|
109
|
+
</TouchableOpacity>);
|
|
102
110
|
};
|
|
103
111
|
const containerRef = React.useRef(null);
|
|
104
112
|
React.useEffect(() => {
|
|
105
|
-
|
|
106
|
-
|
|
113
|
+
containerRef.current?.measure((...args) => {
|
|
114
|
+
// console.log('measure', args[2])
|
|
107
115
|
if (args.length > 3) {
|
|
108
116
|
let _sideLength = +((args[2] - spacingHorizontal * 2 - spacingInner * 2) /
|
|
109
117
|
3).toFixed(1);
|
|
@@ -111,88 +119,89 @@ const MutiPictureView = (props) => {
|
|
|
111
119
|
}
|
|
112
120
|
});
|
|
113
121
|
});
|
|
114
|
-
if (props.value &&
|
|
115
|
-
return (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return (
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
if (props.value && props.value?.length > 0) {
|
|
123
|
+
return (<View style={[styles.container, props.style]} ref={containerRef}>
|
|
124
|
+
{props.value instanceof Array &&
|
|
125
|
+
props.value?.map((item, index) => {
|
|
126
|
+
return (<ItemView key={index} source={typeof item === "string" ? { uri: item } : item} index={index}/>);
|
|
127
|
+
})}
|
|
128
|
+
|
|
129
|
+
{showEmptyPlaceHolder &&
|
|
130
|
+
maxCount - (props.value?.length || 0) - 1 > 0 &&
|
|
122
131
|
Array.from({
|
|
123
|
-
length: maxCount - (
|
|
124
|
-
}, (_, k) => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
] }));
|
|
143
|
-
})));
|
|
132
|
+
length: maxCount - (props.value?.length || 0) - (editable ? 1 : 0),
|
|
133
|
+
}, (_, k) => (<View key={`sg-showEmptyPlaceHolder-${k}`} style={[
|
|
134
|
+
styles.empty_place_container,
|
|
135
|
+
emptyPlaceHolderStyle,
|
|
136
|
+
itemContainerStyle,
|
|
137
|
+
{
|
|
138
|
+
marginTop: k + (editable ? 1 : 0) + (props.value?.length || 0) > 2
|
|
139
|
+
? spacingInner
|
|
140
|
+
: 0,
|
|
141
|
+
marginLeft: (k + (editable ? 1 : 0) + (props.value?.length || 0)) %
|
|
142
|
+
3 ==
|
|
143
|
+
0
|
|
144
|
+
? spacingHorizontal
|
|
145
|
+
: spacingInner,
|
|
146
|
+
width: sideLength,
|
|
147
|
+
height: sideLength,
|
|
148
|
+
},
|
|
149
|
+
]}/>))}
|
|
150
|
+
</View>);
|
|
144
151
|
}
|
|
145
|
-
return (
|
|
146
|
-
|
|
152
|
+
return (<View style={[styles.container, props.style]} ref={containerRef}>
|
|
153
|
+
{viewModel?.photos instanceof Array &&
|
|
147
154
|
viewModel.photos.map((item, index) => {
|
|
148
|
-
return (
|
|
149
|
-
})
|
|
150
|
-
|
|
155
|
+
return (<ItemView key={index} source={typeof item === "string" ? { uri: item } : item} index={index}/>);
|
|
156
|
+
})}
|
|
157
|
+
|
|
158
|
+
{!(viewModel?.photos?.length == maxCount) && editable && (<TouchableOpacity style={[
|
|
151
159
|
styles.item_container,
|
|
152
160
|
itemContainerStyle,
|
|
153
161
|
{
|
|
154
|
-
marginTop: (
|
|
155
|
-
marginLeft: (
|
|
162
|
+
marginTop: (viewModel?.photos?.length || 0) >= 3 ? spacingInner : 0,
|
|
163
|
+
marginLeft: (viewModel?.photos?.length || 0) % 3 == 0
|
|
156
164
|
? spacingHorizontal
|
|
157
165
|
: spacingInner,
|
|
158
166
|
width: sideLength,
|
|
159
167
|
height: sideLength,
|
|
160
168
|
},
|
|
161
169
|
addIconContainerStyle,
|
|
162
|
-
]
|
|
163
|
-
|
|
164
|
-
|
|
170
|
+
]} activeOpacity={0.8} onPress={() => addPhoto()}>
|
|
171
|
+
<Image source={addIcon ? addIcon : icon_add_image} style={[{ width: "25%", height: "25%" }, addIconStyle]} resizeMode="contain"/>
|
|
172
|
+
{props.addText && (<Text style={[
|
|
165
173
|
{
|
|
166
174
|
fontSize: px2sp(12),
|
|
167
175
|
color: "lightgrey",
|
|
168
176
|
marginTop: px2dp(2),
|
|
169
177
|
},
|
|
170
178
|
props.addTextStyle,
|
|
171
|
-
]
|
|
172
|
-
|
|
173
|
-
|
|
179
|
+
]}>
|
|
180
|
+
{props.addText}
|
|
181
|
+
</Text>)}
|
|
182
|
+
</TouchableOpacity>)}
|
|
183
|
+
{showEmptyPlaceHolder &&
|
|
184
|
+
maxCount - (viewModel.photos?.length || 0) - 1 > 0 &&
|
|
174
185
|
Array.from({
|
|
175
|
-
length: maxCount - (
|
|
176
|
-
}, (_, k) => {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
] }));
|
|
195
|
-
})));
|
|
186
|
+
length: maxCount - (viewModel.photos?.length || 0) - (editable ? 1 : 0),
|
|
187
|
+
}, (_, k) => (<View key={`sg-showEmptyPlaceHolder-${k}`} style={[
|
|
188
|
+
styles.empty_place_container,
|
|
189
|
+
emptyPlaceHolderStyle,
|
|
190
|
+
itemContainerStyle,
|
|
191
|
+
{
|
|
192
|
+
marginTop: k + (editable ? 1 : 0) + (viewModel.photos?.length || 0) > 2
|
|
193
|
+
? spacingInner
|
|
194
|
+
: 0,
|
|
195
|
+
marginLeft: (k + (editable ? 1 : 0) + (viewModel.photos?.length || 0)) %
|
|
196
|
+
3 ==
|
|
197
|
+
0
|
|
198
|
+
? spacingHorizontal
|
|
199
|
+
: spacingInner,
|
|
200
|
+
width: sideLength,
|
|
201
|
+
height: sideLength,
|
|
202
|
+
},
|
|
203
|
+
]}/>))}
|
|
204
|
+
</View>);
|
|
196
205
|
};
|
|
197
206
|
const styles = StyleSheet.create({
|
|
198
207
|
container: {
|
|
@@ -202,6 +211,7 @@ const styles = StyleSheet.create({
|
|
|
202
211
|
display: "flex",
|
|
203
212
|
flexDirection: "row",
|
|
204
213
|
flexWrap: "wrap",
|
|
214
|
+
// borderRadius: px2dp(10),
|
|
205
215
|
},
|
|
206
216
|
item_container: {
|
|
207
217
|
overflow: "hidden",
|
|
@@ -1,11 +1,17 @@
|
|
|
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";
|
|
4
11
|
export const PictureViewer = ({ bind, }) => {
|
|
5
|
-
var _a;
|
|
6
12
|
const { viewModel, setViewModel } = bind;
|
|
7
13
|
const visible = viewModel.imageViewer.visible;
|
|
8
|
-
const imgs =
|
|
14
|
+
const imgs = viewModel.imageViewer.imageUrls?.map((item) => ({ url: item }));
|
|
9
15
|
const index = viewModel.imageViewer.index;
|
|
10
16
|
React.useEffect(() => {
|
|
11
17
|
if (Platform.OS == "android") {
|
|
@@ -19,15 +25,30 @@ export const PictureViewer = ({ bind, }) => {
|
|
|
19
25
|
}
|
|
20
26
|
}
|
|
21
27
|
}, [visible]);
|
|
22
|
-
return (
|
|
28
|
+
return (<Modal presentationStyle="overFullScreen" visible={visible} transparent={false} onRequestClose={() => {
|
|
29
|
+
/**
|
|
30
|
+
* 【官方文档】
|
|
31
|
+
* onRequestClose回调会在用户按下 Android 设备上的后退按键或是 Apple TV 上的菜单键时触发。
|
|
32
|
+
* 请务必注意本属性在 Android 平台上为必填,且会在 modal 处于开启状态时阻止BackHandler事件。
|
|
33
|
+
*/
|
|
23
34
|
setViewModel({
|
|
24
|
-
imageViewer:
|
|
35
|
+
imageViewer: {
|
|
36
|
+
...viewModel.imageViewer,
|
|
37
|
+
visible: false,
|
|
38
|
+
},
|
|
25
39
|
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
}} style={{ margin: 0, backgroundColor: "red" }}>
|
|
41
|
+
<ImageViewer imageUrls={imgs} index={index} onSwipeDown={() => {
|
|
42
|
+
// console.log('onSwipeDown');
|
|
43
|
+
}} saveToLocalByLongPress={false}
|
|
44
|
+
// onMove={data => console.log(data)}
|
|
45
|
+
useNativeDriver={true} enableSwipeDown={true} onClick={() => {
|
|
46
|
+
setViewModel({
|
|
47
|
+
imageViewer: {
|
|
48
|
+
...viewModel.imageViewer,
|
|
49
|
+
visible: false,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}}/>
|
|
53
|
+
</Modal>);
|
|
33
54
|
};
|
|
@@ -1,14 +1,3 @@
|
|
|
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
|
-
};
|
|
12
1
|
import * as React from "react";
|
|
13
2
|
import { View, Text, Animated, StyleSheet, ActivityIndicator, TouchableOpacity, } from "react-native";
|
|
14
3
|
import { SwipeListView } from "react-native-swipe-list-view";
|
|
@@ -31,8 +20,7 @@ export var RefreshState;
|
|
|
31
20
|
RefreshState["None"] = "None";
|
|
32
21
|
})(RefreshState || (RefreshState = {}));
|
|
33
22
|
export default React.forwardRef((props, ref) => {
|
|
34
|
-
|
|
35
|
-
const { mode = "FlatList", refreshState, onHeaderRefresh, onFooterRefresh, reload } = props, rest = __rest(props, ["mode", "refreshState", "onHeaderRefresh", "onFooterRefresh", "reload"]);
|
|
23
|
+
const { mode = "FlatList", refreshState, onHeaderRefresh, onFooterRefresh, reload, ...rest } = props;
|
|
36
24
|
const seed = React.useRef(Math.random()).current;
|
|
37
25
|
let onRefresh = () => {
|
|
38
26
|
if (refreshState == RefreshState.HeaderRefreshing)
|
|
@@ -65,33 +53,42 @@ export default React.forwardRef((props, ref) => {
|
|
|
65
53
|
switch (mode) {
|
|
66
54
|
case "FlatList": {
|
|
67
55
|
let flatListProps = props;
|
|
68
|
-
return (
|
|
56
|
+
return (<Animated.FlatList {...rest} ref={ref} refreshing={refreshState == RefreshState.HeaderRefreshing} keyExtractor={(_, index) => {
|
|
69
57
|
return `sg-index-FlatList-${seed}-${index}`;
|
|
70
|
-
}
|
|
71
|
-
|
|
58
|
+
}} contentContainerStyle={flatListProps.data?.length ? {} : { height: "100%" }} onRefresh={onRefresh} onEndReachedThreshold={0.1} onEndReached={onEndReached} showsVerticalScrollIndicator={false} ListHeaderComponent={(_) => (<View style={{ display: "flex", flexDirection: "column" }}>
|
|
59
|
+
<ListHeaderComponent {...flatListProps}/>
|
|
60
|
+
{/* {flatListProps.ListHeaderComponent} */}
|
|
61
|
+
</View>)}
|
|
62
|
+
// ListHeaderComponent={flatListProps.ListHeaderComponent}
|
|
63
|
+
ListFooterComponent={(_) => (<ListFooterComponent {...flatListProps}/>)}/>);
|
|
72
64
|
}
|
|
73
65
|
case "SectionList": {
|
|
74
66
|
let sectionListProps = props;
|
|
75
|
-
const { ItemSeparatorComponent = (_) =>
|
|
76
|
-
return (
|
|
67
|
+
const { ItemSeparatorComponent = (_) => <View style={{ height: 1 }}/>, } = sectionListProps;
|
|
68
|
+
return (<Animated.SectionList {...rest} ref={ref} refreshing={refreshState == RefreshState.HeaderRefreshing} onRefresh={onRefresh} keyExtractor={(_, index) => {
|
|
77
69
|
return `sg-index-SectionList-${seed}-${index}`;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
}} contentContainerStyle={sectionListProps.sections?.length > 0 ? {} : { height: "100%" }} ItemSeparatorComponent={ItemSeparatorComponent} onEndReachedThreshold={0.1} onEndReached={onEndReached} showsVerticalScrollIndicator={false}
|
|
71
|
+
// ListHeaderComponent={(_) => <ListHeaderComponent {...sectionListProps} />}
|
|
72
|
+
ListHeaderComponent={(_) => (<View style={{ display: "flex", flexDirection: "column" }}>
|
|
73
|
+
<ListHeaderComponent {...sectionListProps}/>
|
|
74
|
+
{sectionListProps.ListHeaderComponent}
|
|
75
|
+
</View>)} ListFooterComponent={(_) => (<ListFooterComponent {...sectionListProps}/>)} renderSectionHeader={sectionListProps.renderSectionHeader}/>);
|
|
81
76
|
}
|
|
82
77
|
case "SwipeList": {
|
|
83
78
|
let swipeListProps = props;
|
|
84
|
-
const { ItemSeparatorComponent = (_) =>
|
|
85
|
-
const { renderHiddenItem = (data, rowMap) => (
|
|
79
|
+
const { ItemSeparatorComponent = (_) => <View style={{ height: 1 }}/>, } = swipeListProps;
|
|
80
|
+
const { renderHiddenItem = (data, rowMap) => (<View style={{
|
|
86
81
|
backgroundColor: "red",
|
|
87
82
|
height: "100%",
|
|
88
83
|
alignItems: "flex-end",
|
|
89
84
|
justifyContent: "center",
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
85
|
+
}}>
|
|
86
|
+
<Text>Right </Text>
|
|
87
|
+
</View>), } = swipeListProps;
|
|
88
|
+
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" }}>
|
|
89
|
+
<ListHeaderComponent {...swipeListProps}/>
|
|
90
|
+
{swipeListProps.ListHeaderComponent}
|
|
91
|
+
</View>)} ListFooterComponent={(args) => (<ListFooterComponent {...swipeListProps}/>)} renderHiddenItem={renderHiddenItem}/>);
|
|
95
92
|
}
|
|
96
93
|
}
|
|
97
94
|
});
|
|
@@ -100,34 +97,45 @@ const ListFooterComponent = React.memo((props) => {
|
|
|
100
97
|
switch (refreshState) {
|
|
101
98
|
case RefreshState.Idle:
|
|
102
99
|
case RefreshState.FooterRefreshing:
|
|
103
|
-
return (
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
return (<View style={{ ...styles.container, flexDirection: "row" }}>
|
|
101
|
+
<ActivityIndicator color={"gray"}/>
|
|
102
|
+
<Text style={{ ...styles.text, marginLeft: 5 }}>
|
|
103
|
+
{RefreshText.FooterRefreshing}
|
|
104
|
+
</Text>
|
|
105
|
+
</View>);
|
|
106
106
|
case RefreshState.NoMoreData:
|
|
107
|
-
return (
|
|
108
|
-
|
|
107
|
+
return (<View style={styles.container}>
|
|
108
|
+
<Text style={{ ...styles.text, color: "#999999" }}>
|
|
109
|
+
{RefreshText.NoMoreData}
|
|
110
|
+
</Text>
|
|
111
|
+
</View>);
|
|
109
112
|
case RefreshState.Failure:
|
|
110
|
-
return (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
return (<View style={styles.container}>
|
|
114
|
+
<TouchableOpacity onPress={() => reload && reload()}>
|
|
115
|
+
<Text style={styles.text}>{RefreshText.Failure}</Text>
|
|
116
|
+
</TouchableOpacity>
|
|
117
|
+
</View>);
|
|
113
118
|
case RefreshState.EmptyData:
|
|
114
119
|
if (props.renderListEmptyComponent)
|
|
115
120
|
return props.renderListEmptyComponent();
|
|
116
|
-
return (
|
|
117
|
-
|
|
118
|
-
|
|
121
|
+
return (<View style={styles.container}>
|
|
122
|
+
<TouchableOpacity onPress={() => reload && reload()}>
|
|
123
|
+
<Text style={styles.text}>{RefreshText.EmptyData}</Text>
|
|
124
|
+
</TouchableOpacity>
|
|
125
|
+
</View>);
|
|
119
126
|
default:
|
|
120
|
-
return
|
|
127
|
+
return <View />;
|
|
121
128
|
}
|
|
122
129
|
});
|
|
123
130
|
const ListHeaderComponent = React.memo((props) => {
|
|
124
131
|
const { refreshState } = props;
|
|
125
132
|
switch (refreshState) {
|
|
126
133
|
case RefreshState.HeaderRefreshing:
|
|
127
|
-
return (
|
|
128
|
-
|
|
134
|
+
return (<View style={{ ...styles.container }}>
|
|
135
|
+
<Text style={{ ...styles.text }}>{RefreshText.HeaderRefreshing}</Text>
|
|
136
|
+
</View>);
|
|
129
137
|
default:
|
|
130
|
-
return
|
|
138
|
+
return <View />;
|
|
131
139
|
}
|
|
132
140
|
});
|
|
133
141
|
const styles = StyleSheet.create({
|
|
@@ -137,6 +145,7 @@ const styles = StyleSheet.create({
|
|
|
137
145
|
justifyContent: "center",
|
|
138
146
|
alignItems: "center",
|
|
139
147
|
height: 44,
|
|
148
|
+
// backgroundColor:'cyan'
|
|
140
149
|
},
|
|
141
150
|
text: {
|
|
142
151
|
color: "gray",
|
|
@@ -1,20 +1,16 @@
|
|
|
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-11 15:42:16
|
|
4
|
+
* @LastEditors: shiguo
|
|
5
|
+
* @LastEditTime: 2022-07-11 16:15:02
|
|
6
|
+
* @FilePath: /@aks-dev/easyui/lib/RichText/RichText.tsx
|
|
7
|
+
*/
|
|
12
8
|
import React from "react";
|
|
13
9
|
import { StyleSheet, Text } from "react-native";
|
|
14
10
|
import { px2sp } from "../../screen/px2sp";
|
|
15
11
|
import * as utils from "../../utils/lazy";
|
|
16
12
|
export default (props) => {
|
|
17
|
-
const { rich, richStyle, text, suffix, prefix
|
|
13
|
+
const { rich, richStyle, text, suffix, prefix, ...rest } = props;
|
|
18
14
|
let textStr = "";
|
|
19
15
|
let richStr = "";
|
|
20
16
|
if (utils.isString(text) || utils.isNumber(text)) {
|
|
@@ -25,24 +21,27 @@ export default (props) => {
|
|
|
25
21
|
}
|
|
26
22
|
let positionStart = 0;
|
|
27
23
|
let positionEnd = 0;
|
|
28
|
-
if (
|
|
24
|
+
if (textStr?.indexOf(richStr) >= 0) {
|
|
29
25
|
positionStart = textStr.indexOf(richStr);
|
|
30
26
|
positionEnd = positionStart + richStr.length;
|
|
31
27
|
}
|
|
32
28
|
if (prefix) {
|
|
33
|
-
return (
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
return (<Text style={styles.container} {...rest}>
|
|
30
|
+
<Text style={{ ...styles.defaultRich, ...richStyle }}>{richStr}</Text>
|
|
31
|
+
{textStr}
|
|
32
|
+
</Text>);
|
|
36
33
|
}
|
|
37
34
|
if (suffix) {
|
|
38
|
-
return (
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
return (<Text style={styles.container} {...rest}>
|
|
36
|
+
{textStr}
|
|
37
|
+
<Text style={{ ...styles.defaultRich, ...richStyle }}>{richStr}</Text>
|
|
38
|
+
</Text>);
|
|
41
39
|
}
|
|
42
|
-
return (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
return (<Text style={styles.container} {...rest}>
|
|
41
|
+
{textStr.substring(0, positionStart)}
|
|
42
|
+
{positionEnd > 0 && (<Text style={{ ...styles.defaultRich, ...richStyle }}>{richStr}</Text>)}
|
|
43
|
+
{textStr.substring(positionEnd, textStr.length)}
|
|
44
|
+
</Text>);
|
|
46
45
|
};
|
|
47
46
|
const styles = StyleSheet.create({
|
|
48
47
|
container: {
|
|
@@ -52,5 +51,6 @@ const styles = StyleSheet.create({
|
|
|
52
51
|
defaultRich: {
|
|
53
52
|
color: "red",
|
|
54
53
|
fontSize: px2sp(14),
|
|
54
|
+
// fontWeight: 'bold'
|
|
55
55
|
},
|
|
56
56
|
});
|
|
@@ -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: {
|