@ledvance/ui-biz-bundle 1.0.14 → 1.0.16
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 +1 -1
- package/src/modules/mood/AddMoodPage.d.ts +0 -1
- package/src/modules/mood/AddMoodPage.tsx +0 -5
- package/src/modules/mood/DynamicMoodEditorPage.tsx +6 -5
- package/src/modules/mood/MoodPage.tsx +0 -7
- package/src/modules/mood/StaticMoodEditorPage.d.ts +0 -1
- package/src/modules/mood/StaticMoodEditorPage.tsx +7 -5
- package/src/modules/scene/SceneAction.d.ts +2 -2
- package/src/modules/scene/SceneAction.ts +21 -12
- package/src/modules/scene/SceneInfo.d.ts +2 -2
- package/src/modules/scene/SceneInfo.ts +2 -2
- package/src/modules/timeSchedule/DeviceState.d.ts +7 -2
- package/src/modules/timeSchedule/DeviceState.tsx +9 -2
- package/src/modules/timeSchedule/LdvScheduleItem.tsx +2 -1
- package/src/modules/timeSchedule/ManualSetting.d.ts +6 -2
- package/src/modules/timeSchedule/ManualSetting.tsx +14 -3
- package/src/modules/timeSchedule/MoodSetting.d.ts +2 -1
- package/src/modules/timeSchedule/MoodSetting.tsx +31 -35
- package/src/modules/timeSchedule/ScheduleScene.tsx +2 -1
- package/src/modules/timeSchedule/SingleLightView.d.ts +4 -2
- package/src/modules/timeSchedule/SingleLightView.tsx +42 -165
- package/src/modules/timeSchedule/TimeScheduleBean.d.ts +14 -0
- package/src/modules/timeSchedule/TimeScheduleBean.ts +1 -0
- package/src/modules/timeSchedule/TimeScheduleEditpage.tsx +232 -25
- package/src/modules/timeSchedule/TimeSchedulePage.d.ts +6 -0
- package/src/modules/timeSchedule/TimeSchedulePage.tsx +2 -1
- package/src/modules/timeSchedule/mix/MixLightActions.d.ts +3 -0
- package/src/modules/timeSchedule/mix/MixLightView.d.ts +2 -1
- package/src/modules/timeSchedule/mix/MixLightView.tsx +15 -19
package/package.json
CHANGED
|
@@ -18,7 +18,6 @@ export interface AddMoodPageParams {
|
|
|
18
18
|
moods: SceneUIState[],
|
|
19
19
|
onSave: () => void
|
|
20
20
|
dpCodes: Record<string,string>
|
|
21
|
-
routeKey: Record<string,string>
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
interface AddMoodPageState {
|
|
@@ -63,23 +62,19 @@ const AddMoodPage = () => {
|
|
|
63
62
|
const id = routeParams.moods.length > 0 ? Math.max(...routeParams.moods.map(m => m.id)) + 1 : 0
|
|
64
63
|
if (routeParams.isStatic) {
|
|
65
64
|
toStaticMoodEditorPage(navigation,
|
|
66
|
-
routeParams.routeKey,
|
|
67
65
|
{
|
|
68
66
|
mode: 'add',
|
|
69
67
|
currentMood: index === 0 ? newMood(id, routeParams.isStatic, routeParams.dpCodes) : recommendMood2SceneUIState(item),
|
|
70
68
|
moods: routeParams.moods,
|
|
71
|
-
routeKey: routeParams.routeKey,
|
|
72
69
|
dpCodes: routeParams.dpCodes,
|
|
73
70
|
onSave: routeParams.onSave,
|
|
74
71
|
})
|
|
75
72
|
} else {
|
|
76
73
|
toDynamicMoodEditorPage(navigation,
|
|
77
|
-
routeParams.routeKey,
|
|
78
74
|
{
|
|
79
75
|
mode: 'add',
|
|
80
76
|
currentMood: index === 0 ? newMood(id, routeParams.isStatic, routeParams.dpCodes) : recommendMood2SceneUIState(item),
|
|
81
77
|
moods: routeParams.moods,
|
|
82
|
-
routeKey: routeParams.routeKey,
|
|
83
78
|
dpCodes: routeParams.dpCodes,
|
|
84
79
|
onSave: routeParams.onSave,
|
|
85
80
|
})
|
|
@@ -39,6 +39,7 @@ import {SelectPageData, SelectPageParams} from '../select/SelectPage'
|
|
|
39
39
|
import {toSelectPage} from '../../navigation/tools'
|
|
40
40
|
import FanAdjustView from '@ledvance/base/src/components/FanAdjustView'
|
|
41
41
|
import {showDeleteMoodDialog} from './tools'
|
|
42
|
+
import { ui_biz_routerKey } from '@ledvance/ui-biz-bundle/src/navigation/Routers'
|
|
42
43
|
|
|
43
44
|
const cx = Utils.RatioUtils.convertX
|
|
44
45
|
|
|
@@ -105,7 +106,7 @@ const DynamicMoodEditorPage = () => {
|
|
|
105
106
|
params.moods.map(mood => {
|
|
106
107
|
return mood.id === currentMood.id ? currentMood : mood
|
|
107
108
|
})
|
|
108
|
-
const saveRes = await saveScene(deviceId, currentMood, state.currentNode.transitionMode, state.currentNode.transitionTime, list)
|
|
109
|
+
const saveRes = await saveScene(deviceId, currentMood, state.currentNode.transitionMode, state.currentNode.transitionTime, list, params.dpCodes)
|
|
109
110
|
if (saveRes.success) {
|
|
110
111
|
if (list.length > 0) {
|
|
111
112
|
const setSceneRes = await setScene(deviceId, currentMood.id === moodId && isDelete ? list[0] : currentMood, params.dpCodes)
|
|
@@ -115,7 +116,7 @@ const DynamicMoodEditorPage = () => {
|
|
|
115
116
|
console.log('Mood被清空,将work_mode设置成white')
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
|
-
navigation.navigate(
|
|
119
|
+
navigation.navigate(ui_biz_routerKey.ui_biz_mood)
|
|
119
120
|
routeParams.onSave()
|
|
120
121
|
}, [])
|
|
121
122
|
|
|
@@ -192,7 +193,7 @@ const DynamicMoodEditorPage = () => {
|
|
|
192
193
|
})
|
|
193
194
|
},
|
|
194
195
|
}
|
|
195
|
-
toSelectPage(navigation,
|
|
196
|
+
toSelectPage(navigation, paramsSelect)
|
|
196
197
|
}}/>
|
|
197
198
|
<Spacer height={cx(10)}/>
|
|
198
199
|
<LdvSlider
|
|
@@ -397,8 +398,8 @@ const DynamicMoodEditorPage = () => {
|
|
|
397
398
|
</Card>
|
|
398
399
|
<Spacer/>
|
|
399
400
|
<FanAdjustView
|
|
400
|
-
fanEnable={state.mood.fanEnable}
|
|
401
|
-
fanSpeed={state.mood.fanSpeed}
|
|
401
|
+
fanEnable={!!state.mood.fanEnable}
|
|
402
|
+
fanSpeed={state.mood.fanSpeed || 1}
|
|
402
403
|
maxFanSpeed={useFanMaxSpeed()}
|
|
403
404
|
onFanSwitch={fanEnable => {
|
|
404
405
|
state.mood.fanEnable = fanEnable
|
|
@@ -33,7 +33,6 @@ interface MoodPageUIState extends ScenePageUIState {
|
|
|
33
33
|
|
|
34
34
|
interface MoodPageProps{
|
|
35
35
|
dpCodes: Record<string,string>
|
|
36
|
-
routerKey: Record<string,string>
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
const MAX_MOOD_COUNT = 8
|
|
@@ -71,12 +70,10 @@ const MoodPage = () => {
|
|
|
71
70
|
if (!!state.scenes) {
|
|
72
71
|
toAddMoodPage(
|
|
73
72
|
navigation,
|
|
74
|
-
routeParams.routerKey,
|
|
75
73
|
{
|
|
76
74
|
isStatic: isStatic,
|
|
77
75
|
moods: state.scenes,
|
|
78
76
|
dpCodes: routeParams.dpCodes,
|
|
79
|
-
routeKey: routeParams.routerKey,
|
|
80
77
|
onSave: () => {
|
|
81
78
|
state.flag = Symbol()
|
|
82
79
|
},
|
|
@@ -150,13 +147,11 @@ const MoodPage = () => {
|
|
|
150
147
|
if (item.nodes.length > 1) {
|
|
151
148
|
toDynamicMoodEditorPage(
|
|
152
149
|
navigation,
|
|
153
|
-
routeParams.routerKey,
|
|
154
150
|
{
|
|
155
151
|
mode: 'edit',
|
|
156
152
|
currentMood: item,
|
|
157
153
|
moods: state.scenes,
|
|
158
154
|
dpCodes: routeParams.dpCodes,
|
|
159
|
-
routeKey: routeParams.routerKey,
|
|
160
155
|
onSave: () => {
|
|
161
156
|
state.flag = Symbol()
|
|
162
157
|
},
|
|
@@ -165,13 +160,11 @@ const MoodPage = () => {
|
|
|
165
160
|
}
|
|
166
161
|
toStaticMoodEditorPage(
|
|
167
162
|
navigation,
|
|
168
|
-
routeParams.routerKey,
|
|
169
163
|
{
|
|
170
164
|
mode: 'edit',
|
|
171
165
|
currentMood: item,
|
|
172
166
|
moods: state.scenes,
|
|
173
167
|
dpCodes: routeParams.dpCodes,
|
|
174
|
-
routeKey: routeParams.routerKey,
|
|
175
168
|
onSave: () => {
|
|
176
169
|
state.flag = Symbol()
|
|
177
170
|
},
|
|
@@ -33,6 +33,7 @@ import {SceneNodeInfo, SceneUIState} from '../scene/SceneInfo'
|
|
|
33
33
|
import LampAdjustView from '@ledvance/base/src/components/LampAdjustView'
|
|
34
34
|
import FanAdjustView from '@ledvance/base/src/components/FanAdjustView'
|
|
35
35
|
import {showDeleteMoodDialog} from './tools'
|
|
36
|
+
import { ui_biz_routerKey } from '@ledvance/ui-biz-bundle/src/navigation/Routers'
|
|
36
37
|
|
|
37
38
|
const cx = Utils.RatioUtils.convertX
|
|
38
39
|
|
|
@@ -42,7 +43,6 @@ export interface StaticMoodEditorPageParams {
|
|
|
42
43
|
moods: SceneUIState[]
|
|
43
44
|
onSave: () => void
|
|
44
45
|
dpCodes: Record<string, string>
|
|
45
|
-
routeKey: Record<string, string>
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
export interface StaticMoodEditorPageState {
|
|
@@ -54,6 +54,7 @@ export interface StaticMoodEditorPageState {
|
|
|
54
54
|
const StaticMoodEditorPage = () => {
|
|
55
55
|
const navigation = useNavigation()
|
|
56
56
|
const routeParams = useRoute().params as any
|
|
57
|
+
console.log(routeParams, '< --- routerParams')
|
|
57
58
|
const params = JSON.parse(JSON.stringify(routeParams)) as StaticMoodEditorPageParams
|
|
58
59
|
const deviceId = useDeviceId()
|
|
59
60
|
const [moodId, setScene] = useScene(params.dpCodes)
|
|
@@ -97,12 +98,13 @@ const StaticMoodEditorPage = () => {
|
|
|
97
98
|
fanSpeed: state.mood.fanSpeed,
|
|
98
99
|
nodes: state.mood.nodes,
|
|
99
100
|
}
|
|
101
|
+
|
|
100
102
|
const list = params.mode === 'add' ? [...params.moods, currentMood] :
|
|
101
103
|
isDelete ? params.moods.filter(mood => mood.id !== currentMood.id) :
|
|
102
104
|
params.moods.map(mood => {
|
|
103
105
|
return mood.id === currentMood.id ? currentMood : mood
|
|
104
106
|
})
|
|
105
|
-
const saveRes = await saveScene(deviceId, currentMood, state.currentNode.transitionMode, state.currentNode.transitionTime, list)
|
|
107
|
+
const saveRes = await saveScene(deviceId, currentMood, state.currentNode.transitionMode, state.currentNode.transitionTime, list, params.dpCodes)
|
|
106
108
|
if (saveRes.success) {
|
|
107
109
|
if (list.length > 0) {
|
|
108
110
|
const setSceneRes = await setScene(deviceId, currentMood.id === moodId && isDelete ? list[0] : currentMood, params.dpCodes)
|
|
@@ -112,7 +114,7 @@ const StaticMoodEditorPage = () => {
|
|
|
112
114
|
console.log('Mood被清空,将work_mode设置成white')
|
|
113
115
|
}
|
|
114
116
|
}
|
|
115
|
-
navigation.navigate(
|
|
117
|
+
navigation.navigate(ui_biz_routerKey.ui_biz_mood)
|
|
116
118
|
routeParams.onSave()
|
|
117
119
|
}, [moodId])
|
|
118
120
|
|
|
@@ -213,8 +215,8 @@ const StaticMoodEditorPage = () => {
|
|
|
213
215
|
</Card>
|
|
214
216
|
<Spacer/>
|
|
215
217
|
<FanAdjustView
|
|
216
|
-
fanEnable={state.mood.fanEnable}
|
|
217
|
-
fanSpeed={state.mood.fanSpeed}
|
|
218
|
+
fanEnable={!!state.mood.fanEnable}
|
|
219
|
+
fanSpeed={state.mood.fanSpeed || 1}
|
|
218
220
|
maxFanSpeed={useFanMaxSpeed()}
|
|
219
221
|
onFanSwitch={fanEnable => {
|
|
220
222
|
state.mood.fanEnable = fanEnable
|
|
@@ -4,10 +4,10 @@ type GetRemoteSceneListType = (deviceId: string, dpCodes: Record<string, string>
|
|
|
4
4
|
type SetRemoteSceneListType = (deviceId: string, remoteSceneList: RemoteSceneInfo[]) => Promise<Result<any>>;
|
|
5
5
|
export declare const setRemoteSceneList: SetRemoteSceneListType;
|
|
6
6
|
export declare const getRemoteSceneList: GetRemoteSceneListType;
|
|
7
|
-
export declare function dp2Obj(dp: string): SceneInfo;
|
|
7
|
+
export declare function dp2Obj(dp: string, isFan?: boolean): SceneInfo;
|
|
8
8
|
type UseSceneType = (dpCodes: Record<string, string>) => [number, SetSceneType];
|
|
9
9
|
type SetSceneType = (deviceId: string, scene: SceneInfo, dpCodes: Record<string, string>) => Promise<Result<any>>;
|
|
10
10
|
export declare const useScene: UseSceneType;
|
|
11
|
-
export declare function obj2Dp(scene: SceneInfo): string;
|
|
11
|
+
export declare function obj2Dp(scene: SceneInfo, isFan?: boolean): string;
|
|
12
12
|
export declare function saveScene(deviceId: string, scene: SceneUIState, transitionMode: SceneNodeTransitionMode, transitionTime: number, scenes: SceneUIState[]): Promise<Result<any>>;
|
|
13
13
|
export {};
|
|
@@ -15,6 +15,7 @@ import { Dispatch, useState } from 'react';
|
|
|
15
15
|
import { useUpdateEffect } from 'ahooks';
|
|
16
16
|
import { useDispatch } from 'react-redux';
|
|
17
17
|
import res from '@ledvance/base/src/res';
|
|
18
|
+
import { isFanLamp } from '@ledvance/base/src/utils/Support';
|
|
18
19
|
|
|
19
20
|
type GetRemoteSceneListType = (deviceId: string, dpCodes: Record<string, string>) => Promise<Result<SceneUIState[]>>;
|
|
20
21
|
type SetRemoteSceneListType = (
|
|
@@ -49,15 +50,16 @@ export const getRemoteSceneList: GetRemoteSceneListType = async (deviceId: strin
|
|
|
49
50
|
}
|
|
50
51
|
return {
|
|
51
52
|
success: true,
|
|
52
|
-
data: res.data.map((item, index) => remoteSceneInfo2SceneUIState(item, index)),
|
|
53
|
+
data: res.data.map((item, index) => remoteSceneInfo2SceneUIState(item, index, dpCodes)),
|
|
53
54
|
};
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
function remoteSceneInfo2SceneUIState(
|
|
57
58
|
remoteSceneInfo: RemoteSceneInfo,
|
|
58
59
|
index: number,
|
|
60
|
+
dpCodes: Record<string, any>
|
|
59
61
|
): SceneUIState {
|
|
60
|
-
const sceneInfo = dp2Obj(remoteSceneInfo.i);
|
|
62
|
+
const sceneInfo = dp2Obj(remoteSceneInfo.i, isFanLamp(dpCodes));
|
|
61
63
|
return {
|
|
62
64
|
id: sceneInfo.id,
|
|
63
65
|
fanEnable: sceneInfo.fanEnable,
|
|
@@ -68,15 +70,18 @@ function remoteSceneInfo2SceneUIState(
|
|
|
68
70
|
};
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
export function dp2Obj(dp: string): SceneInfo {
|
|
73
|
+
export function dp2Obj(dp: string, isFan:boolean = false): SceneInfo {
|
|
72
74
|
let dpCopy = dp;
|
|
73
|
-
|
|
75
|
+
let fanEnable = false
|
|
76
|
+
let fanSpeed = 0
|
|
74
77
|
const id = hex2Int(dpCopy.slice(0, 2));
|
|
75
78
|
dpCopy = dpCopy.slice(2);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
if(isFan){
|
|
80
|
+
fanEnable = hex2Int(dpCopy.slice(0, 2)) === 1
|
|
81
|
+
dpCopy = dpCopy.slice(2)
|
|
82
|
+
fanSpeed = hex2Int(dpCopy.slice(0, 2))
|
|
83
|
+
dpCopy = dpCopy.slice(2)
|
|
84
|
+
}
|
|
80
85
|
const nodes: SceneNodeInfo[] = spliceByStep(dpCopy, 26).map(nodeHex => {
|
|
81
86
|
let hex = nodeHex;
|
|
82
87
|
const switchingInterval = hex2Int(hex.slice(0, 2));
|
|
@@ -107,7 +112,7 @@ export function dp2Obj(dp: string): SceneInfo {
|
|
|
107
112
|
isColorNode: s !== 0, // 色相/饱和度 不为0就是颜色节点
|
|
108
113
|
};
|
|
109
114
|
});
|
|
110
|
-
return { id,fanEnable, fanSpeed, nodes }
|
|
115
|
+
return isFan ? { id,fanEnable, fanSpeed, nodes } : { id, nodes }
|
|
111
116
|
}
|
|
112
117
|
|
|
113
118
|
function getSceneImage(index: number): string {
|
|
@@ -162,10 +167,14 @@ const setScene = (dispatch: Dispatch<any>) => (deviceId, scene, dpCodes) =>
|
|
|
162
167
|
});
|
|
163
168
|
|
|
164
169
|
|
|
165
|
-
export function obj2Dp(scene: SceneInfo): string {
|
|
170
|
+
export function obj2Dp(scene: SceneInfo, isFan: boolean = false): string {
|
|
171
|
+
let fanEnableHex = ''
|
|
172
|
+
let fanSpeedHex = ''
|
|
166
173
|
const idHex = scene.id.toString(16).padStart(2, '0')
|
|
167
|
-
|
|
168
|
-
|
|
174
|
+
if(isFan){
|
|
175
|
+
fanEnableHex = (scene.fanEnable ? 1 : 0).toString(16).padStart(2, '0')
|
|
176
|
+
fanSpeedHex = (scene.fanSpeed || 1).toString(16).padStart(2, '0')
|
|
177
|
+
}
|
|
169
178
|
return idHex + fanEnableHex + fanSpeedHex + scene.nodes.map(node => {
|
|
170
179
|
const switchingIntervalHex = node.switchingInterval.toString(16).padStart(2, '0')
|
|
171
180
|
const transitionTimeHex = node.transitionTime.toString(16).padStart(2, '0')
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { ScheduleItemDp } from "./TimeScheduleEditpage";
|
|
2
|
-
|
|
2
|
+
import { JudgeTimeScheduleProps } from "./TimeScheduleBean";
|
|
3
|
+
interface DeviceStateProps extends JudgeTimeScheduleProps {
|
|
4
|
+
singleActions: any;
|
|
5
|
+
mixActions: any;
|
|
6
|
+
actionScene: any;
|
|
3
7
|
scheduleItem: any;
|
|
4
8
|
dps: ScheduleItemDp[];
|
|
9
|
+
selectedDps: ScheduleItemDp[];
|
|
5
10
|
dpCodes: Record<string, string>;
|
|
6
11
|
isManual: boolean;
|
|
7
12
|
setIsManual?: (isManual: boolean) => void;
|
|
8
|
-
setSendDps: (
|
|
13
|
+
setSendDps: (actions: any, type: string) => void;
|
|
9
14
|
changeSkillEnable: (dpId: string, enable: boolean) => void;
|
|
10
15
|
}
|
|
11
16
|
declare const DeviceState: (props: DeviceStateProps) => any;
|
|
@@ -13,19 +13,22 @@ import res from "@ledvance/base/src/res";
|
|
|
13
13
|
const { convertX: cx } = Utils.RatioUtils
|
|
14
14
|
const { isSupportScene } = lampUtils.SupportUtils
|
|
15
15
|
interface DeviceStateProps extends JudgeTimeScheduleProps {
|
|
16
|
+
singleActions: any
|
|
17
|
+
mixActions:any
|
|
18
|
+
actionScene:any
|
|
16
19
|
scheduleItem: any
|
|
17
20
|
dps: ScheduleItemDp[]
|
|
18
21
|
selectedDps: ScheduleItemDp[]
|
|
19
22
|
dpCodes: Record<string, string>
|
|
20
23
|
isManual: boolean
|
|
21
24
|
setIsManual?: (isManual: boolean) => void
|
|
22
|
-
setSendDps: (
|
|
25
|
+
setSendDps: (actions:any, type:string) => void
|
|
23
26
|
changeSkillEnable: (dpId: string, enable: boolean) => void
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
const DeviceState = (props: DeviceStateProps) => {
|
|
27
30
|
const showSegmentControl = () => {
|
|
28
|
-
return !!(isSupportScene() && !isPlug(props.dpCodes) && props.selectedDps.length
|
|
31
|
+
return !!(isSupportScene() && !isPlug(props.dpCodes) && props.selectedDps.length)
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
const showErrorText = () => {
|
|
@@ -42,6 +45,8 @@ const DeviceState = (props: DeviceStateProps) => {
|
|
|
42
45
|
/>}
|
|
43
46
|
{props.isManual ?
|
|
44
47
|
<ManualSetting
|
|
48
|
+
singleActions ={props.singleActions}
|
|
49
|
+
mixActions = {props.mixActions}
|
|
45
50
|
dpCodes={props.dpCodes}
|
|
46
51
|
dps={props.selectedDps}
|
|
47
52
|
scheduleItem={props.scheduleItem}
|
|
@@ -53,6 +58,7 @@ const DeviceState = (props: DeviceStateProps) => {
|
|
|
53
58
|
isOnlyRGBLamp={props.isOnlyRGBLamp}
|
|
54
59
|
isRGBLamp={props.isRGBLamp}
|
|
55
60
|
isRGBWLamp={props.isRGBWLamp}
|
|
61
|
+
isMixRGBWLamp={props.isMixRGBWLamp}
|
|
56
62
|
isTWLamp={props.isTWLamp}
|
|
57
63
|
isFanLamp={props.isFanLamp}
|
|
58
64
|
isSupportMode={props.isSupportMode}
|
|
@@ -67,6 +73,7 @@ const DeviceState = (props: DeviceStateProps) => {
|
|
|
67
73
|
<Text style={{ color: '#FF9500', marginLeft: cx(5) }}>{I18n.getLang('timeschedule_add_schedule_no_device_warning_text')}</Text>
|
|
68
74
|
</View> :
|
|
69
75
|
<MoodSetting
|
|
76
|
+
actionScene={props.actionScene}
|
|
70
77
|
dpCodes={props.dpCodes}
|
|
71
78
|
dps={props.dps}
|
|
72
79
|
scheduleItem={props.scheduleItem}
|
|
@@ -40,7 +40,8 @@ const LdvScheduleItem = (props: LdvScheduleItemProps) => {
|
|
|
40
40
|
onPress(item);
|
|
41
41
|
}}
|
|
42
42
|
onLongPress={() => {
|
|
43
|
-
|
|
43
|
+
onPress(item);
|
|
44
|
+
// onLongPress(item);
|
|
44
45
|
}}>
|
|
45
46
|
<View style={styles.infoContainer}>
|
|
46
47
|
<Text style={styles.time}>{item.time}</Text>
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { ScheduleItemDp } from "./TimeScheduleEditpage";
|
|
2
|
-
|
|
2
|
+
import { JudgeTimeScheduleProps } from "./TimeScheduleBean";
|
|
3
|
+
interface ManualSettingProps extends JudgeTimeScheduleProps {
|
|
4
|
+
singleActions: any;
|
|
5
|
+
mixActions: any;
|
|
3
6
|
scheduleItem: any;
|
|
4
7
|
dps: ScheduleItemDp[];
|
|
5
8
|
dpCodes: Record<string, string>;
|
|
6
|
-
|
|
9
|
+
isMixRGBWLamp?: boolean;
|
|
10
|
+
setSendDps: (actions: any, type: string) => void;
|
|
7
11
|
changeSkillEnable: (dpId: string, enable: boolean) => void;
|
|
8
12
|
}
|
|
9
13
|
declare const ManualSetting: (props: ManualSettingProps) => any;
|
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import { isMixRGBWLamp } from '@ledvance/base/src/utils/Support'
|
|
4
3
|
import SingleLightView from "./SingleLightView";
|
|
5
4
|
import { ScheduleItemDp } from "./TimeScheduleEditpage";
|
|
6
5
|
import MixLightView from "./mix/MixLightView";
|
|
7
6
|
import { JudgeTimeScheduleProps } from "./TimeScheduleBean";
|
|
7
|
+
import { useReactive } from "ahooks";
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
interface ManualSettingProps extends JudgeTimeScheduleProps{
|
|
11
|
+
singleActions: any
|
|
12
|
+
mixActions:any
|
|
11
13
|
scheduleItem: any
|
|
12
14
|
dps: ScheduleItemDp[]
|
|
13
15
|
dpCodes: Record<string, string>
|
|
14
|
-
|
|
16
|
+
isMixRGBWLamp?: boolean
|
|
17
|
+
setSendDps: (actions: any, type:string) => void
|
|
15
18
|
changeSkillEnable: (dpId:string, enable: boolean) => void
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
const ManualSetting = (props: ManualSettingProps) => {
|
|
22
|
+
const state = useReactive({
|
|
23
|
+
singleActions: props.singleActions,
|
|
24
|
+
mixActions: props.mixActions,
|
|
25
|
+
flag: Symbol()
|
|
26
|
+
})
|
|
27
|
+
|
|
19
28
|
|
|
20
29
|
const renderContent = () => {
|
|
21
|
-
if (
|
|
30
|
+
if (props.isMixRGBWLamp) {
|
|
22
31
|
return (
|
|
23
32
|
<MixLightView
|
|
33
|
+
mixActions={state.mixActions}
|
|
24
34
|
dpCodes={props.dpCodes}
|
|
25
35
|
setSendDps={props.setSendDps}
|
|
26
36
|
scheduleItem={props.scheduleItem}
|
|
@@ -31,6 +41,7 @@ const ManualSetting = (props: ManualSettingProps) => {
|
|
|
31
41
|
props.dps.map((item) => (
|
|
32
42
|
<View key={item.dpId}>
|
|
33
43
|
<SingleLightView
|
|
44
|
+
singleActions={state.singleActions}
|
|
34
45
|
dp={item}
|
|
35
46
|
dpCodes={props.dpCodes}
|
|
36
47
|
scheduleItem={props.scheduleItem}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ScheduleItemDp } from "./TimeScheduleEditpage";
|
|
2
2
|
interface MoodSettingProps {
|
|
3
|
+
actionScene: any;
|
|
3
4
|
scheduleItem: any;
|
|
4
5
|
dps: ScheduleItemDp[];
|
|
5
6
|
dpCodes: Record<string, string>;
|
|
6
|
-
setSendDps: (
|
|
7
|
+
setSendDps: (actions: any, type: string) => void;
|
|
7
8
|
changeSkillEnable: (dpId: string, enable: boolean) => void;
|
|
8
9
|
}
|
|
9
10
|
declare const MoodSetting: (props: MoodSettingProps) => any;
|
|
@@ -1,59 +1,55 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
2
|
import { ScheduleItemDp } from "./TimeScheduleEditpage";
|
|
3
|
-
import { isMixRGBWLamp } from '@ledvance/base/src/utils/Support';
|
|
4
|
-
import { obj2Dp as senceObj2Dp, dp2Obj as sencePp2Obj } from "../scene/SceneAction";
|
|
5
3
|
import ScheduleScene from "./ScheduleScene";
|
|
6
4
|
// import MixMoodScene from "../mood/MixScene";
|
|
7
5
|
import { useReactive } from 'ahooks'
|
|
8
|
-
import { Buffer } from 'buffer';
|
|
9
|
-
import { SCENE } from "../../hooks/DeviceDpStateHooks";
|
|
10
6
|
|
|
11
7
|
interface MoodSettingProps{
|
|
8
|
+
actionScene:any
|
|
12
9
|
scheduleItem: any
|
|
13
10
|
dps: ScheduleItemDp[]
|
|
14
11
|
dpCodes: Record<string, string>
|
|
15
|
-
setSendDps: (
|
|
12
|
+
setSendDps: (actions:any, type:string) => void
|
|
16
13
|
changeSkillEnable: (dpId:string, enable: boolean) => void
|
|
17
14
|
}
|
|
18
15
|
|
|
19
16
|
const MoodSetting = (props: MoodSettingProps) =>{
|
|
20
|
-
const {
|
|
17
|
+
const { dpCodes, setSendDps} = props
|
|
21
18
|
const state = useReactive({
|
|
22
|
-
actionScene:
|
|
19
|
+
actionScene: props.actionScene,
|
|
23
20
|
})
|
|
24
21
|
|
|
25
|
-
useEffect(() =>{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}, [])
|
|
22
|
+
// useEffect(() =>{
|
|
23
|
+
// if(scheduleItem){
|
|
24
|
+
// if(scheduleItem.dps[dpCodes.scene_data] !== undefined){
|
|
25
|
+
// state.actionScene = sencePp2Obj(scheduleItem.dps[dpCodes.scene_data])
|
|
26
|
+
// }
|
|
27
|
+
// if (scheduleItem.dps[dpCodes.mix_light_scene] !== undefined) {
|
|
28
|
+
// const sceneDp = scheduleItem.dps[dpCodes.mix_light_scene]
|
|
29
|
+
// state.actionScene = Buffer.from(sceneDp, 'base64').toString('hex')
|
|
30
|
+
// }
|
|
31
|
+
// }
|
|
32
|
+
// }, [])
|
|
36
33
|
|
|
37
34
|
useEffect(() =>{
|
|
38
|
-
|
|
39
|
-
setSendDps('scene',dp)
|
|
35
|
+
setSendDps(state.actionScene, 'actionScene')
|
|
40
36
|
}, [state.actionScene])
|
|
41
37
|
|
|
42
|
-
const getSendDps = () =>{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
38
|
+
// const getSendDps = () =>{
|
|
39
|
+
// if (isMixRGBWLamp(dpCodes)) {
|
|
40
|
+
// return {
|
|
41
|
+
// [dpCodes.mix_light_scene]: Buffer.from(state.actionScene?.value, 'hex').toString('base64'),
|
|
42
|
+
// [dpCodes.switch_led]: true,
|
|
43
|
+
// [dpCodes.work_mode]: SCENE
|
|
44
|
+
// }
|
|
45
|
+
// } else {
|
|
46
|
+
// return {
|
|
47
|
+
// [dpCodes.switch_led]: true,
|
|
48
|
+
// [dpCodes.scene_data]: senceObj2Dp({ id: Number(state?.actionScene?.id), nodes: state?.actionScene?.nodes, fanEnable: state.actionScene.fanEnable, fanSpeed: state.actionScene.fanSpeed }),
|
|
49
|
+
// [dpCodes.work_mode]: SCENE,
|
|
50
|
+
// };
|
|
51
|
+
// }
|
|
52
|
+
// }
|
|
57
53
|
|
|
58
54
|
return (
|
|
59
55
|
// isMixRGBWLamp(dpCodes) ?
|
|
@@ -12,6 +12,7 @@ import { Utils } from 'tuya-panel-kit'
|
|
|
12
12
|
import InfoText from '@ledvance/base/src/components/InfoText'
|
|
13
13
|
import MoodItem from '../mood/MoodItem'
|
|
14
14
|
import { SCENE, useWorkMode } from '../../hooks/DeviceDpStateHooks'
|
|
15
|
+
import { isEmpty } from 'lodash'
|
|
15
16
|
|
|
16
17
|
const cx = Utils.RatioUtils.convertX
|
|
17
18
|
|
|
@@ -40,7 +41,7 @@ const ScheduleScene = ({ scene, setScene, dpCodes }) => {
|
|
|
40
41
|
const res = await getRemoteSceneList(deviceInfo.devId, dpCodes)
|
|
41
42
|
if (res.success) {
|
|
42
43
|
state.scenes = res.data || []
|
|
43
|
-
state.currentScene = scene
|
|
44
|
+
state.currentScene = isEmpty(scene) ? state.scenes[0] : scene
|
|
44
45
|
setScene(state.currentScene)
|
|
45
46
|
}
|
|
46
47
|
}, [])
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ScheduleItemDp } from './TimeScheduleEditpage';
|
|
2
|
-
|
|
2
|
+
import { JudgeTimeScheduleProps } from './TimeScheduleBean';
|
|
3
|
+
interface SingleLightViewProps extends JudgeTimeScheduleProps {
|
|
4
|
+
singleActions: any;
|
|
3
5
|
scheduleItem: any;
|
|
4
6
|
dpCodes: Record<string, string>;
|
|
5
7
|
dp: ScheduleItemDp;
|
|
6
|
-
setSendDps: (
|
|
8
|
+
setSendDps: (actions: any, type: string) => void;
|
|
7
9
|
setEnable: (dpId: string, enable: boolean) => void;
|
|
8
10
|
}
|
|
9
11
|
export default function SingleLightView(props: SingleLightViewProps): any;
|