@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.
Files changed (222) hide show
  1. package/.babelrc +31 -31
  2. package/.eslintignore +5 -5
  3. package/.eslintrc.js +27 -27
  4. package/.prettierrc.js +1 -1
  5. package/.versionrc +5 -5
  6. package/package.json +74 -74
  7. package/rn-cli.config.js +8 -8
  8. package/src/hooks/DeviceDpStateHooks.d.ts +14 -14
  9. package/src/hooks/DeviceDpStateHooks.ts +50 -50
  10. package/src/modules/biorhythm/BiorhythmActions.d.ts +8 -8
  11. package/src/modules/biorhythm/BiorhythmActions.ts +324 -324
  12. package/src/modules/biorhythm/BiorhythmBean.d.ts +58 -58
  13. package/src/modules/biorhythm/BiorhythmBean.ts +230 -230
  14. package/src/modules/biorhythm/BiorhythmEditPage.d.ts +14 -14
  15. package/src/modules/biorhythm/BiorhythmEditPage.tsx +324 -324
  16. package/src/modules/biorhythm/BiorhythmPage.d.ts +10 -10
  17. package/src/modules/biorhythm/BiorhythmPage.tsx +796 -796
  18. package/src/modules/biorhythm/IconSelect.d.ts +2 -2
  19. package/src/modules/biorhythm/IconSelect.tsx +81 -81
  20. package/src/modules/biorhythm/Router.ts +34 -34
  21. package/src/modules/biorhythm/circular/ItemIcon.d.ts +22 -22
  22. package/src/modules/biorhythm/circular/ItemIcon.tsx +172 -172
  23. package/src/modules/biorhythm/circular/Progress.d.ts +24 -24
  24. package/src/modules/biorhythm/circular/Progress.tsx +411 -411
  25. package/src/modules/biorhythm/circular/TimeCircular.d.ts +11 -11
  26. package/src/modules/biorhythm/circular/TimeCircular.tsx +70 -70
  27. package/src/modules/biorhythm/iconListData.d.ts +7 -7
  28. package/src/modules/biorhythm/iconListData.ts +29 -29
  29. package/src/modules/biorhythm/pIdList.d.ts +2 -2
  30. package/src/modules/biorhythm/pIdList.ts +35 -35
  31. package/src/modules/biorhythm/res/BiologicalRes.d.ts +43 -43
  32. package/src/modules/biorhythm/res/BiologicalRes.ts +41 -41
  33. package/src/modules/config/ldvConfig.d.ts +2 -2
  34. package/src/modules/config/ldvConfig.tsx +18 -18
  35. package/src/modules/fixedTime/FixedTimeActions.ts +173 -173
  36. package/src/modules/fixedTime/FixedTimeDetailPage.tsx +372 -372
  37. package/src/modules/fixedTime/FixedTimePage.tsx +213 -213
  38. package/src/modules/fixedTime/Router.ts +26 -26
  39. package/src/modules/flags/FlagActions.ts +267 -267
  40. package/src/modules/flags/FlagEditPage.tsx +441 -441
  41. package/src/modules/flags/FlagInfo.tsx +563 -563
  42. package/src/modules/flags/FlagItem.tsx +90 -90
  43. package/src/modules/flags/FlagPage.tsx +277 -277
  44. package/src/modules/flags/Router.ts +25 -25
  45. package/src/modules/history/HistoryPage.d.ts +2 -2
  46. package/src/modules/history/HistoryPage.tsx +261 -261
  47. package/src/modules/history/Router.ts +16 -16
  48. package/src/modules/history/SwitchHistoryPageActions.d.ts +14 -14
  49. package/src/modules/history/SwitchHistoryPageActions.ts +76 -76
  50. package/src/modules/mood/AddMoodPage.d.ts +10 -10
  51. package/src/modules/mood/AddMoodPage.tsx +792 -792
  52. package/src/modules/mood/DynamicMoodEditorPage.d.ts +6 -6
  53. package/src/modules/mood/DynamicMoodEditorPage.tsx +561 -561
  54. package/src/modules/mood/FantasyMood.tsx +176 -176
  55. package/src/modules/mood/FantasyMoodEditPage.tsx +582 -582
  56. package/src/modules/mood/FantasyMoodItem.tsx +104 -104
  57. package/src/modules/mood/FantasyRouter.ts +35 -35
  58. package/src/modules/mood/MixMood/AddMixMoodPage.tsx +247 -247
  59. package/src/modules/mood/MixMood/MixMoodActions.ts +128 -128
  60. package/src/modules/mood/MixMood/MixMoodEditPage.tsx +721 -721
  61. package/src/modules/mood/MixMood/MixMoodItem.tsx +134 -134
  62. package/src/modules/mood/MixMood/MixMoodPage.tsx +326 -326
  63. package/src/modules/mood/MixMood/MixSceneBeans.ts +364 -364
  64. package/src/modules/mood/MixMood/RecommendMixMoodItem.tsx +69 -69
  65. package/src/modules/mood/MixMood/Router.ts +44 -44
  66. package/src/modules/mood/MoodItem.d.ts +11 -11
  67. package/src/modules/mood/MoodItem.tsx +114 -114
  68. package/src/modules/mood/MoodPage.d.ts +16 -16
  69. package/src/modules/mood/MoodPage.tsx +296 -296
  70. package/src/modules/mood/RecommendMoodItem.d.ts +13 -13
  71. package/src/modules/mood/RecommendMoodItem.tsx +74 -74
  72. package/src/modules/mood/Router.ts +53 -53
  73. package/src/modules/mood/StaticMoodEditorPage.d.ts +16 -16
  74. package/src/modules/mood/StaticMoodEditorPage.tsx +320 -320
  75. package/src/modules/mood/tools.d.ts +3 -3
  76. package/src/modules/mood/tools.ts +11 -11
  77. package/src/modules/music/MusicDataBean.d.ts +47 -47
  78. package/src/modules/music/MusicDataBean.ts +167 -167
  79. package/src/modules/music/MusicManager.d.ts +27 -27
  80. package/src/modules/music/MusicManager.ts +207 -207
  81. package/src/modules/music/MusicPage.d.ts +10 -10
  82. package/src/modules/music/MusicPage.tsx +347 -347
  83. package/src/modules/music/MusicPageActions.d.ts +35 -35
  84. package/src/modules/music/MusicPageActions.ts +317 -317
  85. package/src/modules/music/Router.ts +16 -16
  86. package/src/modules/music/SelecetGenre.d.ts +7 -7
  87. package/src/modules/music/SelecetGenre.tsx +63 -63
  88. package/src/modules/music/color.d.ts +2 -2
  89. package/src/modules/music/color.ts +73 -73
  90. package/src/modules/music/res/index.d.ts +10 -10
  91. package/src/modules/music/res/index.ts +9 -9
  92. package/src/modules/powerOnBehavior/PowerOnBehaviorActions.ts +11 -11
  93. package/src/modules/powerOnBehavior/PowerOnBehaviorPage.tsx +173 -173
  94. package/src/modules/powerOnBehavior/Router.ts +16 -16
  95. package/src/modules/randomTime/RandomTimeActions.ts +160 -160
  96. package/src/modules/randomTime/RandomTimeDetailPage.tsx +337 -337
  97. package/src/modules/randomTime/RandomTimePage.tsx +214 -214
  98. package/src/modules/randomTime/Router.ts +25 -25
  99. package/src/modules/randomTime/Summary.tsx +122 -122
  100. package/src/modules/scene/SceneAction.d.ts +13 -13
  101. package/src/modules/scene/SceneAction.ts +473 -473
  102. package/src/modules/scene/SceneDetailPage.d.ts +1 -1
  103. package/src/modules/scene/SceneDetailPage.tsx +421 -421
  104. package/src/modules/scene/SceneInfo.d.ts +72 -72
  105. package/src/modules/scene/SceneInfo.ts +1059 -1059
  106. package/src/modules/scene/ScenePage.d.ts +7 -7
  107. package/src/modules/scene/ScenePage.tsx +147 -147
  108. package/src/modules/select/SelectPage.d.ts +12 -12
  109. package/src/modules/select/SelectPage.tsx +137 -137
  110. package/src/modules/sleepWakeup/DeviceState.d.ts +9 -9
  111. package/src/modules/sleepWakeup/DeviceState.tsx +99 -99
  112. package/src/modules/sleepWakeup/LdvScheduleItem.d.ts +15 -15
  113. package/src/modules/sleepWakeup/LdvScheduleItem.tsx +176 -176
  114. package/src/modules/sleepWakeup/Router.ts +25 -25
  115. package/src/modules/sleepWakeup/SleepWakeUpActions.d.ts +2 -2
  116. package/src/modules/sleepWakeup/SleepWakeUpActions.ts +180 -180
  117. package/src/modules/sleepWakeup/SleepWakeUpDetailPage.d.ts +2 -2
  118. package/src/modules/sleepWakeup/SleepWakeUpDetailPage.tsx +616 -616
  119. package/src/modules/sleepWakeup/SleepWakeUpPage.d.ts +13 -13
  120. package/src/modules/sleepWakeup/SleepWakeUpPage.tsx +424 -424
  121. package/src/modules/sleepWakeup/utils.d.ts +44 -44
  122. package/src/modules/sleepWakeup/utils.ts +253 -253
  123. package/src/modules/timeSchedule/DeviceState.d.ts +17 -17
  124. package/src/modules/timeSchedule/DeviceState.tsx +94 -94
  125. package/src/modules/timeSchedule/LdvScheduleItem.d.ts +15 -15
  126. package/src/modules/timeSchedule/LdvScheduleItem.tsx +130 -130
  127. package/src/modules/timeSchedule/ManualSetting.d.ts +14 -14
  128. package/src/modules/timeSchedule/ManualSetting.tsx +219 -219
  129. package/src/modules/timeSchedule/MoodSetting.d.ts +11 -11
  130. package/src/modules/timeSchedule/MoodSetting.tsx +228 -228
  131. package/src/modules/timeSchedule/Router.ts +25 -25
  132. package/src/modules/timeSchedule/ScheduleScene.d.ts +6 -6
  133. package/src/modules/timeSchedule/ScheduleScene.tsx +144 -144
  134. package/src/modules/timeSchedule/SingleLightView.d.ts +12 -12
  135. package/src/modules/timeSchedule/SingleLightView.tsx +175 -175
  136. package/src/modules/timeSchedule/TimeScheduleBean.d.ts +14 -14
  137. package/src/modules/timeSchedule/TimeScheduleBean.ts +18 -18
  138. package/src/modules/timeSchedule/TimeScheduleEditpage.d.ts +6 -6
  139. package/src/modules/timeSchedule/TimeScheduleEditpage.tsx +765 -765
  140. package/src/modules/timeSchedule/TimeSchedulePage.d.ts +13 -13
  141. package/src/modules/timeSchedule/TimeSchedulePage.tsx +358 -358
  142. package/src/modules/timeSchedule/components/ColorList.ts +23 -23
  143. package/src/modules/timeSchedule/components/LampSwitchCard.tsx +106 -106
  144. package/src/modules/timeSchedule/mix/MixLightActions.d.ts +3 -3
  145. package/src/modules/timeSchedule/mix/MixLightActions.ts +49 -49
  146. package/src/modules/timeSchedule/mix/MixLightBean.d.ts +10 -10
  147. package/src/modules/timeSchedule/mix/MixLightBean.ts +9 -9
  148. package/src/modules/timeSchedule/mix/MixLightView.d.ts +7 -7
  149. package/src/modules/timeSchedule/mix/MixLightView.tsx +197 -197
  150. package/src/modules/timeSchedule/utils.d.ts +1 -1
  151. package/src/modules/timeSchedule/utils.ts +6 -6
  152. package/src/modules/timer/Router.ts +16 -16
  153. package/src/modules/timer/TimerPage.d.ts +11 -11
  154. package/src/modules/timer/TimerPage.tsx +384 -384
  155. package/src/modules/timer/TimerPageAction.d.ts +22 -22
  156. package/src/modules/timer/TimerPageAction.ts +131 -131
  157. package/src/navigation/Routers.d.ts +15 -15
  158. package/src/navigation/Routers.ts +46 -46
  159. package/src/navigation/tools.d.ts +9 -9
  160. package/src/navigation/tools.ts +21 -21
  161. package/src/newModules/biorhythm/BiorhythmActions.ts +62 -11
  162. package/src/newModules/biorhythm/BiorhythmPage.tsx +1 -4
  163. package/src/newModules/childLock/ChildLockPage.tsx +97 -97
  164. package/src/newModules/childLock/Router.ts +16 -16
  165. package/src/newModules/energyConsumption/EnergyConsumptionActions.ts +23 -23
  166. package/src/newModules/energyConsumption/EnergyConsumptionChart.tsx +84 -84
  167. package/src/newModules/energyConsumption/EnergyConsumptionDetail.tsx +322 -322
  168. package/src/newModules/energyConsumption/EnergyConsumptionPage.tsx +393 -393
  169. package/src/newModules/energyConsumption/Router.ts +34 -34
  170. package/src/newModules/energyConsumption/co2Data.ts +23655 -23655
  171. package/src/newModules/energyConsumption/component/BarChart.tsx +93 -93
  172. package/src/newModules/energyConsumption/component/EnergyModal.tsx +284 -284
  173. package/src/newModules/energyConsumption/component/Overview.tsx +118 -118
  174. package/src/newModules/fixedTime/FixedTimeActions.ts +241 -241
  175. package/src/newModules/fixedTime/FixedTimeDetailPage.tsx +345 -345
  176. package/src/newModules/fixedTime/FixedTimePage.tsx +302 -302
  177. package/src/newModules/fixedTime/Router.ts +25 -25
  178. package/src/newModules/lightMode/LightModePage.tsx +204 -204
  179. package/src/newModules/lightMode/Router.ts +16 -16
  180. package/src/newModules/mood/Interface.ts +5 -0
  181. package/src/newModules/mood/MixDynamicMoodEditor.tsx +8 -5
  182. package/src/newModules/mood/MoodActions.ts +32 -20
  183. package/src/newModules/mood/MoodItem.tsx +3 -3
  184. package/src/newModules/mood/MoodPage.tsx +31 -15
  185. package/src/newModules/mood/MoodParse.ts +5 -6
  186. package/src/newModules/mood/RecommendMoodItem.tsx +3 -3
  187. package/src/newModules/mood/Router.ts +9 -0
  188. package/src/newModules/overchargeSwitch/OverchargeSwitchPage.tsx +96 -96
  189. package/src/newModules/overchargeSwitch/Router.ts +16 -16
  190. package/src/newModules/powerOnBehavior/LightBehaviorPage.tsx +266 -266
  191. package/src/newModules/powerOnBehavior/PlugBehaviorPage.tsx +173 -173
  192. package/src/newModules/powerOnBehavior/PowerOnBehaviorActions.ts +106 -106
  193. package/src/newModules/powerOnBehavior/Router.ts +27 -27
  194. package/src/newModules/randomTime/RandomTimeActions.ts +238 -238
  195. package/src/newModules/randomTime/RandomTimeDetailPage.tsx +325 -325
  196. package/src/newModules/randomTime/RandomTimePage.tsx +299 -299
  197. package/src/newModules/randomTime/Router.ts +25 -25
  198. package/src/newModules/randomTime/Summary.tsx +116 -116
  199. package/src/newModules/remoteControl/RemoteControlActions.ts +5 -5
  200. package/src/newModules/remoteControl/RemoteControlPage.tsx +51 -51
  201. package/src/newModules/remoteControl/Router.ts +15 -15
  202. package/src/newModules/select/Route.ts +16 -16
  203. package/src/newModules/select/SelectPage.d.ts +12 -12
  204. package/src/newModules/select/SelectPage.tsx +137 -137
  205. package/src/newModules/sleepWakeUp/Interface.ts +69 -69
  206. package/src/newModules/sleepWakeUp/Router.ts +24 -24
  207. package/src/newModules/sleepWakeUp/SleepWakeUpActions.ts +317 -317
  208. package/src/newModules/sleepWakeUp/SleepWakeUpDetailPage.tsx +661 -661
  209. package/src/newModules/sleepWakeUp/SleepWakeUpPage.tsx +455 -455
  210. package/src/newModules/sleepWakeUp/utils.ts +253 -253
  211. package/src/newModules/swithInching/Router.ts +16 -16
  212. package/src/newModules/swithInching/SwithInching.tsx +231 -231
  213. package/src/newModules/swithInching/SwithInchingAction.ts +55 -55
  214. package/src/newModules/swithInching/pickerView.tsx +91 -91
  215. package/src/newModules/timeSchedule/Interface.ts +142 -142
  216. package/src/newModules/timeSchedule/Router.ts +25 -25
  217. package/src/newModules/timeSchedule/TimeScheduleActions.ts +53 -53
  218. package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +648 -648
  219. package/src/newModules/timeSchedule/TimeSchedulePage.tsx +253 -253
  220. package/src/newModules/timeSchedule/components/ManuaSettings.tsx +460 -460
  221. package/src/newModules/timeSchedule/components/ScheduleCard.tsx +125 -125
  222. package/tsconfig.json +50 -50
