@aks-dev/easyui 1.0.196 → 1.0.198

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.

Potentially problematic release.


This version of @aks-dev/easyui might be problematic. Click here for more details.

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