@ledvance/ui-biz-bundle 1.1.56 → 1.1.58
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 +2 -1
- package/src/modules/biorhythm/Router.ts +34 -0
- package/src/modules/fixedTime/Router.ts +26 -0
- package/src/modules/flags/FlagInfo.tsx +25 -25
- package/src/modules/flags/FlagPage.tsx +1 -1
- package/src/modules/flags/Router.ts +25 -0
- package/src/modules/history/Router.ts +16 -0
- package/src/modules/mood/FantasyRouter.ts +35 -0
- package/src/modules/mood/MixMood/Router.ts +44 -0
- package/src/modules/mood/Router.ts +53 -0
- package/src/modules/music/Router.ts +16 -0
- package/src/modules/powerOnBehavior/Router.ts +16 -0
- package/src/modules/randomTime/Router.ts +25 -0
- package/src/modules/sleepWakeup/Router.ts +25 -0
- package/src/modules/timeSchedule/Router.ts +25 -0
- package/src/modules/timer/Router.ts +16 -0
- package/src/navigation/Routers.d.ts +0 -7
- package/src/navigation/Routers.ts +15 -304
- package/src/newModules/childLock/ChildLockPage.tsx +97 -0
- package/src/newModules/childLock/Router.ts +16 -0
- package/src/newModules/energyConsumption/EnergyConsumptionActions.ts +23 -0
- package/src/newModules/energyConsumption/EnergyConsumptionChart.tsx +84 -0
- package/src/newModules/energyConsumption/EnergyConsumptionDetail.tsx +321 -0
- package/src/newModules/energyConsumption/EnergyConsumptionPage.tsx +392 -0
- package/src/newModules/energyConsumption/Router.ts +34 -0
- package/src/newModules/energyConsumption/co2Data.ts +23655 -0
- package/src/newModules/energyConsumption/component/BarChart.tsx +93 -0
- package/src/newModules/energyConsumption/component/EnergyModal.tsx +282 -0
- package/src/newModules/energyConsumption/component/Overview.tsx +116 -0
- package/src/newModules/fixedTime/FixedTimeActions.ts +234 -0
- package/src/newModules/fixedTime/FixedTimeDetailPage.tsx +341 -0
- package/src/newModules/fixedTime/FixedTimePage.tsx +231 -0
- package/src/newModules/fixedTime/Router.ts +25 -0
- package/src/newModules/lightMode/LightModePage.tsx +204 -0
- package/src/newModules/lightMode/Router.ts +16 -0
- package/src/newModules/mood/AddMoodPage.tsx +178 -0
- package/src/newModules/mood/DynamicMoodEditorPage.tsx +653 -0
- package/src/newModules/mood/Interface.ts +219 -0
- package/src/newModules/mood/MixDynamicMoodEditor.tsx +781 -0
- package/src/newModules/mood/MoodActions.ts +235 -0
- package/src/newModules/mood/MoodInfo.ts +2151 -0
- package/src/newModules/mood/MoodItem.tsx +148 -0
- package/src/newModules/mood/MoodPage.tsx +385 -0
- package/src/newModules/mood/MoodParse.ts +442 -0
- package/src/newModules/mood/RecommendMoodItem.tsx +68 -0
- package/src/newModules/mood/Router.ts +53 -0
- package/src/newModules/mood/StaticMoodEditorPage.tsx +343 -0
- package/src/newModules/mood/tools.ts +12 -0
- package/src/newModules/overchargeSwitch/OverchargeSwitchPage.tsx +96 -0
- package/src/newModules/overchargeSwitch/Router.ts +16 -0
- package/src/newModules/powerOnBehavior/LightBehaviorPage.tsx +266 -0
- package/src/newModules/powerOnBehavior/PlugBehaviorPage.tsx +173 -0
- package/src/newModules/powerOnBehavior/PowerOnBehaviorActions.ts +106 -0
- package/src/newModules/powerOnBehavior/Router.ts +16 -0
- package/src/newModules/randomTime/RandomTimeActions.ts +232 -0
- package/src/newModules/randomTime/RandomTimeDetailPage.tsx +322 -0
- package/src/newModules/randomTime/RandomTimePage.tsx +230 -0
- package/src/newModules/randomTime/Router.ts +25 -0
- package/src/newModules/randomTime/Summary.tsx +116 -0
- package/src/newModules/swithInching/Router.ts +16 -0
- package/src/newModules/swithInching/SwithInching.tsx +231 -0
- package/src/newModules/swithInching/SwithInchingAction.ts +55 -0
- package/src/newModules/swithInching/pickerView.tsx +91 -0
- package/src/newModules/timeSchedule/Interface.ts +111 -0
- package/src/newModules/timeSchedule/Router.ts +25 -0
- package/src/newModules/timeSchedule/TimeScheduleActions.ts +53 -0
- package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +662 -0
- package/src/newModules/timeSchedule/TimeSchedulePage.tsx +222 -0
- package/src/newModules/timeSchedule/components/ManuaSettings.tsx +259 -0
- package/src/newModules/timeSchedule/components/ScheduleCard.tsx +109 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleProp, StyleSheet, View, ViewStyle, Text } from 'react-native'
|
|
3
|
+
import { Picker, Utils } from 'tuya-panel-kit'
|
|
4
|
+
import _ from 'lodash'
|
|
5
|
+
|
|
6
|
+
const { convertX } = Utils.RatioUtils
|
|
7
|
+
|
|
8
|
+
const hours = _.times(61, (n) => _.padStart(n.toString(), 2, '0'))
|
|
9
|
+
const minutes = _.times(61, (n) => _.padStart(n.toString(), 2, '0'))
|
|
10
|
+
const pickerTheme = {
|
|
11
|
+
fontSize: 20,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface LdvPickerViewProps {
|
|
15
|
+
hour: string,
|
|
16
|
+
minute: string,
|
|
17
|
+
setHour: (string) => void,
|
|
18
|
+
setMinute: (string) => void,
|
|
19
|
+
style?: StyleProp<ViewStyle> | undefined,
|
|
20
|
+
unit?:string[]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const LdvPickerView = (props: LdvPickerViewProps) => {
|
|
24
|
+
|
|
25
|
+
const { hour, minute, unit, setHour, setMinute } = props
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<View style={[styles.pickerContainer, props.style]}>
|
|
29
|
+
<View style={styles.picContainer}>
|
|
30
|
+
<Picker
|
|
31
|
+
style={[styles.picker, styles.pickerLeft]}
|
|
32
|
+
theme={pickerTheme}
|
|
33
|
+
itemStyle={styles.pickerItem}
|
|
34
|
+
textSize={convertX(14)}
|
|
35
|
+
selectedValue={hour}
|
|
36
|
+
itemAlign={'center'}
|
|
37
|
+
onValueChange={value => setHour(value as string)}>
|
|
38
|
+
{hours.map((value) => (
|
|
39
|
+
<Picker.Item key={value} value={value} label={value} />
|
|
40
|
+
))}
|
|
41
|
+
</Picker>
|
|
42
|
+
{unit ? <View style={styles.pickerUnit}>
|
|
43
|
+
<Text style={{ color: '#000', fontSize: convertX(18) }}>
|
|
44
|
+
{unit[0]}
|
|
45
|
+
</Text>
|
|
46
|
+
</View> : null}
|
|
47
|
+
</View>
|
|
48
|
+
<View style={styles.picContainer}>
|
|
49
|
+
<Picker
|
|
50
|
+
style={[styles.picker, styles.pickerLeft]}
|
|
51
|
+
theme={pickerTheme}
|
|
52
|
+
itemStyle={styles.pickerItem}
|
|
53
|
+
textSize={convertX(14)}
|
|
54
|
+
selectedValue={minute}
|
|
55
|
+
onValueChange={value => setMinute(value as string)}>
|
|
56
|
+
{minutes.map((value) => (
|
|
57
|
+
<Picker.Item key={value} value={value} label={value} />
|
|
58
|
+
))}
|
|
59
|
+
</Picker>
|
|
60
|
+
{unit ? <View style={styles.pickerUnit}>
|
|
61
|
+
<Text style={{ color: '#000', fontSize: convertX(18) }}>
|
|
62
|
+
{unit[1]}
|
|
63
|
+
</Text>
|
|
64
|
+
</View> : null}
|
|
65
|
+
</View>
|
|
66
|
+
</View>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const styles = StyleSheet.create({
|
|
71
|
+
pickerContainer: {
|
|
72
|
+
flexDirection: 'row',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
},
|
|
75
|
+
picker: {
|
|
76
|
+
flex: 1,
|
|
77
|
+
},
|
|
78
|
+
pickerLeft: {},
|
|
79
|
+
pickerItem: {},
|
|
80
|
+
picContainer: {
|
|
81
|
+
flex: 1,
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
flexDirection: 'row',
|
|
84
|
+
},
|
|
85
|
+
pickerUnit: {
|
|
86
|
+
position: 'absolute',
|
|
87
|
+
right: convertX(20),
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export default LdvPickerView
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { MoodInfo, MoodUIInfo } from "../mood/Interface";
|
|
2
|
+
|
|
3
|
+
export interface Timer {
|
|
4
|
+
enable: boolean;
|
|
5
|
+
loops: string;
|
|
6
|
+
time: string;
|
|
7
|
+
id: number;
|
|
8
|
+
notification: boolean;
|
|
9
|
+
dps: Record<string, any>;
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type TimerActions = 'add' | 'delete' | 'update'
|
|
14
|
+
|
|
15
|
+
export enum UVCFanMode {
|
|
16
|
+
Nature = 'nature',
|
|
17
|
+
Normal = 'normal',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface HSV {
|
|
21
|
+
h: number;
|
|
22
|
+
s: number;
|
|
23
|
+
v: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type Category = 'light' | 'socket' | 'fan' | 'mainLight' | 'secondaryLight'
|
|
27
|
+
|
|
28
|
+
export interface ApplyForItem {
|
|
29
|
+
key: string;
|
|
30
|
+
dp: string;
|
|
31
|
+
type: Category;
|
|
32
|
+
enable: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface judgmentSupport {
|
|
36
|
+
isSupportColor: boolean;
|
|
37
|
+
isSupportBrightness: boolean;
|
|
38
|
+
isSupportTemperature: boolean;
|
|
39
|
+
isCeilingLight?: boolean;
|
|
40
|
+
isStripLight?: boolean;
|
|
41
|
+
isStringLight?: boolean;
|
|
42
|
+
isMixLight?: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ManualSettingProps extends judgmentSupport {
|
|
46
|
+
applyForList: ApplyForItem[];
|
|
47
|
+
dps: Record<string, any>;
|
|
48
|
+
manualData: ComponentConfig;
|
|
49
|
+
onManualChange?: (manualData: PlugData | DeviceData | MixLightData | StripLightData) => void
|
|
50
|
+
onApplyChange?: (applyForList: ApplyForItem[]) => void
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export enum DeviceType {
|
|
54
|
+
Plug = 'Plug',
|
|
55
|
+
LightSource = 'lightSource',
|
|
56
|
+
MixLight = 'mixLight',
|
|
57
|
+
StripLight = 'stripLight',
|
|
58
|
+
}
|
|
59
|
+
// export type DeviceType = 'LightSource' | 'CeilingLight' | 'StringLight' | 'StripLight' | 'MixLight';
|
|
60
|
+
|
|
61
|
+
export interface PlugData {
|
|
62
|
+
enable: boolean
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface DeviceData {
|
|
66
|
+
h: number;
|
|
67
|
+
s: number;
|
|
68
|
+
v: number;
|
|
69
|
+
brightness: number;
|
|
70
|
+
temperature: number;
|
|
71
|
+
isColorMode: boolean;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface MixLightData extends DeviceData {
|
|
75
|
+
colorLightSwitch: boolean;
|
|
76
|
+
whiteLightSwitch: boolean;
|
|
77
|
+
mixRgbcwEnabled: boolean
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface StripLightData extends DeviceData {
|
|
81
|
+
colors: string[];
|
|
82
|
+
activeKey: number;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type ComponentConfig =
|
|
86
|
+
| { type: DeviceType.Plug; deviceData: PlugData }
|
|
87
|
+
| { type: DeviceType.LightSource; deviceData: DeviceData }
|
|
88
|
+
| { type: DeviceType.MixLight; deviceData: MixLightData }
|
|
89
|
+
| { type: DeviceType.StripLight; deviceData: StripLightData };
|
|
90
|
+
|
|
91
|
+
export interface TimeScheduleDetailState {
|
|
92
|
+
timeSchedule: Timer;
|
|
93
|
+
dps: Record<string, any>;
|
|
94
|
+
isManual: boolean;
|
|
95
|
+
initSelectedSkill: ApplyForItem[];
|
|
96
|
+
selectedSkill: ApplyForItem[];
|
|
97
|
+
unSelectedSkill: ApplyForItem[];
|
|
98
|
+
loading: boolean;
|
|
99
|
+
moodLoading: boolean;
|
|
100
|
+
manualData: ComponentConfig;
|
|
101
|
+
mood?: MoodInfo;
|
|
102
|
+
moods: MoodUIInfo[];
|
|
103
|
+
timerId: any;
|
|
104
|
+
moodName: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface DeviceStateType {
|
|
108
|
+
deviceData: ComponentConfig
|
|
109
|
+
mood?: MoodInfo
|
|
110
|
+
isManual: boolean
|
|
111
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {NavigationRoute} from "tuya-panel-kit";
|
|
2
|
+
import NewTimeSchedulePage from "./TimeSchedulePage";
|
|
3
|
+
import NewTimeScheduleEditPage from "./TimeScheduleDetailPage";
|
|
4
|
+
import {ui_biz_routerKey} from "../../navigation/Routers";
|
|
5
|
+
|
|
6
|
+
const NewTimeSchedulePageRouters: NavigationRoute[] = [
|
|
7
|
+
{
|
|
8
|
+
name: ui_biz_routerKey.ui_biz_time_schedule_new,
|
|
9
|
+
component: NewTimeSchedulePage,
|
|
10
|
+
options: {
|
|
11
|
+
hideTopbar: true,
|
|
12
|
+
showOfflineView: false,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: ui_biz_routerKey.ui_biz_time_schedule_edit_new,
|
|
17
|
+
component: NewTimeScheduleEditPage,
|
|
18
|
+
options: {
|
|
19
|
+
hideTopbar: true,
|
|
20
|
+
showOfflineView: false,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
export default NewTimeSchedulePageRouters
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { NativeApi } from '@ledvance/base/src/api/native';
|
|
2
|
+
import { Timer, TimerActions } from './Interface';
|
|
3
|
+
import { parseJSON } from '@tuya/tuya-panel-lamp-sdk/lib/utils';
|
|
4
|
+
import { ColorList } from '@ledvance/base/src/components/StripAdjustView';
|
|
5
|
+
|
|
6
|
+
export const defDeviceData = {
|
|
7
|
+
h: 0,
|
|
8
|
+
s: 100,
|
|
9
|
+
v: 100,
|
|
10
|
+
brightness: 100,
|
|
11
|
+
temperature: 0,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const defMixDeviceData = {
|
|
15
|
+
...defDeviceData,
|
|
16
|
+
colorEnable: true,
|
|
17
|
+
whiteEnable: true,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const defStripDeviceData = {
|
|
21
|
+
...defDeviceData,
|
|
22
|
+
activeKey: 0,
|
|
23
|
+
colors: ColorList[0],
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const getTimeSchedule = async (deviceId: string): Promise<Timer[]> => {
|
|
27
|
+
const res = await NativeApi.getAllTaskTimer(deviceId);
|
|
28
|
+
if (res.success && Array.isArray(res.data)) {
|
|
29
|
+
return res.data.map(item => ({
|
|
30
|
+
id: item?.mTimerId,
|
|
31
|
+
name: item?.remark,
|
|
32
|
+
loops: item?.mLoops,
|
|
33
|
+
time: item?.mTime,
|
|
34
|
+
dps: parseJSON(item?.mValue),
|
|
35
|
+
enable: !!Number(item?.mStatus),
|
|
36
|
+
notification: item?.isAppPush,
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
return [];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const manageTimeSchedule = async (deviceId: string, schedule: Timer, mode: TimerActions) => {
|
|
43
|
+
const res = await NativeApi.manageTimer(
|
|
44
|
+
deviceId,
|
|
45
|
+
{
|
|
46
|
+
...schedule,
|
|
47
|
+
aliasName: schedule.name,
|
|
48
|
+
status: schedule.enable,
|
|
49
|
+
},
|
|
50
|
+
mode
|
|
51
|
+
);
|
|
52
|
+
return res;
|
|
53
|
+
};
|