@aks-dev/easyui 1.0.190 → 1.0.192

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 (72) hide show
  1. package/dist/components/AnimationModal/AnimationModal.js +23 -41
  2. package/dist/components/Badge/Badge.js +7 -16
  3. package/dist/components/DottedLine/DottedLine.js +15 -20
  4. package/dist/components/Echarts/EchartsView.js +40 -77
  5. package/dist/components/Echarts/demo.js +201 -0
  6. package/dist/components/Echarts/helper.js +1 -16
  7. package/dist/components/Hud/AlertBottomView/AlertBottomView.js +49 -64
  8. package/dist/components/Hud/AlertSheetView/AlertSheetView.js +30 -34
  9. package/dist/components/Hud/AlertView/AlertView.js +52 -66
  10. package/dist/components/Hud/Hud.js +8 -19
  11. package/dist/components/Hud/Loading/Loading.js +7 -25
  12. package/dist/components/Hud/PopoverView/PopoverView.js +5 -20
  13. package/dist/components/Hud/Scanner/Scanner.js +71 -99
  14. package/dist/components/Hud/Toast/Toast.js +6 -16
  15. package/dist/components/MenuView/MenuView.js +32 -73
  16. package/dist/components/Modal/Modal.js +0 -7
  17. package/dist/components/MutiPictureView/MutiPictureView.js +78 -88
  18. package/dist/components/PictureViewer/PictureViewer.js +11 -32
  19. package/dist/components/RefreshList/RefreshList.js +43 -52
  20. package/dist/components/RefreshList/demo.js +9 -0
  21. package/dist/components/RefreshList/demo1.js +27 -0
  22. package/dist/components/RefreshList/demo2.js +9 -0
  23. package/dist/components/RichText/RichText.js +23 -23
  24. package/dist/components/StickHeaderView/StickHeaderView.js +2 -12
  25. package/dist/components/StickHeaderView/demo.js +37 -0
  26. package/dist/components/TableCell/TableCell.js +37 -53
  27. package/dist/components/TextInputArea/TextInputArea.js +22 -31
  28. package/dist/components/WithLoadingContainer/WithLoadingContainer.js +14 -31
  29. package/dist/index.js +0 -11
  30. package/dist/jsbridge/RNEasyui.js +1 -26
  31. package/dist/jsbridge/UpgradeModule.js +12 -21
  32. package/dist/jsbridge/index.js +0 -7
  33. package/dist/screen/index.js +0 -8
  34. package/dist/screen/px2dp.js +2 -25
  35. package/dist/screen/px2sp.js +5 -35
  36. package/dist/screen/text-fit.js +5 -21
  37. package/dist/utils/index.js +0 -7
  38. package/dist/utils/lazy.js +19 -71
  39. package/dist/utils/mode.js +0 -21
  40. package/package.json +3 -7
  41. package/types/components/AnimationModal/AnimationModal.d.ts +0 -8
  42. package/types/components/AnimationModal/AnimationModal.d.ts.map +1 -1
  43. package/types/components/Echarts/demo.d.ts +4 -0
  44. package/types/components/Echarts/demo.d.ts.map +1 -0
  45. package/types/components/Echarts/helper.d.ts +0 -5
  46. package/types/components/Echarts/helper.d.ts.map +1 -1
  47. package/types/components/MutiPictureView/MutiPictureView.d.ts +0 -9
  48. package/types/components/MutiPictureView/MutiPictureView.d.ts.map +1 -1
  49. package/types/components/RefreshList/demo.d.ts +2 -0
  50. package/types/components/RefreshList/demo.d.ts.map +1 -0
  51. package/types/components/RefreshList/demo1.d.ts +2 -0
  52. package/types/components/RefreshList/demo1.d.ts.map +1 -0
  53. package/types/components/RefreshList/demo2.d.ts +2 -0
  54. package/types/components/RefreshList/demo2.d.ts.map +1 -0
  55. package/types/components/StickHeaderView/StickHeaderView.d.ts +0 -6
  56. package/types/components/StickHeaderView/StickHeaderView.d.ts.map +1 -1
  57. package/types/components/StickHeaderView/demo.d.ts +4 -0
  58. package/types/components/StickHeaderView/demo.d.ts.map +1 -0
  59. package/types/components/TextInputArea/TextInputArea.d.ts +0 -1
  60. package/types/components/TextInputArea/TextInputArea.d.ts.map +1 -1
  61. package/types/jsbridge/RNEasyui.d.ts +0 -18
  62. package/types/jsbridge/RNEasyui.d.ts.map +1 -1
  63. package/types/jsbridge/UpgradeModule.d.ts +0 -15
  64. package/types/jsbridge/UpgradeModule.d.ts.map +1 -1
  65. package/types/screen/px2dp.d.ts +0 -11
  66. package/types/screen/px2dp.d.ts.map +1 -1
  67. package/types/screen/text-fit.d.ts +0 -3
  68. package/types/screen/text-fit.d.ts.map +1 -1
  69. package/types/utils/lazy.d.ts +0 -33
  70. package/types/utils/lazy.d.ts.map +1 -1
  71. package/types/utils/mode.d.ts +0 -14
  72. package/types/utils/mode.d.ts.map +1 -1
