@ledvance/ui-biz-bundle 1.1.133 → 1.1.135
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/mood/DynamicMoodEditorPage.tsx +1 -1
- package/src/modules/mood/FantasyMoodEditPage.tsx +1 -1
- package/src/modules/mood/MixMood/MixMoodEditPage.tsx +1 -1
- package/src/modules/mood/StaticMoodEditorPage.tsx +2 -2
- package/src/newModules/biorhythm/BiorhythmActions.ts +34 -8
- package/src/newModules/biorhythm/BiorhythmPage.tsx +58 -24
- package/src/newModules/biorhythm/circular/RhythmsCircle.tsx +488 -0
- package/src/newModules/biorhythm/circular/conical-gradient/Android.tsx +63 -0
- package/src/newModules/biorhythm/circular/conical-gradient/Ios.tsx +26 -0
- package/src/newModules/biorhythm/circular/conical-gradient/Normal.tsx +187 -0
- package/src/newModules/biorhythm/circular/conical-gradient/index.android.tsx +164 -0
- package/src/newModules/biorhythm/circular/conical-gradient/index.ios.tsx +124 -0
- package/src/newModules/biorhythm/circular/conical-gradient/index.tsx +3 -0
- package/src/newModules/biorhythm/circular/conical-gradient/index.web.tsx +94 -0
- package/src/newModules/biorhythm/circular/conical-gradient/interface.ts +19 -0
- package/src/newModules/biorhythm/circular/conical-gradient/utils.ts +25 -0
- package/src/newModules/biorhythm/circular/interface.ts +114 -0
- package/src/newModules/energyConsumption/component/EnergyModal.tsx +3 -0
- package/src/newModules/lightMode/LightModePage.tsx +52 -145
- package/src/newModules/mood/DynamicMoodEditorPage.tsx +1 -1
- package/src/newModules/mood/MixDynamicMoodEditor.tsx +1 -1
- package/src/newModules/mood/MoodInfo.ts +1 -1
- package/src/newModules/mood/MoodPage.tsx +4 -5
- package/src/newModules/mood/StaticMoodEditorPage.tsx +1 -1
- package/src/newModules/powerOnBehavior/LightBehaviorPage.tsx +37 -120
- package/src/newModules/powerOnBehavior/PlugBehaviorPage.tsx +60 -141
- package/src/newModules/powerOnBehavior/PowerOnBehaviorActions.ts +13 -5
- package/src/newModules/sleepWakeUp/SleepWakeUpActions.ts +122 -59
- package/src/newModules/sleepWakeUp/SleepWakeUpPage.tsx +10 -10
- package/src/newModules/swithInching/SwithInching.tsx +23 -20
- package/src/newModules/swithInching/SwithInchingAction.ts +21 -15
- package/src/newModules/biorhythm/circular/ItemIcon.d.ts +0 -22
- package/src/newModules/biorhythm/circular/ItemIcon.tsx +0 -173
- package/src/newModules/biorhythm/circular/Progress.d.ts +0 -24
- package/src/newModules/biorhythm/circular/Progress.tsx +0 -372
- package/src/newModules/biorhythm/circular/TimeCircular.d.ts +0 -11
- package/src/newModules/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
|
+
}
|
|
@@ -311,6 +311,9 @@ const EnergyModal = (props: EnergyModalProps) => {
|
|
|
311
311
|
return (
|
|
312
312
|
<Modal
|
|
313
313
|
visible={props.visible}
|
|
314
|
+
onRequestClose={() => {
|
|
315
|
+
props.onCancel && props.onCancel()
|
|
316
|
+
}}
|
|
314
317
|
>
|
|
315
318
|
<ScrollView>
|
|
316
319
|
<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,16 +1,16 @@
|
|
|
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
4
|
import {useDeviceInfo, useDp} from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
5
5
|
import I18n from '@ledvance/base/src/i18n'
|
|
6
|
-
import {
|
|
6
|
+
import {Utils} from 'tuya-panel-kit'
|
|
7
7
|
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { useReactive, useUpdateEffect } from 'ahooks'
|
|
11
|
-
import { useParams } from '@ledvance/base/src/hooks/Hooks'
|
|
8
|
+
import {useReactive, useUpdateEffect} from 'ahooks'
|
|
9
|
+
import {useParams} from '@ledvance/base/src/hooks/Hooks'
|
|
12
10
|
import {Result} from "@ledvance/base/src/models/modules/Result";
|
|
13
11
|
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
12
|
+
import {getGlobalParamsProperty} from '@ledvance/base/src/utils/common'
|
|
13
|
+
import OptionGroup from "@ledvance/base/src/components/OptionGroup";
|
|
14
14
|
|
|
15
15
|
const { convertX: cx } = Utils.RatioUtils
|
|
16
16
|
const { withTheme } = Utils.ThemeUtils
|
|
@@ -19,12 +19,13 @@ const LIGHT_MODE_RELAY = 'relay'
|
|
|
19
19
|
const LIGHT_MODE_POS = 'pos'
|
|
20
20
|
const LIGHT_MODE_OFF = 'off'
|
|
21
21
|
const LIGHT_MODE_ON = 'on'
|
|
22
|
+
const LIGHT_MODE_NONE = 'none'
|
|
22
23
|
|
|
23
24
|
export interface LightModePageParams {
|
|
24
25
|
lightModeCode: string
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
type LightMode = 'relay' | 'pos' | 'off' | 'on'
|
|
28
|
+
type LightMode = 'relay' | 'pos' | 'off' | 'on' | 'none'
|
|
28
29
|
|
|
29
30
|
export const useLightMode = (code: string): [LightMode, (v: LightMode) => Promise<Result<any>>] => {
|
|
30
31
|
return useDp(code)
|
|
@@ -38,12 +39,42 @@ const LightModePage = (props: { theme?: ThemeType }) => {
|
|
|
38
39
|
const state = useReactive({
|
|
39
40
|
lightMode: lightMode,
|
|
40
41
|
loading: false,
|
|
42
|
+
modes: [] as LightMode[]
|
|
41
43
|
})
|
|
42
44
|
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
state.modes = getGlobalParamsProperty(params.lightModeCode)?.range || []
|
|
47
|
+
}, []);
|
|
48
|
+
|
|
43
49
|
useUpdateEffect(() => {
|
|
44
50
|
state.lightMode = lightMode
|
|
45
51
|
}, [lightMode])
|
|
46
52
|
|
|
53
|
+
const modeMap = useMemo(() => {
|
|
54
|
+
return {
|
|
55
|
+
[LIGHT_MODE_RELAY]: {
|
|
56
|
+
title: I18n.getLang('matterplug_option1title'),
|
|
57
|
+
content: I18n.getLang('matterplug_option1description'),
|
|
58
|
+
},
|
|
59
|
+
[LIGHT_MODE_POS]: {
|
|
60
|
+
title: I18n.getLang('matterplug_option2title'),
|
|
61
|
+
content: I18n.getLang('matterplug_option2description'),
|
|
62
|
+
},
|
|
63
|
+
[LIGHT_MODE_OFF]: {
|
|
64
|
+
title: I18n.getLang('matterplug_option3title'),
|
|
65
|
+
content: I18n.getLang('matterplug_option3description'),
|
|
66
|
+
},
|
|
67
|
+
[LIGHT_MODE_ON]: {
|
|
68
|
+
title: I18n.getLang('matterplug_option4title'),
|
|
69
|
+
content: I18n.getLang('matterplug_option4description'),
|
|
70
|
+
},
|
|
71
|
+
[LIGHT_MODE_NONE]: {
|
|
72
|
+
title: I18n.getLang('matterplug_option3title'),
|
|
73
|
+
content: I18n.getLang('matterplug_option3description'),
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, [])
|
|
77
|
+
|
|
47
78
|
const styles = StyleSheet.create({
|
|
48
79
|
root: {
|
|
49
80
|
flex: 1,
|
|
@@ -55,58 +86,6 @@ const LightModePage = (props: { theme?: ThemeType }) => {
|
|
|
55
86
|
fontWeight: 'bold',
|
|
56
87
|
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
57
88
|
},
|
|
58
|
-
tipText: {
|
|
59
|
-
marginHorizontal: cx(24),
|
|
60
|
-
color: props.theme?.global.fontColor,
|
|
61
|
-
fontSize: cx(14),
|
|
62
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
63
|
-
},
|
|
64
|
-
modeSelectGroup: {
|
|
65
|
-
marginHorizontal: cx(24),
|
|
66
|
-
backgroundColor: props.theme?.container.background,
|
|
67
|
-
borderRadius: cx(4),
|
|
68
|
-
},
|
|
69
|
-
modeTip: {
|
|
70
|
-
marginHorizontal: cx(8),
|
|
71
|
-
color: props.theme?.global.fontColor,
|
|
72
|
-
fontSize: cx(14),
|
|
73
|
-
fontWeight: 'bold',
|
|
74
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
75
|
-
},
|
|
76
|
-
modeSelectCard: {
|
|
77
|
-
marginHorizontal: cx(8),
|
|
78
|
-
},
|
|
79
|
-
line: {
|
|
80
|
-
height: cx(1),
|
|
81
|
-
marginHorizontal: cx(12),
|
|
82
|
-
backgroundColor: props.theme?.container.divider,
|
|
83
|
-
},
|
|
84
|
-
itemRoot: {
|
|
85
|
-
flexDirection: 'row',
|
|
86
|
-
alignItems: 'center',
|
|
87
|
-
paddingHorizontal: cx(12),
|
|
88
|
-
paddingBottom: cx(8),
|
|
89
|
-
},
|
|
90
|
-
itemTextGroup: {
|
|
91
|
-
flex: 1,
|
|
92
|
-
marginEnd: cx(12),
|
|
93
|
-
justifyContent: 'center',
|
|
94
|
-
},
|
|
95
|
-
itemTitle: {
|
|
96
|
-
color: props.theme?.global.fontColor,
|
|
97
|
-
fontSize: cx(14),
|
|
98
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
99
|
-
},
|
|
100
|
-
itemContent: {
|
|
101
|
-
color: props.theme?.global.secondFontColor,
|
|
102
|
-
fontSize: cx(14),
|
|
103
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
104
|
-
},
|
|
105
|
-
itemCheckedIcon: {
|
|
106
|
-
width: cx(32),
|
|
107
|
-
height: cx(32),
|
|
108
|
-
marginEnd: cx(4),
|
|
109
|
-
},
|
|
110
89
|
})
|
|
111
90
|
|
|
112
91
|
return (
|
|
@@ -119,94 +98,22 @@ const LightModePage = (props: { theme?: ThemeType }) => {
|
|
|
119
98
|
{I18n.getLang('matterplug_description')}
|
|
120
99
|
</Text>
|
|
121
100
|
<Spacer />
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
onPress={async () => {
|
|
136
|
-
state.lightMode = LIGHT_MODE_RELAY
|
|
137
|
-
await setLightMode(state.lightMode)
|
|
138
|
-
}} />
|
|
139
|
-
<View style={styles.line} />
|
|
140
|
-
<Spacer height={cx(8)} />
|
|
141
|
-
<LightModeItem
|
|
142
|
-
styles={styles}
|
|
143
|
-
enable={state.lightMode === LIGHT_MODE_POS}
|
|
144
|
-
title={I18n.getLang('matterplug_option2title')}
|
|
145
|
-
content={I18n.getLang('matterplug_option2description')}
|
|
146
|
-
onPress={async () => {
|
|
147
|
-
state.lightMode = LIGHT_MODE_POS
|
|
148
|
-
await setLightMode(state.lightMode)
|
|
149
|
-
}} />
|
|
150
|
-
<View style={styles.line} />
|
|
151
|
-
<Spacer height={cx(8)} />
|
|
152
|
-
<LightModeItem
|
|
153
|
-
styles={styles}
|
|
154
|
-
enable={state.lightMode === LIGHT_MODE_OFF}
|
|
155
|
-
title={I18n.getLang('matterplug_option3title')}
|
|
156
|
-
content={I18n.getLang('matterplug_option3description')}
|
|
157
|
-
onPress={async () => {
|
|
158
|
-
state.lightMode = LIGHT_MODE_OFF
|
|
159
|
-
await setLightMode(state.lightMode)
|
|
160
|
-
}} />
|
|
161
|
-
<Spacer height={cx(8)} />
|
|
162
|
-
<View style={styles.line} />
|
|
163
|
-
<LightModeItem
|
|
164
|
-
styles={styles}
|
|
165
|
-
enable={state.lightMode === LIGHT_MODE_ON}
|
|
166
|
-
title={I18n.getLang('matterplug_option4title')}
|
|
167
|
-
content={I18n.getLang('matterplug_option4description')}
|
|
168
|
-
onPress={async () => {
|
|
169
|
-
state.lightMode = LIGHT_MODE_ON
|
|
170
|
-
await setLightMode(state.lightMode)
|
|
171
|
-
}} />
|
|
172
|
-
<Spacer height={cx(4)} />
|
|
173
|
-
</Card>
|
|
174
|
-
<Spacer height={cx(8)} />
|
|
175
|
-
</View>
|
|
101
|
+
<OptionGroup
|
|
102
|
+
tips={I18n.getLang('matterplug_heading')}
|
|
103
|
+
selected={state.lightMode}
|
|
104
|
+
options={state.modes.map((mode) => ({
|
|
105
|
+
title: modeMap[mode].title,
|
|
106
|
+
content: modeMap[mode].content,
|
|
107
|
+
value: mode,
|
|
108
|
+
onPress: async (value) => {
|
|
109
|
+
state.lightMode = value
|
|
110
|
+
await setLightMode(state.lightMode)
|
|
111
|
+
}
|
|
112
|
+
}))}
|
|
113
|
+
/>
|
|
176
114
|
</ScrollView>
|
|
177
115
|
</Page>
|
|
178
116
|
)
|
|
179
117
|
}
|
|
180
118
|
|
|
181
|
-
interface LightModeItemProps extends PropsWithChildren<ViewProps> {
|
|
182
|
-
styles: StyleSheet.NamedStyles<any>
|
|
183
|
-
onPress: () => void
|
|
184
|
-
title: string
|
|
185
|
-
content: string
|
|
186
|
-
enable: boolean
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function LightModeItem(props: LightModeItemProps) {
|
|
190
|
-
const { styles } = props
|
|
191
|
-
return (
|
|
192
|
-
<TouchableOpacity onPress={props.onPress}>
|
|
193
|
-
<View style={styles.itemRoot}>
|
|
194
|
-
<View style={styles.itemTextGroup}>
|
|
195
|
-
<Text style={styles.itemTitle}>{props.title}</Text>
|
|
196
|
-
<Spacer height={cx(4)} />
|
|
197
|
-
<Text style={styles.itemContent}>{props.content}</Text>
|
|
198
|
-
</View>
|
|
199
|
-
<Image
|
|
200
|
-
source={{ uri: res.ic_check }}
|
|
201
|
-
style={[
|
|
202
|
-
styles.itemCheckedIcon,
|
|
203
|
-
{
|
|
204
|
-
display: props.enable ? 'flex' : 'none',
|
|
205
|
-
},
|
|
206
|
-
]} />
|
|
207
|
-
</View>
|
|
208
|
-
</TouchableOpacity>
|
|
209
|
-
)
|
|
210
|
-
}
|
|
211
|
-
|
|
212
119
|
export default withTheme(LightModePage)
|
|
@@ -267,7 +267,7 @@ const DynamicMoodEditorPage = (props: { theme?: ThemeType }) => {
|
|
|
267
267
|
maxLength={33}
|
|
268
268
|
showError={state.mood.name.length > 32 || nameRepeat}
|
|
269
269
|
tipColor={nameRepeat ? props.theme?.global.error : undefined}
|
|
270
|
-
tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
|
|
270
|
+
tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
|
|
271
271
|
errorText={Strings.getLang(
|
|
272
272
|
nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text'
|
|
273
273
|
)}
|
|
@@ -291,7 +291,7 @@ const MixDynamicMoodEditorPage = (props: { theme?: ThemeType }) => {
|
|
|
291
291
|
maxLength={33}
|
|
292
292
|
showError={state.mood.name.length > 32 || nameRepeat}
|
|
293
293
|
tipColor={nameRepeat ? props.theme?.global.error : undefined}
|
|
294
|
-
tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
|
|
294
|
+
tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
|
|
295
295
|
errorText={Strings.getLang(
|
|
296
296
|
nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text'
|
|
297
297
|
)}
|
|
@@ -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,
|
|
@@ -94,12 +94,11 @@ const MoodPage = (props: { theme?: ThemeType }) => {
|
|
|
94
94
|
|
|
95
95
|
useEffect(() => {
|
|
96
96
|
state.filterMoods = state.originMoods.filter(item => {
|
|
97
|
+
const isDynamic = (item.secondaryLamp.nodes.length > 1 || item.mainLamp.nodes.length > 1)
|
|
97
98
|
return (
|
|
98
|
-
|
|
99
|
-
(
|
|
100
|
-
(state.
|
|
101
|
-
(state.dynamicTagChecked &&
|
|
102
|
-
(item.secondaryLamp.nodes.length > 1 || item.mainLamp.nodes.length > 1))
|
|
99
|
+
[state.staticTagChecked, state.dynamicTagChecked].every(it => !it) ||
|
|
100
|
+
(state.staticTagChecked && !isDynamic) ||
|
|
101
|
+
(state.dynamicTagChecked && isDynamic)
|
|
103
102
|
);
|
|
104
103
|
});
|
|
105
104
|
}, [state.staticTagChecked, state.dynamicTagChecked, state.originMoods]);
|
|
@@ -184,7 +184,7 @@ const StaticMoodEditorPage = (props: { theme?: ThemeType }) => {
|
|
|
184
184
|
maxLength={33}
|
|
185
185
|
showError={state.mood.name.length > 32 || nameRepeat}
|
|
186
186
|
tipColor={nameRepeat ? props.theme?.global.error : undefined}
|
|
187
|
-
tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
|
|
187
|
+
tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
|
|
188
188
|
errorText={I18n.getLang(
|
|
189
189
|
nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text'
|
|
190
190
|
)}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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
5
|
import Page from '@ledvance/base/src/components/Page'
|
|
6
|
-
import {
|
|
6
|
+
import {useDeviceInfo} from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
7
7
|
import I18n from '@ledvance/base/src/i18n'
|
|
8
|
-
import { usePowerOffMemory
|
|
8
|
+
import {useDoNotDisturbControl, usePowerOffMemory} from './PowerOnBehaviorActions'
|
|
9
9
|
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
10
10
|
import Card from '@ledvance/base/src/components/Card'
|
|
11
|
-
import res from '@ledvance/base/src/res'
|
|
12
11
|
import LampAdjustView from '@ledvance/base/src/components/LampAdjustView'
|
|
13
12
|
import LdvSwitch from '@ledvance/base/src/components/ldvSwitch'
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
13
|
+
import {cloneDeep} from 'lodash'
|
|
14
|
+
import {useParams} from '@ledvance/base/src/hooks/Hooks'
|
|
16
15
|
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
16
|
+
import OptionGroup from "@ledvance/base/src/components/OptionGroup";
|
|
17
17
|
|
|
18
18
|
const { convertX: cx } = Utils.RatioUtils
|
|
19
19
|
const { withTheme } = Utils.ThemeUtils
|
|
@@ -61,42 +61,6 @@ const LightBehaviorPage = (props: { theme?: ThemeType }) => {
|
|
|
61
61
|
backgroundColor: props.theme?.container.background,
|
|
62
62
|
borderRadius: cx(4),
|
|
63
63
|
},
|
|
64
|
-
modeTip: {
|
|
65
|
-
marginHorizontal: cx(8),
|
|
66
|
-
color: props.theme?.global.fontColor,
|
|
67
|
-
fontSize: cx(14),
|
|
68
|
-
fontWeight: 'bold',
|
|
69
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
70
|
-
},
|
|
71
|
-
modeSelectCard: {
|
|
72
|
-
marginHorizontal: cx(8),
|
|
73
|
-
},
|
|
74
|
-
line: {
|
|
75
|
-
height: cx(1),
|
|
76
|
-
marginHorizontal: cx(12),
|
|
77
|
-
backgroundColor: props.theme?.container.divider,
|
|
78
|
-
},
|
|
79
|
-
itemRoot: {
|
|
80
|
-
flexDirection: 'row',
|
|
81
|
-
alignItems: 'center',
|
|
82
|
-
paddingHorizontal: cx(12),
|
|
83
|
-
paddingBottom: cx(8),
|
|
84
|
-
},
|
|
85
|
-
itemTextGroup: {
|
|
86
|
-
flex: 1,
|
|
87
|
-
marginEnd: cx(12),
|
|
88
|
-
justifyContent: 'center',
|
|
89
|
-
},
|
|
90
|
-
itemTitle: {
|
|
91
|
-
color: props.theme?.global.fontColor,
|
|
92
|
-
fontSize: cx(14),
|
|
93
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
94
|
-
},
|
|
95
|
-
itemContent: {
|
|
96
|
-
color: props.theme?.global.secondFontColor,
|
|
97
|
-
fontSize: cx(14),
|
|
98
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
99
|
-
},
|
|
100
64
|
})
|
|
101
65
|
|
|
102
66
|
return (
|
|
@@ -110,49 +74,34 @@ const LightBehaviorPage = (props: { theme?: ThemeType }) => {
|
|
|
110
74
|
{I18n.getLang('light_settings_default_secondtopic')}
|
|
111
75
|
</Text>
|
|
112
76
|
<Spacer />
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
<View style={styles.line} />
|
|
142
|
-
<Spacer height={cx(8)} />
|
|
143
|
-
<PowerOnBehaviorModeItem
|
|
144
|
-
styles={styles}
|
|
145
|
-
enable={state.powerMemory.type === PowerMemoryMode.Custom}
|
|
146
|
-
title={I18n.getLang('groups_settings_power_on_behavior_secondbox_status_value3_topic')}
|
|
147
|
-
content={I18n.getLang('groups_settings_power_on_behavior_secondbox_status_value3_description')}
|
|
148
|
-
onPress={async () => {
|
|
149
|
-
state.powerMemory.type = PowerMemoryMode.Custom
|
|
150
|
-
await setPowerMemory(state.powerMemory)
|
|
151
|
-
}} />
|
|
152
|
-
<Spacer height={cx(4)} />
|
|
153
|
-
</Card>
|
|
154
|
-
<Spacer height={cx(8)} />
|
|
155
|
-
</View>
|
|
77
|
+
<OptionGroup
|
|
78
|
+
tips={I18n.getLang('groups_settings_power_on_behavior_secondbox_topic')}
|
|
79
|
+
selected={state.powerMemory.type}
|
|
80
|
+
options={[{
|
|
81
|
+
title: I18n.getLang('groups_settings_power_on_behavior_secondbox_status_value1_topic'),
|
|
82
|
+
content: I18n.getLang('groups_settings_power_on_behavior_secondbox_status_value1_description'),
|
|
83
|
+
value: PowerMemoryMode.Default,
|
|
84
|
+
onPress: (value) => {
|
|
85
|
+
state.powerMemory.type = value
|
|
86
|
+
setPowerMemory(state.powerMemory).then()
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
title: I18n.getLang('groups_settings_power_on_behavior_secondbox_status_value2_topic'),
|
|
90
|
+
content: I18n.getLang('groups_settings_power_on_behavior_secondbox_status_value2_description'),
|
|
91
|
+
value: PowerMemoryMode.Last,
|
|
92
|
+
onPress: (value) => {
|
|
93
|
+
state.powerMemory.type = value
|
|
94
|
+
setPowerMemory(state.powerMemory).then()
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
title: I18n.getLang('groups_settings_power_on_behavior_secondbox_status_value3_topic'),
|
|
98
|
+
content: I18n.getLang('groups_settings_power_on_behavior_secondbox_status_value3_description'),
|
|
99
|
+
value: PowerMemoryMode.Custom,
|
|
100
|
+
onPress: (value) => {
|
|
101
|
+
state.powerMemory.type = value
|
|
102
|
+
setPowerMemory(state.powerMemory).then()
|
|
103
|
+
}
|
|
104
|
+
}]} />
|
|
156
105
|
<Spacer />
|
|
157
106
|
{state.powerMemory.type === PowerMemoryMode.Custom &&
|
|
158
107
|
<Card style={{ marginHorizontal: cx(24) }}>
|
|
@@ -234,36 +183,4 @@ const LightBehaviorPage = (props: { theme?: ThemeType }) => {
|
|
|
234
183
|
)
|
|
235
184
|
}
|
|
236
185
|
|
|
237
|
-
interface PowerOnBehaviorModeItemProps extends PropsWithChildren<ViewProps> {
|
|
238
|
-
onPress: () => void
|
|
239
|
-
title: string
|
|
240
|
-
content: string
|
|
241
|
-
enable: boolean
|
|
242
|
-
styles: StyleSheet.NamedStyles<any>
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function PowerOnBehaviorModeItem(props: PowerOnBehaviorModeItemProps) {
|
|
246
|
-
const { styles } = props
|
|
247
|
-
return (
|
|
248
|
-
<TouchableOpacity onPress={props.onPress}>
|
|
249
|
-
<View style={styles.itemRoot}>
|
|
250
|
-
<View style={styles.itemTextGroup}>
|
|
251
|
-
<Text style={styles.itemTitle}>{props.title}</Text>
|
|
252
|
-
<Spacer height={cx(4)} />
|
|
253
|
-
<Text style={styles.itemContent}>{props.content}</Text>
|
|
254
|
-
</View>
|
|
255
|
-
<Image
|
|
256
|
-
source={{ uri: res.ic_check }}
|
|
257
|
-
style={{
|
|
258
|
-
width: cx(32),
|
|
259
|
-
height: cx(32),
|
|
260
|
-
marginEnd: cx(4),
|
|
261
|
-
display: props.enable ? 'flex' : 'none',
|
|
262
|
-
}}
|
|
263
|
-
/>
|
|
264
|
-
</View>
|
|
265
|
-
</TouchableOpacity>
|
|
266
|
-
)
|
|
267
|
-
}
|
|
268
|
-
|
|
269
186
|
export default withTheme(LightBehaviorPage)
|