@ledvance/ui-biz-bundle 1.1.69 → 1.1.71
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/.babelrc +31 -31
- package/.eslintignore +5 -5
- package/.eslintrc.js +27 -27
- package/.prettierrc.js +1 -1
- package/.versionrc +5 -5
- package/package.json +74 -74
- package/rn-cli.config.js +8 -8
- package/src/hooks/DeviceDpStateHooks.d.ts +14 -14
- package/src/hooks/DeviceDpStateHooks.ts +50 -50
- package/src/modules/biorhythm/BiorhythmActions.d.ts +8 -8
- package/src/modules/biorhythm/BiorhythmActions.ts +324 -324
- package/src/modules/biorhythm/BiorhythmBean.d.ts +58 -58
- package/src/modules/biorhythm/BiorhythmBean.ts +230 -230
- package/src/modules/biorhythm/BiorhythmEditPage.d.ts +14 -14
- package/src/modules/biorhythm/BiorhythmEditPage.tsx +324 -324
- package/src/modules/biorhythm/BiorhythmPage.d.ts +10 -10
- package/src/modules/biorhythm/BiorhythmPage.tsx +796 -796
- package/src/modules/biorhythm/IconSelect.d.ts +2 -2
- package/src/modules/biorhythm/IconSelect.tsx +81 -81
- package/src/modules/biorhythm/Router.ts +34 -34
- package/src/modules/biorhythm/circular/ItemIcon.d.ts +22 -22
- package/src/modules/biorhythm/circular/ItemIcon.tsx +172 -172
- package/src/modules/biorhythm/circular/Progress.d.ts +24 -24
- package/src/modules/biorhythm/circular/Progress.tsx +411 -411
- package/src/modules/biorhythm/circular/TimeCircular.d.ts +11 -11
- package/src/modules/biorhythm/circular/TimeCircular.tsx +70 -70
- package/src/modules/biorhythm/iconListData.d.ts +7 -7
- package/src/modules/biorhythm/iconListData.ts +29 -29
- package/src/modules/biorhythm/pIdList.d.ts +2 -2
- package/src/modules/biorhythm/pIdList.ts +35 -35
- package/src/modules/biorhythm/res/BiologicalRes.d.ts +43 -43
- package/src/modules/biorhythm/res/BiologicalRes.ts +41 -41
- package/src/modules/config/ldvConfig.d.ts +2 -2
- package/src/modules/config/ldvConfig.tsx +18 -18
- package/src/modules/fixedTime/FixedTimeActions.ts +173 -173
- package/src/modules/fixedTime/FixedTimeDetailPage.tsx +372 -372
- package/src/modules/fixedTime/FixedTimePage.tsx +213 -213
- package/src/modules/fixedTime/Router.ts +26 -26
- package/src/modules/flags/FlagActions.ts +267 -267
- package/src/modules/flags/FlagEditPage.tsx +441 -441
- package/src/modules/flags/FlagInfo.tsx +563 -563
- package/src/modules/flags/FlagItem.tsx +90 -90
- package/src/modules/flags/FlagPage.tsx +277 -277
- package/src/modules/flags/Router.ts +25 -25
- package/src/modules/history/HistoryPage.d.ts +2 -2
- package/src/modules/history/HistoryPage.tsx +261 -261
- package/src/modules/history/Router.ts +16 -16
- package/src/modules/history/SwitchHistoryPageActions.d.ts +14 -14
- package/src/modules/history/SwitchHistoryPageActions.ts +76 -76
- package/src/modules/mood/AddMoodPage.d.ts +10 -10
- package/src/modules/mood/AddMoodPage.tsx +792 -792
- package/src/modules/mood/DynamicMoodEditorPage.d.ts +6 -6
- package/src/modules/mood/DynamicMoodEditorPage.tsx +561 -561
- package/src/modules/mood/FantasyMood.tsx +176 -176
- package/src/modules/mood/FantasyMoodEditPage.tsx +582 -582
- package/src/modules/mood/FantasyMoodItem.tsx +104 -104
- package/src/modules/mood/FantasyRouter.ts +35 -35
- package/src/modules/mood/MixMood/AddMixMoodPage.tsx +247 -247
- package/src/modules/mood/MixMood/MixMoodActions.ts +128 -128
- package/src/modules/mood/MixMood/MixMoodEditPage.tsx +721 -721
- package/src/modules/mood/MixMood/MixMoodItem.tsx +134 -134
- package/src/modules/mood/MixMood/MixMoodPage.tsx +326 -326
- package/src/modules/mood/MixMood/MixSceneBeans.ts +364 -364
- package/src/modules/mood/MixMood/RecommendMixMoodItem.tsx +69 -69
- package/src/modules/mood/MixMood/Router.ts +44 -44
- package/src/modules/mood/MoodItem.d.ts +11 -11
- package/src/modules/mood/MoodItem.tsx +114 -114
- package/src/modules/mood/MoodPage.d.ts +16 -16
- package/src/modules/mood/MoodPage.tsx +296 -296
- package/src/modules/mood/RecommendMoodItem.d.ts +13 -13
- package/src/modules/mood/RecommendMoodItem.tsx +74 -74
- package/src/modules/mood/Router.ts +53 -53
- package/src/modules/mood/StaticMoodEditorPage.d.ts +16 -16
- package/src/modules/mood/StaticMoodEditorPage.tsx +320 -320
- package/src/modules/mood/tools.d.ts +3 -3
- package/src/modules/mood/tools.ts +11 -11
- package/src/modules/music/MusicDataBean.d.ts +47 -47
- package/src/modules/music/MusicDataBean.ts +167 -167
- package/src/modules/music/MusicManager.d.ts +27 -27
- package/src/modules/music/MusicManager.ts +207 -207
- package/src/modules/music/MusicPage.d.ts +10 -10
- package/src/modules/music/MusicPage.tsx +347 -347
- package/src/modules/music/MusicPageActions.d.ts +35 -35
- package/src/modules/music/MusicPageActions.ts +317 -317
- package/src/modules/music/Router.ts +16 -16
- package/src/modules/music/SelecetGenre.d.ts +7 -7
- package/src/modules/music/SelecetGenre.tsx +63 -63
- package/src/modules/music/color.d.ts +2 -2
- package/src/modules/music/color.ts +73 -73
- package/src/modules/music/res/index.d.ts +10 -10
- package/src/modules/music/res/index.ts +9 -9
- package/src/modules/powerOnBehavior/PowerOnBehaviorActions.ts +11 -11
- package/src/modules/powerOnBehavior/PowerOnBehaviorPage.tsx +173 -173
- package/src/modules/powerOnBehavior/Router.ts +16 -16
- package/src/modules/randomTime/RandomTimeActions.ts +160 -160
- package/src/modules/randomTime/RandomTimeDetailPage.tsx +337 -337
- package/src/modules/randomTime/RandomTimePage.tsx +214 -214
- package/src/modules/randomTime/Router.ts +25 -25
- package/src/modules/randomTime/Summary.tsx +122 -122
- package/src/modules/scene/SceneAction.d.ts +13 -13
- package/src/modules/scene/SceneAction.ts +473 -473
- package/src/modules/scene/SceneDetailPage.d.ts +1 -1
- package/src/modules/scene/SceneDetailPage.tsx +421 -421
- package/src/modules/scene/SceneInfo.d.ts +72 -72
- package/src/modules/scene/SceneInfo.ts +1059 -1059
- package/src/modules/scene/ScenePage.d.ts +7 -7
- package/src/modules/scene/ScenePage.tsx +147 -147
- package/src/modules/select/SelectPage.d.ts +12 -12
- package/src/modules/select/SelectPage.tsx +137 -137
- package/src/modules/sleepWakeup/DeviceState.d.ts +9 -9
- package/src/modules/sleepWakeup/DeviceState.tsx +99 -99
- package/src/modules/sleepWakeup/LdvScheduleItem.d.ts +15 -15
- package/src/modules/sleepWakeup/LdvScheduleItem.tsx +176 -176
- package/src/modules/sleepWakeup/Router.ts +25 -25
- package/src/modules/sleepWakeup/SleepWakeUpActions.d.ts +2 -2
- package/src/modules/sleepWakeup/SleepWakeUpActions.ts +180 -180
- package/src/modules/sleepWakeup/SleepWakeUpDetailPage.d.ts +2 -2
- package/src/modules/sleepWakeup/SleepWakeUpDetailPage.tsx +616 -616
- package/src/modules/sleepWakeup/SleepWakeUpPage.d.ts +13 -13
- package/src/modules/sleepWakeup/SleepWakeUpPage.tsx +424 -424
- package/src/modules/sleepWakeup/utils.d.ts +44 -44
- package/src/modules/sleepWakeup/utils.ts +253 -253
- package/src/modules/timeSchedule/DeviceState.d.ts +17 -17
- package/src/modules/timeSchedule/DeviceState.tsx +94 -94
- package/src/modules/timeSchedule/LdvScheduleItem.d.ts +15 -15
- package/src/modules/timeSchedule/LdvScheduleItem.tsx +130 -130
- package/src/modules/timeSchedule/ManualSetting.d.ts +14 -14
- package/src/modules/timeSchedule/ManualSetting.tsx +219 -219
- package/src/modules/timeSchedule/MoodSetting.d.ts +11 -11
- package/src/modules/timeSchedule/MoodSetting.tsx +228 -228
- package/src/modules/timeSchedule/Router.ts +25 -25
- package/src/modules/timeSchedule/ScheduleScene.d.ts +6 -6
- package/src/modules/timeSchedule/ScheduleScene.tsx +144 -144
- package/src/modules/timeSchedule/SingleLightView.d.ts +12 -12
- package/src/modules/timeSchedule/SingleLightView.tsx +175 -175
- package/src/modules/timeSchedule/TimeScheduleBean.d.ts +14 -14
- package/src/modules/timeSchedule/TimeScheduleBean.ts +18 -18
- package/src/modules/timeSchedule/TimeScheduleEditpage.d.ts +6 -6
- package/src/modules/timeSchedule/TimeScheduleEditpage.tsx +765 -765
- package/src/modules/timeSchedule/TimeSchedulePage.d.ts +13 -13
- package/src/modules/timeSchedule/TimeSchedulePage.tsx +358 -358
- package/src/modules/timeSchedule/components/ColorList.ts +23 -23
- package/src/modules/timeSchedule/components/LampSwitchCard.tsx +106 -106
- package/src/modules/timeSchedule/mix/MixLightActions.d.ts +3 -3
- package/src/modules/timeSchedule/mix/MixLightActions.ts +49 -49
- package/src/modules/timeSchedule/mix/MixLightBean.d.ts +10 -10
- package/src/modules/timeSchedule/mix/MixLightBean.ts +9 -9
- package/src/modules/timeSchedule/mix/MixLightView.d.ts +7 -7
- package/src/modules/timeSchedule/mix/MixLightView.tsx +197 -197
- package/src/modules/timeSchedule/utils.d.ts +1 -1
- package/src/modules/timeSchedule/utils.ts +6 -6
- package/src/modules/timer/Router.ts +16 -16
- package/src/modules/timer/TimerPage.d.ts +11 -11
- package/src/modules/timer/TimerPage.tsx +384 -384
- package/src/modules/timer/TimerPageAction.d.ts +22 -22
- package/src/modules/timer/TimerPageAction.ts +131 -131
- package/src/navigation/Routers.d.ts +15 -15
- package/src/navigation/Routers.ts +46 -46
- package/src/navigation/tools.d.ts +9 -9
- package/src/navigation/tools.ts +21 -21
- package/src/newModules/biorhythm/BiorhythmActions.ts +62 -11
- package/src/newModules/biorhythm/BiorhythmPage.tsx +1 -4
- package/src/newModules/childLock/ChildLockPage.tsx +97 -97
- package/src/newModules/childLock/Router.ts +16 -16
- package/src/newModules/energyConsumption/EnergyConsumptionActions.ts +23 -23
- package/src/newModules/energyConsumption/EnergyConsumptionChart.tsx +84 -84
- package/src/newModules/energyConsumption/EnergyConsumptionDetail.tsx +322 -322
- package/src/newModules/energyConsumption/EnergyConsumptionPage.tsx +393 -393
- package/src/newModules/energyConsumption/Router.ts +34 -34
- package/src/newModules/energyConsumption/co2Data.ts +23655 -23655
- package/src/newModules/energyConsumption/component/BarChart.tsx +93 -93
- package/src/newModules/energyConsumption/component/EnergyModal.tsx +284 -284
- package/src/newModules/energyConsumption/component/Overview.tsx +118 -118
- package/src/newModules/fixedTime/FixedTimeActions.ts +241 -241
- package/src/newModules/fixedTime/FixedTimeDetailPage.tsx +345 -345
- package/src/newModules/fixedTime/FixedTimePage.tsx +302 -302
- package/src/newModules/fixedTime/Router.ts +25 -25
- package/src/newModules/lightMode/LightModePage.tsx +204 -204
- package/src/newModules/lightMode/Router.ts +16 -16
- package/src/newModules/mood/Interface.ts +5 -0
- package/src/newModules/mood/MixDynamicMoodEditor.tsx +8 -5
- package/src/newModules/mood/MoodActions.ts +32 -20
- package/src/newModules/mood/MoodItem.tsx +3 -3
- package/src/newModules/mood/MoodPage.tsx +31 -15
- package/src/newModules/mood/MoodParse.ts +5 -6
- package/src/newModules/mood/RecommendMoodItem.tsx +3 -3
- package/src/newModules/mood/Router.ts +9 -0
- package/src/newModules/overchargeSwitch/OverchargeSwitchPage.tsx +96 -96
- package/src/newModules/overchargeSwitch/Router.ts +16 -16
- package/src/newModules/powerOnBehavior/LightBehaviorPage.tsx +266 -266
- package/src/newModules/powerOnBehavior/PlugBehaviorPage.tsx +173 -173
- package/src/newModules/powerOnBehavior/PowerOnBehaviorActions.ts +106 -106
- package/src/newModules/powerOnBehavior/Router.ts +27 -27
- package/src/newModules/randomTime/RandomTimeActions.ts +238 -238
- package/src/newModules/randomTime/RandomTimeDetailPage.tsx +325 -325
- package/src/newModules/randomTime/RandomTimePage.tsx +299 -299
- package/src/newModules/randomTime/Router.ts +25 -25
- package/src/newModules/randomTime/Summary.tsx +116 -116
- package/src/newModules/remoteControl/RemoteControlActions.ts +5 -5
- package/src/newModules/remoteControl/RemoteControlPage.tsx +51 -51
- package/src/newModules/remoteControl/Router.ts +15 -15
- package/src/newModules/select/Route.ts +16 -16
- package/src/newModules/select/SelectPage.d.ts +12 -12
- package/src/newModules/select/SelectPage.tsx +137 -137
- package/src/newModules/sleepWakeUp/Interface.ts +69 -69
- package/src/newModules/sleepWakeUp/Router.ts +24 -24
- package/src/newModules/sleepWakeUp/SleepWakeUpActions.ts +317 -317
- package/src/newModules/sleepWakeUp/SleepWakeUpDetailPage.tsx +661 -661
- package/src/newModules/sleepWakeUp/SleepWakeUpPage.tsx +455 -455
- package/src/newModules/sleepWakeUp/utils.ts +253 -253
- package/src/newModules/swithInching/Router.ts +16 -16
- package/src/newModules/swithInching/SwithInching.tsx +231 -231
- package/src/newModules/swithInching/SwithInchingAction.ts +55 -55
- package/src/newModules/swithInching/pickerView.tsx +91 -91
- package/src/newModules/timeSchedule/Interface.ts +142 -142
- package/src/newModules/timeSchedule/Router.ts +25 -25
- package/src/newModules/timeSchedule/TimeScheduleActions.ts +53 -53
- package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +648 -648
- package/src/newModules/timeSchedule/TimeSchedulePage.tsx +253 -253
- package/src/newModules/timeSchedule/components/ManuaSettings.tsx +460 -460
- package/src/newModules/timeSchedule/components/ScheduleCard.tsx +125 -125
- package/tsconfig.json +50 -50
|
@@ -1,460 +1,460 @@
|
|
|
1
|
-
import React, { memo, useMemo } from 'react';
|
|
2
|
-
import { CeilingLightData, DeviceType, directOptions, ManualSettingProps, modeOptions, StripLightData } from '../Interface';
|
|
3
|
-
import { View } from 'react-native';
|
|
4
|
-
import Card from '@ledvance/base/src/components/Card';
|
|
5
|
-
import LampAdjustView from '@ledvance/base/src/components/LampAdjustView';
|
|
6
|
-
import { Utils } from 'tuya-panel-kit';
|
|
7
|
-
import { useCreation, useReactive, useUpdateEffect } from 'ahooks';
|
|
8
|
-
import LdvSwitch from '@ledvance/base/src/components/ldvSwitch';
|
|
9
|
-
import ColorTempAdjustView from '@ledvance/base/src/components/ColorTempAdjustView';
|
|
10
|
-
import ColorAdjustView from '@ledvance/base/src/components/ColorAdjustView';
|
|
11
|
-
import I18n from '@ledvance/base/src/i18n';
|
|
12
|
-
import StripAdjustView from '@ledvance/base/src/components/StripAdjustView';
|
|
13
|
-
import Spacer from '@ledvance/base/src/components/Spacer';
|
|
14
|
-
import { FanAdjustViewContent } from '@ledvance/base/src/components/FanAdjustView';
|
|
15
|
-
import SocketItem from '@ledvance/base/src/components/SocketItem'
|
|
16
|
-
import res from '@ledvance/base/src/res';
|
|
17
|
-
const { convertX: cx } = Utils.RatioUtils;
|
|
18
|
-
const { withTheme } = Utils.ThemeUtils
|
|
19
|
-
|
|
20
|
-
const PowerStripIcon = [res.switch_1, res.switch_2, res.switch_3, res.switch_4]
|
|
21
|
-
|
|
22
|
-
function ManualSettings(props: ManualSettingProps) {
|
|
23
|
-
const state = useReactive({
|
|
24
|
-
deviceData: props.manualData.deviceData,
|
|
25
|
-
applyForList: props.applyForList,
|
|
26
|
-
applyFlag: Symbol(),
|
|
27
|
-
manualFlag: Symbol()
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
useUpdateEffect(() => {
|
|
31
|
-
state.applyForList = props.applyForList;
|
|
32
|
-
state.deviceData = props.manualData.deviceData;
|
|
33
|
-
}, [props.applyForList, props.manualData]);
|
|
34
|
-
|
|
35
|
-
useUpdateEffect(() => {
|
|
36
|
-
props.onApplyChange && props.onApplyChange(state.applyForList)
|
|
37
|
-
}, [state.applyFlag])
|
|
38
|
-
|
|
39
|
-
useUpdateEffect(() => {
|
|
40
|
-
props.onManualChange && props.onManualChange(state.deviceData)
|
|
41
|
-
}, [state.manualFlag])
|
|
42
|
-
|
|
43
|
-
const tabList = useCreation(() => {
|
|
44
|
-
const isSupportWhite = props.isSupportBrightness || props.isSupportTemperature;
|
|
45
|
-
const tabs = [
|
|
46
|
-
{ key: 1, title: I18n.getLang('add_new_static_mood_lights_schedule_switch_tab_color_text') },
|
|
47
|
-
{ key: 0, title: I18n.getLang('add_new_static_mood_lights_schedule_switch_tab_white_text') },
|
|
48
|
-
{
|
|
49
|
-
key: 3,
|
|
50
|
-
title: I18n.getLang(
|
|
51
|
-
'add_new_dynamic_mood_strip_lights_schedule_switch_tab_combination_text'
|
|
52
|
-
),
|
|
53
|
-
},
|
|
54
|
-
];
|
|
55
|
-
if (props.isCeilingLight) {
|
|
56
|
-
return tabs.filter(tab => tab.key !== 0)
|
|
57
|
-
}
|
|
58
|
-
if (!isSupportWhite) {
|
|
59
|
-
return tabs.filter(tab => tab.key !== 0);
|
|
60
|
-
}
|
|
61
|
-
if (!props.isSupportColor) {
|
|
62
|
-
return tabs.filter(tab => tab.key === 0);
|
|
63
|
-
}
|
|
64
|
-
return tabs;
|
|
65
|
-
}, []);
|
|
66
|
-
|
|
67
|
-
const lightSourceCard = useMemo(() => {
|
|
68
|
-
const { deviceData } = state;
|
|
69
|
-
return (
|
|
70
|
-
<View>
|
|
71
|
-
{state.applyForList.map((item, idx) => (
|
|
72
|
-
<View key={item.dp}>
|
|
73
|
-
<Card style={{ marginHorizontal: cx(24) }}>
|
|
74
|
-
<LdvSwitch
|
|
75
|
-
title={item.key}
|
|
76
|
-
color={props.theme.card.background}
|
|
77
|
-
colorAlpha={1}
|
|
78
|
-
enable={item.enable}
|
|
79
|
-
setEnable={(enable: boolean) => {
|
|
80
|
-
state.applyForList = state.applyForList.map((apply, index) => {
|
|
81
|
-
if (idx === index) {
|
|
82
|
-
return {
|
|
83
|
-
...apply,
|
|
84
|
-
enable,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
return apply;
|
|
88
|
-
});
|
|
89
|
-
state.applyFlag = Symbol()
|
|
90
|
-
}}
|
|
91
|
-
/>
|
|
92
|
-
{item.enable && (item.type !== 'socket' && item.type !== 'fan') && (
|
|
93
|
-
<LampAdjustView
|
|
94
|
-
isSupportColor={props.isSupportColor}
|
|
95
|
-
isSupportBrightness={props.isSupportBrightness}
|
|
96
|
-
isSupportTemperature={props.isSupportTemperature}
|
|
97
|
-
isColorMode={deviceData.isColorMode}
|
|
98
|
-
setIsColorMode={mode => {
|
|
99
|
-
state.deviceData = {
|
|
100
|
-
...state.deviceData,
|
|
101
|
-
isColorMode: mode,
|
|
102
|
-
};
|
|
103
|
-
state.manualFlag = Symbol()
|
|
104
|
-
}}
|
|
105
|
-
reserveSV={true}
|
|
106
|
-
h={deviceData.h}
|
|
107
|
-
s={deviceData.s}
|
|
108
|
-
v={deviceData.v}
|
|
109
|
-
brightness={deviceData.brightness}
|
|
110
|
-
colorTemp={deviceData.temperature}
|
|
111
|
-
onHSVChangeComplete={(h, s, v) => {
|
|
112
|
-
state.deviceData = {
|
|
113
|
-
...state.deviceData,
|
|
114
|
-
h,
|
|
115
|
-
s,
|
|
116
|
-
v,
|
|
117
|
-
};
|
|
118
|
-
state.manualFlag = Symbol()
|
|
119
|
-
}}
|
|
120
|
-
onBrightnessChangeComplete={bright => {
|
|
121
|
-
state.deviceData = {
|
|
122
|
-
...state.deviceData,
|
|
123
|
-
brightness: bright
|
|
124
|
-
}
|
|
125
|
-
state.manualFlag = Symbol()
|
|
126
|
-
}}
|
|
127
|
-
onCCTChangeComplete={cct => {
|
|
128
|
-
state.deviceData = {
|
|
129
|
-
...state.deviceData,
|
|
130
|
-
temperature: cct
|
|
131
|
-
}
|
|
132
|
-
state.manualFlag = Symbol()
|
|
133
|
-
}}
|
|
134
|
-
/>
|
|
135
|
-
)}
|
|
136
|
-
|
|
137
|
-
{item.enable && item.type === 'fan' && (
|
|
138
|
-
<FanAdjustViewContent
|
|
139
|
-
hideEnable={true}
|
|
140
|
-
fanEnable={item.enable}
|
|
141
|
-
maxFanSpeed={props.isUVCFan ? 20 : 3}
|
|
142
|
-
isSupportDirection={props.isUVCFan}
|
|
143
|
-
isSupportDisinfect={props.isUVCFan}
|
|
144
|
-
isSupportMode={props.isUVCFan}
|
|
145
|
-
directValue={''}
|
|
146
|
-
disinfect={true}
|
|
147
|
-
modeValue={''}
|
|
148
|
-
directOptions={directOptions}
|
|
149
|
-
modeOptions={modeOptions}
|
|
150
|
-
directChange={(direction: any) => {
|
|
151
|
-
state.deviceData = {
|
|
152
|
-
...state.deviceData,
|
|
153
|
-
direction
|
|
154
|
-
}
|
|
155
|
-
state.manualFlag = Symbol()
|
|
156
|
-
}}
|
|
157
|
-
modeChange={(mode: any) => {
|
|
158
|
-
state.deviceData = {
|
|
159
|
-
...state.deviceData,
|
|
160
|
-
mode
|
|
161
|
-
}
|
|
162
|
-
state.manualFlag = Symbol()
|
|
163
|
-
}}
|
|
164
|
-
disinfectChange={(disinfect: any) => {
|
|
165
|
-
state.deviceData = {
|
|
166
|
-
...state.deviceData,
|
|
167
|
-
disinfect
|
|
168
|
-
}
|
|
169
|
-
state.manualFlag = Symbol()
|
|
170
|
-
}}
|
|
171
|
-
// @ts-ignore
|
|
172
|
-
fanSpeed={deviceData.fanSpeed}
|
|
173
|
-
onFanSwitch={() => { }}
|
|
174
|
-
onFanSpeedChangeComplete={(fanSpeed) => {
|
|
175
|
-
state.deviceData = {
|
|
176
|
-
...state.deviceData,
|
|
177
|
-
fanSpeed
|
|
178
|
-
}
|
|
179
|
-
state.manualFlag = Symbol()
|
|
180
|
-
}}
|
|
181
|
-
/>
|
|
182
|
-
)}
|
|
183
|
-
</Card>
|
|
184
|
-
<Spacer />
|
|
185
|
-
</View>
|
|
186
|
-
))}
|
|
187
|
-
</View>
|
|
188
|
-
);
|
|
189
|
-
}, [state.deviceData, state.applyForList, props.theme.type]);
|
|
190
|
-
|
|
191
|
-
const mixLightCard = useMemo(() => {
|
|
192
|
-
return (
|
|
193
|
-
<View>
|
|
194
|
-
{state.applyForList.map((item, idx) => (
|
|
195
|
-
<View key={item.dp}>
|
|
196
|
-
<Card style={{ marginHorizontal: cx(24) }}>
|
|
197
|
-
<LdvSwitch
|
|
198
|
-
title={item.key}
|
|
199
|
-
color={props.theme.card.background}
|
|
200
|
-
colorAlpha={1}
|
|
201
|
-
enable={item.enable}
|
|
202
|
-
setEnable={(enable: boolean) => {
|
|
203
|
-
state.applyForList[idx].enable = enable;
|
|
204
|
-
state.applyFlag = Symbol()
|
|
205
|
-
}}
|
|
206
|
-
/>
|
|
207
|
-
{item.enable &&
|
|
208
|
-
(item.type === 'mainLight' ? (
|
|
209
|
-
<View>
|
|
210
|
-
<ColorTempAdjustView
|
|
211
|
-
isSupportBrightness={props.isSupportBrightness}
|
|
212
|
-
isSupportTemperature={props.isSupportTemperature}
|
|
213
|
-
colorTemp={state.deviceData.temperature}
|
|
214
|
-
brightness={state.deviceData.brightness}
|
|
215
|
-
onBrightnessChangeComplete={bright => {
|
|
216
|
-
state.deviceData.brightness = bright;
|
|
217
|
-
state.manualFlag = Symbol()
|
|
218
|
-
}}
|
|
219
|
-
onCCTChangeComplete={cct => {
|
|
220
|
-
state.deviceData.temperature = cct;
|
|
221
|
-
state.manualFlag = Symbol()
|
|
222
|
-
}}
|
|
223
|
-
/>
|
|
224
|
-
<Spacer height={cx(16)} />
|
|
225
|
-
</View>
|
|
226
|
-
) : (
|
|
227
|
-
<View>
|
|
228
|
-
<ColorAdjustView
|
|
229
|
-
h={state.deviceData.h}
|
|
230
|
-
s={state.deviceData.s}
|
|
231
|
-
v={state.deviceData.v}
|
|
232
|
-
reserveSV={true}
|
|
233
|
-
minSaturation={1}
|
|
234
|
-
onHSVChangeComplete={(h, s, v) => {
|
|
235
|
-
state.deviceData.h = h;
|
|
236
|
-
state.deviceData.s = s;
|
|
237
|
-
state.deviceData.v = v;
|
|
238
|
-
state.manualFlag = Symbol()
|
|
239
|
-
}}
|
|
240
|
-
/>
|
|
241
|
-
<Spacer />
|
|
242
|
-
</View>
|
|
243
|
-
))}
|
|
244
|
-
</Card>
|
|
245
|
-
<Spacer />
|
|
246
|
-
</View>
|
|
247
|
-
))}
|
|
248
|
-
</View>
|
|
249
|
-
);
|
|
250
|
-
}, [state.deviceData, state.applyForList, props.theme.type]);
|
|
251
|
-
|
|
252
|
-
const stripLightCard = useMemo(() => {
|
|
253
|
-
const deviceData = state.deviceData as StripLightData
|
|
254
|
-
return (
|
|
255
|
-
<View>
|
|
256
|
-
<Card>
|
|
257
|
-
<LdvSwitch
|
|
258
|
-
title={I18n.getLang('light_sources_tile_tw_lighting_headline')}
|
|
259
|
-
color={props.theme.card.background}
|
|
260
|
-
colorAlpha={1}
|
|
261
|
-
enable={state.applyForList[0]?.enable}
|
|
262
|
-
setEnable={(enable: boolean) => {
|
|
263
|
-
state.applyForList[0].enable = enable;
|
|
264
|
-
state.applyFlag = Symbol()
|
|
265
|
-
}}
|
|
266
|
-
/>
|
|
267
|
-
{state.applyForList[0]?.enable && (
|
|
268
|
-
<StripAdjustView
|
|
269
|
-
isSupportBrightness={props.isSupportBrightness}
|
|
270
|
-
isSupportTemperature={props.isSupportTemperature}
|
|
271
|
-
lampTabs={tabList}
|
|
272
|
-
reserveSV={true}
|
|
273
|
-
activeKey={deviceData.activeKey}
|
|
274
|
-
colorDiskActiveKey={deviceData.colorDiskActiveKey}
|
|
275
|
-
onActiveKeyChange={(activekey) => {
|
|
276
|
-
state.deviceData = {
|
|
277
|
-
...state.deviceData,
|
|
278
|
-
activeKey: Number(activekey),
|
|
279
|
-
isColorMode: !(Number(activekey) === 0)
|
|
280
|
-
}
|
|
281
|
-
state.manualFlag = Symbol()
|
|
282
|
-
}}
|
|
283
|
-
onColorDiskChange={(colors, idx) => {
|
|
284
|
-
state.deviceData = {
|
|
285
|
-
...state.deviceData,
|
|
286
|
-
colors,
|
|
287
|
-
colorDiskActiveKey: idx
|
|
288
|
-
}
|
|
289
|
-
state.manualFlag = Symbol()
|
|
290
|
-
}}
|
|
291
|
-
h={state.deviceData.h}
|
|
292
|
-
s={state.deviceData.s}
|
|
293
|
-
v={state.deviceData.v}
|
|
294
|
-
brightness={state.deviceData.brightness}
|
|
295
|
-
colorTemp={state.deviceData.temperature}
|
|
296
|
-
onHSVChangeComplete={(h, s, v) => {
|
|
297
|
-
state.deviceData.h = h;
|
|
298
|
-
state.deviceData.s = s;
|
|
299
|
-
state.deviceData.v = v;
|
|
300
|
-
state.manualFlag = Symbol()
|
|
301
|
-
}}
|
|
302
|
-
onBrightnessChangeComplete={bright => {
|
|
303
|
-
state.deviceData.brightness = bright;
|
|
304
|
-
state.manualFlag = Symbol()
|
|
305
|
-
}}
|
|
306
|
-
onCCTChangeComplete={cct => {
|
|
307
|
-
state.deviceData.temperature = cct;
|
|
308
|
-
state.manualFlag = Symbol()
|
|
309
|
-
}}
|
|
310
|
-
/>
|
|
311
|
-
)}
|
|
312
|
-
</Card>
|
|
313
|
-
<Spacer />
|
|
314
|
-
</View>
|
|
315
|
-
);
|
|
316
|
-
}, [state.deviceData, state.applyForList, props.theme.type]);
|
|
317
|
-
|
|
318
|
-
const ceilingLightCard = useMemo(() => {
|
|
319
|
-
const deviceData = state.deviceData as CeilingLightData
|
|
320
|
-
return (
|
|
321
|
-
<View>
|
|
322
|
-
{state.applyForList.map((item, idx) => (
|
|
323
|
-
<View key={item.dp}>
|
|
324
|
-
<Card style={{ marginHorizontal: cx(24) }}>
|
|
325
|
-
<LdvSwitch
|
|
326
|
-
title={item.key}
|
|
327
|
-
color={'#fff'}
|
|
328
|
-
colorAlpha={1}
|
|
329
|
-
enable={item.enable}
|
|
330
|
-
setEnable={(enable: boolean) => {
|
|
331
|
-
state.applyForList[idx].enable = enable;
|
|
332
|
-
state.applyFlag = Symbol()
|
|
333
|
-
}}
|
|
334
|
-
/>
|
|
335
|
-
{item.enable &&
|
|
336
|
-
(item.type === 'mainLight' ? (
|
|
337
|
-
<View>
|
|
338
|
-
<ColorTempAdjustView
|
|
339
|
-
isSupportBrightness={props.isSupportBrightness}
|
|
340
|
-
isSupportTemperature={props.isSupportTemperature}
|
|
341
|
-
colorTemp={deviceData.temperature}
|
|
342
|
-
brightness={deviceData.brightness}
|
|
343
|
-
onBrightnessChangeComplete={bright => {
|
|
344
|
-
state.deviceData.brightness = bright;
|
|
345
|
-
state.manualFlag = Symbol()
|
|
346
|
-
}}
|
|
347
|
-
onCCTChangeComplete={cct => {
|
|
348
|
-
state.deviceData.temperature = cct;
|
|
349
|
-
state.manualFlag = Symbol()
|
|
350
|
-
}}
|
|
351
|
-
/>
|
|
352
|
-
<Spacer height={cx(16)} />
|
|
353
|
-
</View>
|
|
354
|
-
) : (
|
|
355
|
-
<View>
|
|
356
|
-
<StripAdjustView
|
|
357
|
-
isSupportBrightness={false}
|
|
358
|
-
isSupportTemperature={false}
|
|
359
|
-
lampTabs={tabList}
|
|
360
|
-
reserveSV={true}
|
|
361
|
-
activeKey={deviceData.activeKey}
|
|
362
|
-
colorDiskActiveKey={deviceData.colorDiskActiveKey}
|
|
363
|
-
onActiveKeyChange={(activekey) => {
|
|
364
|
-
state.deviceData = {
|
|
365
|
-
...state.deviceData,
|
|
366
|
-
activeKey: Number(activekey)
|
|
367
|
-
}
|
|
368
|
-
state.manualFlag = Symbol()
|
|
369
|
-
}}
|
|
370
|
-
onColorDiskChange={(colors, idx) => {
|
|
371
|
-
state.deviceData = {
|
|
372
|
-
...state.deviceData,
|
|
373
|
-
colors,
|
|
374
|
-
colorDiskActiveKey: idx
|
|
375
|
-
}
|
|
376
|
-
state.manualFlag = Symbol()
|
|
377
|
-
}}
|
|
378
|
-
h={deviceData.h}
|
|
379
|
-
s={deviceData.s}
|
|
380
|
-
v={deviceData.v}
|
|
381
|
-
brightness={deviceData.brightness}
|
|
382
|
-
colorTemp={deviceData.temperature}
|
|
383
|
-
onHSVChangeComplete={(h, s, v) => {
|
|
384
|
-
state.deviceData.h = h;
|
|
385
|
-
state.deviceData.s = s;
|
|
386
|
-
state.deviceData.v = v;
|
|
387
|
-
state.manualFlag = Symbol()
|
|
388
|
-
}}
|
|
389
|
-
onBrightnessChangeComplete={bright => {
|
|
390
|
-
state.deviceData.brightness = bright;
|
|
391
|
-
state.manualFlag = Symbol()
|
|
392
|
-
}}
|
|
393
|
-
onCCTChangeComplete={cct => {
|
|
394
|
-
state.deviceData.temperature = cct;
|
|
395
|
-
state.manualFlag = Symbol()
|
|
396
|
-
}}
|
|
397
|
-
/>
|
|
398
|
-
<Spacer />
|
|
399
|
-
</View>
|
|
400
|
-
))}
|
|
401
|
-
<Spacer height={cx(16)} />
|
|
402
|
-
</Card>
|
|
403
|
-
<Spacer />
|
|
404
|
-
</View>
|
|
405
|
-
))}
|
|
406
|
-
</View>
|
|
407
|
-
)
|
|
408
|
-
}, [state.deviceData, state.applyForList])
|
|
409
|
-
|
|
410
|
-
const powerStripCard = useMemo(() => {
|
|
411
|
-
return (
|
|
412
|
-
<View>
|
|
413
|
-
{state.applyForList.map((item, idx) => (
|
|
414
|
-
<View key={item.dp}>
|
|
415
|
-
<SocketItem
|
|
416
|
-
title={item.key}
|
|
417
|
-
name={item.name!}
|
|
418
|
-
icon={{ uri: PowerStripIcon[item.index ?? 0] }}
|
|
419
|
-
disabledEdit={true}
|
|
420
|
-
onNameChange={() => { }}
|
|
421
|
-
enabled={item.enable}
|
|
422
|
-
onSwitchChange={async enable => {
|
|
423
|
-
state.applyForList = state.applyForList.map((apply, index) => {
|
|
424
|
-
if (idx === index) {
|
|
425
|
-
return {
|
|
426
|
-
...apply,
|
|
427
|
-
enable,
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
return apply;
|
|
431
|
-
});
|
|
432
|
-
state.applyFlag = Symbol()
|
|
433
|
-
}}
|
|
434
|
-
/>
|
|
435
|
-
<Spacer />
|
|
436
|
-
</View>
|
|
437
|
-
))}
|
|
438
|
-
</View>
|
|
439
|
-
)
|
|
440
|
-
}, [state.deviceData, state.applyForList])
|
|
441
|
-
|
|
442
|
-
const componentRender = useMemo(() => {
|
|
443
|
-
const component =
|
|
444
|
-
props.manualData.type === DeviceType.MixLight
|
|
445
|
-
? mixLightCard
|
|
446
|
-
: props.manualData.type === DeviceType.StripLight
|
|
447
|
-
? stripLightCard
|
|
448
|
-
: props.manualData.type === DeviceType.CeilingLight
|
|
449
|
-
? ceilingLightCard
|
|
450
|
-
: props.manualData.type === DeviceType.PowerStrip
|
|
451
|
-
? powerStripCard
|
|
452
|
-
: lightSourceCard;
|
|
453
|
-
return component;
|
|
454
|
-
}, [props.manualData, state.applyForList, state.deviceData, props.theme.type]);
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
return <View>{componentRender}</View>;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
export default memo(withTheme(ManualSettings))
|
|
1
|
+
import React, { memo, useMemo } from 'react';
|
|
2
|
+
import { CeilingLightData, DeviceType, directOptions, ManualSettingProps, modeOptions, StripLightData } from '../Interface';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import Card from '@ledvance/base/src/components/Card';
|
|
5
|
+
import LampAdjustView from '@ledvance/base/src/components/LampAdjustView';
|
|
6
|
+
import { Utils } from 'tuya-panel-kit';
|
|
7
|
+
import { useCreation, useReactive, useUpdateEffect } from 'ahooks';
|
|
8
|
+
import LdvSwitch from '@ledvance/base/src/components/ldvSwitch';
|
|
9
|
+
import ColorTempAdjustView from '@ledvance/base/src/components/ColorTempAdjustView';
|
|
10
|
+
import ColorAdjustView from '@ledvance/base/src/components/ColorAdjustView';
|
|
11
|
+
import I18n from '@ledvance/base/src/i18n';
|
|
12
|
+
import StripAdjustView from '@ledvance/base/src/components/StripAdjustView';
|
|
13
|
+
import Spacer from '@ledvance/base/src/components/Spacer';
|
|
14
|
+
import { FanAdjustViewContent } from '@ledvance/base/src/components/FanAdjustView';
|
|
15
|
+
import SocketItem from '@ledvance/base/src/components/SocketItem'
|
|
16
|
+
import res from '@ledvance/base/src/res';
|
|
17
|
+
const { convertX: cx } = Utils.RatioUtils;
|
|
18
|
+
const { withTheme } = Utils.ThemeUtils
|
|
19
|
+
|
|
20
|
+
const PowerStripIcon = [res.switch_1, res.switch_2, res.switch_3, res.switch_4]
|
|
21
|
+
|
|
22
|
+
function ManualSettings(props: ManualSettingProps) {
|
|
23
|
+
const state = useReactive({
|
|
24
|
+
deviceData: props.manualData.deviceData,
|
|
25
|
+
applyForList: props.applyForList,
|
|
26
|
+
applyFlag: Symbol(),
|
|
27
|
+
manualFlag: Symbol()
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
useUpdateEffect(() => {
|
|
31
|
+
state.applyForList = props.applyForList;
|
|
32
|
+
state.deviceData = props.manualData.deviceData;
|
|
33
|
+
}, [props.applyForList, props.manualData]);
|
|
34
|
+
|
|
35
|
+
useUpdateEffect(() => {
|
|
36
|
+
props.onApplyChange && props.onApplyChange(state.applyForList)
|
|
37
|
+
}, [state.applyFlag])
|
|
38
|
+
|
|
39
|
+
useUpdateEffect(() => {
|
|
40
|
+
props.onManualChange && props.onManualChange(state.deviceData)
|
|
41
|
+
}, [state.manualFlag])
|
|
42
|
+
|
|
43
|
+
const tabList = useCreation(() => {
|
|
44
|
+
const isSupportWhite = props.isSupportBrightness || props.isSupportTemperature;
|
|
45
|
+
const tabs = [
|
|
46
|
+
{ key: 1, title: I18n.getLang('add_new_static_mood_lights_schedule_switch_tab_color_text') },
|
|
47
|
+
{ key: 0, title: I18n.getLang('add_new_static_mood_lights_schedule_switch_tab_white_text') },
|
|
48
|
+
{
|
|
49
|
+
key: 3,
|
|
50
|
+
title: I18n.getLang(
|
|
51
|
+
'add_new_dynamic_mood_strip_lights_schedule_switch_tab_combination_text'
|
|
52
|
+
),
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
if (props.isCeilingLight) {
|
|
56
|
+
return tabs.filter(tab => tab.key !== 0)
|
|
57
|
+
}
|
|
58
|
+
if (!isSupportWhite) {
|
|
59
|
+
return tabs.filter(tab => tab.key !== 0);
|
|
60
|
+
}
|
|
61
|
+
if (!props.isSupportColor) {
|
|
62
|
+
return tabs.filter(tab => tab.key === 0);
|
|
63
|
+
}
|
|
64
|
+
return tabs;
|
|
65
|
+
}, []);
|
|
66
|
+
|
|
67
|
+
const lightSourceCard = useMemo(() => {
|
|
68
|
+
const { deviceData } = state;
|
|
69
|
+
return (
|
|
70
|
+
<View>
|
|
71
|
+
{state.applyForList.map((item, idx) => (
|
|
72
|
+
<View key={item.dp}>
|
|
73
|
+
<Card style={{ marginHorizontal: cx(24) }}>
|
|
74
|
+
<LdvSwitch
|
|
75
|
+
title={item.key}
|
|
76
|
+
color={props.theme.card.background}
|
|
77
|
+
colorAlpha={1}
|
|
78
|
+
enable={item.enable}
|
|
79
|
+
setEnable={(enable: boolean) => {
|
|
80
|
+
state.applyForList = state.applyForList.map((apply, index) => {
|
|
81
|
+
if (idx === index) {
|
|
82
|
+
return {
|
|
83
|
+
...apply,
|
|
84
|
+
enable,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return apply;
|
|
88
|
+
});
|
|
89
|
+
state.applyFlag = Symbol()
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
{item.enable && (item.type !== 'socket' && item.type !== 'fan') && (
|
|
93
|
+
<LampAdjustView
|
|
94
|
+
isSupportColor={props.isSupportColor}
|
|
95
|
+
isSupportBrightness={props.isSupportBrightness}
|
|
96
|
+
isSupportTemperature={props.isSupportTemperature}
|
|
97
|
+
isColorMode={deviceData.isColorMode}
|
|
98
|
+
setIsColorMode={mode => {
|
|
99
|
+
state.deviceData = {
|
|
100
|
+
...state.deviceData,
|
|
101
|
+
isColorMode: mode,
|
|
102
|
+
};
|
|
103
|
+
state.manualFlag = Symbol()
|
|
104
|
+
}}
|
|
105
|
+
reserveSV={true}
|
|
106
|
+
h={deviceData.h}
|
|
107
|
+
s={deviceData.s}
|
|
108
|
+
v={deviceData.v}
|
|
109
|
+
brightness={deviceData.brightness}
|
|
110
|
+
colorTemp={deviceData.temperature}
|
|
111
|
+
onHSVChangeComplete={(h, s, v) => {
|
|
112
|
+
state.deviceData = {
|
|
113
|
+
...state.deviceData,
|
|
114
|
+
h,
|
|
115
|
+
s,
|
|
116
|
+
v,
|
|
117
|
+
};
|
|
118
|
+
state.manualFlag = Symbol()
|
|
119
|
+
}}
|
|
120
|
+
onBrightnessChangeComplete={bright => {
|
|
121
|
+
state.deviceData = {
|
|
122
|
+
...state.deviceData,
|
|
123
|
+
brightness: bright
|
|
124
|
+
}
|
|
125
|
+
state.manualFlag = Symbol()
|
|
126
|
+
}}
|
|
127
|
+
onCCTChangeComplete={cct => {
|
|
128
|
+
state.deviceData = {
|
|
129
|
+
...state.deviceData,
|
|
130
|
+
temperature: cct
|
|
131
|
+
}
|
|
132
|
+
state.manualFlag = Symbol()
|
|
133
|
+
}}
|
|
134
|
+
/>
|
|
135
|
+
)}
|
|
136
|
+
|
|
137
|
+
{item.enable && item.type === 'fan' && (
|
|
138
|
+
<FanAdjustViewContent
|
|
139
|
+
hideEnable={true}
|
|
140
|
+
fanEnable={item.enable}
|
|
141
|
+
maxFanSpeed={props.isUVCFan ? 20 : 3}
|
|
142
|
+
isSupportDirection={props.isUVCFan}
|
|
143
|
+
isSupportDisinfect={props.isUVCFan}
|
|
144
|
+
isSupportMode={props.isUVCFan}
|
|
145
|
+
directValue={''}
|
|
146
|
+
disinfect={true}
|
|
147
|
+
modeValue={''}
|
|
148
|
+
directOptions={directOptions}
|
|
149
|
+
modeOptions={modeOptions}
|
|
150
|
+
directChange={(direction: any) => {
|
|
151
|
+
state.deviceData = {
|
|
152
|
+
...state.deviceData,
|
|
153
|
+
direction
|
|
154
|
+
}
|
|
155
|
+
state.manualFlag = Symbol()
|
|
156
|
+
}}
|
|
157
|
+
modeChange={(mode: any) => {
|
|
158
|
+
state.deviceData = {
|
|
159
|
+
...state.deviceData,
|
|
160
|
+
mode
|
|
161
|
+
}
|
|
162
|
+
state.manualFlag = Symbol()
|
|
163
|
+
}}
|
|
164
|
+
disinfectChange={(disinfect: any) => {
|
|
165
|
+
state.deviceData = {
|
|
166
|
+
...state.deviceData,
|
|
167
|
+
disinfect
|
|
168
|
+
}
|
|
169
|
+
state.manualFlag = Symbol()
|
|
170
|
+
}}
|
|
171
|
+
// @ts-ignore
|
|
172
|
+
fanSpeed={deviceData.fanSpeed}
|
|
173
|
+
onFanSwitch={() => { }}
|
|
174
|
+
onFanSpeedChangeComplete={(fanSpeed) => {
|
|
175
|
+
state.deviceData = {
|
|
176
|
+
...state.deviceData,
|
|
177
|
+
fanSpeed
|
|
178
|
+
}
|
|
179
|
+
state.manualFlag = Symbol()
|
|
180
|
+
}}
|
|
181
|
+
/>
|
|
182
|
+
)}
|
|
183
|
+
</Card>
|
|
184
|
+
<Spacer />
|
|
185
|
+
</View>
|
|
186
|
+
))}
|
|
187
|
+
</View>
|
|
188
|
+
);
|
|
189
|
+
}, [state.deviceData, state.applyForList, props.theme.type]);
|
|
190
|
+
|
|
191
|
+
const mixLightCard = useMemo(() => {
|
|
192
|
+
return (
|
|
193
|
+
<View>
|
|
194
|
+
{state.applyForList.map((item, idx) => (
|
|
195
|
+
<View key={item.dp}>
|
|
196
|
+
<Card style={{ marginHorizontal: cx(24) }}>
|
|
197
|
+
<LdvSwitch
|
|
198
|
+
title={item.key}
|
|
199
|
+
color={props.theme.card.background}
|
|
200
|
+
colorAlpha={1}
|
|
201
|
+
enable={item.enable}
|
|
202
|
+
setEnable={(enable: boolean) => {
|
|
203
|
+
state.applyForList[idx].enable = enable;
|
|
204
|
+
state.applyFlag = Symbol()
|
|
205
|
+
}}
|
|
206
|
+
/>
|
|
207
|
+
{item.enable &&
|
|
208
|
+
(item.type === 'mainLight' ? (
|
|
209
|
+
<View>
|
|
210
|
+
<ColorTempAdjustView
|
|
211
|
+
isSupportBrightness={props.isSupportBrightness}
|
|
212
|
+
isSupportTemperature={props.isSupportTemperature}
|
|
213
|
+
colorTemp={state.deviceData.temperature}
|
|
214
|
+
brightness={state.deviceData.brightness}
|
|
215
|
+
onBrightnessChangeComplete={bright => {
|
|
216
|
+
state.deviceData.brightness = bright;
|
|
217
|
+
state.manualFlag = Symbol()
|
|
218
|
+
}}
|
|
219
|
+
onCCTChangeComplete={cct => {
|
|
220
|
+
state.deviceData.temperature = cct;
|
|
221
|
+
state.manualFlag = Symbol()
|
|
222
|
+
}}
|
|
223
|
+
/>
|
|
224
|
+
<Spacer height={cx(16)} />
|
|
225
|
+
</View>
|
|
226
|
+
) : (
|
|
227
|
+
<View>
|
|
228
|
+
<ColorAdjustView
|
|
229
|
+
h={state.deviceData.h}
|
|
230
|
+
s={state.deviceData.s}
|
|
231
|
+
v={state.deviceData.v}
|
|
232
|
+
reserveSV={true}
|
|
233
|
+
minSaturation={1}
|
|
234
|
+
onHSVChangeComplete={(h, s, v) => {
|
|
235
|
+
state.deviceData.h = h;
|
|
236
|
+
state.deviceData.s = s;
|
|
237
|
+
state.deviceData.v = v;
|
|
238
|
+
state.manualFlag = Symbol()
|
|
239
|
+
}}
|
|
240
|
+
/>
|
|
241
|
+
<Spacer />
|
|
242
|
+
</View>
|
|
243
|
+
))}
|
|
244
|
+
</Card>
|
|
245
|
+
<Spacer />
|
|
246
|
+
</View>
|
|
247
|
+
))}
|
|
248
|
+
</View>
|
|
249
|
+
);
|
|
250
|
+
}, [state.deviceData, state.applyForList, props.theme.type]);
|
|
251
|
+
|
|
252
|
+
const stripLightCard = useMemo(() => {
|
|
253
|
+
const deviceData = state.deviceData as StripLightData
|
|
254
|
+
return (
|
|
255
|
+
<View>
|
|
256
|
+
<Card>
|
|
257
|
+
<LdvSwitch
|
|
258
|
+
title={I18n.getLang('light_sources_tile_tw_lighting_headline')}
|
|
259
|
+
color={props.theme.card.background}
|
|
260
|
+
colorAlpha={1}
|
|
261
|
+
enable={state.applyForList[0]?.enable}
|
|
262
|
+
setEnable={(enable: boolean) => {
|
|
263
|
+
state.applyForList[0].enable = enable;
|
|
264
|
+
state.applyFlag = Symbol()
|
|
265
|
+
}}
|
|
266
|
+
/>
|
|
267
|
+
{state.applyForList[0]?.enable && (
|
|
268
|
+
<StripAdjustView
|
|
269
|
+
isSupportBrightness={props.isSupportBrightness}
|
|
270
|
+
isSupportTemperature={props.isSupportTemperature}
|
|
271
|
+
lampTabs={tabList}
|
|
272
|
+
reserveSV={true}
|
|
273
|
+
activeKey={deviceData.activeKey}
|
|
274
|
+
colorDiskActiveKey={deviceData.colorDiskActiveKey}
|
|
275
|
+
onActiveKeyChange={(activekey) => {
|
|
276
|
+
state.deviceData = {
|
|
277
|
+
...state.deviceData,
|
|
278
|
+
activeKey: Number(activekey),
|
|
279
|
+
isColorMode: !(Number(activekey) === 0)
|
|
280
|
+
}
|
|
281
|
+
state.manualFlag = Symbol()
|
|
282
|
+
}}
|
|
283
|
+
onColorDiskChange={(colors, idx) => {
|
|
284
|
+
state.deviceData = {
|
|
285
|
+
...state.deviceData,
|
|
286
|
+
colors,
|
|
287
|
+
colorDiskActiveKey: idx
|
|
288
|
+
}
|
|
289
|
+
state.manualFlag = Symbol()
|
|
290
|
+
}}
|
|
291
|
+
h={state.deviceData.h}
|
|
292
|
+
s={state.deviceData.s}
|
|
293
|
+
v={state.deviceData.v}
|
|
294
|
+
brightness={state.deviceData.brightness}
|
|
295
|
+
colorTemp={state.deviceData.temperature}
|
|
296
|
+
onHSVChangeComplete={(h, s, v) => {
|
|
297
|
+
state.deviceData.h = h;
|
|
298
|
+
state.deviceData.s = s;
|
|
299
|
+
state.deviceData.v = v;
|
|
300
|
+
state.manualFlag = Symbol()
|
|
301
|
+
}}
|
|
302
|
+
onBrightnessChangeComplete={bright => {
|
|
303
|
+
state.deviceData.brightness = bright;
|
|
304
|
+
state.manualFlag = Symbol()
|
|
305
|
+
}}
|
|
306
|
+
onCCTChangeComplete={cct => {
|
|
307
|
+
state.deviceData.temperature = cct;
|
|
308
|
+
state.manualFlag = Symbol()
|
|
309
|
+
}}
|
|
310
|
+
/>
|
|
311
|
+
)}
|
|
312
|
+
</Card>
|
|
313
|
+
<Spacer />
|
|
314
|
+
</View>
|
|
315
|
+
);
|
|
316
|
+
}, [state.deviceData, state.applyForList, props.theme.type]);
|
|
317
|
+
|
|
318
|
+
const ceilingLightCard = useMemo(() => {
|
|
319
|
+
const deviceData = state.deviceData as CeilingLightData
|
|
320
|
+
return (
|
|
321
|
+
<View>
|
|
322
|
+
{state.applyForList.map((item, idx) => (
|
|
323
|
+
<View key={item.dp}>
|
|
324
|
+
<Card style={{ marginHorizontal: cx(24) }}>
|
|
325
|
+
<LdvSwitch
|
|
326
|
+
title={item.key}
|
|
327
|
+
color={'#fff'}
|
|
328
|
+
colorAlpha={1}
|
|
329
|
+
enable={item.enable}
|
|
330
|
+
setEnable={(enable: boolean) => {
|
|
331
|
+
state.applyForList[idx].enable = enable;
|
|
332
|
+
state.applyFlag = Symbol()
|
|
333
|
+
}}
|
|
334
|
+
/>
|
|
335
|
+
{item.enable &&
|
|
336
|
+
(item.type === 'mainLight' ? (
|
|
337
|
+
<View>
|
|
338
|
+
<ColorTempAdjustView
|
|
339
|
+
isSupportBrightness={props.isSupportBrightness}
|
|
340
|
+
isSupportTemperature={props.isSupportTemperature}
|
|
341
|
+
colorTemp={deviceData.temperature}
|
|
342
|
+
brightness={deviceData.brightness}
|
|
343
|
+
onBrightnessChangeComplete={bright => {
|
|
344
|
+
state.deviceData.brightness = bright;
|
|
345
|
+
state.manualFlag = Symbol()
|
|
346
|
+
}}
|
|
347
|
+
onCCTChangeComplete={cct => {
|
|
348
|
+
state.deviceData.temperature = cct;
|
|
349
|
+
state.manualFlag = Symbol()
|
|
350
|
+
}}
|
|
351
|
+
/>
|
|
352
|
+
<Spacer height={cx(16)} />
|
|
353
|
+
</View>
|
|
354
|
+
) : (
|
|
355
|
+
<View>
|
|
356
|
+
<StripAdjustView
|
|
357
|
+
isSupportBrightness={false}
|
|
358
|
+
isSupportTemperature={false}
|
|
359
|
+
lampTabs={tabList}
|
|
360
|
+
reserveSV={true}
|
|
361
|
+
activeKey={deviceData.activeKey}
|
|
362
|
+
colorDiskActiveKey={deviceData.colorDiskActiveKey}
|
|
363
|
+
onActiveKeyChange={(activekey) => {
|
|
364
|
+
state.deviceData = {
|
|
365
|
+
...state.deviceData,
|
|
366
|
+
activeKey: Number(activekey)
|
|
367
|
+
}
|
|
368
|
+
state.manualFlag = Symbol()
|
|
369
|
+
}}
|
|
370
|
+
onColorDiskChange={(colors, idx) => {
|
|
371
|
+
state.deviceData = {
|
|
372
|
+
...state.deviceData,
|
|
373
|
+
colors,
|
|
374
|
+
colorDiskActiveKey: idx
|
|
375
|
+
}
|
|
376
|
+
state.manualFlag = Symbol()
|
|
377
|
+
}}
|
|
378
|
+
h={deviceData.h}
|
|
379
|
+
s={deviceData.s}
|
|
380
|
+
v={deviceData.v}
|
|
381
|
+
brightness={deviceData.brightness}
|
|
382
|
+
colorTemp={deviceData.temperature}
|
|
383
|
+
onHSVChangeComplete={(h, s, v) => {
|
|
384
|
+
state.deviceData.h = h;
|
|
385
|
+
state.deviceData.s = s;
|
|
386
|
+
state.deviceData.v = v;
|
|
387
|
+
state.manualFlag = Symbol()
|
|
388
|
+
}}
|
|
389
|
+
onBrightnessChangeComplete={bright => {
|
|
390
|
+
state.deviceData.brightness = bright;
|
|
391
|
+
state.manualFlag = Symbol()
|
|
392
|
+
}}
|
|
393
|
+
onCCTChangeComplete={cct => {
|
|
394
|
+
state.deviceData.temperature = cct;
|
|
395
|
+
state.manualFlag = Symbol()
|
|
396
|
+
}}
|
|
397
|
+
/>
|
|
398
|
+
<Spacer />
|
|
399
|
+
</View>
|
|
400
|
+
))}
|
|
401
|
+
<Spacer height={cx(16)} />
|
|
402
|
+
</Card>
|
|
403
|
+
<Spacer />
|
|
404
|
+
</View>
|
|
405
|
+
))}
|
|
406
|
+
</View>
|
|
407
|
+
)
|
|
408
|
+
}, [state.deviceData, state.applyForList])
|
|
409
|
+
|
|
410
|
+
const powerStripCard = useMemo(() => {
|
|
411
|
+
return (
|
|
412
|
+
<View>
|
|
413
|
+
{state.applyForList.map((item, idx) => (
|
|
414
|
+
<View key={item.dp}>
|
|
415
|
+
<SocketItem
|
|
416
|
+
title={item.key}
|
|
417
|
+
name={item.name!}
|
|
418
|
+
icon={{ uri: PowerStripIcon[item.index ?? 0] }}
|
|
419
|
+
disabledEdit={true}
|
|
420
|
+
onNameChange={() => { }}
|
|
421
|
+
enabled={item.enable}
|
|
422
|
+
onSwitchChange={async enable => {
|
|
423
|
+
state.applyForList = state.applyForList.map((apply, index) => {
|
|
424
|
+
if (idx === index) {
|
|
425
|
+
return {
|
|
426
|
+
...apply,
|
|
427
|
+
enable,
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
return apply;
|
|
431
|
+
});
|
|
432
|
+
state.applyFlag = Symbol()
|
|
433
|
+
}}
|
|
434
|
+
/>
|
|
435
|
+
<Spacer />
|
|
436
|
+
</View>
|
|
437
|
+
))}
|
|
438
|
+
</View>
|
|
439
|
+
)
|
|
440
|
+
}, [state.deviceData, state.applyForList])
|
|
441
|
+
|
|
442
|
+
const componentRender = useMemo(() => {
|
|
443
|
+
const component =
|
|
444
|
+
props.manualData.type === DeviceType.MixLight
|
|
445
|
+
? mixLightCard
|
|
446
|
+
: props.manualData.type === DeviceType.StripLight
|
|
447
|
+
? stripLightCard
|
|
448
|
+
: props.manualData.type === DeviceType.CeilingLight
|
|
449
|
+
? ceilingLightCard
|
|
450
|
+
: props.manualData.type === DeviceType.PowerStrip
|
|
451
|
+
? powerStripCard
|
|
452
|
+
: lightSourceCard;
|
|
453
|
+
return component;
|
|
454
|
+
}, [props.manualData, state.applyForList, state.deviceData, props.theme.type]);
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
return <View>{componentRender}</View>;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export default memo(withTheme(ManualSettings))
|