@ledvance/ui-biz-bundle 1.1.55 → 1.1.57

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 (70) hide show
  1. package/package.json +2 -1
  2. package/src/modules/biorhythm/Router.ts +34 -0
  3. package/src/modules/fixedTime/Router.ts +26 -0
  4. package/src/modules/flags/FlagActions.ts +12 -4
  5. package/src/modules/flags/FlagPage.tsx +31 -11
  6. package/src/modules/flags/Router.ts +25 -0
  7. package/src/modules/history/Router.ts +16 -0
  8. package/src/modules/mood/FantasyRouter.ts +35 -0
  9. package/src/modules/mood/MixMood/Router.ts +44 -0
  10. package/src/modules/mood/Router.ts +53 -0
  11. package/src/modules/music/Router.ts +16 -0
  12. package/src/modules/powerOnBehavior/Router.ts +16 -0
  13. package/src/modules/randomTime/Router.ts +25 -0
  14. package/src/modules/sleepWakeup/Router.ts +25 -0
  15. package/src/modules/timeSchedule/Router.ts +25 -0
  16. package/src/modules/timer/Router.ts +16 -0
  17. package/src/navigation/Routers.d.ts +0 -7
  18. package/src/navigation/Routers.ts +15 -304
  19. package/src/newModules/childLock/ChildLockPage.tsx +97 -0
  20. package/src/newModules/childLock/Router.ts +16 -0
  21. package/src/newModules/energyConsumption/EnergyConsumptionActions.ts +23 -0
  22. package/src/newModules/energyConsumption/EnergyConsumptionChart.tsx +84 -0
  23. package/src/newModules/energyConsumption/EnergyConsumptionDetail.tsx +321 -0
  24. package/src/newModules/energyConsumption/EnergyConsumptionPage.tsx +392 -0
  25. package/src/newModules/energyConsumption/Router.ts +34 -0
  26. package/src/newModules/energyConsumption/co2Data.ts +23655 -0
  27. package/src/newModules/energyConsumption/component/BarChart.tsx +93 -0
  28. package/src/newModules/energyConsumption/component/EnergyModal.tsx +282 -0
  29. package/src/newModules/energyConsumption/component/Overview.tsx +116 -0
  30. package/src/newModules/fixedTime/FixedTimeActions.ts +234 -0
  31. package/src/newModules/fixedTime/FixedTimeDetailPage.tsx +341 -0
  32. package/src/newModules/fixedTime/FixedTimePage.tsx +231 -0
  33. package/src/newModules/fixedTime/Router.ts +25 -0
  34. package/src/newModules/lightMode/LightModePage.tsx +204 -0
  35. package/src/newModules/lightMode/Router.ts +16 -0
  36. package/src/newModules/mood/AddMoodPage.tsx +178 -0
  37. package/src/newModules/mood/DynamicMoodEditorPage.tsx +653 -0
  38. package/src/newModules/mood/Interface.ts +219 -0
  39. package/src/newModules/mood/MixDynamicMoodEditor.tsx +781 -0
  40. package/src/newModules/mood/MoodActions.ts +235 -0
  41. package/src/newModules/mood/MoodInfo.ts +2151 -0
  42. package/src/newModules/mood/MoodItem.tsx +148 -0
  43. package/src/newModules/mood/MoodPage.tsx +385 -0
  44. package/src/newModules/mood/MoodParse.ts +442 -0
  45. package/src/newModules/mood/RecommendMoodItem.tsx +68 -0
  46. package/src/newModules/mood/Router.ts +53 -0
  47. package/src/newModules/mood/StaticMoodEditorPage.tsx +343 -0
  48. package/src/newModules/mood/tools.ts +12 -0
  49. package/src/newModules/overchargeSwitch/OverchargeSwitchPage.tsx +96 -0
  50. package/src/newModules/overchargeSwitch/Router.ts +16 -0
  51. package/src/newModules/powerOnBehavior/LightBehaviorPage.tsx +266 -0
  52. package/src/newModules/powerOnBehavior/PlugBehaviorPage.tsx +173 -0
  53. package/src/newModules/powerOnBehavior/PowerOnBehaviorActions.ts +106 -0
  54. package/src/newModules/powerOnBehavior/Router.ts +16 -0
  55. package/src/newModules/randomTime/RandomTimeActions.ts +232 -0
  56. package/src/newModules/randomTime/RandomTimeDetailPage.tsx +322 -0
  57. package/src/newModules/randomTime/RandomTimePage.tsx +230 -0
  58. package/src/newModules/randomTime/Router.ts +25 -0
  59. package/src/newModules/randomTime/Summary.tsx +116 -0
  60. package/src/newModules/swithInching/Router.ts +16 -0
  61. package/src/newModules/swithInching/SwithInching.tsx +231 -0
  62. package/src/newModules/swithInching/SwithInchingAction.ts +55 -0
  63. package/src/newModules/swithInching/pickerView.tsx +91 -0
  64. package/src/newModules/timeSchedule/Interface.ts +111 -0
  65. package/src/newModules/timeSchedule/Router.ts +25 -0
  66. package/src/newModules/timeSchedule/TimeScheduleActions.ts +53 -0
  67. package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +662 -0
  68. package/src/newModules/timeSchedule/TimeSchedulePage.tsx +222 -0
  69. package/src/newModules/timeSchedule/components/ManuaSettings.tsx +259 -0
  70. package/src/newModules/timeSchedule/components/ScheduleCard.tsx +109 -0
