@ledvance/ui-biz-bundle 1.1.15 → 1.1.17

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
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.1.15",
7
+ "version": "1.1.17",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -52,7 +52,7 @@ export const useFlag: UseFlagType = (flagCode, extra) => {
52
52
  const setFlagFn = (flagItem: FlagItemInfo) => {
53
53
  if (extra.drawToolLight) {
54
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})
55
+ return setDps({ [flagCode]: hex , [extra.switchLedCode]: true, [extra.workModeCode]: WORK_MODE.COLOUR})
56
56
  } else {
57
57
  const hex = obj2Dp(flagItem, extra)
58
58
  return setDps({ [flagCode]: hex, [extra.workModeCode]: WORK_MODE.SCENE, [extra.switchLedCode]: true })
@@ -229,10 +229,10 @@ export function saveFlag(devId: string, flagInfo: FlagUiInfo[]) {
229
229
  return NativeApi.putJson(devId, featureId, JSON.stringify(flagInfo))
230
230
  }
231
231
 
232
- export function getFlagMode(groupId: string){
233
- return NativeApi.getJson(groupId, 'flagMode')
232
+ export function getFlagMode(devId: string){
233
+ return NativeApi.getJson(devId, 'flagMode')
234
234
  }
235
235
 
236
- export function saveFlagMode(groupId: string, v:string){
237
- return NativeApi.putJson(groupId, 'flagMode', v)
236
+ export function saveFlagMode(devId: string, v:string){
237
+ return NativeApi.putJson(devId, 'flagMode', v)
238
238
  }
@@ -1,4 +1,5 @@
1
1
  import I18n from "@ledvance/base/src/i18n";
2
+ import res from "@ledvance/base/src/res";
2
3
  import { SceneNodeTransitionMode } from "@ledvance/ui-biz-bundle/src/modules/scene/SceneInfo";
3
4
 
4
5
  type HSV = {
@@ -19,8 +20,7 @@ export interface FlagItemInfo {
19
20
  speed: number
20
21
  colors: HSV[]
21
22
  whiteColors: BT []
22
- fanEnable?: boolean
23
- fanSpeed?: number
23
+ icon?: number | string
24
24
  }
25
25
 
26
26
  export interface FlagUiInfo extends FlagItemInfo{
@@ -95,7 +95,7 @@ export const defFlagList: FlagUiInfo[] = [
95
95
  whiteColors: [
96
96
  { brightness: 100, colorTemp: 0},
97
97
  ],
98
- colors: [{h: 357, s: 87, v: 100}, {h: 47, s: 100, v: 100}, {h: 357, s: 87, v: 100}]
98
+ colors: [{h: 360, s: 100, v: 100}, {h: 47, s: 100, v: 100}, {h: 357, s: 87, v: 100}]
99
99
  },
100
100
  {
101
101
  id: 249,
@@ -301,6 +301,7 @@ export const defFlagList: FlagUiInfo[] = [
301
301
  mode: SceneNodeTransitionMode.Jump,
302
302
  speed: 70,
303
303
  name: I18n.getLang('flag_leverkusen'),
304
+ icon: res.leverkusen_icon,
304
305
  whiteColors: [
305
306
  { brightness: 100, colorTemp: 0},
306
307
  ],
@@ -1,4 +1,4 @@
1
- import { StyleSheet, View, Text, ViewStyle } from 'react-native'
1
+ import { StyleSheet, View, Text, ViewStyle, Image } from 'react-native'
2
2
  import React from 'react'
3
3
  import Card from '@ledvance/base/src/components/Card'
4
4
  import { SwitchButton, Utils } from 'tuya-panel-kit'
@@ -11,12 +11,15 @@ interface RecommendMoodItemProps {
11
11
  enable: boolean
12
12
  title: string
13
13
  colors: string[]
14
+ icon?: number | string
14
15
  style?: ViewStyle
15
16
  onPress?: () => void
16
17
  onSwitch: (enable: boolean) => void
17
18
  }
18
19
 
19
20
  export default function FlagItem(props: RecommendMoodItemProps) {
21
+ const icon = typeof props.icon === 'number' ? props.icon : { uri: props.icon }
22
+
20
23
  return (
21
24
  <Card
22
25
  style={[styles.card, props.style]}
@@ -24,7 +27,10 @@ export default function FlagItem(props: RecommendMoodItemProps) {
24
27
  <View>
25
28
  <Spacer height={cx(16)} />
26
29
  <View style={styles.headline}>
27
- <Text style={styles.headText}>{props.title}</Text>
30
+ <View style={{ flexDirection: 'row', flex: 1, paddingRight: cx(5), justifyContent: 'flex-start' }}>
31
+ <Text style={styles.headText}>{props.title}</Text>
32
+ {props.icon && <Image source={icon} style={{ width: cx(60), aspectRatio: 2.14, marginRight: cx(10) }} />}
33
+ </View>
28
34
  <SwitchButton
29
35
  thumbStyle={{ elevation: 0 }}
30
36
  value={props.enable}
@@ -50,13 +56,14 @@ const styles = StyleSheet.create({
50
56
  headline: {
51
57
  flexDirection: 'row',
52
58
  marginHorizontal: cx(16),
59
+ justifyContent: 'space-between',
53
60
  },
54
61
  headText: {
55
- flex: 1,
56
62
  color: '#000',
57
63
  fontSize: cx(16),
58
64
  fontFamily: 'helvetica_neue_lt_std_bd',
59
65
  lineHeight: cx(20),
66
+ flex: 1
60
67
  },
61
68
  gradientItem: {
62
69
  alignItems: 'center',
@@ -196,6 +196,7 @@ const FlagPage = () => {
196
196
  renderItem={({ item }) => <FlagItem
197
197
  enable={dps[params.workModeCode] === (params.isStripLight ? WORK_MODE.COLOUR : WORK_MODE.SCENE) && flagId === item.id}
198
198
  title={item.name}
199
+ icon={item.icon}
199
200
  colors={item.colors.map(item => hsv2Hex(item.h, item.s, item.v))}
200
201
  onSwitch={async (enable) => {
201
202
  if (enable) {