@ledvance/ui-biz-bundle 1.1.12 → 1.1.13
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useDps } from "@ledvance/base/src/models/modules/NativePropsSlice";
|
|
2
2
|
import { FlagPageProps } from "./FlagPage";
|
|
3
3
|
import { SceneNodeTransitionMode } from "@ledvance/ui-biz-bundle/src/modules/scene/SceneInfo";
|
|
4
|
-
import { WORK_MODE, nToHS, parseJSON, toFixed } from "@tuya/tuya-panel-lamp-sdk/lib/utils";
|
|
4
|
+
import { ColorUtils, WORK_MODE, nToHS, parseJSON, toFixed } from "@tuya/tuya-panel-lamp-sdk/lib/utils";
|
|
5
5
|
import { cloneDeep } from "lodash";
|
|
6
6
|
import { FlagItemInfo, FlagUiInfo, defFlagList } from "./FlagInfo";
|
|
7
7
|
import { hex2Int } from "@ledvance/base/src/utils/common";
|
|
@@ -9,7 +9,6 @@ import { spliceByStep } from "@ledvance/base/src/utils/common";
|
|
|
9
9
|
import { useMemo, useState } from "react";
|
|
10
10
|
import { useUpdateEffect } from "ahooks";
|
|
11
11
|
import { NativeApi } from "@ledvance/base/src/api/native";
|
|
12
|
-
import { hsv2Hex } from "@ledvance/base/src/utils";
|
|
13
12
|
import { stripDp2Obj } from "@ledvance/ui-biz-bundle/src/modules/scene/SceneAction";
|
|
14
13
|
|
|
15
14
|
export interface ExtraParams extends FlagPageProps, FlagOption {
|
|
@@ -52,8 +51,8 @@ export const useFlag: UseFlagType = (flagCode, extra) => {
|
|
|
52
51
|
|
|
53
52
|
const setFlagFn = (flagItem: FlagItemInfo) => {
|
|
54
53
|
if (extra.drawToolLight) {
|
|
55
|
-
const hex = extra.drawToolLight.drawToolObj2dp(flagItem.colors.map(item =>
|
|
56
|
-
return setDps({ [flagCode]: hex })
|
|
54
|
+
const hex = extra.drawToolLight.drawToolObj2dp(flagItem.colors.map(item => ColorUtils.hsv2hex(item.h, item.s, item.v)))
|
|
55
|
+
return setDps({ [flagCode]: hex , [extra.switchLedCode]: true})
|
|
57
56
|
} else {
|
|
58
57
|
const hex = obj2Dp(flagItem, extra)
|
|
59
58
|
return setDps({ [flagCode]: hex, [extra.workModeCode]: WORK_MODE.SCENE, [extra.switchLedCode]: true })
|
|
@@ -17,7 +17,7 @@ import { hsv2Hex } from "@ledvance/base/src/utils";
|
|
|
17
17
|
import { SceneNodeTransitionMode } from "@ledvance/ui-biz-bundle/src/modules/scene/SceneInfo";
|
|
18
18
|
import { Result } from "@ledvance/base/src/models/modules/Result";
|
|
19
19
|
import { useDps } from "@ledvance/base/src/models/modules/NativePropsSlice";
|
|
20
|
-
import { WORK_MODE } from "@tuya/tuya-panel-lamp-sdk/lib/utils";
|
|
20
|
+
import { ColorUtils, WORK_MODE } from "@tuya/tuya-panel-lamp-sdk/lib/utils";
|
|
21
21
|
const cx = Utils.RatioUtils.convertX
|
|
22
22
|
|
|
23
23
|
export interface FlagPageProps {
|
|
@@ -59,7 +59,7 @@ const FlagPage = () => {
|
|
|
59
59
|
const flagId = useMemo(() =>{
|
|
60
60
|
if(flagState.colors !== undefined){
|
|
61
61
|
const flag = state.flags.find(item => {
|
|
62
|
-
const hexColors = item.colors.map(c =>
|
|
62
|
+
const hexColors = item.colors.map(c => ColorUtils.hsv2hex(c.h, c.s, c.v).toLocaleUpperCase())
|
|
63
63
|
return isEqual(hexColors, flagState.colors)
|
|
64
64
|
})
|
|
65
65
|
return flag?.id
|
|
@@ -105,7 +105,7 @@ const FlagPage = () => {
|
|
|
105
105
|
})
|
|
106
106
|
}
|
|
107
107
|
state.flags = cloneFlag
|
|
108
|
-
setFlags(cloneFlag)
|
|
108
|
+
setFlags(cloneDeep(cloneFlag))
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -185,7 +185,7 @@ const FlagPage = () => {
|
|
|
185
185
|
<FlatList
|
|
186
186
|
data={state.flags}
|
|
187
187
|
renderItem={({ item }) => <FlagItem
|
|
188
|
-
enable={dps[params.workModeCode] === WORK_MODE.
|
|
188
|
+
enable={dps[params.workModeCode] === (params.isStripLight ? WORK_MODE.Colour : WORK_MODE.Scene) && flagId === item.id}
|
|
189
189
|
title={item.name}
|
|
190
190
|
colors={item.colors.map(item => hsv2Hex(item.h, item.s, item.v))}
|
|
191
191
|
onSwitch={async (enable) => {
|