@aks-dev/easyui 1.0.163 → 1.1.2
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 +151 -0
- package/dist/components/DottedLine/DottedLine.js +50 -0
- package/{lib/Echarts/EchartsView.tsx → dist/components/EchartsView/EchartsView.js} +74 -113
- package/{lib/Echarts/helper.tsx → dist/components/EchartsView/helper.js} +17 -24
- package/dist/components/Hud/AlertBottomView/AlertBottomView.js +174 -0
- package/dist/components/Hud/AlertSheetView/AlertSheetView.js +117 -0
- package/dist/components/Hud/AlertView/AlertView.js +184 -0
- package/dist/components/Hud/Hud.js +29 -0
- package/dist/components/Hud/Loading/Loading.js +66 -0
- package/dist/components/Hud/PopoverView/PopoverView.js +47 -0
- package/dist/components/Hud/Scanner/Scanner.js +301 -0
- package/dist/components/Hud/Toast/Toast.js +71 -0
- package/dist/components/MenuView/MenuView.js +184 -0
- package/{lib/Modal/Modal.tsx → dist/components/Modal/Modal.js} +1 -4
- package/dist/components/MutiPictureView/MutiPictureView.js +239 -0
- package/dist/components/PictureViewer/PictureViewer.js +54 -0
- package/dist/components/RefreshList/RefreshList.js +155 -0
- package/dist/components/RichText/RichText.js +56 -0
- package/dist/components/StickHeaderView/StickHeaderView.js +37 -0
- package/dist/components/TableCell/TableCell.js +97 -0
- package/dist/components/TextInputArea/TextInputArea.js +65 -0
- package/dist/components/WithLoadingContainer/WithLoadingContainer.js +77 -0
- package/dist/index.js +31 -0
- package/dist/jsbridge/RNEasyui.js +46 -0
- package/{jsbridge/UpgradeModule.ts → dist/jsbridge/UpgradeModule.js} +25 -23
- package/{jsbridge/index.ts → dist/jsbridge/index.js} +2 -2
- package/{screen/index.ts → dist/screen/index.js} +2 -2
- package/dist/screen/px2dp.js +45 -0
- package/{screen/px2sp.ts → dist/screen/px2sp.js} +13 -20
- package/{screen/text-fit.ts → dist/screen/text-fit.js} +10 -20
- package/{utils/index.ts → dist/utils/index.js} +2 -2
- package/{utils/lazy.ts → dist/utils/lazy.js} +164 -165
- package/dist/utils/mode.js +50 -0
- package/package.json +31 -19
- package/readme.md +3 -3
- package/types/components/AnimationModal/AnimationModal.d.ts +27 -0
- package/types/components/AnimationModal/AnimationModal.d.ts.map +1 -0
- package/types/components/DottedLine/DottedLine.d.ts +10 -0
- package/types/components/DottedLine/DottedLine.d.ts.map +1 -0
- package/types/components/EchartsView/EchartsView.d.ts +10 -0
- package/types/components/EchartsView/EchartsView.d.ts.map +1 -0
- package/types/components/EchartsView/helper.d.ts +10 -0
- package/types/components/EchartsView/helper.d.ts.map +1 -0
- package/types/components/Hud/AlertBottomView/AlertBottomView.d.ts +25 -0
- package/types/components/Hud/AlertBottomView/AlertBottomView.d.ts.map +1 -0
- package/types/components/Hud/AlertSheetView/AlertSheetView.d.ts +19 -0
- package/types/components/Hud/AlertSheetView/AlertSheetView.d.ts.map +1 -0
- package/types/components/Hud/AlertView/AlertView.d.ts +25 -0
- package/types/components/Hud/AlertView/AlertView.d.ts.map +1 -0
- package/types/components/Hud/Hud.d.ts +11 -0
- package/types/components/Hud/Hud.d.ts.map +1 -0
- package/types/components/Hud/Loading/Loading.d.ts +11 -0
- package/types/components/Hud/Loading/Loading.d.ts.map +1 -0
- package/types/components/Hud/PopoverView/PopoverView.d.ts +17 -0
- package/types/components/Hud/PopoverView/PopoverView.d.ts.map +1 -0
- package/types/components/Hud/Scanner/Scanner.d.ts +12 -0
- package/types/components/Hud/Scanner/Scanner.d.ts.map +1 -0
- package/types/components/Hud/Toast/Toast.d.ts +9 -0
- package/types/components/Hud/Toast/Toast.d.ts.map +1 -0
- package/types/components/MenuView/MenuView.d.ts +21 -0
- package/types/components/MenuView/MenuView.d.ts.map +1 -0
- package/types/components/Modal/Modal.d.ts +2 -0
- package/types/components/Modal/Modal.d.ts.map +1 -0
- package/{lib/MutiPictureView/index.ts → types/components/MutiPictureView/MutiPictureView.d.ts} +18 -31
- package/types/components/MutiPictureView/MutiPictureView.d.ts.map +1 -0
- package/types/components/PictureViewer/PictureViewer.d.ts +17 -0
- package/types/components/PictureViewer/PictureViewer.d.ts.map +1 -0
- package/types/components/RefreshList/RefreshList.d.ts +45 -0
- package/types/components/RefreshList/RefreshList.d.ts.map +1 -0
- package/types/components/RichText/RichText.d.ts +12 -0
- package/types/components/RichText/RichText.d.ts.map +1 -0
- package/types/components/StickHeaderView/StickHeaderView.d.ts +15 -0
- package/types/components/StickHeaderView/StickHeaderView.d.ts.map +1 -0
- package/{lib/TableCell/index.ts → types/components/TableCell/TableCell.d.ts} +8 -30
- package/types/components/TableCell/TableCell.d.ts.map +1 -0
- package/types/components/TextInputArea/TextInputArea.d.ts +17 -0
- package/types/components/TextInputArea/TextInputArea.d.ts.map +1 -0
- package/types/components/WithLoadingContainer/WithLoadingContainer.d.ts +23 -0
- package/types/components/WithLoadingContainer/WithLoadingContainer.d.ts.map +1 -0
- package/types/index.d.ts +22 -0
- package/types/index.d.ts.map +1 -0
- package/types/jsbridge/RNEasyui.d.ts +23 -0
- package/types/jsbridge/RNEasyui.d.ts.map +1 -0
- package/types/jsbridge/UpgradeModule.d.ts +26 -0
- package/types/jsbridge/UpgradeModule.d.ts.map +1 -0
- package/types/jsbridge/index.d.ts +3 -0
- package/types/jsbridge/index.d.ts.map +1 -0
- package/types/screen/index.d.ts +3 -0
- package/types/screen/index.d.ts.map +1 -0
- package/{screen/index.d.ts → types/screen/px2dp.d.ts} +6 -12
- package/types/screen/px2dp.d.ts.map +1 -0
- package/types/screen/px2sp.d.ts +2 -0
- package/types/screen/px2sp.d.ts.map +1 -0
- package/types/screen/text-fit.d.ts +5 -0
- package/types/screen/text-fit.d.ts.map +1 -0
- package/types/utils/index.d.ts +3 -0
- package/types/utils/index.d.ts.map +1 -0
- package/{utils/index.d.ts → types/utils/lazy.d.ts} +15 -53
- package/types/utils/lazy.d.ts.map +1 -0
- package/types/utils/mode.d.ts +24 -0
- package/types/utils/mode.d.ts.map +1 -0
- 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
|
@@ -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
|
-
}
|
|
@@ -1,60 +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
|
-
const listRef = React.useRef<any>()
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
|
|
16
|
-
<RefreshList
|
|
17
|
-
mode='SectionList'
|
|
18
|
-
sections={
|
|
19
|
-
[
|
|
20
|
-
{
|
|
21
|
-
title: "Main dishes",
|
|
22
|
-
data: ["Pizza", "Burger", "Risotto"]
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
title: "Sides",
|
|
26
|
-
data: ["French Fries", "Onion Rings", "Fried Shrimps"]
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
title: "Drinks",
|
|
30
|
-
data: ["Water", "Coke", "Beer"]
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
title: "Desserts",
|
|
34
|
-
data: ["Cheese Cake", "Ice Cream"]
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
renderItem={({ item, section }) => {
|
|
39
|
-
|
|
40
|
-
return <View>{item}</View>
|
|
41
|
-
}}
|
|
42
|
-
|
|
43
|
-
refreshState={refreshState}
|
|
44
|
-
onHeaderRefresh={() => {
|
|
45
|
-
|
|
46
|
-
}}
|
|
47
|
-
onFooterRefresh={() => {
|
|
48
|
-
|
|
49
|
-
}}
|
|
50
|
-
|
|
51
|
-
renderSectionHeader={({ section: { letter } }) => (
|
|
52
|
-
<View style={{ backgroundColor: 'red' }}>
|
|
53
|
-
|
|
54
|
-
</View>
|
|
55
|
-
)}
|
|
56
|
-
/>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
)
|
|
60
|
-
}
|
|
@@ -1,46 +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
|
-
const listRef = React.useRef<any>()
|
|
13
|
-
const dataList = Array(20)
|
|
14
|
-
.fill("")
|
|
15
|
-
.map((_, i) => ({ key: `${i}`, text: `item #${i}` }))
|
|
16
|
-
// return (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// <RefreshList
|
|
21
|
-
// mode='SwipeList'
|
|
22
|
-
// ref={listRef}
|
|
23
|
-
// data={dataList}
|
|
24
|
-
// renderItem={(data, rowMap) => (
|
|
25
|
-
// <View >
|
|
26
|
-
// <Text>I am {data.item.text} in a SwipeListView</Text>
|
|
27
|
-
// </View>
|
|
28
|
-
// )}
|
|
29
|
-
// refreshState={refreshState}
|
|
30
|
-
// onHeaderRefresh={() => {
|
|
31
|
-
|
|
32
|
-
// }}
|
|
33
|
-
// onFooterRefresh={() => {
|
|
34
|
-
|
|
35
|
-
// }}
|
|
36
|
-
// renderHiddenItem={(data, rowMap) => (
|
|
37
|
-
// <TouchableOpacity onPress={() => {
|
|
38
|
-
// listRef.current?.safeCloseOpenRow()
|
|
39
|
-
// }}>
|
|
40
|
-
|
|
41
|
-
// </TouchableOpacity>
|
|
42
|
-
// )}
|
|
43
|
-
// />
|
|
44
|
-
|
|
45
|
-
// )
|
|
46
|
-
}
|
package/lib/RefreshList/index.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: your name
|
|
3
|
-
* @Date: 2022-04-20 14:56:05
|
|
4
|
-
* @LastEditTime: 2022-12-29 10:46:57
|
|
5
|
-
* @LastEditors: shiguo
|
|
6
|
-
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
7
|
-
* @FilePath: /@aks-dev/easyui/lib/RefreshList/index.ts
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import * as React from 'react'
|
|
11
|
-
|
|
12
|
-
import { FlatListProps, SectionListProps } from 'react-native'
|
|
13
|
-
import { IPropsSwipeListView } from 'react-native-swipe-list-view/types'
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// declare namespace easyui {
|
|
17
|
-
// type Mode = {
|
|
18
|
-
// FlatList
|
|
19
|
-
// SectionList
|
|
20
|
-
// SwipeList
|
|
21
|
-
// }
|
|
22
|
-
// }
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
type CommonProps = {
|
|
27
|
-
// mode: keyof easyui.Mode;
|
|
28
|
-
onHeaderRefresh: (info: any) => void;
|
|
29
|
-
onFooterRefresh: (info: any) => void;
|
|
30
|
-
reload: () => void;
|
|
31
|
-
refreshState: RefreshState;
|
|
32
|
-
renderListEmptyComponent: () => React.ReactElement;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
type SectionT = {
|
|
37
|
-
[key: string]: any;
|
|
38
|
-
};
|
|
39
|
-
type ItemT = any;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
export type FlatListRefreshProps = {
|
|
43
|
-
mode?: 'FlatList';
|
|
44
|
-
} & FlatListProps<ItemT> & Partial<CommonProps>;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export type SectionListRefreshProps = {
|
|
48
|
-
mode: 'SectionList';
|
|
49
|
-
|
|
50
|
-
} & SectionListProps<ItemT, SectionT> & Partial<CommonProps>;
|
|
51
|
-
|
|
52
|
-
export type SwipeListViewRefreshProps = {
|
|
53
|
-
mode: 'SwipeList';
|
|
54
|
-
data: ItemT[];
|
|
55
|
-
} & IPropsSwipeListView<ItemT> & Partial<CommonProps> & FlatListProps<ItemT> ;
|
|
56
|
-
|
|
57
|
-
export type RefreshListProps = FlatListRefreshProps | SwipeListViewRefreshProps | SectionListRefreshProps
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
export enum RefreshState {
|
|
61
|
-
Idle = 'Idle',
|
|
62
|
-
HeaderRefreshing = 'HeaderRefreshing',
|
|
63
|
-
FooterRefreshing = 'FooterRefreshing',
|
|
64
|
-
NoMoreData = 'NoMoreData',
|
|
65
|
-
Failure = 'Failure',
|
|
66
|
-
EmptyData = 'EmptyData',
|
|
67
|
-
None = 'None',
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
export const RefreshText = {
|
|
72
|
-
HeaderRefreshing: '上拉可以刷新',
|
|
73
|
-
FooterRefreshing: '下拉可以加载更多',
|
|
74
|
-
Failure: '服务器正在出小差,点击重新加载',
|
|
75
|
-
NoMoreData: '已经全部加载完毕',
|
|
76
|
-
EmptyData: '没有数据',
|
|
77
|
-
Idle: '正在加载更多的数据..',
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
export declare const RefreshList: React.FC<RefreshListProps>;
|
|
84
|
-
|
|
@@ -1,82 +0,0 @@
|
|
|
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
|
-
*/
|
|
8
|
-
import React from 'react'
|
|
9
|
-
import { StyleSheet, Text } from 'react-native'
|
|
10
|
-
import type { RichTextProps } from '.'
|
|
11
|
-
import { px2sp } from '../../screen/px2sp'
|
|
12
|
-
import * as utils from '../../utils/lazy'
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export default (props: RichTextProps) => {
|
|
18
|
-
const { rich, richStyle, text, suffix, prefix, ...rest } = props
|
|
19
|
-
let textStr = ''
|
|
20
|
-
let richStr = ''
|
|
21
|
-
if (utils.isString(text) || utils.isNumber(text)) {
|
|
22
|
-
textStr = String(text)
|
|
23
|
-
}
|
|
24
|
-
if (utils.isString(rich) || utils.isNumber(rich)) {
|
|
25
|
-
richStr = String(rich)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
let positionStart = 0
|
|
29
|
-
let positionEnd = 0
|
|
30
|
-
if (textStr?.indexOf(richStr) >= 0) {
|
|
31
|
-
positionStart = textStr.indexOf(richStr)
|
|
32
|
-
positionEnd = positionStart + richStr.length
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (prefix) {
|
|
36
|
-
return (
|
|
37
|
-
<Text style={styles.container} {...rest}>
|
|
38
|
-
<Text style={{ ...styles.defaultRich, ...richStyle }}>{richStr}</Text>
|
|
39
|
-
{textStr}
|
|
40
|
-
</Text>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (suffix) {
|
|
47
|
-
return (
|
|
48
|
-
<Text style={styles.container} {...rest}>
|
|
49
|
-
{textStr}
|
|
50
|
-
<Text style={{ ...styles.defaultRich, ...richStyle }}>{richStr}</Text>
|
|
51
|
-
</Text>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<Text style={styles.container} {...rest}>
|
|
58
|
-
{textStr.substring(0, positionStart)}
|
|
59
|
-
{
|
|
60
|
-
positionEnd > 0 &&
|
|
61
|
-
<Text style={{ ...styles.defaultRich, ...richStyle }}>{richStr}</Text>
|
|
62
|
-
}
|
|
63
|
-
{textStr.substring(positionEnd, textStr.length)}
|
|
64
|
-
</Text>
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const styles = StyleSheet.create({
|
|
73
|
-
container: {
|
|
74
|
-
color: '#333333',
|
|
75
|
-
fontSize: px2sp(14)
|
|
76
|
-
},
|
|
77
|
-
defaultRich: {
|
|
78
|
-
color: 'red',
|
|
79
|
-
fontSize: px2sp(14),
|
|
80
|
-
// fontWeight: 'bold'
|
|
81
|
-
}
|
|
82
|
-
})
|
package/lib/RichText/index.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: shiguo
|
|
3
|
-
* @Date: 2022-07-11 15:42:08
|
|
4
|
-
* @LastEditors: shiguo
|
|
5
|
-
* @LastEditTime: 2022-07-11 16:14:12
|
|
6
|
-
* @FilePath: /@aks-dev/easyui/lib/RichText/index.ts
|
|
7
|
-
*/
|
|
8
|
-
import react from 'react'
|
|
9
|
-
import { TextStyle, TextProps } from 'react-native'
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export type RichTextProps = {
|
|
13
|
-
rich?: string | number,
|
|
14
|
-
richStyle?: TextStyle,
|
|
15
|
-
text?: string | number,
|
|
16
|
-
suffix?: boolean,
|
|
17
|
-
prefix?: boolean,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export declare const RichText: react.FC<RichTextProps & TextProps>
|
|
@@ -1,65 +0,0 @@
|
|
|
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
|
-
*/
|
|
8
|
-
import * as React from 'react';
|
|
9
|
-
import { StyleSheet, Animated, LayoutChangeEvent } from "react-native";
|
|
10
|
-
|
|
11
|
-
import { StickHeaderViewProps } from '.'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const App: React.FC<StickHeaderViewProps> = (props) => {
|
|
16
|
-
|
|
17
|
-
const {
|
|
18
|
-
style,
|
|
19
|
-
children,
|
|
20
|
-
stickyHeaderY = -1,
|
|
21
|
-
stickyScrollY = new Animated.Value(0)
|
|
22
|
-
} = props
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const [stickyLayoutY, setStickyLayoutY] = React.useState(0)
|
|
26
|
-
|
|
27
|
-
// 兼容代码,防止没有传头部高度
|
|
28
|
-
const _onLayout = (event: LayoutChangeEvent) => {
|
|
29
|
-
setStickyLayoutY(event.nativeEvent.layout.y)
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const translateY = () => {
|
|
33
|
-
let y = stickyHeaderY !== -1 ? stickyHeaderY : stickyLayoutY;
|
|
34
|
-
return stickyScrollY.interpolate({
|
|
35
|
-
inputRange: [-1, 0, y, y + 1],
|
|
36
|
-
outputRange: [0, 0, 0, 1],
|
|
37
|
-
})
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<Animated.View
|
|
43
|
-
onLayout={_onLayout}
|
|
44
|
-
style={
|
|
45
|
-
[
|
|
46
|
-
style,
|
|
47
|
-
styles.container,
|
|
48
|
-
{ transform: [{ translateY: translateY() }] }
|
|
49
|
-
]}
|
|
50
|
-
>
|
|
51
|
-
|
|
52
|
-
{children}
|
|
53
|
-
|
|
54
|
-
</Animated.View>
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const styles = StyleSheet.create({
|
|
59
|
-
container: {
|
|
60
|
-
zIndex: 100
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
export default React.memo(App)
|