@ledvance/group-ui-biz-bundle 1.0.90 → 1.0.92
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/diyScene/DefaultScenes.ts +439 -0
- package/src/modules/diyScene/DiySceneActions.ts +206 -0
- package/src/modules/diyScene/DiySceneEditorPage.tsx +356 -0
- package/src/modules/diyScene/DiyScenePage.tsx +281 -0
- package/src/modules/diyScene/Router.ts +25 -0
- package/src/modules/energyConsumption/EnergyConsumptionActions.ts +134 -119
- package/src/modules/energyConsumption/EnergyConsumptionChart.tsx +30 -9
- package/src/modules/energyConsumption/component/DateSwitch.tsx +111 -0
- package/src/modules/energyConsumption/component/NewBarChart.tsx +16 -3
- package/src/modules/timeSchedule/Interface.ts +19 -10
- package/src/modules/timeSchedule/TimeScheduleActions.ts +7 -1
- package/src/modules/timeSchedule/TimeScheduleDetailPage.tsx +116 -26
- package/src/modules/timeSchedule/TimeSchedulePage.tsx +1 -0
- package/src/modules/timeSchedule/components/ManuaSettings.tsx +35 -3
- package/src/navigation/Routers.ts +3 -1
|
@@ -37,13 +37,16 @@ import DeleteButton from '@ledvance/base/src/components/DeleteButton';
|
|
|
37
37
|
import SegmentControl from '@ledvance/base/src/components/segmentControl';
|
|
38
38
|
import { useParams } from '@ledvance/base/src/hooks/Hooks';
|
|
39
39
|
import ManualSettings from './components/ManuaSettings';
|
|
40
|
-
import { defDeviceData, defMixDeviceData, defStripDeviceData, defFanLightDeviceData } from './TimeScheduleActions';
|
|
40
|
+
import { defDeviceData, defMixDeviceData, defStripDeviceData, defFanLightDeviceData, defMoodStripDeviceData } from './TimeScheduleActions';
|
|
41
41
|
import MoodItem from '../mood_new/MoodItem';
|
|
42
42
|
import Summary from './components/Summary'
|
|
43
43
|
import { getRemoteMoodList } from '../mood_new/MoodActions'
|
|
44
|
-
import { MoodUIInfo } from '../mood_new/Interface';
|
|
44
|
+
import {MoodInfo, MoodUIInfo } from '../mood_new/Interface';
|
|
45
45
|
import InfoText from '@ledvance/base/src/components/InfoText';
|
|
46
46
|
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
47
|
+
import Tag from '@ledvance/base/src/components/Tag';
|
|
48
|
+
import { DiySceneInfo } from '@ledvance/base/src/utils/interface';
|
|
49
|
+
import DiySceneItem from '@ledvance/base/src/components/DiySceneItem';
|
|
47
50
|
|
|
48
51
|
const { convertX: cx } = Utils.RatioUtils;
|
|
49
52
|
const { withTheme } = Utils.ThemeUtils
|
|
@@ -61,6 +64,7 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
61
64
|
const uaGroupInfo = useUAGroupInfo()
|
|
62
65
|
const is24HourClock = useSystemTimeFormate();
|
|
63
66
|
const [moods, setMoods] = useMoods();
|
|
67
|
+
type MoodsType = typeof params.isMoodStrip extends true ? DiySceneInfo[] : MoodUIInfo[]
|
|
64
68
|
const state = useReactive<TimeScheduleDetailState>({
|
|
65
69
|
timeSchedule: params.mode === 'add' ? newTimeSchedule() : cloneDeep(params.timeSchedule),
|
|
66
70
|
dps: params.mode === 'add' ? {} : params.timeSchedule.dps,
|
|
@@ -76,6 +80,10 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
76
80
|
: params.manualDataDp2Obj(params.timeSchedule.dps)?.deviceData,
|
|
77
81
|
mood: params.mode === 'add' ? undefined : params.manualDataDp2Obj(params.timeSchedule.dps)?.mood,
|
|
78
82
|
moods: cloneDeep(moods),
|
|
83
|
+
filterMoods: cloneDeep(moods),
|
|
84
|
+
staticTagChecked: true,
|
|
85
|
+
dynamicTagChecked: true,
|
|
86
|
+
diyTagChecked: true,
|
|
79
87
|
timerId: undefined,
|
|
80
88
|
moodName: '',
|
|
81
89
|
});
|
|
@@ -145,15 +153,37 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
145
153
|
useEffect(() => {
|
|
146
154
|
if (state.moods?.length) {
|
|
147
155
|
state.moodName =
|
|
148
|
-
state.moods.find(m =>
|
|
156
|
+
(state.moods as MoodsType).find(m =>
|
|
149
157
|
params.isCeilingLight
|
|
150
|
-
? m.mainLamp.id === state.mood?.mainLamp.id &&
|
|
151
|
-
m.secondaryLamp.id === state.mood?.secondaryLamp.id
|
|
158
|
+
? m.mainLamp.id === (state.mood as MoodInfo)?.mainLamp.id &&
|
|
159
|
+
m.secondaryLamp.id === (state.mood as MoodInfo)?.secondaryLamp.id
|
|
152
160
|
: m.id === state.mood?.id
|
|
153
161
|
)?.name || '';
|
|
154
162
|
}
|
|
155
163
|
}, [state.mood, state.moods]);
|
|
156
164
|
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
if (params.isMoodStrip) {
|
|
167
|
+
state.filterMoods = (state.moods as DiySceneInfo[]).filter(item => {
|
|
168
|
+
return [state.staticTagChecked, state.dynamicTagChecked, state.diyTagChecked].every(it => !it)
|
|
169
|
+
|| (state.staticTagChecked && item.type === 'Static')
|
|
170
|
+
|| (state.dynamicTagChecked && item.type === 'Dynamic')
|
|
171
|
+
|| (state.diyTagChecked && item.type === 'DIY')
|
|
172
|
+
})
|
|
173
|
+
} else {
|
|
174
|
+
state.filterMoods = (state.moods as MoodsType).filter(item => {
|
|
175
|
+
return (
|
|
176
|
+
(state.staticTagChecked && state.dynamicTagChecked) ||
|
|
177
|
+
(!state.staticTagChecked && !state.dynamicTagChecked) ||
|
|
178
|
+
(state.staticTagChecked && item.mainLamp.nodes.length < 2) ||
|
|
179
|
+
(state.dynamicTagChecked &&
|
|
180
|
+
(item.secondaryLamp.nodes.length > 1 || item.mainLamp.nodes.length > 1))
|
|
181
|
+
);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
}, [state.staticTagChecked, state.dynamicTagChecked, state.diyTagChecked, state.moods]);
|
|
186
|
+
|
|
157
187
|
const getFormateTime = useCallback((time: number | string) => {
|
|
158
188
|
if (typeof time === 'number') {
|
|
159
189
|
return `${toFixedString(Math.trunc(time / 60), 2)}:${toFixedString(time % 60, 2)}`;
|
|
@@ -211,7 +241,7 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
211
241
|
}, [params.applyForList.length, params.applyForDisabled]);
|
|
212
242
|
|
|
213
243
|
const getMoodItemEnable = useCallback((item: MoodUIInfo ) =>{
|
|
214
|
-
return params.isCeilingLight ? ((item.mainLamp.id === state.mood?.mainLamp?.id) && (item.secondaryLamp.id === state.mood?.secondaryLamp?.id)) : item.id === state.mood?.id
|
|
244
|
+
return params.isCeilingLight ? ((item.mainLamp.id === (state.mood as MoodInfo)?.mainLamp?.id) && (item.secondaryLamp.id === (state.mood as MoodInfo)?.secondaryLamp?.id)) : item.id === state.mood?.id
|
|
215
245
|
}, [state.mood, params.isCeilingLight])
|
|
216
246
|
|
|
217
247
|
const styles = StyleSheet.create({
|
|
@@ -264,6 +294,10 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
264
294
|
color: props.theme?.global.fontColor,
|
|
265
295
|
fontSize: cx(14)
|
|
266
296
|
},
|
|
297
|
+
tagLine: {
|
|
298
|
+
flexDirection: 'row',
|
|
299
|
+
marginHorizontal: cx(24),
|
|
300
|
+
}
|
|
267
301
|
})
|
|
268
302
|
|
|
269
303
|
return (
|
|
@@ -429,7 +463,7 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
429
463
|
{showMoodFanSelectText && <InfoText
|
|
430
464
|
style={{marginHorizontal: cx(24)}}
|
|
431
465
|
icon={res.ic_warning_amber}
|
|
432
|
-
contentColor={props.theme?.global.
|
|
466
|
+
contentColor={props.theme?.global.warning}
|
|
433
467
|
text={I18n.getLang('timeschedule_add_schedule_devicestate_sec_warning_text')}
|
|
434
468
|
/>}
|
|
435
469
|
{state.isManual ? (
|
|
@@ -454,25 +488,77 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
454
488
|
}}
|
|
455
489
|
/>
|
|
456
490
|
) : (
|
|
457
|
-
!showMoodFanSelectText ?
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
491
|
+
!showMoodFanSelectText ? (
|
|
492
|
+
<View>
|
|
493
|
+
{!(params.isStringLight || params.isStripLight) && <View style={styles.tagLine}>
|
|
494
|
+
<Tag
|
|
495
|
+
checked={state.staticTagChecked}
|
|
496
|
+
text={I18n.getLang('mood_overview_filter_name_text1')}
|
|
497
|
+
onCheckedChange={checked => {
|
|
498
|
+
state.staticTagChecked = checked;
|
|
499
|
+
}}
|
|
500
|
+
/>
|
|
501
|
+
<Spacer width={cx(8)} height={0} />
|
|
502
|
+
<Tag
|
|
503
|
+
checked={state.dynamicTagChecked}
|
|
504
|
+
text={I18n.getLang('mood_overview_filter_name_text2')}
|
|
505
|
+
onCheckedChange={checked => {
|
|
506
|
+
state.dynamicTagChecked = checked;
|
|
507
|
+
}}
|
|
508
|
+
/>
|
|
509
|
+
{
|
|
510
|
+
params.isMoodStrip && <>
|
|
511
|
+
<Spacer width={cx(8)} height={0}/>
|
|
512
|
+
<Tag
|
|
513
|
+
checked={state.diyTagChecked}
|
|
514
|
+
text={I18n.getLang('mood_overview_field_chip_diy')}
|
|
515
|
+
onCheckedChange={checked => {
|
|
516
|
+
state.diyTagChecked = checked;
|
|
517
|
+
}}
|
|
518
|
+
/>
|
|
519
|
+
</>
|
|
520
|
+
}
|
|
521
|
+
</View>}
|
|
522
|
+
{params.isMoodStrip ? <FlatList
|
|
523
|
+
data={state.filterMoods as DiySceneInfo[]}
|
|
524
|
+
renderItem={({item}) => {
|
|
525
|
+
return (
|
|
526
|
+
<DiySceneItem
|
|
527
|
+
enable={item.id === state.mood?.id}
|
|
528
|
+
scene={item}
|
|
529
|
+
onSwitch={_ => {
|
|
530
|
+
state.mood = cloneDeep(item);
|
|
531
|
+
}}
|
|
532
|
+
/>
|
|
533
|
+
);
|
|
467
534
|
}}
|
|
535
|
+
ListHeaderComponent={() => <Spacer height={cx(10)}/>}
|
|
536
|
+
ItemSeparatorComponent={() => <Spacer/>}
|
|
537
|
+
ListFooterComponent={() => <Spacer/>}
|
|
538
|
+
keyExtractor={item => `${item.name}`}
|
|
539
|
+
/> :
|
|
540
|
+
<FlatList
|
|
541
|
+
data={state.filterMoods as MoodUIInfo[]}
|
|
542
|
+
renderItem={({ item }) => {
|
|
543
|
+
return (
|
|
544
|
+
<MoodItem
|
|
545
|
+
enable={getMoodItemEnable(item)}
|
|
546
|
+
mood={item}
|
|
547
|
+
isMix={!!(params.isMixLight || params.isCeilingLight)}
|
|
548
|
+
onSwitch={_ => {
|
|
549
|
+
state.mood = cloneDeep(item);
|
|
550
|
+
}}
|
|
551
|
+
/>
|
|
552
|
+
);
|
|
553
|
+
}}
|
|
554
|
+
ListHeaderComponent={() => <Spacer height={cx(10)} />}
|
|
555
|
+
ItemSeparatorComponent={() => <Spacer />}
|
|
556
|
+
ListFooterComponent={() => <Spacer />}
|
|
557
|
+
keyExtractor={item => `${item.name}`}
|
|
468
558
|
/>
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
ItemSeparatorComponent={() => <Spacer />}
|
|
473
|
-
ListFooterComponent={() => <Spacer />}
|
|
474
|
-
keyExtractor={item => `${item.name}`}
|
|
475
|
-
/> : <View></View>
|
|
559
|
+
}
|
|
560
|
+
</View>
|
|
561
|
+
) : <View></View>
|
|
476
562
|
)}
|
|
477
563
|
<Spacer />
|
|
478
564
|
|
|
@@ -614,7 +700,9 @@ const getDefaultManual = (props: TimeScheduleDetailPageParams): ComponentConfig
|
|
|
614
700
|
DeviceType.FanLight
|
|
615
701
|
: props.isCeilingLight
|
|
616
702
|
? DeviceType.CeilingLight
|
|
617
|
-
:
|
|
703
|
+
: props.isMoodStrip
|
|
704
|
+
? DeviceType.MoodStrip
|
|
705
|
+
: DeviceType.LightSource
|
|
618
706
|
const deviceData =
|
|
619
707
|
(deviceType === DeviceType.StripLight || deviceType === DeviceType.CeilingLight)
|
|
620
708
|
? defStripDeviceData
|
|
@@ -622,7 +710,9 @@ const getDefaultManual = (props: TimeScheduleDetailPageParams): ComponentConfig
|
|
|
622
710
|
? defMixDeviceData
|
|
623
711
|
: deviceType === DeviceType.FanLight
|
|
624
712
|
? defFanLightDeviceData
|
|
625
|
-
:
|
|
713
|
+
: deviceType === DeviceType.MoodStrip
|
|
714
|
+
? defMoodStripDeviceData
|
|
715
|
+
: defDeviceData;
|
|
626
716
|
// @ts-ignore
|
|
627
717
|
return {
|
|
628
718
|
type: deviceType,
|
|
@@ -38,6 +38,7 @@ export interface TimeSchedulePageParams {
|
|
|
38
38
|
isMixLight?: boolean;
|
|
39
39
|
isFanLight?: boolean
|
|
40
40
|
isUVCFan?: boolean;
|
|
41
|
+
isMoodStrip?: boolean
|
|
41
42
|
applyForList: ApplyForItem[];
|
|
42
43
|
applyForDisabled?: boolean; // 是否可以选择apply for
|
|
43
44
|
manualDataDp2Obj: (dps: Record<string, any>) => DeviceStateType;
|
|
@@ -15,6 +15,9 @@ import { useGroupDevices } from '@ledvance/base/src/models/modules/NativePropsSl
|
|
|
15
15
|
import ApplyForDeviceList from '@ledvance/base/src/components/ApplyForDeviceList';
|
|
16
16
|
import { cloneDeep } from 'lodash';
|
|
17
17
|
import { FanAdjustViewContent } from '@ledvance/base/src/components/FanAdjustView';
|
|
18
|
+
import { cctToColor } from '@ledvance/base/src/utils/cctUtils';
|
|
19
|
+
import {hsv2Hex, mapFloatToRange } from '@ledvance/base/src/utils';
|
|
20
|
+
import { AdjustType } from '@ledvance/base/src/utils/interface';
|
|
18
21
|
const { convertX: cx } = Utils.RatioUtils;
|
|
19
22
|
const { withTheme } = Utils.ThemeUtils
|
|
20
23
|
|
|
@@ -66,6 +69,14 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
66
69
|
|
|
67
70
|
const lightSourceCard = useMemo(() => {
|
|
68
71
|
const { deviceData } = state;
|
|
72
|
+
const getBlockColor = () => {
|
|
73
|
+
if (!deviceData.isColorMode) return cctToColor(deviceData.temperature)
|
|
74
|
+
if (deviceData.isColorMode) {
|
|
75
|
+
const s = Math.round(mapFloatToRange(deviceData.s / 100, 30, 100))
|
|
76
|
+
return hsv2Hex(deviceData.h, s, 100)
|
|
77
|
+
}
|
|
78
|
+
return props.theme?.card?.background
|
|
79
|
+
};
|
|
69
80
|
return (
|
|
70
81
|
<View>
|
|
71
82
|
{state.applyForList.map((item, idx) => (
|
|
@@ -73,7 +84,7 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
73
84
|
<Card style={{ marginHorizontal: cx(24) }}>
|
|
74
85
|
<LdvSwitch
|
|
75
86
|
title={item.name || item.key}
|
|
76
|
-
color={
|
|
87
|
+
color={getBlockColor()}
|
|
77
88
|
colorAlpha={1}
|
|
78
89
|
enable={item.enable}
|
|
79
90
|
setEnable={(enable: boolean) => {
|
|
@@ -99,6 +110,7 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
99
110
|
state.deviceData = {
|
|
100
111
|
...state.deviceData,
|
|
101
112
|
isColorMode: mode,
|
|
113
|
+
adjustType: mode ? AdjustType.COLOUR : AdjustType.WHITE
|
|
102
114
|
};
|
|
103
115
|
state.manualFlag = Symbol()
|
|
104
116
|
}}
|
|
@@ -195,6 +207,15 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
195
207
|
}, [state.deviceData, state.applyForList, props.theme?.card.background]);
|
|
196
208
|
|
|
197
209
|
const mixLightCard = useMemo(() => {
|
|
210
|
+
const {deviceData} = state;
|
|
211
|
+
const getBlockColor = ((type: string) => {
|
|
212
|
+
if (type === 'mainLight') return cctToColor(deviceData.temperature);
|
|
213
|
+
if (type === 'secondaryLight') {
|
|
214
|
+
const s = Math.round(mapFloatToRange(deviceData.s / 100, 30, 100));
|
|
215
|
+
return hsv2Hex(deviceData.h, s, 100);
|
|
216
|
+
}
|
|
217
|
+
return props.theme?.card?.background;
|
|
218
|
+
});
|
|
198
219
|
return (
|
|
199
220
|
<View>
|
|
200
221
|
{state.applyForList.map((item, idx) => (
|
|
@@ -202,7 +223,7 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
202
223
|
<Card style={{ marginHorizontal: cx(24) }}>
|
|
203
224
|
<LdvSwitch
|
|
204
225
|
title={item.key}
|
|
205
|
-
color={
|
|
226
|
+
color={getBlockColor(item.type)}
|
|
206
227
|
colorAlpha={1}
|
|
207
228
|
enable={item.enable}
|
|
208
229
|
setEnable={(enable: boolean) => {
|
|
@@ -331,6 +352,17 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
331
352
|
|
|
332
353
|
const ceilingLightCard = useMemo(() => {
|
|
333
354
|
const deviceData = state.deviceData as CeilingLightData
|
|
355
|
+
const getBlockColor = (type: string) => {
|
|
356
|
+
if (type === 'mainLight') {
|
|
357
|
+
return cctToColor(deviceData.temperature);
|
|
358
|
+
}
|
|
359
|
+
// deviceData.activeKey === 3为combination
|
|
360
|
+
if (type === 'secondaryLight' && deviceData.activeKey !== 3) {
|
|
361
|
+
const s = Math.round(mapFloatToRange(deviceData.s / 100, 30, 100));
|
|
362
|
+
return hsv2Hex(deviceData.h, s, 100);
|
|
363
|
+
}
|
|
364
|
+
return props.theme?.card.background;
|
|
365
|
+
}
|
|
334
366
|
return (
|
|
335
367
|
<View>
|
|
336
368
|
{state.applyForList.map((item, idx) => (
|
|
@@ -338,7 +370,7 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
338
370
|
<Card style={{ marginHorizontal: cx(24) }}>
|
|
339
371
|
<LdvSwitch
|
|
340
372
|
title={item.key}
|
|
341
|
-
color={
|
|
373
|
+
color={getBlockColor(item.type)}
|
|
342
374
|
colorAlpha={1}
|
|
343
375
|
enable={item.enable}
|
|
344
376
|
setEnable={(enable: boolean) => {
|
|
@@ -32,5 +32,7 @@ export const ui_biz_routerKey = {
|
|
|
32
32
|
'group_ui_biz_switch_inching': 'group_ui_biz_switch_inching',
|
|
33
33
|
'group_ui_biz_energy_consumption': 'group_ui_biz_energy_consumption',
|
|
34
34
|
'group_ui_biz_energy_consumption_detail': 'group_ui_biz_energy_consumption_detail',
|
|
35
|
-
'group_ui_biz_energy_consumption_chart': 'group_ui_biz_energy_consumption_chart'
|
|
35
|
+
'group_ui_biz_energy_consumption_chart': 'group_ui_biz_energy_consumption_chart',
|
|
36
|
+
'group_ui_biz_diy_scene_page': 'group_ui_biz_diy_scene_page',
|
|
37
|
+
'group_ui_biz_diy_scene_edit_page': 'group_ui_biz_diy_scene_edit_page'
|
|
36
38
|
}
|