@ledvance/ui-biz-bundle 1.0.15 → 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/timeSchedule/TimeSchedulePage.d.ts +1 -1
- package/src/modules/timeSchedule/TimeSchedulePage.tsx +1 -1
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
|
|
@@ -7,7 +7,7 @@ export type dpItem = {
|
|
|
7
7
|
export interface TimeSchedulePageRouteParams extends JudgeTimeScheduleProps {
|
|
8
8
|
dps: dpItem[];
|
|
9
9
|
dpCodes: Record<string, string>;
|
|
10
|
-
getDpValue
|
|
10
|
+
getDpValue?: (v: any) => any;
|
|
11
11
|
}
|
|
12
12
|
declare const TimeSchedulePage: () => any;
|
|
13
13
|
export default TimeSchedulePage;
|