@@ -1,722 +1,722 @@
1
- import Page from '@ledvance/base/src/components/Page'
2
- import I18n from '@ledvance/base/src/i18n'
3
- import { useNavigation, useRoute } from '@react-navigation/native'
4
- import { StackNavigationProp } from '@react-navigation/stack'
5
- import React, { useCallback, useEffect, useMemo } from 'react'
6
- import { useReactive } from 'ahooks'
7
- import { hsv2Hex, mapFloatToRange } from '@ledvance/base/src/utils'
8
- import { cctToColor } from '@ledvance/base/src/utils/cctUtils'
9
- import res from '@ledvance/base/src/res'
10
- import { cloneDeep, find, isEqual } from 'lodash'
11
- import { FlatList, Image, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
12
- import TextField from '@ledvance/base/src/components/TextField'
13
- import Card from '@ledvance/base/src/components/Card'
14
- import Spacer from '@ledvance/base/src/components/Spacer'
15
- import { Utils } from 'tuya-panel-kit'
16
- import LdvSlider from '@ledvance/base/src/components/ldvSlider'
17
- import TextButton from '@ledvance/base/src/components/TextButton'
18
- import { stripLightSceneMode, StripNodeInfo, SceneNodeInfo, StripLightSceneMode, CeilingLightSceneMode, StripSceneInfo } from '../../scene/SceneInfo'
19
- import { MixSceneInfo, MixMainLampInfo, MixSceneNodeInfo } from './MixSceneBeans'
20
- import TextFieldStyleButton from '@ledvance/base/src/components/TextFieldStyleButton'
21
- import { SelectPageParams } from '../../select/SelectPage'
22
- import { ui_biz_routerKey } from '../../../navigation/Routers'
23
- import { MixMoodPageProps } from '@ledvance/ui-biz-bundle/src/modules/mood/MixMood/MixMoodPage'
24
- import Segmented from '@ledvance/base/src/components/Segmented'
25
- import LdvSwitch from '@ledvance/base/src/components/ldvSwitch'
26
- import ColorTempAdjustView from '@ledvance/base/src/components/ColorTempAdjustView'
27
- import ColorAdjustView from '@ledvance/base/src/components/ColorAdjustView'
28
- import { Result } from '@ledvance/base/src/models/modules/Result'
29
- import { showDialog } from '@ledvance/base/src/utils/common'
30
- import { defSecondly } from './AddMixMoodPage'
31
- const cx = Utils.RatioUtils.convertX
32
-
33
- interface MixMoodEditPageState {
34
- headline: string
35
- mood: MixSceneInfo
36
- currentColorNodeIdx: number
37
- currentWhiteNodeIdx: number
38
- paintBucketSelected: boolean
39
- paintWhiteBucketSelected: boolean
40
- sceneMode: StripLightSceneMode
41
- mainLamp: MixMainLampInfo
42
- secondlyLamp: StripSceneInfo
43
- loading: boolean
44
- }
45
-
46
- export interface MixMoodEditParams {
47
- mode: 'add' | 'edit'
48
- isStatic: boolean
49
- currentMood: MixSceneInfo
50
- moods: MixSceneInfo[]
51
- modDeleteFlag: (mode: 'add' | 'edit' | 'del', currentMood: MixSceneInfo) => Promise<Result<any>>
52
- onSave: () => void
53
- moduleParams: MixMoodPageProps
54
- }
55
- const RgbcMoodEditPage = () => {
56
- const navigation = useNavigation<StackNavigationProp<any>>()
57
- const routeParams = useRoute().params as MixMoodEditParams
58
- const params = cloneDeep(routeParams)
59
- const moduleParams = params.moduleParams
60
- const { mainLamp, secondlyLamp } = params.currentMood
61
- const state = useReactive<MixMoodEditPageState>({
62
- headline: '',
63
- mood: params.currentMood,
64
- mainLamp,
65
- secondlyLamp,
66
- currentWhiteNodeIdx: mainLamp.nodes?.length ? mainLamp.nodes.length - 1 : 0,
67
- currentColorNodeIdx: secondlyLamp.nodes?.length ? secondlyLamp.nodes?.length - 1 : 0,
68
- paintBucketSelected: false,
69
- paintWhiteBucketSelected: false,
70
- sceneMode: stripLightSceneMode,
71
- loading: false
72
- })
73
-
74
- useEffect(() => {
75
- state.headline = I18n.getLang(params.mode === 'add' ?
76
- (params.isStatic ? 'add_new_static_mood_headline_text' : 'add_new_dynamic_mood_headline_text') :
77
- (params.isStatic ? 'edit_static_mood_headline_text' : 'edit_static_mood_headline_text'))
78
- }, [params.mode, params.isStatic])
79
-
80
- const getColorBlockColor = useCallback(() => {
81
- if (state.secondlyLamp?.nodes?.length) {
82
- const currentNode = state.secondlyLamp?.nodes?.[state.currentColorNodeIdx]
83
- const s = Math.round(mapFloatToRange(currentNode.s / 100, 30, 100))
84
- if (currentNode.isColorNode) {
85
- return hsv2Hex(currentNode.h, s, 100)
86
- }
87
- }
88
- return '#fff'
89
- }, [state.currentColorNodeIdx, state.secondlyLamp?.nodes])
90
-
91
- const getNodeColor = useCallback((node: MixSceneNodeInfo, isColorNode) => {
92
- if (isColorNode) {
93
- return hsv2Hex(node.h, node.s, node.v)
94
- } else {
95
- return cctToColor(node.colorTemp)
96
- }
97
- }, [])
98
-
99
- const createSecondlySelectModeData = useCallback(() => {
100
- return Object.values(state.sceneMode).map(scene => {
101
- return {
102
- text: scene.title,
103
- selected: scene.mode === state.secondlyLamp.mode,
104
- value: scene.mode,
105
- }
106
- })
107
- }, [state.secondlyLamp.mode, state.sceneMode])
108
-
109
- const createMainSelectModeData = useCallback(() => {
110
- return Object.values(CeilingLightSceneMode).map(scene => {
111
- return {
112
- text: scene.title,
113
- selected: scene.mode === state.mainLamp.mode,
114
- value: scene.mode,
115
- }
116
- })
117
- }, [state.mainLamp.mode])
118
-
119
- const createSelectOtherData = useCallback((otherData) => {
120
- return otherData.map(other => {
121
- return {
122
- text: other.label,
123
- selected: other.value === state.secondlyLamp.expand,
124
- value: other.value,
125
- }
126
- })
127
- }, [state.secondlyLamp.expand])
128
-
129
- const getSelectOther = useCallback((otherData) => {
130
- const currentOther = otherData.find(other => other.value === state.secondlyLamp.expand)
131
- return currentOther.label
132
- }, [state.secondlyLamp.expand])
133
-
134
- const checkMoodDataChanged = useMemo(() =>{
135
- return isEqual({
136
- ...state.mood,
137
- mainLamp: state.mainLamp,
138
- secondlyLamp: state.secondlyLamp
139
- }, params.currentMood)
140
- }, [params.currentMood, state.mood, state.mainLamp, state.secondlyLamp])
141
-
142
- const nameRepeat = useMemo(() => {
143
- return !!find(params.moods, m => ((m.mainLamp.id !== state.mood.mainLamp.id && (params.isStatic ? params.isStatic : m.secondlyLamp.id !== state.mood.secondlyLamp.id)) && m.name === state.mood.name))
144
- }, [state.mood.name, params.isStatic])
145
-
146
- const canSaveMoodData = useMemo(() =>{
147
- return state.mood.name.length > 0 && state.mood.name.length < 33 && !nameRepeat && (params.mode === 'add' || !checkMoodDataChanged)
148
- }, [nameRepeat, state.mood.name, checkMoodDataChanged, params.mode])
149
-
150
- return (
151
- <Page
152
- backText={I18n.getLang('mesh_device_detail_mode')}
153
- showBackDialog={!checkMoodDataChanged}
154
- loading={state.loading}
155
- backDialogTitle={
156
- I18n.getLang(params.mode === 'add' ?
157
- 'string_light_pp_dialog_sm_add_headline_c' :
158
- 'manage_user_unsaved_changes_dialog_headline')
159
- }
160
- backDialogContent={
161
- I18n.getLang(params.mode === 'add' ?
162
- 'strip_light_static_mood_add_step_2_dialog_text' :
163
- 'strip_light_static_mood_editor_step_2_dialog_text')
164
- }
165
- headlineText={state.headline}
166
- rightButtonIcon={canSaveMoodData ? res.ic_check : res.ic_uncheck}
167
- rightButtonIconClick={async () => {
168
- if(state.loading || !canSaveMoodData) return
169
- state.loading = true
170
- const res = await params.modDeleteFlag(params.mode, {
171
- ...state.mood,
172
- mainLamp: state.mainLamp,
173
- secondlyLamp: params.isStatic ? defSecondly : state.secondlyLamp
174
- })
175
- state.loading = false
176
- if (res.success) {
177
- navigation.navigate(ui_biz_routerKey.ui_biz_mix_mood)
178
- }
179
- }}>
180
- <ScrollView
181
- style={{ flex: 1 }}
182
- nestedScrollEnabled={true}>
183
- <View style={styles.root}>
184
- <TextField
185
- style={styles.name}
186
- value={state.mood.name}
187
- placeholder={I18n.getLang('edit_static_mood_inputfield_topic_text')}
188
- onChangeText={text => {
189
- state.mood.name = text
190
- }}
191
- showError={state.mood.name.length > 32 || nameRepeat}
192
- maxLength={33}
193
- tipColor={nameRepeat ? '#f00' : undefined}
194
- tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
195
- errorText={I18n.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')} />
196
- {params.isStatic ? <Card style={styles.adjustCard}>
197
- <LdvSwitch
198
- title={I18n.getLang('light_sources_tile_main_lighting_headline')}
199
- color="#fff"
200
- colorAlpha={1}
201
- enable={false}
202
- setEnable={() => { }}
203
- showSwitch={false}
204
- />
205
- <ColorTempAdjustView
206
- isSupportBrightness={moduleParams.isSupportBrightness}
207
- isSupportTemperature={moduleParams.isSupportTemperature}
208
- colorTemp={state.mainLamp.nodes[state.currentWhiteNodeIdx].colorTemp}
209
- brightness={state.mainLamp.nodes[state.currentWhiteNodeIdx].brightness}
210
- onBrightnessChangeComplete={(bright) => {
211
- state.mainLamp.nodes.forEach(node => {
212
- node.brightness = bright
213
- })
214
- }}
215
- onCCTChangeComplete={(cct) => {
216
- state.mainLamp.nodes.forEach(node => {
217
- node.colorTemp = cct
218
- })
219
- }}
220
- />
221
- <Spacer height={cx(16)}/>
222
- </Card> :
223
- <>
224
- <Card style={styles.adjustCard}>
225
- <LdvSwitch
226
- title={I18n.getLang('light_sources_tile_main_lighting_headline')}
227
- color="#fff"
228
- colorAlpha={1}
229
- enable={false}
230
- setEnable={() => { }}
231
- showSwitch={false}
232
- />
233
- <TextFieldStyleButton
234
- style={styles.transitionMode}
235
- text={CeilingLightSceneMode[state.mainLamp.mode]?.title}
236
- placeholder={I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline')}
237
- onPress={() => {
238
- const paramsSelect: SelectPageParams<number> = {
239
- title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline'),
240
- data: createMainSelectModeData(),
241
- onSelect: selectPageData => {
242
- state.mainLamp.mode = selectPageData.value
243
- },
244
- }
245
- navigation.navigate(ui_biz_routerKey.ui_biz_select_page, paramsSelect)
246
- }} />
247
- <Spacer height={cx(10)} />
248
- <LdvSlider
249
- title={I18n.getLang('add_new_dynamic_mood_lights_field_speed_topic_text')}
250
- value={state.mainLamp.speed}
251
- onValueChange={() => { }}
252
- onSlidingComplete={value => {
253
- state.mainLamp.speed = value
254
- }} />
255
- <Spacer height={cx(16)} />
256
- <View style={styles.nodesAdjust}>
257
- <View style={styles.adjustButtons}>
258
- <TouchableOpacity
259
- onPress={() => {
260
- state.paintWhiteBucketSelected = true
261
- }}>
262
- <Image
263
- style={[styles.adjustButton, { tintColor: state.paintWhiteBucketSelected ? '#f60' : '#666' }]}
264
- source={res.ic_paint_bucket} />
265
- </TouchableOpacity>
266
- <TouchableOpacity
267
- onPress={() => {
268
- state.paintWhiteBucketSelected = false
269
- }}>
270
- <Image
271
- style={[styles.adjustButton, { tintColor: state.paintWhiteBucketSelected ? '#666' : '#f60' }]}
272
- source={res.ic_colorize} />
273
- </TouchableOpacity>
274
- </View>
275
- <FlatList
276
- data={state.mainLamp.nodes}
277
- style={styles.nodeList}
278
- renderItem={({ item, index }) => {
279
- return (
280
- <View style={styles.nodeItem}>
281
- <TouchableOpacity
282
- style={[
283
- styles.nodeBlock,
284
- {
285
- backgroundColor: getNodeColor(item, false),
286
- },
287
- ]}
288
- onPress={() => {
289
- state.currentWhiteNodeIdx = index
290
- }} />
291
- <TouchableOpacity
292
- style={styles.nodeDeleteBtn}
293
- disabled={state.mainLamp.nodes.length < 3}
294
- onPress={() => {
295
- state.mainLamp.nodes.splice(index, 1)
296
- state.currentWhiteNodeIdx = state.mainLamp.nodes.length - 1
297
- }}>
298
- <Image
299
- style={[
300
- styles.nodeDeleteIcon,
301
- {
302
- tintColor: state.mainLamp.nodes.length < 3 ? '#ccc' : '#666',
303
- },
304
- ]}
305
- source={res.ic_mood_del} />
306
- </TouchableOpacity>
307
- </View>
308
- )
309
- }}
310
- keyExtractor={(_, index) => `${index}`}
311
- ItemSeparatorComponent={() => <Spacer height={cx(12)} />}
312
- ListFooterComponent={() => {
313
- if (state.mainLamp.nodes.length >= 8) {
314
- return (<></>)
315
- }
316
- return (
317
- <View>
318
- <Spacer height={cx(12)} />
319
- <TouchableOpacity
320
- style={styles.nodeAddBtn}
321
- onPress={() => {
322
- const node = {
323
- ...state.mainLamp.nodes[state.currentWhiteNodeIdx],
324
- }
325
- state.mainLamp.nodes.push(node)
326
- state.currentWhiteNodeIdx = state.mainLamp.nodes.length - 1
327
- }}>
328
- <Image
329
- style={{
330
- width: cx(18),
331
- height: cx(18),
332
- tintColor: '#000',
333
- }}
334
- source={{ uri: res.add }} />
335
- </TouchableOpacity>
336
- </View>
337
- )
338
- }} />
339
- </View>
340
- <Spacer />
341
- <ColorTempAdjustView
342
- isSupportBrightness={moduleParams.isSupportBrightness}
343
- isSupportTemperature={moduleParams.isSupportTemperature}
344
- colorTemp={state.mainLamp.nodes[state.currentWhiteNodeIdx].colorTemp}
345
- brightness={state.mainLamp.nodes[state.currentWhiteNodeIdx].brightness}
346
- onBrightnessChangeComplete={(bright) => {
347
- state.mainLamp.nodes.forEach((node, idx) => {
348
- if (state.paintWhiteBucketSelected) {
349
- node.brightness = bright
350
- }
351
- if (state.currentWhiteNodeIdx === idx) {
352
- node.brightness = bright
353
- }
354
- })
355
- }}
356
- onCCTChangeComplete={(cct) => {
357
- state.mainLamp.nodes.forEach((node, idx) => {
358
- if (state.paintWhiteBucketSelected) {
359
- node.colorTemp = cct
360
- }
361
- if (state.currentWhiteNodeIdx === idx) {
362
- node.colorTemp = cct
363
- }
364
- })
365
- }}
366
- />
367
- <Spacer height={cx(10)} />
368
- </Card>
369
- <Card style={styles.adjustCard}>
370
- <LdvSwitch
371
- title={I18n.getLang('light_sources_tile_sec_lighting_headline')}
372
- color={'#fff'}
373
- colorAlpha={1}
374
- enable={false}
375
- setEnable={() => { }}
376
- showSwitch={false}
377
- />
378
- <TextFieldStyleButton
379
- style={styles.transitionMode}
380
- text={state.sceneMode[state.secondlyLamp.mode]?.title}
381
- placeholder={I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline')}
382
- onPress={() => {
383
- const paramsSelect: SelectPageParams<number> = {
384
- title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline'),
385
- data: createSecondlySelectModeData(),
386
- onSelect: selectPageData => {
387
- state.secondlyLamp.mode = selectPageData.value
388
- },
389
- }
390
- navigation.navigate(ui_biz_routerKey.ui_biz_select_page, paramsSelect)
391
- }} />
392
- <Spacer height={cx(10)} />
393
- <LdvSlider
394
- title={I18n.getLang('add_new_dynamic_mood_lights_field_speed_topic_text')}
395
- value={state.secondlyLamp.speed}
396
- onValueChange={() => { }}
397
- onSlidingComplete={value => {
398
- state.secondlyLamp.speed = value
399
- }} />
400
- <Spacer height={cx(16)} />
401
- {state.sceneMode[state.secondlyLamp.mode]?.turnOn && <View style={styles.transitionMode}>
402
- <Segmented
403
- value={state.secondlyLamp.direction}
404
- options={[
405
- {
406
- label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text1'),
407
- value: 0
408
- },
409
- {
410
- label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text2'),
411
- value: 1
412
- },
413
- ]}
414
- onChange={(v) => state.secondlyLamp.direction = Number(v)}
415
- />
416
- <Spacer />
417
- </View>}
418
- {state.sceneMode[state.secondlyLamp.mode]?.paragraph && <View style={styles.transitionMode}>
419
- <Segmented
420
- value={state.secondlyLamp.segmented}
421
- options={[
422
- {
423
- label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text3'),
424
- value: 0
425
- },
426
- {
427
- label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text4'),
428
- value: 1
429
- },
430
- ]}
431
- onChange={(v) => state.secondlyLamp.segmented = Number(v)}
432
- />
433
- <Spacer />
434
- </View>}
435
- {state.sceneMode[state.secondlyLamp.mode]?.other && <>
436
- <TextFieldStyleButton
437
- style={styles.transitionMode}
438
- text={getSelectOther(state.sceneMode[state.secondlyLamp.mode]?.other)}
439
- placeholder={I18n.getLang('add_new_dynamic_mood_strip_lights_selectionfield2_topic_text')}
440
- onPress={() => {
441
- const paramsSelect: SelectPageParams<number> = {
442
- title: I18n.getLang('add_new_dynamic_mood_strip_lights_selectionfield2_topic_text'),
443
- data: createSelectOtherData(state.sceneMode[state.secondlyLamp.mode]?.other),
444
- onSelect: selectPageData => {
445
- state.secondlyLamp.expand = selectPageData.value
446
- },
447
- }
448
- navigation.navigate(ui_biz_routerKey.ui_biz_select_page, paramsSelect)
449
- }} />
450
- <Spacer />
451
- </>}
452
- <View style={styles.nodesAdjust}>
453
- <View style={styles.adjustButtons}>
454
- <TouchableOpacity
455
- onPress={() => {
456
- state.paintBucketSelected = true
457
- }}>
458
- <Image
459
- style={[styles.adjustButton, { tintColor: state.paintBucketSelected ? '#f60' : '#666' }]}
460
- source={res.ic_paint_bucket} />
461
- </TouchableOpacity>
462
- <TouchableOpacity
463
- onPress={() => {
464
- state.paintBucketSelected = false
465
- }}>
466
- <Image
467
- style={[styles.adjustButton, { tintColor: state.paintBucketSelected ? '#666' : '#f60' }]}
468
- source={res.ic_colorize} />
469
- </TouchableOpacity>
470
- </View>
471
- <FlatList
472
- data={state.secondlyLamp.nodes}
473
- style={styles.nodeList}
474
- renderItem={({ item, index }) => {
475
- return (
476
- <View style={styles.nodeItem}>
477
- <TouchableOpacity
478
- style={[
479
- styles.nodeBlock,
480
- {
481
- backgroundColor: getNodeColor(item, true),
482
- },
483
- ]}
484
- onPress={() => {
485
- state.currentColorNodeIdx = index
486
- }} />
487
- <TouchableOpacity
488
- style={styles.nodeDeleteBtn}
489
- disabled={state.secondlyLamp.nodes.length < 3}
490
- onPress={() => {
491
- state.secondlyLamp.nodes.splice(index, 1)
492
- state.currentColorNodeIdx = state.secondlyLamp.nodes.length - 1
493
- }}>
494
- <Image
495
- style={[
496
- styles.nodeDeleteIcon,
497
- {
498
- tintColor: state.secondlyLamp.nodes.length < 3 ? '#ccc' : '#666',
499
- },
500
- ]}
501
- source={res.ic_mood_del} />
502
- </TouchableOpacity>
503
- </View>
504
- )
505
- }}
506
- keyExtractor={(_, index) => `${index}`}
507
- ItemSeparatorComponent={() => <Spacer height={cx(12)} />}
508
- ListFooterComponent={() => {
509
- if (state.secondlyLamp.nodes.length >= 8) {
510
- return (<></>)
511
- }
512
- return (
513
- <View>
514
- <Spacer height={cx(12)} />
515
- <TouchableOpacity
516
- style={styles.nodeAddBtn}
517
- onPress={() => {
518
- const node = {
519
- ...state.secondlyLamp?.nodes?.[state.currentColorNodeIdx],
520
- }
521
- state.secondlyLamp.nodes.push(node)
522
- state.currentColorNodeIdx = state.secondlyLamp.nodes.length - 1
523
- }}>
524
- <Image
525
- style={{
526
- width: cx(18),
527
- height: cx(18),
528
- tintColor: '#000',
529
- }}
530
- source={{ uri: res.add }} />
531
- </TouchableOpacity>
532
- </View>
533
- )
534
- }} />
535
- </View>
536
- <Spacer />
537
- <View style={styles.lightLine}>
538
- <Text style={styles.light}>
539
- {I18n.getLang('add_new_dynamic_mood_lights_field_headline2_text')}
540
- </Text>
541
- <View style={[styles.preview, { backgroundColor: getColorBlockColor() }]} />
542
- </View>
543
- <Spacer />
544
- <ColorAdjustView
545
- h={state.secondlyLamp.nodes[state.currentColorNodeIdx]?.h}
546
- s={state.secondlyLamp.nodes[state.currentColorNodeIdx]?.s}
547
- v={state.secondlyLamp.nodes[state.currentColorNodeIdx]?.v}
548
- onHSVChange={() => { }}
549
- onHSVChangeComplete={(h, s, v) => {
550
- state.secondlyLamp.nodes.forEach((node, idx) => {
551
- if (state.paintBucketSelected) {
552
- node.h = h
553
- node.s = s
554
- node.v = v
555
- }
556
- if (state.currentColorNodeIdx === idx) {
557
- node.h = h
558
- node.s = s
559
- node.v = v
560
- }
561
- })
562
- }}
563
- />
564
- <Spacer height={cx(10)} />
565
- </Card>
566
- </>}
567
-
568
- <Spacer />
569
- {params.mode === 'edit' &&
570
- <View style={{ marginTop: cx(20), marginHorizontal: cx(24) }}>
571
- <TextButton
572
- style={styles.deleteBtn}
573
- textStyle={styles.deleteBtnText}
574
- text={I18n.getLang('edit_static_mood_button_delete_text')}
575
- onPress={() => {
576
- showDialog({
577
- method: 'confirm',
578
- title: I18n.getLang('string_light_pp_dialog_sm_ed_headline_d'),
579
- subTitle: I18n.getLang('strip_light_static_mood_edit_dialog_text'),
580
- onConfirm: async (_, { close }) => {
581
- close()
582
- state.loading = true
583
- const res = await params.modDeleteFlag('del', state.mood)
584
- state.loading = false
585
- if(res.success){
586
- navigation.navigate(ui_biz_routerKey.ui_biz_mix_mood)
587
- }
588
- }
589
- })
590
- }} />
591
- </View>}
592
- <Spacer />
593
- </View>
594
- </ScrollView>
595
- </Page>
596
- )
597
- }
598
- const styles = StyleSheet.create({
599
- root: {
600
- flex: 1,
601
- flexDirection: 'column',
602
- },
603
- name: {
604
- marginHorizontal: cx(24),
605
- },
606
- adjustCard: {
607
- marginVertical: cx(12),
608
- marginHorizontal: cx(24),
609
- },
610
- fanAdjustCard: {
611
- marginHorizontal: cx(24),
612
- },
613
- lightLine: {
614
- flexDirection: 'row',
615
- marginHorizontal: cx(16),
616
- },
617
- light: {
618
- color: '#000',
619
- fontSize: cx(18),
620
- fontFamily: 'helvetica_neue_lt_std_bd',
621
- },
622
- transitionMode: {
623
- marginHorizontal: cx(16),
624
- },
625
- preview: {
626
- width: cx(20),
627
- height: cx(20),
628
- marginStart: cx(12),
629
- borderRadius: cx(4),
630
- },
631
- nodesAdjust: {
632
- flexDirection: 'row',
633
- alignItems: 'center',
634
- },
635
- adjustButtons: {
636
- width: cx(44),
637
- marginStart: cx(16),
638
- },
639
- adjustButton: {
640
- width: cx(44),
641
- height: cx(44),
642
- },
643
- nodeList: {
644
- flex: 1,
645
- marginHorizontal: cx(16),
646
- },
647
- nodeItem: {
648
- flexDirection: 'row',
649
- alignItems: 'center',
650
- },
651
- nodeBlock: {
652
- flex: 1,
653
- height: cx(40),
654
- borderRadius: cx(8),
655
- borderWidth: 1,
656
- borderColor: '#ccc'
657
- },
658
- nodeDeleteBtn: {
659
- width: cx(24),
660
- height: cx(30),
661
- justifyContent: 'center',
662
- alignItems: 'center',
663
- },
664
- nodeDeleteIcon: {
665
- width: cx(16),
666
- height: cx(16),
667
- },
668
- nodeAddBtn: {
669
- height: cx(40),
670
- justifyContent: 'center',
671
- alignItems: 'center',
672
- marginEnd: cx(26),
673
- borderRadius: cx(8),
674
- borderWidth: cx(1),
675
- borderStyle: 'dashed',
676
- borderColor: '#666',
677
- backgroundColor: '#f6f6f6',
678
- },
679
- deleteBtn: {
680
- width: '100%',
681
- height: cx(50),
682
- backgroundColor: '#666',
683
- borderRadius: cx(8),
684
- },
685
- deleteBtnText: {
686
- color: '#fff',
687
- fontSize: cx(16),
688
- fontFamily: 'helvetica_neue_lt_std_bd',
689
- },
690
- })
691
-
692
- export const defWhiteNode: SceneNodeInfo[] = [
693
- {
694
- h: 0,
695
- s: 0,
696
- v: 0,
697
- brightness: 100,
698
- colorTemp: 0,
699
- switchingInterval: 50,
700
- transitionTime: 50,
701
- transitionMode: 1,
702
- isColorNode: false
703
- },
704
- {
705
- h: 0,
706
- s: 0,
707
- v: 0,
708
- brightness: 100,
709
- colorTemp: 0,
710
- switchingInterval: 50,
711
- transitionTime: 50,
712
- transitionMode: 1,
713
- isColorNode: false
714
- },
715
- ]
716
-
717
- export const defColorNode: StripNodeInfo[] = [
718
- { h: 0, s: 100, v: 100, brightness: 0, colorTemp: 0, isColorNode: true },
719
- { h: 0, s: 100, v: 100, brightness: 0, colorTemp: 0, isColorNode: true },
720
- ]
721
-
1
+ import Page from '@ledvance/base/src/components/Page'
2
+ import I18n from '@ledvance/base/src/i18n'
3
+ import { useNavigation, useRoute } from '@react-navigation/native'
4
+ import { StackNavigationProp } from '@react-navigation/stack'
5
+ import React, { useCallback, useEffect, useMemo } from 'react'
6
+ import { useReactive } from 'ahooks'
7
+ import { hsv2Hex, mapFloatToRange } from '@ledvance/base/src/utils'
8
+ import { cctToColor } from '@ledvance/base/src/utils/cctUtils'
9
+ import res from '@ledvance/base/src/res'
10
+ import { cloneDeep, find, isEqual } from 'lodash'
11
+ import { FlatList, Image, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
12
+ import TextField from '@ledvance/base/src/components/TextField'
13
+ import Card from '@ledvance/base/src/components/Card'
14
+ import Spacer from '@ledvance/base/src/components/Spacer'
15
+ import { Utils } from 'tuya-panel-kit'
16
+ import LdvSlider from '@ledvance/base/src/components/ldvSlider'
17
+ import TextButton from '@ledvance/base/src/components/TextButton'
18
+ import { stripLightSceneMode, StripNodeInfo, SceneNodeInfo, StripLightSceneMode, CeilingLightSceneMode, StripSceneInfo } from '../../scene/SceneInfo'
19
+ import { MixSceneInfo, MixMainLampInfo, MixSceneNodeInfo } from './MixSceneBeans'
20
+ import TextFieldStyleButton from '@ledvance/base/src/components/TextFieldStyleButton'
21
+ import { SelectPageParams } from '../../select/SelectPage'
22
+ import { ui_biz_routerKey } from '../../../navigation/Routers'
23
+ import { MixMoodPageProps } from '@ledvance/ui-biz-bundle/src/modules/mood/MixMood/MixMoodPage'
24
+ import Segmented from '@ledvance/base/src/components/Segmented'
25
+ import LdvSwitch from '@ledvance/base/src/components/ldvSwitch'
26
+ import ColorTempAdjustView from '@ledvance/base/src/components/ColorTempAdjustView'
27
+ import ColorAdjustView from '@ledvance/base/src/components/ColorAdjustView'
28
+ import { Result } from '@ledvance/base/src/models/modules/Result'
29
+ import { showDialog } from '@ledvance/base/src/utils/common'
30
+ import { defSecondly } from './AddMixMoodPage'
31
+ const cx = Utils.RatioUtils.convertX
32
+
33
+ interface MixMoodEditPageState {
34
+ headline: string
35
+ mood: MixSceneInfo
36
+ currentColorNodeIdx: number
37
+ currentWhiteNodeIdx: number
38
+ paintBucketSelected: boolean
39
+ paintWhiteBucketSelected: boolean
40
+ sceneMode: StripLightSceneMode
41
+ mainLamp: MixMainLampInfo
42
+ secondlyLamp: StripSceneInfo
43
+ loading: boolean
44
+ }
45
+
46
+ export interface MixMoodEditParams {
47
+ mode: 'add' | 'edit'
48
+ isStatic: boolean
49
+ currentMood: MixSceneInfo
50
+ moods: MixSceneInfo[]
51
+ modDeleteFlag: (mode: 'add' | 'edit' | 'del', currentMood: MixSceneInfo) => Promise<Result<any>>
52
+ onSave: () => void
53
+ moduleParams: MixMoodPageProps
54
+ }
55
+ const RgbcMoodEditPage = () => {
56
+ const navigation = useNavigation<StackNavigationProp<any>>()
57
+ const routeParams = useRoute().params as MixMoodEditParams
58
+ const params = cloneDeep(routeParams)
59
+ const moduleParams = params.moduleParams
60
+ const { mainLamp, secondlyLamp } = params.currentMood
61
+ const state = useReactive<MixMoodEditPageState>({
62
+ headline: '',
63
+ mood: params.currentMood,
64
+ mainLamp,
65
+ secondlyLamp,
66
+ currentWhiteNodeIdx: mainLamp.nodes?.length ? mainLamp.nodes.length - 1 : 0,
67
+ currentColorNodeIdx: secondlyLamp.nodes?.length ? secondlyLamp.nodes?.length - 1 : 0,
68
+ paintBucketSelected: false,
69
+ paintWhiteBucketSelected: false,
70
+ sceneMode: stripLightSceneMode,
71
+ loading: false
72
+ })
73
+
74
+ useEffect(() => {
75
+ state.headline = I18n.getLang(params.mode === 'add' ?
76
+ (params.isStatic ? 'add_new_static_mood_headline_text' : 'add_new_dynamic_mood_headline_text') :
77
+ (params.isStatic ? 'edit_static_mood_headline_text' : 'edit_static_mood_headline_text'))
78
+ }, [params.mode, params.isStatic])
79
+
80
+ const getColorBlockColor = useCallback(() => {
81
+ if (state.secondlyLamp?.nodes?.length) {
82
+ const currentNode = state.secondlyLamp?.nodes?.[state.currentColorNodeIdx]
83
+ const s = Math.round(mapFloatToRange(currentNode.s / 100, 30, 100))
84
+ if (currentNode.isColorNode) {
85
+ return hsv2Hex(currentNode.h, s, 100)
86
+ }
87
+ }
88
+ return '#fff'
89
+ }, [state.currentColorNodeIdx, state.secondlyLamp?.nodes])
90
+
91
+ const getNodeColor = useCallback((node: MixSceneNodeInfo, isColorNode) => {
92
+ if (isColorNode) {
93
+ return hsv2Hex(node.h, node.s, node.v)
94
+ } else {
95
+ return cctToColor(node.colorTemp)
96
+ }
97
+ }, [])
98
+
99
+ const createSecondlySelectModeData = useCallback(() => {
100
+ return Object.values(state.sceneMode).map(scene => {
101
+ return {
102
+ text: scene.title,
103
+ selected: scene.mode === state.secondlyLamp.mode,
104
+ value: scene.mode,
105
+ }
106
+ })
107
+ }, [state.secondlyLamp.mode, state.sceneMode])
108
+
109
+ const createMainSelectModeData = useCallback(() => {
110
+ return Object.values(CeilingLightSceneMode).map(scene => {
111
+ return {
112
+ text: scene.title,
113
+ selected: scene.mode === state.mainLamp.mode,
114
+ value: scene.mode,
115
+ }
116
+ })
117
+ }, [state.mainLamp.mode])
118
+
119
+ const createSelectOtherData = useCallback((otherData) => {
120
+ return otherData.map(other => {
121
+ return {
122
+ text: other.label,
123
+ selected: other.value === state.secondlyLamp.expand,
124
+ value: other.value,
125
+ }
126
+ })
127
+ }, [state.secondlyLamp.expand])
128
+
129
+ const getSelectOther = useCallback((otherData) => {
130
+ const currentOther = otherData.find(other => other.value === state.secondlyLamp.expand)
131
+ return currentOther.label
132
+ }, [state.secondlyLamp.expand])
133
+
134
+ const checkMoodDataChanged = useMemo(() =>{
135
+ return isEqual({
136
+ ...state.mood,
137
+ mainLamp: state.mainLamp,
138
+ secondlyLamp: state.secondlyLamp
139
+ }, params.currentMood)
140
+ }, [params.currentMood, state.mood, state.mainLamp, state.secondlyLamp])
141
+
142
+ const nameRepeat = useMemo(() => {
143
+ return !!find(params.moods, m => ((m.mainLamp.id !== state.mood.mainLamp.id && (params.isStatic ? params.isStatic : m.secondlyLamp.id !== state.mood.secondlyLamp.id)) && m.name === state.mood.name))
144
+ }, [state.mood.name, params.isStatic])
145
+
146
+ const canSaveMoodData = useMemo(() =>{
147
+ return state.mood.name.length > 0 && state.mood.name.length < 33 && !nameRepeat && (params.mode === 'add' || !checkMoodDataChanged)
148
+ }, [nameRepeat, state.mood.name, checkMoodDataChanged, params.mode])
149
+
150
+ return (
151
+ <Page
152
+ backText={I18n.getLang('mesh_device_detail_mode')}
153
+ showBackDialog={!checkMoodDataChanged}
154
+ loading={state.loading}
155
+ backDialogTitle={
156
+ I18n.getLang(params.mode === 'add' ?
157
+ 'string_light_pp_dialog_sm_add_headline_c' :
158
+ 'manage_user_unsaved_changes_dialog_headline')
159
+ }
160
+ backDialogContent={
161
+ I18n.getLang(params.mode === 'add' ?
162
+ 'strip_light_static_mood_add_step_2_dialog_text' :
163
+ 'strip_light_static_mood_editor_step_2_dialog_text')
164
+ }
165
+ headlineText={state.headline}
166
+ rightButtonIcon={canSaveMoodData ? res.ic_check : res.ic_uncheck}
167
+ rightButtonIconClick={async () => {
168
+ if(state.loading || !canSaveMoodData) return
169
+ state.loading = true
170
+ const res = await params.modDeleteFlag(params.mode, {
171
+ ...state.mood,
172
+ mainLamp: state.mainLamp,
173
+ secondlyLamp: params.isStatic ? defSecondly : state.secondlyLamp
174
+ })
175
+ state.loading = false
176
+ if (res.success) {
177
+ navigation.navigate(ui_biz_routerKey.ui_biz_mix_mood)
178
+ }
179
+ }}>
180
+ <ScrollView
181
+ style={{ flex: 1 }}
182
+ nestedScrollEnabled={true}>
183
+ <View style={styles.root}>
184
+ <TextField
185
+ style={styles.name}
186
+ value={state.mood.name}
187
+ placeholder={I18n.getLang('edit_static_mood_inputfield_topic_text')}
188
+ onChangeText={text => {
189
+ state.mood.name = text
190
+ }}
191
+ showError={state.mood.name.length > 32 || nameRepeat}
192
+ maxLength={33}
193
+ tipColor={nameRepeat ? '#f00' : undefined}
194
+ tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
195
+ errorText={I18n.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')} />
196
+ {params.isStatic ? <Card style={styles.adjustCard}>
197
+ <LdvSwitch
198
+ title={I18n.getLang('light_sources_tile_main_lighting_headline')}
199
+ color="#fff"
200
+ colorAlpha={1}
201
+ enable={false}
202
+ setEnable={() => { }}
203
+ showSwitch={false}
204
+ />
205
+ <ColorTempAdjustView
206
+ isSupportBrightness={moduleParams.isSupportBrightness}
207
+ isSupportTemperature={moduleParams.isSupportTemperature}
208
+ colorTemp={state.mainLamp.nodes[state.currentWhiteNodeIdx].colorTemp}
209
+ brightness={state.mainLamp.nodes[state.currentWhiteNodeIdx].brightness}
210
+ onBrightnessChangeComplete={(bright) => {
211
+ state.mainLamp.nodes.forEach(node => {
212
+ node.brightness = bright
213
+ })
214
+ }}
215
+ onCCTChangeComplete={(cct) => {
216
+ state.mainLamp.nodes.forEach(node => {
217
+ node.colorTemp = cct
218
+ })
219
+ }}
220
+ />
221
+ <Spacer height={cx(16)}/>
222
+ </Card> :
223
+ <>
224
+ <Card style={styles.adjustCard}>
225
+ <LdvSwitch
226
+ title={I18n.getLang('light_sources_tile_main_lighting_headline')}
227
+ color="#fff"
228
+ colorAlpha={1}
229
+ enable={false}
230
+ setEnable={() => { }}
231
+ showSwitch={false}
232
+ />
233
+ <TextFieldStyleButton
234
+ style={styles.transitionMode}
235
+ text={CeilingLightSceneMode[state.mainLamp.mode]?.title}
236
+ placeholder={I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline')}
237
+ onPress={() => {
238
+ const paramsSelect: SelectPageParams<number> = {
239
+ title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline'),
240
+ data: createMainSelectModeData(),
241
+ onSelect: selectPageData => {
242
+ state.mainLamp.mode = selectPageData.value
243
+ },
244
+ }
245
+ navigation.navigate(ui_biz_routerKey.ui_biz_select_page, paramsSelect)
246
+ }} />
247
+ <Spacer height={cx(10)} />
248
+ <LdvSlider
249
+ title={I18n.getLang('add_new_dynamic_mood_lights_field_speed_topic_text')}
250
+ value={state.mainLamp.speed}
251
+ onValueChange={() => { }}
252
+ onSlidingComplete={value => {
253
+ state.mainLamp.speed = value
254
+ }} />
255
+ <Spacer height={cx(16)} />
256
+ <View style={styles.nodesAdjust}>
257
+ <View style={styles.adjustButtons}>
258
+ <TouchableOpacity
259
+ onPress={() => {
260
+ state.paintWhiteBucketSelected = true
261
+ }}>
262
+ <Image
263
+ style={[styles.adjustButton, { tintColor: state.paintWhiteBucketSelected ? '#f60' : '#666' }]}
264
+ source={res.ic_paint_bucket} />
265
+ </TouchableOpacity>
266
+ <TouchableOpacity
267
+ onPress={() => {
268
+ state.paintWhiteBucketSelected = false
269
+ }}>
270
+ <Image
271
+ style={[styles.adjustButton, { tintColor: state.paintWhiteBucketSelected ? '#666' : '#f60' }]}
272
+ source={res.ic_colorize} />
273
+ </TouchableOpacity>
274
+ </View>
275
+ <FlatList
276
+ data={state.mainLamp.nodes}
277
+ style={styles.nodeList}
278
+ renderItem={({ item, index }) => {
279
+ return (
280
+ <View style={styles.nodeItem}>
281
+ <TouchableOpacity
282
+ style={[
283
+ styles.nodeBlock,
284
+ {
285
+ backgroundColor: getNodeColor(item, false),
286
+ },
287
+ ]}
288
+ onPress={() => {
289
+ state.currentWhiteNodeIdx = index
290
+ }} />
291
+ <TouchableOpacity
292
+ style={styles.nodeDeleteBtn}
293
+ disabled={state.mainLamp.nodes.length < 3}
294
+ onPress={() => {
295
+ state.mainLamp.nodes.splice(index, 1)
296
+ state.currentWhiteNodeIdx = state.mainLamp.nodes.length - 1
297
+ }}>
298
+ <Image
299
+ style={[
300
+ styles.nodeDeleteIcon,
301
+ {
302
+ tintColor: state.mainLamp.nodes.length < 3 ? '#ccc' : '#666',
303
+ },
304
+ ]}
305
+ source={res.ic_mood_del} />
306
+ </TouchableOpacity>
307
+ </View>
308
+ )
309
+ }}
310
+ keyExtractor={(_, index) => `${index}`}
311
+ ItemSeparatorComponent={() => <Spacer height={cx(12)} />}
312
+ ListFooterComponent={() => {
313
+ if (state.mainLamp.nodes.length >= 8) {
314
+ return (<></>)
315
+ }
316
+ return (
317
+ <View>
318
+ <Spacer height={cx(12)} />
319
+ <TouchableOpacity
320
+ style={styles.nodeAddBtn}
321
+ onPress={() => {
322
+ const node = {
323
+ ...state.mainLamp.nodes[state.currentWhiteNodeIdx],
324
+ }
325
+ state.mainLamp.nodes.push(node)
326
+ state.currentWhiteNodeIdx = state.mainLamp.nodes.length - 1
327
+ }}>
328
+ <Image
329
+ style={{
330
+ width: cx(18),
331
+ height: cx(18),
332
+ tintColor: '#000',
333
+ }}
334
+ source={{ uri: res.add }} />
335
+ </TouchableOpacity>
336
+ </View>
337
+ )
338
+ }} />
339
+ </View>
340
+ <Spacer />
341
+ <ColorTempAdjustView
342
+ isSupportBrightness={moduleParams.isSupportBrightness}
343
+ isSupportTemperature={moduleParams.isSupportTemperature}
344
+ colorTemp={state.mainLamp.nodes[state.currentWhiteNodeIdx].colorTemp}
345
+ brightness={state.mainLamp.nodes[state.currentWhiteNodeIdx].brightness}
346
+ onBrightnessChangeComplete={(bright) => {
347
+ state.mainLamp.nodes.forEach((node, idx) => {
348
+ if (state.paintWhiteBucketSelected) {
349
+ node.brightness = bright
350
+ }
351
+ if (state.currentWhiteNodeIdx === idx) {
352
+ node.brightness = bright
353
+ }
354
+ })
355
+ }}
356
+ onCCTChangeComplete={(cct) => {
357
+ state.mainLamp.nodes.forEach((node, idx) => {
358
+ if (state.paintWhiteBucketSelected) {
359
+ node.colorTemp = cct
360
+ }
361
+ if (state.currentWhiteNodeIdx === idx) {
362
+ node.colorTemp = cct
363
+ }
364
+ })
365
+ }}
366
+ />
367
+ <Spacer height={cx(10)} />
368
+ </Card>
369
+ <Card style={styles.adjustCard}>
370
+ <LdvSwitch
371
+ title={I18n.getLang('light_sources_tile_sec_lighting_headline')}
372
+ color={'#fff'}
373
+ colorAlpha={1}
374
+ enable={false}
375
+ setEnable={() => { }}
376
+ showSwitch={false}
377
+ />
378
+ <TextFieldStyleButton
379
+ style={styles.transitionMode}
380
+ text={state.sceneMode[state.secondlyLamp.mode]?.title}
381
+ placeholder={I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline')}
382
+ onPress={() => {
383
+ const paramsSelect: SelectPageParams<number> = {
384
+ title: I18n.getLang('add_new_dynamic_mood_color_changing_mode_headline'),
385
+ data: createSecondlySelectModeData(),
386
+ onSelect: selectPageData => {
387
+ state.secondlyLamp.mode = selectPageData.value
388
+ },
389
+ }
390
+ navigation.navigate(ui_biz_routerKey.ui_biz_select_page, paramsSelect)
391
+ }} />
392
+ <Spacer height={cx(10)} />
393
+ <LdvSlider
394
+ title={I18n.getLang('add_new_dynamic_mood_lights_field_speed_topic_text')}
395
+ value={state.secondlyLamp.speed}
396
+ onValueChange={() => { }}
397
+ onSlidingComplete={value => {
398
+ state.secondlyLamp.speed = value
399
+ }} />
400
+ <Spacer height={cx(16)} />
401
+ {state.sceneMode[state.secondlyLamp.mode]?.turnOn && <View style={styles.transitionMode}>
402
+ <Segmented
403
+ value={state.secondlyLamp.direction}
404
+ options={[
405
+ {
406
+ label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text1'),
407
+ value: 0
408
+ },
409
+ {
410
+ label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text2'),
411
+ value: 1
412
+ },
413
+ ]}
414
+ onChange={(v) => state.secondlyLamp.direction = Number(v)}
415
+ />
416
+ <Spacer />
417
+ </View>}
418
+ {state.sceneMode[state.secondlyLamp.mode]?.paragraph && <View style={styles.transitionMode}>
419
+ <Segmented
420
+ value={state.secondlyLamp.segmented}
421
+ options={[
422
+ {
423
+ label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text3'),
424
+ value: 0
425
+ },
426
+ {
427
+ label: I18n.getLang('add_new_dynamic_mood_strip_lights_switch_tab_text4'),
428
+ value: 1
429
+ },
430
+ ]}
431
+ onChange={(v) => state.secondlyLamp.segmented = Number(v)}
432
+ />
433
+ <Spacer />
434
+ </View>}
435
+ {state.sceneMode[state.secondlyLamp.mode]?.other && <>
436
+ <TextFieldStyleButton
437
+ style={styles.transitionMode}
438
+ text={getSelectOther(state.sceneMode[state.secondlyLamp.mode]?.other)}
439
+ placeholder={I18n.getLang('add_new_dynamic_mood_strip_lights_selectionfield2_topic_text')}
440
+ onPress={() => {
441
+ const paramsSelect: SelectPageParams<number> = {
442
+ title: I18n.getLang('add_new_dynamic_mood_strip_lights_selectionfield2_topic_text'),
443
+ data: createSelectOtherData(state.sceneMode[state.secondlyLamp.mode]?.other),
444
+ onSelect: selectPageData => {
445
+ state.secondlyLamp.expand = selectPageData.value
446
+ },
447
+ }
448
+ navigation.navigate(ui_biz_routerKey.ui_biz_select_page, paramsSelect)
449
+ }} />
450
+ <Spacer />
451
+ </>}
452
+ <View style={styles.nodesAdjust}>
453
+ <View style={styles.adjustButtons}>
454
+ <TouchableOpacity
455
+ onPress={() => {
456
+ state.paintBucketSelected = true
457
+ }}>
458
+ <Image
459
+ style={[styles.adjustButton, { tintColor: state.paintBucketSelected ? '#f60' : '#666' }]}
460
+ source={res.ic_paint_bucket} />
461
+ </TouchableOpacity>
462
+ <TouchableOpacity
463
+ onPress={() => {
464
+ state.paintBucketSelected = false
465
+ }}>
466
+ <Image
467
+ style={[styles.adjustButton, { tintColor: state.paintBucketSelected ? '#666' : '#f60' }]}
468
+ source={res.ic_colorize} />
469
+ </TouchableOpacity>
470
+ </View>
471
+ <FlatList
472
+ data={state.secondlyLamp.nodes}
473
+ style={styles.nodeList}
474
+ renderItem={({ item, index }) => {
475
+ return (
476
+ <View style={styles.nodeItem}>
477
+ <TouchableOpacity
478
+ style={[
479
+ styles.nodeBlock,
480
+ {
481
+ backgroundColor: getNodeColor(item, true),
482
+ },
483
+ ]}
484
+ onPress={() => {
485
+ state.currentColorNodeIdx = index
486
+ }} />
487
+ <TouchableOpacity
488
+ style={styles.nodeDeleteBtn}
489
+ disabled={state.secondlyLamp.nodes.length < 3}
490
+ onPress={() => {
491
+ state.secondlyLamp.nodes.splice(index, 1)
492
+ state.currentColorNodeIdx = state.secondlyLamp.nodes.length - 1
493
+ }}>
494
+ <Image
495
+ style={[
496
+ styles.nodeDeleteIcon,
497
+ {
498
+ tintColor: state.secondlyLamp.nodes.length < 3 ? '#ccc' : '#666',
499
+ },
500
+ ]}
501
+ source={res.ic_mood_del} />
502
+ </TouchableOpacity>
503
+ </View>
504
+ )
505
+ }}
506
+ keyExtractor={(_, index) => `${index}`}
507
+ ItemSeparatorComponent={() => <Spacer height={cx(12)} />}
508
+ ListFooterComponent={() => {
509
+ if (state.secondlyLamp.nodes.length >= 8) {
510
+ return (<></>)
511
+ }
512
+ return (
513
+ <View>
514
+ <Spacer height={cx(12)} />
515
+ <TouchableOpacity
516
+ style={styles.nodeAddBtn}
517
+ onPress={() => {
518
+ const node = {
519
+ ...state.secondlyLamp?.nodes?.[state.currentColorNodeIdx],
520
+ }
521
+ state.secondlyLamp.nodes.push(node)
522
+ state.currentColorNodeIdx = state.secondlyLamp.nodes.length - 1
523
+ }}>
524
+ <Image
525
+ style={{
526
+ width: cx(18),
527
+ height: cx(18),
528
+ tintColor: '#000',
529
+ }}
530
+ source={{ uri: res.add }} />
531
+ </TouchableOpacity>
532
+ </View>
533
+ )
534
+ }} />
535
+ </View>
536
+ <Spacer />
537
+ <View style={styles.lightLine}>
538
+ <Text style={styles.light}>
539
+ {I18n.getLang('add_new_dynamic_mood_lights_field_headline2_text')}
540
+ </Text>
541
+ <View style={[styles.preview, { backgroundColor: getColorBlockColor() }]} />
542
+ </View>
543
+ <Spacer />
544
+ <ColorAdjustView
545
+ h={state.secondlyLamp.nodes[state.currentColorNodeIdx]?.h}
546
+ s={state.secondlyLamp.nodes[state.currentColorNodeIdx]?.s}
547
+ v={state.secondlyLamp.nodes[state.currentColorNodeIdx]?.v}
548
+ onHSVChange={() => { }}
549
+ onHSVChangeComplete={(h, s, v) => {
550
+ state.secondlyLamp.nodes.forEach((node, idx) => {
551
+ if (state.paintBucketSelected) {
552
+ node.h = h
553
+ node.s = s
554
+ node.v = v
555
+ }
556
+ if (state.currentColorNodeIdx === idx) {
557
+ node.h = h
558
+ node.s = s
559
+ node.v = v
560
+ }
561
+ })
562
+ }}
563
+ />
564
+ <Spacer height={cx(10)} />
565
+ </Card>
566
+ </>}
567
+
568
+ <Spacer />
569
+ {params.mode === 'edit' &&
570
+ <View style={{ marginTop: cx(20), marginHorizontal: cx(24) }}>
571
+ <TextButton
572
+ style={styles.deleteBtn}
573
+ textStyle={styles.deleteBtnText}
574
+ text={I18n.getLang('edit_static_mood_button_delete_text')}
575
+ onPress={() => {
576
+ showDialog({
577
+ method: 'confirm',
578
+ title: I18n.getLang('string_light_pp_dialog_sm_ed_headline_d'),
579
+ subTitle: I18n.getLang('strip_light_static_mood_edit_dialog_text'),
580
+ onConfirm: async (_, { close }) => {
581
+ close()
582
+ state.loading = true
583
+ const res = await params.modDeleteFlag('del', state.mood)
584
+ state.loading = false
585
+ if(res.success){
586
+ navigation.navigate(ui_biz_routerKey.ui_biz_mix_mood)
587
+ }
588
+ }
589
+ })
590
+ }} />
591
+ </View>}
592
+ <Spacer />
593
+ </View>
594
+ </ScrollView>
595
+ </Page>
596
+ )
597
+ }
598
+ const styles = StyleSheet.create({
599
+ root: {
600
+ flex: 1,
601
+ flexDirection: 'column',
602
+ },
603
+ name: {
604
+ marginHorizontal: cx(24),
605
+ },
606
+ adjustCard: {
607
+ marginVertical: cx(12),
608
+ marginHorizontal: cx(24),
609
+ },
610
+ fanAdjustCard: {
611
+ marginHorizontal: cx(24),
612
+ },
613
+ lightLine: {
614
+ flexDirection: 'row',
615
+ marginHorizontal: cx(16),
616
+ },
617
+ light: {
618
+ color: '#000',
619
+ fontSize: cx(18),
620
+ fontFamily: 'helvetica_neue_lt_std_bd',
621
+ },
622
+ transitionMode: {
623
+ marginHorizontal: cx(16),
624
+ },
625
+ preview: {
626
+ width: cx(20),
627
+ height: cx(20),
628
+ marginStart: cx(12),
629
+ borderRadius: cx(4),
630
+ },
631
+ nodesAdjust: {
632
+ flexDirection: 'row',
633
+ alignItems: 'center',
634
+ },
635
+ adjustButtons: {
636
+ width: cx(44),
637
+ marginStart: cx(16),
638
+ },
639
+ adjustButton: {
640
+ width: cx(44),
641
+ height: cx(44),
642
+ },
643
+ nodeList: {
644
+ flex: 1,
645
+ marginHorizontal: cx(16),
646
+ },
647
+ nodeItem: {
648
+ flexDirection: 'row',
649
+ alignItems: 'center',
650
+ },
651
+ nodeBlock: {
652
+ flex: 1,
653
+ height: cx(40),
654
+ borderRadius: cx(8),
655
+ borderWidth: 1,
656
+ borderColor: '#ccc'
657
+ },
658
+ nodeDeleteBtn: {
659
+ width: cx(24),
660
+ height: cx(30),
661
+ justifyContent: 'center',
662
+ alignItems: 'center',
663
+ },
664
+ nodeDeleteIcon: {
665
+ width: cx(16),
666
+ height: cx(16),
667
+ },
668
+ nodeAddBtn: {
669
+ height: cx(40),
670
+ justifyContent: 'center',
671
+ alignItems: 'center',
672
+ marginEnd: cx(26),
673
+ borderRadius: cx(8),
674
+ borderWidth: cx(1),
675
+ borderStyle: 'dashed',
676
+ borderColor: '#666',
677
+ backgroundColor: '#f6f6f6',
678
+ },
679
+ deleteBtn: {
680
+ width: '100%',
681
+ height: cx(50),
682
+ backgroundColor: '#666',
683
+ borderRadius: cx(8),
684
+ },
685
+ deleteBtnText: {
686
+ color: '#fff',
687
+ fontSize: cx(16),
688
+ fontFamily: 'helvetica_neue_lt_std_bd',
689
+ },
690
+ })
691
+
692
+ export const defWhiteNode: SceneNodeInfo[] = [
693
+ {
694
+ h: 0,
695
+ s: 0,
696
+ v: 0,
697
+ brightness: 100,
698
+ colorTemp: 0,
699
+ switchingInterval: 50,
700
+ transitionTime: 50,
701
+ transitionMode: 1,
702
+ isColorNode: false
703
+ },
704
+ {
705
+ h: 0,
706
+ s: 0,
707
+ v: 0,
708
+ brightness: 100,
709
+ colorTemp: 0,
710
+ switchingInterval: 50,
711
+ transitionTime: 50,
712
+ transitionMode: 1,
713
+ isColorNode: false
714
+ },
715
+ ]
716
+
717
+ export const defColorNode: StripNodeInfo[] = [
718
+ { h: 0, s: 100, v: 100, brightness: 0, colorTemp: 0, isColorNode: true },
719
+ { h: 0, s: 100, v: 100, brightness: 0, colorTemp: 0, isColorNode: true },
720
+ ]
721
+
722
722
  export default RgbcMoodEditPage