@ledvance/group-ui-biz-bundle 1.0.110 → 1.0.112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/group-ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.0.110",
7
+ "version": "1.0.112",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -10,7 +10,7 @@ import { useReactive, useUpdateEffect } from "ahooks";
10
10
  import { cloneDeep } from "lodash";
11
11
  import ThemeType from '@ledvance/base/src/config/themeType'
12
12
 
13
- const { convertX: cx, height } = Utils.RatioUtils
13
+ const { convertX: cx, height, statusBarHeight } = Utils.RatioUtils
14
14
  const { withTheme } = Utils.ThemeUtils
15
15
 
16
16
  export const UnitList = [
@@ -57,23 +57,44 @@ const EnergyModal = (props: EnergyModalProps) => {
57
57
  };
58
58
 
59
59
  const getDescription = (string: string) => {
60
- const separators = /[.:]/;
61
- const text = string.split(separators)
62
- const length = text.length - 1
63
- return <View>
64
- <Text style={{ color: props.theme?.global.fontColor }}>{text[length - 6] + '.'}</Text>
65
- <Spacer />
66
- <Text style={{ color: props.theme?.global.fontColor }}>{text[length - 5] + '.'}</Text>
67
- <Spacer />
68
- <Text style={{ color: props.theme?.global.fontColor }}>{text[length - 4] + text[length - 3] + ':'}</Text>
69
- <Spacer />
70
- <Text
71
- style={{ textDecorationLine: 'underline', color: props.theme?.button.primary }}
72
- onPress={() => openLink(`${text[length - 2]}:${text[length - 1]}${text[length]}`)}
73
- >
74
- {`${text[length - 2]}:${text[length - 1]}${text[length]}`}
75
- </Text>
76
- </View>
60
+ // 首先提取URL
61
+ const urlRegex = /(https?:\/\/[^\s]+)$/;
62
+ const urlMatch = string.match(urlRegex);
63
+ const url = urlMatch ? urlMatch[0] : '';
64
+
65
+ // 移除URL部分以处理正文文本
66
+ const textWithoutUrl = urlMatch
67
+ ? string.slice(0, string.lastIndexOf(url)).trim()
68
+ : string;
69
+
70
+ // 分割文本但保留分隔符
71
+ const sentences:string[] = [];
72
+ const parts = textWithoutUrl.split(/([.:])/);
73
+
74
+ for (let i = 0; i < parts.length - 1; i += 2) {
75
+ if (i + 1 < parts.length) {
76
+ sentences.push(parts[i] + parts[i + 1]);
77
+ }
78
+ }
79
+
80
+ return (
81
+ <View>
82
+ {sentences.map((sentence, index) => (
83
+ <View key={index}>
84
+ <Text style={{ color: props.theme?.global.fontColor }}>{sentence.trim()}</Text>
85
+ <Spacer />
86
+ </View>
87
+ ))}
88
+ {url && (
89
+ <Text
90
+ style={{ textDecorationLine: 'underline', color: props.theme?.button.primary }}
91
+ onPress={() => openLink(url)}
92
+ >
93
+ {url}
94
+ </Text>
95
+ )}
96
+ </View>
97
+ );
77
98
  }
78
99
 
79
100
  useUpdateEffect(() =>{
@@ -224,7 +245,7 @@ const EnergyModal = (props: EnergyModalProps) => {
224
245
  </View>
225
246
  ),
226
247
  wrapperStyle: {
227
- height: height - cx(40),
248
+ height: height - statusBarHeight - cx(40),
228
249
  backgroundColor: props.theme?.global.background
229
250
  },
230
251
  footer: (<View style={{ backgroundColor: props.theme?.global.background}}></View>),
@@ -286,7 +307,7 @@ const EnergyModal = (props: EnergyModalProps) => {
286
307
  <Text style={{ color: props.theme?.button.primary, fontSize: cx(16) }}>{props.confirmText}</Text>
287
308
  </TouchableOpacity>
288
309
  </View>
289
- <View style={{ height: height - cx(100), paddingHorizontal: cx(16), backgroundColor: props.theme?.global.background }}>
310
+ <View style={{ height: height - statusBarHeight - cx(100), paddingHorizontal: cx(16), backgroundColor: props.theme?.global.background }}>
290
311
  {getContent()}
291
312
  </View>
292
313
  </ScrollView>