@@ -0,0 +1,93 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import ECharts from '@ledvance/react-native-echarts-pro';
4
+ import I18n from "@ledvance/base/src/i18n";
5
+
6
+ const BarChartWithTouch = ({ data, height, width }) => {
7
+ const dataX = data?.map(item => { return item.chartTitle });
8
+ const dataY = data?.map(item => { return item.value });
9
+ const option = {
10
+ title: {
11
+ text: I18n.getLang('consumption_data_annual_bar_chart_text'),
12
+ textStyle: {
13
+ fontSize: 14,
14
+ color: "#666666",
15
+ },
16
+ top: 10,
17
+ },
18
+ tooltip: {
19
+ show: false,
20
+ },
21
+ grid: {
22
+ width,
23
+ right: "20%",
24
+ left: '10%'
25
+ },
26
+ xAxis: {
27
+ data: dataX,
28
+ axisTick: {
29
+ show: false
30
+ },
31
+ axisLabel: {
32
+ show: true,
33
+ color: '#999999',
34
+ interval: 0,
35
+ }
36
+ },
37
+ yAxis: {
38
+ min: data?.length === 0 && 0.6 || 0
39
+ },
40
+ series: [
41
+ {
42
+ type: 'bar',
43
+ data: dataY,
44
+ itemStyle: {
45
+ emphasis: {
46
+ color: '#FF6600', // Color when bar is clicked
47
+ },
48
+ color: '#FFC2A9',
49
+ borderRadius: 2
50
+ },
51
+ barMaxWidth: 10,
52
+ label: {
53
+ show: false, // 开启显示
54
+ position: 'top', // 在上方显示
55
+ distance: 10, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。
56
+ verticalAlign: 'middle',
57
+ textStyle: { // 数值样式
58
+ color: 'black',
59
+ fontSize: 12
60
+ },
61
+ },
62
+ select: {
63
+ label: {
64
+ show: true,
65
+ align: "center",
66
+ verticalAlign: "bottom"
67
+ },
68
+ itemStyle: {
69
+ borderColor: '#FFC2A9'
70
+ }
71
+ },
72
+ selectedMode: "single"
73
+ },
74
+ ],
75
+ dataZoom: {
76
+ start: 0,
77
+ type: "inside",
78
+ maxValueSpan: 5
79
+ },
80
+ customMapData: {}
81
+ };
82
+
83
+ return (
84
+ <View style={{ flex: 1 }}>
85
+ <ECharts
86
+ option={option}
87
+ height={height}
88
+ />
89
+ </View>
90
+ );
91
+ };
92
+
93
+ export default BarChartWithTouch;
@@ -0,0 +1,282 @@
1
+ import React from "react";
2
+ import Card from "@ledvance/base/src/components/Card";
3
+ import Spacer from "@ledvance/base/src/components/Spacer";
4
+ import TextFieldStyleButton from "@ledvance/base/src/components/TextFieldStyleButton";
5
+ import I18n from "@ledvance/base/src/i18n";
6
+ import res from "@ledvance/base/src/res";
7
+ import { TouchableOpacity, View, Text, TextInput, StyleSheet, Linking, FlatList, Image, ScrollView } from "react-native";
8
+ import { Utils, Modal, Popup } from "tuya-panel-kit";
9
+ import { useReactive, useUpdateEffect } from "ahooks";
10
+ import { cloneDeep } from "lodash";
11
+
12
+ const { convertX: cx, height } = Utils.RatioUtils
13
+
14
+ export const UnitList = [
15
+ I18n.getLang('consumption_data_price_per_kwh_currency_value1'),
16
+ I18n.getLang('consumption_data_price_per_kwh_currency_value2'),
17
+ I18n.getLang('consumption_data_price_per_kwh_currency_value3'),
18
+ I18n.getLang('consumption_data_price_per_kwh_currency_value4')
19
+ ]
20
+
21
+ export interface EnergyData {
22
+ price: string
23
+ unit: string
24
+ }
25
+ interface EnergyModalProps {
26
+ visible: boolean
27
+ popupType: 'money' | 'co2' | 'unit'
28
+ title: string
29
+ confirmText?: string
30
+ cancelText?: string
31
+ energyData?: EnergyData
32
+ motionType?: 'none'
33
+ onConfirm?: (data?: EnergyData) => void
34
+ onCancel?: () => void
35
+ }
36
+ const EnergyModal = (props: EnergyModalProps) => {
37
+ const state = useReactive({
38
+ energyData: cloneDeep(props.energyData),
39
+ unitPopup: false
40
+ })
41
+
42
+
43
+ const openLink = (url: string) => {
44
+ Linking.openURL(url).catch((error) => console.error('无法打开链接:', error));
45
+ };
46
+
47
+ const getDescription = (string: string) => {
48
+ const separators = /[.:]/;
49
+ const text = string.split(separators)
50
+ const length = text.length - 1
51
+ return <View>
52
+ <Text style={{ color: '#000' }}>{text[length - 6] + '.'}</Text>
53
+ <Spacer />
54
+ <Text style={{ color: '#000' }}>{text[length - 5] + '.'}</Text>
55
+ <Spacer />
56
+ <Text style={{ color: '#000' }}>{text[length - 4] + text[length - 3] + ':'}</Text>
57
+ <Spacer />
58
+ <Text
59
+ style={{ textDecorationLine: 'underline', color: '#ff6600' }}
60
+ onPress={() => openLink(`${text[length - 2]}:${text[length - 1]}${text[length]}`)}
61
+ >
62
+ {`${text[length - 2]}:${text[length - 1]}${text[length]}`}
63
+ </Text>
64
+ </View>
65
+ }
66
+
67
+ useUpdateEffect(() =>{
68
+ state.energyData = cloneDeep(props.energyData)
69
+ }, [props.energyData])
70
+
71
+
72
+ const getContent = () => {
73
+ if (props.popupType === 'money') {
74
+ return (
75
+ <View>
76
+ <Spacer />
77
+ <Text style={styles.popupTip}>{I18n.getLang('consumption_data_price_per_kwh_headline_text')}</Text>
78
+ <Spacer height={cx(40)} />
79
+ <Text style={{ fontSize: cx(14), color: '#000' }}>{I18n.getLang('consumption_data_price_per_kwh_description_text')}</Text>
80
+ <Spacer height={cx(15)} />
81
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
82
+ <View style={{ flex: 3 }}>
83
+ <Spacer height={cx(4)} />
84
+ <Text style={{ color: '#666', marginStart: cx(13), fontFamily: 'helvetica_neue_lt_std_bd' }}>{I18n.getLang('consumption_data_price_per_kwh_headline_text')}</Text>
85
+ <View style={styles.textInputGroup}>
86
+ <TextInput
87
+ value={state.energyData?.price}
88
+ onChangeText={(t: string) => {
89
+ const value = t.replace(/[^0-9.,]/g, '')
90
+ if (Number(value) > 999999) {
91
+ if (state.energyData) state.energyData.price = '999999'
92
+ } else {
93
+ if (state.energyData) state.energyData.price = value
94
+ }
95
+ }}
96
+ style={styles.textInput}
97
+ keyboardType="numeric"
98
+ />
99
+ <View style={styles.line} />
100
+ </View>
101
+ </View>
102
+ <View style={{ flex: 2, marginLeft: cx(20) }}>
103
+ <TextFieldStyleButton
104
+ text={state.energyData?.unit || ''}
105
+ placeholder={I18n.getLang('consumption_data_price_per_kwh_currency_headline_text')}
106
+ onPress={() => (
107
+ energyPopup({
108
+ energyData: state.energyData,
109
+ onItemClick: (title) => {
110
+ if (state.energyData) state.energyData.unit = title
111
+ }
112
+ })
113
+ )}
114
+ />
115
+ </View>
116
+ </View>
117
+ </View>
118
+ )
119
+ } else if (props.popupType === 'unit') {
120
+ return (
121
+ <View>
122
+ <Spacer />
123
+ <Card>
124
+ <FlatList
125
+ data={UnitList}
126
+ renderItem={({ item }) => (
127
+ <View style={styles.unitItem}>
128
+ <Text style={{ fontSize: cx(16), color: '#000' }}>{item}</Text>
129
+ {props.energyData && props.energyData.unit === item && <Image
130
+ style={{ width: cx(16), height: cx(16) }}
131
+ source={res.app_music_check}
132
+ resizeMode="contain"
133
+ />}
134
+ </View>
135
+ )}
136
+ ItemSeparatorComponent={() => (
137
+ <View style={{ flex: 1, height: 1, backgroundColor: '#ccc' }}></View>
138
+ )}
139
+ keyExtractor={item => item}
140
+ />
141
+ </Card>
142
+ </View>
143
+ )
144
+ } else {
145
+ return (
146
+ <View>
147
+ <Spacer />
148
+ <Text style={styles.popupTip}>{I18n.getLang('consumption_data_field3_co2_topic_headline')}</Text>
149
+ <Spacer height={cx(40)} />
150
+ {getDescription(I18n.getLang('consumption_data_field3_co2_inforamtion_decription_text'))}
151
+ </View>
152
+ )
153
+ }
154
+
155
+ }
156
+ return (
157
+ <Modal
158
+ visible={props.visible}
159
+ >
160
+ <ScrollView>
161
+ <View style={{ backgroundColor: '#DFDEDE', flexDirection: 'row', height: cx(60), justifyContent: 'space-between', alignItems: 'center', borderTopLeftRadius: cx(10), borderTopRightRadius: cx(10), paddingHorizontal: cx(8) }}>
162
+ <TouchableOpacity onPress={() => {
163
+ props.onCancel && props.onCancel()
164
+ }}>
165
+ <Text style={{ color: '#FF6600', fontSize: cx(16) }}>{props.cancelText}</Text>
166
+ </TouchableOpacity>
167
+ <Text style={{ color: '#000', fontSize: cx(16), fontWeight: 'bold' }}>{props.title}</Text>
168
+ <TouchableOpacity onPress={() => {
169
+ props.onConfirm && props.onConfirm(state.energyData)
170
+ }}>
171
+ <Text style={{ color: '#FF6600', fontSize: cx(16) }}>{props.confirmText}</Text>
172
+ </TouchableOpacity>
173
+ </View>
174
+ <View style={{ height: height - cx(100), paddingHorizontal: cx(16), backgroundColor: '#fff' }}>
175
+ {getContent()}
176
+ </View>
177
+ </ScrollView>
178
+ </Modal>
179
+ )
180
+ }
181
+
182
+ const styles = StyleSheet.create({
183
+ popupTip: {
184
+ fontSize: cx(16),
185
+ color: '#000',
186
+ fontWeight: 'bold'
187
+ },
188
+ textInput: {
189
+ flex: 1,
190
+ height: cx(44),
191
+ marginStart: cx(16),
192
+ marginEnd: cx(6),
193
+ fontSize: cx(16),
194
+ color: '#000',
195
+ fontFamily: 'helvetica_neue_lt_std_roman',
196
+ },
197
+ textInputGroup: {
198
+ flexDirection: 'row',
199
+ borderRadius: cx(4),
200
+ backgroundColor: '#F6F6F6',
201
+ alignItems: 'center',
202
+ },
203
+ iconTouchable: {
204
+ marginEnd: cx(18),
205
+ padding: cx(4),
206
+ },
207
+ line: {
208
+ height: 1,
209
+ position: 'absolute',
210
+ start: cx(4),
211
+ end: cx(4),
212
+ bottom: 0,
213
+ backgroundColor: '#cbcbcb',
214
+ },
215
+ unitItem: {
216
+ flexDirection: 'row',
217
+ justifyContent: 'space-between',
218
+ paddingHorizontal: cx(10),
219
+ alignItems: 'center',
220
+ height: cx(40),
221
+
222
+ }
223
+ })
224
+
225
+ const energyPopup = (props: {
226
+ energyData?: EnergyData,
227
+ onItemClick: (unit: string) => void
228
+ }) => {
229
+ return (
230
+ Popup.custom({
231
+ title: (
232
+ <View style={{ backgroundColor: '#DFDEDE', flexDirection: 'row', height: cx(60), justifyContent: 'space-between', alignItems: 'center', borderTopLeftRadius: cx(10), borderTopRightRadius: cx(10), paddingHorizontal: cx(8) }}>
233
+ <TouchableOpacity onPress={() => Popup.close()}>
234
+ <Text style={{ color: '#FF6600', fontSize: cx(16) }}>{I18n.getLang('auto_scan_system_cancel')}</Text>
235
+ </TouchableOpacity>
236
+ </View>
237
+ ),
238
+ wrapperStyle: {
239
+ height: height - cx(40)
240
+ },
241
+ footer: (<View></View>),
242
+ onMaskPress: () => { },
243
+ motionType: 'none',
244
+ useKeyboardView: true,
245
+ content: (
246
+ <View
247
+ style={{ paddingHorizontal: cx(16) }}>
248
+ <Spacer />
249
+ <Card>
250
+ <FlatList
251
+ data={UnitList}
252
+ renderItem={({ item }) => (
253
+ <TouchableOpacity
254
+ onPress={() => {
255
+ props.onItemClick(item)
256
+ Popup.close()
257
+ }}
258
+ >
259
+ <View style={styles.unitItem}>
260
+ <Text style={{ fontSize: cx(16), color: '#000' }}>{item}</Text>
261
+ {props.energyData && props.energyData.unit === item && <Image
262
+ style={{ width: cx(16), height: cx(16) }}
263
+ source={res.app_music_check}
264
+ resizeMode="contain"
265
+ />}
266
+ </View>
267
+ </TouchableOpacity>
268
+ )}
269
+ ItemSeparatorComponent={() => (
270
+ <View style={{ flex: 1, height: 1, backgroundColor: '#ccc' }}></View>
271
+ )}
272
+ keyExtractor={item => item}
273
+ />
274
+ </Card>
275
+ <Spacer />
276
+ </View>
277
+ )
278
+ })
279
+ )
280
+ }
281
+
282
+ export default EnergyModal
@@ -0,0 +1,116 @@
1
+ import React from "react";
2
+ import { View, Text, StyleProp, ViewStyle, TouchableOpacity, Image, FlatList, StyleSheet } from "react-native";
3
+ import { Utils } from "tuya-panel-kit";
4
+ import res from "@ledvance/base/src/res";
5
+ import Spacer from "@ledvance/base/src/components/Spacer";
6
+ import I18n from "@ledvance/base/src/i18n";
7
+ import { isEmpty } from "lodash";
8
+ import { OverviewItem } from "../EnergyConsumptionPage";
9
+ import { EnergyConsumptionChartProps } from "../EnergyConsumptionChart";
10
+ import { useRoute } from '@react-navigation/core'
11
+
12
+ const { convertX: cx } = Utils.RatioUtils
13
+
14
+ interface OverViewProps {
15
+ style?: StyleProp<ViewStyle>
16
+ headlineText?: string
17
+ headlineClick?: () => void
18
+ overviewItemClick?: (item: OverviewItem) => void
19
+ overViewList: OverviewItem[]
20
+ }
21
+ const OverView = (props: OverViewProps) => {
22
+ const { over365Days} = useRoute().params as EnergyConsumptionChartProps
23
+ return (
24
+ <View style={[props.style]}>
25
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
26
+ <Text style={{ color: '#000', fontWeight: 'bold' }}>{props.headlineText}</Text>
27
+ {!isEmpty(props.overViewList) && <TouchableOpacity
28
+ onPress={() => {
29
+ props.headlineClick && props.headlineClick()
30
+ }}
31
+ >
32
+ <Image
33
+ source={res.energy_consumption_chart}
34
+ style={{ width: cx(16), height: cx(16), marginLeft: cx(8) }}
35
+ />
36
+ </TouchableOpacity>}
37
+ </View>
38
+ <Spacer />
39
+ <FlatList
40
+ data={props.overViewList}
41
+ renderItem={({ item }) => (
42
+ <View>
43
+ <TouchableOpacity
44
+ onPress={() => {
45
+ props.overviewItemClick && props.overviewItemClick(item)
46
+ }}
47
+ >
48
+ <View style={{ backgroundColor: '#fff', alignItems: 'center', justifyContent: 'space-between', flexDirection: 'row', }}>
49
+ <Text style={styles.overviewItemText}>{item.key}</Text>
50
+ <View style={{ flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
51
+ <View style={{ flexDirection: 'row' }}>
52
+ <Text style={[styles.overviewItemText, { color: '#999' }]}>{item.value}</Text>
53
+ <Text style={[styles.overviewItemText, { color: '#999' }]}> kWh</Text>
54
+ </View>
55
+ <Image
56
+ source={res.energy_consumption_right}
57
+ style={{ width: cx(16), height: cx(16), marginLeft: cx(8) }}
58
+ />
59
+ </View>
60
+ </View>
61
+ </TouchableOpacity>
62
+ </View>
63
+ )}
64
+ keyExtractor={(item) => item.key}
65
+ ItemSeparatorComponent={() => <Spacer height={cx(10)} />}
66
+ ListFooterComponent={() => <Spacer height={cx(30)} />}
67
+ ListEmptyComponent={() => (
68
+ <View style={styles.listEmptyContainer}>
69
+ <Image
70
+ style={styles.listEmptyImage}
71
+ source={res.energy_consumption_empty} />
72
+ <Spacer height={cx(10)} />
73
+ <View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: cx(25) }}>
74
+ <Image style={styles.listEmptyTextIcon} source={res.co2Icon} />
75
+ <Spacer width={cx(4)} height={0} />
76
+ <Text style={styles.listEmptyText}>
77
+ {
78
+ over365Days ?
79
+ I18n.getLang('energyconsumption_Daylimit')
80
+ :
81
+ I18n.getLang('history_overview_empty_information_text')
82
+ }
83
+ </Text>
84
+ </View>
85
+ </View>
86
+ )}
87
+ />
88
+ </View>
89
+ )
90
+ }
91
+
92
+ const styles = StyleSheet.create({
93
+ listEmptyContainer: {
94
+ alignItems: 'center'
95
+ },
96
+ listEmptyImage: {
97
+ width: cx(200),
98
+ height: cx(200),
99
+ },
100
+ listEmptyTextIcon: {
101
+ width: cx(16),
102
+ height: cx(16),
103
+ tintColor: '#000',
104
+ },
105
+ listEmptyText: {
106
+ color: '#000',
107
+ fontSize: cx(12),
108
+ fontFamily: 'helvetica_neue_lt_std_roman',
109
+ },
110
+ overviewItemText: {
111
+ color: '#000',
112
+ fontSize: cx(14)
113
+ },
114
+ })
115
+
116
+ export default OverView