@ledvance/ui-biz-bundle 1.1.32 → 1.1.33
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
|
@@ -57,7 +57,19 @@ export const useFlag: UseFlagType = (flagCode, extra) => {
|
|
|
57
57
|
setDps({ [flagCode]: hex})
|
|
58
58
|
}, idx * 50)
|
|
59
59
|
})
|
|
60
|
-
|
|
60
|
+
const extraDps = {}
|
|
61
|
+
if(extra.isCeilingLight){
|
|
62
|
+
const whiteHex = obj2Dp(flagItem, extra)
|
|
63
|
+
extraDps[extra.switchLedCode] = true,
|
|
64
|
+
extraDps[extra.rgbcSwitchLedCode!] = true
|
|
65
|
+
extraDps[extra.rgbcWorkModeCode!] = WORK_MODE.COLOUR
|
|
66
|
+
extraDps[extra.workModeCode] = WORK_MODE.SCENE
|
|
67
|
+
extraDps[extra.sceneDataCode!!] = whiteHex
|
|
68
|
+
}else{
|
|
69
|
+
extraDps[extra.switchLedCode] = true
|
|
70
|
+
extraDps[extra.workModeCode] = WORK_MODE.COLOUR
|
|
71
|
+
}
|
|
72
|
+
return setDps(extraDps)
|
|
61
73
|
} else {
|
|
62
74
|
const hex = obj2Dp(flagItem, extra)
|
|
63
75
|
return setDps({ [flagCode]: hex, [extra.workModeCode]: WORK_MODE.SCENE, [extra.switchLedCode]: true })
|
|
@@ -69,6 +81,7 @@ export const useFlag: UseFlagType = (flagCode, extra) => {
|
|
|
69
81
|
export interface FlagOption {
|
|
70
82
|
isMixLight?: boolean
|
|
71
83
|
isStringLight?: boolean
|
|
84
|
+
isCeilingLight?: boolean
|
|
72
85
|
workModeCode: string
|
|
73
86
|
}
|
|
74
87
|
|
|
@@ -129,8 +142,8 @@ export function obj2Dp(flagItem: FlagItemInfo, option?: FlagOption): string {
|
|
|
129
142
|
} else {
|
|
130
143
|
const switchingIntervalHex = nToHS(flagItem.speed)
|
|
131
144
|
const transitionTimeHex = nToHS(flagItem.speed)
|
|
132
|
-
const transitionModeHex = nToHS(flagItem.mode)
|
|
133
|
-
const
|
|
145
|
+
const transitionModeHex = nToHS(option?.isCeilingLight ? SceneNodeTransitionMode.Static : flagItem.mode)
|
|
146
|
+
const colorHex = flagItem.colors.map(color => {
|
|
134
147
|
const hHex = nToHS(Math.round(color.h), 4)
|
|
135
148
|
const sHex = nToHS(Math.round(color.s * 10), 4)
|
|
136
149
|
const vHex = nToHS(Math.round(color.v * 10), 4)
|
|
@@ -138,6 +151,9 @@ export function obj2Dp(flagItem: FlagItemInfo, option?: FlagOption): string {
|
|
|
138
151
|
const colorTempHex = '0000'
|
|
139
152
|
return switchingIntervalHex + transitionTimeHex + transitionModeHex + hHex + sHex + vHex + brightnessHex + colorTempHex
|
|
140
153
|
}).join('')
|
|
154
|
+
const whiteColor = flagItem.whiteColors[0]
|
|
155
|
+
const whiteHex = switchingIntervalHex + transitionTimeHex + transitionModeHex + '0000' + '0000' + '0000' + nToHS(whiteColor?.brightness * 10, 4) + nToHS(whiteColor?.colorTemp * 10, 4)
|
|
156
|
+
const hex = idHex + (option?.isCeilingLight ? whiteHex : colorHex)
|
|
141
157
|
return hex
|
|
142
158
|
}
|
|
143
159
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback,
|
|
1
|
+
import React, { useCallback, useMemo } from 'react'
|
|
2
2
|
import I18n from '@ledvance/base/src/i18n'
|
|
3
3
|
import { useNavigation, useRoute } from '@react-navigation/native'
|
|
4
4
|
import Page from '@ledvance/base/src/components/Page'
|
|
@@ -46,8 +46,6 @@ const FlagEditPage = () => {
|
|
|
46
46
|
colorPaintBucketSelected: false,
|
|
47
47
|
loading: false
|
|
48
48
|
})
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
}, [])
|
|
51
49
|
|
|
52
50
|
const getButtonStatus = () => {
|
|
53
51
|
return (params.mode === 'edit' && isEqual(state.mood, params.currentMood)) ||
|
|
@@ -57,10 +55,10 @@ const FlagEditPage = () => {
|
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
const getColorBlockColor = useCallback((isMainLight?: boolean) => {
|
|
60
|
-
if(isMainLight){
|
|
58
|
+
if (isMainLight) {
|
|
61
59
|
return cctToColor(state.currentWhiteNode.colorTemp, Math.max(...[state.currentWhiteNode.brightness, 50]))
|
|
62
60
|
}
|
|
63
|
-
const { h, s, v} = state.currentNode
|
|
61
|
+
const { h, s, v } = state.currentNode
|
|
64
62
|
return hsv2Hex(h, s, v)
|
|
65
63
|
}, [state.currentNode, state.currentWhiteNode])
|
|
66
64
|
|
|
@@ -70,7 +68,7 @@ const FlagEditPage = () => {
|
|
|
70
68
|
|
|
71
69
|
return (
|
|
72
70
|
<Page
|
|
73
|
-
backText={I18n.getLang('
|
|
71
|
+
backText={I18n.getLang('Feature_devicepanel_flags')}
|
|
74
72
|
showBackDialog={true}
|
|
75
73
|
loading={state.loading}
|
|
76
74
|
backDialogTitle={
|
|
@@ -109,7 +107,7 @@ const FlagEditPage = () => {
|
|
|
109
107
|
tipColor={nameRepeat ? '#f00' : undefined}
|
|
110
108
|
tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
|
|
111
109
|
errorText={I18n.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')} />
|
|
112
|
-
{params.moduleParams.isSupportMixScene && <><Card style={styles.adjustCard}>
|
|
110
|
+
{(params.moduleParams.isSupportMixScene || params.moduleParams.isCeilingLight) && <><Card style={styles.adjustCard}>
|
|
113
111
|
<Spacer height={cx(16)} />
|
|
114
112
|
<View style={styles.lightLine}>
|
|
115
113
|
<Text style={styles.light}>
|
|
@@ -160,11 +158,11 @@ const FlagEditPage = () => {
|
|
|
160
158
|
<Spacer height={cx(16)} />
|
|
161
159
|
<View style={styles.lightLine}>
|
|
162
160
|
<Text style={styles.light}>
|
|
163
|
-
{I18n.getLang(params.moduleParams.isSupportMixScene ? 'light_sources_tile_sec_lighting_headline' : 'light_sources_tile_tw_lighting_headline')}
|
|
161
|
+
{I18n.getLang(params.moduleParams.isSupportMixScene ? 'light_sources_tile_sec_lighting_headline' : params.moduleParams.isCeilingLight ? 'ceiling_light_title_lighting_headline' : 'light_sources_tile_tw_lighting_headline')}
|
|
164
162
|
</Text>
|
|
165
163
|
</View>
|
|
166
164
|
<Spacer height={cx(10)} />
|
|
167
|
-
{!params.moduleParams.isStripLight && <>
|
|
165
|
+
{(!params.moduleParams.isStripLight && !params.moduleParams.isCeilingLight) && <>
|
|
168
166
|
<LdvSlider
|
|
169
167
|
title={I18n.getLang('add_new_dynamic_mood_lights_field_speed_topic_text')}
|
|
170
168
|
value={state.mood.speed}
|
|
@@ -27,6 +27,7 @@ export interface FlagPageProps {
|
|
|
27
27
|
isSupportTemperature?: boolean
|
|
28
28
|
isStringLight?: boolean
|
|
29
29
|
isStripLight?: boolean
|
|
30
|
+
isCeilingLight?: boolean
|
|
30
31
|
isSupportMixScene?: boolean
|
|
31
32
|
drawToolLight?: {
|
|
32
33
|
drawToolCode: string
|
|
@@ -37,6 +38,8 @@ export interface FlagPageProps {
|
|
|
37
38
|
sceneDataCode?: string
|
|
38
39
|
workModeCode: string
|
|
39
40
|
switchLedCode: string
|
|
41
|
+
rgbcWorkModeCode?: string
|
|
42
|
+
rgbcSwitchLedCode?: string
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
const FlagPage = () => {
|
|
@@ -48,9 +51,10 @@ const FlagPage = () => {
|
|
|
48
51
|
const [moods, setMoods] = useMoods()
|
|
49
52
|
const [flags, setFlags] = useFlags()
|
|
50
53
|
const [flagMode, setFlagMode] = useFlagMode()
|
|
51
|
-
const [flagState, setFlag] = useFlag((params.isStripLight ? params?.drawToolLight?.drawToolCode : params.sceneDataCode)!!, {
|
|
54
|
+
const [flagState, setFlag] = useFlag(((params.isStripLight || params.isCeilingLight) ? params?.drawToolLight?.drawToolCode : params.sceneDataCode)!!, {
|
|
52
55
|
isMixLight: params.isSupportMixScene,
|
|
53
56
|
isStringLight: params.isStringLight,
|
|
57
|
+
isCeilingLight: params.isCeilingLight,
|
|
54
58
|
...params
|
|
55
59
|
})
|
|
56
60
|
const state = useReactive({
|