@aks-dev/easyui 1.0.114 → 1.0.116
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.
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: OBKoro1
|
|
3
3
|
* @Date: 2022-04-24 17:38:27
|
|
4
4
|
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-11-10 12:15:48
|
|
6
6
|
* @FilePath: /@aks-dev/easyui/lib/MutiPictureView/MutiPictureView.tsx
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -27,11 +27,14 @@ const MutiPictureView: React.FC<MutiPictureViewProps> = (props) => {
|
|
|
27
27
|
addIcon,
|
|
28
28
|
addIconStyle,
|
|
29
29
|
addIconContainerStyle,//borderWidth: 1, borderStyle: 'dashed', borderColor: assets.color_A3A9CC 虚线框
|
|
30
|
+
itemContainerStyle,
|
|
31
|
+
emptyPlaceHolderStyle,
|
|
30
32
|
delIcon,
|
|
31
33
|
delIconStyle,
|
|
32
34
|
spacingHorizontal = px2dp(15),
|
|
33
35
|
spacingInner = px2dp(8),
|
|
34
36
|
editable = true,
|
|
37
|
+
showEmptyPlaceHolder = false
|
|
35
38
|
} = props
|
|
36
39
|
const { viewModel, setViewModel } = bind
|
|
37
40
|
React.useEffect(() => {
|
|
@@ -113,7 +116,7 @@ const MutiPictureView: React.FC<MutiPictureViewProps> = (props) => {
|
|
|
113
116
|
const ItemView: React.FC<{ source: ImageSourcePropType, index: number }> = ({ source, index }) => {
|
|
114
117
|
|
|
115
118
|
return (
|
|
116
|
-
<TouchableOpacity style={[styles.item_container, {
|
|
119
|
+
<TouchableOpacity style={[styles.item_container, itemContainerStyle, {
|
|
117
120
|
marginTop: index < 3 ? 0 : spacingInner,
|
|
118
121
|
marginLeft: index % 3 == 0 ? spacingHorizontal : spacingInner,
|
|
119
122
|
width: sideLength,
|
|
@@ -167,7 +170,7 @@ const MutiPictureView: React.FC<MutiPictureViewProps> = (props) => {
|
|
|
167
170
|
|
|
168
171
|
{
|
|
169
172
|
!(viewModel?.photos?.length == maxCount) && editable && (
|
|
170
|
-
<TouchableOpacity style={[styles.item_container, {
|
|
173
|
+
<TouchableOpacity style={[styles.item_container, itemContainerStyle, {
|
|
171
174
|
marginTop: (viewModel?.photos?.length || 0) >= 3 ? spacingInner : 0,
|
|
172
175
|
marginLeft: (viewModel?.photos?.length || 0) % 3 == 0 ? spacingHorizontal : spacingInner,
|
|
173
176
|
width: sideLength,
|
|
@@ -179,6 +182,17 @@ const MutiPictureView: React.FC<MutiPictureViewProps> = (props) => {
|
|
|
179
182
|
|
|
180
183
|
)
|
|
181
184
|
}
|
|
185
|
+
{
|
|
186
|
+
showEmptyPlaceHolder && maxCount - (viewModel.photos?.length || 0) - 1 > 0 &&
|
|
187
|
+
Array.from({ length: maxCount - (viewModel.photos?.length || 0) - 1 }, (_, k) =>
|
|
188
|
+
<View key={`sg-showEmptyPlaceHolder-${k}`} style={[styles.empty_place_container, emptyPlaceHolderStyle, itemContainerStyle, {
|
|
189
|
+
marginTop: k + 1 + (viewModel.photos?.length || 0) > 2 ? spacingInner : 0,
|
|
190
|
+
marginLeft: (k + 1 + (viewModel.photos?.length || 0)) % 3 == 0 ? spacingHorizontal : spacingInner,
|
|
191
|
+
width: sideLength,
|
|
192
|
+
height: sideLength,
|
|
193
|
+
}]} />
|
|
194
|
+
)
|
|
195
|
+
}
|
|
182
196
|
</View >
|
|
183
197
|
|
|
184
198
|
)
|
|
@@ -199,7 +213,7 @@ const styles = StyleSheet.create({
|
|
|
199
213
|
display: 'flex',
|
|
200
214
|
flexDirection: 'row',
|
|
201
215
|
flexWrap: 'wrap',
|
|
202
|
-
borderRadius: px2dp(10),
|
|
216
|
+
// borderRadius: px2dp(10),
|
|
203
217
|
},
|
|
204
218
|
item_container: {
|
|
205
219
|
overflow: 'hidden',
|
|
@@ -218,6 +232,12 @@ const styles = StyleSheet.create({
|
|
|
218
232
|
width: px2dp(24),
|
|
219
233
|
height: px2dp(24)
|
|
220
234
|
},
|
|
235
|
+
empty_place_container: {
|
|
236
|
+
borderRadius: px2dp(10),
|
|
237
|
+
backgroundColor: '#ededed',
|
|
238
|
+
borderColor: '#cccccc',
|
|
239
|
+
borderWidth: .75,
|
|
240
|
+
}
|
|
221
241
|
})
|
|
222
242
|
|
|
223
243
|
|
|
@@ -3,7 +3,7 @@ import { TextStyle } from 'react-native';
|
|
|
3
3
|
* @Author: shiguo
|
|
4
4
|
* @Date: 2022-04-24 17:38:32
|
|
5
5
|
* @LastEditors: shiguo
|
|
6
|
-
* @LastEditTime: 2022-
|
|
6
|
+
* @LastEditTime: 2022-11-10 12:15:56
|
|
7
7
|
* @FilePath: /@aks-dev/easyui/lib/MutiPictureView/index.ts
|
|
8
8
|
*/
|
|
9
9
|
import { StyleProp, ViewStyle, ImageStyle, ImageSourcePropType } from 'react-native'
|
|
@@ -41,6 +41,7 @@ export declare type MutiPictureViewProps = {
|
|
|
41
41
|
addText?: string;
|
|
42
42
|
addTextStyle?: StyleProp<TextStyle>;
|
|
43
43
|
addIconContainerStyle?: StyleProp<ViewStyle>;
|
|
44
|
+
itemContainerStyle?: StyleProp<ViewStyle>;
|
|
44
45
|
delIcon?: ImageSourcePropType;
|
|
45
46
|
delIconStyle?: StyleProp<ImageStyle>;
|
|
46
47
|
/**外边距 */
|
|
@@ -51,6 +52,9 @@ export declare type MutiPictureViewProps = {
|
|
|
51
52
|
editable?: boolean;
|
|
52
53
|
/**这个属性会覆盖bind.viewModel.photos */
|
|
53
54
|
value?: (string | { uri: string })[];
|
|
55
|
+
/**default false 空视图占位 */
|
|
56
|
+
showEmptyPlaceHolder?: boolean;
|
|
57
|
+
emptyPlaceHolderStyle?: StyleProp<ViewStyle>;
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
|