@aks-dev/easyui 1.0.115 → 1.0.117

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-11-10 11:37:13
5
+ * @LastEditTime: 2022-11-10 15:22:00
6
6
  * @FilePath: /@aks-dev/easyui/lib/MutiPictureView/MutiPictureView.tsx
7
7
  */
8
8
 
@@ -28,11 +28,13 @@ const MutiPictureView: React.FC<MutiPictureViewProps> = (props) => {
28
28
  addIconStyle,
29
29
  addIconContainerStyle,//borderWidth: 1, borderStyle: 'dashed', borderColor: assets.color_A3A9CC 虚线框
30
30
  itemContainerStyle,
31
+ emptyPlaceHolderStyle,
31
32
  delIcon,
32
33
  delIconStyle,
33
34
  spacingHorizontal = px2dp(15),
34
35
  spacingInner = px2dp(8),
35
36
  editable = true,
37
+ showEmptyPlaceHolder = false
36
38
  } = props
37
39
  const { viewModel, setViewModel } = bind
38
40
  React.useEffect(() => {
@@ -114,7 +116,7 @@ const MutiPictureView: React.FC<MutiPictureViewProps> = (props) => {
114
116
  const ItemView: React.FC<{ source: ImageSourcePropType, index: number }> = ({ source, index }) => {
115
117
 
116
118
  return (
117
- <TouchableOpacity style={[styles.item_container,itemContainerStyle, {
119
+ <TouchableOpacity style={[styles.item_container, itemContainerStyle, {
118
120
  marginTop: index < 3 ? 0 : spacingInner,
119
121
  marginLeft: index % 3 == 0 ? spacingHorizontal : spacingInner,
120
122
  width: sideLength,
@@ -168,7 +170,7 @@ const MutiPictureView: React.FC<MutiPictureViewProps> = (props) => {
168
170
 
169
171
  {
170
172
  !(viewModel?.photos?.length == maxCount) && editable && (
171
- <TouchableOpacity style={[styles.item_container, itemContainerStyle,{
173
+ <TouchableOpacity style={[styles.item_container, itemContainerStyle, {
172
174
  marginTop: (viewModel?.photos?.length || 0) >= 3 ? spacingInner : 0,
173
175
  marginLeft: (viewModel?.photos?.length || 0) % 3 == 0 ? spacingHorizontal : spacingInner,
174
176
  width: sideLength,
@@ -180,6 +182,17 @@ const MutiPictureView: React.FC<MutiPictureViewProps> = (props) => {
180
182
 
181
183
  )
182
184
  }
185
+ {
186
+ showEmptyPlaceHolder && maxCount - (viewModel.photos?.length || 0) - 1 > 0 &&
187
+ Array.from({ length: maxCount - (viewModel.photos?.length || 0) - (editable?1:0) }, (_, k) =>
188
+ <View key={`sg-showEmptyPlaceHolder-${k}`} style={[styles.empty_place_container, emptyPlaceHolderStyle, itemContainerStyle, {
189
+ marginTop: k + (editable?1:0) + (viewModel.photos?.length || 0) > 2 ? spacingInner : 0,
190
+ marginLeft: (k + (editable?1:0) + (viewModel.photos?.length || 0)) % 3 == 0 ? spacingHorizontal : spacingInner,
191
+ width: sideLength,
192
+ height: sideLength,
193
+ }]} />
194
+ )
195
+ }
183
196
  </View >
184
197
 
185
198
  )
@@ -219,6 +232,12 @@ const styles = StyleSheet.create({
219
232
  width: px2dp(24),
220
233
  height: px2dp(24)
221
234
  },
235
+ empty_place_container: {
236
+ borderRadius: px2dp(10),
237
+ backgroundColor: '#ededed',
238
+ borderColor: '#cccccc',
239
+ borderWidth: .75,
240
+ }
222
241
  })
223
242
 
224
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-11-10 11:36:31
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'
@@ -52,6 +52,9 @@ export declare type MutiPictureViewProps = {
52
52
  editable?: boolean;
53
53
  /**这个属性会覆盖bind.viewModel.photos */
54
54
  value?: (string | { uri: string })[];
55
+ /**default false 空视图占位 */
56
+ showEmptyPlaceHolder?: boolean;
57
+ emptyPlaceHolderStyle?: StyleProp<ViewStyle>;
55
58
  }
56
59
 
57
60
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aks-dev/easyui",
3
- "version": "1.0.115",
3
+ "version": "1.0.117",
4
4
  "description": "工具箱",
5
5
  "main": "./src/index.ts",
6
6
  "typings": "./src/index.d.ts",