@ledvance/ui-biz-bundle 1.1.11 → 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ import TextField from '@ledvance/base/src/components/TextField'
|
|
|
11
11
|
import Card from '@ledvance/base/src/components/Card'
|
|
12
12
|
import LdvSlider from '@ledvance/base/src/components/ldvSlider'
|
|
13
13
|
import TextButton from '@ledvance/base/src/components/TextButton'
|
|
14
|
-
import { hex2Hsv, hsv2Hex
|
|
14
|
+
import { hex2Hsv, hsv2Hex } from '@ledvance/base/src/utils'
|
|
15
15
|
import { cloneDeep, find, isEqual } from 'lodash'
|
|
16
16
|
import { FlagUiInfo } from './FlagInfo'
|
|
17
17
|
import ColorAdjustView from '@ledvance/base/src/components/ColorAdjustView'
|
|
@@ -60,8 +60,8 @@ const FlagEditPage = () => {
|
|
|
60
60
|
if(isMainLight){
|
|
61
61
|
return cctToColor(state.currentWhiteNode.colorTemp, Math.max(...[state.currentWhiteNode.brightness, 50]))
|
|
62
62
|
}
|
|
63
|
-
const s =
|
|
64
|
-
return hsv2Hex(
|
|
63
|
+
const { h, s, v} = state.currentNode
|
|
64
|
+
return hsv2Hex(h, s, v)
|
|
65
65
|
}, [state.currentNode, state.currentWhiteNode])
|
|
66
66
|
|
|
67
67
|
const nameRepeat = useMemo(() => {
|
|
@@ -162,7 +162,6 @@ const FlagEditPage = () => {
|
|
|
162
162
|
<Text style={styles.light}>
|
|
163
163
|
{I18n.getLang(params.moduleParams.isSupportMixScene ? 'light_sources_tile_sec_lighting_headline' : 'light_sources_tile_tw_lighting_headline')}
|
|
164
164
|
</Text>
|
|
165
|
-
<View style={[styles.preview, { backgroundColor: getColorBlockColor() }]} />
|
|
166
165
|
</View>
|
|
167
166
|
<Spacer height={cx(10)} />
|
|
168
167
|
<LdvSlider
|
|
@@ -274,6 +273,7 @@ const FlagEditPage = () => {
|
|
|
274
273
|
s={state.currentNode.s}
|
|
275
274
|
v={state.currentNode.v}
|
|
276
275
|
reserveSV={true}
|
|
276
|
+
minBrightness={0}
|
|
277
277
|
onHSVChange={(h, s, v) => {
|
|
278
278
|
if (state.colorPaintBucketSelected) {
|
|
279
279
|
state.mood.colors = state.mood.colors.map(() => (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useMemo } from "react";
|
|
2
2
|
import Page from "@ledvance/base/src/components/Page";
|
|
3
|
-
import { useDeviceId, useDeviceInfo } from "@ledvance/base/src/models/modules/NativePropsSlice";
|
|
3
|
+
import { useDeviceId, useDeviceInfo, useFlags, useMoods } from "@ledvance/base/src/models/modules/NativePropsSlice";
|
|
4
4
|
import { FlatList } from "react-native";
|
|
5
5
|
import Spacer from "@ledvance/base/src/components/Spacer";
|
|
6
6
|
import { Utils } from "tuya-panel-kit";
|
|
@@ -9,7 +9,7 @@ import { FlagUiInfo } from "./FlagInfo";
|
|
|
9
9
|
import { getRemoteFlag, saveFlag, useFlag } from "./FlagActions";
|
|
10
10
|
import { useRoute, useNavigation } from '@react-navigation/core'
|
|
11
11
|
import I18n from "@ledvance/base/src/i18n";
|
|
12
|
-
import { useReactive } from "ahooks";
|
|
12
|
+
import { useReactive, useUpdateEffect } from "ahooks";
|
|
13
13
|
import { cloneDeep, difference, isEqual, last, map, range } from "lodash";
|
|
14
14
|
import { ui_biz_routerKey} from "../../navigation/Routers";
|
|
15
15
|
import res from "@ledvance/base/src/res";
|
|
@@ -44,6 +44,8 @@ const FlagPage = () => {
|
|
|
44
44
|
const devId = useDeviceId()
|
|
45
45
|
const navigation = useNavigation()
|
|
46
46
|
const [dps, setDps] = useDps()
|
|
47
|
+
const [moods, setMoods] = useMoods()
|
|
48
|
+
const [flags, setFlags] = useFlags()
|
|
47
49
|
const [flagState, setFlag] = useFlag((params.isStripLight ? params?.drawToolLight?.drawToolCode : params.sceneDataCode)!!, {
|
|
48
50
|
isMixLight: params.isSupportMixScene,
|
|
49
51
|
isStringLight: params.isStringLight,
|
|
@@ -51,8 +53,8 @@ const FlagPage = () => {
|
|
|
51
53
|
})
|
|
52
54
|
const state = useReactive({
|
|
53
55
|
loading: true,
|
|
54
|
-
flags:
|
|
55
|
-
moods: []
|
|
56
|
+
flags: cloneDeep(flags) as FlagUiInfo[],
|
|
57
|
+
moods: params.isStripLight ? [] : cloneDeep(moods)
|
|
56
58
|
})
|
|
57
59
|
const flagId = useMemo(() =>{
|
|
58
60
|
if(flagState.colors !== undefined){
|
|
@@ -71,16 +73,27 @@ const FlagPage = () => {
|
|
|
71
73
|
|
|
72
74
|
useEffect(() => {
|
|
73
75
|
if(!devId) return
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
if(!flags?.length){
|
|
77
|
+
getRemoteFlagInfo().then()
|
|
78
|
+
}
|
|
79
|
+
if(params.getRemoteMoodList && !moods?.length){
|
|
76
80
|
params.getRemoteMoodList(devId).then(res =>{
|
|
77
81
|
if(res.success && Array.isArray(res.data)){
|
|
78
82
|
state.moods = res.data
|
|
83
|
+
setMoods(cloneDeep(res.data))
|
|
79
84
|
}
|
|
80
85
|
})
|
|
81
86
|
}
|
|
82
87
|
}, [devId])
|
|
83
88
|
|
|
89
|
+
useUpdateEffect(() =>{
|
|
90
|
+
state.moods = params.isStripLight ? [] : cloneDeep(moods)
|
|
91
|
+
}, [JSON.stringify(moods)])
|
|
92
|
+
|
|
93
|
+
useUpdateEffect(() =>{
|
|
94
|
+
state.flags = cloneDeep(flags)
|
|
95
|
+
}, [JSON.stringify(flags)])
|
|
96
|
+
|
|
84
97
|
const getRemoteFlagInfo = async () => {
|
|
85
98
|
const res = await getRemoteFlag(devId)
|
|
86
99
|
if (res.success) {
|
|
@@ -92,6 +105,7 @@ const FlagPage = () => {
|
|
|
92
105
|
})
|
|
93
106
|
}
|
|
94
107
|
state.flags = cloneFlag
|
|
108
|
+
setFlags(cloneFlag)
|
|
95
109
|
}
|
|
96
110
|
}
|
|
97
111
|
|
|
@@ -131,6 +145,7 @@ const FlagPage = () => {
|
|
|
131
145
|
const res = await saveFlag(devId, cloneDeep(newScene))
|
|
132
146
|
if (res.success) {
|
|
133
147
|
state.flags = cloneDeep(newScene)
|
|
148
|
+
setFlags(cloneDeep(newScene))
|
|
134
149
|
if(mode === 'del' && currentMood.id !== flagState.id){
|
|
135
150
|
return {
|
|
136
151
|
success: true
|