@ledvance/ui-biz-bundle 1.1.111 → 1.1.113

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/ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.1.111",
7
+ "version": "1.1.113",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -26,7 +26,7 @@ const { withTheme } = Utils.ThemeUtils
26
26
 
27
27
  export interface MusicPageRouterParams extends JudgeTimeScheduleProps {
28
28
  switch_led: string
29
- colour_switch?: string
29
+ colour_switch?: string
30
30
  work_mode: string
31
31
  mix_rgbcw: string
32
32
  mix_light_scene: string
@@ -116,9 +116,9 @@ const MusicPage = (props: { theme?: ThemeType }) => {
116
116
  } else {
117
117
  const dps = {}
118
118
  if (workMode !== 'music') dps[params.work_mode] = WorkMode.Music
119
- if (!switchLed) dps[params.switch_led] = true
119
+ if (!switchLed) dps[params.switch_led] = true
120
120
  if (params.colour_switch && params.isCeilingLight){
121
- dps[params.colour_switch] = true
121
+ dps[params.colour_switch] = true
122
122
  }
123
123
  if (!isEmpty(dps)){
124
124
  await setDps(dps)
@@ -194,7 +194,7 @@ const MusicPage = (props: { theme?: ThemeType }) => {
194
194
 
195
195
  const getSelect = async () => {
196
196
  state.musicEnable = workMode === 'music' && !!switchLed
197
- if (!state.musicEnable) return
197
+ if (!state.musicEnable) return
198
198
  const res: any = await NativeApi.getJson(deviceId, 'musicSelect')
199
199
  const type = res?.data ? (JSON.parse(res?.data)?.type || 0) : 0
200
200
  state.musicType = res?.data ? JSON.parse(res?.data)?.musicType : params.dreamMusicDp ? 0 : 1
@@ -311,7 +311,7 @@ const MusicPage = (props: { theme?: ThemeType }) => {
311
311
  <View style={{ alignItems: 'center', marginVertical: cx(38) }}>
312
312
  <Image
313
313
  style={{ width: cx(200), height: cx(204) }}
314
- source={state.musicEnable ? Img.app_music_center_on : Img.app_music_center_off}
314
+ source={state.musicEnable ? (props.theme?.type === 'light' ? Img.app_music_center_on_light : Img.app_music_center_on_dark) : Img.app_music_center_off}
315
315
  resizeMode="contain"
316
316
  />
317
317
  </View>
@@ -5,5 +5,6 @@ export default {
5
5
  app_music_romantic: require('./app_music_romantic.png'),
6
6
  app_music_check: require('./iconsMaterialOutlinedArrowsNavCheck.png'),
7
7
  app_music_center_off: require('./illustrationsFeaturesMusicDisabled.png'),
8
- app_music_center_on: require('./illustrationsFeaturesMusic.png'),
8
+ app_music_center_on_light: require('./illustrationsFeaturesMusic.png'),
9
+ app_music_center_on_dark: require('./illustrationsFeaturesMusic-dark.png'),
9
10
  }
@@ -131,7 +131,7 @@ const TimerPage = (props: {theme?: ThemeType}) => {
131
131
  return progress.length > 1
132
132
  }
133
133
 
134
- const renderItem = ({ item }) => {
134
+ const renderItem = (item: dpItem) => {
135
135
  return (
136
136
  <View style={{
137
137
  flexDirection: 'row',
@@ -250,11 +250,9 @@ const TimerPage = (props: {theme?: ThemeType}) => {
250
250
  borderRadius: 4,
251
251
  }}
252
252
  >
253
- <FlatList
254
- data={state.selectedSkill}
255
- renderItem={item => renderItem(item)}
256
- keyExtractor={(item: dpItem) => item.dpId}
257
- />
253
+ {
254
+ state.selectedSkill.map(item => renderItem(item))
255
+ }
258
256
  </View>}
259
257
  </View>
260
258
  {state.skillList.map((skill: dpItem) => {
@@ -151,6 +151,7 @@ const BiorhythmEditPage = (props: { theme?: ThemeType }) => {
151
151
 
152
152
  <View style={{ height: cx(20) }} />
153
153
  <TimerPicker
154
+ key={props.theme?.type}
154
155
  itemTextColor='#aeadb5'
155
156
  style={{ paddingVertical: cx(0), marginVertical: cx(0), backgroundColor: props.theme?.global.background }}
156
157
  pickerFontColor={props.theme?.global.fontColor}
@@ -1,5 +1,5 @@
1
1
  import {useDp} from "@ledvance/base/src/models/modules/NativePropsSlice";
2
- import {localeNumber, loopsText, monthFormat, monthFormatShort} from "@ledvance/base/src/utils/common";
2
+ import {exportCsvFile, localeNumber, loopsText, monthFormat, monthFormatShort} from "@ledvance/base/src/utils/common";
3
3
  import {EnergyData} from "./component/EnergyModal";
4
4
  import {NativeApi} from "@ledvance/base/src/api/native";
5
5
  import {
@@ -13,6 +13,7 @@ import {OverviewItem} from "@ledvance/ui-biz-bundle/src/newModules/energyConsump
13
13
  import {overDays} from "@ledvance/base/src/utils/index";
14
14
  import dayjs from "dayjs";
15
15
  import {isEmpty} from "lodash";
16
+ import I18n from "@ledvance/base/src/i18n";
16
17
 
17
18
  export function useElectricCurrent(dpCode: string): number {
18
19
  const current = useDp<number, any>(dpCode)[0] || 0
@@ -135,3 +136,9 @@ const getDpResultByDate = async (devId: string, addEleDpCode: string, date: stri
135
136
  }
136
137
  return list
137
138
  }
139
+
140
+ export const exportEnergyCsv = (values: any[][], unit: string) => {
141
+ const headers = [I18n.getLang('date'), `${I18n.getLang('consumption_data_annual_bar_chart_system_back_text')} (kWh)`, `Price(${unit})`]
142
+ const functionName = `${I18n.getLang('consumption_data_annual_bar_chart_system_back_text')}`
143
+ exportCsvFile(headers, values, functionName)
144
+ }
@@ -1,25 +1,25 @@
1
1
  import React, { useCallback } from "react";
2
- import {Image, Platform, StyleSheet, View, Text, TouchableOpacity} from "react-native";
2
+ import {Image, StyleSheet, View, TouchableOpacity} from "react-native";
3
3
  import {useRoute} from '@react-navigation/core'
4
4
  import Page from "@ledvance/base/src/components/Page";
5
5
  import res from "@ledvance/base/src/res";
6
6
  import I18n from "@ledvance/base/src/i18n";
7
7
  import {Utils} from "tuya-panel-kit";
8
8
  import NewBarChart from "./component/NewBarChart";
9
- import {exportFile, loopsText, monthFormat} from "@ledvance/base/src/utils/common";
9
+ import { loopsText, monthFormat} from "@ledvance/base/src/utils/common";
10
10
  import {OverviewItem} from "./EnergyConsumptionPage";
11
11
  import Spacer from "@ledvance/base/src/components/Spacer";
12
12
  import InfoText from "@ledvance/base/src/components/InfoText";
13
13
  import dayjs from "dayjs";
14
14
  import ThemeType from '@ledvance/base/src/config/themeType'
15
15
  import {overDays} from "@ledvance/base/src/utils/index";
16
- import DateTypeItem from "@ledvance/ui-biz-bundle/src/newModules/energyConsumption/component/DateTypeItem";
17
- import {DateType} from "@ledvance/ui-biz-bundle/src/newModules/energyConsumption/co2Data";
18
- import DateSelectedItem from "@ledvance/ui-biz-bundle/src/newModules/energyConsumption/component/DateSelectedItem";
16
+ import DateTypeItem from "./component/DateTypeItem";
17
+ import {DateType} from "./co2Data";
18
+ import DateSelectedItem from "./component/DateSelectedItem";
19
19
  import {useReactive, useUpdateEffect} from "ahooks";
20
- import {getElectricity} from "@ledvance/ui-biz-bundle/src/newModules/energyConsumption/EnergyConsumptionActions";
20
+ import {exportEnergyCsv, getElectricity} from "./EnergyConsumptionActions";
21
21
  import {useDeviceId} from "@ledvance/base/src/models/modules/NativePropsSlice";
22
- import DateSwitch from "@ledvance/ui-biz-bundle/src/newModules/energyConsumption/component/DateSwitch";
22
+ import DateSwitch from "./component/DateSwitch";
23
23
 
24
24
  const {convertX: cx} = Utils.RatioUtils
25
25
  const {withTheme} = Utils.ThemeUtils
@@ -163,8 +163,11 @@ const EnergyConsumptionChart = (props: { theme?: ThemeType }) => {
163
163
  onDateChange={(date) => {
164
164
  state.date = date;
165
165
  }}/>
166
- <TouchableOpacity onPress={() => {
167
- exportFile(state.chartData, params.price, params.unit)
166
+ <TouchableOpacity
167
+ style={{width: cx(30)}}
168
+ onPress={() => {
169
+ const values = state.chartData.map(item => [item.key, item.value, (Number(params.price) * Number(item.value)).toFixed(2)])
170
+ exportEnergyCsv(values, params.unit)
168
171
  }}>
169
172
  <Image
170
173
  style={styles.downloadIcon}
@@ -13,7 +13,7 @@ import {getDataWithSpecified, getDpResultByHour} from "@ledvance/base/src/models
13
13
  import {useDeviceId, useEngergyGeneration, useTimeZoneCity} from "@ledvance/base/src/models/modules/NativePropsSlice";
14
14
  import {cloneDeep, isEmpty} from "lodash";
15
15
  import {OverviewItem, PopupType} from "./EnergyConsumptionPage";
16
- import {exchangeNumber, exportFile, localeNumber, loopsText} from '@ledvance/base/src/utils/common'
16
+ import {exchangeNumber, localeNumber, loopsText} from '@ledvance/base/src/utils/common'
17
17
  import dayjs from "dayjs";
18
18
  import {ui_biz_routerKey} from "../../navigation/Routers";
19
19
  import {EnergyConsumptionChartProps} from "./EnergyConsumptionChart";
@@ -21,6 +21,7 @@ import {overDays} from "@ledvance/base/src/utils";
21
21
  import EnergyPopup, {EnergyData} from "./component/EnergyModal";
22
22
  import {carbonDioxideEmission, countryAndRegion} from "./co2Data";
23
23
  import ThemeType from '@ledvance/base/src/config/themeType'
24
+ import { exportEnergyCsv } from "./EnergyConsumptionActions";
24
25
 
25
26
  const { convertX: cx } = Utils.RatioUtils
26
27
  const { withTheme } = Utils.ThemeUtils
@@ -191,7 +192,8 @@ const EnergyConsumptionDetail = (props: {theme?: ThemeType}) => {
191
192
  headlineText={params.curMonth.key}
192
193
  headlineIcon={state.overviewList.length ? res.download_icon : undefined}
193
194
  onHeadlineIconClick={() => {
194
- exportFile(state.overviewList, params.price, params.unit);
195
+ const values = state.overviewList.map(item => [item.key, item.value, (Number(params.price) * Number(item.value)).toFixed(2)])
196
+ exportEnergyCsv(values, params.unit)
195
197
  }}
196
198
  showGreenery={false}
197
199
  greeneryIcon={res.energy_consumption_greenery}
@@ -14,7 +14,7 @@ import { getDpResultByMonth } from "@ledvance/base/src/models/TuyaApi";
14
14
  import {useDeviceId, useEngergyGeneration, useTimeZoneCity} from "@ledvance/base/src/models/modules/NativePropsSlice";
15
15
  import { flattenDeep, isEmpty } from "lodash";
16
16
  import { exchangeNumber, exportFile, localeNumber, monthFormat, monthFormatShort } from "@ledvance/base/src/utils/common";
17
- import {updatePrice, useElectricCurrent, usePower, useVoltage} from "./EnergyConsumptionActions";
17
+ import {exportEnergyCsv, updatePrice, useElectricCurrent, usePower, useVoltage} from "./EnergyConsumptionActions";
18
18
  import {ui_biz_routerKey} from "../../navigation/Routers";
19
19
  import { EnergyConsumptionDetailProps } from "./EnergyConsumptionDetail";
20
20
  import { EnergyConsumptionChartProps } from "./EnergyConsumptionChart";
@@ -242,7 +242,8 @@ const EnergyConsumptionPage = (props: {theme?: ThemeType}) => {
242
242
  headlineText={I18n.getLang(isSolarPlug ? 'sockets_headline_power' : 'consumption_data_annual_bar_chart_system_back_text')}
243
243
  headlineIcon={state.overviewList.length ? res.download_icon : undefined}
244
244
  onHeadlineIconClick={() => {
245
- exportFile(state.overviewList, state.price, state.unit);
245
+ const values = state.overviewList.map(item => [item.key, item.value, (Number(state.price) * Number(item.value)).toFixed(2)])
246
+ exportEnergyCsv(values, state.unit)
246
247
  }}
247
248
  showGreenery={isSolarPlug}
248
249
  greeneryIcon={res.energy_consumption_greenery}
@@ -252,7 +253,7 @@ const EnergyConsumptionPage = (props: {theme?: ThemeType}) => {
252
253
  {/* tip */}
253
254
  <Spacer height={cx(15)} />
254
255
  <View style={styles.showTip}>
255
- <Text style={{ fontSize: cx(14) }}>{I18n.getLang(isSolarPlug ? 'generation_data_description_text' : 'consumption_data_description_text')}</Text>
256
+ <Text style={{ fontSize: cx(14), color: props.theme?.global.fontColor, }}>{I18n.getLang(isSolarPlug ? 'generation_data_description_text' : 'consumption_data_description_text')}</Text>
256
257
  </View>
257
258
  <Spacer />
258
259
  {/* Today */}
@@ -76,7 +76,7 @@ const FixedTimeDetailPage = (props: { theme?: ThemeType }) => {
76
76
  }, [state.initFixedTime, JSON.stringify(state.fixedTime)])
77
77
 
78
78
  const canSubmit = useMemo(() => {
79
- return state.fixedTime.name?.length > 0 && state.fixedTime.name?.length < 33 && !checkItemChanged && inRangeTime && state.fixedTime.channel !== undefined
79
+ return state.fixedTime.name?.length > 0 && state.fixedTime.name?.length < 33 && (!checkItemChanged || params.mode === 'add') && inRangeTime && state.fixedTime.channel !== undefined
80
80
  }, [JSON.stringify(state.fixedTime), checkItemChanged, inRangeTime])
81
81
 
82
82
  const styles = StyleSheet.create({
@@ -160,6 +160,7 @@ const FixedTimeDetailPage = (props: { theme?: ThemeType }) => {
160
160
  />
161
161
  {/* pick */}
162
162
  <TimerPicker
163
+ key={props.theme?.type}
163
164
  itemTextColor='#aeadb5'
164
165
  style={{ paddingVertical: cx(0), marginVertical: cx(0), backgroundColor: props.theme?.global.background }}
165
166
  pickerFontColor={props.theme?.global.fontColor}
@@ -339,7 +339,7 @@ const FixedTimeCard = memo((props: {
339
339
  const newFixedTime = (isPlug: boolean) => {
340
340
  const startTime = dayjs().hour() * 60 + dayjs().minute()
341
341
  return {
342
- name: '',
342
+ name: I18n.getLang('fixedTimeCycle_socket_headline'),
343
343
  enable: true,
344
344
  weeks: [0, 0, 0, 0, 0, 0, 0],
345
345
  startTime: startTime,
@@ -201,10 +201,7 @@ export const useMoodScene = (params: MoodPageParams): [MoodInfo, (moodInfo: Mood
201
201
  }
202
202
  mainLamp[params.switchLedDp] = true
203
203
  }
204
- return setDps({
205
- ...mainDps,
206
- version: params.isStripLight ? 1 : 0
207
- })
204
+ return setDps(mainDps)
208
205
  };
209
206
  return [moodState, setMoodFn];
210
207
  };
@@ -285,4 +282,4 @@ export function useSceneStatusId(params: SceneStatusParams): [number, (moodId: n
285
282
  }, [])
286
283
 
287
284
  return [sceneStatusId, setSceneStatusIdRemote]
288
- }
285
+ }
@@ -62,7 +62,7 @@ const RandomTimeDetailPage = (props: { theme?: ThemeType }) => {
62
62
  }, [JSON.stringify(state.initRandomTime), JSON.stringify(state.randomTime)])
63
63
 
64
64
  const canSubmit = useMemo(() => {
65
- return state.randomTime.name?.length > 0 && state.randomTime.name?.length < 33 && !checkItemChanged && state.randomTime.channel !== undefined
65
+ return state.randomTime.name?.length > 0 && state.randomTime.name?.length < 33 && (!checkItemChanged || params.mode === 'add') && state.randomTime.channel !== undefined
66
66
  }, [JSON.stringify(state.randomTime), checkItemChanged])
67
67
 
68
68
  const styles = StyleSheet.create({
@@ -152,6 +152,7 @@ const RandomTimeDetailPage = (props: { theme?: ThemeType }) => {
152
152
  />
153
153
  {/* pick */}
154
154
  <TimerPicker
155
+ key={props.theme?.type}
155
156
  itemTextColor='#aeadb5'
156
157
  style={{ paddingVertical: cx(0), marginVertical: cx(0), backgroundColor: props.theme?.global.background }}
157
158
  pickerFontColor={props.theme?.global.fontColor}
@@ -210,7 +210,7 @@ const RandomTimePage = (props: { theme?: ThemeType }) => {
210
210
  onBackClick={navigation.goBack}
211
211
  loading={state.loading}
212
212
  onHeadlineIconClick={() => {
213
- navigateToEdit('add', newRandomTime(params.isPlug))
213
+ navigateToEdit('add', newRandomTime(!!params.isPlug))
214
214
  }}
215
215
  >
216
216
  <ScrollView nestedScrollEnabled={true}>
@@ -291,7 +291,7 @@ const RandomTimePage = (props: { theme?: ThemeType }) => {
291
291
  }}
292
292
  textStyle={{ color: props.theme?.button.fontColor }}
293
293
  onPress={() => {
294
- navigateToEdit('add', newRandomTime(params.isPlug))
294
+ navigateToEdit('add', newRandomTime(!!params.isPlug))
295
295
  }} />}
296
296
  </View>}
297
297
  </ScrollView>
@@ -337,10 +337,10 @@ const RandomTimeCard = (props: {
337
337
  )
338
338
  }
339
339
 
340
- const newRandomTime = (isPlug?: boolean) => {
340
+ const newRandomTime = (isPlug: boolean) => {
341
341
  const startTime = dayjs().hour() * 60 + dayjs().minute()
342
342
  return {
343
- name: '',
343
+ name: I18n.getLang('randomtimecycle_sockets_headline_text'),
344
344
  enable: true,
345
345
  weeks: [0, 0, 0, 0, 0, 0, 0],
346
346
  startTime: startTime,
@@ -113,7 +113,7 @@ const SleepWakeUpDetailPage = (props: { theme?: ThemeType }) => {
113
113
  }, [params.scheduleItem, JSON.stringify(state.sleepWakeUp), params.mode])
114
114
 
115
115
  const canSubmit = useMemo(() => {
116
- return state.sleepWakeUp.name?.length > 0 && state.sleepWakeUp.name?.length < 33 && !checkItemChanged
116
+ return state.sleepWakeUp.name?.length > 0 && state.sleepWakeUp.name?.length < 33 && (!checkItemChanged || params.mode === 'add')
117
117
  }, [state.sleepWakeUp.name, checkItemChanged]);
118
118
 
119
119
  const mixLightCard = useMemo(() => {
@@ -203,7 +203,7 @@ const SleepWakeUpDetailPage = (props: { theme?: ThemeType }) => {
203
203
  picker: {
204
204
  marginHorizontal: cx(24),
205
205
  marginVertical: cx(15),
206
- color: props.theme?.global.backgournd,
206
+ color: props.theme?.global.background,
207
207
  },
208
208
  week: {},
209
209
  itemTitle: {
@@ -328,6 +328,7 @@ const SleepWakeUpDetailPage = (props: { theme?: ThemeType }) => {
328
328
  />
329
329
  {/* pick */}
330
330
  <TimerPicker
331
+ key={props.theme?.type}
331
332
  itemTextColor="#aeadb5"
332
333
  style={{ paddingVertical: cx(0), marginVertical: cx(0), backgroundColor: props.theme?.global.background }}
333
334
  pickerFontColor={props.theme?.global.fontColor}
@@ -492,7 +492,7 @@ const SleepWakeUpPage = (props: { theme?: ThemeType }) => {
492
492
  isMax: isWakeUpMax
493
493
  },
494
494
  ]}
495
- onItemPress={(isSleep) => onAddScheduleDialogItemClick(isSleep, 'add', getNewSleepWakeUp(isSleep, params))}
495
+ onItemPress={(isSleep) => onAddScheduleDialogItemClick(isSleep, 'add', getNewSleepWakeUp(isSleep, params, isSleep ? sleepList.length + 1 : wakeUpList.length + 1))}
496
496
  />
497
497
  </>
498
498
  )
@@ -534,7 +534,7 @@ const SleepWakeUpCard = (props: {
534
534
 
535
535
  const getNewSleepWakeUp = (isSleep: boolean, params: SleepWakeUpPageRouteParams) => {
536
536
  const def = {
537
- name: '',
537
+ name: `${I18n.getLang(isSleep ? 'sleepwakeschedule_field_3_Times_chips2_text' : 'sleepwakeschedule_field_3_Times_chips_text')}`,
538
538
  weeks: [0, 0, 0, 0, 0, 0, 0],
539
539
  delay: 6,
540
540
  hour: isSleep ? 23 : 7,
@@ -215,7 +215,7 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
215
215
  !!(state.timeSchedule.name.length && state.timeSchedule.name.length < 33) &&
216
216
  !!state.selectedSkill.length &&
217
217
  (state.isManual || !!state.mood) &&
218
- !isModify &&
218
+ (!isModify || params.mode === 'add') &&
219
219
  !showMoodFanSelectText
220
220
  );
221
221
  }, [state.timeSchedule.name, state.selectedSkill, isModify, state.isManual, state.mood, showMoodFanSelectText]);
@@ -331,7 +331,6 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
331
331
  state.selectedSkill
332
332
  ),
333
333
  });
334
- console.log(res, '< ---- resss');
335
334
  state.loading = false;
336
335
  if (res.success) {
337
336
  navigation.goBack();
@@ -357,6 +356,7 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
357
356
 
358
357
  {/* pick */}
359
358
  <TimerPicker
359
+ key={props.theme?.type}
360
360
  itemTextColor="#aeadb5"
361
361
  style={{ paddingVertical: cx(0), marginVertical: cx(0), backgroundColor: props.theme?.global.background }}
362
362
  pickerFontColor={props.theme?.global.fontColor}
@@ -686,7 +686,7 @@ const newTimeSchedule = () => {
686
686
  enable: true,
687
687
  loops: '0000000',
688
688
  notification: false,
689
- name: '',
689
+ name: I18n.getLang('timeschedule_add_schedule_system_back_text'),
690
690
  time: `${toFixedString(new Date().getHours(), 2)}:${toFixedString(new Date().getMinutes(), 2)}`,
691
691
  dps: {},
692
692
  id: -1,
@@ -124,6 +124,7 @@ const TimeSchedulePage = (props: { theme?: ThemeType }) => {
124
124
  refreshFn: () => {
125
125
  state.flag = Symbol();
126
126
  },
127
+ newScheduleId: state.originList.length + 2,
127
128
  ...params,
128
129
  });
129
130
  }, []);