@@ -1,10 +1,3 @@
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
1
  import * as React from "react";
9
2
  import { Image, View, StyleSheet, Keyboard, TouchableOpacity, Text, } from "react-native";
10
3
  import { px2dp } from "../../screen/px2dp";
@@ -13,19 +6,20 @@ import SYImagePicker from "@aks-dev/react-native-syan-image-picker";
13
6
  let icon_add_image = require("./assets/icon_add_image.png");
14
7
  let icon_del_image = require("./assets/icon_del_image.png");
15
8
  const MutiPictureView = (props) => {
16
- const { bind, maxCount = 6, type = "showImagePicker", addIcon, addIconStyle, addIconContainerStyle, //borderWidth: 1, borderStyle: 'dashed', borderColor: assets.color_A3A9CC 虚线框
17
- itemContainerStyle, emptyPlaceHolderStyle, delIcon, delIconStyle, spacingHorizontal = px2dp(15), spacingInner = px2dp(8), editable = true, showEmptyPlaceHolder = false, } = props;
9
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
10
+ const { bind, maxCount = 6, type = "showImagePicker", addIcon, addIconStyle, addIconContainerStyle, itemContainerStyle, emptyPlaceHolderStyle, delIcon, delIconStyle, spacingHorizontal = px2dp(15), spacingInner = px2dp(8), editable = true, showEmptyPlaceHolder = false, } = props;
18
11
  const { viewModel, setViewModel } = bind;
19
12
  React.useEffect(() => { }, []);
20
13
  const [sideLength, setSideLength] = React.useState(0);
21
14
  const addPhoto = () => {
15
+ var _a, _b;
22
16
  let images = viewModel.photos || [];
23
17
  if (!images) {
24
18
  throw new Error("viewModel没有定义photos字段");
25
19
  }
26
20
  if (type == "showImagePicker") {
27
21
  SYImagePicker.showImagePicker({
28
- imageCount: maxCount - (viewModel.photos?.length || 0),
22
+ imageCount: maxCount - (((_a = viewModel.photos) === null || _a === void 0 ? void 0 : _a.length) || 0),
29
23
  isCrop: false,
30
24
  isRecordSelected: false,
31
25
  quality: 20,
@@ -41,7 +35,7 @@ const MutiPictureView = (props) => {
41
35
  }
42
36
  if (type == "openCamera") {
43
37
  SYImagePicker.openCamera({
44
- imageCount: maxCount - (viewModel.photos?.length || 0),
38
+ imageCount: maxCount - (((_b = viewModel.photos) === null || _b === void 0 ? void 0 : _b.length) || 0),
45
39
  isCrop: false,
46
40
  isRecordSelected: false,
47
41
  quality: 20,
@@ -66,13 +60,13 @@ const MutiPictureView = (props) => {
66
60
  setViewModel({ photos: photos });
67
61
  };
68
62
  const showPhoto = (index) => {
63
+ var _a;
69
64
  Keyboard.dismiss();
70
- let imgs = (props.value || viewModel.photos)?.filter((it) => {
65
+ let imgs = ((_a = (props.value || viewModel.photos)) === null || _a === void 0 ? void 0 : _a.filter((it) => {
71
66
  return ((typeof it === "string" && it.indexOf("http") >= 0) ||
72
67
  typeof it == "object");
73
- }) || [];
68
+ })) || [];
74
69
  let images = [];
75
- // console.log('viewModel', viewModel, imgs)
76
70
  imgs.forEach((it) => {
77
71
  if (typeof it === "string") {
78
72
  images.push({ uri: it });
@@ -92,7 +86,7 @@ const MutiPictureView = (props) => {
92
86
  });
93
87
  };
94
88
  const ItemView = ({ source, index, }) => {
95
- return (<TouchableOpacity style={[
89
+ return (React.createElement(TouchableOpacity, { style: [
96
90
  styles.item_container,
97
91
  itemContainerStyle,
98
92
  {
@@ -101,17 +95,15 @@ const MutiPictureView = (props) => {
101
95
  width: sideLength,
102
96
  height: sideLength,
103
97
  },
104
- ]} activeOpacity={0.8} onPress={() => showPhoto(index)}>
105
- <Image source={source} style={{ width: "100%", height: "100%" }} resizeMode="cover"/>
106
- {editable && !props.value && (<TouchableOpacity onPress={() => deletePhoto(index)} style={[styles.del_img_container, delIconStyle]}>
107
- <Image source={delIcon ? delIcon : icon_del_image} resizeMode="contain" style={{ width: "100%", height: "100%" }}/>
108
- </TouchableOpacity>)}
109
- </TouchableOpacity>);
98
+ ], activeOpacity: 0.8, onPress: () => showPhoto(index) },
99
+ React.createElement(Image, { source: source, style: { width: "100%", height: "100%" }, resizeMode: "cover" }),
100
+ editable && !props.value && (React.createElement(TouchableOpacity, { onPress: () => deletePhoto(index), style: [styles.del_img_container, delIconStyle] },
101
+ React.createElement(Image, { source: delIcon ? delIcon : icon_del_image, resizeMode: "contain", style: { width: "100%", height: "100%" } })))));
110
102
  };
111
103
  const containerRef = React.useRef(null);
112
104
  React.useEffect(() => {
113
- containerRef.current?.measure((...args) => {
114
- // console.log('measure', args[2])
105
+ var _a;
106
+ (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.measure((...args) => {
115
107
  if (args.length > 3) {
116
108
  let _sideLength = +((args[2] - spacingHorizontal * 2 - spacingInner * 2) /
117
109
  3).toFixed(1);
@@ -119,89 +111,88 @@ const MutiPictureView = (props) => {
119
111
  }
120
112
  });
121
113
  });
122
- if (props.value && props.value?.length > 0) {
123
- return (<View style={[styles.container, props.style]} ref={containerRef}>
124
- {props.value instanceof Array &&
125
- props.value?.map((item, index) => {
126
- return (<ItemView key={index} source={typeof item === "string" ? { uri: item } : item} index={index}/>);
127
- })}
128
-
129
- {showEmptyPlaceHolder &&
130
- maxCount - (props.value?.length || 0) - 1 > 0 &&
114
+ if (props.value && ((_a = props.value) === null || _a === void 0 ? void 0 : _a.length) > 0) {
115
+ return (React.createElement(View, { style: [styles.container, props.style], ref: containerRef },
116
+ props.value instanceof Array &&
117
+ ((_b = props.value) === null || _b === void 0 ? void 0 : _b.map((item, index) => {
118
+ return (React.createElement(ItemView, { key: index, source: typeof item === "string" ? { uri: item } : item, index: index }));
119
+ })),
120
+ showEmptyPlaceHolder &&
121
+ maxCount - (((_c = props.value) === null || _c === void 0 ? void 0 : _c.length) || 0) - 1 > 0 &&
131
122
  Array.from({
132
- length: maxCount - (props.value?.length || 0) - (editable ? 1 : 0),
133
- }, (_, k) => (<View key={`sg-showEmptyPlaceHolder-${k}`} style={[
134
- styles.empty_place_container,
135
- emptyPlaceHolderStyle,
136
- itemContainerStyle,
137
- {
138
- marginTop: k + (editable ? 1 : 0) + (props.value?.length || 0) > 2
139
- ? spacingInner
140
- : 0,
141
- marginLeft: (k + (editable ? 1 : 0) + (props.value?.length || 0)) %
142
- 3 ==
143
- 0
144
- ? spacingHorizontal
145
- : spacingInner,
146
- width: sideLength,
147
- height: sideLength,
148
- },
149
- ]}/>))}
150
- </View>);
123
+ length: maxCount - (((_d = props.value) === null || _d === void 0 ? void 0 : _d.length) || 0) - (editable ? 1 : 0),
124
+ }, (_, k) => {
125
+ var _a, _b;
126
+ return (React.createElement(View, { key: `sg-showEmptyPlaceHolder-${k}`, style: [
127
+ styles.empty_place_container,
128
+ emptyPlaceHolderStyle,
129
+ itemContainerStyle,
130
+ {
131
+ marginTop: k + (editable ? 1 : 0) + (((_a = props.value) === null || _a === void 0 ? void 0 : _a.length) || 0) > 2
132
+ ? spacingInner
133
+ : 0,
134
+ marginLeft: (k + (editable ? 1 : 0) + (((_b = props.value) === null || _b === void 0 ? void 0 : _b.length) || 0)) %
135
+ 3 ==
136
+ 0
137
+ ? spacingHorizontal
138
+ : spacingInner,
139
+ width: sideLength,
140
+ height: sideLength,
141
+ },
142
+ ] }));
143
+ })));
151
144
  }
152
- return (<View style={[styles.container, props.style]} ref={containerRef}>
153
- {viewModel?.photos instanceof Array &&
145
+ return (React.createElement(View, { style: [styles.container, props.style], ref: containerRef },
146
+ (viewModel === null || viewModel === void 0 ? void 0 : viewModel.photos) instanceof Array &&
154
147
  viewModel.photos.map((item, index) => {
155
- return (<ItemView key={index} source={typeof item === "string" ? { uri: item } : item} index={index}/>);
156
- })}
157
-
158
- {!(viewModel?.photos?.length == maxCount) && editable && (<TouchableOpacity style={[
148
+ return (React.createElement(ItemView, { key: index, source: typeof item === "string" ? { uri: item } : item, index: index }));
149
+ }),
150
+ !(((_e = viewModel === null || viewModel === void 0 ? void 0 : viewModel.photos) === null || _e === void 0 ? void 0 : _e.length) == maxCount) && editable && (React.createElement(TouchableOpacity, { style: [
159
151
  styles.item_container,
160
152
  itemContainerStyle,
161
153
  {
162
- marginTop: (viewModel?.photos?.length || 0) >= 3 ? spacingInner : 0,
163
- marginLeft: (viewModel?.photos?.length || 0) % 3 == 0
154
+ marginTop: (((_f = viewModel === null || viewModel === void 0 ? void 0 : viewModel.photos) === null || _f === void 0 ? void 0 : _f.length) || 0) >= 3 ? spacingInner : 0,
155
+ marginLeft: (((_g = viewModel === null || viewModel === void 0 ? void 0 : viewModel.photos) === null || _g === void 0 ? void 0 : _g.length) || 0) % 3 == 0
164
156
  ? spacingHorizontal
165
157
  : spacingInner,
166
158
  width: sideLength,
167
159
  height: sideLength,
168
160
  },
169
161
  addIconContainerStyle,
170
- ]} activeOpacity={0.8} onPress={() => addPhoto()}>
171
- <Image source={addIcon ? addIcon : icon_add_image} style={[{ width: "25%", height: "25%" }, addIconStyle]} resizeMode="contain"/>
172
- {props.addText && (<Text style={[
162
+ ], activeOpacity: 0.8, onPress: () => addPhoto() },
163
+ React.createElement(Image, { source: addIcon ? addIcon : icon_add_image, style: [{ width: "25%", height: "25%" }, addIconStyle], resizeMode: "contain" }),
164
+ props.addText && (React.createElement(Text, { style: [
173
165
  {
174
166
  fontSize: px2sp(12),
175
167
  color: "lightgrey",
176
168
  marginTop: px2dp(2),
177
169
  },
178
170
  props.addTextStyle,
179
- ]}>
180
- {props.addText}
181
- </Text>)}
182
- </TouchableOpacity>)}
183
- {showEmptyPlaceHolder &&
184
- maxCount - (viewModel.photos?.length || 0) - 1 > 0 &&
171
+ ] }, props.addText)))),
172
+ showEmptyPlaceHolder &&
173
+ maxCount - (((_h = viewModel.photos) === null || _h === void 0 ? void 0 : _h.length) || 0) - 1 > 0 &&
185
174
  Array.from({
186
- length: maxCount - (viewModel.photos?.length || 0) - (editable ? 1 : 0),
187
- }, (_, k) => (<View key={`sg-showEmptyPlaceHolder-${k}`} style={[
188
- styles.empty_place_container,
189
- emptyPlaceHolderStyle,
190
- itemContainerStyle,
191
- {
192
- marginTop: k + (editable ? 1 : 0) + (viewModel.photos?.length || 0) > 2
193
- ? spacingInner
194
- : 0,
195
- marginLeft: (k + (editable ? 1 : 0) + (viewModel.photos?.length || 0)) %
196
- 3 ==
197
- 0
198
- ? spacingHorizontal
199
- : spacingInner,
200
- width: sideLength,
201
- height: sideLength,
202
- },
203
- ]}/>))}
204
- </View>);
175
+ length: maxCount - (((_j = viewModel.photos) === null || _j === void 0 ? void 0 : _j.length) || 0) - (editable ? 1 : 0),
176
+ }, (_, k) => {
177
+ var _a, _b;
178
+ return (React.createElement(View, { key: `sg-showEmptyPlaceHolder-${k}`, style: [
179
+ styles.empty_place_container,
180
+ emptyPlaceHolderStyle,
181
+ itemContainerStyle,
182
+ {
183
+ marginTop: k + (editable ? 1 : 0) + (((_a = viewModel.photos) === null || _a === void 0 ? void 0 : _a.length) || 0) > 2
184
+ ? spacingInner
185
+ : 0,
186
+ marginLeft: (k + (editable ? 1 : 0) + (((_b = viewModel.photos) === null || _b === void 0 ? void 0 : _b.length) || 0)) %
187
+ 3 ==
188
+ 0
189
+ ? spacingHorizontal
190
+ : spacingInner,
191
+ width: sideLength,
192
+ height: sideLength,
193
+ },
194
+ ] }));
195
+ })));
205
196
  };
206
197
  const styles = StyleSheet.create({
207
198
  container: {
@@ -211,7 +202,6 @@ const styles = StyleSheet.create({
211
202
  display: "flex",
212
203
  flexDirection: "row",
213
204
  flexWrap: "wrap",
214
- // borderRadius: px2dp(10),
215
205
  },
216
206
  item_container: {
217
207
  overflow: "hidden",
@@ -1,17 +1,11 @@
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
1
  import * as React from "react";
9
2
  import { Modal, StatusBar, Platform } from "react-native";
10
3
  import ImageViewer from "react-native-image-zoom-viewer";
11
4
  export const PictureViewer = ({ bind, }) => {
5
+ var _a;
12
6
  const { viewModel, setViewModel } = bind;
13
7
  const visible = viewModel.imageViewer.visible;
14
- const imgs = viewModel.imageViewer.imageUrls?.map((item) => ({ url: item }));
8
+ const imgs = (_a = viewModel.imageViewer.imageUrls) === null || _a === void 0 ? void 0 : _a.map((item) => ({ url: item }));
15
9
  const index = viewModel.imageViewer.index;
16
10
  React.useEffect(() => {
17
11
  if (Platform.OS == "android") {
@@ -25,30 +19,15 @@ export const PictureViewer = ({ bind, }) => {
25
19
  }
26
20
  }
27
21
  }, [visible]);
28
- return (<Modal presentationStyle="overFullScreen" visible={visible} transparent={false} onRequestClose={() => {
29
- /**
30
- * 【官方文档】
31
- * onRequestClose回调会在用户按下 Android 设备上的后退按键或是 Apple TV 上的菜单键时触发。
32
- * 请务必注意本属性在 Android 平台上为必填,且会在 modal 处于开启状态时阻止BackHandler事件。
33
- */
22
+ return (React.createElement(Modal, { presentationStyle: "overFullScreen", visible: visible, transparent: false, onRequestClose: () => {
34
23
  setViewModel({
35
- imageViewer: {
36
- ...viewModel.imageViewer,
37
- visible: false,
38
- },
24
+ imageViewer: Object.assign(Object.assign({}, viewModel.imageViewer), { visible: false }),
39
25
  });
40
- }} style={{ margin: 0, backgroundColor: "red" }}>
41
- <ImageViewer imageUrls={imgs} index={index} onSwipeDown={() => {
42
- // console.log('onSwipeDown');
43
- }} saveToLocalByLongPress={false}
44
- // onMove={data => console.log(data)}
45
- useNativeDriver={true} enableSwipeDown={true} onClick={() => {
46
- setViewModel({
47
- imageViewer: {
48
- ...viewModel.imageViewer,
49
- visible: false,
50
- },
51
- });
52
- }}/>
53
- </Modal>);
26
+ }, style: { margin: 0, backgroundColor: "red" } },
27
+ React.createElement(ImageViewer, { imageUrls: imgs, index: index, onSwipeDown: () => {
28
+ }, saveToLocalByLongPress: false, useNativeDriver: true, enableSwipeDown: true, onClick: () => {
29
+ setViewModel({
30
+ imageViewer: Object.assign(Object.assign({}, viewModel.imageViewer), { visible: false }),
31
+ });
32
+ } })));
54
33
  };
@@ -1,3 +1,14 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import * as React from "react";
2
13
  import { View, Text, Animated, StyleSheet, ActivityIndicator, TouchableOpacity, } from "react-native";
3
14
  import { SwipeListView } from "react-native-swipe-list-view";
@@ -20,7 +31,8 @@ export var RefreshState;
20
31
  RefreshState["None"] = "None";
21
32
  })(RefreshState || (RefreshState = {}));
22
33
  export default React.forwardRef((props, ref) => {
23
- const { mode = "FlatList", refreshState, onHeaderRefresh, onFooterRefresh, reload, ...rest } = props;
34
+ var _a, _b;
35
+ const { mode = "FlatList", refreshState, onHeaderRefresh, onFooterRefresh, reload } = props, rest = __rest(props, ["mode", "refreshState", "onHeaderRefresh", "onFooterRefresh", "reload"]);
24
36
  const seed = React.useRef(Math.random()).current;
25
37
  let onRefresh = () => {
26
38
  if (refreshState == RefreshState.HeaderRefreshing)
@@ -53,42 +65,33 @@ export default React.forwardRef((props, ref) => {
53
65
  switch (mode) {
54
66
  case "FlatList": {
55
67
  let flatListProps = props;
56
- return (<Animated.FlatList {...rest} ref={ref} refreshing={refreshState == RefreshState.HeaderRefreshing} keyExtractor={(_, index) => {
68
+ return (React.createElement(Animated.FlatList, Object.assign({}, rest, { ref: ref, refreshing: refreshState == RefreshState.HeaderRefreshing, keyExtractor: (_, index) => {
57
69
  return `sg-index-FlatList-${seed}-${index}`;
58
- }} contentContainerStyle={flatListProps.data?.length ? {} : { height: "100%" }} onRefresh={onRefresh} onEndReachedThreshold={0.1} onEndReached={onEndReached} showsVerticalScrollIndicator={false} ListHeaderComponent={(_) => (<View style={{ display: "flex", flexDirection: "column" }}>
59
- <ListHeaderComponent {...flatListProps}/>
60
- {/* {flatListProps.ListHeaderComponent} */}
61
- </View>)}
62
- // ListHeaderComponent={flatListProps.ListHeaderComponent}
63
- ListFooterComponent={(_) => (<ListFooterComponent {...flatListProps}/>)}/>);
70
+ }, contentContainerStyle: ((_a = flatListProps.data) === null || _a === void 0 ? void 0 : _a.length) ? {} : { height: "100%" }, onRefresh: onRefresh, onEndReachedThreshold: 0.1, onEndReached: onEndReached, showsVerticalScrollIndicator: false, ListHeaderComponent: (_) => (React.createElement(View, { style: { display: "flex", flexDirection: "column" } },
71
+ React.createElement(ListHeaderComponent, Object.assign({}, flatListProps)))), ListFooterComponent: (_) => (React.createElement(ListFooterComponent, Object.assign({}, flatListProps))) })));
64
72
  }
65
73
  case "SectionList": {
66
74
  let sectionListProps = props;
67
- const { ItemSeparatorComponent = (_) => <View style={{ height: 1 }}/>, } = sectionListProps;
68
- return (<Animated.SectionList {...rest} ref={ref} refreshing={refreshState == RefreshState.HeaderRefreshing} onRefresh={onRefresh} keyExtractor={(_, index) => {
75
+ const { ItemSeparatorComponent = (_) => React.createElement(View, { style: { height: 1 } }), } = sectionListProps;
76
+ return (React.createElement(Animated.SectionList, Object.assign({}, rest, { ref: ref, refreshing: refreshState == RefreshState.HeaderRefreshing, onRefresh: onRefresh, keyExtractor: (_, index) => {
69
77
  return `sg-index-SectionList-${seed}-${index}`;
70
- }} contentContainerStyle={sectionListProps.sections?.length > 0 ? {} : { height: "100%" }} ItemSeparatorComponent={ItemSeparatorComponent} onEndReachedThreshold={0.1} onEndReached={onEndReached} showsVerticalScrollIndicator={false}
71
- // ListHeaderComponent={(_) => <ListHeaderComponent {...sectionListProps} />}
72
- ListHeaderComponent={(_) => (<View style={{ display: "flex", flexDirection: "column" }}>
73
- <ListHeaderComponent {...sectionListProps}/>
74
- {sectionListProps.ListHeaderComponent}
75
- </View>)} ListFooterComponent={(_) => (<ListFooterComponent {...sectionListProps}/>)} renderSectionHeader={sectionListProps.renderSectionHeader}/>);
78
+ }, contentContainerStyle: ((_b = sectionListProps.sections) === null || _b === void 0 ? void 0 : _b.length) > 0 ? {} : { height: "100%" }, ItemSeparatorComponent: ItemSeparatorComponent, onEndReachedThreshold: 0.1, onEndReached: onEndReached, showsVerticalScrollIndicator: false, ListHeaderComponent: (_) => (React.createElement(View, { style: { display: "flex", flexDirection: "column" } },
79
+ React.createElement(ListHeaderComponent, Object.assign({}, sectionListProps)),
80
+ sectionListProps.ListHeaderComponent)), ListFooterComponent: (_) => (React.createElement(ListFooterComponent, Object.assign({}, sectionListProps))), renderSectionHeader: sectionListProps.renderSectionHeader })));
76
81
  }
77
82
  case "SwipeList": {
78
83
  let swipeListProps = props;
79
- const { ItemSeparatorComponent = (_) => <View style={{ height: 1 }}/>, } = swipeListProps;
80
- const { renderHiddenItem = (data, rowMap) => (<View style={{
84
+ const { ItemSeparatorComponent = (_) => React.createElement(View, { style: { height: 1 } }), } = swipeListProps;
85
+ const { renderHiddenItem = (data, rowMap) => (React.createElement(View, { style: {
81
86
  backgroundColor: "red",
82
87
  height: "100%",
83
88
  alignItems: "flex-end",
84
89
  justifyContent: "center",
85
- }}>
86
- <Text>Right </Text>
87
- </View>), } = swipeListProps;
88
- return (<SwipeListView {...rest} rightOpenValue={-100} leftOpenValue={0} ref={ref} disableLeftSwipe={false} disableRightSwipe={true} onRefresh={onRefresh} refreshing={refreshState == RefreshState.HeaderRefreshing} ItemSeparatorComponent={ItemSeparatorComponent} onEndReachedThreshold={0.1} onEndReached={onEndReached} showsVerticalScrollIndicator={false} ListHeaderComponent={(_) => (<View style={{ display: "flex", flexDirection: "column" }}>
89
- <ListHeaderComponent {...swipeListProps}/>
90
- {swipeListProps.ListHeaderComponent}
91
- </View>)} ListFooterComponent={(args) => (<ListFooterComponent {...swipeListProps}/>)} renderHiddenItem={renderHiddenItem}/>);
90
+ } },
91
+ React.createElement(Text, null, "Right "))), } = swipeListProps;
92
+ return (React.createElement(SwipeListView, Object.assign({}, rest, { rightOpenValue: -100, leftOpenValue: 0, ref: ref, disableLeftSwipe: false, disableRightSwipe: true, onRefresh: onRefresh, refreshing: refreshState == RefreshState.HeaderRefreshing, ItemSeparatorComponent: ItemSeparatorComponent, onEndReachedThreshold: 0.1, onEndReached: onEndReached, showsVerticalScrollIndicator: false, ListHeaderComponent: (_) => (React.createElement(View, { style: { display: "flex", flexDirection: "column" } },
93
+ React.createElement(ListHeaderComponent, Object.assign({}, swipeListProps)),
94
+ swipeListProps.ListHeaderComponent)), ListFooterComponent: (args) => (React.createElement(ListFooterComponent, Object.assign({}, swipeListProps))), renderHiddenItem: renderHiddenItem })));
92
95
  }
93
96
  }
94
97
  });
@@ -97,45 +100,34 @@ const ListFooterComponent = React.memo((props) => {
97
100
  switch (refreshState) {
98
101
  case RefreshState.Idle:
99
102
  case RefreshState.FooterRefreshing:
100
- return (<View style={{ ...styles.container, flexDirection: "row" }}>
101
- <ActivityIndicator color={"gray"}/>
102
- <Text style={{ ...styles.text, marginLeft: 5 }}>
103
- {RefreshText.FooterRefreshing}
104
- </Text>
105
- </View>);
103
+ return (React.createElement(View, { style: Object.assign(Object.assign({}, styles.container), { flexDirection: "row" }) },
104
+ React.createElement(ActivityIndicator, { color: "gray" }),
105
+ React.createElement(Text, { style: Object.assign(Object.assign({}, styles.text), { marginLeft: 5 }) }, RefreshText.FooterRefreshing)));
106
106
  case RefreshState.NoMoreData:
107
- return (<View style={styles.container}>
108
- <Text style={{ ...styles.text, color: "#999999" }}>
109
- {RefreshText.NoMoreData}
110
- </Text>
111
- </View>);
107
+ return (React.createElement(View, { style: styles.container },
108
+ React.createElement(Text, { style: Object.assign(Object.assign({}, styles.text), { color: "#999999" }) }, RefreshText.NoMoreData)));
112
109
  case RefreshState.Failure:
113
- return (<View style={styles.container}>
114
- <TouchableOpacity onPress={() => reload && reload()}>
115
- <Text style={styles.text}>{RefreshText.Failure}</Text>
116
- </TouchableOpacity>
117
- </View>);
110
+ return (React.createElement(View, { style: styles.container },
111
+ React.createElement(TouchableOpacity, { onPress: () => reload && reload() },
112
+ React.createElement(Text, { style: styles.text }, RefreshText.Failure))));
118
113
  case RefreshState.EmptyData:
119
114
  if (props.renderListEmptyComponent)
120
115
  return props.renderListEmptyComponent();
121
- return (<View style={styles.container}>
122
- <TouchableOpacity onPress={() => reload && reload()}>
123
- <Text style={styles.text}>{RefreshText.EmptyData}</Text>
124
- </TouchableOpacity>
125
- </View>);
116
+ return (React.createElement(View, { style: styles.container },
117
+ React.createElement(TouchableOpacity, { onPress: () => reload && reload() },
118
+ React.createElement(Text, { style: styles.text }, RefreshText.EmptyData))));
126
119
  default:
127
- return <View />;
120
+ return React.createElement(View, null);
128
121
  }
129
122
  });
130
123
  const ListHeaderComponent = React.memo((props) => {
131
124
  const { refreshState } = props;
132
125
  switch (refreshState) {
133
126
  case RefreshState.HeaderRefreshing:
134
- return (<View style={{ ...styles.container }}>
135
- <Text style={{ ...styles.text }}>{RefreshText.HeaderRefreshing}</Text>
136
- </View>);
127
+ return (React.createElement(View, { style: Object.assign({}, styles.container) },
128
+ React.createElement(Text, { style: Object.assign({}, styles.text) }, RefreshText.HeaderRefreshing)));
137
129
  default:
138
- return <View />;
130
+ return React.createElement(View, null);
139
131
  }
140
132
  });
141
133
  const styles = StyleSheet.create({
@@ -145,7 +137,6 @@ const styles = StyleSheet.create({
145
137
  justifyContent: "center",
146
138
  alignItems: "center",
147
139
  height: 44,
148
- // backgroundColor:'cyan'
149
140
  },
150
141
  text: {
151
142
  color: "gray",
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ import { View } from "react-native";
3
+ import { default as RefreshList, RefreshState } from "./RefreshList";
4
+ const App = () => {
5
+ const [refreshState, setRefreshState] = React.useState(RefreshState.Idle);
6
+ return (React.createElement(RefreshList, { data: ["a", "b"], renderItem: ({ item, index }) => {
7
+ return React.createElement(View, null, item);
8
+ }, refreshState: refreshState, onHeaderRefresh: () => { }, onFooterRefresh: () => { } }));
9
+ };
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+ import { View } from "react-native";
3
+ import { default as RefreshList, RefreshState } from "./RefreshList";
4
+ const App = () => {
5
+ const [refreshState, setRefreshState] = React.useState(RefreshState.Idle);
6
+ const listRef = React.useRef(null);
7
+ return (React.createElement(RefreshList, { mode: "SectionList", sections: [
8
+ {
9
+ title: "Main dishes",
10
+ data: ["Pizza", "Burger", "Risotto"],
11
+ },
12
+ {
13
+ title: "Sides",
14
+ data: ["French Fries", "Onion Rings", "Fried Shrimps"],
15
+ },
16
+ {
17
+ title: "Drinks",
18
+ data: ["Water", "Coke", "Beer"],
19
+ },
20
+ {
21
+ title: "Desserts",
22
+ data: ["Cheese Cake", "Ice Cream"],
23
+ },
24
+ ], renderItem: ({ item, section }) => {
25
+ return React.createElement(View, null, item);
26
+ }, refreshState: refreshState, onHeaderRefresh: () => { }, onFooterRefresh: () => { }, renderSectionHeader: ({ section: { letter } }) => (React.createElement(View, { style: { backgroundColor: "red" } })) }));
27
+ };
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ import { RefreshState } from "./RefreshList";
3
+ const App = () => {
4
+ const [refreshState, setRefreshState] = React.useState(RefreshState.Idle);
5
+ const listRef = React.useRef(null);
6
+ const dataList = Array(20)
7
+ .fill("")
8
+ .map((_, i) => ({ key: `${i}`, text: `item #${i}` }));
9
+ };
@@ -1,16 +1,20 @@
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
- */
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
8
12
  import React from "react";
9
13
  import { StyleSheet, Text } from "react-native";
10
14
  import { px2sp } from "../../screen/px2sp";
11
15
  import * as utils from "../../utils/lazy";
12
16
  export default (props) => {
13
- const { rich, richStyle, text, suffix, prefix, ...rest } = props;
17
+ const { rich, richStyle, text, suffix, prefix } = props, rest = __rest(props, ["rich", "richStyle", "text", "suffix", "prefix"]);
14
18
  let textStr = "";
15
19
  let richStr = "";
16
20
  if (utils.isString(text) || utils.isNumber(text)) {
@@ -21,27 +25,24 @@ export default (props) => {
21
25
  }
22
26
  let positionStart = 0;
23
27
  let positionEnd = 0;
24
- if (textStr?.indexOf(richStr) >= 0) {
28
+ if ((textStr === null || textStr === void 0 ? void 0 : textStr.indexOf(richStr)) >= 0) {
25
29
  positionStart = textStr.indexOf(richStr);
26
30
  positionEnd = positionStart + richStr.length;
27
31
  }
28
32
  if (prefix) {
29
- return (<Text style={styles.container} {...rest}>
30
- <Text style={{ ...styles.defaultRich, ...richStyle }}>{richStr}</Text>
31
- {textStr}
32
- </Text>);
33
+ return (React.createElement(Text, Object.assign({ style: styles.container }, rest),
34
+ React.createElement(Text, { style: Object.assign(Object.assign({}, styles.defaultRich), richStyle) }, richStr),
35
+ textStr));
33
36
  }
34
37
  if (suffix) {
35
- return (<Text style={styles.container} {...rest}>
36
- {textStr}
37
- <Text style={{ ...styles.defaultRich, ...richStyle }}>{richStr}</Text>
38
- </Text>);
38
+ return (React.createElement(Text, Object.assign({ style: styles.container }, rest),
39
+ textStr,
40
+ React.createElement(Text, { style: Object.assign(Object.assign({}, styles.defaultRich), richStyle) }, richStr)));
39
41
  }
40
- return (<Text style={styles.container} {...rest}>
41
- {textStr.substring(0, positionStart)}
42
- {positionEnd > 0 && (<Text style={{ ...styles.defaultRich, ...richStyle }}>{richStr}</Text>)}
43
- {textStr.substring(positionEnd, textStr.length)}
44
- </Text>);
42
+ return (React.createElement(Text, Object.assign({ style: styles.container }, rest),
43
+ textStr.substring(0, positionStart),
44
+ positionEnd > 0 && (React.createElement(Text, { style: Object.assign(Object.assign({}, styles.defaultRich), richStyle) }, richStr)),
45
+ textStr.substring(positionEnd, textStr.length)));
45
46
  };
46
47
  const styles = StyleSheet.create({
47
48
  container: {
@@ -51,6 +52,5 @@ const styles = StyleSheet.create({
51
52
  defaultRich: {
52
53
  color: "red",
53
54
  fontSize: px2sp(14),
54
- // fontWeight: 'bold'
55
55
  },
56
56
  });