@ledvance/base 1.1.71 → 1.1.72

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/base",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.1.71",
7
+ "version": "1.1.72",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@reduxjs/toolkit": "^1.8.6",
@@ -11,21 +11,17 @@ import I18n from '../i18n/index'
11
11
  const {convertX: cx} = Utils.RatioUtils
12
12
 
13
13
  interface LampConfigViewProps extends ColorAdjustViewProps, ColorTempAdjustViewProps {
14
- isRGBWLamp: boolean
15
- isRGBLamp: boolean
16
- isOnlyRGBLamp: boolean
17
- isTWLamp: boolean
18
- isDIMLamp: boolean
19
14
  isColorMode: boolean
15
+ isSupportColor: boolean
20
16
  setIsColorMode: (isColorMode: boolean) => void
21
17
  }
22
18
 
23
19
  const LampAdjustView = (props: LampConfigViewProps) => {
24
20
 
25
21
  const state = useReactive({
26
- hasSegmentControl: props.isRGBWLamp || props.isRGBLamp,
22
+ hasSegmentControl: props.isSupportColor && (props.isSupportBrightness || props.isSupportTemperature),
27
23
  })
28
-
24
+
29
25
  return (
30
26
  <View>
31
27
  {state.hasSegmentControl &&
@@ -36,7 +32,7 @@ const LampAdjustView = (props: LampConfigViewProps) => {
36
32
  isFirst={props.isColorMode}
37
33
  setIsFirst={props.setIsColorMode}/>
38
34
  }
39
- {(props.isOnlyRGBLamp || (state.hasSegmentControl && props.isColorMode)) &&
35
+ {((state.hasSegmentControl && props.isColorMode) || (!state.hasSegmentControl && props.isSupportColor)) &&
40
36
  <>
41
37
  {state.hasSegmentControl && <Spacer height={cx(10)}/>}
42
38
  <ColorAdjustView
@@ -50,7 +46,7 @@ const LampAdjustView = (props: LampConfigViewProps) => {
50
46
  <Spacer/>
51
47
  </>
52
48
  }
53
- {(props.isTWLamp || props.isDIMLamp || (!props.isColorMode)) &&
49
+ {((state.hasSegmentControl && !props.isColorMode) || (!state.hasSegmentControl && (props.isSupportBrightness || props.isSupportTemperature))) &&
54
50
  <>
55
51
  {state.hasSegmentControl && <Spacer height={cx(10)}/>}
56
52
  <ColorTempAdjustView
@@ -1,12 +1,10 @@
1
- import React from 'react'
1
+ import React, { useMemo } from 'react'
2
2
  import {StyleProp, StyleSheet, Text, View, ViewStyle} from 'react-native'
3
3
  import {Picker, Utils} from 'tuya-panel-kit'
4
4
  import _ from 'lodash'
5
5
 
6
6
  const {convertX} = Utils.RatioUtils
7
7
 
8
- const hours = _.times(24, (n) => _.padStart(n.toString(), 2, '0'))
9
- const minutes = _.times(60, (n) => _.padStart(n.toString(), 2, '0'))
10
8
  const pickerTheme = {
11
9
  fontSize: 20,
12
10
  }
@@ -18,12 +16,14 @@ interface LdvPickerViewProps {
18
16
  setMinute: (string) => void,
19
17
  style?: StyleProp<ViewStyle> | undefined,
20
18
  unit?: string[]
19
+ minutesStep?: number
21
20
  }
22
21
 
23
22
  const LdvPickerView = (props: LdvPickerViewProps) => {
24
23
 
25
- const {hour, minute, unit, setHour, setMinute} = props
26
-
24
+ const {hour, minute, unit, setHour, setMinute, minutesStep = 1} = props
25
+ const hours = useMemo(() => _.times(24, (n) => _.padStart(n.toString(), 2, '0')), [])
26
+ const minutes = useMemo(() => _.times(60 / minutesStep, (n) => _.padStart((n * minutesStep).toString(), 2, '0')) , [props.minutesStep])
27
27
  return (
28
28
  <View style={[styles.pickerContainer, props.style]}>
29
29
  <View style={styles.picContainer}>