@ledvance/group-ui-biz-bundle 1.0.126 → 1.0.128
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 +7 -2
- package/src/modules/biorhythm/BiorhythmPage.tsx +73 -78
- package/src/modules/powerOnBehavior/LightBehaviorPage.tsx +25 -6
- package/src/modules/powerOnBehavior/PlugBehaviorPage.tsx +3 -3
- package/src/modules/powerOnBehavior/PowerOnBehaviorActions.ts +3 -1
- package/src/modules/remoteSwitch/RemoteSwitchPage.tsx +3 -1
package/package.json
CHANGED
|
@@ -23,12 +23,15 @@ export const useBiorhythm = (): [BiorhythmBean, (value: BiorhythmBean) => Promis
|
|
|
23
23
|
return obj2Dp(val)
|
|
24
24
|
})
|
|
25
25
|
const supportOldData = useCallback((oldData: BiorhythmBean) =>{
|
|
26
|
+
const repeatPeriod = [...oldData.repeatPeriod]
|
|
27
|
+
repeatPeriod.sort((a, b) => a.index - b.index)
|
|
26
28
|
return {
|
|
27
29
|
...oldData,
|
|
30
|
+
repeatPeriod: repeatPeriod,
|
|
28
31
|
planList: oldData.planList.map(p => {
|
|
29
32
|
// @ts-ignore 老数据中使用的是startTime
|
|
30
33
|
if (!p.hasOwnProperty('time') && p.startTime){
|
|
31
|
-
|
|
34
|
+
// @ts-ignore
|
|
32
35
|
const t = p.startTime.split(':')
|
|
33
36
|
return {
|
|
34
37
|
...p,
|
|
@@ -72,6 +75,7 @@ export function dp2Obj(dp: string): BiorhythmBean {
|
|
|
72
75
|
enabled: p === '1',
|
|
73
76
|
}
|
|
74
77
|
})
|
|
78
|
+
repeatPeriod.sort((a, b) => a.index - b.index)
|
|
75
79
|
dpCopy = dpCopy.slice(2)
|
|
76
80
|
// 节点个数 (每个节点长度18),最多8个节点
|
|
77
81
|
hex2Int(dpCopy.slice(0, 2))
|
|
@@ -203,8 +207,9 @@ function obj2Dp(obj: BiorhythmBean): string {
|
|
|
203
207
|
const versionHex = '00'
|
|
204
208
|
const enableHex = obj.enable ? '01' : '00'
|
|
205
209
|
const gradientHex = obj.gradient === BiorhythmGradientType.EntireGradient ? '00' : '0F'
|
|
210
|
+
const newRepeatPeriod = [obj.repeatPeriod[obj.repeatPeriod.length - 1], ...obj.repeatPeriod.slice(0, -1)]
|
|
206
211
|
const repeatPeriodHex = parseInt(
|
|
207
|
-
|
|
212
|
+
newRepeatPeriod
|
|
208
213
|
.map(p => (p.enabled ? '1' : '0'))
|
|
209
214
|
.reverse()
|
|
210
215
|
.join(''),
|
|
@@ -22,7 +22,6 @@ import I18n from '@ledvance/base/src/i18n'
|
|
|
22
22
|
import res from '@ledvance/base/src/res'
|
|
23
23
|
import { ui_biz_routerKey } from '../../navigation/Routers'
|
|
24
24
|
import { cctToColor } from '@ledvance/base/src/utils/cctUtils'
|
|
25
|
-
import { setDataSource } from '@ledvance/base/src/components/weekSelect'
|
|
26
25
|
import { BiorhythmEditPageParams } from './BiorhythmDetailPage'
|
|
27
26
|
import { useBiorhythm } from './BiorhythmActions'
|
|
28
27
|
import { convertMinutesTo12HourFormat, showDialog as showCommonDialog, showDialog } from '@ledvance/base/src/utils/common'
|
|
@@ -185,11 +184,7 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
185
184
|
}, [JSON.stringify(biorhythm)])
|
|
186
185
|
|
|
187
186
|
useEffect(() => {
|
|
188
|
-
const weeks
|
|
189
|
-
biorhythm.repeatPeriod.map(item => {
|
|
190
|
-
return item?.enabled ? 1 : 0
|
|
191
|
-
})).filter(item => item.enabled)
|
|
192
|
-
.map(item => item.title)
|
|
187
|
+
const weeks = biorhythm.repeatPeriod.filter(it => it.enabled).map(it => it.title)
|
|
193
188
|
|
|
194
189
|
if (weeks.length > 0) {
|
|
195
190
|
// / more than one
|
|
@@ -219,20 +214,20 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
219
214
|
const sunHomeText = string => {
|
|
220
215
|
const text = string.split('SUN@HOME')
|
|
221
216
|
return text?.length === 1 && <Text style={{ fontSize: cx(14), color: props.theme?.global.fontColor }}>{text[0]}</Text> ||
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
217
|
+
<Text style={{
|
|
218
|
+
fontSize: cx(14),
|
|
219
|
+
flexDirection: 'row',
|
|
220
|
+
}}>
|
|
221
|
+
<Text style={{ color: props.theme?.global.fontColor }}>{text[0]}</Text>
|
|
222
|
+
<Text onPress={openLink}
|
|
223
|
+
style={{
|
|
224
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
225
|
+
color: props.theme?.button.primary,
|
|
226
|
+
textDecorationLine: 'underline',
|
|
227
|
+
flexWrap: 'wrap',
|
|
228
|
+
}}>SUN@HOME</Text>
|
|
229
|
+
<Text style={{ color: props.theme?.global.fontColor }}>{text[1]}</Text>
|
|
230
|
+
</Text>
|
|
236
231
|
}
|
|
237
232
|
|
|
238
233
|
const randomIcon = () => {
|
|
@@ -433,66 +428,66 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
433
428
|
marginTop: cx(26),
|
|
434
429
|
}}>
|
|
435
430
|
{state.planList.length === 8 && <View
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
431
|
+
style={{ marginVertical: cx(10), flexDirection: 'row', alignItems: 'center', width: width - cx(48) }}>
|
|
432
|
+
<Image style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.warning }} source={{ uri: res.ic_warning_amber }} />
|
|
433
|
+
<Text
|
|
434
|
+
style={{
|
|
435
|
+
flexWrap: 'wrap',
|
|
436
|
+
fontSize: cx(12),
|
|
437
|
+
color: props.theme?.global.fontColor
|
|
438
|
+
}}>{I18n.getLang('add_new_trigger_time_warning_max_number_text')}</Text>
|
|
444
439
|
</View>}
|
|
445
440
|
{state.planList.length < 8 &&
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
441
|
+
<>
|
|
442
|
+
<Text
|
|
443
|
+
style={{
|
|
444
|
+
fontSize: cx(16),
|
|
445
|
+
fontWeight: 'bold',
|
|
446
|
+
color: props.theme?.global.fontColor,
|
|
447
|
+
}}>{I18n.getLang('bio_ryhthm_default_subheadline_text')}</Text>
|
|
448
|
+
<TouchableOpacity
|
|
449
|
+
onPress={() => {
|
|
450
|
+
const ids: number[] = state.planList.map(p => p.id)
|
|
451
|
+
const newPlan: Plan = {
|
|
452
|
+
id: Math.max(...ids) + 1,
|
|
453
|
+
icon: res.rhythm_icon1,
|
|
454
|
+
time: 0,
|
|
455
|
+
name: '',
|
|
456
|
+
colorTemperature: 0,
|
|
457
|
+
brightness: 100,
|
|
458
|
+
action: [
|
|
459
|
+
{
|
|
460
|
+
uri: 'model/attribute/set/LightCtrl/ColorTemperature',
|
|
461
|
+
startValue: `${colorTemperatureValue(0)}`,
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
uri: 'model/attribute/set/LightCtrl/Brightness',
|
|
465
|
+
startValue: '100',
|
|
466
|
+
},
|
|
467
|
+
],
|
|
468
|
+
enable: true,
|
|
469
|
+
iconId: randomIcon(),
|
|
470
|
+
}
|
|
471
|
+
const editPageParams: BiorhythmEditPageParams = {
|
|
472
|
+
planData: newPlan,
|
|
473
|
+
isAdd: true,
|
|
474
|
+
onPlanEdited,
|
|
475
|
+
onPlanDelete,
|
|
476
|
+
nameRepeat,
|
|
477
|
+
minimumEnable,
|
|
478
|
+
iconIdList: state.planList?.map(item => {
|
|
479
|
+
return item.iconId
|
|
480
|
+
}),
|
|
481
|
+
isMixLight: params.isMixLight,
|
|
482
|
+
isSupportTemperature: params.isSupportTemperature,
|
|
483
|
+
isSupportBrightness: params.isSupportBrightness,
|
|
484
|
+
showDeleteBtn
|
|
485
|
+
}
|
|
486
|
+
navigation.navigate(ui_biz_routerKey.group_ui_biz_biological_detail, editPageParams)
|
|
487
|
+
}}>
|
|
488
|
+
<Image source={{ uri: res.biorhythom_add }} style={{ height: cx(24), width: cx(24), tintColor: props.theme?.icon.primary }} />
|
|
489
|
+
</TouchableOpacity>
|
|
490
|
+
</>
|
|
496
491
|
}
|
|
497
492
|
</View>
|
|
498
493
|
<FlatList
|
|
@@ -3,9 +3,14 @@ import {ScrollView, StyleSheet, Text, View} from 'react-native'
|
|
|
3
3
|
import {useReactive, useUpdateEffect} from 'ahooks'
|
|
4
4
|
import {Utils} from 'tuya-panel-kit'
|
|
5
5
|
import Page from '@ledvance/base/src/components/Page'
|
|
6
|
-
import {
|
|
6
|
+
import {useUAGroupInfo} from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
7
7
|
import I18n from '@ledvance/base/src/i18n'
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
LightBehaviorPageParams,
|
|
10
|
+
PowerOffMemoryModel,
|
|
11
|
+
useDoNotDisturbControl,
|
|
12
|
+
usePowerOffMemory
|
|
13
|
+
} from './PowerOnBehaviorActions'
|
|
9
14
|
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
10
15
|
import Card from '@ledvance/base/src/components/Card'
|
|
11
16
|
import LampAdjustView from '@ledvance/base/src/components/LampAdjustView'
|
|
@@ -23,18 +28,32 @@ export enum PowerMemoryMode {
|
|
|
23
28
|
Last = 1,
|
|
24
29
|
Custom = 2
|
|
25
30
|
}
|
|
31
|
+
|
|
32
|
+
const initCustomValue = (powerMemory: PowerOffMemoryModel) => {
|
|
33
|
+
const newPowerMemory = cloneDeep(powerMemory)
|
|
34
|
+
if (newPowerMemory.isColor) {
|
|
35
|
+
newPowerMemory.temperature = 100
|
|
36
|
+
newPowerMemory.bright = 100
|
|
37
|
+
} else {
|
|
38
|
+
newPowerMemory.hue = 0
|
|
39
|
+
newPowerMemory.sat = 100
|
|
40
|
+
newPowerMemory.hue = 100
|
|
41
|
+
}
|
|
42
|
+
return newPowerMemory
|
|
43
|
+
}
|
|
44
|
+
|
|
26
45
|
const LightBehaviorPage = (props: { theme?: ThemeType }) => {
|
|
27
46
|
const params = useParams<LightBehaviorPageParams>()
|
|
28
|
-
const
|
|
47
|
+
const uaGroupInfo = useUAGroupInfo()
|
|
29
48
|
const [powerMemory, setPowerMemory] = usePowerOffMemory()
|
|
30
49
|
const [doNotDisturb, setDoNotDisturb] = useDoNotDisturbControl()
|
|
31
50
|
const state = useReactive({
|
|
32
51
|
loading: false,
|
|
33
|
-
powerMemory:
|
|
52
|
+
powerMemory: initCustomValue(powerMemory),
|
|
34
53
|
})
|
|
35
54
|
|
|
36
55
|
useUpdateEffect(() => {
|
|
37
|
-
state.powerMemory = powerMemory
|
|
56
|
+
state.powerMemory = cloneDeep(powerMemory)
|
|
38
57
|
}, [JSON.stringify(powerMemory)])
|
|
39
58
|
|
|
40
59
|
const styles = StyleSheet.create({
|
|
@@ -56,7 +75,7 @@ const LightBehaviorPage = (props: { theme?: ThemeType }) => {
|
|
|
56
75
|
|
|
57
76
|
return (
|
|
58
77
|
<Page
|
|
59
|
-
backText={
|
|
78
|
+
backText={uaGroupInfo.name}
|
|
60
79
|
headlineText={I18n.getLang('light_sources_specific_settings_power_off')}
|
|
61
80
|
loading={state.loading}>
|
|
62
81
|
<ScrollView style={styles.root} nestedScrollEnabled={true}>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import {ScrollView, StyleSheet} from 'react-native'
|
|
3
3
|
import Page from '@ledvance/base/src/components/Page'
|
|
4
|
-
import {
|
|
4
|
+
import {useUAGroupInfo} from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
5
5
|
import I18n from '@ledvance/base/src/i18n'
|
|
6
6
|
import {PowerBehaviorPageParams, usePowerBehavior} from './PowerOnBehaviorActions'
|
|
7
7
|
import {Utils} from 'tuya-panel-kit'
|
|
@@ -21,7 +21,7 @@ const RELAY_STATUS_MEMORY = 'memory'
|
|
|
21
21
|
|
|
22
22
|
const PlugBehaviorPage = () => {
|
|
23
23
|
const params = useParams<PowerBehaviorPageParams>()
|
|
24
|
-
const
|
|
24
|
+
const uaGroupInfo = useUAGroupInfo()
|
|
25
25
|
const [powerMemories, setPowerMemories] = usePowerBehavior(params.powerBehaviorKeys)
|
|
26
26
|
|
|
27
27
|
const state = useReactive({
|
|
@@ -42,7 +42,7 @@ const PlugBehaviorPage = () => {
|
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
44
|
<Page
|
|
45
|
-
backText={
|
|
45
|
+
backText={uaGroupInfo.name}
|
|
46
46
|
headlineText={I18n.getLang('light_sources_specific_settings_power_off')}
|
|
47
47
|
loading={state.loading}>
|
|
48
48
|
<ScrollView style={styles.root} nestedScrollEnabled={true}>
|
|
@@ -2,6 +2,7 @@ import {useFeatureHook} from "@ledvance/base/src/models/modules/NativePropsSlice
|
|
|
2
2
|
import {Result} from "@ledvance/base/src/models/modules/Result"
|
|
3
3
|
import {Utils} from 'tuya-panel-kit';
|
|
4
4
|
import {spliceByStep} from "@ledvance/base/src/utils/common";
|
|
5
|
+
import {cloneDeep} from "lodash";
|
|
5
6
|
|
|
6
7
|
const { hexStringToNumber } = Utils.StringUtils;
|
|
7
8
|
|
|
@@ -109,7 +110,8 @@ export function dp2Obj(dp: string): PowerOffMemoryModel {
|
|
|
109
110
|
};
|
|
110
111
|
}
|
|
111
112
|
|
|
112
|
-
export function obj2Dp(
|
|
113
|
+
export function obj2Dp(powerMemory: PowerOffMemoryModel): string {
|
|
114
|
+
const obj = cloneDeep(powerMemory)
|
|
113
115
|
const version = '00';
|
|
114
116
|
if (obj.isColor) {
|
|
115
117
|
obj.bright = 0
|
|
@@ -56,7 +56,9 @@ const RemoteSwitchPage = (props: { theme?: ThemeType }) => {
|
|
|
56
56
|
|
|
57
57
|
return (<Page
|
|
58
58
|
backText={uaGroupInfo.name}
|
|
59
|
-
loading={state.loading}
|
|
59
|
+
loading={state.loading}
|
|
60
|
+
headlineText={I18n.getLang('light_sources_specific_settings_remote_control')}
|
|
61
|
+
>
|
|
60
62
|
<View style={[styles.titleBGView, styles.shadow]}>
|
|
61
63
|
<Text style={styles.title}>{I18n.getLang('light_sources_specific_settings_remote_control')}</Text>
|
|
62
64
|
<View style={[styles.colorBlock, { backgroundColor: 'red', opacity: 0 }]} />
|