@ledvance/base 1.1.20 → 1.1.22

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 (52) hide show
  1. package/package.json +1 -1
  2. package/src/components/ColorTempAdjustView.tsx +2 -1
  3. package/src/components/FanAdjustView.tsx +1 -1
  4. package/src/components/LinearGradientLine.tsx +5 -6
  5. package/src/components/Page.tsx +20 -7
  6. package/src/models/modules/NativePropsSlice.tsx +12 -2
  7. package/src/res/cash.png +0 -0
  8. package/src/res/cash@2x.png +0 -0
  9. package/src/res/cash@3x.png +0 -0
  10. package/src/res/componentsIOsButtonsButtonAdd.png +0 -0
  11. package/src/res/componentsIOsButtonsButtonAdd@2x.png +0 -0
  12. package/src/res/componentsIOsButtonsButtonAdd@3x.png +0 -0
  13. package/src/res/iconsMaterialOutlinedArrowsNavArrowForwardIos.png +0 -0
  14. package/src/res/iconsMaterialOutlinedArrowsNavArrowForwardIos@2x.png +0 -0
  15. package/src/res/iconsMaterialOutlinedArrowsNavArrowForwardIos@3x.png +0 -0
  16. package/src/res/iconsMaterialOutlinedArrowsNavCheck.png +0 -0
  17. package/src/res/iconsMaterialOutlinedArrowsNavCheck@2x.png +0 -0
  18. package/src/res/iconsMaterialOutlinedArrowsNavCheck@3x.png +0 -0
  19. package/src/res/iconsMaterialOutlinedCalendarCalendarToday.png +0 -0
  20. package/src/res/iconsMaterialOutlinedCalendarCalendarToday@2x.png +0 -0
  21. package/src/res/iconsMaterialOutlinedCalendarCalendarToday@3x.png +0 -0
  22. package/src/res/iconsMaterialOutlinedCommunicationInfo.png +0 -0
  23. package/src/res/iconsMaterialOutlinedCommunicationInfo@2x.png +0 -0
  24. package/src/res/iconsMaterialOutlinedCommunicationInfo@3x.png +0 -0
  25. package/src/res/iconsMaterialOutlinedEditorFileDownload.png +0 -0
  26. package/src/res/iconsMaterialOutlinedEditorFileDownload@2x.png +0 -0
  27. package/src/res/iconsMaterialOutlinedEditorFileDownload@3x.png +0 -0
  28. package/src/res/iconsMaterialOutlinedEditorInventory.png +0 -0
  29. package/src/res/iconsMaterialOutlinedEditorInventory@2x.png +0 -0
  30. package/src/res/iconsMaterialOutlinedEditorInventory@3x.png +0 -0
  31. package/src/res/iconsMaterialOutlinedOtherBarChart.png +0 -0
  32. package/src/res/iconsMaterialOutlinedOtherBarChart@2x.png +0 -0
  33. package/src/res/iconsMaterialOutlinedOtherBarChart@3x.png +0 -0
  34. package/src/res/iconsMaterialOutlinedOtherEnergySavingsLeaf.png +0 -0
  35. package/src/res/iconsMaterialOutlinedOtherEnergySavingsLeaf@2x.png +0 -0
  36. package/src/res/iconsMaterialOutlinedOtherEnergySavingsLeaf@3x.png +0 -0
  37. package/src/res/iconsMaterialOutlinedTimeAccessTime.png +0 -0
  38. package/src/res/iconsMaterialOutlinedTimeAccessTime@2x.png +0 -0
  39. package/src/res/iconsMaterialOutlinedTimeAccessTime@3x.png +0 -0
  40. package/src/res/illustrationsFeaturesLogs.png +0 -0
  41. package/src/res/illustrationsFeaturesLogs@2x.png +0 -0
  42. package/src/res/illustrationsFeaturesLogs@3x.png +0 -0
  43. package/src/res/illustrationsHomeRoutines.png +0 -0
  44. package/src/res/illustrationsHomeRoutines@2x.png +0 -0
  45. package/src/res/illustrationsHomeRoutines@3x.png +0 -0
  46. package/src/res/index.ts +26 -10
  47. package/src/res/materialiconsOutlinedArrowsNavWarningAmber.png +0 -0
  48. package/src/res/materialiconsOutlinedArrowsNavWarningAmber@2x.png +0 -0
  49. package/src/res/materialiconsOutlinedArrowsNavWarningAmber@3x.png +0 -0
  50. package/src/utils/Support.ts +24 -0
  51. package/src/utils/index.d.ts +1 -0
  52. package/src/utils/index.ts +4 -0
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/base",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.1.20",
7
+ "version": "1.1.22",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@reduxjs/toolkit": "^1.8.6",
@@ -6,6 +6,7 @@ import LdvPresetView from './ldvPresetView'
6
6
  import LdvSlider from './ldvSlider'
