@ledvance/ui-biz-bundle 1.1.108 → 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()
|
|
@@ -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) => {
|