@ledvance/group-ui-biz-bundle 1.0.118 → 1.0.119
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/timeSchedule/Interface.ts +7 -2
- package/src/modules/timeSchedule/TimeScheduleActions.ts +4 -0
- package/src/modules/timeSchedule/TimeScheduleDetailPage.tsx +121 -139
- package/src/modules/timeSchedule/TimeSchedulePage.tsx +2 -1
- package/src/modules/timeSchedule/components/ManuaSettings.tsx +30 -1
package/package.json
CHANGED
|
@@ -90,7 +90,7 @@ export interface ManualSettingProps extends judgmentSupport {
|
|
|
90
90
|
applyForList: ApplyForItem[];
|
|
91
91
|
dps: Record<string, any>;
|
|
92
92
|
manualData: ComponentConfig;
|
|
93
|
-
onManualChange?: (manualData: DeviceData | MixLightData | StripLightData) => void
|
|
93
|
+
onManualChange?: (manualData: DeviceData | MixLightData | StripLightData | ShutterData) => void
|
|
94
94
|
onApplyChange?: (applyForList: ApplyForItem[]) => void
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -101,6 +101,7 @@ export enum DeviceType {
|
|
|
101
101
|
CeilingLight = 'ceilingLight',
|
|
102
102
|
FanLight = 'fanLight',
|
|
103
103
|
MoodStrip = 'moodStrip',
|
|
104
|
+
Shutter = 'shutter',
|
|
104
105
|
}
|
|
105
106
|
// export type DeviceType = 'LightSource' | 'CeilingLight' | 'StringLight' | 'StripLight' | 'MixLight';
|
|
106
107
|
|
|
@@ -139,6 +140,10 @@ export interface MoodStripData extends DeviceData {
|
|
|
139
140
|
adjustType: AdjustType
|
|
140
141
|
}
|
|
141
142
|
|
|
143
|
+
export interface ShutterData extends DeviceData {
|
|
144
|
+
percentControl: number
|
|
145
|
+
}
|
|
146
|
+
|
|
142
147
|
export type ComponentConfig =
|
|
143
148
|
| { type: DeviceType.LightSource; deviceData: DeviceData }
|
|
144
149
|
| { type: DeviceType.MixLight; deviceData: MixLightData }
|
|
@@ -146,7 +151,7 @@ export type ComponentConfig =
|
|
|
146
151
|
| { type: DeviceType.CeilingLight; deviceData: CeilingLightData }
|
|
147
152
|
| { type: DeviceType.FanLight; deviceData: FanLightData }
|
|
148
153
|
| { type: DeviceType.MoodStrip; deviceData: MoodStripData}
|
|
149
|
-
|
|
154
|
+
| { type: DeviceType.Shutter; deviceData: ShutterData}
|
|
150
155
|
export interface TimeScheduleDetailState {
|
|
151
156
|
timeSchedule: Timer;
|
|
152
157
|
dps: Record<string, any>;
|
|
@@ -45,6 +45,10 @@ export const defMoodStripDeviceData = {
|
|
|
45
45
|
adjustType: AdjustType.COLOUR
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
export const defShutterDeviceData = {
|
|
49
|
+
percentControl: 100
|
|
50
|
+
};
|
|
51
|
+
|
|
48
52
|
export const addTimeSchedule = async (props: IAddSingleTime) => {
|
|
49
53
|
try {
|
|
50
54
|
const res = await commonApi.timerApi.addSingleTimer({
|
|
@@ -37,11 +37,11 @@ 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, defMoodStripDeviceData } from './TimeScheduleActions';
|
|
40
|
+
import { defDeviceData, defMixDeviceData, defStripDeviceData, defFanLightDeviceData, defMoodStripDeviceData, defShutterDeviceData } 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 {MoodInfo, 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
47
|
import Tag from '@ledvance/base/src/components/Tag';
|
|
@@ -222,7 +222,7 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
222
222
|
return isEqual(before, now);
|
|
223
223
|
}, [JSON.stringify(state.timeSchedule), JSON.stringify(state.initSelectedSkill), JSON.stringify(state.selectedSkill), state.manualData, state.isManual, state.mood]);
|
|
224
224
|
|
|
225
|
-
const showMoodFanSelectText = useMemo(() =>{
|
|
225
|
+
const showMoodFanSelectText = useMemo(() => {
|
|
226
226
|
return (params.isUVCFan || params.isFanLight) && !state.isManual && state.selectedSkill.length < 2
|
|
227
227
|
}, [params.isUVCFan, params.isFanLight, state.selectedSkill.length, state.isManual])
|
|
228
228
|
|
|
@@ -240,10 +240,35 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
240
240
|
return params.applyForList.length !== 1 && !params.applyForDisabled;
|
|
241
241
|
}, [params.applyForList.length, params.applyForDisabled]);
|
|
242
242
|
|
|
243
|
-
const getMoodItemEnable = useCallback((item: MoodUIInfo
|
|
243
|
+
const getMoodItemEnable = useCallback((item: MoodUIInfo) => {
|
|
244
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
|
|
245
245
|
}, [state.mood, params.isCeilingLight])
|
|
246
246
|
|
|
247
|
+
const renderSkillGroup = (skills: ApplyForItem[], i18nString: string) => {
|
|
248
|
+
if (!skills.length) return null;
|
|
249
|
+
|
|
250
|
+
return (
|
|
251
|
+
<>
|
|
252
|
+
<Text style={{ fontSize: cx(14), color: props.theme?.global.fontColor }}>
|
|
253
|
+
{i18nString}
|
|
254
|
+
</Text>
|
|
255
|
+
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
|
|
256
|
+
{skills.map(item => (
|
|
257
|
+
<View
|
|
258
|
+
style={[
|
|
259
|
+
styles.summaryRight,
|
|
260
|
+
{ marginRight: cx(5), marginBottom: cx(5) },
|
|
261
|
+
]}
|
|
262
|
+
key={item.dp}
|
|
263
|
+
>
|
|
264
|
+
<Text style={styles.rightItem}>{item.key}</Text>
|
|
265
|
+
</View>
|
|
266
|
+
))}
|
|
267
|
+
</View>
|
|
268
|
+
</>
|
|
269
|
+
);
|
|
270
|
+
};
|
|
271
|
+
|
|
247
272
|
const styles = StyleSheet.create({
|
|
248
273
|
cardContainer: {
|
|
249
274
|
marginHorizontal: cx(24),
|
|
@@ -387,9 +412,9 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
387
412
|
{I18n.getLang('timeschedule_add_schedule_subheadline_text')}
|
|
388
413
|
</Text>
|
|
389
414
|
<Spacer height={cx(10)} />
|
|
390
|
-
<View style={[styles.applyContent, {paddingTop: state.selectedSkill.length ? cx(10) : 0}]}>
|
|
415
|
+
<View style={[styles.applyContent, { paddingTop: state.selectedSkill.length ? cx(10) : 0 }]}>
|
|
391
416
|
{state.selectedSkill.length === 0 ? (
|
|
392
|
-
<Text style={{color: props.theme?.global.fontColor}}>
|
|
417
|
+
<Text style={{ color: props.theme?.global.fontColor }}>
|
|
393
418
|
{I18n.getLang('timer_ceiling_fan_selectionfield_no_components_text')}
|
|
394
419
|
</Text>
|
|
395
420
|
) : (
|
|
@@ -409,7 +434,7 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
409
434
|
>
|
|
410
435
|
<Image
|
|
411
436
|
style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.fontColor }}
|
|
412
|
-
source={{ uri: res.ic_arrows_nav_clear}}
|
|
437
|
+
source={{ uri: res.ic_arrows_nav_clear }}
|
|
413
438
|
/>
|
|
414
439
|
</TouchableOpacity>
|
|
415
440
|
)}
|
|
@@ -430,7 +455,7 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
430
455
|
<Text style={{ color: props.theme?.global.fontColor }}>{item.key}</Text>
|
|
431
456
|
<Image
|
|
432
457
|
style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.fontColor }}
|
|
433
|
-
source={{ uri: res.device_panel_timer_add}}
|
|
458
|
+
source={{ uri: res.device_panel_timer_add }}
|
|
434
459
|
/>
|
|
435
460
|
</TouchableOpacity>
|
|
436
461
|
);
|
|
@@ -456,16 +481,16 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
456
481
|
)}
|
|
457
482
|
<Spacer height={cx(10)} />
|
|
458
483
|
{(!state.selectedSkill.length && !showMoodFanSelectText) && <InfoText
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
484
|
+
style={{ marginHorizontal: cx(24) }}
|
|
485
|
+
icon={res.ic_warning_amber}
|
|
486
|
+
contentColor={props.theme?.global.warning}
|
|
487
|
+
text={I18n.getLang('timeschedule_add_schedule_no_device_warning_text')}
|
|
463
488
|
/>}
|
|
464
489
|
{showMoodFanSelectText && <InfoText
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
490
|
+
style={{ marginHorizontal: cx(24) }}
|
|
491
|
+
icon={res.ic_warning_amber}
|
|
492
|
+
contentColor={props.theme?.global.warning}
|
|
493
|
+
text={I18n.getLang('timeschedule_add_schedule_devicestate_sec_warning_text')}
|
|
469
494
|
/>}
|
|
470
495
|
{state.isManual ? (
|
|
471
496
|
<ManualSettings
|
|
@@ -492,52 +517,52 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
492
517
|
!showMoodFanSelectText ? (
|
|
493
518
|
<View>
|
|
494
519
|
{!(params.isStringLight || params.isStripLight) && <View style={styles.tagLine}>
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
520
|
+
<Tag
|
|
521
|
+
checked={state.staticTagChecked}
|
|
522
|
+
text={I18n.getLang('mood_overview_filter_name_text1')}
|
|
523
|
+
onCheckedChange={checked => {
|
|
524
|
+
state.staticTagChecked = checked;
|
|
525
|
+
}}
|
|
526
|
+
/>
|
|
527
|
+
<Spacer width={cx(8)} height={0} />
|
|
528
|
+
<Tag
|
|
529
|
+
checked={state.dynamicTagChecked}
|
|
530
|
+
text={I18n.getLang('mood_overview_filter_name_text2')}
|
|
531
|
+
onCheckedChange={checked => {
|
|
532
|
+
state.dynamicTagChecked = checked;
|
|
533
|
+
}}
|
|
534
|
+
/>
|
|
510
535
|
{
|
|
511
536
|
params.isMoodStrip && <>
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
537
|
+
<Spacer width={cx(8)} height={0} />
|
|
538
|
+
<Tag
|
|
539
|
+
checked={state.diyTagChecked}
|
|
540
|
+
text={I18n.getLang('mood_overview_field_chip_diy')}
|
|
541
|
+
onCheckedChange={checked => {
|
|
542
|
+
state.diyTagChecked = checked;
|
|
543
|
+
}}
|
|
544
|
+
/>
|
|
545
|
+
</>
|
|
521
546
|
}
|
|
522
547
|
</View>}
|
|
523
548
|
{params.isMoodStrip ? <FlatList
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
549
|
+
data={state.filterMoods as DiySceneInfo[]}
|
|
550
|
+
renderItem={({ item }) => {
|
|
551
|
+
return (
|
|
552
|
+
<DiySceneItem
|
|
553
|
+
enable={item.id === state.mood?.id}
|
|
554
|
+
scene={item}
|
|
555
|
+
onSwitch={_ => {
|
|
556
|
+
state.mood = cloneDeep(item);
|
|
557
|
+
}}
|
|
558
|
+
/>
|
|
559
|
+
);
|
|
560
|
+
}}
|
|
561
|
+
ListHeaderComponent={() => <Spacer height={cx(10)} />}
|
|
562
|
+
ItemSeparatorComponent={() => <Spacer />}
|
|
563
|
+
ListFooterComponent={() => <Spacer />}
|
|
564
|
+
keyExtractor={item => `${item.name}`}
|
|
565
|
+
/> :
|
|
541
566
|
<FlatList
|
|
542
567
|
data={state.filterMoods as MoodUIInfo[]}
|
|
543
568
|
renderItem={({ item }) => {
|
|
@@ -586,62 +611,20 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
586
611
|
: convertTo12HourFormat(state.timeSchedule.time)}
|
|
587
612
|
actions={<View style={{ flex: 1 }}>
|
|
588
613
|
{state.isManual
|
|
589
|
-
?
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
|
|
597
|
-
{state.selectedSkill
|
|
598
|
-
.filter(skill => skill.enable)
|
|
599
|
-
.map(item => (
|
|
600
|
-
<View
|
|
601
|
-
style={[
|
|
602
|
-
styles.summaryRight,
|
|
603
|
-
{ marginRight: cx(5), marginBottom: cx(5) },
|
|
604
|
-
]}
|
|
605
|
-
key={item.dp}
|
|
606
|
-
>
|
|
607
|
-
<Text style={[styles.rightItem]}>{item.key}</Text>
|
|
608
|
-
</View>
|
|
609
|
-
))}
|
|
610
|
-
</View>
|
|
611
|
-
</>
|
|
612
|
-
)}
|
|
613
|
-
|
|
614
|
-
{!!state.selectedSkill.filter(skill => !skill.enable).length && (
|
|
615
|
-
<>
|
|
616
|
-
<Text style={{ fontSize: cx(14), color: props.theme?.global.fontColor }}>
|
|
617
|
-
{I18n.getLang('feature_summary_action_txt_2')}
|
|
618
|
-
</Text>
|
|
619
|
-
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
|
|
620
|
-
{state.selectedSkill
|
|
621
|
-
.filter(skill => !skill.enable)
|
|
622
|
-
.map((item) => (
|
|
623
|
-
<View
|
|
624
|
-
style={[
|
|
625
|
-
styles.summaryRight,
|
|
626
|
-
{ marginRight: cx(5), marginBottom: cx(5) },
|
|
627
|
-
]}
|
|
628
|
-
key={item.dp}
|
|
629
|
-
>
|
|
630
|
-
<Text style={[styles.rightItem]}>{item.key}</Text>
|
|
631
|
-
</View>
|
|
632
|
-
))}
|
|
633
|
-
</View>
|
|
634
|
-
</>
|
|
635
|
-
)}
|
|
636
|
-
</>
|
|
637
|
-
)
|
|
614
|
+
? (state.selectedSkill.length ? (
|
|
615
|
+
<>
|
|
616
|
+
{renderSkillGroup(state.selectedSkill.filter(skill => skill.enable), I18n.getLang(params.isShutter ? 'curtain_summary_action_txt_1' : 'feature_summary_action_txt_1'))}
|
|
617
|
+
{renderSkillGroup(state.selectedSkill.filter(skill => !skill.enable), I18n.getLang(params.isShutter ? 'curtain_summary_action_txt_2' : 'feature_summary_action_txt_2'))}
|
|
618
|
+
</>
|
|
619
|
+
) : null
|
|
620
|
+
)
|
|
638
621
|
: !!state.moodName && (
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
622
|
+
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
|
|
623
|
+
<View style={[styles.summaryRight, { marginLeft: cx(5) }]}>
|
|
624
|
+
<Text style={styles.rightItem}>{state.moodName}</Text>
|
|
625
|
+
</View>
|
|
642
626
|
</View>
|
|
643
|
-
|
|
644
|
-
)}
|
|
627
|
+
)}
|
|
645
628
|
</View>}
|
|
646
629
|
/>
|
|
647
630
|
<Spacer height={cx(30)} />
|
|
@@ -659,7 +642,7 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
659
642
|
onConfirm: async (_, { close }) => {
|
|
660
643
|
state.loading = true;
|
|
661
644
|
close();
|
|
662
|
-
const res = await params.modDeleteTimeSchedule('del', {...state.timeSchedule, status: 2}, state.timeSchedule.id.toString());
|
|
645
|
+
const res = await params.modDeleteTimeSchedule('del', { ...state.timeSchedule, status: 2 }, state.timeSchedule.id.toString());
|
|
663
646
|
state.loading = false;
|
|
664
647
|
if (res.success) {
|
|
665
648
|
params.refreshFn()
|
|
@@ -690,38 +673,37 @@ const newTimeSchedule = () => {
|
|
|
690
673
|
};
|
|
691
674
|
|
|
692
675
|
const getDefaultManual = (props: TimeScheduleDetailPageParams): ComponentConfig => {
|
|
693
|
-
const
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
: defDeviceData;
|
|
676
|
+
const deviceTypeMap: Record<string, DeviceType> = {
|
|
677
|
+
isStripLight: DeviceType.StripLight,
|
|
678
|
+
isMixLight: DeviceType.MixLight,
|
|
679
|
+
isFanLight: DeviceType.FanLight,
|
|
680
|
+
isCeilingLight: DeviceType.CeilingLight,
|
|
681
|
+
isMoodStrip: DeviceType.MoodStrip,
|
|
682
|
+
isShutter: DeviceType.Shutter
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
const deviceType = Object.entries(deviceTypeMap)
|
|
686
|
+
.find(([key]) => props[key as keyof TimeScheduleDetailPageParams])
|
|
687
|
+
?.[1] || DeviceType.LightSource;
|
|
688
|
+
|
|
689
|
+
const deviceDataMap: Record<DeviceType, any> = {
|
|
690
|
+
[DeviceType.StripLight]: defStripDeviceData,
|
|
691
|
+
[DeviceType.CeilingLight]: defStripDeviceData,
|
|
692
|
+
[DeviceType.MixLight]: defMixDeviceData,
|
|
693
|
+
[DeviceType.FanLight]: defFanLightDeviceData,
|
|
694
|
+
[DeviceType.MoodStrip]: defMoodStripDeviceData,
|
|
695
|
+
[DeviceType.Shutter]: defShutterDeviceData,
|
|
696
|
+
[DeviceType.LightSource]: defDeviceData,
|
|
697
|
+
};
|
|
698
|
+
|
|
717
699
|
// @ts-ignore
|
|
718
700
|
return {
|
|
719
701
|
type: deviceType,
|
|
720
702
|
deviceData: {
|
|
721
|
-
...
|
|
722
|
-
isColorMode: props.isSupportColor
|
|
703
|
+
...deviceDataMap[deviceType],
|
|
704
|
+
isColorMode: props.isSupportColor,
|
|
723
705
|
},
|
|
724
706
|
};
|
|
725
707
|
};
|
|
726
708
|
|
|
727
|
-
export default withTheme(TimeScheduleDetailPage)
|
|
709
|
+
export default withTheme(TimeScheduleDetailPage) as React.ComponentType<TimeScheduleDetailPageParams>
|
|
@@ -36,6 +36,7 @@ export interface TimeSchedulePageParams {
|
|
|
36
36
|
isFanLight?: boolean
|
|
37
37
|
isUVCFan?: boolean;
|
|
38
38
|
isMoodStrip?: boolean
|
|
39
|
+
isShutter?: boolean
|
|
39
40
|
applyForList: ApplyForItem[];
|
|
40
41
|
applyForDisabled?: boolean; // 是否可以选择apply for
|
|
41
42
|
manualDataDp2Obj: (dps: Record<string, any>) => DeviceStateType;
|
|
@@ -233,4 +234,4 @@ const TimeSchedulePage = (props: { theme?: ThemeType }) => {
|
|
|
233
234
|
);
|
|
234
235
|
};
|
|
235
236
|
|
|
236
|
-
export default withTheme(TimeSchedulePage)
|
|
237
|
+
export default withTheme(TimeSchedulePage) as React.ComponentType<TimeSchedulePageParams>
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
StripLightData,
|
|
8
8
|
directOptions,
|
|
9
9
|
modeOptions,
|
|
10
|
+
ShutterData,
|
|
10
11
|
} from '../Interface';
|
|
11
12
|
import { View } from 'react-native';
|
|
12
13
|
import Card from '@ledvance/base/src/components/Card';
|
|
@@ -26,6 +27,7 @@ import { FanAdjustViewContent } from '@ledvance/base/src/components/FanAdjustVie
|
|
|
26
27
|
import { cctToColor } from '@ledvance/base/src/utils/cctUtils';
|
|
27
28
|
import {hsv2Hex, mapFloatToRange } from '@ledvance/base/src/utils';
|
|
28
29
|
import { AdjustType, ApplyForItem } from '@ledvance/base/src/utils/interface';
|
|
30
|
+
import LdvSlider from '@ledvance/base/src/components/ldvSlider';
|
|
29
31
|
const { convertX: cx } = Utils.RatioUtils;
|
|
30
32
|
const { withTheme } = Utils.ThemeUtils
|
|
31
33
|
|
|
@@ -476,6 +478,31 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
476
478
|
)
|
|
477
479
|
}, [state.deviceData, state.applyForList, props.theme?.card.background])
|
|
478
480
|
|
|
481
|
+
const shutterCard = useMemo(() => {
|
|
482
|
+
return (
|
|
483
|
+
<Card style={{ marginHorizontal: cx(24) }}>
|
|
484
|
+
<Spacer height={cx(16)} />
|
|
485
|
+
<LdvSlider
|
|
486
|
+
title={'Curtain'}
|
|
487
|
+
value={(state.deviceData as ShutterData).percentControl}
|
|
488
|
+
min={0}
|
|
489
|
+
max={100}
|
|
490
|
+
onSlidingComplete={async (value) => {
|
|
491
|
+
(state.deviceData as ShutterData).percentControl = value
|
|
492
|
+
state.applyForList = state.applyForList.map((apply) => {
|
|
493
|
+
return {
|
|
494
|
+
...apply,
|
|
495
|
+
enable: value > 0
|
|
496
|
+
}
|
|
497
|
+
})
|
|
498
|
+
state.applyFlag = Symbol()
|
|
499
|
+
}}
|
|
500
|
+
/>
|
|
501
|
+
<Spacer />
|
|
502
|
+
</Card>
|
|
503
|
+
)
|
|
504
|
+
}, [state.deviceData, state.applyForList, props.theme?.type])
|
|
505
|
+
|
|
479
506
|
const componentRender = useMemo(() => {
|
|
480
507
|
const component =
|
|
481
508
|
props.manualData.type === DeviceType.MixLight
|
|
@@ -484,6 +511,8 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
484
511
|
? stripLightCard
|
|
485
512
|
: props.manualData.type === DeviceType.CeilingLight
|
|
486
513
|
? ceilingLightCard
|
|
514
|
+
: props.manualData.type === DeviceType.Shutter
|
|
515
|
+
? shutterCard
|
|
487
516
|
: lightSourceCard;
|
|
488
517
|
return component;
|
|
489
518
|
}, [props.manualData.type, state.applyForList, state.deviceData, props.theme?.card.background]);
|
|
@@ -492,4 +521,4 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
492
521
|
return <View>{componentRender}</View>;
|
|
493
522
|
}
|
|
494
523
|
|
|
495
|
-
export default memo(withTheme(ManualSettings))
|
|
524
|
+
export default memo(withTheme(ManualSettings)) as React.ComponentType<ManualSettingProps>
|