@aks-dev/easyui 1.0.10

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.
Files changed (66) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +35 -0
  3. package/android/build.gradle +44 -0
  4. package/android/src/main/AndroidManifest.xml +20 -0
  5. package/android/src/main/java/com/easyui/RNEasyuiModule.java +29 -0
  6. package/android/src/main/java/com/easyui/RNEasyuiPackage.java +38 -0
  7. package/android/src/main/java/com/easyui/UpgradeModule.java +54 -0
  8. package/ios/RNEasyui.h +18 -0
  9. package/ios/RNEasyui.m +13 -0
  10. package/ios/RNEasyui.podspec +24 -0
  11. package/ios/RNEasyui.xcodeproj/project.pbxproj +259 -0
  12. package/ios/RNEasyui.xcworkspace/contents.xcworkspacedata +9 -0
  13. package/ios/UpgradeModule.h +12 -0
  14. package/ios/UpgradeModule.m +38 -0
  15. package/jsbridge/RNEasyui.tsx +13 -0
  16. package/jsbridge/UpgradeModule.tsx +13 -0
  17. package/jsbridge/index.ts +13 -0
  18. package/lib/Badge/Badge.tsx +39 -0
  19. package/lib/Badge/index.ts +21 -0
  20. package/lib/Easy-Hud/AlertView/AlertView.tsx +233 -0
  21. package/lib/Easy-Hud/AlertView/index.ts +41 -0
  22. package/lib/Easy-Hud/EasyHud.tsx +48 -0
  23. package/lib/Easy-Hud/Loading/Loading.tsx +80 -0
  24. package/lib/Easy-Hud/Loading/index.ts +35 -0
  25. package/lib/Easy-Hud/Toast/Toast.tsx +86 -0
  26. package/lib/Easy-Hud/Toast/index.ts +22 -0
  27. package/lib/Easy-Hud/index.ts +18 -0
  28. package/lib/Echarts/EchartsView.tsx +151 -0
  29. package/lib/Echarts/demo.tsx +235 -0
  30. package/lib/Echarts/helper.tsx +63 -0
  31. package/lib/Echarts/index.ts +29 -0
  32. package/lib/Modal/Modal.tsx +12 -0
  33. package/lib/Modal/index.ts +10 -0
  34. package/lib/MutiPictureView/MutiPictureView.tsx +213 -0
  35. package/lib/MutiPictureView/icon_add_image.png +0 -0
  36. package/lib/MutiPictureView/icon_del_image.png +0 -0
  37. package/lib/MutiPictureView/index.ts +55 -0
  38. package/lib/PictureViewer/PictureViewer.tsx +80 -0
  39. package/lib/PictureViewer/index.ts +26 -0
  40. package/lib/RefreshList/RefreshList.tsx +222 -0
  41. package/lib/RefreshList/demo.tsx +30 -0
  42. package/lib/RefreshList/demo1.tsx +60 -0
  43. package/lib/RefreshList/demo2.tsx +46 -0
  44. package/lib/RefreshList/index.ts +84 -0
  45. package/lib/StickHeaderView/StickHeaderView.tsx +65 -0
  46. package/lib/StickHeaderView/demo.tsx +104 -0
  47. package/lib/StickHeaderView/index.ts +26 -0
  48. package/lib/TableCell/TableCell.tsx +117 -0
  49. package/lib/TableCell/back.png +0 -0
  50. package/lib/TableCell/index.ts +45 -0
  51. package/lib/TextInputArea/TextInputArea.tsx +88 -0
  52. package/lib/TextInputArea/index.ts +32 -0
  53. package/lib/WithLoadingContainer/WithLoadingContainer.tsx +93 -0
  54. package/lib/WithLoadingContainer/index.ts +36 -0
  55. package/lib/WithLoadingContainer/loading.gif +0 -0
  56. package/lib/WithLoadingContainer/loading3.gif +0 -0
  57. package/package.json +59 -0
  58. package/screen/index.ts +16 -0
  59. package/screen/px2dp.tsx +44 -0
  60. package/screen/px2sp.tsx +65 -0
  61. package/screen/text-set.tsx +58 -0
  62. package/src/index.d.ts +58 -0
  63. package/src/index.ts +66 -0
  64. package/utils/index.ts +56 -0
  65. package/utils/lazy.tsx +40 -0
  66. package/utils/mode.tsx +48 -0
