@ledvance/ui-biz-bundle 1.1.129 → 1.1.131
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/newModules/timeSchedule/Interface.ts +8 -3
- package/src/newModules/timeSchedule/TimeScheduleActions.ts +4 -0
- package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +71 -83
- package/src/newModules/timeSchedule/TimeSchedulePage.tsx +1 -0
- package/src/newModules/timeSchedule/components/ManuaSettings.tsx +41 -12
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ export interface HSV {
|
|
|
25
25
|
v: number;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export type Category = 'light' | 'socket' | 'fan' | 'mainLight' | 'secondaryLight'
|
|
28
|
+
export type Category = 'light' | 'socket' | 'fan' | 'mainLight' | 'secondaryLight' | 'shutter'
|
|
29
29
|
|
|
30
30
|
export interface ApplyForItem {
|
|
31
31
|
name?: string
|
|
@@ -54,7 +54,7 @@ export interface ManualSettingProps extends judgmentSupport {
|
|
|
54
54
|
applyForList: ApplyForItem[];
|
|
55
55
|
dps: Record<string, any>;
|
|
56
56
|
manualData: ComponentConfig;
|
|
57
|
-
onManualChange?: (manualData: PlugData | DeviceData | MixLightData | StripLightData) => void
|
|
57
|
+
onManualChange?: (manualData: PlugData | DeviceData | MixLightData | StripLightData | ShutterData) => void
|
|
58
58
|
onApplyChange?: (applyForList: ApplyForItem[]) => void
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -67,6 +67,7 @@ export enum DeviceType {
|
|
|
67
67
|
CeilingLight = 'ceilingLight',
|
|
68
68
|
FanLight = 'fanLight',
|
|
69
69
|
MoodStrip = 'moodStrip',
|
|
70
|
+
Shutter = 'shutter',
|
|
70
71
|
}
|
|
71
72
|
// export type DeviceType = 'LightSource' | 'CeilingLight' | 'StringLight' | 'StripLight' | 'MixLight';
|
|
72
73
|
|
|
@@ -106,6 +107,10 @@ export interface MoodStripData extends DeviceData {
|
|
|
106
107
|
adjustType: AdjustType
|
|
107
108
|
}
|
|
108
109
|
|
|
110
|
+
export interface ShutterData extends DeviceData {
|
|
111
|
+
percentControl: number
|
|
112
|
+
}
|
|
113
|
+
|
|
109
114
|
export type ComponentConfig =
|
|
110
115
|
| { type: DeviceType.LightSource; deviceData: DeviceData }
|
|
111
116
|
| { type: DeviceType.MixLight; deviceData: MixLightData }
|
|
@@ -114,7 +119,7 @@ export type ComponentConfig =
|
|
|
114
119
|
| { type: DeviceType.FanLight; deviceData: FanLightData }
|
|
115
120
|
| { type: DeviceType.PowerStrip; deviceData: DeviceData}
|
|
116
121
|
| { type: DeviceType.MoodStrip; deviceData: MoodStripData}
|
|
117
|
-
|
|
122
|
+
| { type: DeviceType.Shutter; deviceData: ShutterData}
|
|
118
123
|
export interface TimeScheduleDetailState {
|
|
119
124
|
timeSchedule: Timer;
|
|
120
125
|
dps: Record<string, any>;
|
|
@@ -38,6 +38,10 @@ export const defMoodStripDeviceData = {
|
|
|
38
38
|
adjustType: AdjustType.COLOUR
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
+
export const defShutterDeviceData = {
|
|
42
|
+
percentControl: 100
|
|
43
|
+
};
|
|
44
|
+
|
|
41
45
|
export const getTimeSchedule = async (deviceId: string): Promise<Timer[]> => {
|
|
42
46
|
const res = await NativeApi.getAllTaskTimer(deviceId);
|
|
43
47
|
if (res.success && Array.isArray(res.data)) {
|
|
@@ -25,7 +25,8 @@ import {
|
|
|
25
25
|
defFanLightDeviceData,
|
|
26
26
|
defMixDeviceData,
|
|
27
27
|
defMoodStripDeviceData,
|
|
28
|
-
defStripDeviceData
|
|
28
|
+
defStripDeviceData,
|
|
29
|
+
defShutterDeviceData
|
|
29
30
|
} from './TimeScheduleActions';
|
|
30
31
|
import MoodItem from '../mood/MoodItem';
|
|
31
32
|
import {getRemoteMoodList} from '../mood/MoodActions';
|
|
@@ -228,6 +229,31 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
228
229
|
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
|
|
229
230
|
}, [state.mood, params.isCeilingLight])
|
|
230
231
|
|
|
232
|
+
const renderSkillGroup = (skills: ApplyForItem[], i18nString: string) => {
|
|
233
|
+
if (!skills.length) return null;
|
|
234
|
+
|
|
235
|
+
return (
|
|
236
|
+
<>
|
|
237
|
+
<Text style={{ fontSize: cx(14), color: props.theme?.global.fontColor }}>
|
|
238
|
+
{i18nString}
|
|
239
|
+
</Text>
|
|
240
|
+
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
|
|
241
|
+
{skills.map(item => (
|
|
242
|
+
<View
|
|
243
|
+
style={[
|
|
244
|
+
styles.summaryRight,
|
|
245
|
+
{ marginRight: cx(5), marginBottom: cx(5) },
|
|
246
|
+
]}
|
|
247
|
+
key={item.dp}
|
|
248
|
+
>
|
|
249
|
+
<Text style={styles.rightItem}>{item.key}</Text>
|
|
250
|
+
</View>
|
|
251
|
+
))}
|
|
252
|
+
</View>
|
|
253
|
+
</>
|
|
254
|
+
);
|
|
255
|
+
};
|
|
256
|
+
|
|
231
257
|
const styles = StyleSheet.create({
|
|
232
258
|
cardContainer: {
|
|
233
259
|
marginHorizontal: cx(24),
|
|
@@ -589,65 +615,26 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
|
|
|
589
615
|
time={is24HourClock
|
|
590
616
|
? state.timeSchedule.time
|
|
591
617
|
: convertTo12HourFormat(state.timeSchedule.time)}
|
|
592
|
-
actions={
|
|
593
|
-
{
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
{!!state.selectedSkill.filter(skill => skill.enable).length && (
|
|
618
|
+
actions={
|
|
619
|
+
<View style={{ flex: 1 }}>
|
|
620
|
+
{state.isManual ? (
|
|
621
|
+
state.selectedSkill.length ? (
|
|
597
622
|
<>
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
</Text>
|
|
601
|
-
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
|
|
602
|
-
{state.selectedSkill
|
|
603
|
-
.filter(skill => skill.enable)
|
|
604
|
-
.map(item => (
|
|
605
|
-
<View
|
|
606
|
-
style={[
|
|
607
|
-
styles.summaryRight,
|
|
608
|
-
{ marginRight: cx(5), marginBottom: cx(5) },
|
|
609
|
-
]}
|
|
610
|
-
key={item.dp}
|
|
611
|
-
>
|
|
612
|
-
<Text style={[styles.rightItem]}>{item.key}</Text>
|
|
613
|
-
</View>
|
|
614
|
-
))}
|
|
615
|
-
</View>
|
|
623
|
+
{renderSkillGroup(state.selectedSkill.filter(skill => skill.enable), I18n.getLang(params.isShutter ? 'curtain_summary_action_txt_1' : 'feature_summary_action_txt_1'))}
|
|
624
|
+
{renderSkillGroup(state.selectedSkill.filter(skill => !skill.enable), I18n.getLang(params.isShutter ? 'curtain_summary_action_txt_2' : 'feature_summary_action_txt_2'))}
|
|
616
625
|
</>
|
|
617
|
-
)
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
<
|
|
622
|
-
{
|
|
623
|
-
</Text>
|
|
624
|
-
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
|
|
625
|
-
{state.selectedSkill
|
|
626
|
-
.filter(skill => !skill.enable)
|
|
627
|
-
.map((item) => (
|
|
628
|
-
<View
|
|
629
|
-
style={[
|
|
630
|
-
styles.summaryRight,
|
|
631
|
-
{ marginRight: cx(5), marginBottom: cx(5) },
|
|
632
|
-
]}
|
|
633
|
-
key={item.dp}
|
|
634
|
-
>
|
|
635
|
-
<Text style={[styles.rightItem]}>{item.key}</Text>
|
|
636
|
-
</View>
|
|
637
|
-
))}
|
|
626
|
+
) : null
|
|
627
|
+
) : (
|
|
628
|
+
state.moodName ? (
|
|
629
|
+
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
|
|
630
|
+
<View style={[styles.summaryRight, { marginLeft: cx(5) }]}>
|
|
631
|
+
<Text style={styles.rightItem}>{state.moodName}</Text>
|
|
638
632
|
</View>
|
|
639
|
-
|
|
640
|
-
)
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
|
|
645
|
-
<View style={[styles.summaryRight, { marginLeft: cx(5) }]}>
|
|
646
|
-
<Text style={styles.rightItem}>{state.moodName}</Text>
|
|
647
|
-
</View>
|
|
648
|
-
</View>
|
|
649
|
-
)}
|
|
650
|
-
</View>}
|
|
633
|
+
</View>
|
|
634
|
+
) : null
|
|
635
|
+
)}
|
|
636
|
+
</View>
|
|
637
|
+
}
|
|
651
638
|
/>
|
|
652
639
|
<Spacer height={cx(30)} />
|
|
653
640
|
|
|
@@ -694,38 +681,39 @@ const newTimeSchedule = () => {
|
|
|
694
681
|
};
|
|
695
682
|
|
|
696
683
|
const getDefaultManual = (props: TimeScheduleDetailPageParams): ComponentConfig => {
|
|
697
|
-
const
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
684
|
+
const deviceTypeMap: Record<string, DeviceType> = {
|
|
685
|
+
isStripLight: DeviceType.StripLight,
|
|
686
|
+
isMixLight: DeviceType.MixLight,
|
|
687
|
+
isPowerStrip: DeviceType.PowerStrip,
|
|
688
|
+
isFanLight: DeviceType.FanLight,
|
|
689
|
+
isCeilingLight: DeviceType.CeilingLight,
|
|
690
|
+
isMoodStrip: DeviceType.MoodStrip,
|
|
691
|
+
isShutter: DeviceType.Shutter
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
const deviceType = Object.entries(deviceTypeMap)
|
|
695
|
+
.find(([key]) => props[key as keyof TimeScheduleDetailPageParams])
|
|
696
|
+
?.[1] || DeviceType.LightSource;
|
|
697
|
+
|
|
698
|
+
const deviceDataMap: Record<DeviceType, any> = {
|
|
699
|
+
[DeviceType.StripLight]: defStripDeviceData,
|
|
700
|
+
[DeviceType.CeilingLight]: defStripDeviceData,
|
|
701
|
+
[DeviceType.MixLight]: defMixDeviceData,
|
|
702
|
+
[DeviceType.FanLight]: defFanLightDeviceData,
|
|
703
|
+
[DeviceType.MoodStrip]: defMoodStripDeviceData,
|
|
704
|
+
[DeviceType.Shutter]: defShutterDeviceData,
|
|
705
|
+
[DeviceType.PowerStrip]: defDeviceData,
|
|
706
|
+
[DeviceType.LightSource]: defDeviceData,
|
|
707
|
+
[DeviceType.Plug]: defDeviceData
|
|
708
|
+
};
|
|
721
709
|
|
|
722
710
|
return {
|
|
723
711
|
type: deviceType as any,
|
|
724
712
|
deviceData: {
|
|
725
|
-
...
|
|
713
|
+
...deviceDataMap[deviceType],
|
|
726
714
|
isColorMode: props.isSupportColor,
|
|
727
715
|
},
|
|
728
716
|
};
|
|
729
717
|
};
|
|
730
718
|
|
|
731
|
-
export default withTheme(TimeScheduleDetailPage)
|
|
719
|
+
export default withTheme(TimeScheduleDetailPage) as React.ComponentType<any>
|
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import React, {memo, useMemo} from 'react';
|
|
1
|
+
import React, { memo, useMemo } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
DeviceType,
|
|
4
4
|
directOptions,
|
|
5
5
|
FanLightData,
|
|
6
6
|
ManualSettingProps,
|
|
7
7
|
modeOptions,
|
|
8
|
+
ShutterData,
|
|
8
9
|
StripLightData
|
|
9
10
|
} from '../Interface';
|
|
10
|
-
import {View} from 'react-native';
|
|
11
|
+
import { View } from 'react-native';
|
|
11
12
|
import Card from '@ledvance/base/src/components/Card';
|
|
12
13
|
import LampAdjustView from '@ledvance/base/src/components/LampAdjustView';
|
|
13
|
-
import {Utils} from 'tuya-panel-kit';
|
|
14
|
-
import {useCreation, useReactive, useUpdateEffect} from 'ahooks';
|
|
14
|
+
import { Utils } from 'tuya-panel-kit';
|
|
15
|
+
import { useCreation, useReactive, useUpdateEffect } from 'ahooks';
|
|
15
16
|
import LdvSwitch from '@ledvance/base/src/components/ldvSwitch';
|
|
16
17
|
import ColorTempAdjustView from '@ledvance/base/src/components/ColorTempAdjustView';
|
|
17
18
|
import ColorAdjustView from '@ledvance/base/src/components/ColorAdjustView';
|
|
18
19
|
import I18n from '@ledvance/base/src/i18n';
|
|
19
20
|
import StripAdjustView from '@ledvance/base/src/components/StripAdjustView';
|
|
20
21
|
import Spacer from '@ledvance/base/src/components/Spacer';
|
|
21
|
-
import {FanAdjustViewContent} from '@ledvance/base/src/components/FanAdjustView';
|
|
22
|
+
import { FanAdjustViewContent } from '@ledvance/base/src/components/FanAdjustView';
|
|
22
23
|
import SocketItem from '@ledvance/base/src/components/SocketItem'
|
|
23
24
|
import res from '@ledvance/base/src/res';
|
|
24
25
|
import { cctToColor } from '@ledvance/base/src/utils/cctUtils';
|
|
25
|
-
import {hsv2Hex, mapFloatToRange } from '@ledvance/base/src/utils';
|
|
26
|
-
import {AdjustType, ApplyForItem} from "@ledvance/base/src/utils/interface";
|
|
26
|
+
import { hsv2Hex, mapFloatToRange } from '@ledvance/base/src/utils';
|
|
27
|
+
import { AdjustType, ApplyForItem } from "@ledvance/base/src/utils/interface";
|
|
28
|
+
import LdvSlider from '@ledvance/base/src/components/ldvSlider';
|
|
27
29
|
|
|
28
30
|
const { convertX: cx } = Utils.RatioUtils;
|
|
29
31
|
const { withTheme } = Utils.ThemeUtils
|
|
@@ -94,7 +96,7 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
94
96
|
<Card style={{ marginHorizontal: cx(24) }}>
|
|
95
97
|
<LdvSwitch
|
|
96
98
|
title={item.name || item.key}
|
|
97
|
-
color={getBlockColor(item)}
|
|
99
|
+
color={getBlockColor(item as any)}
|
|
98
100
|
colorAlpha={1}
|
|
99
101
|
enable={item.enable}
|
|
100
102
|
setEnable={(enable: boolean) => {
|
|
@@ -212,7 +214,7 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
212
214
|
}, [state.deviceData, state.applyForList, props.theme?.type]);
|
|
213
215
|
|
|
214
216
|
const mixLightCard = useMemo(() => {
|
|
215
|
-
const {deviceData} = state;
|
|
217
|
+
const { deviceData } = state;
|
|
216
218
|
const getBlockColor = ((type: string) => {
|
|
217
219
|
if (type === 'mainLight') return cctToColor(deviceData.temperature);
|
|
218
220
|
if (type === 'secondaryLight') {
|
|
@@ -489,7 +491,32 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
489
491
|
))}
|
|
490
492
|
</View>
|
|
491
493
|
)
|
|
492
|
-
}, [state.deviceData, state.applyForList])
|
|
494
|
+
}, [state.deviceData, state.applyForList, props.theme?.type])
|
|
495
|
+
|
|
496
|
+
const shutterCard = useMemo(() => {
|
|
497
|
+
return (
|
|
498
|
+
<Card style={{ marginHorizontal: cx(24) }}>
|
|
499
|
+
<Spacer height={cx(16)} />
|
|
500
|
+
<LdvSlider
|
|
501
|
+
title={'Curtain'}
|
|
502
|
+
value={(state.deviceData as ShutterData).percentControl}
|
|
503
|
+
min={0}
|
|
504
|
+
max={100}
|
|
505
|
+
onSlidingComplete={async (value) => {
|
|
506
|
+
(state.deviceData as ShutterData).percentControl = value
|
|
507
|
+
state.applyForList = state.applyForList.map((apply) => {
|
|
508
|
+
return {
|
|
509
|
+
...apply,
|
|
510
|
+
enable: value > 0
|
|
511
|
+
}
|
|
512
|
+
})
|
|
513
|
+
state.applyFlag = Symbol()
|
|
514
|
+
}}
|
|
515
|
+
/>
|
|
516
|
+
<Spacer />
|
|
517
|
+
</Card>
|
|
518
|
+
)
|
|
519
|
+
}, [state.deviceData, state.applyForList, props.theme?.type])
|
|
493
520
|
|
|
494
521
|
const componentRender = useMemo(() => {
|
|
495
522
|
const component =
|
|
@@ -501,7 +528,9 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
501
528
|
? ceilingLightCard
|
|
502
529
|
: props.manualData.type === DeviceType.PowerStrip
|
|
503
530
|
? powerStripCard
|
|
504
|
-
:
|
|
531
|
+
: props.manualData.type === DeviceType.Shutter
|
|
532
|
+
? shutterCard
|
|
533
|
+
: lightSourceCard;
|
|
505
534
|
return component;
|
|
506
535
|
}, [props.manualData, state.applyForList, state.deviceData, props.theme?.type]);
|
|
507
536
|
|
|
@@ -509,4 +538,4 @@ function ManualSettings(props: ManualSettingProps) {
|
|
|
509
538
|
return <View>{componentRender}</View>;
|
|
510
539
|
}
|
|
511
540
|
|
|
512
|
-
export default memo(withTheme(ManualSettings))
|
|
541
|
+
export default memo(withTheme(ManualSettings)) as React.ComponentType<ManualSettingProps>
|