7
7
  import {Utils} from 'tuya-panel-kit'
8
8
  import I18n from '../i18n/index'
9
+ import {cctToColor} from '../utils/cctUtils'
9
10
 
10
11
  const {convertX: cx} = Utils.RatioUtils
11
12
 
@@ -28,7 +29,7 @@ const ColorTempAdjustView = (props: ColorTempAdjustViewProps) => {
28
29
  <LdvColorSlider
29
30
  type={'temperature'}
30
31
  title={I18n.getLang('light_sources_tile_main_lighting_shade')}
31
- thumbColor={'white'}
32
+ thumbColor={cctToColor(props.colorTemp)}
32
33
  value={props.colorTemp}
33
34
  onValueChange={props.onCCTChange}
34
35
  onSlidingComplete={props.onCCTChangeComplete}/>
@@ -124,7 +124,7 @@ const FanAdjustView = (props: FanAdjustViewProps) => {
124
124
  setEnable={props.disinfectChange}
125
125
  color={''}
126
126
  colorAlpha={1}
127
- title={'1'}/>
127
+ title={I18n.getLang('ceiling_fan_tile_uvc_fan_disinfect')}/>
128
128
  <Spacer height={cx(16)}/>
129
129
  </>}
130
130
  </Card>
@@ -43,21 +43,20 @@ const LinearGradientLine = (props: LinearGradientLineProps) => {
43
43
  state.stops[`${pc}%`] = color
44
44
  pc += p
45
45
  })
46
- console.log('LinearGradientLine colors', JSON.stringify(state.stops))
47
46
  }, [props.colors])
48
47
 
49
48
  return (
50
- <View style={[{width, height, overflow: 'hidden'}, props.style]}>
51
- <LinearGradient
49
+ <View style={[{ width, height, overflow: 'hidden' }, props.style]}>
50
+ {JSON.stringify(state.stops) !== '{}' && <LinearGradient
52
51
  gradientId="Gradient"
53
- style={{width, height}}
52
+ style={{ width, height }}
54
53
  x1={state.x1}
55
54
  y1={state.y1}
56
55
  x2={state.x2}
57
56
  y2={state.y2}
58
57
  stops={state.stops}>
59
- <Rect width={width} height={height}/>
60
- </LinearGradient>
58
+ <Rect width={width} height={height} />
59
+ </LinearGradient>}
61
60
  </View>
62
61
  )
63
62
  }
@@ -1,5 +1,5 @@
1
- import React, { PropsWithChildren, useCallback } from 'react'
2
- import { View, ViewProps } from 'react-native'
1
+ import React, { PropsWithChildren, useCallback, useEffect } from 'react'
2
+ import { BackHandler, View, ViewProps } from 'react-native'
3
3
  import LDVTopBar from './ldvTopBar'
4
4
  import { useNavigation } from '@react-navigation/native'
5
5
  import LdvTopName from './ldvTopName'
@@ -46,18 +46,31 @@ const Page = (props: PageProps) => {
46
46
  },
47
47
  [props.backDialogTitle, props.backDialogContent, disabled],
48
48
  )
