@ledvance/group-ui-biz-bundle 1.0.46 → 1.0.48
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/biorhythm/BiorhythmActions.ts +5 -13
- package/src/modules/biorhythm/BiorhythmBean.ts +6 -6
- package/src/modules/biorhythm/BiorhythmPage.tsx +373 -420
- package/src/modules/biorhythm/Router.ts +34 -0
- package/src/modules/fixedTimeForPlug/Router.ts +25 -0
- package/src/modules/fixedTimingForLight/Router.ts +25 -0
- package/src/modules/flags/Router.ts +25 -0
- package/src/modules/mood/AddMoodPage.tsx +2 -2
- package/src/modules/mood_new/AddMoodPage.tsx +197 -0
- package/src/modules/mood_new/DynamicMoodEditorPage.tsx +654 -0
- package/src/modules/mood_new/Interface.ts +219 -0
- package/src/modules/mood_new/MixDynamicMoodEditor.tsx +788 -0
- package/src/modules/mood_new/MoodActions.ts +227 -0
- package/src/modules/mood_new/MoodInfo.ts +2151 -0
- package/src/modules/mood_new/MoodItem.tsx +148 -0
- package/src/modules/mood_new/MoodPage.tsx +374 -0
- package/src/modules/mood_new/MoodParse.ts +442 -0
- package/src/modules/mood_new/RecommendMoodItem.tsx +69 -0
- package/src/modules/mood_new/Router.ts +43 -0
- package/src/modules/mood_new/StaticMoodEditorPage.tsx +293 -0
- package/src/modules/music/Router.ts +16 -0
- package/src/modules/randomTimeForPlug/Router.ts +25 -0
- package/src/modules/randomTimingForLight/Router.ts +25 -0
- package/src/modules/remoteSwitch/Router.ts +16 -0
- package/src/modules/select/Router.ts +16 -0
- package/src/modules/switchGradient/Router.ts +16 -0
- package/src/modules/timeSchedule/Interface.ts +150 -0
- package/src/modules/timeSchedule/Router.ts +25 -0
- package/src/modules/timeSchedule/TimeScheduleActions.ts +140 -0
- package/src/modules/timeSchedule/TimeScheduleDetailPage.tsx +625 -0
- package/src/modules/timeSchedule/TimeSchedulePage.tsx +220 -0
- package/src/modules/timeSchedule/components/ManuaSettings.tsx +376 -0
- package/src/modules/timeSchedule/components/ScheduleCard.tsx +109 -0
- package/src/modules/timeSchedule/components/Summary.tsx +124 -0
- package/src/modules/timer/Router.ts +16 -0
- package/src/navigation/Routers.ts +1 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {NavigationRoute} from "tuya-panel-kit";
|
|
2
|
+
import BiorhythmPage from "./BiorhythmPage";
|
|
3
|
+
import BiorhythmEditPage from "./BiorhythmDetailPage";
|
|
4
|
+
import BiorhythmIconSelectPage from "./IconSelect"
|
|
5
|
+
import {ui_biz_routerKey} from "../../navigation/Routers";
|
|
6
|
+
|
|
7
|
+
const BiorhythmPageRouters: NavigationRoute[] = [
|
|
8
|
+
{
|
|
9
|
+
name: ui_biz_routerKey.group_ui_biz_biological,
|
|
10
|
+
component: BiorhythmPage,
|
|
11
|
+
options:{
|
|
12
|
+
hideTopbar: true,
|
|
13
|
+
showOfflineView: false,
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: ui_biz_routerKey.group_ui_biz_biological_detail,
|
|
18
|
+
component: BiorhythmEditPage,
|
|
19
|
+
options:{
|
|
20
|
+
hideTopbar: true,
|
|
21
|
+
showOfflineView: false,
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: ui_biz_routerKey.group_ui_biz_biological_icon_select,
|
|
26
|
+
component: BiorhythmIconSelectPage,
|
|
27
|
+
options:{
|
|
28
|
+
hideTopbar: true,
|
|
29
|
+
showOfflineView: false,
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
export default BiorhythmPageRouters
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {NavigationRoute} from "tuya-panel-kit";
|
|
2
|
+
import FixedTimeForPlugPage from "./FixedTimeForPlugPage";
|
|
3
|
+
import FixedTimeForPlugDetailPage from "./FixedTimeForPlugDetailPage";
|
|
4
|
+
import {ui_biz_routerKey} from "../../navigation/Routers";
|
|
5
|
+
|
|
6
|
+
const FixedTimeForPlugRouters: NavigationRoute[] = [
|
|
7
|
+
{
|
|
8
|
+
name: ui_biz_routerKey.group_ui_biz_fixed_time_plug,
|
|
9
|
+
component: FixedTimeForPlugPage,
|
|
10
|
+
options:{
|
|
11
|
+
hideTopbar: true,
|
|
12
|
+
showOfflineView: false,
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: ui_biz_routerKey.group_ui_biz_fixed_time_plug_detail,
|
|
17
|
+
component: FixedTimeForPlugDetailPage,
|
|
18
|
+
options:{
|
|
19
|
+
hideTopbar: true,
|
|
20
|
+
showOfflineView: false,
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
export default FixedTimeForPlugRouters
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {NavigationRoute} from "tuya-panel-kit";
|
|
2
|
+
import FixedTimingForLightPage from "./FixedTimingForLightPage";
|
|
3
|
+
import FixedTimingForLightDetailPage from "./FixedTimingForLightDetailPage";
|
|
4
|
+
import {ui_biz_routerKey} from "../../navigation/Routers";
|
|
5
|
+
|
|
6
|
+
const FixedTimingForLightRouters: NavigationRoute[] = [
|
|
7
|
+
{
|
|
8
|
+
name: ui_biz_routerKey.group_ui_biz_fixed_timing_light,
|
|
9
|
+
component: FixedTimingForLightPage,
|
|
10
|
+
options:{
|
|
11
|
+
hideTopbar: true,
|
|
12
|
+
showOfflineView: false,
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: ui_biz_routerKey.group_ui_biz_fixed_timing_light_detail,
|
|
17
|
+
component: FixedTimingForLightDetailPage,
|
|
18
|
+
options:{
|
|
19
|
+
hideTopbar: true,
|
|
20
|
+
showOfflineView: false,
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
export default FixedTimingForLightRouters
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {NavigationRoute} from "tuya-panel-kit";
|
|
2
|
+
import FlagPage from "./FlagPage";
|
|
3
|
+
import FlagEditPage from "./FlagEditPage";
|
|
4
|
+
import {ui_biz_routerKey} from "../../navigation/Routers";
|
|
5
|
+
|
|
6
|
+
const FlagPageRouters: NavigationRoute[] = [
|
|
7
|
+
{
|
|
8
|
+
name: ui_biz_routerKey.group_ui_biz_flag_page,
|
|
9
|
+
component: FlagPage,
|
|
10
|
+
options:{
|
|
11
|
+
hideTopbar: true,
|
|
12
|
+
showOfflineView: false,
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: ui_biz_routerKey.group_ui_biz_flag_page_edit,
|
|
17
|
+
component: FlagEditPage,
|
|
18
|
+
options:{
|
|
19
|
+
hideTopbar: true,
|
|
20
|
+
showOfflineView: false,
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
export default FlagPageRouters
|
|
@@ -76,7 +76,7 @@ const AddMoodPage = () => {
|
|
|
76
76
|
mode: 'add',
|
|
77
77
|
currentMood: index === 0 ? newMood(
|
|
78
78
|
id,
|
|
79
|
-
moduleParams.isSupportColor
|
|
79
|
+
moduleParams.isSupportColor,
|
|
80
80
|
routeParams.isStatic,
|
|
81
81
|
moduleParams
|
|
82
82
|
) : recommendMood2SceneUIState(item),
|
|
@@ -90,7 +90,7 @@ const AddMoodPage = () => {
|
|
|
90
90
|
mode: 'add',
|
|
91
91
|
currentMood: index === 0 ? newMood(
|
|
92
92
|
id,
|
|
93
|
-
moduleParams.isSupportColor
|
|
93
|
+
moduleParams.isSupportColor,
|
|
94
94
|
routeParams.isStatic,
|
|
95
95
|
moduleParams
|
|
96
96
|
) : recommendMood2SceneUIState(item),
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import Strings from '@ledvance/base/src/i18n';
|
|
2
|
+
import Page from '@ledvance/base/src/components/Page';
|
|
3
|
+
import React, { useCallback } from 'react';
|
|
4
|
+
import { FlatList, StyleSheet, Text, View } from 'react-native';
|
|
5
|
+
import { Utils } from 'tuya-panel-kit';
|
|
6
|
+
import RecommendMoodItem from './RecommendMoodItem';
|
|
7
|
+
import Spacer from '@ledvance/base/src/components/Spacer';
|
|
8
|
+
import { useReactive } from 'ahooks';
|
|
9
|
+
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
10
|
+
import {
|
|
11
|
+
MoodPageParams,
|
|
12
|
+
MoodNodeTransitionMode,
|
|
13
|
+
MoodUIInfo,
|
|
14
|
+
MoodJumpGradientMode,
|
|
15
|
+
} from './Interface';
|
|
16
|
+
import { Result } from '@ledvance/base/src/models/modules/Result';
|
|
17
|
+
import { ui_biz_routerKey } from '../../navigation/Routers'
|
|
18
|
+
import { difference, head, map, range } from 'lodash';
|
|
19
|
+
import { RecommendMood, getRecommendMixMoods, getRecommendMoods } from './MoodInfo';
|
|
20
|
+
|
|
21
|
+
const cx = Utils.RatioUtils.convertX;
|
|
22
|
+
|
|
23
|
+
export interface AddMoodPageParams {
|
|
24
|
+
isStatic: boolean;
|
|
25
|
+
moods: MoodUIInfo[];
|
|
26
|
+
moduleParams: MoodPageParams;
|
|
27
|
+
modDeleteMood: (mode: 'add' | 'edit' | 'del', currentMood: MoodUIInfo) => Promise<Result<any>>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface AddMoodPageState {
|
|
31
|
+
data: RecommendMood[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const AddMoodPage = () => {
|
|
35
|
+
const navigation = useNavigation();
|
|
36
|
+
const routeParams = useRoute().params as AddMoodPageParams;
|
|
37
|
+
const moduleParams = routeParams.moduleParams;
|
|
38
|
+
const isMix = !!(moduleParams.isMixLight || moduleParams.isCeilingLight);
|
|
39
|
+
const state = useReactive<AddMoodPageState>({
|
|
40
|
+
data: isMix
|
|
41
|
+
? getRecommendMixMoods(routeParams.isStatic, moduleParams)
|
|
42
|
+
: getRecommendMoods(routeParams.isStatic, moduleParams),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const getFormateItem = item => {
|
|
46
|
+
return {
|
|
47
|
+
...item,
|
|
48
|
+
version: 0,
|
|
49
|
+
secondaryLamp: item.secondaryLamp ?? {
|
|
50
|
+
nodes: [],
|
|
51
|
+
mode: 0,
|
|
52
|
+
speed: 75,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const onMoodItemClick = useCallback(
|
|
58
|
+
(moodItem: RecommendMood) => {
|
|
59
|
+
let useIds: any[] = []
|
|
60
|
+
if(moduleParams.isCeilingLight){
|
|
61
|
+
const mainIds = map(routeParams.moods.map(m => m.mainLamp), 'id') ?? 0
|
|
62
|
+
const secondaryIds = map(routeParams.moods.map(m => m.secondaryLamp), 'id') ?? 0
|
|
63
|
+
useIds = [...mainIds, ...secondaryIds]
|
|
64
|
+
}else{
|
|
65
|
+
useIds = map(routeParams.moods, 'id');
|
|
66
|
+
}
|
|
67
|
+
const idRange = range(0, 256);
|
|
68
|
+
const mainId: number = head(difference(idRange, useIds));
|
|
69
|
+
const secondaryId: number = head(difference(idRange, [...useIds, mainId]))
|
|
70
|
+
console.log(mainId, secondaryId, '< --- iddddddddd ')
|
|
71
|
+
const url = routeParams.isStatic
|
|
72
|
+
? ui_biz_routerKey.group_ui_biz_static_mood_edit
|
|
73
|
+
: !!(moduleParams.isCeilingLight || moduleParams.isMixLight)
|
|
74
|
+
? ui_biz_routerKey.group_ui_biz_dynamic_mix_mood_edit
|
|
75
|
+
: ui_biz_routerKey.group_ui_biz_dynamic_mood_edit;
|
|
76
|
+
const currentMood = moodItem.mainLamp
|
|
77
|
+
? { ...moodItem, id: mainId, mainLamp: {...moodItem.mainLamp, id: mainId}, secondaryLamp: {...moodItem.secondaryLamp, id: secondaryId}}
|
|
78
|
+
: newMood(mainId, secondaryId ,moduleParams.isSupportColor, routeParams.isStatic, moduleParams);
|
|
79
|
+
navigation.navigate(url, {
|
|
80
|
+
mode: 'add',
|
|
81
|
+
currentMood,
|
|
82
|
+
moods: routeParams.moods,
|
|
83
|
+
moduleParams,
|
|
84
|
+
modDeleteMood: routeParams.modDeleteMood,
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
[routeParams]
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<Page
|
|
92
|
+
backText={Strings.getLang('add_new_static_mood_system_back')}
|
|
93
|
+
headlineText={Strings.getLang(
|
|
94
|
+
routeParams.isStatic
|
|
95
|
+
? 'add_new_static_mood_headline_text'
|
|
96
|
+
: 'add_new_dynamic_mood_headline_text'
|
|
97
|
+
)}
|
|
98
|
+
>
|
|
99
|
+
<View style={styles.root}>
|
|
100
|
+
<Text style={styles.desc}>
|
|
101
|
+
{Strings.getLang(
|
|
102
|
+
routeParams.isStatic
|
|
103
|
+
? 'add_new_static_mood_description_text'
|
|
104
|
+
: 'add_new_dynamic_mood_description_text'
|
|
105
|
+
)}
|
|
106
|
+
</Text>
|
|
107
|
+
<FlatList
|
|
108
|
+
style={{ flex: 1 }}
|
|
109
|
+
data={state.data}
|
|
110
|
+
renderItem={({ item }) => {
|
|
111
|
+
return (
|
|
112
|
+
<RecommendMoodItem
|
|
113
|
+
title={item.name}
|
|
114
|
+
isMix={isMix}
|
|
115
|
+
mood={getFormateItem(item)}
|
|
116
|
+
onPress={() => {
|
|
117
|
+
onMoodItemClick(item);
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
}}
|
|
122
|
+
ItemSeparatorComponent={() => <Spacer />}
|
|
123
|
+
ListHeaderComponent={() => <Spacer />}
|
|
124
|
+
ListFooterComponent={() => <Spacer />}
|
|
125
|
+
keyExtractor={item => item.name}
|
|
126
|
+
/>
|
|
127
|
+
</View>
|
|
128
|
+
</Page>
|
|
129
|
+
);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const styles = StyleSheet.create({
|
|
133
|
+
root: {
|
|
134
|
+
flex: 1,
|
|
135
|
+
flexDirection: 'column',
|
|
136
|
+
},
|
|
137
|
+
desc: {
|
|
138
|
+
color: '#000',
|
|
139
|
+
fontSize: cx(16),
|
|
140
|
+
marginHorizontal: cx(24),
|
|
141
|
+
marginTop: cx(12),
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
export default AddMoodPage;
|
|
146
|
+
|
|
147
|
+
function newMood(
|
|
148
|
+
mainId: number,
|
|
149
|
+
secondaryId: number,
|
|
150
|
+
isColorMode: boolean,
|
|
151
|
+
isStatic: boolean,
|
|
152
|
+
moduleParams: MoodPageParams
|
|
153
|
+
): MoodUIInfo {
|
|
154
|
+
const jump = moduleParams.isStringLight
|
|
155
|
+
? MoodJumpGradientMode.StringJump
|
|
156
|
+
: moduleParams.isStripLight
|
|
157
|
+
? MoodJumpGradientMode.StripJump
|
|
158
|
+
: MoodJumpGradientMode.SourceJump;
|
|
159
|
+
const node = {
|
|
160
|
+
brightness: 100,
|
|
161
|
+
colorTemp: 100,
|
|
162
|
+
h: 0,
|
|
163
|
+
s: 100,
|
|
164
|
+
v: 100,
|
|
165
|
+
isColorNode: !!(moduleParams.isCeilingLight || moduleParams.isMixLight) ? false : isColorMode,
|
|
166
|
+
};
|
|
167
|
+
return {
|
|
168
|
+
version: 0,
|
|
169
|
+
name: '',
|
|
170
|
+
image: '',
|
|
171
|
+
id: mainId,
|
|
172
|
+
mainLamp: {
|
|
173
|
+
id: mainId,
|
|
174
|
+
speed: 75,
|
|
175
|
+
enable: true,
|
|
176
|
+
fanEnable: true,
|
|
177
|
+
fanSpeed: 1,
|
|
178
|
+
mode: isStatic ? MoodNodeTransitionMode.Static : jump,
|
|
179
|
+
nodes: isStatic ? [node] : [node, { ...node }],
|
|
180
|
+
},
|
|
181
|
+
secondaryLamp: {
|
|
182
|
+
id: secondaryId,
|
|
183
|
+
enable: true,
|
|
184
|
+
mode: MoodJumpGradientMode.StripJump,
|
|
185
|
+
speed: 75,
|
|
186
|
+
version: 0,
|
|
187
|
+
expand: 0,
|
|
188
|
+
reserved1: 0,
|
|
189
|
+
reserved2: 0,
|
|
190
|
+
segmented: 0,
|
|
191
|
+
loop: 0,
|
|
192
|
+
excessive: 0,
|
|
193
|
+
direction: 0,
|
|
194
|
+
nodes: isStatic ? [] : [{...node, isColorNode: true}, {...node, isColorNode: true}],
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
}
|