@ledvance/group-ui-biz-bundle 1.0.121 → 1.0.122
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/BiorhythmPage.tsx +118 -78
- package/src/modules/biorhythm/circular/RhythmsCircle.tsx +483 -0
- package/src/modules/biorhythm/circular/conical-gradient/Android.tsx +63 -0
- package/src/modules/biorhythm/circular/conical-gradient/Ios.tsx +26 -0
- package/src/modules/biorhythm/circular/conical-gradient/Normal.tsx +187 -0
- package/src/modules/biorhythm/circular/conical-gradient/index.android.tsx +164 -0
- package/src/modules/biorhythm/circular/conical-gradient/index.ios.tsx +124 -0
- package/src/modules/biorhythm/circular/conical-gradient/index.tsx +3 -0
- package/src/modules/biorhythm/circular/conical-gradient/index.web.tsx +94 -0
- package/src/modules/biorhythm/circular/conical-gradient/interface.ts +19 -0
- package/src/modules/biorhythm/circular/conical-gradient/utils.ts +25 -0
- package/src/modules/biorhythm/circular/interface.ts +114 -0
- package/src/modules/energyConsumption/component/EnergyModal.tsx +3 -0
- package/src/modules/lightMode/LightModePage.tsx +50 -144
- package/src/modules/mood/DynamicMoodEditorPage.tsx +1 -1
- package/src/modules/mood/StaticMoodEditorPage.tsx +1 -1
- package/src/modules/mood_new/DynamicMoodEditorPage.tsx +1 -1
- package/src/modules/mood_new/MixDynamicMoodEditor.tsx +1 -1
- package/src/modules/mood_new/MoodInfo.ts +1 -1
- package/src/modules/mood_new/StaticMoodEditorPage.tsx +1 -1
- package/src/modules/powerOnBehavior/LightBehaviorPage.tsx +208 -0
- package/src/modules/powerOnBehavior/PlugBehaviorPage.tsx +99 -0
- package/src/modules/powerOnBehavior/PowerOnBehaviorActions.ts +131 -0
- package/src/modules/powerOnBehavior/Router.ts +27 -0
- package/src/navigation/Routers.ts +3 -1
- package/src/modules/biorhythm/circular/ItemIcon.d.ts +0 -22
- package/src/modules/biorhythm/circular/ItemIcon.tsx +0 -173
- package/src/modules/biorhythm/circular/Progress.d.ts +0 -24
- package/src/modules/biorhythm/circular/Progress.tsx +0 -372
- package/src/modules/biorhythm/circular/TimeCircular.d.ts +0 -11
- package/src/modules/biorhythm/circular/TimeCircular.tsx +0 -64
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle, ImageStyle, ImageSourcePropType } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export interface RhythmsCircleProps {
|
|
4
|
+
/**
|
|
5
|
+
* picker的大小
|
|
6
|
+
*/
|
|
7
|
+
size: number;
|
|
8
|
+
/**
|
|
9
|
+
* 滑动图标内圈大小
|
|
10
|
+
*/
|
|
11
|
+
ringWidth: number;
|
|
12
|
+
/**
|
|
13
|
+
* 滑块图标大小
|
|
14
|
+
*/
|
|
15
|
+
thumbSize: number;
|
|
16
|
+
/**
|
|
17
|
+
* 色盘最外围样式
|
|
18
|
+
*/
|
|
19
|
+
pickerStyle?: StyleProp<ViewStyle>;
|
|
20
|
+
/**
|
|
21
|
+
* 时间盘的样式
|
|
22
|
+
*/
|
|
23
|
+
timeStyle?: StyleProp<ViewStyle>;
|
|
24
|
+
/**
|
|
25
|
+
* 时间指针图片
|
|
26
|
+
*/
|
|
27
|
+
timeImg?: ImageSourcePropType;
|
|
28
|
+
/**
|
|
29
|
+
* 滑块图标样式
|
|
30
|
+
*/
|
|
31
|
+
thumbStyle?: StyleProp<ViewStyle>;
|
|
32
|
+
/**
|
|
33
|
+
* 图标样式
|
|
34
|
+
*/
|
|
35
|
+
iconStyle?: StyleProp<ImageStyle>;
|
|
36
|
+
/**
|
|
37
|
+
* 数据
|
|
38
|
+
*/
|
|
39
|
+
data?: IData[];
|
|
40
|
+
/**
|
|
41
|
+
* 滑块图标是否可拖动
|
|
42
|
+
*/
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* 不能拖动的透明度
|
|
46
|
+
*/
|
|
47
|
+
disabledOpacity?: number;
|
|
48
|
+
/**
|
|
49
|
+
* 是否可以滑过超过上一个节点和下一个节点
|
|
50
|
+
*/
|
|
51
|
+
stepOverEnabled?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 最小间隔时间为15分钟对应的角度
|
|
54
|
+
*/
|
|
55
|
+
stepTime?: number;
|
|
56
|
+
/**
|
|
57
|
+
* 滑块图标移动事件
|
|
58
|
+
*/
|
|
59
|
+
onMove?: (v: IMovePropsData[]) => void;
|
|
60
|
+
/**
|
|
61
|
+
* 滑块图标移动结束事件
|
|
62
|
+
*/
|
|
63
|
+
onRelease?: (v: IMovePropsData[]) => void;
|
|
64
|
+
/**
|
|
65
|
+
* 滑块图标改变事件
|
|
66
|
+
*/
|
|
67
|
+
onChange?: (v: IMovePropsData[]) => void;
|
|
68
|
+
/**
|
|
69
|
+
* 在日落节点后多加一个颜色进行优化
|
|
70
|
+
*/
|
|
71
|
+
lastRingColor?: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface IData {
|
|
75
|
+
/**
|
|
76
|
+
* 下标
|
|
77
|
+
*/
|
|
78
|
+
index: number;
|
|
79
|
+
/**
|
|
80
|
+
* hour * 60 + minute,
|
|
81
|
+
*/
|
|
82
|
+
time: number;
|
|
83
|
+
/**
|
|
84
|
+
* 图标
|
|
85
|
+
*/
|
|
86
|
+
icon: string;
|
|
87
|
+
/**
|
|
88
|
+
* 图标未点击的颜色
|
|
89
|
+
*/
|
|
90
|
+
noActiveColor: string;
|
|
91
|
+
/**
|
|
92
|
+
* 图标点击的颜色
|
|
93
|
+
*/
|
|
94
|
+
activeColor: string;
|
|
95
|
+
/**
|
|
96
|
+
* 每个图标之间极坐标的颜色
|
|
97
|
+
*/
|
|
98
|
+
color: string;
|
|
99
|
+
/**
|
|
100
|
+
* 图标是否可以触发
|
|
101
|
+
*/
|
|
102
|
+
valid?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* 改节点的角度
|
|
105
|
+
*/
|
|
106
|
+
angle?: number;
|
|
107
|
+
}
|
|
108
|
+
export interface IMovePropsData {
|
|
109
|
+
index: number;
|
|
110
|
+
time: number;
|
|
111
|
+
icon: string;
|
|
112
|
+
color: string;
|
|
113
|
+
deg: number;
|
|
114
|
+
}
|
|
@@ -292,6 +292,9 @@ const EnergyModal = (props: EnergyModalProps) => {
|
|
|
292
292
|
return (
|
|
293
293
|
<Modal
|
|
294
294
|
visible={props.visible}
|
|
295
|
+
onRequestClose={() => {
|
|
296
|
+
props.onCancel && props.onCancel()
|
|
297
|
+
}}
|
|
295
298
|
>
|
|
296
299
|
<ScrollView>
|
|
297
300
|
<View style={{ backgroundColor: props.theme?.card.head, flexDirection: 'row', height: cx(60), justifyContent: 'space-between', alignItems: 'center', borderTopLeftRadius: cx(10), borderTopRightRadius: cx(10), paddingHorizontal: cx(8) }}>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
1
|
+
import React, {useEffect, useMemo} from 'react'
|
|
2
|
+
import {ScrollView, StyleSheet, Text} from 'react-native'
|
|
3
3
|
import Page from '@ledvance/base/src/components/Page'
|
|
4
|
-
import {
|
|
4
|
+
import {useFeatureHook, useUAGroupInfo} from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
5
5
|
import I18n from '@ledvance/base/src/i18n'
|
|
6
6
|
import {Utils} from 'tuya-panel-kit'
|
|
7
7
|
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
8
|
-
import Card from '@ledvance/base/src/components/Card'
|
|
9
|
-
import res from '@ledvance/base/src/res'
|
|
10
8
|
import {useReactive, useUpdateEffect} from 'ahooks'
|
|
11
9
|
import {Result} from "@ledvance/base/src/models/modules/Result";
|
|
12
10
|
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
11
|
+
import {getGlobalParamsProperty} from '@ledvance/base/src/utils/common'
|
|
12
|
+
import OptionGroup from "@ledvance/base/src/components/OptionGroup";
|
|
13
13
|
|
|
14
14
|
const { convertX: cx } = Utils.RatioUtils
|
|
15
15
|
const { withTheme } = Utils.ThemeUtils
|
|
@@ -18,8 +18,9 @@ const LIGHT_MODE_RELAY = 'relay'
|
|
|
18
18
|
const LIGHT_MODE_POS = 'pos'
|
|
19
19
|
const LIGHT_MODE_OFF = 'off'
|
|
20
20
|
const LIGHT_MODE_ON = 'on'
|
|
21
|
+
const LIGHT_MODE_NONE = 'none'
|
|
21
22
|
|
|
22
|
-
export type LightMode = 'relay' | 'pos' | 'off' | 'on'
|
|
23
|
+
export type LightMode = 'relay' | 'pos' | 'off' | 'on' | 'none'
|
|
23
24
|
|
|
24
25
|
interface LightModeConfig {
|
|
25
26
|
lightMode: LightMode
|
|
@@ -36,12 +37,42 @@ const LightModePage = (props: { theme?: ThemeType }) => {
|
|
|
36
37
|
const state = useReactive({
|
|
37
38
|
lightMode: lightMode,
|
|
38
39
|
loading: false,
|
|
40
|
+
modes: [] as LightMode[]
|
|
39
41
|
})
|
|
40
42
|
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
state.modes = getGlobalParamsProperty('light_mode')?.range || []
|
|
45
|
+
}, []);
|
|
46
|
+
|
|
41
47
|
useUpdateEffect(() => {
|
|
42
48
|
state.lightMode = lightMode
|
|
43
49
|
}, [lightMode])
|
|
44
50
|
|
|
51
|
+
const modeMap = useMemo(() => {
|
|
52
|
+
return {
|
|
53
|
+
[LIGHT_MODE_RELAY]: {
|
|
54
|
+
title: I18n.getLang('matterplug_option1title'),
|
|
55
|
+
content: I18n.getLang('matterplug_option1description'),
|
|
56
|
+
},
|
|
57
|
+
[LIGHT_MODE_POS]: {
|
|
58
|
+
title: I18n.getLang('matterplug_option2title'),
|
|
59
|
+
content: I18n.getLang('matterplug_option2description'),
|
|
60
|
+
},
|
|
61
|
+
[LIGHT_MODE_OFF]: {
|
|
62
|
+
title: I18n.getLang('matterplug_option3title'),
|
|
63
|
+
content: I18n.getLang('matterplug_option3description'),
|
|
64
|
+
},
|
|
65
|
+
[LIGHT_MODE_ON]: {
|
|
66
|
+
title: I18n.getLang('matterplug_option4title'),
|
|
67
|
+
content: I18n.getLang('matterplug_option4description'),
|
|
68
|
+
},
|
|
69
|
+
[LIGHT_MODE_NONE]: {
|
|
70
|
+
title: I18n.getLang('matterplug_option3title'),
|
|
71
|
+
content: I18n.getLang('matterplug_option3description'),
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}, [])
|
|
75
|
+
|
|
45
76
|
const styles = StyleSheet.create({
|
|
46
77
|
root: {
|
|
47
78
|
flex: 1,
|
|
@@ -53,61 +84,8 @@ const LightModePage = (props: { theme?: ThemeType }) => {
|
|
|
53
84
|
fontWeight: 'bold',
|
|
54
85
|
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
55
86
|
},
|
|
56
|
-
tipText: {
|
|
57
|
-
marginHorizontal: cx(24),
|
|
58
|
-
color: props.theme?.global.fontColor,
|
|
59
|
-
fontSize: cx(14),
|
|
60
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
61
|
-
},
|
|
62
|
-
modeSelectGroup: {
|
|
63
|
-
marginHorizontal: cx(24),
|
|
64
|
-
backgroundColor: props.theme?.container.background,
|
|
65
|
-
borderRadius: cx(4),
|
|
66
|
-
},
|
|
67
|
-
modeTip: {
|
|
68
|
-
marginHorizontal: cx(8),
|
|
69
|
-
color: props.theme?.global.fontColor,
|
|
70
|
-
fontSize: cx(14),
|
|
71
|
-
fontWeight: 'bold',
|
|
72
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
73
|
-
},
|
|
74
|
-
modeSelectCard: {
|
|
75
|
-
marginHorizontal: cx(8),
|
|
76
|
-
},
|
|
77
|
-
line: {
|
|
78
|
-
height: cx(1),
|
|
79
|
-
marginHorizontal: cx(12),
|
|
80
|
-
backgroundColor: props.theme?.container.divider,
|
|
81
|
-
},
|
|
82
|
-
itemRoot: {
|
|
83
|
-
flexDirection: 'row',
|
|
84
|
-
alignItems: 'center',
|
|
85
|
-
paddingHorizontal: cx(12),
|
|
86
|
-
paddingBottom: cx(8),
|
|
87
|
-
},
|
|
88
|
-
itemTextGroup: {
|
|
89
|
-
flex: 1,
|
|
90
|
-
marginEnd: cx(12),
|
|
91
|
-
justifyContent: 'center',
|
|
92
|
-
},
|
|
93
|
-
itemTitle: {
|
|
94
|
-
color: props.theme?.global.fontColor,
|
|
95
|
-
fontSize: cx(14),
|
|
96
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
97
|
-
},
|
|
98
|
-
itemContent: {
|
|
99
|
-
color: props.theme?.global.secondFontColor,
|
|
100
|
-
fontSize: cx(14),
|
|
101
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
102
|
-
},
|
|
103
|
-
itemCheckedIcon: {
|
|
104
|
-
width: cx(32),
|
|
105
|
-
height: cx(32),
|
|
106
|
-
marginEnd: cx(4),
|
|
107
|
-
},
|
|
108
87
|
})
|
|
109
88
|
|
|
110
|
-
|
|
111
89
|
return (
|
|
112
90
|
<Page
|
|
113
91
|
backText={uaGroupInfo.name}
|
|
@@ -118,94 +96,22 @@ const LightModePage = (props: { theme?: ThemeType }) => {
|
|
|
118
96
|
{I18n.getLang('matterplug_description')}
|
|
119
97
|
</Text>
|
|
120
98
|
<Spacer />
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
onPress={async () => {
|
|
135
|
-
state.lightMode = LIGHT_MODE_RELAY
|
|
136
|
-
await setLightMode(state.lightMode)
|
|
137
|
-
}} />
|
|
138
|
-
<View style={styles.line} />
|
|
139
|
-
<Spacer height={cx(8)} />
|
|
140
|
-
<LightModeItem
|
|
141
|
-
styles={styles}
|
|
142
|
-
enable={state.lightMode === LIGHT_MODE_POS}
|
|
143
|
-
title={I18n.getLang('matterplug_option2title')}
|
|
144
|
-
content={I18n.getLang('matterplug_option2description')}
|
|
145
|
-
onPress={async () => {
|
|
146
|
-
state.lightMode = LIGHT_MODE_POS
|
|
147
|
-
await setLightMode(state.lightMode)
|
|
148
|
-
}} />
|
|
149
|
-
<View style={styles.line} />
|
|
150
|
-
<Spacer height={cx(8)} />
|
|
151
|
-
<LightModeItem
|
|
152
|
-
styles={styles}
|
|
153
|
-
enable={state.lightMode === LIGHT_MODE_OFF}
|
|
154
|
-
title={I18n.getLang('matterplug_option3title')}
|
|
155
|
-
content={I18n.getLang('matterplug_option3description')}
|
|
156
|
-
onPress={async () => {
|
|
157
|
-
state.lightMode = LIGHT_MODE_OFF
|
|
158
|
-
await setLightMode(state.lightMode)
|
|
159
|
-
}} />
|
|
160
|
-
<Spacer height={cx(8)} />
|
|
161
|
-
<View style={styles.line} />
|
|
162
|
-
<LightModeItem
|
|
163
|
-
styles={styles}
|
|
164
|
-
enable={state.lightMode === LIGHT_MODE_ON}
|
|
165
|
-
title={I18n.getLang('matterplug_option4title')}
|
|
166
|
-
content={I18n.getLang('matterplug_option4description')}
|
|
167
|
-
onPress={async () => {
|
|
168
|
-
state.lightMode = LIGHT_MODE_ON
|
|
169
|
-
await setLightMode(state.lightMode)
|
|
170
|
-
}} />
|
|
171
|
-
<Spacer height={cx(4)} />
|
|
172
|
-
</Card>
|
|
173
|
-
<Spacer height={cx(8)} />
|
|
174
|
-
</View>
|
|
99
|
+
<OptionGroup
|
|
100
|
+
tips={I18n.getLang('matterplug_heading')}
|
|
101
|
+
selected={state.lightMode}
|
|
102
|
+
options={state.modes.map((mode) => ({
|
|
103
|
+
title: modeMap[mode].title,
|
|
104
|
+
content: modeMap[mode].content,
|
|
105
|
+
value: mode,
|
|
106
|
+
onPress: async (value) => {
|
|
107
|
+
state.lightMode = value
|
|
108
|
+
await setLightMode(state.lightMode)
|
|
109
|
+
}
|
|
110
|
+
}))}
|
|
111
|
+
/>
|
|
175
112
|
</ScrollView>
|
|
176
113
|
</Page>
|
|
177
114
|
)
|
|
178
115
|
}
|
|
179
116
|
|
|
180
|
-
interface LightModeItemProps extends PropsWithChildren<ViewProps> {
|
|
181
|
-
onPress: () => void
|
|
182
|
-
title: string
|
|
183
|
-
content: string
|
|
184
|
-
enable: boolean
|
|
185
|
-
styles: any
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function LightModeItem(props: LightModeItemProps) {
|
|
189
|
-
const { styles } = props
|
|
190
|
-
return (
|
|
191
|
-
<TouchableOpacity onPress={props.onPress}>
|
|
192
|
-
<View style={styles.itemRoot}>
|
|
193
|
-
<View style={styles.itemTextGroup}>
|
|
194
|
-
<Text style={styles.itemTitle}>{props.title}</Text>
|
|
195
|
-
<Spacer height={cx(4)} />
|
|
196
|
-
<Text style={styles.itemContent}>{props.content}</Text>
|
|
197
|
-
</View>
|
|
198
|
-
<Image
|
|
199
|
-
source={{ uri: res.ic_check }}
|
|
200
|
-
style={[
|
|
201
|
-
styles.itemCheckedIcon,
|
|
202
|
-
{
|
|
203
|
-
display: props.enable ? 'flex' : 'none',
|
|
204
|
-
},
|
|
205
|
-
]} />
|
|
206
|
-
</View>
|
|
207
|
-
</TouchableOpacity>
|
|
208
|
-
)
|
|
209
|
-
}
|
|
210
|
-
|
|
211
117
|
export default withTheme(LightModePage)
|
|
@@ -141,7 +141,7 @@ const DynamicMoodEditorPage = () => {
|
|
|
141
141
|
maxLength={33}
|
|
142
142
|
showError={state.mood.name.length > 32 || nameRepeat}
|
|
143
143
|
tipColor={nameRepeat ? '#f00' : undefined}
|
|
144
|
-
tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
|
|
144
|
+
tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
|
|
145
145
|
errorText={Strings.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')} />
|
|
146
146
|
<Card style={styles.adjustCard}>
|
|
147
147
|
<Spacer height={cx(16)} />
|
|
@@ -126,7 +126,7 @@ const StaticMoodEditorPage = () => {
|
|
|
126
126
|
maxLength={33}
|
|
127
127
|
showError={state.mood.name.length > 32 || nameRepeat}
|
|
128
128
|
tipColor={nameRepeat ? '#f00' : undefined}
|
|
129
|
-
tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
|
|
129
|
+
tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
|
|
130
130
|
errorText={I18n.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')} />
|
|
131
131
|
<Card style={styles.adjustCard}>
|
|
132
132
|
<Spacer height={cx(16)} />
|
|
@@ -268,7 +268,7 @@ const DynamicMoodEditorPage = (props: { theme?: ThemeType }) => {
|
|
|
268
268
|
maxLength={33}
|
|
269
269
|
showError={state.mood.name.length > 32 || nameRepeat}
|
|
270
270
|
tipColor={nameRepeat ? props.theme?.global.error : undefined}
|
|
271
|
-
tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
|
|
271
|
+
tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
|
|
272
272
|
errorText={I18n.getLang(
|
|
273
273
|
nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text'
|
|
274
274
|
)}
|
|
@@ -288,7 +288,7 @@ const MixDynamicMoodEditorPage = (props: { theme?: ThemeType }) => {
|
|
|
288
288
|
maxLength={33}
|
|
289
289
|
showError={state.mood.name.length > 32 || nameRepeat}
|
|
290
290
|
tipColor={nameRepeat ? props.theme?.global.error : undefined}
|
|
291
|
-
tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
|
|
291
|
+
tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
|
|
292
292
|
errorText={I18n.getLang(
|
|
293
293
|
nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text'
|
|
294
294
|
)}
|
|
@@ -383,7 +383,7 @@ function getStringLightSceneList(): RemoteMoodInfo[] {
|
|
|
383
383
|
},
|
|
384
384
|
{
|
|
385
385
|
n: I18n.getLang('dynamicmoods_sorbet'),
|
|
386
|
-
i: "
|
|
386
|
+
i: "0111104b4b0000006400d2580000000064003364000000006400000100000000",
|
|
387
387
|
s: '',
|
|
388
388
|
t: 0,
|
|
389
389
|
e: false,
|
|
@@ -185,7 +185,7 @@ const StaticMoodEditorPage = (props: { theme?: ThemeType }) => {
|
|
|
185
185
|
maxLength={33}
|
|
186
186
|
showError={state.mood.name.length > 32 || nameRepeat}
|
|
187
187
|
tipColor={nameRepeat ? props.theme?.global.error : undefined}
|
|
188
|
-
tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
|
|
188
|
+
tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
|
|
189
189
|
errorText={I18n.getLang(
|
|
190
190
|
nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text'
|
|
191
191
|
)}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {ScrollView, StyleSheet, Text, View} from 'react-native'
|
|
3
|
+
import {useReactive, useUpdateEffect} from 'ahooks'
|
|
4
|
+
import {Utils} from 'tuya-panel-kit'
|
|
5
|
+
import Page from '@ledvance/base/src/components/Page'
|
|
6
|
+
import {useDeviceInfo} from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
7
|
+
import I18n from '@ledvance/base/src/i18n'
|
|
8
|
+
import {LightBehaviorPageParams, useDoNotDisturbControl, usePowerOffMemory} from './PowerOnBehaviorActions'
|
|
9
|
+
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
10
|
+
import Card from '@ledvance/base/src/components/Card'
|
|
11
|
+
import LampAdjustView from '@ledvance/base/src/components/LampAdjustView'
|
|
12
|
+
import LdvSwitch from '@ledvance/base/src/components/ldvSwitch'
|
|
13
|
+
import {cloneDeep} from 'lodash'
|
|
14
|
+
import {useParams} from '@ledvance/base/src/hooks/Hooks'
|
|
15
|
+
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
16
|
+
import OptionGroup from "@ledvance/base/src/components/OptionGroup";
|
|
17
|
+
|
|
18
|
+
const { convertX: cx } = Utils.RatioUtils
|
|
19
|
+
const { withTheme } = Utils.ThemeUtils
|
|
20
|
+
|
|
21
|
+
export enum PowerMemoryMode {
|
|
22
|
+
Default = 0,
|
|
23
|
+
Last = 1,
|
|
24
|
+
Custom = 2
|
|
25
|
+
}
|
|
26
|
+
const LightBehaviorPage = (props: { theme?: ThemeType }) => {
|
|
27
|
+
const params = useParams<LightBehaviorPageParams>()
|
|
28
|
+
const deviceInfo = useDeviceInfo()
|
|
29
|
+
const [powerMemory, setPowerMemory] = usePowerOffMemory()
|
|
30
|
+
const [doNotDisturb, setDoNotDisturb] = useDoNotDisturbControl()
|
|
31
|
+
const state = useReactive({
|
|
32
|
+
loading: false,
|
|
33
|
+
powerMemory: cloneDeep(powerMemory),
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
useUpdateEffect(() => {
|
|
37
|
+
state.powerMemory = powerMemory
|
|
38
|
+
}, [JSON.stringify(powerMemory)])
|
|
39
|
+
|
|
40
|
+
const styles = StyleSheet.create({
|
|
41
|
+
root: {
|
|
42
|
+
flex: 1,
|
|
43
|
+
},
|
|
44
|
+
tipText: {
|
|
45
|
+
marginHorizontal: cx(24),
|
|
46
|
+
color: props.theme?.global.fontColor,
|
|
47
|
+
fontSize: cx(14),
|
|
48
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
49
|
+
},
|
|
50
|
+
modeSelectGroup: {
|
|
51
|
+
marginHorizontal: cx(24),
|
|
52
|
+
backgroundColor: props.theme?.container.background,
|
|
53
|
+
borderRadius: cx(4),
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<Page
|
|
59
|
+
backText={deviceInfo.name}
|
|
60
|
+
headlineText={I18n.getLang('light_sources_specific_settings_power_off')}
|
|
61
|
+
loading={state.loading}>
|
|
62
|
+
<ScrollView style={styles.root} nestedScrollEnabled={true}>
|
|
63
|
+
<View>
|
|
64
|
+
<Text style={styles.tipText}>
|
|
65
|
+
{I18n.getLang('light_settings_default_secondtopic')}
|
|
66
|
+
</Text>
|
|
67
|
+
<Spacer />
|
|
68
|
+
<OptionGroup
|
|
69
|
+
tips={I18n.getLang('groups_settings_power_on_behavior_secondbox_topic')}
|
|
70
|
+
selected={state.powerMemory.type}
|
|
71
|
+
options={[{
|
|
72
|
+
title: I18n.getLang('groups_settings_power_on_behavior_secondbox_status_value1_topic'),
|
|
73
|
+
content: I18n.getLang('groups_settings_power_on_behavior_secondbox_status_value1_description'),
|
|
74
|
+
value: PowerMemoryMode.Default,
|
|
75
|
+
onPress: (value) => {
|
|
76
|
+
state.powerMemory = {
|
|
77
|
+
...state.powerMemory,
|
|
78
|
+
type: value
|
|
79
|
+
}
|
|
80
|
+
setPowerMemory(state.powerMemory).then()
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
title: I18n.getLang('groups_settings_power_on_behavior_secondbox_status_value2_topic'),
|
|
84
|
+
content: I18n.getLang('groups_settings_power_on_behavior_secondbox_status_value2_description'),
|
|
85
|
+
value: PowerMemoryMode.Last,
|
|
86
|
+
onPress: (value) => {
|
|
87
|
+
state.powerMemory = {
|
|
88
|
+
...state.powerMemory,
|
|
89
|
+
type: value
|
|
90
|
+
}
|
|
91
|
+
setPowerMemory(state.powerMemory).then()
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
title: I18n.getLang('groups_settings_power_on_behavior_secondbox_status_value3_topic'),
|
|
95
|
+
content: I18n.getLang('groups_settings_power_on_behavior_secondbox_status_value3_description'),
|
|
96
|
+
value: PowerMemoryMode.Custom,
|
|
97
|
+
onPress: (value) => {
|
|
98
|
+
state.powerMemory = {
|
|
99
|
+
...state.powerMemory,
|
|
100
|
+
type: value
|
|
101
|
+
}
|
|
102
|
+
setPowerMemory(state.powerMemory).then()
|
|
103
|
+
}
|
|
104
|
+
}]}
|
|
105
|
+
/>
|
|
106
|
+
<Spacer />
|
|
107
|
+
{state.powerMemory.type === PowerMemoryMode.Custom &&
|
|
108
|
+
<Card style={{ marginHorizontal: cx(24) }}>
|
|
109
|
+
<View>
|
|
110
|
+
<Spacer />
|
|
111
|
+
<LampAdjustView
|
|
112
|
+
isSupportColor={params.isSupportColor}
|
|
113
|
+
isSupportTemperature={params.isSupportTemperature}
|
|
114
|
+
isSupportBrightness={params.isSupportBrightness}
|
|
115
|
+
isColorMode={state.powerMemory.isColor}
|
|
116
|
+
reserveSV={true}
|
|
117
|
+
setIsColorMode={async isColorMode => {
|
|
118
|
+
state.powerMemory = {
|
|
119
|
+
...state.powerMemory,
|
|
120
|
+
isColor: isColorMode
|
|
121
|
+
}
|
|
122
|
+
}}
|
|
123
|
+
h={state.powerMemory.hue} s={state.powerMemory.sat} v={state.powerMemory.val}
|
|
124
|
+
onHSVChange={(h, s, v) => {
|
|
125
|
+
state.powerMemory = {
|
|
126
|
+
...state.powerMemory,
|
|
127
|
+
hue: h,
|
|
128
|
+
sat: s,
|
|
129
|
+
val: v
|
|
130
|
+
}
|
|
131
|
+
}}
|
|
132
|
+
onHSVChangeComplete={async (h, s, v) => {
|
|
133
|
+
state.powerMemory = {
|
|
134
|
+
...state.powerMemory,
|
|
135
|
+
hue: h,
|
|
136
|
+
sat: s,
|
|
137
|
+
val: v
|
|
138
|
+
}
|
|
139
|
+
await setPowerMemory(state.powerMemory)
|
|
140
|
+
}}
|
|
141
|
+
colorTemp={state.powerMemory.temperature}
|
|
142
|
+
brightness={state.powerMemory.bright}
|
|
143
|
+
onCCTChange={cct => {
|
|
144
|
+
state.powerMemory = {
|
|
145
|
+
...state.powerMemory,
|
|
146
|
+
temperature: cct
|
|
147
|
+
}
|
|
148
|
+
}}
|
|
149
|
+
onCCTChangeComplete={async cct => {
|
|
150
|
+
state.powerMemory = {
|
|
151
|
+
...state.powerMemory,
|
|
152
|
+
temperature: cct
|
|
153
|
+
}
|
|
154
|
+
await setPowerMemory(state.powerMemory)
|
|
155
|
+
}}
|
|
156
|
+
onBrightnessChange={brightness => {
|
|
157
|
+
state.powerMemory = {
|
|
158
|
+
...state.powerMemory,
|
|
159
|
+
bright: brightness
|
|
160
|
+
}
|
|
161
|
+
}}
|
|
162
|
+
onBrightnessChangeComplete={async brightness => {
|
|
163
|
+
state.powerMemory = {
|
|
164
|
+
...state.powerMemory,
|
|
165
|
+
bright: brightness
|
|
166
|
+
}
|
|
167
|
+
await setPowerMemory(state.powerMemory)
|
|
168
|
+
}} />
|
|
169
|
+
</View>
|
|
170
|
+
</Card>
|
|
171
|
+
}
|
|
172
|
+
<Spacer />
|
|
173
|
+
{!!params.isSupportDoNotDisturb && <View style={styles.modeSelectGroup}>
|
|
174
|
+
<Spacer height={cx(8)} />
|
|
175
|
+
<View style={{ marginHorizontal: cx(8) }}>
|
|
176
|
+
<Card style={{ borderRadius: cx(4) }}>
|
|
177
|
+
<LdvSwitch
|
|
178
|
+
title={I18n.getLang('light_settings_default_secondbox_text')}
|
|
179
|
+
color={props.theme?.card.background}
|
|
180
|
+
colorAlpha={1}
|
|
181
|
+
enable={doNotDisturb}
|
|
182
|
+
setEnable={async (enable: boolean) => {
|
|
183
|
+
state.loading = true
|
|
184
|
+
await setDoNotDisturb(enable)
|
|
185
|
+
state.loading = false
|
|
186
|
+
}} />
|
|
187
|
+
</Card>
|
|
188
|
+
</View>
|
|
189
|
+
<Spacer height={cx(8)} />
|
|
190
|
+
<Text
|
|
191
|
+
style={{
|
|
192
|
+
marginHorizontal: cx(8),
|
|
193
|
+
color: props.theme?.global.fontColor,
|
|
194
|
+
fontSize: cx(12),
|
|
195
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
196
|
+
}}>
|
|
197
|
+
{I18n.getLang('groups_settings_power_on_behavior_disturbbox_note')}
|
|
198
|
+
</Text>
|
|
199
|
+
<Spacer height={cx(8)} />
|
|
200
|
+
</View>}
|
|
201
|
+
<Spacer />
|
|
202
|
+
</View>
|
|
203
|
+
</ScrollView>
|
|
204
|
+
</Page>
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export default withTheme(LightBehaviorPage)
|