49
+
50
+ useEffect(() => {
51
+ if (!!props.showBackDialog) {
52
+ BackHandler.addEventListener('hardwareBackPress', onBack)
53
+ return () => {
54
+ BackHandler.removeEventListener('hardwareBackPress', onBack)
55
+ }
56
+ }
57
+ }, [props.showBackDialog, disabled])
58
+
49
59
  return (
50
60
  <>
51
- <View style={[{ flex: 1 }, props.style]}>
61
+ <View style={[{ flex: 1, position: 'relative' }, props.style]}>
52
62
  <LDVTopBar
53
63
  title={props.backText}
54
- onBackPress={props.onBackClick || (() => {
55
- navigation.goBack()
56
- })}
64
+ onBackPress={
65
+ !!props.onBackClick ? props.onBackClick :
66
+ !!props.showBackDialog ? onBack : (() => {
67
+ navigation.goBack()
68
+ })
69
+ }
57
70
  rightButtonIcon={props.rightButtonIcon}
58
71
  onRightButtonPress={props.rightButtonIconClick}
59
72
  />
60
- {props.headlineText &&
73
+ {(!!props.headlineText) &&
61
74
  <LdvTopName
62
75
  title={props.headlineText}
63
76
  rightIcon={props.headlineIcon}
@@ -12,7 +12,7 @@ export interface NativeProps {
12
12
  familyName: string
13
13
  deviceInfo: DeviceInfo
14
14
  uaGroupInfo: UAGroupInfo
15
- timeSchedule?: symbol
15
+ timeSchedule?: boolean
16
16
  energieverbrauch?: object
17
17
  }
18
18
 
@@ -42,7 +42,7 @@ const initialState: NativeProps = {
42
42
  dps: {},
43
43
  config: {},
44
44
  },
45
- timeSchedule: Symbol(),
45
+ timeSchedule: false,
46
46
  energieverbrauch: {},
47
47
  }
48
48
 
@@ -51,6 +51,10 @@ const productList = [
51
51
  'rcqe1i17x0vrvws7',
52
52
  ]
53
53
 
54
+ const fanProductList = [
55
+ "urcqn70htlshvigb"
56
+ ]
57
+
54
58
  const nativePropsSlice = createSlice({
55
59
  name: 'ldvModules',
56
60
  initialState: initialState,
@@ -247,6 +251,12 @@ export function useGroupConfigFeature<GC, GCPT extends { [K in keyof GC]: GC[K]
247
251
  return [groupConfig[key] as GCPT, setGroupConfigFeature]
248
252
  }
249
253
 
254
+ export const useFanMaxSpeed = () =>{
255
+ const {productId} = useDeviceInfo()
256
+ const maxSpeed = fanProductList.includes(productId) ? 20 : 3
257
+ return maxSpeed
258
+ }
259
+
250
260
  export const ldvModules = nativePropsSlice.reducer
251
261
 
252
262
  export const {
Binary file
Binary file
Binary file
package/src/res/index.ts CHANGED
@@ -7,16 +7,39 @@ export default {
7
7
  ldv_timer_empty: 'timer_empty',
8
8
  ldv_right_arrow: 'arrow',
9
9
  ldv_list_select: 'list_select',
10
+ switch_1: 'switch_1',
11
+ switch_2: 'switch_2',
12
+ switch_3: 'switch_3',
13
+ switch_4: 'switch_usb',
14
+ ic_cancel: 'ic_cancel',
15
+ ic_more: 'ic_more',
16
+ device_panel_timer_add: require('./materialiconsOutlinedArrowsNavAddBox.png'),
17
+ device_panel_schedule_alert: 'device_panel_schedule_alert',
18
+ device_panel_schedule_add: 'device_panel_schedule_add',
19
+ ic_arrows_nav_clear: require('./materialiconsFilledCancel.png'),
20
+ ic_info: 'ic_info',
21
+ ic_warning_amber: require('./materialiconsOutlinedArrowsNavWarningAmber.png'),
10
22
  ic_check: 'ic_check',
11
- ic_uncheck: 'ic_uncheck',
23
+ ic_uncheck: require('./componentsIOsButtonsButtonAdd.png'),
24
+ rn_ic_download: 'rn_ic_download',
25
+ scheduleEmpty: require('./illustrationsHomeRoutines.png'),
26
+ summary_icon1: require('./iconsMaterialOutlinedCalendarCalendarToday.png'),
27
+ summary_icon2: require('./iconsMaterialOutlinedTimeAccessTime.png'),
28
+ summary_icon3: require('./iconsMaterialOutlinedEditorInventory.png'),
29
+ energy_consumption_right: require('./iconsMaterialOutlinedArrowsNavArrowForwardIos.png'),
30
+ energy_consumption_chart: require('./iconsMaterialOutlinedOtherBarChart.png'),
31
+ energy_consumption_cash: require('./cash.png'),
32
+ energy_consumption_greenery: require('./iconsMaterialOutlinedOtherEnergySavingsLeaf.png'),
33
+ app_music_check: require('./iconsMaterialOutlinedArrowsNavCheck.png'),
34
+ co2Icon: require('./iconsMaterialOutlinedCommunicationInfo.png'),
35
+ download_icon: require('./iconsMaterialOutlinedEditorFileDownload.png'),
36
+ energy_consumption_empty: require('./illustrationsFeaturesLogs.png'),
12
37
  rhythm_icon1: 'rhythm_icon1',
13
38
  rhythm_icon2: 'rhythm_icon2',
14
39
  rhythm_icon3: 'rhythm_icon3',
15
40
  rhythm_icon4: 'rhythm_icon4',
16
41
  color_temperature_wheel: 'color_temperature_wheel',
17
42
  color_wheel: 'color_wheel',
18
- ic_more: 'ic_more',
19
- ic_cancel: 'ic_cancel',
20
43
  scene_goodnight: 'scene_goodnight',
21
44
  scene_reading: 'scene_reading',
22
45
  scene_work: 'scene_work',
@@ -27,13 +50,6 @@ export default {
27
50
  add: 'add',
28
51
  delete: 'delete',
29
52
  icon_edit_scene: 'icon_edit_scene',
30
- device_panel_timer_add: require('./materialiconsOutlinedArrowsNavAddBox.png'),
31
- device_panel_schedule_add: 'device_panel_schedule_add',
32
- device_panel_schedule_alert: 'device_panel_schedule_alert',
33
- ic_arrows_nav_clear: require('./materialiconsFilledCancel.png'),
34
- ic_info: 'ic_info',
35
- ic_warning_amber: 'ic_warning_amber',
36
- rn_ic_download: 'rn_ic_download',
37
53
  light_on: require('./light_on.png'),
38
54
  light_off: require('./light_off.png'),
39
55
  }
@@ -1,3 +1,4 @@
1
+
1
2
  // 判断是否是plug
2
3
  export const isPlug = (dpCodes: Record<string, string>) => {
3
4
  return !!dpCodes.switch_1
@@ -62,6 +63,17 @@ export const isTWLamp = (dpCodes: Record<string, string>) => {
62
63
  )
63
64
  }
64
65
 
66
+ // 支持调节: 色温+ 温度
67
+ export const isFanLamp = (dpCodes: Record<string, string>) => {
68
+ return !!(
69
+ !dpCodes.mix_rgbcw &&
70
+ !dpCodes.colour_data &&
71
+ dpCodes.temp_value &&
72
+ dpCodes.bright_value &&
73
+ dpCodes.fan_speed
74
+ )
75
+ }
76
+
65
77
  // 支持调节:单一色温亮度
66
78
  export const isDIMLamp = (dpCodes: Record<string, string>) => {
67
79
  return !!(
@@ -82,4 +94,16 @@ export const isGARDOT = (dpCodes: Record<string, string>) => {
82
94
  dpCodes.countdown &&
83
95
  dpCodes.control_data
84
96
  )
97
+ }
98
+
99
+ export const isSupportColor = (dpCodes: Record<string, string>) => {
100
+ return !!(dpCodes.colour_data)
101
+ }
102
+
103
+ export const isSupportTemperature = (dpCodes: Record<string, string>) => {
104
+ return !!(dpCodes.temp_value)
105
+ }
106
+
107
+ export const isSupportBrightness = (dpCodes: Record<string, string>) => {
108
+ return !!(dpCodes.bright_value)
85
109
  }
@@ -23,3 +23,4 @@ export declare const getHSVByHex: (string: any) => {
23
23
  v: number;
24
24
  };
25
25
  export declare function mapFloatToRange(value: number, min: number, max: number): number;
26
+ export declare function mapValueToRatio(value: number, min: number, max: number): number;
@@ -170,3 +170,7 @@ export function mapFloatToRange(value: number, min: number, max: number): number
170
170
  // 计算插值后的值
171
171
  return min + value * (max - min)
172
172
  }
173
+
174
+ export function mapValueToRatio(value: number, min: number, max: number): number {
175
+ return ((value || 0) - min) / (max - min)
176
+ }