@aks-dev/easyui 1.0.163 → 1.1.5
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.d.ts +27 -0
- package/dist/components/AnimationModal/AnimationModal.d.ts.map +1 -0
- package/dist/components/AnimationModal/AnimationModal.js +151 -0
- package/dist/components/Badge/Badge.d.ts +8 -0
- package/dist/components/Badge/Badge.d.ts.map +1 -0
- package/dist/components/Badge/Badge.js +35 -0
- package/dist/components/DottedLine/DottedLine.d.ts +10 -0
- package/dist/components/DottedLine/DottedLine.d.ts.map +1 -0
- package/dist/components/DottedLine/DottedLine.js +50 -0
- package/dist/components/EchartsView/EchartsView.d.ts +10 -0
- package/dist/components/EchartsView/EchartsView.d.ts.map +1 -0
- package/{lib/Echarts/EchartsView.tsx → dist/components/EchartsView/EchartsView.js} +74 -113
- package/dist/components/EchartsView/helper.d.ts +10 -0
- package/dist/components/EchartsView/helper.d.ts.map +1 -0
- package/{lib/Echarts/helper.tsx → dist/components/EchartsView/helper.js} +17 -24
- package/dist/components/Hud/AlertBottomView/AlertBottomView.d.ts +25 -0
- package/dist/components/Hud/AlertBottomView/AlertBottomView.d.ts.map +1 -0
- package/dist/components/Hud/AlertBottomView/AlertBottomView.js +174 -0
- package/dist/components/Hud/AlertSheetView/AlertSheetView.d.ts +19 -0
- package/dist/components/Hud/AlertSheetView/AlertSheetView.d.ts.map +1 -0
- package/dist/components/Hud/AlertSheetView/AlertSheetView.js +117 -0
- package/dist/components/Hud/AlertView/AlertView.d.ts +25 -0
- package/dist/components/Hud/AlertView/AlertView.d.ts.map +1 -0
- package/dist/components/Hud/AlertView/AlertView.js +184 -0
- package/dist/components/Hud/Hud.d.ts +11 -0
- package/dist/components/Hud/Hud.d.ts.map +1 -0
- package/dist/components/Hud/Hud.js +29 -0
- package/dist/components/Hud/Loading/Loading.d.ts +11 -0
- package/dist/components/Hud/Loading/Loading.d.ts.map +1 -0
- package/dist/components/Hud/Loading/Loading.js +66 -0
- package/dist/components/Hud/PopoverView/PopoverView.d.ts +17 -0
- package/dist/components/Hud/PopoverView/PopoverView.d.ts.map +1 -0
- package/dist/components/Hud/PopoverView/PopoverView.js +47 -0
- package/dist/components/Hud/Scanner/Scanner.d.ts +12 -0
- package/dist/components/Hud/Scanner/Scanner.d.ts.map +1 -0
- package/dist/components/Hud/Scanner/Scanner.js +301 -0
- package/dist/components/Hud/Toast/Toast.d.ts +9 -0
- package/dist/components/Hud/Toast/Toast.d.ts.map +1 -0
- package/dist/components/Hud/Toast/Toast.js +71 -0
- package/dist/components/MenuView/MenuView.d.ts +21 -0
- package/dist/components/MenuView/MenuView.d.ts.map +1 -0
- package/dist/components/MenuView/MenuView.js +184 -0
- package/dist/components/Modal/Modal.d.ts +2 -0
- package/dist/components/Modal/Modal.d.ts.map +1 -0
- package/{lib/Modal/Modal.tsx → dist/components/Modal/Modal.js} +1 -4
- package/{lib/MutiPictureView/index.ts → dist/components/MutiPictureView/MutiPictureView.d.ts} +18 -31
- package/dist/components/MutiPictureView/MutiPictureView.d.ts.map +1 -0
- package/dist/components/MutiPictureView/MutiPictureView.js +243 -0
- package/dist/components/PictureViewer/PictureViewer.d.ts +17 -0
- package/dist/components/PictureViewer/PictureViewer.d.ts.map +1 -0
- package/dist/components/PictureViewer/PictureViewer.js +54 -0
- package/dist/components/RefreshList/RefreshList.d.ts +45 -0
- package/dist/components/RefreshList/RefreshList.d.ts.map +1 -0
- package/dist/components/RefreshList/RefreshList.js +155 -0
- package/dist/components/RichText/RichText.d.ts +12 -0
- package/dist/components/RichText/RichText.d.ts.map +1 -0
- package/dist/components/RichText/RichText.js +56 -0
- package/dist/components/StickHeaderView/StickHeaderView.d.ts +15 -0
- package/dist/components/StickHeaderView/StickHeaderView.d.ts.map +1 -0
- package/dist/components/StickHeaderView/StickHeaderView.js +37 -0
- package/{lib/TableCell/index.ts → dist/components/TableCell/TableCell.d.ts} +8 -30
- package/dist/components/TableCell/TableCell.d.ts.map +1 -0
- package/dist/components/TableCell/TableCell.js +97 -0
- package/dist/components/TextInputArea/TextInputArea.d.ts +17 -0
- package/dist/components/TextInputArea/TextInputArea.d.ts.map +1 -0
- package/dist/components/TextInputArea/TextInputArea.js +65 -0
- package/dist/components/WithLoadingContainer/WithLoadingContainer.d.ts +23 -0
- package/dist/components/WithLoadingContainer/WithLoadingContainer.d.ts.map +1 -0
- package/dist/components/WithLoadingContainer/WithLoadingContainer.js +77 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/jsbridge/RNEasyui.d.ts +23 -0
- package/dist/jsbridge/RNEasyui.d.ts.map +1 -0
- package/dist/jsbridge/RNEasyui.js +46 -0
- package/dist/jsbridge/UpgradeModule.d.ts +26 -0
- package/dist/jsbridge/UpgradeModule.d.ts.map +1 -0
- package/{jsbridge/UpgradeModule.ts → dist/jsbridge/UpgradeModule.js} +25 -23
- package/dist/jsbridge/index.d.ts +3 -0
- package/dist/jsbridge/index.d.ts.map +1 -0
- package/{jsbridge/index.ts → dist/jsbridge/index.js} +2 -2
- package/dist/screen/index.d.ts +3 -0
- package/dist/screen/index.d.ts.map +1 -0
- package/{screen/index.ts → dist/screen/index.js} +2 -2
- package/{screen/index.d.ts → dist/screen/px2dp.d.ts} +6 -12
- package/dist/screen/px2dp.d.ts.map +1 -0
- package/dist/screen/px2dp.js +45 -0
- package/dist/screen/px2sp.d.ts +2 -0
- package/dist/screen/px2sp.d.ts.map +1 -0
- package/{screen/px2sp.ts → dist/screen/px2sp.js} +13 -20
- package/dist/screen/text-fit.d.ts +5 -0
- package/dist/screen/text-fit.d.ts.map +1 -0
- package/{screen/text-fit.ts → dist/screen/text-fit.js} +10 -20
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/{utils/index.ts → dist/utils/index.js} +2 -2
- package/{utils/index.d.ts → dist/utils/lazy.d.ts} +15 -53
- package/dist/utils/lazy.d.ts.map +1 -0
- package/{utils/lazy.ts → dist/utils/lazy.js} +164 -165
- package/dist/utils/mode.d.ts +24 -0
- package/dist/utils/mode.d.ts.map +1 -0
- package/dist/utils/mode.js +50 -0
- package/package.json +32 -22
- package/readme.md +3 -3
- package/android/.DS_Store +0 -0
- package/android/src/.DS_Store +0 -0
- package/android/src/main/.DS_Store +0 -0
- package/android/src/main/java/.DS_Store +0 -0
- package/android/src/main/java/com/.DS_Store +0 -0
- package/android/src/main/java/com/easyui/.DS_Store +0 -0
- package/i.sh +0 -23
- package/ios/.DS_Store +0 -0
- package/ios/assets/.DS_Store +0 -0
- package/ios/views/.DS_Store +0 -0
- package/jsbridge/RNEasyui.ts +0 -42
- package/jsbridge/index.d.ts +0 -67
- package/lib/.DS_Store +0 -0
- package/lib/AnimationModal/AnimationModal.tsx +0 -201
- package/lib/AnimationModal/index.d.ts +0 -41
- package/lib/Badge/Badge.tsx +0 -40
- package/lib/Badge/index.ts +0 -21
- package/lib/DottedLine/DottedLine.tsx +0 -66
- package/lib/DottedLine/index.ts +0 -18
- package/lib/Echarts/demo.tsx +0 -235
- package/lib/Echarts/index.ts +0 -29
- package/lib/Hud/.DS_Store +0 -0
- package/lib/Hud/AlertBottomView/AlertBottomView.tsx +0 -228
- package/lib/Hud/AlertBottomView/index.d.ts +0 -42
- package/lib/Hud/AlertSheetView/AlertSheetView.tsx +0 -179
- package/lib/Hud/AlertSheetView/index.d.ts +0 -35
- package/lib/Hud/AlertView/AlertView.tsx +0 -234
- package/lib/Hud/AlertView/index.d.ts +0 -46
- package/lib/Hud/Hud.tsx +0 -67
- package/lib/Hud/Loading/Loading.tsx +0 -87
- package/lib/Hud/Loading/index.d.ts +0 -38
- package/lib/Hud/PopoverView/PopoverView.tsx +0 -66
- package/lib/Hud/PopoverView/index.d.ts +0 -39
- package/lib/Hud/Scanner/Scanner.tsx +0 -250
- package/lib/Hud/Scanner/index.d.ts +0 -42
- package/lib/Hud/Toast/Toast.tsx +0 -86
- package/lib/Hud/Toast/index.d.ts +0 -22
- package/lib/Hud/index.ts +0 -20
- package/lib/MenuView/MenuView.tsx +0 -252
- package/lib/MenuView/index.ts +0 -31
- package/lib/Modal/index.ts +0 -10
- package/lib/MutiPictureView/MutiPictureView.tsx +0 -259
- package/lib/PictureViewer/PictureViewer.tsx +0 -80
- package/lib/PictureViewer/index.ts +0 -26
- package/lib/RefreshList/RefreshList.tsx +0 -235
- package/lib/RefreshList/demo.tsx +0 -30
- package/lib/RefreshList/demo1.tsx +0 -60
- package/lib/RefreshList/demo2.tsx +0 -46
- package/lib/RefreshList/index.ts +0 -84
- package/lib/RichText/RichText.tsx +0 -82
- package/lib/RichText/index.ts +0 -21
- package/lib/StickHeaderView/StickHeaderView.tsx +0 -65
- package/lib/StickHeaderView/demo.tsx +0 -104
- package/lib/StickHeaderView/index.ts +0 -26
- package/lib/TableCell/TableCell.tsx +0 -118
- package/lib/TextInputArea/TextInputArea.tsx +0 -89
- package/lib/TextInputArea/index.d.ts +0 -33
- package/lib/WithLoadingContainer/WithLoadingContainer.tsx +0 -93
- package/lib/WithLoadingContainer/index.ts +0 -36
- package/screen/px2dp.ts +0 -51
- package/src/index.d.ts +0 -42
- package/src/index.ts +0 -54
- package/utils/mode.ts +0 -48
- /package/{lib/Hud/Scanner → dist/components/Hud/Scanner/assets}/flashlight-blue.png +0 -0
- /package/{lib/Hud/Scanner → dist/components/Hud/Scanner/assets}/flashlight-white.png +0 -0
- /package/{lib/Hud/Scanner → dist/components/Hud/Scanner/assets}/icon_back_white.png +0 -0
- /package/{lib/MutiPictureView → dist/components/MutiPictureView/assets}/icon_add_image.png +0 -0
- /package/{lib/MutiPictureView → dist/components/MutiPictureView/assets}/icon_del_image.png +0 -0
- /package/{lib/TableCell → dist/components/TableCell/assets}/back.png +0 -0
- /package/{lib/WithLoadingContainer → dist/components/WithLoadingContainer/assets}/loading.gif +0 -0
- /package/{lib/WithLoadingContainer → dist/components/WithLoadingContainer/assets}/loading3.gif +0 -0
- /package/{lib → dist/components}/index.md +0 -0
package/lib/MenuView/index.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: shiguo
|
|
3
|
-
* @Date: 2022-07-14 18:09:02
|
|
4
|
-
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2023-01-03 17:30:04
|
|
6
|
-
* @FilePath: /@aks-dev/easyui/lib/MenuView/index.ts
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import React from "react";
|
|
10
|
-
import { ImageSourcePropType, StyleProp, ViewStyle, TouchableOpacityProps } from 'react-native';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export type MenuItem = {
|
|
15
|
-
text: string;
|
|
16
|
-
icon?: ImageSourcePropType;
|
|
17
|
-
extra?: any
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type MenuProps = {
|
|
21
|
-
defaultAlignVertical?: 'bottom' | 'top';
|
|
22
|
-
defaultAlignHorizontal?: 'left' | 'right';
|
|
23
|
-
style?: StyleProp<ViewStyle> | undefined;
|
|
24
|
-
data?: MenuItem[];
|
|
25
|
-
onItemClick?: (index: number, extra?: any) => void;
|
|
26
|
-
onContainerClick?:Function;
|
|
27
|
-
activeOpacity?:number;
|
|
28
|
-
} & Readonly<{ children?: React.ReactNode | undefined }> & TouchableOpacityProps
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export declare const MenuView: React.FC<MenuProps>;
|
package/lib/Modal/index.ts
DELETED
|
@@ -1,259 +0,0 @@
|
|
|
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
|
-
*/
|
|
8
|
-
|
|
9
|
-
import * as React from 'react'
|
|
10
|
-
import { Image, View, StyleSheet, Keyboard, ImageSourcePropType, TouchableOpacity, MeasureOnSuccessCallback, Text } from 'react-native'
|
|
11
|
-
import { px2dp } from '../../screen/px2dp'
|
|
12
|
-
import { px2sp } from '../../screen/px2sp'
|
|
13
|
-
|
|
14
|
-
import SYImagePicker from "@aks-dev/react-native-syan-image-picker";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import type { MutiPictureViewProps } from '.'
|
|
18
|
-
|
|
19
|
-
let icon_add_image = require('./icon_add_image.png')
|
|
20
|
-
let icon_del_image = require('./icon_del_image.png')
|
|
21
|
-
|
|
22
|
-
const MutiPictureView: React.FC<MutiPictureViewProps> = (props) => {
|
|
23
|
-
const {
|
|
24
|
-
bind,
|
|
25
|
-
maxCount = 6,
|
|
26
|
-
type = 'showImagePicker',
|
|
27
|
-
addIcon,
|
|
28
|
-
addIconStyle,
|
|
29
|
-
addIconContainerStyle,//borderWidth: 1, borderStyle: 'dashed', borderColor: assets.color_A3A9CC 虚线框
|
|
30
|
-
itemContainerStyle,
|
|
31
|
-
emptyPlaceHolderStyle,
|
|
32
|
-
delIcon,
|
|
33
|
-
delIconStyle,
|
|
34
|
-
spacingHorizontal = px2dp(15),
|
|
35
|
-
spacingInner = px2dp(8),
|
|
36
|
-
editable = true,
|
|
37
|
-
showEmptyPlaceHolder = false
|
|
38
|
-
} = props
|
|
39
|
-
const { viewModel, setViewModel } = bind
|
|
40
|
-
React.useEffect(() => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}, [])
|
|
44
|
-
|
|
45
|
-
const [sideLength, setSideLength] = React.useState<number>(0)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const addPhoto = () => {
|
|
50
|
-
let images: any[] = viewModel.photos || []
|
|
51
|
-
if (!images) {
|
|
52
|
-
throw new Error("viewModel没有定义photos字段")
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (type == 'showImagePicker') {
|
|
56
|
-
SYImagePicker.showImagePicker({ imageCount: maxCount - (viewModel.photos?.length || 0), isCrop: false, isRecordSelected: false, quality: 20 }, (err, photos) => {
|
|
57
|
-
if (!err) {
|
|
58
|
-
let imgs = photos.map((it) => { return { uri: it.uri } })
|
|
59
|
-
images = images.concat(imgs)
|
|
60
|
-
setViewModel({ photos: images })
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (type == 'openCamera') {
|
|
66
|
-
SYImagePicker.openCamera({ imageCount: maxCount - (viewModel.photos?.length || 0), isCrop: false, isRecordSelected: false, quality: 20 }, (err, photos) => {
|
|
67
|
-
if (!err) {
|
|
68
|
-
let imgs = photos.map((it) => { return { uri: it.uri } })
|
|
69
|
-
images = images.concat(imgs)
|
|
70
|
-
setViewModel({ photos: images })
|
|
71
|
-
} else {
|
|
72
|
-
console.log('打开相机失败')
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const deletePhoto = (index: number) => {
|
|
82
|
-
Keyboard.dismiss()
|
|
83
|
-
let photos = [...viewModel.photos || []]
|
|
84
|
-
photos.splice(index, 1)
|
|
85
|
-
setViewModel({ photos: photos })
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const showPhoto = (index: number) => {
|
|
89
|
-
Keyboard.dismiss()
|
|
90
|
-
let imgs: any[] = (props.value || viewModel.photos)?.filter((it) => { return (typeof it === 'string' && it.indexOf('http') >= 0) || typeof it == 'object' }) || []
|
|
91
|
-
let images: any[] = []
|
|
92
|
-
// console.log('viewModel', viewModel, imgs)
|
|
93
|
-
imgs.forEach(it => {
|
|
94
|
-
if (typeof it === 'string') {
|
|
95
|
-
images.push({ uri: it })
|
|
96
|
-
} else {
|
|
97
|
-
images.push(it)
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
setViewModel({
|
|
101
|
-
imageViewer: {
|
|
102
|
-
imageUrls: images.map((it) => {
|
|
103
|
-
return it.uri
|
|
104
|
-
}),
|
|
105
|
-
index: index,
|
|
106
|
-
visible: true,
|
|
107
|
-
}
|
|
108
|
-
})
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const ItemView: React.FC<{ source: ImageSourcePropType, index: number }> = ({ source, index }) => {
|
|
117
|
-
|
|
118
|
-
return (
|
|
119
|
-
<TouchableOpacity style={[styles.item_container, itemContainerStyle, {
|
|
120
|
-
marginTop: index < 3 ? 0 : spacingInner,
|
|
121
|
-
marginLeft: index % 3 == 0 ? spacingHorizontal : spacingInner,
|
|
122
|
-
width: sideLength,
|
|
123
|
-
height: sideLength,
|
|
124
|
-
}]} activeOpacity={0.8} onPress={() => showPhoto(index)}>
|
|
125
|
-
<Image source={source} style={{ width: '100%', height: '100%' }} resizeMode='cover' />
|
|
126
|
-
{
|
|
127
|
-
editable && !props.value &&
|
|
128
|
-
<TouchableOpacity onPress={() => deletePhoto(index)} style={[styles.del_img_container, delIconStyle]}>
|
|
129
|
-
<Image source={delIcon ? delIcon : icon_del_image} resizeMode='contain' style={{ width: '100%', height: '100%' }} />
|
|
130
|
-
</TouchableOpacity>
|
|
131
|
-
}
|
|
132
|
-
</TouchableOpacity>
|
|
133
|
-
)
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const containerRef = React.useRef<{ measure: (callback: MeasureOnSuccessCallback) => void }>()
|
|
141
|
-
|
|
142
|
-
React.useEffect(() => {
|
|
143
|
-
containerRef.current?.measure((...args) => {
|
|
144
|
-
// console.log('measure', args[2])
|
|
145
|
-
if (args.length > 3) {
|
|
146
|
-
let _sideLength = +((args[2] - spacingHorizontal * 2 - spacingInner * 2) / 3).toFixed(1);
|
|
147
|
-
setSideLength(_sideLength - 0.1)
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
})
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (props.value && props.value?.length > 0) {
|
|
156
|
-
return (
|
|
157
|
-
<View style={[styles.container, props.style]} ref={containerRef as any}>
|
|
158
|
-
{props.value instanceof Array && props.value?.map((item, index) => {
|
|
159
|
-
return <ItemView key={index} source={typeof item === 'string' ? { uri: item } : item} index={index} />
|
|
160
|
-
})}
|
|
161
|
-
|
|
162
|
-
{
|
|
163
|
-
showEmptyPlaceHolder && maxCount - (props.value?.length || 0) - 1 > 0 &&
|
|
164
|
-
Array.from({ length: maxCount - (props.value?.length || 0) - (editable ? 1 : 0) }, (_, k) =>
|
|
165
|
-
<View key={`sg-showEmptyPlaceHolder-${k}`} style={[styles.empty_place_container, emptyPlaceHolderStyle, itemContainerStyle, {
|
|
166
|
-
marginTop: k + (editable ? 1 : 0) + (props.value?.length || 0) > 2 ? spacingInner : 0,
|
|
167
|
-
marginLeft: (k + (editable ? 1 : 0) + (props.value?.length || 0)) % 3 == 0 ? spacingHorizontal : spacingInner,
|
|
168
|
-
width: sideLength,
|
|
169
|
-
height: sideLength,
|
|
170
|
-
}]} />
|
|
171
|
-
)
|
|
172
|
-
}
|
|
173
|
-
</View >
|
|
174
|
-
)
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return (
|
|
178
|
-
<View style={[styles.container, props.style]} ref={containerRef as any}>
|
|
179
|
-
{viewModel?.photos instanceof Array && viewModel.photos.map((item, index) => {
|
|
180
|
-
return <ItemView key={index} source={typeof item === 'string' ? { uri: item } : item} index={index} />
|
|
181
|
-
})}
|
|
182
|
-
|
|
183
|
-
{
|
|
184
|
-
!(viewModel?.photos?.length == maxCount) && editable && (
|
|
185
|
-
<TouchableOpacity style={[styles.item_container, itemContainerStyle, {
|
|
186
|
-
marginTop: (viewModel?.photos?.length || 0) >= 3 ? spacingInner : 0,
|
|
187
|
-
marginLeft: (viewModel?.photos?.length || 0) % 3 == 0 ? spacingHorizontal : spacingInner,
|
|
188
|
-
width: sideLength,
|
|
189
|
-
height: sideLength,
|
|
190
|
-
}, addIconContainerStyle]} activeOpacity={0.8} onPress={() => addPhoto()}>
|
|
191
|
-
<Image source={addIcon ? addIcon : icon_add_image} style={[{ width: '25%', height: '25%' }, addIconStyle]} resizeMode='contain' />
|
|
192
|
-
{props.addText && <Text style={[{ fontSize: px2sp(12), color: 'lightgrey', marginTop: px2dp(2) }, props.addTextStyle]}>{props.addText}</Text>}
|
|
193
|
-
</TouchableOpacity>
|
|
194
|
-
|
|
195
|
-
)
|
|
196
|
-
}
|
|
197
|
-
{
|
|
198
|
-
showEmptyPlaceHolder && maxCount - (viewModel.photos?.length || 0) - 1 > 0 &&
|
|
199
|
-
Array.from({ length: maxCount - (viewModel.photos?.length || 0) - (editable ? 1 : 0) }, (_, k) =>
|
|
200
|
-
<View key={`sg-showEmptyPlaceHolder-${k}`} style={[styles.empty_place_container, emptyPlaceHolderStyle, itemContainerStyle, {
|
|
201
|
-
marginTop: k + (editable ? 1 : 0) + (viewModel.photos?.length || 0) > 2 ? spacingInner : 0,
|
|
202
|
-
marginLeft: (k + (editable ? 1 : 0) + (viewModel.photos?.length || 0)) % 3 == 0 ? spacingHorizontal : spacingInner,
|
|
203
|
-
width: sideLength,
|
|
204
|
-
height: sideLength,
|
|
205
|
-
}]} />
|
|
206
|
-
)
|
|
207
|
-
}
|
|
208
|
-
</View >
|
|
209
|
-
|
|
210
|
-
)
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const styles = StyleSheet.create({
|
|
221
|
-
container: {
|
|
222
|
-
flex: 1,
|
|
223
|
-
minHeight: 1,
|
|
224
|
-
backgroundColor: 'transparent',
|
|
225
|
-
display: 'flex',
|
|
226
|
-
flexDirection: 'row',
|
|
227
|
-
flexWrap: 'wrap',
|
|
228
|
-
// borderRadius: px2dp(10),
|
|
229
|
-
},
|
|
230
|
-
item_container: {
|
|
231
|
-
overflow: 'hidden',
|
|
232
|
-
borderRadius: px2dp(10),
|
|
233
|
-
display: 'flex',
|
|
234
|
-
position: 'relative',
|
|
235
|
-
justifyContent: 'center',
|
|
236
|
-
alignItems: 'center',
|
|
237
|
-
backgroundColor: '#ededed',
|
|
238
|
-
},
|
|
239
|
-
|
|
240
|
-
del_img_container: {
|
|
241
|
-
position: 'absolute',
|
|
242
|
-
right: 2,
|
|
243
|
-
top: 2,
|
|
244
|
-
width: px2dp(24),
|
|
245
|
-
height: px2dp(24)
|
|
246
|
-
},
|
|
247
|
-
empty_place_container: {
|
|
248
|
-
borderRadius: px2dp(10),
|
|
249
|
-
backgroundColor: '#ededed',
|
|
250
|
-
borderColor: '#cccccc',
|
|
251
|
-
borderWidth: .75,
|
|
252
|
-
}
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
export default React.memo(MutiPictureView, (prevProps, nextProps) => false);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
@@ -1,80 +0,0 @@
|
|
|
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
|
-
*/
|
|
8
|
-
|
|
9
|
-
import * as React from 'react'
|
|
10
|
-
import { Modal, StatusBar, Platform } from 'react-native'
|
|
11
|
-
import ImageViewer from "react-native-image-zoom-viewer";
|
|
12
|
-
|
|
13
|
-
import type { BindProps } from './index'
|
|
14
|
-
|
|
15
|
-
export const PictureViewer: React.FC<{ bind: BindProps }> = ({ bind }) => {
|
|
16
|
-
|
|
17
|
-
const { viewModel, setViewModel } = bind
|
|
18
|
-
const visible = viewModel.imageViewer.visible
|
|
19
|
-
const imgs = viewModel.imageViewer.imageUrls?.map(item => ({ url: item }))
|
|
20
|
-
const index = viewModel.imageViewer.index
|
|
21
|
-
|
|
22
|
-
React.useEffect(() => {
|
|
23
|
-
if (Platform.OS == 'android') {
|
|
24
|
-
if (visible) {
|
|
25
|
-
StatusBar.setBackgroundColor('black')
|
|
26
|
-
StatusBar.setBarStyle('light-content')
|
|
27
|
-
} else {
|
|
28
|
-
StatusBar.setBackgroundColor('transparent')
|
|
29
|
-
StatusBar.setBarStyle('dark-content')
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}, [visible])
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<Modal
|
|
38
|
-
presentationStyle='overFullScreen'
|
|
39
|
-
visible={visible}
|
|
40
|
-
transparent={false}
|
|
41
|
-
onRequestClose={() => {
|
|
42
|
-
/**
|
|
43
|
-
* 【官方文档】
|
|
44
|
-
* onRequestClose回调会在用户按下 Android 设备上的后退按键或是 Apple TV 上的菜单键时触发。
|
|
45
|
-
* 请务必注意本属性在 Android 平台上为必填,且会在 modal 处于开启状态时阻止BackHandler事件。
|
|
46
|
-
*/
|
|
47
|
-
setViewModel({
|
|
48
|
-
imageViewer: {
|
|
49
|
-
...viewModel.imageViewer,
|
|
50
|
-
visible: false
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
}}
|
|
54
|
-
style={{ margin: 0, backgroundColor: 'red' }}
|
|
55
|
-
>
|
|
56
|
-
<ImageViewer
|
|
57
|
-
imageUrls={imgs}
|
|
58
|
-
index={index}
|
|
59
|
-
onSwipeDown={() => {
|
|
60
|
-
// console.log('onSwipeDown');
|
|
61
|
-
}}
|
|
62
|
-
saveToLocalByLongPress={false}
|
|
63
|
-
// onMove={data => console.log(data)}
|
|
64
|
-
useNativeDriver={true}
|
|
65
|
-
enableSwipeDown={true}
|
|
66
|
-
onClick={() => {
|
|
67
|
-
setViewModel({
|
|
68
|
-
imageViewer: {
|
|
69
|
-
...viewModel.imageViewer,
|
|
70
|
-
visible: false
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
}}
|
|
74
|
-
/>
|
|
75
|
-
</Modal>
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: shiguo
|
|
3
|
-
* @Date: 2022-04-24 17:10:21
|
|
4
|
-
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-04-26 11:35:20
|
|
6
|
-
* @FilePath: /@aks/easy/lib/PictureViewer/index.ts
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type ViewModelProps = {
|
|
11
|
-
imageViewer: {
|
|
12
|
-
imageUrls: any[],
|
|
13
|
-
index: number,
|
|
14
|
-
visible: boolean
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export type BindProps = {
|
|
20
|
-
viewModel: ViewModelProps,
|
|
21
|
-
setViewModel: (intent: Partial<ViewModelProps>) => void
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export declare const PictureViewer: React.FC<{ bind: BindProps }>;
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { View, Text, Animated, StyleSheet, ActivityIndicator, TouchableOpacity } from 'react-native';
|
|
3
|
-
import { SwipeListView, RowMap } from 'react-native-swipe-list-view'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
FlatListRefreshProps,
|
|
9
|
-
SectionListRefreshProps,
|
|
10
|
-
SwipeListViewRefreshProps,
|
|
11
|
-
RefreshListProps,
|
|
12
|
-
RefreshState,
|
|
13
|
-
RefreshText
|
|
14
|
-
} from './index'
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export default React.forwardRef((props: RefreshListProps, ref: React.Ref<any>) => {
|
|
20
|
-
const {
|
|
21
|
-
mode = 'FlatList',
|
|
22
|
-
refreshState,
|
|
23
|
-
onHeaderRefresh,
|
|
24
|
-
onFooterRefresh,
|
|
25
|
-
reload,
|
|
26
|
-
...rest
|
|
27
|
-
} = props
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const seed = React.useRef(Math.random()).current
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
let onRefresh = () => {
|
|
34
|
-
if (refreshState == RefreshState.HeaderRefreshing) return
|
|
35
|
-
if (refreshState == RefreshState.FooterRefreshing) return
|
|
36
|
-
onHeaderRefresh && onHeaderRefresh(RefreshState.HeaderRefreshing)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
let onEndReached = (info: unknown) => {
|
|
40
|
-
|
|
41
|
-
if (mode == 'FlatList') {
|
|
42
|
-
props = props as FlatListRefreshProps;
|
|
43
|
-
if (!(props.data instanceof Array)) {
|
|
44
|
-
throw new Error('[sg:FlatList] data is not Array')
|
|
45
|
-
}
|
|
46
|
-
if (props.data.length == 0) return
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (mode == 'SectionList') {
|
|
50
|
-
props = props as SectionListRefreshProps;
|
|
51
|
-
if (!(props.sections instanceof Array)) {
|
|
52
|
-
throw new Error('[sg:SectionList] sections is not Array')
|
|
53
|
-
}
|
|
54
|
-
if (props.sections.length == 0) return
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (refreshState != RefreshState.Idle) return
|
|
58
|
-
onFooterRefresh && onFooterRefresh(RefreshState.FooterRefreshing)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
switch (mode) {
|
|
64
|
-
case 'FlatList':
|
|
65
|
-
let flatListProps: FlatListRefreshProps = props as FlatListRefreshProps
|
|
66
|
-
return (
|
|
67
|
-
<Animated.FlatList
|
|
68
|
-
{...rest as FlatListRefreshProps}
|
|
69
|
-
ref={ref}
|
|
70
|
-
refreshing={refreshState == RefreshState.HeaderRefreshing}
|
|
71
|
-
keyExtractor={(_, index) => { return `sg-index-FlatList-${seed}-${index}` }}
|
|
72
|
-
contentContainerStyle={flatListProps.data?.length ? {} : { height: "100%" }}
|
|
73
|
-
onRefresh={onRefresh}
|
|
74
|
-
onEndReachedThreshold={0.1}
|
|
75
|
-
onEndReached={onEndReached}
|
|
76
|
-
showsVerticalScrollIndicator={false}
|
|
77
|
-
ListHeaderComponent={(_) => (
|
|
78
|
-
<View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
79
|
-
<ListHeaderComponent {...flatListProps} />
|
|
80
|
-
{flatListProps.ListHeaderComponent}
|
|
81
|
-
</View>
|
|
82
|
-
)}
|
|
83
|
-
ListFooterComponent={(_) => <ListFooterComponent {...flatListProps} />}
|
|
84
|
-
|
|
85
|
-
/>
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
case 'SectionList':
|
|
89
|
-
let sectionListProps: SectionListRefreshProps = props as SectionListRefreshProps;
|
|
90
|
-
const { ItemSeparatorComponent = (_) => (
|
|
91
|
-
<View style={{ height: 1 }} />
|
|
92
|
-
) } = sectionListProps
|
|
93
|
-
return (
|
|
94
|
-
<Animated.SectionList
|
|
95
|
-
{...rest as SectionListRefreshProps}
|
|
96
|
-
ref={ref}
|
|
97
|
-
refreshing={refreshState == RefreshState.HeaderRefreshing}
|
|
98
|
-
onRefresh={onRefresh}
|
|
99
|
-
keyExtractor={(_, index) => { return `sg-index-SectionList-${seed}-${index}` }}
|
|
100
|
-
contentContainerStyle={sectionListProps.sections?.length > 0 ? {} : { height: "100%" }}
|
|
101
|
-
ItemSeparatorComponent={ItemSeparatorComponent}
|
|
102
|
-
onEndReachedThreshold={0.1}
|
|
103
|
-
onEndReached={onEndReached}
|
|
104
|
-
showsVerticalScrollIndicator={false}
|
|
105
|
-
// ListHeaderComponent={(_) => <ListHeaderComponent {...sectionListProps} />}
|
|
106
|
-
ListHeaderComponent={(_) => (
|
|
107
|
-
<View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
108
|
-
<ListHeaderComponent {...flatListProps} />
|
|
109
|
-
{sectionListProps.ListHeaderComponent}
|
|
110
|
-
</View>
|
|
111
|
-
)}
|
|
112
|
-
ListFooterComponent={(_) => <ListFooterComponent {...sectionListProps} />}
|
|
113
|
-
renderSectionHeader={sectionListProps.renderSectionHeader}
|
|
114
|
-
/>
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
case 'SwipeList':
|
|
118
|
-
let swipeListProps: SwipeListViewRefreshProps = props as SwipeListViewRefreshProps
|
|
119
|
-
const { renderHiddenItem = (data, rowMap) => (
|
|
120
|
-
<View style={{ backgroundColor: 'red', height: '100%', alignItems: 'flex-end', justifyContent: "center" }}>
|
|
121
|
-
<Text>Right </Text>
|
|
122
|
-
</View>
|
|
123
|
-
) } = swipeListProps
|
|
124
|
-
return (
|
|
125
|
-
<SwipeListView
|
|
126
|
-
{...rest as SwipeListViewRefreshProps}
|
|
127
|
-
rightOpenValue={-100}
|
|
128
|
-
leftOpenValue={0}
|
|
129
|
-
ref={ref}
|
|
130
|
-
disableLeftSwipe={false}
|
|
131
|
-
disableRightSwipe={true}
|
|
132
|
-
onRefresh={onRefresh}
|
|
133
|
-
refreshing={refreshState == RefreshState.HeaderRefreshing}
|
|
134
|
-
ItemSeparatorComponent={ItemSeparatorComponent}
|
|
135
|
-
onEndReachedThreshold={0.1}
|
|
136
|
-
onEndReached={onEndReached}
|
|
137
|
-
showsVerticalScrollIndicator={false}
|
|
138
|
-
ListHeaderComponent={(_) => (
|
|
139
|
-
<View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
140
|
-
<ListHeaderComponent {...flatListProps} />
|
|
141
|
-
{swipeListProps.ListHeaderComponent}
|
|
142
|
-
</View>
|
|
143
|
-
)}
|
|
144
|
-
ListFooterComponent={(args) => <ListFooterComponent {...swipeListProps} />}
|
|
145
|
-
renderHiddenItem={renderHiddenItem}
|
|
146
|
-
/>
|
|
147
|
-
|
|
148
|
-
)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const ListFooterComponent = React.memo((props: RefreshListProps) => {
|
|
160
|
-
const {
|
|
161
|
-
refreshState,
|
|
162
|
-
reload,
|
|
163
|
-
} = props
|
|
164
|
-
|
|
165
|
-
switch (refreshState) {
|
|
166
|
-
case RefreshState.Idle:
|
|
167
|
-
case RefreshState.FooterRefreshing:
|
|
168
|
-
return (
|
|
169
|
-
<View style={{ ...styles.container, flexDirection: 'row' }}>
|
|
170
|
-
<ActivityIndicator color={'gray'} />
|
|
171
|
-
<Text style={{ ...styles.text, marginLeft: 5 }}>{RefreshText.FooterRefreshing}</Text>
|
|
172
|
-
</View>
|
|
173
|
-
)
|
|
174
|
-
case RefreshState.NoMoreData:
|
|
175
|
-
return (
|
|
176
|
-
<View style={styles.container}>
|
|
177
|
-
<Text style={{ ...styles.text, color: '#999999' }}>{RefreshText.NoMoreData}</Text>
|
|
178
|
-
</View>
|
|
179
|
-
)
|
|
180
|
-
case RefreshState.Failure:
|
|
181
|
-
return (
|
|
182
|
-
<View style={styles.container}>
|
|
183
|
-
<TouchableOpacity onPress={() => reload && reload()}>
|
|
184
|
-
<Text style={styles.text}>{RefreshText.Failure}</Text>
|
|
185
|
-
</TouchableOpacity>
|
|
186
|
-
</View>
|
|
187
|
-
)
|
|
188
|
-
case RefreshState.EmptyData:
|
|
189
|
-
if (props.renderListEmptyComponent) return props.renderListEmptyComponent()
|
|
190
|
-
return (
|
|
191
|
-
<View style={styles.container}>
|
|
192
|
-
<TouchableOpacity onPress={() => reload && reload()}>
|
|
193
|
-
<Text style={styles.text}>{RefreshText.EmptyData}</Text>
|
|
194
|
-
</TouchableOpacity>
|
|
195
|
-
</View>
|
|
196
|
-
)
|
|
197
|
-
default:
|
|
198
|
-
return <View />
|
|
199
|
-
}
|
|
200
|
-
})
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const ListHeaderComponent = React.memo((props: RefreshListProps) => {
|
|
204
|
-
const { refreshState } = props
|
|
205
|
-
switch (refreshState) {
|
|
206
|
-
case RefreshState.HeaderRefreshing:
|
|
207
|
-
return (
|
|
208
|
-
<View style={{ ...styles.container, }}>
|
|
209
|
-
<Text style={{ ...styles.text, }}>{RefreshText.HeaderRefreshing}</Text>
|
|
210
|
-
</View>
|
|
211
|
-
)
|
|
212
|
-
default:
|
|
213
|
-
return <View />
|
|
214
|
-
}
|
|
215
|
-
})
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const styles = StyleSheet.create({
|
|
221
|
-
container: {
|
|
222
|
-
display: 'flex',
|
|
223
|
-
flexDirection: 'column',
|
|
224
|
-
justifyContent: "center",
|
|
225
|
-
alignItems: 'center',
|
|
226
|
-
height: 44,
|
|
227
|
-
// backgroundColor:'cyan'
|
|
228
|
-
},
|
|
229
|
-
text: {
|
|
230
|
-
color: 'gray',
|
|
231
|
-
lineHeight: 16,
|
|
232
|
-
fontSize: 13,
|
|
233
|
-
},
|
|
234
|
-
})
|
|
235
|
-
|
package/lib/RefreshList/demo.tsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import { View, TouchableOpacity, Text } from 'react-native'
|
|
3
|
-
|
|
4
|
-
import { RefreshList, RefreshState } from './index'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const App = () => {
|
|
9
|
-
|
|
10
|
-
const [refreshState, setRefreshState] = React.useState(RefreshState.Idle)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<RefreshList
|
|
15
|
-
data={['a', 'b']}
|
|
16
|
-
renderItem={({ item, index }) => {
|
|
17
|
-
|
|
18
|
-
return <View>{item}</View>
|
|
19
|
-
}}
|
|
20
|
-
|
|
21
|
-
refreshState={refreshState}
|
|
22
|
-
onHeaderRefresh={() => {
|
|
23
|
-
|
|
24
|
-
}}
|
|
25
|
-
onFooterRefresh={() => {
|
|
26
|
-
|
|
27
|
-
}}
|
|
28
|
-
/>
|
|
29
|
-
)
|
|
30
|
-
}
|