@@ -0,0 +1,46 @@
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
+ }
@@ -0,0 +1,84 @@
1
+ /*
2
+ * @Author: your name
3
+ * @Date: 2022-04-20 14:56:05
4
+ * @LastEditTime: 2022-04-27 14:22:01
5
+ * @LastEditors: shiguo
6
+ * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
7
+ * @FilePath: /@aks/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: Function;
29
+ onFooterRefresh: (info: any) => void;
30
+ reload: Function;
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>;
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
+
@@ -0,0 +1,65 @@
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)
@@ -0,0 +1,104 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-29 17:48:20
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-04-29 17:57:17
6
+ * @FilePath: /@aks/easyui/lib/StickHeaderView/demo.tsx
7
+ */
8
+ import React from 'react'
9
+ import { View, StyleSheet, TouchableOpacity, Text, Animated } from 'react-native'
10
+ import { px2dp } from '../../screen/px2dp'
11
+ import { px2sp } from '../../screen/px2sp'
12
+
13
+ import StickHeaderView from './StickHeaderView'
14
+ import WithLoadingContainer from '../WithLoadingContainer/WithLoadingContainer'
15
+ import { Status } from '../WithLoadingContainer'
16
+ export default ({ }) => {
17
+
18
+
19
+ const scrollY = React.useRef(new Animated.Value(0)).current;
20
+ const headHeight = React.useRef(-1);
21
+
22
+
23
+
24
+
25
+ return (
26
+ <View style={styles.container}>
27
+ <Animated.ScrollView
28
+ style={{ flex: 1 }}
29
+ onScroll={
30
+ Animated.event(
31
+ [{
32
+ nativeEvent: { contentOffset: { y: scrollY } } // 记录滑动距离
33
+ }],
34
+ // {
35
+ // useNativeDriver: true,
36
+ // listener: (event) => {
37
+ // let ey = (event.nativeEvent as any)?.contentOffset?.y as number;
38
+
39
+ // }
40
+ // }
41
+ ) // 使用原生动画驱动
42
+ }
43
+ scrollEventThrottle={1}
44
+ >
45
+
46
+
47
+
48
+
49
+ <View onLayout={(e) => {
50
+ let { height } = e.nativeEvent.layout;
51
+ // setViewModel({ headHeight: height }); // 给头部高度赋值
52
+ headHeight.current = height
53
+ }}>
54
+ {/* <Calendar/> */}
55
+
56
+ </View>
57
+
58
+ <StickHeaderView
59
+ // stickyHeaderY={viewModel.headHeight} // 把头部高度传入
60
+ // stickyScrollY={viewModel.scrollY} // 把滑动距离传入
61
+ stickyHeaderY={headHeight.current} // 把头部高度传入
62
+ stickyScrollY={scrollY} //
63
+ >
64
+ <View >
65
+
66
+ <Text style={{ fontSize: px2sp(16), color: '#333', marginLeft: px2dp(30) }}>当日计划</Text>
67
+
68
+ </View>
69
+
70
+ </StickHeaderView>
71
+
72
+
73
+ <WithLoadingContainer
74
+ status={Status.SUCCESS}
75
+ emptyText={'今日无需巡检'}
76
+ >
77
+
78
+ {Array(30).fill('')?.map((i, index) => <Item key={`sg-item-${index}`} item={i} index={index} />)}
79
+ </WithLoadingContainer>
80
+ </Animated.ScrollView>
81
+ </View>
82
+ )
83
+ }
84
+
85
+
86
+
87
+ const Item = (props: { item: any, index: number }) => {
88
+ return (
89
+ <TouchableOpacity >
90
+
91
+
92
+
93
+ </TouchableOpacity>
94
+ )
95
+ }
96
+
97
+
98
+ const styles = StyleSheet.create({
99
+ container: {
100
+
101
+
102
+ },
103
+
104
+ })
@@ -0,0 +1,26 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-29 10:22:02
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-04-29 10:30:47
6
+ * @FilePath: /@aks/easyui/lib/StickHeaderView/index.ts
7
+ */
8
+ import * as React from 'react';
9
+ import { Animated, ViewProps } from "react-native";
10
+
11
+
12
+ export type StickHeaderViewProps = {
13
+ /**
14
+ * 头部高度
15
+ */
16
+ stickyHeaderY: number;
17
+
18
+ /**
19
+ * 滑动距离
20
+ */
21
+ stickyScrollY: Animated.Value;
22
+
23
+ } & ViewProps
24
+
25
+
26
+ export declare const StickHeaderView: React.FC<StickHeaderViewProps>;
@@ -0,0 +1,117 @@
1
+ import * as React from 'react'
2
+ import {
3
+ View, Text, StyleSheet, TouchableOpacity, Image,
4
+ } from 'react-native'
5
+ import { px2dp } from '../../screen/px2dp'
6
+ import { px2sp } from '../../screen/px2sp'
7
+
8
+ import { TableCellProps } from './index'
9
+
10
+
11
+
12
+
13
+ export default (props: Partial<TableCellProps>) => {
14
+ const { showNav = false, activeOpacity = .8 } = props
15
+ return (
16
+ <TouchableOpacity activeOpacity={activeOpacity}
17
+ style={[styles.container, props.style]}
18
+ disabled={props.onPress == undefined}
19
+ onPress={() => props.onPress && props.onPress()}
20
+ >
21
+ <View style={[styles.warpper, props.showUnderline ? {
22
+ borderBottomColor: '#f2f2f2',
23
+ // borderBottomWidth: StyleSheet.hairlineWidth,
24
+ borderBottomWidth: px2dp(1),
25
+ ...props.underlineStyle
26
+ } : {}]}>
27
+ {props.icon && <Image
28
+ style={[{ width: px2dp(20), height: px2dp(20), marginRight: px2dp(8) }, props.iconStyle]}
29
+ resizeMode='contain'
30
+ source={props.icon}
31
+ />}
32
+ <View style={[styles.middle, props.middleContaierStyle]}>
33
+ {/* 标题 */}
34
+ {(() => {
35
+ if (typeof props.title === 'string' || typeof props.title === 'number') {
36
+ return (
37
+ <Text
38
+ numberOfLines={1}
39
+ {...props.titleOptions}
40
+ style={[styles.title, props.titleOptions?.style]}
41
+ >{props.title}</Text>
42
+ )
43
+ }
44
+ if (React.isValidElement(props.title)) return props.title
45
+ return <View style={styles.title} />
46
+ })()}
47
+
48
+
49
+ {(() => {
50
+ if (typeof props.content === 'string' || typeof props.content === 'number') {
51
+ return (
52
+ <Text
53
+ numberOfLines={1}
54
+ {...props.contentOptions}
55
+ style={[styles.content, props.contentOptions?.style]}
56
+ >{props.content}</Text>
57
+ )
58
+ }
59
+ if (React.isValidElement(props.content)) return props.content
60
+
61
+ return undefined
62
+ })()}
63
+ </View>
64
+ {showNav && <Image
65
+ style={{ width: px2dp(9), height: px2dp(16), marginLeft: px2dp(8) }}
66
+ source={require('./back.png')}
67
+ />}
68
+ </View>
69
+
70
+ </TouchableOpacity>
71
+
72
+ )
73
+ }
74
+
75
+
76
+
77
+ const styles = StyleSheet.create({
78
+ container: {
79
+ display: 'flex',
80
+ minHeight: px2dp(44),
81
+ paddingLeft: px2dp(15),
82
+ paddingRight: px2dp(10),
83
+ backgroundColor: 'white',
84
+
85
+ },
86
+ warpper: {
87
+ flexGrow: 1,
88
+ display: 'flex',
89
+ flexDirection: 'row',
90
+ alignItems: 'center',
91
+ position: 'relative',
92
+ },
93
+ middle: {
94
+ flexGrow: 1,
95
+ flexShrink: 1,
96
+ display: 'flex',
97
+ flexDirection: 'row',
98
+ alignItems: 'center',
99
+ justifyContent: 'space-between',
100
+ // backgroundColor: 'cyan'
101
+ },
102
+ title: {
103
+ // backgroundColor: 'red',
104
+ flexGrow: 0,
105
+ flexShrink: 0,
106
+ fontSize: px2sp(14),
107
+ color: '#333333'
108
+ },
109
+ content: {
110
+ // backgroundColor: 'yellow',
111
+ flexGrow: 1,
112
+ flexShrink: 1,
113
+ fontSize: px2sp(14),
114
+ color: '#666666',
115
+ textAlign: 'right'
116
+ },
117
+ })
Binary file
@@ -0,0 +1,45 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-21 15:30:07
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-05-07 17:11:32
6
+ * @FilePath: /@aks/easyui/lib/TableCell/index.ts
7
+ */
8
+
9
+ import * as React from 'react'
10
+
11
+ import {
12
+ StyleProp, ViewStyle,
13
+ ImageSourcePropType, ImageStyle, TextProps, ColorValue
14
+ } from 'react-native'
15
+
16
+
17
+
18
+
19
+ export type TableCellProps = {
20
+ icon: ImageSourcePropType;
21
+ iconStyle: StyleProp<ImageStyle>;
22
+
23
+ title: string | number | React.ReactElement | undefined;
24
+ titleOptions: TextProps;
25
+
26
+
27
+ style: StyleProp<ViewStyle> | undefined;
28
+ activeOpacity: number;
29
+ middleContaierStyle: StyleProp<ViewStyle> | undefined;
30
+
31
+
32
+ content: string | number | React.ReactElement | undefined;
33
+ contentOptions: TextProps;
34
+
35
+ onPress: () => void;
36
+ showUnderline: boolean;
37
+ underlineStyle?: {
38
+ borderBottomColor?: ColorValue | undefined;
39
+ borderBottomWidth?: number | undefined;
40
+ }
41
+ showNav: boolean;
42
+ }
43
+
44
+
45
+ export declare const TableCell: React.FC<Partial<TableCellProps>>;
@@ -0,0 +1,88 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-24 13:56:47
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-05-09 16:00:27
6
+ * @FilePath: /@aks/easyui/lib/TextInputArea/TextInputArea.tsx
7
+ */
8
+ import React from 'react'
9
+ import { View, Text, TextInput, StyleSheet } from 'react-native'
10
+ import {px2dp} from '../../screen/px2dp'
11
+ import {px2sp} from '../../screen/px2sp'
12
+
13
+
14
+ import type { TextInputAreaProps, TextInputAreaCurrent } from '.'
15
+
16
+ export default React.forwardRef<TextInputAreaCurrent, Partial<TextInputAreaProps>>((props, ref) => {
17
+ const { defaultValue, placeholder, maxLength = 200, on, ...rest } = props
18
+
19
+ const [value, setValue] = React.useState<string | undefined>(defaultValue)
20
+
21
+ React.useLayoutEffect(() => {
22
+ setValue(defaultValue)
23
+ }, [defaultValue])
24
+
25
+
26
+ React.useImperativeHandle<unknown,TextInputAreaCurrent>(ref, () => ({
27
+ value: value,
28
+ }), [value])
29
+
30
+ return (
31
+ <View style={[styles.container, rest.style]}>
32
+
33
+
34
+ <TextInput
35
+ {...rest}
36
+ style={styles.textInput}
37
+ value={value}
38
+ onChangeText={txt => {
39
+ setValue(txt);
40
+ on && on(txt);
41
+ }}
42
+ multiline={true}
43
+ textAlignVertical={'top'}
44
+ maxLength={maxLength}
45
+ placeholder={placeholder}
46
+
47
+ />
48
+
49
+ <View style={styles.corner}>
50
+ <Text style={styles.limit}>
51
+ <Text style={{ ...styles.limit, color: value && value?.length > (maxLength - 5) ? 'red' : '#AFAFAF' }}>{value?.length || 0}</Text>
52
+ /
53
+ {maxLength}
54
+ </Text>
55
+ </View>
56
+ </View>
57
+ )
58
+ })
59
+
60
+
61
+
62
+ const styles = StyleSheet.create({
63
+ container: {
64
+ // backgroundColor: '#F5F5F5',
65
+ minHeight: px2dp(200),
66
+ // borderRadius: px2dp(10),
67
+ backgroundColor:'white'
68
+ },
69
+ textInput: {
70
+ flex: 1,
71
+ margin: px2dp(15),
72
+ marginBottom: px2dp(8),
73
+ // backgroundColor: 'red'
74
+ },
75
+ corner: {
76
+ // position: 'absolute',
77
+ // backgroundColor:'cyan',
78
+ marginHorizontal: px2dp(15),
79
+ marginBottom: px2dp(8)
80
+ },
81
+ limit: {
82
+ textAlign: 'right',
83
+ fontSize: px2sp(10),
84
+ color: '#AFAFAF'
85
+ },
86
+
87
+
88
+ })
@@ -0,0 +1,32 @@
1
+ /*
2
+ * @Author: shiguo
3
+ * @Date: 2022-04-24 13:59:32
4
+ * @LastEditors: shiguo
5
+ * @LastEditTime: 2022-04-26 12:31:51
6
+ * @FilePath: /@aks/easy/lib/TextInputArea/index.ts
7
+ */
8
+ import * as React from 'react'
9
+ import { ViewStyle, StyleProp, TextInputProps } from 'react-native'
10
+
11
+
12
+ export type TextInputAreaProps = {
13
+ placeholder: string,
14
+ maxLength: number,
15
+ style: StyleProp<ViewStyle>,
16
+ /**设置默认值 */
17
+ defaultValue: string,
18
+ /*监听content的变化*/
19
+ on: (content: string) => void
20
+ } & TextInputProps
21
+
22
+
23
+
24
+
25
+ export type TextInputAreaCurrent = {
26
+ value: string | undefined;
27
+ }
28
+
29
+
30
+ export declare const TextInputArea: React.ForwardRefExoticComponent<React.PropsWithoutRef<Partial<TextInputAreaProps>> & React.RefAttributes<TextInputAreaCurrent>>;
31
+
32
+