@aks-dev/easyui 1.0.189 → 1.0.191

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.

@@ -5,6 +5,7 @@
5
5
  * @LastEditTime: 2023-09-27 15:17:15
6
6
  * @FilePath: /@aks-dev/easyui/lib/AnimationModal/AnimationModal.tsx
7
7
  */
8
+ import { __awaiter } from "tslib";
8
9
  import * as React from "react";
9
10
  import { View, Animated, Easing, PanResponder, StyleSheet, useWindowDimensions, BackHandler, } from "react-native";
10
11
  import * as utils from "../../utils/lazy";
@@ -36,7 +37,8 @@ export const AnimationModal = React.forwardRef((props, ref) => {
36
37
  const layoutRef = React.useRef({ h0: 0, h1: 0 });
37
38
  const getLayoutPromise = () => {
38
39
  return new Promise((resovle, reject) => {
39
- viewRef.current?.measure((...args) => {
40
+ var _a;
41
+ (_a = viewRef.current) === null || _a === void 0 ? void 0 : _a.measure((...args) => {
40
42
  if (args.length == 6) {
41
43
  layoutRef.current.h1 = args[3];
42
44
  }
@@ -53,11 +55,12 @@ export const AnimationModal = React.forwardRef((props, ref) => {
53
55
  };
54
56
  const getData = () => dataRef.current;
55
57
  const show = () => {
56
- setDisplay("flex", async () => {
57
- await utils.sleep(50);
58
- await getLayoutPromise();
59
- timing(-layoutRef.current?.h1);
60
- });
58
+ setDisplay("flex", () => __awaiter(void 0, void 0, void 0, function* () {
59
+ var _a;
60
+ yield utils.sleep(50);
61
+ yield getLayoutPromise();
62
+ timing(-((_a = layoutRef.current) === null || _a === void 0 ? void 0 : _a.h1));
63
+ }));
61
64
  return init();
62
65
  };
63
66
  const hide = () => {
@@ -1,3 +1,4 @@
1
+ import { __rest } from "tslib";
1
2
  /*
2
3
  * @Author: shiguo
3
4
  * @Date: 2022-07-12 15:30:19
@@ -8,18 +9,11 @@
8
9
  import React from "react";
9
10
  import { StyleSheet, View } from "react-native";
10
11
  export default (props) => {
11
- const { vertical = false, dottedColor, dottedCount = 200, ...rest } = props;
12
+ const { vertical = false, dottedColor, dottedCount = 200 } = props, rest = __rest(props, ["vertical", "dottedColor", "dottedCount"]);
12
13
  const arrs = Array.from({ length: dottedCount }, (k, v) => v);
13
- return (<View style={{
14
- ...styles.container,
15
- flexDirection: vertical ? "column" : "row",
16
- ...rest.style,
17
- }}>
14
+ return (<View style={Object.assign(Object.assign(Object.assign({}, styles.container), { flexDirection: vertical ? "column" : "row" }), rest.style)}>
18
15
  {arrs.map((item, index) => {
19
- return (<View key={`dotted-${index}`} style={{
20
- ...(vertical ? styles.dotted_vertical : styles.dotted_horizontal),
21
- ...(dottedColor && { backgroundColor: dottedColor }),
22
- }}/>);
16
+ return (<View key={`dotted-${index}`} style={Object.assign(Object.assign({}, (vertical ? styles.dotted_vertical : styles.dotted_horizontal)), (dottedColor && { backgroundColor: dottedColor }))}/>);
23
17
  })}
24
18
  </View>);
25
19
  };
@@ -1,3 +1,4 @@
1
+ import { __awaiter } from "tslib";
1
2
  /*
2
3
  * @Author: shiguo
3
4
  * @Date: 2022-05-05 14:52:53
@@ -11,6 +12,7 @@ import { WebView } from "react-native-webview";
11
12
  import { getHtml, toString } from "./helper";
12
13
  // type Reducer = (prevState: State, action: Partial<State>) => State;
13
14
  const EchartsView = (props) => {
15
+ var _a, _b;
14
16
  const [state, dispatch] = React.useReducer((prevState, ...args) => Object.assign({}, prevState, ...args), {
15
17
  width: 0,
16
18
  height: 0,
@@ -21,7 +23,8 @@ const EchartsView = (props) => {
21
23
  const rootView = React.useRef({ pageX: 0, pageY: 0, width: 0, height: 0 });
22
24
  const getRootViewlayoutPromise = () => {
23
25
  return new Promise((resovle, reject) => {
24
- containerRef.current?.measure((...args) => {
26
+ var _a;
27
+ (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.measure((...args) => {
25
28
  if (args.length == 6) {
26
29
  rootView.current = {
27
30
  width: args[2],
@@ -36,9 +39,10 @@ const EchartsView = (props) => {
36
39
  });
37
40
  };
38
41
  React.useLayoutEffect(() => {
39
- (async () => {
42
+ (() => __awaiter(void 0, void 0, void 0, function* () {
43
+ var _a;
40
44
  if (state.isLoaded) {
41
- await getRootViewlayoutPromise();
45
+ yield getRootViewlayoutPromise();
42
46
  let height = rootView.current.height
43
47
  ? `${rootView.current.height}px`
44
48
  : "auto";
@@ -57,8 +61,9 @@ const EchartsView = (props) => {
57
61
  instance.setOption(${toString(props.option)});
58
62
  })();
59
63
  `;
60
- WebViewRef.current?.injectJavaScript(run);
64
+ (_a = WebViewRef.current) === null || _a === void 0 ? void 0 : _a.injectJavaScript(run);
61
65
  return () => {
66
+ var _a;
62
67
  const run = `
63
68
  ;(function() {
64
69
  var instance = echarts.getInstanceByDom(document.getElementById('main'));
@@ -68,11 +73,11 @@ const EchartsView = (props) => {
68
73
  }
69
74
  })();
70
75
  `;
71
- WebViewRef.current?.injectJavaScript(run);
76
+ (_a = WebViewRef.current) === null || _a === void 0 ? void 0 : _a.injectJavaScript(run);
72
77
  };
73
78
  }
74
79
  return undefined;
75
- })().catch((err) => {
80
+ }))().catch((err) => {
76
81
  console.log(err);
77
82
  });
78
83
  }, [props.option, state.isLoaded]);
@@ -109,14 +114,15 @@ const EchartsView = (props) => {
109
114
  return (<View style={[styles.container, props.style]} ref={containerRef}>
110
115
  <WebView ref={WebViewRef} originWhitelist={["*"]} useWebKit={true} // ios使用最新webkit内核渲染
111
116
  allowUniversalAccessFromFileURLs={true} geolocationEnabled={true} mixedContentMode={"always"} renderLoading={() => {
117
+ var _a;
112
118
  if (props.renderLoading)
113
119
  return props.renderLoading();
114
120
  return (<View style={{
115
- backgroundColor: props.style?.backgroundColor || "transparent",
121
+ backgroundColor: ((_a = props.style) === null || _a === void 0 ? void 0 : _a.backgroundColor) || "transparent",
116
122
  }}/>);
117
123
  }} // 设置空View,修复ioswebview闪白
118
124
  style={{
119
- backgroundColor: props.style?.backgroundColor || "transparent",
125
+ backgroundColor: ((_a = props.style) === null || _a === void 0 ? void 0 : _a.backgroundColor) || "transparent",
120
126
  opacity: 0.99, //解决闪退的办法
121
127
  }} // 设置背景色透明,修复android闪白
122
128
  scrollEnabled={false}
@@ -133,7 +139,7 @@ const EchartsView = (props) => {
133
139
  }} source={{
134
140
  baseUrl: "",
135
141
  html: getHtml({
136
- backgroundColor: props.style?.backgroundColor || "transparent",
142
+ backgroundColor: ((_b = props.style) === null || _b === void 0 ? void 0 : _b.backgroundColor) || "transparent",
137
143
  }),
138
144
  }}/>
139
145
  </View>);
@@ -1,3 +1,4 @@
1
+ import { __awaiter } from "tslib";
1
2
  import * as React from "react";
2
3
  import { View, Text, StyleSheet, Platform, StatusBar, TouchableOpacity, Dimensions, } from "react-native";
3
4
  import Modal from "react-native-modal";
@@ -13,16 +14,16 @@ export default React.forwardRef((_, ref) => {
13
14
  const cancelCallbackRef = React.useRef(undefined);
14
15
  const confirmCallbackRef = React.useRef(undefined);
15
16
  React.useImperativeHandle(ref, () => ({
16
- show: async (options) => {
17
+ show: (options) => __awaiter(void 0, void 0, void 0, function* () {
17
18
  setState(Object.assign({}, defaultState, { visible: true }, options));
18
19
  cancelCallbackRef.current = options.cancel;
19
20
  confirmCallbackRef.current = options.confirm;
20
- },
21
+ }),
21
22
  hide,
22
23
  }), []);
23
- const hide = async () => {
24
+ const hide = () => __awaiter(void 0, void 0, void 0, function* () {
24
25
  setState(defaultState);
25
- };
26
+ });
26
27
  React.useEffect(() => {
27
28
  if (Platform.OS == "android") {
28
29
  if (state.visible) {
@@ -91,7 +92,8 @@ export default React.forwardRef((_, ref) => {
91
92
  });
92
93
  export const alertBottomViewRef = React.createRef();
93
94
  export const showAlertBottomModal = (props) => {
94
- alertBottomViewRef.current?.show(props);
95
+ var _a;
96
+ (_a = alertBottomViewRef.current) === null || _a === void 0 ? void 0 : _a.show(props);
95
97
  };
96
98
  // const sleep = (msec?: number) => {
97
99
  // return new Promise(resolve => {
@@ -1,23 +1,25 @@
1
+ import { __awaiter } from "tslib";
1
2
  import * as React from "react";
2
3
  import { Dimensions, Platform, StatusBar, StyleSheet, Text, TouchableOpacity, View, } from "react-native";
3
4
  import Modal from "react-native-modal";
4
5
  import { px2dp } from "../../../screen/px2dp";
5
6
  import { px2sp } from "../../../screen/px2sp";
6
7
  export default React.forwardRef((_, ref) => {
8
+ var _a;
7
9
  const defaultState = {
8
10
  visible: false,
9
11
  actions: [],
10
12
  };
11
13
  const [state, setState] = React.useState(defaultState);
12
14
  React.useImperativeHandle(ref, () => ({
13
- show: async (options) => {
15
+ show: (options) => __awaiter(void 0, void 0, void 0, function* () {
14
16
  setState(Object.assign({}, defaultState, { visible: true }, options));
15
- },
17
+ }),
16
18
  hide,
17
19
  }), []);
18
- const hide = async () => {
20
+ const hide = () => __awaiter(void 0, void 0, void 0, function* () {
19
21
  setState(defaultState);
20
- };
22
+ });
21
23
  React.useEffect(() => {
22
24
  if (Platform.OS == "android") {
23
25
  if (state.visible) {
@@ -42,7 +44,7 @@ export default React.forwardRef((_, ref) => {
42
44
  <View style={styles.container}>
43
45
  <View style={[styles.wrapper]}>
44
46
  <View style={styles.itemContainer}>
45
- {state.actions?.map((i, idx) => (<TouchableOpacity key={`sg-action-${idx}`} style={[styles.item]} activeOpacity={1} onPress={() => {
47
+ {(_a = state.actions) === null || _a === void 0 ? void 0 : _a.map((i, idx) => (<TouchableOpacity key={`sg-action-${idx}`} style={[styles.item]} activeOpacity={1} onPress={() => {
46
48
  hide();
47
49
  i.onClick && i.onClick();
48
50
  }}>
@@ -63,7 +65,8 @@ export default React.forwardRef((_, ref) => {
63
65
  });
64
66
  export const alertSheetViewRef = React.createRef();
65
67
  export const showAlertSheetModal = (props) => {
66
- alertSheetViewRef.current?.show(props);
68
+ var _a;
69
+ (_a = alertSheetViewRef.current) === null || _a === void 0 ? void 0 : _a.show(props);
67
70
  };
68
71
  const styles = StyleSheet.create({
69
72
  container: {
@@ -1,3 +1,4 @@
1
+ import { __awaiter } from "tslib";
1
2
  import * as React from "react";
2
3
  import { View, Text, StyleSheet, Platform, Modal, StatusBar, TouchableOpacity, Animated, Easing, } from "react-native";
3
4
  import { px2dp, deviceWidth } from "../../../screen/px2dp";
@@ -12,20 +13,20 @@ export default React.forwardRef((_, ref) => {
12
13
  const cancelCallbackRef = React.useRef(undefined);
13
14
  const confirmCallbackRef = React.useRef(undefined);
14
15
  React.useImperativeHandle(ref, () => ({
15
- show: async (options) => {
16
+ show: (options) => __awaiter(void 0, void 0, void 0, function* () {
16
17
  setState(Object.assign({}, defaultState, { visible: true }, options));
17
18
  cancelCallbackRef.current = options.cancel;
18
19
  confirmCallbackRef.current = options.confirm;
19
20
  // await sleep(50)
20
21
  startAnimate(1);
21
- },
22
+ }),
22
23
  hide,
23
24
  }), []);
24
- const hide = async () => {
25
+ const hide = () => __awaiter(void 0, void 0, void 0, function* () {
25
26
  startAnimate(0.3);
26
27
  // await sleep(50)
27
28
  setState(defaultState);
28
- };
29
+ });
29
30
  let scale_anim = React.useRef(new Animated.Value(0.3)).current;
30
31
  const startAnimate = (x) => {
31
32
  Animated.timing(scale_anim, {
@@ -100,7 +101,8 @@ export default React.forwardRef((_, ref) => {
100
101
  });
101
102
  export const alertViewRef = React.createRef();
102
103
  export const showAlertModal = (props) => {
103
- alertViewRef.current?.show(props);
104
+ var _a;
105
+ (_a = alertViewRef.current) === null || _a === void 0 ? void 0 : _a.show(props);
104
106
  };
105
107
  // const sleep = (msec?: number) => {
106
108
  // return new Promise(resolve => {
@@ -36,17 +36,11 @@ export const Loading = React.forwardRef((_, ref) => {
36
36
  </TouchableOpacity>);
37
37
  });
38
38
  export const loadingRef = React.createRef();
39
- export const showLoading = (content) => loadingRef.current?.showLoading(content);
40
- export const hideLoading = () => loadingRef.current?.hideLoading();
39
+ export const showLoading = (content) => { var _a; return (_a = loadingRef.current) === null || _a === void 0 ? void 0 : _a.showLoading(content); };
40
+ export const hideLoading = () => { var _a; return (_a = loadingRef.current) === null || _a === void 0 ? void 0 : _a.hideLoading(); };
41
41
  const SCREEN_WIDTH = Dimensions.get("window").width;
42
42
  const styles = StyleSheet.create({
43
- container: {
44
- ...StyleSheet.absoluteFill,
45
- display: "flex",
46
- justifyContent: "center",
47
- alignItems: "center",
48
- // backgroundColor:'red'
49
- },
43
+ container: Object.assign(Object.assign({}, StyleSheet.absoluteFill), { display: "flex", justifyContent: "center", alignItems: "center" }),
50
44
  warpper: {
51
45
  backgroundColor: "#00000088",
52
46
  padding: 40,
@@ -27,21 +27,17 @@ export const PopoverView = React.forwardRef((_, ref) => {
27
27
  }), [visible]);
28
28
  if (!visible)
29
29
  return null;
30
- return (<TouchableOpacity activeOpacity={1} style={[styles.container, options?.style]} disabled={options?.disabled} onPress={(e) => {
30
+ return (<TouchableOpacity activeOpacity={1} style={[styles.container, options === null || options === void 0 ? void 0 : options.style]} disabled={options === null || options === void 0 ? void 0 : options.disabled} onPress={(e) => {
31
31
  setVisible(false);
32
32
  setOptions(undefined);
33
33
  // e.stopPropagation()
34
34
  }}>
35
- {React.isValidElement(options?.content) && options?.content}
35
+ {React.isValidElement(options === null || options === void 0 ? void 0 : options.content) && (options === null || options === void 0 ? void 0 : options.content)}
36
36
  </TouchableOpacity>);
37
37
  });
38
38
  export const popoverViewRef = React.createRef();
39
- export const showPopoverView = (options) => popoverViewRef.current?.showPopoverView(options);
40
- export const hidePopoverView = () => popoverViewRef.current?.hidePopoverView();
39
+ export const showPopoverView = (options) => { var _a; return (_a = popoverViewRef.current) === null || _a === void 0 ? void 0 : _a.showPopoverView(options); };
40
+ export const hidePopoverView = () => { var _a; return (_a = popoverViewRef.current) === null || _a === void 0 ? void 0 : _a.hidePopoverView(); };
41
41
  const styles = StyleSheet.create({
42
- container: {
43
- ...StyleSheet.absoluteFill,
44
- display: "flex",
45
- // backgroundColor:'red'
46
- },
42
+ container: Object.assign(Object.assign({}, StyleSheet.absoluteFill), { display: "flex" }),
47
43
  });
@@ -1,3 +1,4 @@
1
+ import { __awaiter } from "tslib";
1
2
  /*
2
3
  * @Author: shiguo
3
4
  * @Date: 2022-04-24 14:27:02
@@ -41,8 +42,8 @@ export const Scanner = React.forwardRef((_, ref) => {
41
42
  showScanner: _showScanner,
42
43
  hideScanner: _hideScanner,
43
44
  }), [show]);
44
- const _showScanner = async (cb) => {
45
- let res = await requestMultiple([
45
+ const _showScanner = (cb) => __awaiter(void 0, void 0, void 0, function* () {
46
+ let res = yield requestMultiple([
46
47
  PERMISSIONS.IOS.CAMERA,
47
48
  PERMISSIONS.ANDROID.CAMERA,
48
49
  ]);
@@ -51,7 +52,7 @@ export const Scanner = React.forwardRef((_, ref) => {
51
52
  _scanerResultRef.current = null;
52
53
  setShow(true);
53
54
  setPointStyle({});
54
- await utils.sleep();
55
+ yield utils.sleep();
55
56
  animationStart();
56
57
  _cbRef.current = cb;
57
58
  }
@@ -59,12 +60,12 @@ export const Scanner = React.forwardRef((_, ref) => {
59
60
  _hideScanner();
60
61
  showToast("您未开启相机权限,暂不能使用此功能");
61
62
  }
62
- };
63
- const _hideScanner = async () => {
63
+ });
64
+ const _hideScanner = () => __awaiter(void 0, void 0, void 0, function* () {
64
65
  animationStop();
65
- await utils.sleep();
66
+ yield utils.sleep();
66
67
  setShow(false);
67
- };
68
+ });
68
69
  const animation = Animated.loop(Animated.sequence([
69
70
  Animated.timing(moveAnim, {
70
71
  toValue: px2dp(222),
@@ -79,8 +80,9 @@ export const Scanner = React.forwardRef((_, ref) => {
79
80
  useNativeDriver: true,
80
81
  }),
81
82
  ]));
82
- const animationStart = async () => {
83
- cameraRef.current?.resumePreview();
83
+ const animationStart = () => __awaiter(void 0, void 0, void 0, function* () {
84
+ var _a;
85
+ (_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.resumePreview();
84
86
  animation.start(({ finished }) => {
85
87
  // console.log('animationStart finished', finished)
86
88
  if (finished) {
@@ -88,9 +90,10 @@ export const Scanner = React.forwardRef((_, ref) => {
88
90
  animation.start();
89
91
  }
90
92
  });
91
- };
93
+ });
92
94
  const animationStop = (result) => {
93
- cameraRef.current?.pausePreview();
95
+ var _a;
96
+ (_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.pausePreview();
94
97
  animation.stop();
95
98
  };
96
99
  const codeScanner = useCodeScanner({
@@ -98,7 +101,7 @@ export const Scanner = React.forwardRef((_, ref) => {
98
101
  onCodeScanned: (codes) => {
99
102
  console.log(`Scanned ${codes.length} codes!`);
100
103
  let code = codes.find((i) => i.value);
101
- if (code?.value && _scanerResultRef.current == undefined) {
104
+ if ((code === null || code === void 0 ? void 0 : code.value) && _scanerResultRef.current == undefined) {
102
105
  _scanerResultRef.current = code.value;
103
106
  _cbRef.current(code.value);
104
107
  _hideScanner();
@@ -297,5 +300,5 @@ const styles = StyleSheet.create({
297
300
  grantedText: { lineHeight: px2dp(30), color: lineColor, fontWeight: "bold" },
298
301
  });
299
302
  export const scannerRef = React.createRef();
300
- export const showScanner = (cb) => scannerRef.current?.showScanner(cb);
301
- export const hideScanner = () => scannerRef.current?.hideScanner();
303
+ export const showScanner = (cb) => { var _a; return (_a = scannerRef.current) === null || _a === void 0 ? void 0 : _a.showScanner(cb); };
304
+ export const hideScanner = () => { var _a; return (_a = scannerRef.current) === null || _a === void 0 ? void 0 : _a.hideScanner(); };
@@ -33,16 +33,16 @@ export const Toast = React.forwardRef((_, ref) => {
33
33
  fadeAnimation.start();
34
34
  },
35
35
  }));
36
- return (<Animated.View style={{ ...styles.toastContainer, opacity: fade }}>
36
+ return (<Animated.View style={Object.assign(Object.assign({}, styles.toastContainer), { opacity: fade })}>
37
37
  <View style={styles.toastTipsContainer}>
38
- <Text numberOfLines={5} style={{ ...styles.toastTitle }}>
38
+ <Text numberOfLines={5} style={Object.assign({}, styles.toastTitle)}>
39
39
  {tipText}{" "}
40
40
  </Text>
41
41
  </View>
42
42
  </Animated.View>);
43
43
  });
44
44
  export const toastRef = React.createRef();
45
- export const showToast = (content) => toastRef.current?.showToast(content);
45
+ export const showToast = (content) => { var _a; return (_a = toastRef.current) === null || _a === void 0 ? void 0 : _a.showToast(content); };
46
46
  const SCREEN_WIDTH = Dimensions.get("window").width;
47
47
  const styles = StyleSheet.create({
48
48
  toastContainer: {
@@ -1,3 +1,4 @@
1
+ import { __awaiter } from "tslib";
1
2
  import React from "react";
2
3
  import { Image, ScrollView, Text, TouchableOpacity, View, } from "react-native";
3
4
  import { deviceHeight, deviceWidth } from "../../screen/px2dp";
@@ -29,7 +30,8 @@ export default (props) => {
29
30
  // })
30
31
  const getRootViewlayoutPromise = () => {
31
32
  return new Promise((resovle, reject) => {
32
- containerRef.current?.measure((...args) => {
33
+ var _a;
34
+ (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.measure((...args) => {
33
35
  if (args.length == 6) {
34
36
  rootView.current = {
35
37
  width: args[2],
@@ -44,6 +46,7 @@ export default (props) => {
44
46
  });
45
47
  };
46
48
  const getLayoutInfos = () => {
49
+ var _a;
47
50
  let alignVertical = defaultAlignVertical;
48
51
  let alignHorizontal = defaultAlignHorizontal;
49
52
  let width = rootView.current.width;
@@ -59,7 +62,7 @@ export default (props) => {
59
62
  }
60
63
  /**todo: target_width的获取是延迟的,所以这里又问题 */
61
64
  const target_width = sc.current.width;
62
- const target_height = CELL_HEIGHT * (Math.min(props.data?.length || 0, 5) || 0);
65
+ const target_height = CELL_HEIGHT * (Math.min(((_a = props.data) === null || _a === void 0 ? void 0 : _a.length) || 0, 5) || 0);
63
66
  return {
64
67
  alignVertical,
65
68
  alignHorizontal,
@@ -113,53 +116,37 @@ export default (props) => {
113
116
  const PADDING = 10;
114
117
  const ARROW_HEIGHT = 12;
115
118
  const CELL_HEIGHT = 36;
116
- const show = async () => {
119
+ const show = () => __awaiter(void 0, void 0, void 0, function* () {
120
+ var _a, _b;
117
121
  props.onContainerClick && props.onContainerClick();
118
- if (props.data == undefined || props.data?.length == 0)
122
+ if (props.data == undefined || ((_a = props.data) === null || _a === void 0 ? void 0 : _a.length) == 0)
119
123
  return;
120
124
  /**重新获取rootview的定位 */
121
- await getRootViewlayoutPromise();
125
+ yield getRootViewlayoutPromise();
122
126
  /**重新获取rootview的定位 */
123
127
  showPopoverView({
124
- content: (<TouchableOpacity activeOpacity={1} style={{
125
- position: "absolute",
126
- minWidth: deviceWidth * 0.36,
127
- maxWidth: deviceWidth * 0.8,
128
- minHeight: CELL_HEIGHT + PADDING * 2,
129
- maxHeight: CELL_HEIGHT * 5 + PADDING * 2,
130
- borderRadius: 6,
131
- backgroundColor: "#000000ee",
128
+ content: (<TouchableOpacity activeOpacity={1} style={Object.assign({ position: "absolute", minWidth: deviceWidth * 0.36, maxWidth: deviceWidth * 0.8, minHeight: CELL_HEIGHT + PADDING * 2, maxHeight: CELL_HEIGHT * 5 + PADDING * 2, borderRadius: 6, backgroundColor: "#000000ee",
132
129
  // overflow: 'hidden' ,
133
- padding: PADDING,
134
- ...reLayout(),
135
- }}>
136
- <View style={{
137
- width: ARROW_HEIGHT,
138
- height: ARROW_HEIGHT,
139
- backgroundColor: "#000000ee",
140
- position: "absolute",
141
- zIndex: 1,
142
- transform: [{ rotateZ: "45deg" }],
143
- ...(() => {
144
- const { alignVertical, alignHorizontal } = getLayoutInfos();
145
- if (alignVertical == "bottom" && alignHorizontal == "left")
146
- return { left: "20%", top: -5 };
147
- if (alignVertical == "bottom" && alignHorizontal == "right")
148
- return { right: "20%", top: -5 };
149
- if (alignVertical == "top" && alignHorizontal == "left")
150
- return { left: "20%", bottom: -5 };
151
- if (alignVertical == "top" && alignHorizontal == "right")
152
- return { right: "20%", bottom: -5 };
153
- return {};
154
- })(),
155
- }}/>
130
+ padding: PADDING }, reLayout())}>
131
+ <View style={Object.assign({ width: ARROW_HEIGHT, height: ARROW_HEIGHT, backgroundColor: "#000000ee", position: "absolute", zIndex: 1, transform: [{ rotateZ: "45deg" }] }, (() => {
132
+ const { alignVertical, alignHorizontal } = getLayoutInfos();
133
+ if (alignVertical == "bottom" && alignHorizontal == "left")
134
+ return { left: "20%", top: -5 };
135
+ if (alignVertical == "bottom" && alignHorizontal == "right")
136
+ return { right: "20%", top: -5 };
137
+ if (alignVertical == "top" && alignHorizontal == "left")
138
+ return { left: "20%", bottom: -5 };
139
+ if (alignVertical == "top" && alignHorizontal == "right")
140
+ return { right: "20%", bottom: -5 };
141
+ return {};
142
+ })())}/>
156
143
 
157
144
  <ScrollView onLayout={(e) => {
158
145
  // console.log('target onLayout', e.nativeEvent.layout)
159
146
  let _sc = e.nativeEvent.layout;
160
147
  sc.current = _sc;
161
148
  }}>
162
- {props.data?.map((i, idx) => {
149
+ {(_b = props.data) === null || _b === void 0 ? void 0 : _b.map((i, idx) => {
163
150
  return (<TouchableOpacity activeOpacity={0.7} key={`sg-memnu-${idx}`} style={{
164
151
  height: CELL_HEIGHT,
165
152
  display: "flex",
@@ -179,6 +166,6 @@ export default (props) => {
179
166
  </ScrollView>
180
167
  </TouchableOpacity>),
181
168
  });
182
- };
169
+ });
183
170
  return (<TouchableOpacity ref={containerRef} onPress={(e) => show()} {...props}/>);
184
171
  };
@@ -13,19 +13,21 @@ import SYImagePicker from "@aks-dev/react-native-syan-image-picker";
13
13
  let icon_add_image = require("./assets/icon_add_image.png");
14
14
  let icon_del_image = require("./assets/icon_del_image.png");
15
15
  const MutiPictureView = (props) => {
16
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
16
17
  const { bind, maxCount = 6, type = "showImagePicker", addIcon, addIconStyle, addIconContainerStyle, //borderWidth: 1, borderStyle: 'dashed', borderColor: assets.color_A3A9CC 虚线框
17
18
  itemContainerStyle, emptyPlaceHolderStyle, delIcon, delIconStyle, spacingHorizontal = px2dp(15), spacingInner = px2dp(8), editable = true, showEmptyPlaceHolder = false, } = props;
18
19
  const { viewModel, setViewModel } = bind;
19
20
  React.useEffect(() => { }, []);
20
21
  const [sideLength, setSideLength] = React.useState(0);
21
22
  const addPhoto = () => {
23
+ var _a, _b;
22
24
  let images = viewModel.photos || [];
23
25
  if (!images) {
24
26
  throw new Error("viewModel没有定义photos字段");
25
27
  }
26
28
  if (type == "showImagePicker") {
27
29
  SYImagePicker.showImagePicker({
28
- imageCount: maxCount - (viewModel.photos?.length || 0),
30
+ imageCount: maxCount - (((_a = viewModel.photos) === null || _a === void 0 ? void 0 : _a.length) || 0),
29
31
  isCrop: false,
30
32
  isRecordSelected: false,
31
33
  quality: 20,
@@ -41,7 +43,7 @@ const MutiPictureView = (props) => {
41
43
  }
42
44
  if (type == "openCamera") {
43
45
  SYImagePicker.openCamera({
44
- imageCount: maxCount - (viewModel.photos?.length || 0),
46
+ imageCount: maxCount - (((_b = viewModel.photos) === null || _b === void 0 ? void 0 : _b.length) || 0),
45
47
  isCrop: false,
46
48
  isRecordSelected: false,
47
49
  quality: 20,
@@ -66,11 +68,12 @@ const MutiPictureView = (props) => {
66
68
  setViewModel({ photos: photos });
67
69
  };
68
70
  const showPhoto = (index) => {
71
+ var _a;
69
72
  Keyboard.dismiss();
70
- let imgs = (props.value || viewModel.photos)?.filter((it) => {
73
+ let imgs = ((_a = (props.value || viewModel.photos)) === null || _a === void 0 ? void 0 : _a.filter((it) => {
71
74
  return ((typeof it === "string" && it.indexOf("http") >= 0) ||
72
75
  typeof it == "object");
73
- }) || [];
76
+ })) || [];
74
77
  let images = [];
75
78
  // console.log('viewModel', viewModel, imgs)
76
79
  imgs.forEach((it) => {
@@ -110,7 +113,8 @@ const MutiPictureView = (props) => {
110
113
  };
111
114
  const containerRef = React.useRef(null);
112
115
  React.useEffect(() => {
113
- containerRef.current?.measure((...args) => {
116
+ var _a;
117
+ (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.measure((...args) => {
114
118
  // console.log('measure', args[2])
115
119
  if (args.length > 3) {
116
120
  let _sideLength = +((args[2] - spacingHorizontal * 2 - spacingInner * 2) /
@@ -119,48 +123,51 @@ const MutiPictureView = (props) => {
119
123
  }
120
124
  });
121
125
  });
122
- if (props.value && props.value?.length > 0) {
126
+ if (props.value && ((_a = props.value) === null || _a === void 0 ? void 0 : _a.length) > 0) {
123
127
  return (<View style={[styles.container, props.style]} ref={containerRef}>
124
128
  {props.value instanceof Array &&
125
- props.value?.map((item, index) => {
129
+ ((_b = props.value) === null || _b === void 0 ? void 0 : _b.map((item, index) => {
126
130
  return (<ItemView key={index} source={typeof item === "string" ? { uri: item } : item} index={index}/>);
127
- })}
131
+ }))}
128
132
 
129
133
  {showEmptyPlaceHolder &&
130
- maxCount - (props.value?.length || 0) - 1 > 0 &&
134
+ maxCount - (((_c = props.value) === null || _c === void 0 ? void 0 : _c.length) || 0) - 1 > 0 &&
131
135
  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
- ]}/>))}
136
+ length: maxCount - (((_d = props.value) === null || _d === void 0 ? void 0 : _d.length) || 0) - (editable ? 1 : 0),
137
+ }, (_, k) => {
138
+ var _a, _b;
139
+ return (<View key={`sg-showEmptyPlaceHolder-${k}`} style={[
140
+ styles.empty_place_container,
141
+ emptyPlaceHolderStyle,
142
+ itemContainerStyle,
143
+ {
144
+ marginTop: k + (editable ? 1 : 0) + (((_a = props.value) === null || _a === void 0 ? void 0 : _a.length) || 0) > 2
145
+ ? spacingInner
146
+ : 0,
147
+ marginLeft: (k + (editable ? 1 : 0) + (((_b = props.value) === null || _b === void 0 ? void 0 : _b.length) || 0)) %
148
+ 3 ==
149
+ 0
150
+ ? spacingHorizontal
151
+ : spacingInner,
152
+ width: sideLength,
153
+ height: sideLength,
154
+ },
155
+ ]}/>);
156
+ })}
150
157
  </View>);
151
158
  }
152
159
  return (<View style={[styles.container, props.style]} ref={containerRef}>
153
- {viewModel?.photos instanceof Array &&
160
+ {(viewModel === null || viewModel === void 0 ? void 0 : viewModel.photos) instanceof Array &&
154
161
  viewModel.photos.map((item, index) => {
155
162
  return (<ItemView key={index} source={typeof item === "string" ? { uri: item } : item} index={index}/>);
156
163
  })}
157
164
 
158
- {!(viewModel?.photos?.length == maxCount) && editable && (<TouchableOpacity style={[
165
+ {!(((_e = viewModel === null || viewModel === void 0 ? void 0 : viewModel.photos) === null || _e === void 0 ? void 0 : _e.length) == maxCount) && editable && (<TouchableOpacity style={[
159
166
  styles.item_container,
160
167
  itemContainerStyle,
161
168
  {
162
- marginTop: (viewModel?.photos?.length || 0) >= 3 ? spacingInner : 0,
163
- marginLeft: (viewModel?.photos?.length || 0) % 3 == 0
169
+ marginTop: (((_f = viewModel === null || viewModel === void 0 ? void 0 : viewModel.photos) === null || _f === void 0 ? void 0 : _f.length) || 0) >= 3 ? spacingInner : 0,
170
+ marginLeft: (((_g = viewModel === null || viewModel === void 0 ? void 0 : viewModel.photos) === null || _g === void 0 ? void 0 : _g.length) || 0) % 3 == 0
164
171
  ? spacingHorizontal
165
172
  : spacingInner,
166
173
  width: sideLength,
@@ -181,26 +188,29 @@ const MutiPictureView = (props) => {
181
188
  </Text>)}
182
189
  </TouchableOpacity>)}
183
190
  {showEmptyPlaceHolder &&
184
- maxCount - (viewModel.photos?.length || 0) - 1 > 0 &&
191
+ maxCount - (((_h = viewModel.photos) === null || _h === void 0 ? void 0 : _h.length) || 0) - 1 > 0 &&
185
192
  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
- ]}/>))}
193
+ length: maxCount - (((_j = viewModel.photos) === null || _j === void 0 ? void 0 : _j.length) || 0) - (editable ? 1 : 0),
194
+ }, (_, k) => {
195
+ var _a, _b;
196
+ return (<View key={`sg-showEmptyPlaceHolder-${k}`} style={[
197
+ styles.empty_place_container,
198
+ emptyPlaceHolderStyle,
199
+ itemContainerStyle,
200
+ {
201
+ marginTop: k + (editable ? 1 : 0) + (((_a = viewModel.photos) === null || _a === void 0 ? void 0 : _a.length) || 0) > 2
202
+ ? spacingInner
203
+ : 0,
204
+ marginLeft: (k + (editable ? 1 : 0) + (((_b = viewModel.photos) === null || _b === void 0 ? void 0 : _b.length) || 0)) %
205
+ 3 ==
206
+ 0
207
+ ? spacingHorizontal
208
+ : spacingInner,
209
+ width: sideLength,
210
+ height: sideLength,
211
+ },
212
+ ]}/>);
213
+ })}
204
214
  </View>);
205
215
  };
206
216
  const styles = StyleSheet.create({
@@ -9,9 +9,10 @@ import * as React from "react";
9
9
  import { Modal, StatusBar, Platform } from "react-native";
10
10
  import ImageViewer from "react-native-image-zoom-viewer";
11
11
  export const PictureViewer = ({ bind, }) => {
12
+ var _a;
12
13
  const { viewModel, setViewModel } = bind;
13
14
  const visible = viewModel.imageViewer.visible;
14
- const imgs = viewModel.imageViewer.imageUrls?.map((item) => ({ url: item }));
15
+ const imgs = (_a = viewModel.imageViewer.imageUrls) === null || _a === void 0 ? void 0 : _a.map((item) => ({ url: item }));
15
16
  const index = viewModel.imageViewer.index;
16
17
  React.useEffect(() => {
17
18
  if (Platform.OS == "android") {
@@ -32,10 +33,7 @@ export const PictureViewer = ({ bind, }) => {
32
33
  * 请务必注意本属性在 Android 平台上为必填,且会在 modal 处于开启状态时阻止BackHandler事件。
33
34
  */
34
35
  setViewModel({
35
- imageViewer: {
36
- ...viewModel.imageViewer,
37
- visible: false,
38
- },
36
+ imageViewer: Object.assign(Object.assign({}, viewModel.imageViewer), { visible: false }),
39
37
  });
40
38
  }} style={{ margin: 0, backgroundColor: "red" }}>
41
39
  <ImageViewer imageUrls={imgs} index={index} onSwipeDown={() => {
@@ -44,10 +42,7 @@ export const PictureViewer = ({ bind, }) => {
44
42
  // onMove={data => console.log(data)}
45
43
  useNativeDriver={true} enableSwipeDown={true} onClick={() => {
46
44
  setViewModel({
47
- imageViewer: {
48
- ...viewModel.imageViewer,
49
- visible: false,
50
- },
45
+ imageViewer: Object.assign(Object.assign({}, viewModel.imageViewer), { visible: false }),
51
46
  });
52
47
  }}/>
53
48
  </Modal>);
@@ -1,3 +1,4 @@
1
+ import { __rest } from "tslib";
1
2
  import * as React from "react";
2
3
  import { View, Text, Animated, StyleSheet, ActivityIndicator, TouchableOpacity, } from "react-native";
3
4
  import { SwipeListView } from "react-native-swipe-list-view";
@@ -20,7 +21,8 @@ export var RefreshState;
20
21
  RefreshState["None"] = "None";
21
22
  })(RefreshState || (RefreshState = {}));
22
23
  export default React.forwardRef((props, ref) => {
23
- const { mode = "FlatList", refreshState, onHeaderRefresh, onFooterRefresh, reload, ...rest } = props;
24
+ var _a, _b;
25
+ const { mode = "FlatList", refreshState, onHeaderRefresh, onFooterRefresh, reload } = props, rest = __rest(props, ["mode", "refreshState", "onHeaderRefresh", "onFooterRefresh", "reload"]);
24
26
  const seed = React.useRef(Math.random()).current;
25
27
  let onRefresh = () => {
26
28
  if (refreshState == RefreshState.HeaderRefreshing)
@@ -55,7 +57,7 @@ export default React.forwardRef((props, ref) => {
55
57
  let flatListProps = props;
56
58
  return (<Animated.FlatList {...rest} ref={ref} refreshing={refreshState == RefreshState.HeaderRefreshing} keyExtractor={(_, index) => {
57
59
  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" }}>
60
+ }} contentContainerStyle={((_a = flatListProps.data) === null || _a === void 0 ? void 0 : _a.length) ? {} : { height: "100%" }} onRefresh={onRefresh} onEndReachedThreshold={0.1} onEndReached={onEndReached} showsVerticalScrollIndicator={false} ListHeaderComponent={(_) => (<View style={{ display: "flex", flexDirection: "column" }}>
59
61
  <ListHeaderComponent {...flatListProps}/>
60
62
  {/* {flatListProps.ListHeaderComponent} */}
61
63
  </View>)}
@@ -67,7 +69,7 @@ export default React.forwardRef((props, ref) => {
67
69
  const { ItemSeparatorComponent = (_) => <View style={{ height: 1 }}/>, } = sectionListProps;
68
70
  return (<Animated.SectionList {...rest} ref={ref} refreshing={refreshState == RefreshState.HeaderRefreshing} onRefresh={onRefresh} keyExtractor={(_, index) => {
69
71
  return `sg-index-SectionList-${seed}-${index}`;
70
- }} contentContainerStyle={sectionListProps.sections?.length > 0 ? {} : { height: "100%" }} ItemSeparatorComponent={ItemSeparatorComponent} onEndReachedThreshold={0.1} onEndReached={onEndReached} showsVerticalScrollIndicator={false}
72
+ }} contentContainerStyle={((_b = sectionListProps.sections) === null || _b === void 0 ? void 0 : _b.length) > 0 ? {} : { height: "100%" }} ItemSeparatorComponent={ItemSeparatorComponent} onEndReachedThreshold={0.1} onEndReached={onEndReached} showsVerticalScrollIndicator={false}
71
73
  // ListHeaderComponent={(_) => <ListHeaderComponent {...sectionListProps} />}
72
74
  ListHeaderComponent={(_) => (<View style={{ display: "flex", flexDirection: "column" }}>
73
75
  <ListHeaderComponent {...sectionListProps}/>
@@ -97,15 +99,15 @@ const ListFooterComponent = React.memo((props) => {
97
99
  switch (refreshState) {
98
100
  case RefreshState.Idle:
99
101
  case RefreshState.FooterRefreshing:
100
- return (<View style={{ ...styles.container, flexDirection: "row" }}>
102
+ return (<View style={Object.assign(Object.assign({}, styles.container), { flexDirection: "row" })}>
101
103
  <ActivityIndicator color={"gray"}/>
102
- <Text style={{ ...styles.text, marginLeft: 5 }}>
104
+ <Text style={Object.assign(Object.assign({}, styles.text), { marginLeft: 5 })}>
103
105
  {RefreshText.FooterRefreshing}
104
106
  </Text>
105
107
  </View>);
106
108
  case RefreshState.NoMoreData:
107
109
  return (<View style={styles.container}>
108
- <Text style={{ ...styles.text, color: "#999999" }}>
110
+ <Text style={Object.assign(Object.assign({}, styles.text), { color: "#999999" })}>
109
111
  {RefreshText.NoMoreData}
110
112
  </Text>
111
113
  </View>);
@@ -131,8 +133,8 @@ const ListHeaderComponent = React.memo((props) => {
131
133
  const { refreshState } = props;
132
134
  switch (refreshState) {
133
135
  case RefreshState.HeaderRefreshing:
134
- return (<View style={{ ...styles.container }}>
135
- <Text style={{ ...styles.text }}>{RefreshText.HeaderRefreshing}</Text>
136
+ return (<View style={Object.assign({}, styles.container)}>
137
+ <Text style={Object.assign({}, styles.text)}>{RefreshText.HeaderRefreshing}</Text>
136
138
  </View>);
137
139
  default:
138
140
  return <View />;
@@ -1,3 +1,4 @@
1
+ import { __rest } from "tslib";
1
2
  /*
2
3
  * @Author: shiguo
3
4
  * @Date: 2022-07-11 15:42:16
@@ -10,7 +11,7 @@ import { StyleSheet, Text } from "react-native";
10
11
  import { px2sp } from "../../screen/px2sp";
11
12
  import * as utils from "../../utils/lazy";
12
13
  export default (props) => {
13
- const { rich, richStyle, text, suffix, prefix, ...rest } = props;
14
+ const { rich, richStyle, text, suffix, prefix } = props, rest = __rest(props, ["rich", "richStyle", "text", "suffix", "prefix"]);
14
15
  let textStr = "";
15
16
  let richStr = "";
16
17
  if (utils.isString(text) || utils.isNumber(text)) {
@@ -21,25 +22,25 @@ export default (props) => {
21
22
  }
22
23
  let positionStart = 0;
23
24
  let positionEnd = 0;
24
- if (textStr?.indexOf(richStr) >= 0) {
25
+ if ((textStr === null || textStr === void 0 ? void 0 : textStr.indexOf(richStr)) >= 0) {
25
26
  positionStart = textStr.indexOf(richStr);
26
27
  positionEnd = positionStart + richStr.length;
27
28
  }
28
29
  if (prefix) {
29
30
  return (<Text style={styles.container} {...rest}>
30
- <Text style={{ ...styles.defaultRich, ...richStyle }}>{richStr}</Text>
31
+ <Text style={Object.assign(Object.assign({}, styles.defaultRich), richStyle)}>{richStr}</Text>
31
32
  {textStr}
32
33
  </Text>);
33
34
  }
34
35
  if (suffix) {
35
36
  return (<Text style={styles.container} {...rest}>
36
37
  {textStr}
37
- <Text style={{ ...styles.defaultRich, ...richStyle }}>{richStr}</Text>
38
+ <Text style={Object.assign(Object.assign({}, styles.defaultRich), richStyle)}>{richStr}</Text>
38
39
  </Text>);
39
40
  }
40
41
  return (<Text style={styles.container} {...rest}>
41
42
  {textStr.substring(0, positionStart)}
42
- {positionEnd > 0 && (<Text style={{ ...styles.defaultRich, ...richStyle }}>{richStr}</Text>)}
43
+ {positionEnd > 0 && (<Text style={Object.assign(Object.assign({}, styles.defaultRich), richStyle)}>{richStr}</Text>)}
43
44
  {textStr.substring(positionEnd, textStr.length)}
44
45
  </Text>);
45
46
  };
@@ -8,13 +8,9 @@ export default (props) => {
8
8
  <View style={[
9
9
  styles.warpper,
10
10
  props.showUnderline
11
- ? {
12
- borderBottomColor: "#f2f2f2",
11
+ ? Object.assign({ borderBottomColor: "#f2f2f2",
13
12
  // borderBottomWidth: StyleSheet.hairlineWidth,
14
- borderBottomWidth: px2dp(1),
15
- ...props.underlineStyle,
16
- }
17
- : {},
13
+ borderBottomWidth: px2dp(1) }, props.underlineStyle) : {},
18
14
  ]}>
19
15
  {props.icon && (<Image style={[
20
16
  { width: px2dp(20), height: px2dp(20), marginRight: px2dp(8) },
@@ -23,9 +19,10 @@ export default (props) => {
23
19
  <View style={[styles.middle, props.middleContaierStyle]}>
24
20
  {/* 标题 */}
25
21
  {(() => {
22
+ var _a;
26
23
  if (typeof props.title === "string" ||
27
24
  typeof props.title === "number") {
28
- return (<Text numberOfLines={1} {...props.titleOptions} style={[styles.title, props.titleOptions?.style]}>
25
+ return (<Text numberOfLines={1} {...props.titleOptions} style={[styles.title, (_a = props.titleOptions) === null || _a === void 0 ? void 0 : _a.style]}>
29
26
  {props.title}
30
27
  </Text>);
31
28
  }
@@ -35,9 +32,10 @@ export default (props) => {
35
32
  })()}
36
33
 
37
34
  {(() => {
35
+ var _a;
38
36
  if (typeof props.content === "string" ||
39
37
  typeof props.content === "number") {
40
- return (<Text numberOfLines={1} {...props.contentOptions} style={[styles.content, props.contentOptions?.style]}>
38
+ return (<Text numberOfLines={1} {...props.contentOptions} style={[styles.content, (_a = props.contentOptions) === null || _a === void 0 ? void 0 : _a.style]}>
41
39
  {props.content}
42
40
  </Text>);
43
41
  }
@@ -1,3 +1,4 @@
1
+ import { __rest } from "tslib";
1
2
  /*
2
3
  * @Author: shiguo
3
4
  * @Date: 2022-04-24 13:56:47
@@ -10,7 +11,7 @@ import { View, Text, TextInput, StyleSheet, } from "react-native";
10
11
  import { px2dp } from "../../screen/px2dp";
11
12
  import { px2sp } from "../../screen/px2sp";
12
13
  export default React.forwardRef((props, ref) => {
13
- const { defaultValue, placeholder, maxLength = 200, on, ...rest } = props;
14
+ const { defaultValue, placeholder, maxLength = 200, on } = props, rest = __rest(props, ["defaultValue", "placeholder", "maxLength", "on"]);
14
15
  const [value, setValue] = React.useState(defaultValue);
15
16
  React.useLayoutEffect(() => {
16
17
  setValue(defaultValue);
@@ -26,11 +27,8 @@ export default React.forwardRef((props, ref) => {
26
27
 
27
28
  <View style={styles.corner}>
28
29
  <Text style={styles.limit}>
29
- <Text style={{
30
- ...styles.limit,
31
- color: value && value?.length > maxLength - 5 ? "red" : "#AFAFAF",
32
- }}>
33
- {value?.length || 0}
30
+ <Text style={Object.assign(Object.assign({}, styles.limit), { color: value && (value === null || value === void 0 ? void 0 : value.length) > maxLength - 5 ? "red" : "#AFAFAF" })}>
31
+ {(value === null || value === void 0 ? void 0 : value.length) || 0}
34
32
  </Text>
35
33
  /{maxLength}
36
34
  </Text>
@@ -42,5 +42,5 @@ export const getNavigationBarHeight = () => {
42
42
  */
43
43
  export const gotoDesktop = () => {
44
44
  if (Platform.OS == "android")
45
- RNEasyui?.gotoDesktop();
45
+ RNEasyui === null || RNEasyui === void 0 ? void 0 : RNEasyui.gotoDesktop();
46
46
  };
@@ -1,3 +1,4 @@
1
+ import { __awaiter } from "tslib";
1
2
  /*
2
3
  * @Author: shiguo
3
4
  * @Date: 2022-05-05 14:19:39
@@ -20,11 +21,11 @@ export const getAppVersion = () => UpgradeModule.getAppVersion();
20
21
  * @return {*}
21
22
  */
22
23
  export const getOSVersion = () => UpgradeModule.getOSVersion();
23
- export const upgrade = async (options) => {
24
+ export const upgrade = (options) => __awaiter(void 0, void 0, void 0, function* () {
24
25
  const { title = "提示" } = options;
25
26
  if (Platform.OS == "android") {
26
27
  try {
27
- const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE, {
28
+ const granted = yield PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE, {
28
29
  title: "提示",
29
30
  message: "应用升级需要获取APP的写入权限",
30
31
  buttonNeutral: "稍后再询问",
@@ -41,4 +42,4 @@ export const upgrade = async (options) => {
41
42
  }
42
43
  }
43
44
  return UpgradeModule.upgrade(options);
44
- };
45
+ });
@@ -12,14 +12,9 @@ import React from 'react';
12
12
  import { Platform, Text as Text_spaceName, TextInput as TextInput_spaceName } from 'react-native';
13
13
  const Text = Text_spaceName;
14
14
  const TextInput = TextInput_spaceName;
15
- const textDefaultStyle = {
16
- ...Platform.select({
17
- android: { fontFamily: 'DroidSansFallback' }
18
- }),
19
- allowFontScaling: false,
20
- paddingVertical: 0,
21
- paddingHorizontal: 0,
22
- };
15
+ const textDefaultStyle = Object.assign(Object.assign({}, Platform.select({
16
+ android: { fontFamily: 'DroidSansFallback' }
17
+ })), { allowFontScaling: false, paddingVertical: 0, paddingHorizontal: 0 });
23
18
  const textRender = Text.render;
24
19
  Text.render = function (...args) {
25
20
  const origin = textRender.call(this, ...args);
@@ -5,6 +5,7 @@
5
5
  * @LastEditTime: 2023-03-23 15:07:44
6
6
  * @FilePath: /@aks-dev/easyui/utils/lazy.ts
7
7
  */
8
+ import { __awaiter } from "tslib";
8
9
  /**
9
10
  * @description: 睡眠时间
10
11
  * @param {*}毫秒值
@@ -28,19 +29,19 @@ export const randomcolor = () => {
28
29
  * @param {*} dataList:数据源
29
30
  * @return {*}
30
31
  */
31
- export const syncLoop = async (dataList, callback) => {
32
+ export const syncLoop = (dataList, callback) => __awaiter(void 0, void 0, void 0, function* () {
32
33
  const length = dataList.length;
33
34
  const O = Object(dataList);
34
35
  let k = 0;
35
36
  while (k < length) {
36
37
  if (k in O) {
37
38
  const kValue = O[k];
38
- await callback(kValue, k);
39
+ yield callback(kValue, k);
39
40
  }
40
41
  k++;
41
42
  }
42
43
  return Promise.resolve("SyncForeach loop over");
43
- };
44
+ });
44
45
  /**
45
46
  * @description: 对11位手机号码加*
46
47
  * @return {*}
@@ -253,14 +254,16 @@ export const isChainChar = (str) => {
253
254
  return true;
254
255
  };
255
256
  export const isHaveChartCount = (str) => {
257
+ var _a;
256
258
  if (/[a-z]/i.test(str)) {
257
- return str.match(/[a-z]/gi)?.length;
259
+ return (_a = str.match(/[a-z]/gi)) === null || _a === void 0 ? void 0 : _a.length;
258
260
  }
259
261
  return 0;
260
262
  };
261
263
  export const isHaveNumberCount = (str) => {
264
+ var _a;
262
265
  if (/[0-9]/i.test(str)) {
263
- return str.match(/[0-9]/gi)?.length;
266
+ return (_a = str.match(/[0-9]/gi)) === null || _a === void 0 ? void 0 : _a.length;
264
267
  }
265
268
  return 0;
266
269
  };
package/package.json CHANGED
@@ -1,13 +1,9 @@
1
1
  {
2
2
  "name": "@aks-dev/easyui",
3
- "version": "1.0.189",
3
+ "version": "1.0.191",
4
4
  "description": "工具箱",
5
- "exports": {
6
- ".": {
7
- "types": "./types/index.d.ts",
8
- "import": "./dist/index.js"
9
- }
10
- },
5
+ "main": "./dist/index.js",
6
+ "types": "./types/index.d.ts",
11
7
  "scripts": {
12
8
  "test": "yarn run lint",
13
9
  "release": "yarn semantic-release",