@ledvance/ui-biz-bundle 1.1.107 → 1.1.109
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
|
@@ -26,6 +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
30
|
work_mode: string
|
|
30
31
|
mix_rgbcw: string
|
|
31
32
|
mix_light_scene: string
|
|
@@ -116,6 +117,9 @@ const MusicPage = (props: { theme?: ThemeType }) => {
|
|
|
116
117
|
const dps = {}
|
|
117
118
|
if (workMode !== 'music') dps[params.work_mode] = WorkMode.Music
|
|
118
119
|
if (!switchLed) dps[params.switch_led] = true
|
|
120
|
+
if (params.colour_switch && params.isCeilingLight){
|
|
121
|
+
dps[params.colour_switch] = true
|
|
122
|
+
}
|
|
119
123
|
if (!isEmpty(dps)){
|
|
120
124
|
await setDps(dps)
|
|
121
125
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useMemo } from "react";
|
|
2
2
|
import { ScrollView, StyleSheet, View, Text, Image, TouchableOpacity } from "react-native";
|
|
3
|
-
import { useNavigation } from '@react-navigation/core'
|
|
3
|
+
import { useNavigation, useIsFocused } from '@react-navigation/core'
|
|
4
4
|
import { useRoute } from '@react-navigation/core'
|
|
5
5
|
import Page from "@ledvance/base/src/components/Page";
|
|
6
6
|
import res from "@ledvance/base/src/res";
|
|
@@ -9,7 +9,7 @@ import { Utils } from "tuya-panel-kit";
|
|
|
9
9
|
import Spacer from "@ledvance/base/src/components/Spacer";
|
|
10
10
|
import Card from "@ledvance/base/src/components/Card";
|
|
11
11
|
import OverView from "./component/Overview";
|
|
12
|
-
import { useReactive, useUpdateEffect } from "ahooks";
|
|
12
|
+
import { useInterval, useReactive, useUpdateEffect } from "ahooks";
|
|
13
13
|
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";
|
|
@@ -19,7 +19,7 @@ import {ui_biz_routerKey} from "../../navigation/Routers";
|
|
|
19
19
|
import { EnergyConsumptionDetailProps } from "./EnergyConsumptionDetail";
|
|
20
20
|
import { EnergyConsumptionChartProps } from "./EnergyConsumptionChart";
|
|
21
21
|
import EnergyPopup, { EnergyData, UnitList } from "./component/EnergyModal";
|
|
22
|
-
import { NativeApi } from "@ledvance/base/src/api/native";
|
|
22
|
+
import { NativeApi, queryDpIds } from "@ledvance/base/src/api/native";
|
|
23
23
|
import { carbonDioxideEmission, countryAndRegion } from "./co2Data";
|
|
24
24
|
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
25
25
|
|
|
@@ -55,6 +55,7 @@ const EnergyConsumptionPage = (props: {theme?: ThemeType}) => {
|
|
|
55
55
|
const params = useRoute().params as EnergyConsumptionPageProps
|
|
56
56
|
const devId = useDeviceId()
|
|
57
57
|
const navigation = useNavigation()
|
|
58
|
+
const isFocused = useIsFocused()
|
|
58
59
|
const timeZoneCity = useTimeZoneCity()
|
|
59
60
|
const power = usePower(params.powerDpCode)
|
|
60
61
|
const voltage = useVoltage(params.voltageDpCode)
|
|
@@ -75,6 +76,16 @@ const EnergyConsumptionPage = (props: {theme?: ThemeType}) => {
|
|
|
75
76
|
return state.overviewList?.length ? `${state.overviewList[len - 1].key} - ${state.overviewList[0].key}` : ''
|
|
76
77
|
}, [state.overviewList])
|
|
77
78
|
|
|
79
|
+
useInterval(() => {
|
|
80
|
+
if (isFocused) {
|
|
81
|
+
const jsonData = JSON.stringify([params.electricDpCode, params.powerDpCode, params.voltageDpCode])
|
|
82
|
+
queryDpIds(jsonData, devId).then()
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
3000,
|
|
86
|
+
{immediate: true}
|
|
87
|
+
)
|
|
88
|
+
|
|
78
89
|
useEffect(() => {
|
|
79
90
|
getElectricity().then()
|
|
80
91
|
getInitPrice().then()
|
|
@@ -43,8 +43,9 @@ const MoodPage = (props: { theme?: ThemeType }) => {
|
|
|
43
43
|
const [moodInfo, setMoodInfo] = useMoodScene(params);
|
|
44
44
|
const [moods, setMoods] = useMoods();
|
|
45
45
|
const [mainWork, setMainWork] = useWorkMode(params.mainWorkMode);
|
|
46
|
-
const [secondaryWork
|
|
46
|
+
const [secondaryWork] = useWorkMode(params.secondaryWorkMode!);
|
|
47
47
|
const [switchLed] = useSwitchLed(params.switchLedDp)
|
|
48
|
+
const [, setSecondarySwitch] = useSwitchLed(params.secondarySwitch!)
|
|
48
49
|
const [flagMode, setFlagMode] = useFlagMode();
|
|
49
50
|
const [sceneStatusId, setSceneStatusId] = useSceneStatusId({
|
|
50
51
|
isSupportSceneStatus: params.isSupportSceneStatus,
|
|
@@ -231,8 +232,8 @@ const MoodPage = (props: { theme?: ThemeType }) => {
|
|
|
231
232
|
setMainWork(work).then();
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
|
-
if (params.isCeilingLight && params.secondaryWorkMode
|
|
235
|
-
|
|
235
|
+
if (params.isCeilingLight && params.secondaryWorkMode) {
|
|
236
|
+
setSecondarySwitch(false)
|
|
236
237
|
}
|
|
237
238
|
}
|
|
238
239
|
return {
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import React, {memo, useMemo} from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
DeviceType,
|
|
4
|
+
directOptions,
|
|
5
|
+
FanLightData,
|
|
6
|
+
ManualSettingProps,
|
|
7
|
+
modeOptions,
|
|
8
|
+
StripLightData
|
|
9
|
+
} from '../Interface';
|
|
3
10
|
import {View} from 'react-native';
|
|
4
11
|
import Card from '@ledvance/base/src/components/Card';
|
|
5
12
|
import LampAdjustView from '@ledvance/base/src/components/LampAdjustView';
|
|
@@ -16,7 +23,7 @@ import SocketItem from '@ledvance/base/src/components/SocketItem'
|
|
|
16
23
|
import res from '@ledvance/base/src/res';
|
|
17
24
|
import { cctToColor } from '@ledvance/base/src/utils/cctUtils';
|
|
18
25
|
import {hsv2Hex, mapFloatToRange } from '@ledvance/base/src/utils';
|
|
19
|
-
import {AdjustType} from "@ledvance/base/src/utils/interface";
|
|
26
|
+
import {AdjustType, ApplyForItem} from "@ledvance/base/src/utils/interface";
|
|
20
27
|
|
|
21
28
|
const { convertX: cx } = Utils.RatioUtils;
|
|
22
29
|
const { withTheme } = Utils.ThemeUtils
|
|
@@ -70,11 +77,13 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
70
77
|
|
|
71
78
|
const lightSourceCard = useMemo(() => {
|
|
72
79
|
const { deviceData } = state;
|
|
73
|
-
const getBlockColor = () => {
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
const getBlockColor = (item: ApplyForItem) => {
|
|
81
|
+
if (['light', 'mainLight', 'secondaryLight'].includes(item.type)) {
|
|
82
|
+
if (!deviceData.isColorMode) return cctToColor(deviceData.temperature)
|
|
83
|
+
if (deviceData.isColorMode) {
|
|
84
|
+
const s = Math.round(mapFloatToRange(deviceData.s / 100, 30, 100))
|
|
85
|
+
return hsv2Hex(deviceData.h, s, 100)
|
|
86
|
+
}
|
|
78
87
|
}
|
|
79
88
|
return props.theme?.card?.background
|
|
80
89
|
};
|
|
@@ -85,7 +94,7 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
85
94
|
<Card style={{ marginHorizontal: cx(24) }}>
|
|
86
95
|
<LdvSwitch
|
|
87
96
|
title={item.name || item.key}
|
|
88
|
-
color={getBlockColor()}
|
|
97
|
+
color={getBlockColor(item)}
|
|
89
98
|
colorAlpha={1}
|
|
90
99
|
enable={item.enable}
|
|
91
100
|
setEnable={(enable: boolean) => {
|
|
@@ -274,12 +283,22 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
274
283
|
|
|
275
284
|
const stripLightCard = useMemo(() => {
|
|
276
285
|
const deviceData = state.deviceData as StripLightData
|
|
286
|
+
const getBlockColor = () => {
|
|
287
|
+
if (deviceData.activeKey === 1) {
|
|
288
|
+
const s = Math.round(mapFloatToRange(state.deviceData.s / 100, 30, 100))
|
|
289
|
+
return hsv2Hex(state.deviceData.h, s, 100)
|
|
290
|
+
}
|
|
291
|
+
if (deviceData.activeKey === 0) {
|
|
292
|
+
return cctToColor(state.deviceData.temperature)
|
|
293
|
+
}
|
|
294
|
+
return props.theme?.card.background
|
|
295
|
+
}
|
|
277
296
|
return (
|
|
278
297
|
<View>
|
|
279
298
|
<Card style={{ marginHorizontal: cx(24) }}>
|
|
280
299
|
<LdvSwitch
|
|
281
300
|
title={I18n.getLang('light_sources_tile_tw_lighting_headline')}
|
|
282
|
-
color={
|
|
301
|
+
color={getBlockColor()}
|
|
283
302
|
colorAlpha={1}
|
|
284
303
|
enable={state.applyForList[0]?.enable}
|
|
285
304
|
setEnable={(enable: boolean) => {
|