@ledvance/ui-biz-bundle 1.1.69 → 1.1.71
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/.babelrc +31 -31
- package/.eslintignore +5 -5
- package/.eslintrc.js +27 -27
- package/.prettierrc.js +1 -1
- package/.versionrc +5 -5
- package/package.json +74 -74
- package/rn-cli.config.js +8 -8
- package/src/hooks/DeviceDpStateHooks.d.ts +14 -14
- package/src/hooks/DeviceDpStateHooks.ts +50 -50
- package/src/modules/biorhythm/BiorhythmActions.d.ts +8 -8
- package/src/modules/biorhythm/BiorhythmActions.ts +324 -324
- package/src/modules/biorhythm/BiorhythmBean.d.ts +58 -58
- package/src/modules/biorhythm/BiorhythmBean.ts +230 -230
- package/src/modules/biorhythm/BiorhythmEditPage.d.ts +14 -14
- package/src/modules/biorhythm/BiorhythmEditPage.tsx +324 -324
- package/src/modules/biorhythm/BiorhythmPage.d.ts +10 -10
- package/src/modules/biorhythm/BiorhythmPage.tsx +796 -796
- package/src/modules/biorhythm/IconSelect.d.ts +2 -2
- package/src/modules/biorhythm/IconSelect.tsx +81 -81
- package/src/modules/biorhythm/Router.ts +34 -34
- package/src/modules/biorhythm/circular/ItemIcon.d.ts +22 -22
- package/src/modules/biorhythm/circular/ItemIcon.tsx +172 -172
- package/src/modules/biorhythm/circular/Progress.d.ts +24 -24
- package/src/modules/biorhythm/circular/Progress.tsx +411 -411
- package/src/modules/biorhythm/circular/TimeCircular.d.ts +11 -11
- package/src/modules/biorhythm/circular/TimeCircular.tsx +70 -70
- package/src/modules/biorhythm/iconListData.d.ts +7 -7
- package/src/modules/biorhythm/iconListData.ts +29 -29
- package/src/modules/biorhythm/pIdList.d.ts +2 -2
- package/src/modules/biorhythm/pIdList.ts +35 -35
- package/src/modules/biorhythm/res/BiologicalRes.d.ts +43 -43
- package/src/modules/biorhythm/res/BiologicalRes.ts +41 -41
- package/src/modules/config/ldvConfig.d.ts +2 -2
- package/src/modules/config/ldvConfig.tsx +18 -18
- package/src/modules/fixedTime/FixedTimeActions.ts +173 -173
- package/src/modules/fixedTime/FixedTimeDetailPage.tsx +372 -372
- package/src/modules/fixedTime/FixedTimePage.tsx +213 -213
- package/src/modules/fixedTime/Router.ts +26 -26
- package/src/modules/flags/FlagActions.ts +267 -267
- package/src/modules/flags/FlagEditPage.tsx +441 -441
- package/src/modules/flags/FlagInfo.tsx +563 -563
- package/src/modules/flags/FlagItem.tsx +90 -90
- package/src/modules/flags/FlagPage.tsx +277 -277
- package/src/modules/flags/Router.ts +25 -25
- package/src/modules/history/HistoryPage.d.ts +2 -2
- package/src/modules/history/HistoryPage.tsx +261 -261
- package/src/modules/history/Router.ts +16 -16
- package/src/modules/history/SwitchHistoryPageActions.d.ts +14 -14
- package/src/modules/history/SwitchHistoryPageActions.ts +76 -76
- package/src/modules/mood/AddMoodPage.d.ts +10 -10
- package/src/modules/mood/AddMoodPage.tsx +792 -792
- package/src/modules/mood/DynamicMoodEditorPage.d.ts +6 -6
- package/src/modules/mood/DynamicMoodEditorPage.tsx +561 -561
- package/src/modules/mood/FantasyMood.tsx +176 -176
- package/src/modules/mood/FantasyMoodEditPage.tsx +582 -582
- package/src/modules/mood/FantasyMoodItem.tsx +104 -104
- package/src/modules/mood/FantasyRouter.ts +35 -35
- package/src/modules/mood/MixMood/AddMixMoodPage.tsx +247 -247
- package/src/modules/mood/MixMood/MixMoodActions.ts +128 -128
- package/src/modules/mood/MixMood/MixMoodEditPage.tsx +721 -721
- package/src/modules/mood/MixMood/MixMoodItem.tsx +134 -134
- package/src/modules/mood/MixMood/MixMoodPage.tsx +326 -326
- package/src/modules/mood/MixMood/MixSceneBeans.ts +364 -364
- package/src/modules/mood/MixMood/RecommendMixMoodItem.tsx +69 -69
- package/src/modules/mood/MixMood/Router.ts +44 -44
- package/src/modules/mood/MoodItem.d.ts +11 -11
- package/src/modules/mood/MoodItem.tsx +114 -114
- package/src/modules/mood/MoodPage.d.ts +16 -16
- package/src/modules/mood/MoodPage.tsx +296 -296
- package/src/modules/mood/RecommendMoodItem.d.ts +13 -13
- package/src/modules/mood/RecommendMoodItem.tsx +74 -74
- package/src/modules/mood/Router.ts +53 -53
- package/src/modules/mood/StaticMoodEditorPage.d.ts +16 -16
- package/src/modules/mood/StaticMoodEditorPage.tsx +320 -320
- package/src/modules/mood/tools.d.ts +3 -3
- package/src/modules/mood/tools.ts +11 -11
- package/src/modules/music/MusicDataBean.d.ts +47 -47
- package/src/modules/music/MusicDataBean.ts +167 -167
- package/src/modules/music/MusicManager.d.ts +27 -27
- package/src/modules/music/MusicManager.ts +207 -207
- package/src/modules/music/MusicPage.d.ts +10 -10
- package/src/modules/music/MusicPage.tsx +347 -347
- package/src/modules/music/MusicPageActions.d.ts +35 -35
- package/src/modules/music/MusicPageActions.ts +317 -317
- package/src/modules/music/Router.ts +16 -16
- package/src/modules/music/SelecetGenre.d.ts +7 -7
- package/src/modules/music/SelecetGenre.tsx +63 -63
- package/src/modules/music/color.d.ts +2 -2
- package/src/modules/music/color.ts +73 -73
- package/src/modules/music/res/index.d.ts +10 -10
- package/src/modules/music/res/index.ts +9 -9
- package/src/modules/powerOnBehavior/PowerOnBehaviorActions.ts +11 -11
- package/src/modules/powerOnBehavior/PowerOnBehaviorPage.tsx +173 -173
- package/src/modules/powerOnBehavior/Router.ts +16 -16
- package/src/modules/randomTime/RandomTimeActions.ts +160 -160
- package/src/modules/randomTime/RandomTimeDetailPage.tsx +337 -337
- package/src/modules/randomTime/RandomTimePage.tsx +214 -214
- package/src/modules/randomTime/Router.ts +25 -25
- package/src/modules/randomTime/Summary.tsx +122 -122
- package/src/modules/scene/SceneAction.d.ts +13 -13
- package/src/modules/scene/SceneAction.ts +473 -473
- package/src/modules/scene/SceneDetailPage.d.ts +1 -1
- package/src/modules/scene/SceneDetailPage.tsx +421 -421
- package/src/modules/scene/SceneInfo.d.ts +72 -72
- package/src/modules/scene/SceneInfo.ts +1059 -1059
- package/src/modules/scene/ScenePage.d.ts +7 -7
- package/src/modules/scene/ScenePage.tsx +147 -147
- package/src/modules/select/SelectPage.d.ts +12 -12
- package/src/modules/select/SelectPage.tsx +137 -137
- package/src/modules/sleepWakeup/DeviceState.d.ts +9 -9
- package/src/modules/sleepWakeup/DeviceState.tsx +99 -99
- package/src/modules/sleepWakeup/LdvScheduleItem.d.ts +15 -15
- package/src/modules/sleepWakeup/LdvScheduleItem.tsx +176 -176
- package/src/modules/sleepWakeup/Router.ts +25 -25
- package/src/modules/sleepWakeup/SleepWakeUpActions.d.ts +2 -2
- package/src/modules/sleepWakeup/SleepWakeUpActions.ts +180 -180
- package/src/modules/sleepWakeup/SleepWakeUpDetailPage.d.ts +2 -2
- package/src/modules/sleepWakeup/SleepWakeUpDetailPage.tsx +616 -616
- package/src/modules/sleepWakeup/SleepWakeUpPage.d.ts +13 -13
- package/src/modules/sleepWakeup/SleepWakeUpPage.tsx +424 -424
- package/src/modules/sleepWakeup/utils.d.ts +44 -44
- package/src/modules/sleepWakeup/utils.ts +253 -253
- package/src/modules/timeSchedule/DeviceState.d.ts +17 -17
- package/src/modules/timeSchedule/DeviceState.tsx +94 -94
- package/src/modules/timeSchedule/LdvScheduleItem.d.ts +15 -15
- package/src/modules/timeSchedule/LdvScheduleItem.tsx +130 -130
- package/src/modules/timeSchedule/ManualSetting.d.ts +14 -14
- package/src/modules/timeSchedule/ManualSetting.tsx +219 -219
- package/src/modules/timeSchedule/MoodSetting.d.ts +11 -11
- package/src/modules/timeSchedule/MoodSetting.tsx +228 -228
- package/src/modules/timeSchedule/Router.ts +25 -25
- package/src/modules/timeSchedule/ScheduleScene.d.ts +6 -6
- package/src/modules/timeSchedule/ScheduleScene.tsx +144 -144
- package/src/modules/timeSchedule/SingleLightView.d.ts +12 -12
- package/src/modules/timeSchedule/SingleLightView.tsx +175 -175
- package/src/modules/timeSchedule/TimeScheduleBean.d.ts +14 -14
- package/src/modules/timeSchedule/TimeScheduleBean.ts +18 -18
- package/src/modules/timeSchedule/TimeScheduleEditpage.d.ts +6 -6
- package/src/modules/timeSchedule/TimeScheduleEditpage.tsx +765 -765
- package/src/modules/timeSchedule/TimeSchedulePage.d.ts +13 -13
- package/src/modules/timeSchedule/TimeSchedulePage.tsx +358 -358
- package/src/modules/timeSchedule/components/ColorList.ts +23 -23
- package/src/modules/timeSchedule/components/LampSwitchCard.tsx +106 -106
- package/src/modules/timeSchedule/mix/MixLightActions.d.ts +3 -3
- package/src/modules/timeSchedule/mix/MixLightActions.ts +49 -49
- package/src/modules/timeSchedule/mix/MixLightBean.d.ts +10 -10
- package/src/modules/timeSchedule/mix/MixLightBean.ts +9 -9
- package/src/modules/timeSchedule/mix/MixLightView.d.ts +7 -7
- package/src/modules/timeSchedule/mix/MixLightView.tsx +197 -197
- package/src/modules/timeSchedule/utils.d.ts +1 -1
- package/src/modules/timeSchedule/utils.ts +6 -6
- package/src/modules/timer/Router.ts +16 -16
- package/src/modules/timer/TimerPage.d.ts +11 -11
- package/src/modules/timer/TimerPage.tsx +384 -384
- package/src/modules/timer/TimerPageAction.d.ts +22 -22
- package/src/modules/timer/TimerPageAction.ts +131 -131
- package/src/navigation/Routers.d.ts +15 -15
- package/src/navigation/Routers.ts +46 -46
- package/src/navigation/tools.d.ts +9 -9
- package/src/navigation/tools.ts +21 -21
- package/src/newModules/biorhythm/BiorhythmActions.ts +62 -11
- package/src/newModules/biorhythm/BiorhythmPage.tsx +1 -4
- package/src/newModules/childLock/ChildLockPage.tsx +97 -97
- package/src/newModules/childLock/Router.ts +16 -16
- package/src/newModules/energyConsumption/EnergyConsumptionActions.ts +23 -23
- package/src/newModules/energyConsumption/EnergyConsumptionChart.tsx +84 -84
- package/src/newModules/energyConsumption/EnergyConsumptionDetail.tsx +322 -322
- package/src/newModules/energyConsumption/EnergyConsumptionPage.tsx +393 -393
- package/src/newModules/energyConsumption/Router.ts +34 -34
- package/src/newModules/energyConsumption/co2Data.ts +23655 -23655
- package/src/newModules/energyConsumption/component/BarChart.tsx +93 -93
- package/src/newModules/energyConsumption/component/EnergyModal.tsx +284 -284
- package/src/newModules/energyConsumption/component/Overview.tsx +118 -118
- package/src/newModules/fixedTime/FixedTimeActions.ts +241 -241
- package/src/newModules/fixedTime/FixedTimeDetailPage.tsx +345 -345
- package/src/newModules/fixedTime/FixedTimePage.tsx +302 -302
- package/src/newModules/fixedTime/Router.ts +25 -25
- package/src/newModules/lightMode/LightModePage.tsx +204 -204
- package/src/newModules/lightMode/Router.ts +16 -16
- package/src/newModules/mood/Interface.ts +5 -0
- package/src/newModules/mood/MixDynamicMoodEditor.tsx +8 -5
- package/src/newModules/mood/MoodActions.ts +32 -20
- package/src/newModules/mood/MoodItem.tsx +3 -3
- package/src/newModules/mood/MoodPage.tsx +31 -15
- package/src/newModules/mood/MoodParse.ts +5 -6
- package/src/newModules/mood/RecommendMoodItem.tsx +3 -3
- package/src/newModules/mood/Router.ts +9 -0
- package/src/newModules/overchargeSwitch/OverchargeSwitchPage.tsx +96 -96
- package/src/newModules/overchargeSwitch/Router.ts +16 -16
- package/src/newModules/powerOnBehavior/LightBehaviorPage.tsx +266 -266
- package/src/newModules/powerOnBehavior/PlugBehaviorPage.tsx +173 -173
- package/src/newModules/powerOnBehavior/PowerOnBehaviorActions.ts +106 -106
- package/src/newModules/powerOnBehavior/Router.ts +27 -27
- package/src/newModules/randomTime/RandomTimeActions.ts +238 -238
- package/src/newModules/randomTime/RandomTimeDetailPage.tsx +325 -325
- package/src/newModules/randomTime/RandomTimePage.tsx +299 -299
- package/src/newModules/randomTime/Router.ts +25 -25
- package/src/newModules/randomTime/Summary.tsx +116 -116
- package/src/newModules/remoteControl/RemoteControlActions.ts +5 -5
- package/src/newModules/remoteControl/RemoteControlPage.tsx +51 -51
- package/src/newModules/remoteControl/Router.ts +15 -15
- package/src/newModules/select/Route.ts +16 -16
- package/src/newModules/select/SelectPage.d.ts +12 -12
- package/src/newModules/select/SelectPage.tsx +137 -137
- package/src/newModules/sleepWakeUp/Interface.ts +69 -69
- package/src/newModules/sleepWakeUp/Router.ts +24 -24
- package/src/newModules/sleepWakeUp/SleepWakeUpActions.ts +317 -317
- package/src/newModules/sleepWakeUp/SleepWakeUpDetailPage.tsx +661 -661
- package/src/newModules/sleepWakeUp/SleepWakeUpPage.tsx +455 -455
- package/src/newModules/sleepWakeUp/utils.ts +253 -253
- package/src/newModules/swithInching/Router.ts +16 -16
- package/src/newModules/swithInching/SwithInching.tsx +231 -231
- package/src/newModules/swithInching/SwithInchingAction.ts +55 -55
- package/src/newModules/swithInching/pickerView.tsx +91 -91
- package/src/newModules/timeSchedule/Interface.ts +142 -142
- package/src/newModules/timeSchedule/Router.ts +25 -25
- package/src/newModules/timeSchedule/TimeScheduleActions.ts +53 -53
- package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +648 -648
- package/src/newModules/timeSchedule/TimeSchedulePage.tsx +253 -253
- package/src/newModules/timeSchedule/components/ManuaSettings.tsx +460 -460
- package/src/newModules/timeSchedule/components/ScheduleCard.tsx +125 -125
- package/tsconfig.json +50 -50
|
@@ -1,766 +1,766 @@
|
|
|
1
|
-
import React, { useCallback, useEffect } from 'react'
|
|
2
|
-
import { FlatList, Image, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
|
|
3
|
-
import Page from '@ledvance/base/src/components/Page'
|
|
4
|
-
import TextField from '@ledvance/base/src/components/TextField'
|
|
5
|
-
import I18n from '@ledvance/base/src/i18n'
|
|
6
|
-
import { useNavigation, useRoute } from '@react-navigation/native'
|
|
7
|
-
import LdvTopName from '@ledvance/base/src/components/ldvTopName'
|
|
8
|
-
import LdvPickerView from '@ledvance/base/src/components/ldvPickerView'
|
|
9
|
-
import LdvWeekView from '@ledvance/base/src/components/weekSelect'
|
|
10
|
-
import { SwitchButton, Utils } from 'tuya-panel-kit'
|
|
11
|
-
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
12
|
-
import DeleteButton from '@ledvance/base/src/components/DeleteButton'
|
|
13
|
-
import { loopText, toFixed } from '@ledvance/base/src/utils/common'
|
|
14
|
-
import { NativeApi } from '@ledvance/base/src/api/native'
|
|
15
|
-
import { isUVCFanDevice, useDeviceId } from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
16
|
-
import res from '@ledvance/base/src/res'
|
|
17
|
-
import { useReactive } from 'ahooks'
|
|
18
|
-
import { dpItem, TimeSchedulePageRouteParams } from './TimeSchedulePage'
|
|
19
|
-
import { cloneDeep, differenceBy, isEmpty, isEqual } from 'lodash'
|
|
20
|
-
import DeviceState from './DeviceState'
|
|
21
|
-
import { getHexByHSV, getHSVByHex } from '@ledvance/base/src/utils'
|
|
22
|
-
import { Buffer } from 'buffer'
|
|
23
|
-
import { dp2Obj, obj2Dp } from './mix/MixLightActions'
|
|
24
|
-
import { dp2Obj as sencePp2Obj, obj2Dp as senceObj2Dp } from '../scene/SceneAction'
|
|
25
|
-
import { COLOUR, SCENE, WHITE } from '../../hooks/DeviceDpStateHooks'
|
|
26
|
-
import { ColorList } from './components/ColorList'
|
|
27
|
-
|
|
28
|
-
const { convertX: cx } = Utils.RatioUtils
|
|
29
|
-
|
|
30
|
-
export interface ScheduleItemDp extends dpItem {
|
|
31
|
-
enable: boolean
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
interface TimeScheduleEditPageParams extends TimeSchedulePageRouteParams {
|
|
35
|
-
mode: 'add' | 'edit'
|
|
36
|
-
scheduleItem: any,
|
|
37
|
-
dps: ScheduleItemDp[]
|
|
38
|
-
dpCodes: Record<any, any>
|
|
39
|
-
reloadData: () => void
|
|
40
|
-
deleteDialog: (item: any) => Promise<void>
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const TimeScheduleEditPage = () => {
|
|
44
|
-
const navigation = useNavigation()
|
|
45
|
-
const devId = useDeviceId()
|
|
46
|
-
const route = useRoute()
|
|
47
|
-
const isUVCFan = isUVCFanDevice()
|
|
48
|
-
const props = cloneDeep(route.params) as TimeScheduleEditPageParams
|
|
49
|
-
const { scheduleItem, dps, reloadData, deleteDialog, dpCodes } = props
|
|
50
|
-
const state = useReactive({
|
|
51
|
-
loading: false,
|
|
52
|
-
hour: '00',
|
|
53
|
-
minute: '00',
|
|
54
|
-
loop: [0, 0, 0, 0, 0, 0, 0],
|
|
55
|
-
isNotification: false,
|
|
56
|
-
name: '',
|
|
57
|
-
selectedSkill: [] as ScheduleItemDp[],
|
|
58
|
-
skillList: [] as ScheduleItemDp[],
|
|
59
|
-
isManual: true,
|
|
60
|
-
singleActions: {
|
|
61
|
-
enable: true, // colorLightSwitch
|
|
62
|
-
whiteLightSwitch: true,
|
|
63
|
-
isColor: true,
|
|
64
|
-
h: 0,
|
|
65
|
-
s: 100,
|
|
66
|
-
v: 100,
|
|
67
|
-
temperature: 100,
|
|
68
|
-
brightness: 100,
|
|
69
|
-
colorDiskActiveKey: 0,
|
|
70
|
-
colors: ColorList[0],
|
|
71
|
-
activeKey: 1,
|
|
72
|
-
fanEnable: true,
|
|
73
|
-
fanSpeed: 1,
|
|
74
|
-
fanMode: 'normal',
|
|
75
|
-
},
|
|
76
|
-
mixActions: {
|
|
77
|
-
whiteLightSwitch: true,
|
|
78
|
-
colorLightSwitch: false,
|
|
79
|
-
mixRgbcwEnabled: true,
|
|
80
|
-
hue: 360,
|
|
81
|
-
sat: 100,
|
|
82
|
-
lightness: 100,
|
|
83
|
-
brightness: 100,
|
|
84
|
-
colorTempPercent: 100,
|
|
85
|
-
},
|
|
86
|
-
actionScene: {} as any,
|
|
87
|
-
dpsValue: {} as Record<string, any>,
|
|
88
|
-
})
|
|
89
|
-
console.log(props, '< --- props')
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
// 设置功能列表
|
|
92
|
-
if (props.mode === 'edit' && scheduleItem) {
|
|
93
|
-
state.hour = scheduleItem.time.split(':')[0]
|
|
94
|
-
state.minute = scheduleItem.time.split(':')[1]
|
|
95
|
-
state.name = scheduleItem.aliasName
|
|
96
|
-
state.isNotification = !!scheduleItem.isAppPush
|
|
97
|
-
state.loop = scheduleItem.loops.split('').map((mItem: string) => parseInt(mItem))
|
|
98
|
-
state.selectedSkill = props.isCeilingLight ? props.dps : dps.reduce((pre, cur) => {
|
|
99
|
-
if (scheduleItem.dps[cur.dpId] !== undefined) {
|
|
100
|
-
const result = { ...cur, enable: scheduleItem.dps[cur.dpId] }
|
|
101
|
-
pre.push(result)
|
|
102
|
-
}
|
|
103
|
-
return pre
|
|
104
|
-
}, [] as ScheduleItemDp[])
|
|
105
|
-
state.skillList = differenceBy(dps, state.selectedSkill, 'dpId')
|
|
106
|
-
|
|
107
|
-
if (props.dps2lightData) {
|
|
108
|
-
console.log(scheduleItem.dps, '< --- dps')
|
|
109
|
-
const lightData = props.dps2lightData(scheduleItem.dps)
|
|
110
|
-
console.log(lightData, '< --- lightData')
|
|
111
|
-
state.singleActions = {
|
|
112
|
-
...state.singleActions,
|
|
113
|
-
...lightData.singleActions,
|
|
114
|
-
}
|
|
115
|
-
state.isManual = lightData.isManual
|
|
116
|
-
state.actionScene = lightData.actionScene
|
|
117
|
-
|
|
118
|
-
return
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// single
|
|
122
|
-
if (scheduleItem.dps[dpCodes.switch_led] !== undefined) {
|
|
123
|
-
state.singleActions.enable = scheduleItem.dps[dpCodes.switch_led]
|
|
124
|
-
}
|
|
125
|
-
if (scheduleItem.dps[dpCodes.work_mode] !== undefined) {
|
|
126
|
-
state.singleActions.isColor = scheduleItem.dps[dpCodes.work_mode] === COLOUR
|
|
127
|
-
}
|
|
128
|
-
if (scheduleItem.dps[dpCodes.fan_switch] !== undefined) {
|
|
129
|
-
state.singleActions.fanEnable = scheduleItem.dps[dpCodes.fan_switch]
|
|
130
|
-
}
|
|
131
|
-
state.singleActions.brightness = scheduleItem.dps[dpCodes.bright_value] / 10 || 100
|
|
132
|
-
state.singleActions.temperature = scheduleItem.dps[dpCodes.temp_value] / 10 || 100
|
|
133
|
-
state.singleActions.fanSpeed = scheduleItem.dps[dpCodes.fan_speed] || 1
|
|
134
|
-
state.singleActions.fanMode = scheduleItem.dps[dpCodes.fan_mode] || 'normal'
|
|
135
|
-
const hsv = getHSVByHex(scheduleItem.dps[dpCodes.colour_data] || '0000000003e8')
|
|
136
|
-
state.singleActions.h = hsv.h
|
|
137
|
-
state.singleActions.s = Math.round(hsv.s / 10)
|
|
138
|
-
state.singleActions.v = Math.round(hsv.v / 10)
|
|
139
|
-
|
|
140
|
-
// mix
|
|
141
|
-
if (scheduleItem.dps[dpCodes.mix_rgbcw] !== undefined) {
|
|
142
|
-
const base64String = Buffer.from(scheduleItem.dps[dpCodes.mix_rgbcw], 'base64').toString('hex')
|
|
143
|
-
state.mixActions = dp2Obj(base64String)
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (scheduleItem.dps[dpCodes.scene_data] !== undefined) {
|
|
147
|
-
state.actionScene = sencePp2Obj(scheduleItem.dps[dpCodes.scene_data], !!props.isFanLamp, isUVCFan)
|
|
148
|
-
state.isManual = false
|
|
149
|
-
}
|
|
150
|
-
if (scheduleItem.dps[dpCodes.mix_light_scene] !== undefined) {
|
|
151
|
-
const sceneDp = scheduleItem.dps[dpCodes.mix_light_scene]
|
|
152
|
-
state.actionScene = Buffer.from(sceneDp, 'base64').toString('hex')
|
|
153
|
-
state.isManual = false
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
} else {
|
|
157
|
-
const date = new Date()
|
|
158
|
-
state.hour = toFixed(date.getHours(), 2)
|
|
159
|
-
state.minute = toFixed(date.getMinutes(), 2)
|
|
160
|
-
// 当dps长度只有1个的时候或者是mixLight灯时默认选中,
|
|
161
|
-
if (!showClearIcon()) {
|
|
162
|
-
state.selectedSkill = dps.map(item => ({
|
|
163
|
-
...item,
|
|
164
|
-
enable: true,
|
|
165
|
-
}))
|
|
166
|
-
} else {
|
|
167
|
-
state.skillList = dps.map(item => ({
|
|
168
|
-
...item,
|
|
169
|
-
enable: true,
|
|
170
|
-
}))
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}, [])
|
|
174
|
-
|
|
175
|
-
const selectWeekAction = (idx: number) => {
|
|
176
|
-
state.loop = state.loop.map((item, tempIndex) => {
|
|
177
|
-
if (tempIndex === idx - 1) {
|
|
178
|
-
return item > 0 ? 0 : 1
|
|
179
|
-
}
|
|
180
|
-
return item
|
|
181
|
-
})
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
const manualCheck = () => {
|
|
185
|
-
return state.isManual && state.selectedSkill.length
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// 只支持风扇灯跟普通灯
|
|
189
|
-
const sceneCheck = () => {
|
|
190
|
-
if(props.isCeilingLight){
|
|
191
|
-
return (state.actionScene?.mainLamp?.nodes?.length) || (state.actionScene?.secondlyLamp?.nodes?.length)
|
|
192
|
-
}
|
|
193
|
-
return !state.isManual && state.skillList.length === 0 && state.actionScene && (state?.actionScene?.nodes || state?.actionScene?.value)
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
const saveEnable = () => {
|
|
197
|
-
return !state.loading
|
|
198
|
-
&& state.name.length && state.name.length <= 32
|
|
199
|
-
&& (manualCheck() || sceneCheck())
|
|
200
|
-
&& [
|
|
201
|
-
!isEqual(scheduleItem?.aliasName, state.name),
|
|
202
|
-
!isEqual(scheduleItem?.time, [state.hour, state.minute].join(':')),
|
|
203
|
-
!isEqual(scheduleItem?.loops, state.loop.join('')),
|
|
204
|
-
!isEqual(!!scheduleItem?.isAppPush, state.isNotification),
|
|
205
|
-
!isEqual(scheduleItem?.dps, getSendDps()),
|
|
206
|
-
].some(e => e)
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const saveAction = () => {
|
|
210
|
-
if (!saveEnable() || state.loading) {
|
|
211
|
-
return
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
state.loading = true
|
|
215
|
-
const params = {
|
|
216
|
-
time: [state.hour, state.minute].join(':'),
|
|
217
|
-
loops: state.loop.join(''),
|
|
218
|
-
dps: getAllDps(),
|
|
219
|
-
aliasName: state.name,
|
|
220
|
-
status: true,
|
|
221
|
-
notification: state.isNotification,
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (scheduleItem) {
|
|
225
|
-
NativeApi.editTimer(
|
|
226
|
-
devId,
|
|
227
|
-
{
|
|
228
|
-
...params,
|
|
229
|
-
id: scheduleItem.id,
|
|
230
|
-
},
|
|
231
|
-
res => {
|
|
232
|
-
if (res?.result) {
|
|
233
|
-
reloadData()
|
|
234
|
-
navigation.goBack()
|
|
235
|
-
state.loading = false
|
|
236
|
-
} else {
|
|
237
|
-
state.loading = false
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
},
|
|
241
|
-
)
|
|
242
|
-
} else {
|
|
243
|
-
NativeApi.addTimer(
|
|
244
|
-
devId,
|
|
245
|
-
params,
|
|
246
|
-
res => {
|
|
247
|
-
if (res?.result) {
|
|
248
|
-
reloadData()
|
|
249
|
-
navigation.goBack()
|
|
250
|
-
state.loading = false
|
|
251
|
-
} else {
|
|
252
|
-
state.loading = false
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
)
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
const getSendDps = () => {
|
|
260
|
-
if (props.lightData2dps) {
|
|
261
|
-
return props.lightData2dps({
|
|
262
|
-
singleActions: state.singleActions,
|
|
263
|
-
mixActions: state.mixActions,
|
|
264
|
-
actionScene: !isEmpty(state.actionScene) ? state.actionScene : undefined,
|
|
265
|
-
isManual: state.isManual,
|
|
266
|
-
})
|
|
267
|
-
}
|
|
268
|
-
if (state.isManual) {
|
|
269
|
-
if (props.isDIMLamp) {
|
|
270
|
-
return {
|
|
271
|
-
[dpCodes.bright_value]: state.singleActions.brightness * 10,
|
|
272
|
-
}
|
|
273
|
-
} else if (props.isFanLamp) {
|
|
274
|
-
let v = {}
|
|
275
|
-
const hasFan = !!state.selectedSkill.find(item => item.value.includes('fan'))
|
|
276
|
-
const hasLight = !!state.selectedSkill.find(item => item.value.includes('light'))
|
|
277
|
-
if (hasFan) {
|
|
278
|
-
v = {
|
|
279
|
-
...v,
|
|
280
|
-
[dpCodes.fan_mode]: state.singleActions.fanMode,
|
|
281
|
-
[dpCodes.fan_speed]: state.singleActions.fanSpeed,
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
if (hasLight) {
|
|
285
|
-
v = {
|
|
286
|
-
...v,
|
|
287
|
-
[dpCodes.work_mode]: WHITE,
|
|
288
|
-
[dpCodes.bright_value]: state.singleActions.brightness * 10,
|
|
289
|
-
[dpCodes.temp_value]: state.singleActions.temperature * 10,
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
return v
|
|
293
|
-
}
|
|
294
|
-
if (props.isTWLamp) {
|
|
295
|
-
return {
|
|
296
|
-
[dpCodes.work_mode]: WHITE,
|
|
297
|
-
[dpCodes.bright_value]: state.singleActions.brightness * 10,
|
|
298
|
-
[dpCodes.temp_value]: state.singleActions.temperature * 10,
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
if (props.isRGBWLamp) {
|
|
302
|
-
if (state.singleActions.isColor) {
|
|
303
|
-
const colorString = getHexByHSV({
|
|
304
|
-
h: state.singleActions.h,
|
|
305
|
-
s: state.singleActions.s * 10,
|
|
306
|
-
v: state.singleActions.v * 10,
|
|
307
|
-
})
|
|
308
|
-
return {
|
|
309
|
-
[dpCodes.work_mode]: COLOUR,
|
|
310
|
-
[dpCodes.colour_data]: colorString,
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
return {
|
|
314
|
-
[dpCodes.work_mode]: WHITE,
|
|
315
|
-
[dpCodes.temp_value]: state.singleActions.temperature * 10,
|
|
316
|
-
[dpCodes.bright_value]: state.singleActions.brightness * 10,
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
} else if (props.isMixRGBWLamp) {
|
|
320
|
-
const dpsString = obj2Dp(state.mixActions)
|
|
321
|
-
return {
|
|
322
|
-
[dpCodes.switch_led]: true,
|
|
323
|
-
[dpCodes.mix_rgbcw]: Buffer.from(dpsString, 'hex').toString('base64'),
|
|
324
|
-
}
|
|
325
|
-
} else if (props.isGlassRGBWLamp) {
|
|
326
|
-
const colorString = getHexByHSV({
|
|
327
|
-
h: state.singleActions.h,
|
|
328
|
-
s: state.singleActions.s * 10,
|
|
329
|
-
v: state.singleActions.v * 10,
|
|
330
|
-
})
|
|
331
|
-
return {
|
|
332
|
-
[dpCodes.work_mode]: COLOUR,
|
|
333
|
-
[dpCodes.colour_data]: colorString,
|
|
334
|
-
}
|
|
335
|
-
} else if (props.isGARDOT) {
|
|
336
|
-
const colorString = getHexByHSV({
|
|
337
|
-
h: state.singleActions.h,
|
|
338
|
-
s: state.singleActions.s * 10,
|
|
339
|
-
v: state.singleActions.v * 10,
|
|
340
|
-
})
|
|
341
|
-
return {
|
|
342
|
-
[dpCodes.work_mode]: COLOUR,
|
|
343
|
-
[dpCodes.colour_data]: colorString,
|
|
344
|
-
}
|
|
345
|
-
} else {
|
|
346
|
-
const colorString = getHexByHSV({
|
|
347
|
-
h: state.singleActions.h,
|
|
348
|
-
s: state.singleActions.s * 10,
|
|
349
|
-
v: state.singleActions.v * 10,
|
|
350
|
-
})
|
|
351
|
-
return {
|
|
352
|
-
[dpCodes.switch_led]: true,
|
|
353
|
-
[dpCodes.colour_data]: colorString,
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
} else {
|
|
357
|
-
if (props.isMixRGBWLamp) {
|
|
358
|
-
const v = {
|
|
359
|
-
[dpCodes.mix_light_scene]: Buffer.from(state.actionScene?.value, 'hex').toString('base64'),
|
|
360
|
-
[dpCodes.switch_led]: true,
|
|
361
|
-
[dpCodes.work_mode]: SCENE,
|
|
362
|
-
}
|
|
363
|
-
return props.isFanLamp ? {
|
|
364
|
-
...v,
|
|
365
|
-
[dpCodes.fan_switch]: state.actionScene.fanEnable,
|
|
366
|
-
[dpCodes.fan_speed]: state.actionScene.fanSpeed,
|
|
367
|
-
} : v
|
|
368
|
-
} else {
|
|
369
|
-
const v = {
|
|
370
|
-
[dpCodes.switch_led]: true,
|
|
371
|
-
// @ts-ignore
|
|
372
|
-
[dpCodes.scene_data]: senceObj2Dp({
|
|
373
|
-
id: Number(state?.actionScene?.id),
|
|
374
|
-
nodes: state?.actionScene?.nodes,
|
|
375
|
-
}, !!props.isFanLamp, isUVCFan),
|
|
376
|
-
[dpCodes.work_mode]: SCENE,
|
|
377
|
-
}
|
|
378
|
-
return props.isFanLamp ? {
|
|
379
|
-
...v,
|
|
380
|
-
[dpCodes.fan_switch]: state.actionScene.fanEnable,
|
|
381
|
-
[dpCodes.fan_speed]: state.actionScene.fanSpeed,
|
|
382
|
-
} : v
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
const getAllDps = () => {
|
|
389
|
-
const dpsValue = getSendDps()
|
|
390
|
-
if (state.isManual && !props.isMixRGBWLamp) {
|
|
391
|
-
let v = {}
|
|
392
|
-
state.selectedSkill.forEach(skill => {
|
|
393
|
-
v[skill.dpId] = skill.enable
|
|
394
|
-
})
|
|
395
|
-
return {
|
|
396
|
-
...v,
|
|
397
|
-
...dpsValue,
|
|
398
|
-
}
|
|
399
|
-
} else {
|
|
400
|
-
return dpsValue
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
const setSendDps = useCallback((actions, type) => {
|
|
405
|
-
state[type] = actions
|
|
406
|
-
}, [])
|
|
407
|
-
|
|
408
|
-
const renderItem = ({ item }) => {
|
|
409
|
-
return (
|
|
410
|
-
<View style={{
|
|
411
|
-
flexDirection: 'row',
|
|
412
|
-
justifyContent: 'space-between',
|
|
413
|
-
alignItems: 'center',
|
|
414
|
-
backgroundColor: '#fff',
|
|
415
|
-
marginBottom: cx(8),
|
|
416
|
-
}}>
|
|
417
|
-
<Text
|
|
418
|
-
style={{
|
|
419
|
-
color: '#000',
|
|
420
|
-
fontSize: 14,
|
|
421
|
-
marginHorizontal: cx(6),
|
|
422
|
-
marginVertical: cx(9),
|
|
423
|
-
}}
|
|
424
|
-
>
|
|
425
|
-
{item.label}
|
|
426
|
-
</Text>
|
|
427
|
-
{showClearIcon() && <TouchableOpacity onPress={() => handelSkill('lower', item)}>
|
|
428
|
-
<Image style={{ width: cx(16), height: cx(16), marginRight: cx(5) }} source={res.ic_arrows_nav_clear}/>
|
|
429
|
-
</TouchableOpacity>}
|
|
430
|
-
</View>
|
|
431
|
-
)
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
const handelSkill = (handelType: string, skill: ScheduleItemDp) => {
|
|
435
|
-
if (handelType === 'add') {
|
|
436
|
-
state.selectedSkill = [...state.selectedSkill, skill]
|
|
437
|
-
state.skillList = state.skillList.filter(item => item.dpId !== skill.dpId)
|
|
438
|
-
} else {
|
|
439
|
-
state.skillList = [...state.skillList, skill]
|
|
440
|
-
state.selectedSkill = state.selectedSkill.filter(item => item.dpId !== skill.dpId)
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
const hasSelected = () => {
|
|
445
|
-
return !!state.selectedSkill.length
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
const changeSkillEnable = useCallback((dpId: string, enable: boolean) => {
|
|
449
|
-
state.selectedSkill = state.selectedSkill.map((skill) => {
|
|
450
|
-
if (dpId === skill.dpId) {
|
|
451
|
-
skill.enable = enable
|
|
452
|
-
}
|
|
453
|
-
return skill
|
|
454
|
-
})
|
|
455
|
-
}, [state.selectedSkill])
|
|
456
|
-
|
|
457
|
-
const showClearIcon = () => {
|
|
458
|
-
return dps.length > 1 && !props.isMixRGBWLamp && !props.isCeilingLight
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
return (
|
|
462
|
-
<Page
|
|
463
|
-
backText={I18n.getLang('motion_detection_add_time_schedule_system_back_text')}
|
|
464
|
-
rightButtonIcon={saveEnable() ? res.ic_check : res.ic_uncheck}
|
|
465
|
-
rightButtonIconClick={() => saveAction()}
|
|
466
|
-
rightButtonDisabled={!saveEnable()}
|
|
467
|
-
showBackDialog={true}
|
|
468
|
-
backDialogTitle={I18n.getLang('cancel_dialog_leave_unsaved_titel')}
|
|
469
|
-
backDialogContent={I18n.getLang('cancel_dialog_leave_unsaved_timeschedule_note')}>
|
|
470
|
-
<ScrollView
|
|
471
|
-
nestedScrollEnabled={true}
|
|
472
|
-
showsHorizontalScrollIndicator={false}
|
|
473
|
-
showsVerticalScrollIndicator={false}>
|
|
474
|
-
<LdvTopName
|
|
475
|
-
title={I18n.getLang(props.mode === 'add' ? 'motion_detection_add_time_schedule_headline_text' : 'edit_timeschedule_headline_text')}/>
|
|
476
|
-
<View style={styles.content}>
|
|
477
|
-
<TextField
|
|
478
|
-
value={state.name}
|
|
479
|
-
placeholder={I18n.getLang('motion_detection_add_time_schedule_selectionfield_text')}
|
|
480
|
-
onChangeText={(t: string) => {
|
|
481
|
-
state.name = t
|
|
482
|
-
}}
|
|
483
|
-
showError={state.name.length > 32}
|
|
484
|
-
maxLength={33}
|
|
485
|
-
errorText={I18n.getLang('add_new_dynamic_mood_alert_text')}/>
|
|
486
|
-
{/* pick */}
|
|
487
|
-
<LdvPickerView
|
|
488
|
-
style={styles.picker}
|
|
489
|
-
hour={state.hour}
|
|
490
|
-
minute={state.minute}
|
|
491
|
-
setHour={v => (state.hour = v)}
|
|
492
|
-
setMinute={v => (state.minute = v)}
|
|
493
|
-
/>
|
|
494
|
-
{/* week */}
|
|
495
|
-
<LdvWeekView
|
|
496
|
-
value={state.loop}
|
|
497
|
-
style={styles.zeroMarginHorizontal}
|
|
498
|
-
onSelect={selectWeekAction}/>
|
|
499
|
-
<Text style={styles.loopText}>{loopText(state.loop, `${state.hour}:${state.minute}`)}</Text>
|
|
500
|
-
{/* Apply for */}
|
|
501
|
-
<View>
|
|
502
|
-
<Text style={styles.itemTitle}>{I18n.getLang('timeschedule_add_schedule_subheadline_text')}</Text>
|
|
503
|
-
<View
|
|
504
|
-
style={{
|
|
505
|
-
backgroundColor: '#f6f6f6',
|
|
506
|
-
borderRadius: 4,
|
|
507
|
-
minHeight: cx(50),
|
|
508
|
-
flex: 1,
|
|
509
|
-
justifyContent: 'center',
|
|
510
|
-
}}
|
|
511
|
-
>
|
|
512
|
-
{!hasSelected() ? <Text
|
|
513
|
-
style={{ marginLeft: cx(10) }}>{I18n.getLang('timer_ceiling_fan_selectionfield_no_components_text')}</Text> :
|
|
514
|
-
<View
|
|
515
|
-
style={{
|
|
516
|
-
marginHorizontal: cx(8),
|
|
517
|
-
marginTop: cx(8),
|
|
518
|
-
borderRadius: 4,
|
|
519
|
-
}}>
|
|
520
|
-
<FlatList
|
|
521
|
-
data={state.selectedSkill}
|
|
522
|
-
renderItem={item => renderItem(item)}
|
|
523
|
-
keyExtractor={(item) => item.dpId + 'selected'}/>
|
|
524
|
-
</View>}
|
|
525
|
-
</View>
|
|
526
|
-
{state.skillList.map((item) => {
|
|
527
|
-
return (
|
|
528
|
-
<TouchableOpacity style={styles.skillListItem} key={item.dpId + 'skill'}
|
|
529
|
-
onPress={() => handelSkill('add', item)}>
|
|
530
|
-
<Text style={{ color: '#000' }}>{item.label}</Text>
|
|
531
|
-
<Image style={{ width: cx(16), height: cx(16) }} source={res.device_panel_timer_add}/>
|
|
532
|
-
</TouchableOpacity>
|
|
533
|
-
)
|
|
534
|
-
})}
|
|
535
|
-
</View>
|
|
536
|
-
{/* Device state */}
|
|
537
|
-
<View>
|
|
538
|
-
<Text style={styles.itemTitle}>{I18n.getLang('timeschedule_add_schedule_subheadline2_text')}</Text>
|
|
539
|
-
</View>
|
|
540
|
-
<DeviceState
|
|
541
|
-
singleActions={state.singleActions}
|
|
542
|
-
mixActions={state.mixActions}
|
|
543
|
-
actionScene={state.actionScene}
|
|
544
|
-
dpCodes={dpCodes}
|
|
545
|
-
dps={state.skillList}
|
|
546
|
-
selectedDps={state.selectedSkill}
|
|
547
|
-
scheduleItem={scheduleItem}
|
|
548
|
-
isManual={state.isManual}
|
|
549
|
-
setIsManual={useCallback((v) => {
|
|
550
|
-
state.isManual = v
|
|
551
|
-
}, [])}
|
|
552
|
-
setSendDps={setSendDps}
|
|
553
|
-
changeSkillEnable={changeSkillEnable}
|
|
554
|
-
isDIMLamp={props.isDIMLamp}
|
|
555
|
-
isOnlyRGBLamp={props.isOnlyRGBLamp}
|
|
556
|
-
isRGBLamp={props.isRGBLamp}
|
|
557
|
-
isRGBWLamp={props.isRGBWLamp}
|
|
558
|
-
isMixRGBWLamp={props.isMixRGBWLamp}
|
|
559
|
-
isTWLamp={props.isTWLamp}
|
|
560
|
-
isFanLamp={props.isFanLamp}
|
|
561
|
-
isSupportMode={props.isSupportMode}
|
|
562
|
-
isSupportColor={props.isSupportColor}
|
|
563
|
-
isSupportBrightness={props.isSupportBrightness}
|
|
564
|
-
isSupportTemperature={props.isSupportTemperature}
|
|
565
|
-
isSupportMood={props.isSupportMood}
|
|
566
|
-
isStringLight={props.isStringLight}
|
|
567
|
-
isStripLight={props.isStripLight}
|
|
568
|
-
fantasyFeatureId={props.fantasyFeatureId}
|
|
569
|
-
isCeilingLight={props.isCeilingLight}
|
|
570
|
-
/>
|
|
571
|
-
{!hasSelected() && <View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
572
|
-
<Image style={{ width: cx(16), height: cx(16), tintColor: '#FF9500' }} source={res.ic_warning_amber}/>
|
|
573
|
-
<Text style={{
|
|
574
|
-
color: '#FF9500',
|
|
575
|
-
marginLeft: cx(5),
|
|
576
|
-
}}>{I18n.getLang('timeschedule_add_schedule_no_device_warning_text')}</Text>
|
|
577
|
-
</View>}
|
|
578
|
-
{/* Settings */}
|
|
579
|
-
<Text style={styles.itemTitle}>{I18n.getLang('timeschedule_add_schedule_subheadline4_text')}</Text>
|
|
580
|
-
<View style={styles.switchButton}>
|
|
581
|
-
<Text style={styles.text}>{I18n.getLang('timeschedule_add_schedule_text2')}</Text>
|
|
582
|
-
<SwitchButton
|
|
583
|
-
value={state.isNotification}
|
|
584
|
-
onValueChange={value => {
|
|
585
|
-
state.isNotification = value
|
|
586
|
-
}}/>
|
|
587
|
-
</View>
|
|
588
|
-
{/* Summary */}
|
|
589
|
-
<View>
|
|
590
|
-
<Text style={styles.itemTitle}>{I18n.getLang('add_randomtimecycle_subheadline_text')}</Text>
|
|
591
|
-
<View style={styles.summaryContainer}>
|
|
592
|
-
<View style={styles.summaryLeft}>
|
|
593
|
-
<Image
|
|
594
|
-
source={res.summary_icon1}
|
|
595
|
-
resizeMode="contain"
|
|
596
|
-
style={styles.summaryImg}
|
|
597
|
-
/>
|
|
598
|
-
<View>
|
|
599
|
-
<Text style={styles.leftTitle}>{I18n.getLang('feature_summary_frequency_headline')}</Text>
|
|
600
|
-
</View>
|
|
601
|
-
</View>
|
|
602
|
-
<View style={styles.summaryRight}>
|
|
603
|
-
<Text style={styles.rightItem}>{loopText(state.loop, `${state.hour}:${state.minute}`)}</Text>
|
|
604
|
-
</View>
|
|
605
|
-
</View>
|
|
606
|
-
<View style={styles.summaryContainer}>
|
|
607
|
-
<View style={styles.summaryLeft}>
|
|
608
|
-
<Image
|
|
609
|
-
source={res.summary_icon2}
|
|
610
|
-
resizeMode="contain"
|
|
611
|
-
style={styles.summaryImg}
|
|
612
|
-
/>
|
|
613
|
-
<View>
|
|
614
|
-
<Text style={styles.leftTitle}>{I18n.getLang('feature_summary_time_headline')}</Text>
|
|
615
|
-
</View>
|
|
616
|
-
</View>
|
|
617
|
-
<View style={styles.summaryRight}>
|
|
618
|
-
<Text style={styles.rightItem}>{[state.hour, state.minute].join(':')}</Text>
|
|
619
|
-
</View>
|
|
620
|
-
</View>
|
|
621
|
-
<View style={[styles.summaryContainer, { alignItems: 'flex-start' }]}>
|
|
622
|
-
<View style={styles.summaryLeft}>
|
|
623
|
-
<Image
|
|
624
|
-
source={res.summary_icon3}
|
|
625
|
-
resizeMode="contain"
|
|
626
|
-
style={styles.summaryImg}
|
|
627
|
-
/>
|
|
628
|
-
<View>
|
|
629
|
-
<Text
|
|
630
|
-
style={styles.leftTitle}>{I18n.getLang('motion_detection_add_time_schedule_actions_text1')}</Text>
|
|
631
|
-
</View>
|
|
632
|
-
</View>
|
|
633
|
-
<View style={{marginLeft: cx(16), flex: 1}}>
|
|
634
|
-
{!!state.selectedSkill.length && <>
|
|
635
|
-
{(!!state.selectedSkill.filter(skill => skill.enable).length) && <>
|
|
636
|
-
<Text style={{ marginLeft: cx(5) }}>{I18n.getLang('feature_summary_action_txt_1')}</Text>
|
|
637
|
-
<View style={{ flexDirection: 'row',flexWrap: 'wrap' }}>{
|
|
638
|
-
state.selectedSkill.filter(skill => skill.enable).map(item => (
|
|
639
|
-
<View style={[styles.summaryRight, { marginLeft: cx(5), marginBottom: cx(5) }]}
|
|
640
|
-
key={item.dpId}>
|
|
641
|
-
<Text style={[styles.rightItem]}
|
|
642
|
-
>{item.label}</Text>
|
|
643
|
-
</View>
|
|
644
|
-
))
|
|
645
|
-
}</View>
|
|
646
|
-
</>}
|
|
647
|
-
|
|
648
|
-
{(!!state.selectedSkill.filter(skill => !skill.enable).length) && <>
|
|
649
|
-
<Text style={{ marginLeft: cx(5) }}>{I18n.getLang('feature_summary_action_txt_2')}</Text>
|
|
650
|
-
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>{
|
|
651
|
-
state.selectedSkill.filter(skill => !skill.enable).map(item => (
|
|
652
|
-
<View style={[styles.summaryRight, { marginLeft: cx(5), marginBottom: cx(5) }]}
|
|
653
|
-
key={item.dpId}>
|
|
654
|
-
<Text style={[styles.rightItem]}
|
|
655
|
-
>{item.label}</Text>
|
|
656
|
-
</View>
|
|
657
|
-
))
|
|
658
|
-
}</View>
|
|
659
|
-
</>}
|
|
660
|
-
</>}
|
|
661
|
-
</View>
|
|
662
|
-
</View>
|
|
663
|
-
<Spacer height={cx(40)}/>
|
|
664
|
-
{props.mode === 'edit' && <View style={{ marginBottom: cx(24) }}>
|
|
665
|
-
<DeleteButton
|
|
666
|
-
text={I18n.getLang('edit_timeschedule_bttn_text')}
|
|
667
|
-
onPress={() => {
|
|
668
|
-
deleteDialog(scheduleItem).then(() => {
|
|
669
|
-
navigation.goBack()
|
|
670
|
-
})
|
|
671
|
-
}}
|
|
672
|
-
/>
|
|
673
|
-
</View>}
|
|
674
|
-
</View>
|
|
675
|
-
</View>
|
|
676
|
-
</ScrollView>
|
|
677
|
-
</Page>
|
|
678
|
-
)
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
const styles = StyleSheet.create({
|
|
682
|
-
content: {
|
|
683
|
-
marginHorizontal: cx(24),
|
|
684
|
-
},
|
|
685
|
-
picker: {
|
|
686
|
-
marginHorizontal: cx(24),
|
|
687
|
-
marginVertical: cx(15),
|
|
688
|
-
color: 'rgb(35,35,38)',
|
|
689
|
-
},
|
|
690
|
-
zeroMarginHorizontal: {
|
|
691
|
-
marginHorizontal: 0,
|
|
692
|
-
},
|
|
693
|
-
loopText: {
|
|
694
|
-
fontSize: cx(14),
|
|
695
|
-
fontFamily: 'PingFangSC-Medium',
|
|
696
|
-
color: '#999999',
|
|
697
|
-
marginTop: cx(10),
|
|
698
|
-
},
|
|
699
|
-
itemTitle: {
|
|
700
|
-
color: '#000',
|
|
701
|
-
fontSize: cx(16),
|
|
702
|
-
fontWeight: 'bold',
|
|
703
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
704
|
-
marginTop: cx(30),
|
|
705
|
-
marginBottom: cx(10),
|
|
706
|
-
},
|
|
707
|
-
switchButton: {
|
|
708
|
-
flexDirection: 'row',
|
|
709
|
-
alignItems: 'center',
|
|
710
|
-
justifyContent: 'space-between',
|
|
711
|
-
marginBottom: cx(10),
|
|
712
|
-
},
|
|
713
|
-
text: {
|
|
714
|
-
color: '#000',
|
|
715
|
-
},
|
|
716
|
-
switchCard: {
|
|
717
|
-
paddingVertical: cx(16),
|
|
718
|
-
},
|
|
719
|
-
switchCardContent: {
|
|
720
|
-
flexDirection: 'row',
|
|
721
|
-
alignItems: 'center',
|
|
722
|
-
},
|
|
723
|
-
switchCardTitle: {
|
|
724
|
-
color: '#000',
|
|
725
|
-
fontSize: cx(16),
|
|
726
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
727
|
-
},
|
|
728
|
-
skillListItem: {
|
|
729
|
-
flexDirection: 'row',
|
|
730
|
-
justifyContent: 'space-between',
|
|
731
|
-
height: cx(30),
|
|
732
|
-
alignItems: 'center',
|
|
733
|
-
marginVertical: cx(5),
|
|
734
|
-
},
|
|
735
|
-
summaryContainer: {
|
|
736
|
-
flexDirection: 'row',
|
|
737
|
-
justifyContent: 'flex-start',
|
|
738
|
-
marginBottom: cx(10),
|
|
739
|
-
},
|
|
740
|
-
summaryImg: {
|
|
741
|
-
height: cx(12),
|
|
742
|
-
width: cx(12),
|
|
743
|
-
marginRight: cx(6),
|
|
744
|
-
},
|
|
745
|
-
summaryLeft: {
|
|
746
|
-
flexDirection: 'row',
|
|
747
|
-
alignItems: 'center',
|
|
748
|
-
minWidth: cx(90),
|
|
749
|
-
},
|
|
750
|
-
leftTitle: {
|
|
751
|
-
fontSize: cx(14),
|
|
752
|
-
color: '#000',
|
|
753
|
-
},
|
|
754
|
-
summaryRight: {
|
|
755
|
-
flexDirection: 'column',
|
|
756
|
-
marginLeft: cx(21),
|
|
757
|
-
backgroundColor: '#cbcbcb',
|
|
758
|
-
borderRadius: cx(16),
|
|
759
|
-
},
|
|
760
|
-
rightItem: {
|
|
761
|
-
paddingHorizontal: cx(12),
|
|
762
|
-
color: '#000',
|
|
763
|
-
},
|
|
764
|
-
})
|
|
765
|
-
|
|
1
|
+
import React, { useCallback, useEffect } from 'react'
|
|
2
|
+
import { FlatList, Image, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
|
|
3
|
+
import Page from '@ledvance/base/src/components/Page'
|
|
4
|
+
import TextField from '@ledvance/base/src/components/TextField'
|
|
5
|
+
import I18n from '@ledvance/base/src/i18n'
|
|
6
|
+
import { useNavigation, useRoute } from '@react-navigation/native'
|
|
7
|
+
import LdvTopName from '@ledvance/base/src/components/ldvTopName'
|
|
8
|
+
import LdvPickerView from '@ledvance/base/src/components/ldvPickerView'
|
|
9
|
+
import LdvWeekView from '@ledvance/base/src/components/weekSelect'
|
|
10
|
+
import { SwitchButton, Utils } from 'tuya-panel-kit'
|
|
11
|
+
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
12
|
+
import DeleteButton from '@ledvance/base/src/components/DeleteButton'
|
|
13
|
+
import { loopText, toFixed } from '@ledvance/base/src/utils/common'
|
|
14
|
+
import { NativeApi } from '@ledvance/base/src/api/native'
|
|
15
|
+
import { isUVCFanDevice, useDeviceId } from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
16
|
+
import res from '@ledvance/base/src/res'
|
|
17
|
+
import { useReactive } from 'ahooks'
|
|
18
|
+
import { dpItem, TimeSchedulePageRouteParams } from './TimeSchedulePage'
|
|
19
|
+
import { cloneDeep, differenceBy, isEmpty, isEqual } from 'lodash'
|
|
20
|
+
import DeviceState from './DeviceState'
|
|
21
|
+
import { getHexByHSV, getHSVByHex } from '@ledvance/base/src/utils'
|
|
22
|
+
import { Buffer } from 'buffer'
|
|
23
|
+
import { dp2Obj, obj2Dp } from './mix/MixLightActions'
|
|
24
|
+
import { dp2Obj as sencePp2Obj, obj2Dp as senceObj2Dp } from '../scene/SceneAction'
|
|
25
|
+
import { COLOUR, SCENE, WHITE } from '../../hooks/DeviceDpStateHooks'
|
|
26
|
+
import { ColorList } from './components/ColorList'
|
|
27
|
+
|
|
28
|
+
const { convertX: cx } = Utils.RatioUtils
|
|
29
|
+
|
|
30
|
+
export interface ScheduleItemDp extends dpItem {
|
|
31
|
+
enable: boolean
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface TimeScheduleEditPageParams extends TimeSchedulePageRouteParams {
|
|
35
|
+
mode: 'add' | 'edit'
|
|
36
|
+
scheduleItem: any,
|
|
37
|
+
dps: ScheduleItemDp[]
|
|
38
|
+
dpCodes: Record<any, any>
|
|
39
|
+
reloadData: () => void
|
|
40
|
+
deleteDialog: (item: any) => Promise<void>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const TimeScheduleEditPage = () => {
|
|
44
|
+
const navigation = useNavigation()
|
|
45
|
+
const devId = useDeviceId()
|
|
46
|
+
const route = useRoute()
|
|
47
|
+
const isUVCFan = isUVCFanDevice()
|
|
48
|
+
const props = cloneDeep(route.params) as TimeScheduleEditPageParams
|
|
49
|
+
const { scheduleItem, dps, reloadData, deleteDialog, dpCodes } = props
|
|
50
|
+
const state = useReactive({
|
|
51
|
+
loading: false,
|
|
52
|
+
hour: '00',
|
|
53
|
+
minute: '00',
|
|
54
|
+
loop: [0, 0, 0, 0, 0, 0, 0],
|
|
55
|
+
isNotification: false,
|
|
56
|
+
name: '',
|
|
57
|
+
selectedSkill: [] as ScheduleItemDp[],
|
|
58
|
+
skillList: [] as ScheduleItemDp[],
|
|
59
|
+
isManual: true,
|
|
60
|
+
singleActions: {
|
|
61
|
+
enable: true, // colorLightSwitch
|
|
62
|
+
whiteLightSwitch: true,
|
|
63
|
+
isColor: true,
|
|
64
|
+
h: 0,
|
|
65
|
+
s: 100,
|
|
66
|
+
v: 100,
|
|
67
|
+
temperature: 100,
|
|
68
|
+
brightness: 100,
|
|
69
|
+
colorDiskActiveKey: 0,
|
|
70
|
+
colors: ColorList[0],
|
|
71
|
+
activeKey: 1,
|
|
72
|
+
fanEnable: true,
|
|
73
|
+
fanSpeed: 1,
|
|
74
|
+
fanMode: 'normal',
|
|
75
|
+
},
|
|
76
|
+
mixActions: {
|
|
77
|
+
whiteLightSwitch: true,
|
|
78
|
+
colorLightSwitch: false,
|
|
79
|
+
mixRgbcwEnabled: true,
|
|
80
|
+
hue: 360,
|
|
81
|
+
sat: 100,
|
|
82
|
+
lightness: 100,
|
|
83
|
+
brightness: 100,
|
|
84
|
+
colorTempPercent: 100,
|
|
85
|
+
},
|
|
86
|
+
actionScene: {} as any,
|
|
87
|
+
dpsValue: {} as Record<string, any>,
|
|
88
|
+
})
|
|
89
|
+
console.log(props, '< --- props')
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
// 设置功能列表
|
|
92
|
+
if (props.mode === 'edit' && scheduleItem) {
|
|
93
|
+
state.hour = scheduleItem.time.split(':')[0]
|
|
94
|
+
state.minute = scheduleItem.time.split(':')[1]
|
|
95
|
+
state.name = scheduleItem.aliasName
|
|
96
|
+
state.isNotification = !!scheduleItem.isAppPush
|
|
97
|
+
state.loop = scheduleItem.loops.split('').map((mItem: string) => parseInt(mItem))
|
|
98
|
+
state.selectedSkill = props.isCeilingLight ? props.dps : dps.reduce((pre, cur) => {
|
|
99
|
+
if (scheduleItem.dps[cur.dpId] !== undefined) {
|
|
100
|
+
const result = { ...cur, enable: scheduleItem.dps[cur.dpId] }
|
|
101
|
+
pre.push(result)
|
|
102
|
+
}
|
|
103
|
+
return pre
|
|
104
|
+
}, [] as ScheduleItemDp[])
|
|
105
|
+
state.skillList = differenceBy(dps, state.selectedSkill, 'dpId')
|
|
106
|
+
|
|
107
|
+
if (props.dps2lightData) {
|
|
108
|
+
console.log(scheduleItem.dps, '< --- dps')
|
|
109
|
+
const lightData = props.dps2lightData(scheduleItem.dps)
|
|
110
|
+
console.log(lightData, '< --- lightData')
|
|
111
|
+
state.singleActions = {
|
|
112
|
+
...state.singleActions,
|
|
113
|
+
...lightData.singleActions,
|
|
114
|
+
}
|
|
115
|
+
state.isManual = lightData.isManual
|
|
116
|
+
state.actionScene = lightData.actionScene
|
|
117
|
+
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// single
|
|
122
|
+
if (scheduleItem.dps[dpCodes.switch_led] !== undefined) {
|
|
123
|
+
state.singleActions.enable = scheduleItem.dps[dpCodes.switch_led]
|
|
124
|
+
}
|
|
125
|
+
if (scheduleItem.dps[dpCodes.work_mode] !== undefined) {
|
|
126
|
+
state.singleActions.isColor = scheduleItem.dps[dpCodes.work_mode] === COLOUR
|
|
127
|
+
}
|
|
128
|
+
if (scheduleItem.dps[dpCodes.fan_switch] !== undefined) {
|
|
129
|
+
state.singleActions.fanEnable = scheduleItem.dps[dpCodes.fan_switch]
|
|
130
|
+
}
|
|
131
|
+
state.singleActions.brightness = scheduleItem.dps[dpCodes.bright_value] / 10 || 100
|
|
132
|
+
state.singleActions.temperature = scheduleItem.dps[dpCodes.temp_value] / 10 || 100
|
|
133
|
+
state.singleActions.fanSpeed = scheduleItem.dps[dpCodes.fan_speed] || 1
|
|
134
|
+
state.singleActions.fanMode = scheduleItem.dps[dpCodes.fan_mode] || 'normal'
|
|
135
|
+
const hsv = getHSVByHex(scheduleItem.dps[dpCodes.colour_data] || '0000000003e8')
|
|
136
|
+
state.singleActions.h = hsv.h
|
|
137
|
+
state.singleActions.s = Math.round(hsv.s / 10)
|
|
138
|
+
state.singleActions.v = Math.round(hsv.v / 10)
|
|
139
|
+
|
|
140
|
+
// mix
|
|
141
|
+
if (scheduleItem.dps[dpCodes.mix_rgbcw] !== undefined) {
|
|
142
|
+
const base64String = Buffer.from(scheduleItem.dps[dpCodes.mix_rgbcw], 'base64').toString('hex')
|
|
143
|
+
state.mixActions = dp2Obj(base64String)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (scheduleItem.dps[dpCodes.scene_data] !== undefined) {
|
|
147
|
+
state.actionScene = sencePp2Obj(scheduleItem.dps[dpCodes.scene_data], !!props.isFanLamp, isUVCFan)
|
|
148
|
+
state.isManual = false
|
|
149
|
+
}
|
|
150
|
+
if (scheduleItem.dps[dpCodes.mix_light_scene] !== undefined) {
|
|
151
|
+
const sceneDp = scheduleItem.dps[dpCodes.mix_light_scene]
|
|
152
|
+
state.actionScene = Buffer.from(sceneDp, 'base64').toString('hex')
|
|
153
|
+
state.isManual = false
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
} else {
|
|
157
|
+
const date = new Date()
|
|
158
|
+
state.hour = toFixed(date.getHours(), 2)
|
|
159
|
+
state.minute = toFixed(date.getMinutes(), 2)
|
|
160
|
+
// 当dps长度只有1个的时候或者是mixLight灯时默认选中,
|
|
161
|
+
if (!showClearIcon()) {
|
|
162
|
+
state.selectedSkill = dps.map(item => ({
|
|
163
|
+
...item,
|
|
164
|
+
enable: true,
|
|
165
|
+
}))
|
|
166
|
+
} else {
|
|
167
|
+
state.skillList = dps.map(item => ({
|
|
168
|
+
...item,
|
|
169
|
+
enable: true,
|
|
170
|
+
}))
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}, [])
|
|
174
|
+
|
|
175
|
+
const selectWeekAction = (idx: number) => {
|
|
176
|
+
state.loop = state.loop.map((item, tempIndex) => {
|
|
177
|
+
if (tempIndex === idx - 1) {
|
|
178
|
+
return item > 0 ? 0 : 1
|
|
179
|
+
}
|
|
180
|
+
return item
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const manualCheck = () => {
|
|
185
|
+
return state.isManual && state.selectedSkill.length
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// 只支持风扇灯跟普通灯
|
|
189
|
+
const sceneCheck = () => {
|
|
190
|
+
if(props.isCeilingLight){
|
|
191
|
+
return (state.actionScene?.mainLamp?.nodes?.length) || (state.actionScene?.secondlyLamp?.nodes?.length)
|
|
192
|
+
}
|
|
193
|
+
return !state.isManual && state.skillList.length === 0 && state.actionScene && (state?.actionScene?.nodes || state?.actionScene?.value)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const saveEnable = () => {
|
|
197
|
+
return !state.loading
|
|
198
|
+
&& state.name.length && state.name.length <= 32
|
|
199
|
+
&& (manualCheck() || sceneCheck())
|
|
200
|
+
&& [
|
|
201
|
+
!isEqual(scheduleItem?.aliasName, state.name),
|
|
202
|
+
!isEqual(scheduleItem?.time, [state.hour, state.minute].join(':')),
|
|
203
|
+
!isEqual(scheduleItem?.loops, state.loop.join('')),
|
|
204
|
+
!isEqual(!!scheduleItem?.isAppPush, state.isNotification),
|
|
205
|
+
!isEqual(scheduleItem?.dps, getSendDps()),
|
|
206
|
+
].some(e => e)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const saveAction = () => {
|
|
210
|
+
if (!saveEnable() || state.loading) {
|
|
211
|
+
return
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
state.loading = true
|
|
215
|
+
const params = {
|
|
216
|
+
time: [state.hour, state.minute].join(':'),
|
|
217
|
+
loops: state.loop.join(''),
|
|
218
|
+
dps: getAllDps(),
|
|
219
|
+
aliasName: state.name,
|
|
220
|
+
status: true,
|
|
221
|
+
notification: state.isNotification,
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (scheduleItem) {
|
|
225
|
+
NativeApi.editTimer(
|
|
226
|
+
devId,
|
|
227
|
+
{
|
|
228
|
+
...params,
|
|
229
|
+
id: scheduleItem.id,
|
|
230
|
+
},
|
|
231
|
+
res => {
|
|
232
|
+
if (res?.result) {
|
|
233
|
+
reloadData()
|
|
234
|
+
navigation.goBack()
|
|
235
|
+
state.loading = false
|
|
236
|
+
} else {
|
|
237
|
+
state.loading = false
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
},
|
|
241
|
+
)
|
|
242
|
+
} else {
|
|
243
|
+
NativeApi.addTimer(
|
|
244
|
+
devId,
|
|
245
|
+
params,
|
|
246
|
+
res => {
|
|
247
|
+
if (res?.result) {
|
|
248
|
+
reloadData()
|
|
249
|
+
navigation.goBack()
|
|
250
|
+
state.loading = false
|
|
251
|
+
} else {
|
|
252
|
+
state.loading = false
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const getSendDps = () => {
|
|
260
|
+
if (props.lightData2dps) {
|
|
261
|
+
return props.lightData2dps({
|
|
262
|
+
singleActions: state.singleActions,
|
|
263
|
+
mixActions: state.mixActions,
|
|
264
|
+
actionScene: !isEmpty(state.actionScene) ? state.actionScene : undefined,
|
|
265
|
+
isManual: state.isManual,
|
|
266
|
+
})
|
|
267
|
+
}
|
|
268
|
+
if (state.isManual) {
|
|
269
|
+
if (props.isDIMLamp) {
|
|
270
|
+
return {
|
|
271
|
+
[dpCodes.bright_value]: state.singleActions.brightness * 10,
|
|
272
|
+
}
|
|
273
|
+
} else if (props.isFanLamp) {
|
|
274
|
+
let v = {}
|
|
275
|
+
const hasFan = !!state.selectedSkill.find(item => item.value.includes('fan'))
|
|
276
|
+
const hasLight = !!state.selectedSkill.find(item => item.value.includes('light'))
|
|
277
|
+
if (hasFan) {
|
|
278
|
+
v = {
|
|
279
|
+
...v,
|
|
280
|
+
[dpCodes.fan_mode]: state.singleActions.fanMode,
|
|
281
|
+
[dpCodes.fan_speed]: state.singleActions.fanSpeed,
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (hasLight) {
|
|
285
|
+
v = {
|
|
286
|
+
...v,
|
|
287
|
+
[dpCodes.work_mode]: WHITE,
|
|
288
|
+
[dpCodes.bright_value]: state.singleActions.brightness * 10,
|
|
289
|
+
[dpCodes.temp_value]: state.singleActions.temperature * 10,
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return v
|
|
293
|
+
}
|
|
294
|
+
if (props.isTWLamp) {
|
|
295
|
+
return {
|
|
296
|
+
[dpCodes.work_mode]: WHITE,
|
|
297
|
+
[dpCodes.bright_value]: state.singleActions.brightness * 10,
|
|
298
|
+
[dpCodes.temp_value]: state.singleActions.temperature * 10,
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (props.isRGBWLamp) {
|
|
302
|
+
if (state.singleActions.isColor) {
|
|
303
|
+
const colorString = getHexByHSV({
|
|
304
|
+
h: state.singleActions.h,
|
|
305
|
+
s: state.singleActions.s * 10,
|
|
306
|
+
v: state.singleActions.v * 10,
|
|
307
|
+
})
|
|
308
|
+
return {
|
|
309
|
+
[dpCodes.work_mode]: COLOUR,
|
|
310
|
+
[dpCodes.colour_data]: colorString,
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return {
|
|
314
|
+
[dpCodes.work_mode]: WHITE,
|
|
315
|
+
[dpCodes.temp_value]: state.singleActions.temperature * 10,
|
|
316
|
+
[dpCodes.bright_value]: state.singleActions.brightness * 10,
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
} else if (props.isMixRGBWLamp) {
|
|
320
|
+
const dpsString = obj2Dp(state.mixActions)
|
|
321
|
+
return {
|
|
322
|
+
[dpCodes.switch_led]: true,
|
|
323
|
+
[dpCodes.mix_rgbcw]: Buffer.from(dpsString, 'hex').toString('base64'),
|
|
324
|
+
}
|
|
325
|
+
} else if (props.isGlassRGBWLamp) {
|
|
326
|
+
const colorString = getHexByHSV({
|
|
327
|
+
h: state.singleActions.h,
|
|
328
|
+
s: state.singleActions.s * 10,
|
|
329
|
+
v: state.singleActions.v * 10,
|
|
330
|
+
})
|
|
331
|
+
return {
|
|
332
|
+
[dpCodes.work_mode]: COLOUR,
|
|
333
|
+
[dpCodes.colour_data]: colorString,
|
|
334
|
+
}
|
|
335
|
+
} else if (props.isGARDOT) {
|
|
336
|
+
const colorString = getHexByHSV({
|
|
337
|
+
h: state.singleActions.h,
|
|
338
|
+
s: state.singleActions.s * 10,
|
|
339
|
+
v: state.singleActions.v * 10,
|
|
340
|
+
})
|
|
341
|
+
return {
|
|
342
|
+
[dpCodes.work_mode]: COLOUR,
|
|
343
|
+
[dpCodes.colour_data]: colorString,
|
|
344
|
+
}
|
|
345
|
+
} else {
|
|
346
|
+
const colorString = getHexByHSV({
|
|
347
|
+
h: state.singleActions.h,
|
|
348
|
+
s: state.singleActions.s * 10,
|
|
349
|
+
v: state.singleActions.v * 10,
|
|
350
|
+
})
|
|
351
|
+
return {
|
|
352
|
+
[dpCodes.switch_led]: true,
|
|
353
|
+
[dpCodes.colour_data]: colorString,
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
} else {
|
|
357
|
+
if (props.isMixRGBWLamp) {
|
|
358
|
+
const v = {
|
|
359
|
+
[dpCodes.mix_light_scene]: Buffer.from(state.actionScene?.value, 'hex').toString('base64'),
|
|
360
|
+
[dpCodes.switch_led]: true,
|
|
361
|
+
[dpCodes.work_mode]: SCENE,
|
|
362
|
+
}
|
|
363
|
+
return props.isFanLamp ? {
|
|
364
|
+
...v,
|
|
365
|
+
[dpCodes.fan_switch]: state.actionScene.fanEnable,
|
|
366
|
+
[dpCodes.fan_speed]: state.actionScene.fanSpeed,
|
|
367
|
+
} : v
|
|
368
|
+
} else {
|
|
369
|
+
const v = {
|
|
370
|
+
[dpCodes.switch_led]: true,
|
|
371
|
+
// @ts-ignore
|
|
372
|
+
[dpCodes.scene_data]: senceObj2Dp({
|
|
373
|
+
id: Number(state?.actionScene?.id),
|
|
374
|
+
nodes: state?.actionScene?.nodes,
|
|
375
|
+
}, !!props.isFanLamp, isUVCFan),
|
|
376
|
+
[dpCodes.work_mode]: SCENE,
|
|
377
|
+
}
|
|
378
|
+
return props.isFanLamp ? {
|
|
379
|
+
...v,
|
|
380
|
+
[dpCodes.fan_switch]: state.actionScene.fanEnable,
|
|
381
|
+
[dpCodes.fan_speed]: state.actionScene.fanSpeed,
|
|
382
|
+
} : v
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
const getAllDps = () => {
|
|
389
|
+
const dpsValue = getSendDps()
|
|
390
|
+
if (state.isManual && !props.isMixRGBWLamp) {
|
|
391
|
+
let v = {}
|
|
392
|
+
state.selectedSkill.forEach(skill => {
|
|
393
|
+
v[skill.dpId] = skill.enable
|
|
394
|
+
})
|
|
395
|
+
return {
|
|
396
|
+
...v,
|
|
397
|
+
...dpsValue,
|
|
398
|
+
}
|
|
399
|
+
} else {
|
|
400
|
+
return dpsValue
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
const setSendDps = useCallback((actions, type) => {
|
|
405
|
+
state[type] = actions
|
|
406
|
+
}, [])
|
|
407
|
+
|
|
408
|
+
const renderItem = ({ item }) => {
|
|
409
|
+
return (
|
|
410
|
+
<View style={{
|
|
411
|
+
flexDirection: 'row',
|
|
412
|
+
justifyContent: 'space-between',
|
|
413
|
+
alignItems: 'center',
|
|
414
|
+
backgroundColor: '#fff',
|
|
415
|
+
marginBottom: cx(8),
|
|
416
|
+
}}>
|
|
417
|
+
<Text
|
|
418
|
+
style={{
|
|
419
|
+
color: '#000',
|
|
420
|
+
fontSize: 14,
|
|
421
|
+
marginHorizontal: cx(6),
|
|
422
|
+
marginVertical: cx(9),
|
|
423
|
+
}}
|
|
424
|
+
>
|
|
425
|
+
{item.label}
|
|
426
|
+
</Text>
|
|
427
|
+
{showClearIcon() && <TouchableOpacity onPress={() => handelSkill('lower', item)}>
|
|
428
|
+
<Image style={{ width: cx(16), height: cx(16), marginRight: cx(5) }} source={res.ic_arrows_nav_clear}/>
|
|
429
|
+
</TouchableOpacity>}
|
|
430
|
+
</View>
|
|
431
|
+
)
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
const handelSkill = (handelType: string, skill: ScheduleItemDp) => {
|
|
435
|
+
if (handelType === 'add') {
|
|
436
|
+
state.selectedSkill = [...state.selectedSkill, skill]
|
|
437
|
+
state.skillList = state.skillList.filter(item => item.dpId !== skill.dpId)
|
|
438
|
+
} else {
|
|
439
|
+
state.skillList = [...state.skillList, skill]
|
|
440
|
+
state.selectedSkill = state.selectedSkill.filter(item => item.dpId !== skill.dpId)
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const hasSelected = () => {
|
|
445
|
+
return !!state.selectedSkill.length
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
const changeSkillEnable = useCallback((dpId: string, enable: boolean) => {
|
|
449
|
+
state.selectedSkill = state.selectedSkill.map((skill) => {
|
|
450
|
+
if (dpId === skill.dpId) {
|
|
451
|
+
skill.enable = enable
|
|
452
|
+
}
|
|
453
|
+
return skill
|
|
454
|
+
})
|
|
455
|
+
}, [state.selectedSkill])
|
|
456
|
+
|
|
457
|
+
const showClearIcon = () => {
|
|
458
|
+
return dps.length > 1 && !props.isMixRGBWLamp && !props.isCeilingLight
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
return (
|
|
462
|
+
<Page
|
|
463
|
+
backText={I18n.getLang('motion_detection_add_time_schedule_system_back_text')}
|
|
464
|
+
rightButtonIcon={saveEnable() ? res.ic_check : res.ic_uncheck}
|
|
465
|
+
rightButtonIconClick={() => saveAction()}
|
|
466
|
+
rightButtonDisabled={!saveEnable()}
|
|
467
|
+
showBackDialog={true}
|
|
468
|
+
backDialogTitle={I18n.getLang('cancel_dialog_leave_unsaved_titel')}
|
|
469
|
+
backDialogContent={I18n.getLang('cancel_dialog_leave_unsaved_timeschedule_note')}>
|
|
470
|
+
<ScrollView
|
|
471
|
+
nestedScrollEnabled={true}
|
|
472
|
+
showsHorizontalScrollIndicator={false}
|
|
473
|
+
showsVerticalScrollIndicator={false}>
|
|
474
|
+
<LdvTopName
|
|
475
|
+
title={I18n.getLang(props.mode === 'add' ? 'motion_detection_add_time_schedule_headline_text' : 'edit_timeschedule_headline_text')}/>
|
|
476
|
+
<View style={styles.content}>
|
|
477
|
+
<TextField
|
|
478
|
+
value={state.name}
|
|
479
|
+
placeholder={I18n.getLang('motion_detection_add_time_schedule_selectionfield_text')}
|
|
480
|
+
onChangeText={(t: string) => {
|
|
481
|
+
state.name = t
|
|
482
|
+
}}
|
|
483
|
+
showError={state.name.length > 32}
|
|
484
|
+
maxLength={33}
|
|
485
|
+
errorText={I18n.getLang('add_new_dynamic_mood_alert_text')}/>
|
|
486
|
+
{/* pick */}
|
|
487
|
+
<LdvPickerView
|
|
488
|
+
style={styles.picker}
|
|
489
|
+
hour={state.hour}
|
|
490
|
+
minute={state.minute}
|
|
491
|
+
setHour={v => (state.hour = v)}
|
|
492
|
+
setMinute={v => (state.minute = v)}
|
|
493
|
+
/>
|
|
494
|
+
{/* week */}
|
|
495
|
+
<LdvWeekView
|
|
496
|
+
value={state.loop}
|
|
497
|
+
style={styles.zeroMarginHorizontal}
|
|
498
|
+
onSelect={selectWeekAction}/>
|
|
499
|
+
<Text style={styles.loopText}>{loopText(state.loop, `${state.hour}:${state.minute}`)}</Text>
|
|
500
|
+
{/* Apply for */}
|
|
501
|
+
<View>
|
|
502
|
+
<Text style={styles.itemTitle}>{I18n.getLang('timeschedule_add_schedule_subheadline_text')}</Text>
|
|
503
|
+
<View
|
|
504
|
+
style={{
|
|
505
|
+
backgroundColor: '#f6f6f6',
|
|
506
|
+
borderRadius: 4,
|
|
507
|
+
minHeight: cx(50),
|
|
508
|
+
flex: 1,
|
|
509
|
+
justifyContent: 'center',
|
|
510
|
+
}}
|
|
511
|
+
>
|
|
512
|
+
{!hasSelected() ? <Text
|
|
513
|
+
style={{ marginLeft: cx(10) }}>{I18n.getLang('timer_ceiling_fan_selectionfield_no_components_text')}</Text> :
|
|
514
|
+
<View
|
|
515
|
+
style={{
|
|
516
|
+
marginHorizontal: cx(8),
|
|
517
|
+
marginTop: cx(8),
|
|
518
|
+
borderRadius: 4,
|
|
519
|
+
}}>
|
|
520
|
+
<FlatList
|
|
521
|
+
data={state.selectedSkill}
|
|
522
|
+
renderItem={item => renderItem(item)}
|
|
523
|
+
keyExtractor={(item) => item.dpId + 'selected'}/>
|
|
524
|
+
</View>}
|
|
525
|
+
</View>
|
|
526
|
+
{state.skillList.map((item) => {
|
|
527
|
+
return (
|
|
528
|
+
<TouchableOpacity style={styles.skillListItem} key={item.dpId + 'skill'}
|
|
529
|
+
onPress={() => handelSkill('add', item)}>
|
|
530
|
+
<Text style={{ color: '#000' }}>{item.label}</Text>
|
|
531
|
+
<Image style={{ width: cx(16), height: cx(16) }} source={res.device_panel_timer_add}/>
|
|
532
|
+
</TouchableOpacity>
|
|
533
|
+
)
|
|
534
|
+
})}
|
|
535
|
+
</View>
|
|
536
|
+
{/* Device state */}
|
|
537
|
+
<View>
|
|
538
|
+
<Text style={styles.itemTitle}>{I18n.getLang('timeschedule_add_schedule_subheadline2_text')}</Text>
|
|
539
|
+
</View>
|
|
540
|
+
<DeviceState
|
|
541
|
+
singleActions={state.singleActions}
|
|
542
|
+
mixActions={state.mixActions}
|
|
543
|
+
actionScene={state.actionScene}
|
|
544
|
+
dpCodes={dpCodes}
|
|
545
|
+
dps={state.skillList}
|
|
546
|
+
selectedDps={state.selectedSkill}
|
|
547
|
+
scheduleItem={scheduleItem}
|
|
548
|
+
isManual={state.isManual}
|
|
549
|
+
setIsManual={useCallback((v) => {
|
|
550
|
+
state.isManual = v
|
|
551
|
+
}, [])}
|
|
552
|
+
setSendDps={setSendDps}
|
|
553
|
+
changeSkillEnable={changeSkillEnable}
|
|
554
|
+
isDIMLamp={props.isDIMLamp}
|
|
555
|
+
isOnlyRGBLamp={props.isOnlyRGBLamp}
|
|
556
|
+
isRGBLamp={props.isRGBLamp}
|
|
557
|
+
isRGBWLamp={props.isRGBWLamp}
|
|
558
|
+
isMixRGBWLamp={props.isMixRGBWLamp}
|
|
559
|
+
isTWLamp={props.isTWLamp}
|
|
560
|
+
isFanLamp={props.isFanLamp}
|
|
561
|
+
isSupportMode={props.isSupportMode}
|
|
562
|
+
isSupportColor={props.isSupportColor}
|
|
563
|
+
isSupportBrightness={props.isSupportBrightness}
|
|
564
|
+
isSupportTemperature={props.isSupportTemperature}
|
|
565
|
+
isSupportMood={props.isSupportMood}
|
|
566
|
+
isStringLight={props.isStringLight}
|
|
567
|
+
isStripLight={props.isStripLight}
|
|
568
|
+
fantasyFeatureId={props.fantasyFeatureId}
|
|
569
|
+
isCeilingLight={props.isCeilingLight}
|
|
570
|
+
/>
|
|
571
|
+
{!hasSelected() && <View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
572
|
+
<Image style={{ width: cx(16), height: cx(16), tintColor: '#FF9500' }} source={res.ic_warning_amber}/>
|
|
573
|
+
<Text style={{
|
|
574
|
+
color: '#FF9500',
|
|
575
|
+
marginLeft: cx(5),
|
|
576
|
+
}}>{I18n.getLang('timeschedule_add_schedule_no_device_warning_text')}</Text>
|
|
577
|
+
</View>}
|
|
578
|
+
{/* Settings */}
|
|
579
|
+
<Text style={styles.itemTitle}>{I18n.getLang('timeschedule_add_schedule_subheadline4_text')}</Text>
|
|
580
|
+
<View style={styles.switchButton}>
|
|
581
|
+
<Text style={styles.text}>{I18n.getLang('timeschedule_add_schedule_text2')}</Text>
|
|
582
|
+
<SwitchButton
|
|
583
|
+
value={state.isNotification}
|
|
584
|
+
onValueChange={value => {
|
|
585
|
+
state.isNotification = value
|
|
586
|
+
}}/>
|
|
587
|
+
</View>
|
|
588
|
+
{/* Summary */}
|
|
589
|
+
<View>
|
|
590
|
+
<Text style={styles.itemTitle}>{I18n.getLang('add_randomtimecycle_subheadline_text')}</Text>
|
|
591
|
+
<View style={styles.summaryContainer}>
|
|
592
|
+
<View style={styles.summaryLeft}>
|
|
593
|
+
<Image
|
|
594
|
+
source={res.summary_icon1}
|
|
595
|
+
resizeMode="contain"
|
|
596
|
+
style={styles.summaryImg}
|
|
597
|
+
/>
|
|
598
|
+
<View>
|
|
599
|
+
<Text style={styles.leftTitle}>{I18n.getLang('feature_summary_frequency_headline')}</Text>
|
|
600
|
+
</View>
|
|
601
|
+
</View>
|
|
602
|
+
<View style={styles.summaryRight}>
|
|
603
|
+
<Text style={styles.rightItem}>{loopText(state.loop, `${state.hour}:${state.minute}`)}</Text>
|
|
604
|
+
</View>
|
|
605
|
+
</View>
|
|
606
|
+
<View style={styles.summaryContainer}>
|
|
607
|
+
<View style={styles.summaryLeft}>
|
|
608
|
+
<Image
|
|
609
|
+
source={res.summary_icon2}
|
|
610
|
+
resizeMode="contain"
|
|
611
|
+
style={styles.summaryImg}
|
|
612
|
+
/>
|
|
613
|
+
<View>
|
|
614
|
+
<Text style={styles.leftTitle}>{I18n.getLang('feature_summary_time_headline')}</Text>
|
|
615
|
+
</View>
|
|
616
|
+
</View>
|
|
617
|
+
<View style={styles.summaryRight}>
|
|
618
|
+
<Text style={styles.rightItem}>{[state.hour, state.minute].join(':')}</Text>
|
|
619
|
+
</View>
|
|
620
|
+
</View>
|
|
621
|
+
<View style={[styles.summaryContainer, { alignItems: 'flex-start' }]}>
|
|
622
|
+
<View style={styles.summaryLeft}>
|
|
623
|
+
<Image
|
|
624
|
+
source={res.summary_icon3}
|
|
625
|
+
resizeMode="contain"
|
|
626
|
+
style={styles.summaryImg}
|
|
627
|
+
/>
|
|
628
|
+
<View>
|
|
629
|
+
<Text
|
|
630
|
+
style={styles.leftTitle}>{I18n.getLang('motion_detection_add_time_schedule_actions_text1')}</Text>
|
|
631
|
+
</View>
|
|
632
|
+
</View>
|
|
633
|
+
<View style={{marginLeft: cx(16), flex: 1}}>
|
|
634
|
+
{!!state.selectedSkill.length && <>
|
|
635
|
+
{(!!state.selectedSkill.filter(skill => skill.enable).length) && <>
|
|
636
|
+
<Text style={{ marginLeft: cx(5) }}>{I18n.getLang('feature_summary_action_txt_1')}</Text>
|
|
637
|
+
<View style={{ flexDirection: 'row',flexWrap: 'wrap' }}>{
|
|
638
|
+
state.selectedSkill.filter(skill => skill.enable).map(item => (
|
|
639
|
+
<View style={[styles.summaryRight, { marginLeft: cx(5), marginBottom: cx(5) }]}
|
|
640
|
+
key={item.dpId}>
|
|
641
|
+
<Text style={[styles.rightItem]}
|
|
642
|
+
>{item.label}</Text>
|
|
643
|
+
</View>
|
|
644
|
+
))
|
|
645
|
+
}</View>
|
|
646
|
+
</>}
|
|
647
|
+
|
|
648
|
+
{(!!state.selectedSkill.filter(skill => !skill.enable).length) && <>
|
|
649
|
+
<Text style={{ marginLeft: cx(5) }}>{I18n.getLang('feature_summary_action_txt_2')}</Text>
|
|
650
|
+
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>{
|
|
651
|
+
state.selectedSkill.filter(skill => !skill.enable).map(item => (
|
|
652
|
+
<View style={[styles.summaryRight, { marginLeft: cx(5), marginBottom: cx(5) }]}
|
|
653
|
+
key={item.dpId}>
|
|
654
|
+
<Text style={[styles.rightItem]}
|
|
655
|
+
>{item.label}</Text>
|
|
656
|
+
</View>
|
|
657
|
+
))
|
|
658
|
+
}</View>
|
|
659
|
+
</>}
|
|
660
|
+
</>}
|
|
661
|
+
</View>
|
|
662
|
+
</View>
|
|
663
|
+
<Spacer height={cx(40)}/>
|
|
664
|
+
{props.mode === 'edit' && <View style={{ marginBottom: cx(24) }}>
|
|
665
|
+
<DeleteButton
|
|
666
|
+
text={I18n.getLang('edit_timeschedule_bttn_text')}
|
|
667
|
+
onPress={() => {
|
|
668
|
+
deleteDialog(scheduleItem).then(() => {
|
|
669
|
+
navigation.goBack()
|
|
670
|
+
})
|
|
671
|
+
}}
|
|
672
|
+
/>
|
|
673
|
+
</View>}
|
|
674
|
+
</View>
|
|
675
|
+
</View>
|
|
676
|
+
</ScrollView>
|
|
677
|
+
</Page>
|
|
678
|
+
)
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
const styles = StyleSheet.create({
|
|
682
|
+
content: {
|
|
683
|
+
marginHorizontal: cx(24),
|
|
684
|
+
},
|
|
685
|
+
picker: {
|
|
686
|
+
marginHorizontal: cx(24),
|
|
687
|
+
marginVertical: cx(15),
|
|
688
|
+
color: 'rgb(35,35,38)',
|
|
689
|
+
},
|
|
690
|
+
zeroMarginHorizontal: {
|
|
691
|
+
marginHorizontal: 0,
|
|
692
|
+
},
|
|
693
|
+
loopText: {
|
|
694
|
+
fontSize: cx(14),
|
|
695
|
+
fontFamily: 'PingFangSC-Medium',
|
|
696
|
+
color: '#999999',
|
|
697
|
+
marginTop: cx(10),
|
|
698
|
+
},
|
|
699
|
+
itemTitle: {
|
|
700
|
+
color: '#000',
|
|
701
|
+
fontSize: cx(16),
|
|
702
|
+
fontWeight: 'bold',
|
|
703
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
704
|
+
marginTop: cx(30),
|
|
705
|
+
marginBottom: cx(10),
|
|
706
|
+
},
|
|
707
|
+
switchButton: {
|
|
708
|
+
flexDirection: 'row',
|
|
709
|
+
alignItems: 'center',
|
|
710
|
+
justifyContent: 'space-between',
|
|
711
|
+
marginBottom: cx(10),
|
|
712
|
+
},
|
|
713
|
+
text: {
|
|
714
|
+
color: '#000',
|
|
715
|
+
},
|
|
716
|
+
switchCard: {
|
|
717
|
+
paddingVertical: cx(16),
|
|
718
|
+
},
|
|
719
|
+
switchCardContent: {
|
|
720
|
+
flexDirection: 'row',
|
|
721
|
+
alignItems: 'center',
|
|
722
|
+
},
|
|
723
|
+
switchCardTitle: {
|
|
724
|
+
color: '#000',
|
|
725
|
+
fontSize: cx(16),
|
|
726
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
727
|
+
},
|
|
728
|
+
skillListItem: {
|
|
729
|
+
flexDirection: 'row',
|
|
730
|
+
justifyContent: 'space-between',
|
|
731
|
+
height: cx(30),
|
|
732
|
+
alignItems: 'center',
|
|
733
|
+
marginVertical: cx(5),
|
|
734
|
+
},
|
|
735
|
+
summaryContainer: {
|
|
736
|
+
flexDirection: 'row',
|
|
737
|
+
justifyContent: 'flex-start',
|
|
738
|
+
marginBottom: cx(10),
|
|
739
|
+
},
|
|
740
|
+
summaryImg: {
|
|
741
|
+
height: cx(12),
|
|
742
|
+
width: cx(12),
|
|
743
|
+
marginRight: cx(6),
|
|
744
|
+
},
|
|
745
|
+
summaryLeft: {
|
|
746
|
+
flexDirection: 'row',
|
|
747
|
+
alignItems: 'center',
|
|
748
|
+
minWidth: cx(90),
|
|
749
|
+
},
|
|
750
|
+
leftTitle: {
|
|
751
|
+
fontSize: cx(14),
|
|
752
|
+
color: '#000',
|
|
753
|
+
},
|
|
754
|
+
summaryRight: {
|
|
755
|
+
flexDirection: 'column',
|
|
756
|
+
marginLeft: cx(21),
|
|
757
|
+
backgroundColor: '#cbcbcb',
|
|
758
|
+
borderRadius: cx(16),
|
|
759
|
+
},
|
|
760
|
+
rightItem: {
|
|
761
|
+
paddingHorizontal: cx(12),
|
|
762
|
+
color: '#000',
|
|
763
|
+
},
|
|
764
|
+
})
|
|
765
|
+
|
|
766
766
|
export default TimeScheduleEditPage
|