@ledvance/base 1.2.83 → 1.2.85
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/.babelrc +31 -31
- package/.eslintignore +5 -5
- package/.eslintrc.js +27 -27
- package/.prettierrc.js +1 -1
- package/.versionrc +5 -5
- package/localazy.json +851 -848
- package/localazy.keys.json +4 -4
- package/package.json +74 -74
- package/rn-cli.config.js +8 -8
- package/src/api/native.d.ts +71 -71
- package/src/api/native.ts +423 -423
- package/src/api/nativeEventEmitter.d.ts +3 -3
- package/src/api/nativeEventEmitter.ts +125 -125
- package/src/components/AdvanceCard.d.ts +25 -25
- package/src/components/AdvanceCard.tsx +117 -117
- package/src/components/AdvanceList.d.ts +9 -9
- package/src/components/AdvanceList.tsx +69 -69
- package/src/components/ApplyForDeviceItem.d.ts +6 -6
- package/src/components/ApplyForDeviceItem.tsx +83 -83
- package/src/components/ApplyForDeviceList.d.ts +7 -7
- package/src/components/ApplyForDeviceList.tsx +61 -61
- package/src/components/ApplyForText.d.ts +6 -6
- package/src/components/ApplyForText.tsx +52 -52
- package/src/components/Card.d.ts +10 -10
- package/src/components/Card.tsx +40 -40
- package/src/components/Cell.d.ts +21 -21
- package/src/components/Cell.tsx +69 -69
- package/src/components/CircularProgress.d.ts +8 -8
- package/src/components/CircularProgress.tsx +42 -42
- package/src/components/ColorAdjustView.d.ts +12 -12
- package/src/components/ColorAdjustView.tsx +64 -64
- package/src/components/ColorExtractor.d.ts +73 -73
- package/src/components/ColorExtractor.tsx +374 -374
- package/src/components/ColorTempAdjustView.d.ts +13 -13
- package/src/components/ColorTempAdjustView.tsx +57 -57
- package/src/components/ColorsLine.d.ts +7 -7
- package/src/components/ColorsLine.tsx +47 -47
- package/src/components/CustomListDialog.d.ts +15 -15
- package/src/components/CustomListDialog.tsx +66 -66
- package/src/components/DeleteButton.d.ts +10 -10
- package/src/components/DeleteButton.tsx +40 -40
- package/src/components/Dialog.d.ts +10 -10
- package/src/components/Dialog.tsx +38 -38
- package/src/components/DrawToolView.d.ts +46 -46
- package/src/components/DrawToolView.tsx +262 -262
- package/src/components/FanAdjustView.d.ts +23 -23
- package/src/components/FanAdjustView.tsx +141 -141
- package/src/components/InfoText.d.ts +11 -11
- package/src/components/InfoText.tsx +45 -45
- package/src/components/LampAdjustView.d.ts +10 -10
- package/src/components/LampAdjustView.tsx +75 -75
- package/src/components/LampAdjustView2.d.ts +24 -24
- package/src/components/LampAdjustView2.tsx +104 -104
- package/src/components/LinearGradientLine.d.ts +9 -9
- package/src/components/LinearGradientLine.tsx +63 -63
- package/src/components/LoadingView.tsx +39 -39
- package/src/components/MoodColorsLine.d.ts +9 -9
- package/src/components/MoodColorsLine.tsx +38 -38
- package/src/components/Page.d.ts +21 -21
- package/src/components/Page.tsx +104 -104
- package/src/components/Popup.d.ts +7 -7
- package/src/components/Popup.tsx +71 -71
- package/src/components/Segmented.d.ts +14 -14
- package/src/components/Segmented.tsx +76 -76
- package/src/components/ShowSelect.d.ts +1 -1
- package/src/components/ShowSelect.tsx +158 -158
- package/src/components/SocketItem.d.ts +13 -13
- package/src/components/SocketItem.tsx +87 -87
- package/src/components/Spacer.d.ts +7 -7
- package/src/components/Spacer.tsx +13 -13
- package/src/components/Stepper.d.ts +19 -19
- package/src/components/Stepper.tsx +130 -130
- package/src/components/StripAdjustView.d.ts +16 -16
- package/src/components/StripAdjustView.tsx +129 -129
- package/src/components/StripLightView.d.ts +14 -14
- package/src/components/StripLightView.tsx +24 -24
- package/src/components/Summary.tsx +116 -116
- package/src/components/Tag.d.ts +8 -8
- package/src/components/Tag.tsx +56 -56
- package/src/components/TextButton.d.ts +9 -9
- package/src/components/TextButton.tsx +31 -31
- package/src/components/TextField.d.ts +9 -9
- package/src/components/TextField.tsx +92 -92
- package/src/components/TextFieldStyleButton.d.ts +8 -8
- package/src/components/TextFieldStyleButton.tsx +85 -85
- package/src/components/UATabTitle.d.ts +6 -6
- package/src/components/UATabTitle.tsx +31 -31
- package/src/components/UATabs.d.ts +12 -12
- package/src/components/UATabs.tsx +77 -77
- package/src/components/connect.d.ts +10 -10
- package/src/components/connect.tsx +20 -20
- package/src/components/ldvColorBrightness.d.ts +1 -1
- package/src/components/ldvColorBrightness.tsx +18 -18
- package/src/components/ldvColorSlider.d.ts +14 -14
- package/src/components/ldvColorSlider.tsx +131 -131
- package/src/components/ldvItemView.d.ts +12 -12
- package/src/components/ldvItemView.tsx +43 -43
- package/src/components/ldvPickerView.d.ts +13 -13
- package/src/components/ldvPickerView.tsx +97 -97
- package/src/components/ldvPresetView.d.ts +2 -2
- package/src/components/ldvPresetView.tsx +86 -86
- package/src/components/ldvSaturation.d.ts +2 -2
- package/src/components/ldvSaturation.tsx +22 -22
- package/src/components/ldvSlider.d.ts +15 -15
- package/src/components/ldvSlider.tsx +103 -103
- package/src/components/ldvSwitch.d.ts +10 -10
- package/src/components/ldvSwitch.tsx +52 -52
- package/src/components/ldvTemperatureSlider.d.ts +13 -13
- package/src/components/ldvTemperatureSlider.tsx +139 -139
- package/src/components/ldvTopBar.d.ts +10 -10
- package/src/components/ldvTopBar.tsx +76 -76
- package/src/components/ldvTopName.d.ts +9 -9
- package/src/components/ldvTopName.tsx +63 -63
- package/src/components/segmentControl.d.ts +1 -1
- package/src/components/segmentControl.tsx +65 -65
- package/src/components/weekSelect.d.ts +7 -7
- package/src/components/weekSelect.tsx +98 -98
- package/src/composeLayout.d.ts +30 -30
- package/src/composeLayout.tsx +261 -261
- package/src/config/dark-theme.ts +61 -61
- package/src/config/light-theme.ts +61 -61
- package/src/hooks/Hooks.d.ts +2 -2
- package/src/hooks/Hooks.ts +8 -8
- package/src/i18n/index.d.ts +16 -16
- package/src/i18n/index.ts +37 -37
- package/src/i18n/strings.d.ts +15953 -15953
- package/src/i18n/strings.ts +23781 -23723
- package/src/main.tsx +9 -9
- package/src/models/GlobalParams.d.ts +14 -14
- package/src/models/GlobalParams.ts +14 -14
- package/src/models/TuyaApi.d.ts +29 -29
- package/src/models/TuyaApi.ts +92 -92
- package/src/models/combine.d.ts +26 -26
- package/src/models/combine.ts +17 -17
- package/src/models/configureStore.d.ts +9 -9
- package/src/models/configureStore.ts +33 -33
- package/src/models/index.d.ts +31 -31
- package/src/models/index.ts +22 -22
- package/src/models/modules/NativePropsSlice.d.ts +61 -61
- package/src/models/modules/NativePropsSlice.tsx +467 -467
- package/src/models/modules/Result.d.ts +14 -14
- package/src/models/modules/Result.ts +15 -15
- package/src/models/modules/common.d.ts +44 -44
- package/src/models/modules/common.ts +161 -161
- package/src/res/index.d.ts +70 -70
- package/src/res/index.ts +73 -73
- package/src/utils/ColorParser.d.ts +66 -66
- package/src/utils/ColorParser.ts +189 -189
- package/src/utils/ColorUtils.d.ts +71 -71
- package/src/utils/ColorUtils.tsx +448 -448
- package/src/utils/Support.d.ts +13 -13
- package/src/utils/Support.ts +108 -108
- package/src/utils/TypeUtils.d.ts +3 -3
- package/src/utils/cctUtils.d.ts +1 -1
- package/src/utils/cctUtils.ts +110 -110
- package/src/utils/common.d.ts +35 -35
- package/src/utils/common.ts +379 -379
- package/src/utils/index.d.ts +26 -26
- package/src/utils/index.ts +191 -191
- package/src/utils/interface.d.ts +6 -6
- package/src/utils/interface.ts +50 -50
- package/src/utils/loopsCompare.d.ts +1 -1
- package/src/utils/loopsCompare.ts +62 -62
- package/tsconfig.json +50 -50
- package/update-localazy.py +52 -52
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {StyleSheet, TouchableOpacity, View} from 'react-native'
|
|
3
|
-
import {Utils} from 'tuya-panel-kit'
|
|
4
|
-
|
|
5
|
-
const {convertX: cx} = Utils.RatioUtils
|
|
6
|
-
|
|
7
|
-
const temperatures = [
|
|
8
|
-
{
|
|
9
|
-
color: 'rgb(253, 176, 97)',
|
|
10
|
-
value: 0,
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
color: 'rgb(249, 208, 162)',
|
|
14
|
-
value: 20,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
color: 'rgb(254, 243, 221)',
|
|
18
|
-
value: 40,
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
color: 'rgb(246, 247, 244)',
|
|
22
|
-
value: 60,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
color: 'rgb(231, 238, 247)',
|
|
26
|
-
value: 80,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
color: 'rgb(194, 216, 251)',
|
|
30
|
-
value: 100,
|
|
31
|
-
},
|
|
32
|
-
]
|
|
33
|
-
|
|
34
|
-
const colors = [
|
|
35
|
-
{
|
|
36
|
-
color: '#ff0000',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
color: '#ff8700',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
color: '#fff100',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
color: '#00FF00',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
color: '#0025ff',
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
color: '#bb00ff',
|
|
52
|
-
},
|
|
53
|
-
]
|
|
54
|
-
|
|
55
|
-
const LdvPresetView = (props) => {
|
|
56
|
-
const {type, onPress} = props
|
|
57
|
-
let dataSource = type == 'temperature' ? temperatures : colors
|
|
58
|
-
return (
|
|
59
|
-
<View style={styles.container}>
|
|
60
|
-
{dataSource.map((item, index) =>
|
|
61
|
-
<TouchableOpacity
|
|
62
|
-
key={index}
|
|
63
|
-
style={[styles.item, {backgroundColor: item.color}]}
|
|
64
|
-
onPress={() => {
|
|
65
|
-
onPress(item)
|
|
66
|
-
}}/>)}
|
|
67
|
-
</View>
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const styles = StyleSheet.create({
|
|
72
|
-
container: {
|
|
73
|
-
flexDirection: 'row',
|
|
74
|
-
justifyContent: 'space-between',
|
|
75
|
-
alignItems: 'center',
|
|
76
|
-
marginHorizontal: cx(16),
|
|
77
|
-
},
|
|
78
|
-
item: {
|
|
79
|
-
width: cx(28),
|
|
80
|
-
height: cx(28),
|
|
81
|
-
borderRadius: cx(14),
|
|
82
|
-
borderWidth: cx(1),
|
|
83
|
-
borderColor: 'rgb(230, 231, 232)',
|
|
84
|
-
},
|
|
85
|
-
})
|
|
86
|
-
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {StyleSheet, TouchableOpacity, View} from 'react-native'
|
|
3
|
+
import {Utils} from 'tuya-panel-kit'
|
|
4
|
+
|
|
5
|
+
const {convertX: cx} = Utils.RatioUtils
|
|
6
|
+
|
|
7
|
+
const temperatures = [
|
|
8
|
+
{
|
|
9
|
+
color: 'rgb(253, 176, 97)',
|
|
10
|
+
value: 0,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
color: 'rgb(249, 208, 162)',
|
|
14
|
+
value: 20,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
color: 'rgb(254, 243, 221)',
|
|
18
|
+
value: 40,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
color: 'rgb(246, 247, 244)',
|
|
22
|
+
value: 60,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
color: 'rgb(231, 238, 247)',
|
|
26
|
+
value: 80,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
color: 'rgb(194, 216, 251)',
|
|
30
|
+
value: 100,
|
|
31
|
+
},
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
const colors = [
|
|
35
|
+
{
|
|
36
|
+
color: '#ff0000',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
color: '#ff8700',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
color: '#fff100',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
color: '#00FF00',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
color: '#0025ff',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
color: '#bb00ff',
|
|
52
|
+
},
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
const LdvPresetView = (props) => {
|
|
56
|
+
const {type, onPress} = props
|
|
57
|
+
let dataSource = type == 'temperature' ? temperatures : colors
|
|
58
|
+
return (
|
|
59
|
+
<View style={styles.container}>
|
|
60
|
+
{dataSource.map((item, index) =>
|
|
61
|
+
<TouchableOpacity
|
|
62
|
+
key={index}
|
|
63
|
+
style={[styles.item, {backgroundColor: item.color}]}
|
|
64
|
+
onPress={() => {
|
|
65
|
+
onPress(item)
|
|
66
|
+
}}/>)}
|
|
67
|
+
</View>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const styles = StyleSheet.create({
|
|
72
|
+
container: {
|
|
73
|
+
flexDirection: 'row',
|
|
74
|
+
justifyContent: 'space-between',
|
|
75
|
+
alignItems: 'center',
|
|
76
|
+
marginHorizontal: cx(16),
|
|
77
|
+
},
|
|
78
|
+
item: {
|
|
79
|
+
width: cx(28),
|
|
80
|
+
height: cx(28),
|
|
81
|
+
borderRadius: cx(14),
|
|
82
|
+
borderWidth: cx(1),
|
|
83
|
+
borderColor: 'rgb(230, 231, 232)',
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
|
|
87
87
|
export default LdvPresetView
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const LdvSaturation: (props: any) => JSX.Element;
|
|
2
|
-
export default LdvSaturation;
|
|
1
|
+
declare const LdvSaturation: (props: any) => JSX.Element;
|
|
2
|
+
export default LdvSaturation;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import LdvSlider from 'components/ldvSlider'
|
|
3
|
-
import I18n from '../i18n/index'
|
|
4
|
-
|
|
5
|
-
const LdvSaturation = (props) => {
|
|
6
|
-
const {value, onSlidingComplete, minSaturation} = props
|
|
7
|
-
|
|
8
|
-
const renderBrightness = () => {
|
|
9
|
-
return (
|
|
10
|
-
<LdvSlider
|
|
11
|
-
style={props.style}
|
|
12
|
-
title={I18n.getLang('light_sources_tile_rgb_lighting_saturation')}
|
|
13
|
-
value={value}
|
|
14
|
-
max={100}
|
|
15
|
-
min={minSaturation ? minSaturation : 0}
|
|
16
|
-
onSlidingComplete={onSlidingComplete}
|
|
17
|
-
onValueChange={props.onValueChange}/>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
return renderBrightness()
|
|
21
|
-
}
|
|
22
|
-
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import LdvSlider from 'components/ldvSlider'
|
|
3
|
+
import I18n from '../i18n/index'
|
|
4
|
+
|
|
5
|
+
const LdvSaturation = (props) => {
|
|
6
|
+
const {value, onSlidingComplete, minSaturation} = props
|
|
7
|
+
|
|
8
|
+
const renderBrightness = () => {
|
|
9
|
+
return (
|
|
10
|
+
<LdvSlider
|
|
11
|
+
style={props.style}
|
|
12
|
+
title={I18n.getLang('light_sources_tile_rgb_lighting_saturation')}
|
|
13
|
+
value={value}
|
|
14
|
+
max={100}
|
|
15
|
+
min={minSaturation ? minSaturation : 0}
|
|
16
|
+
onSlidingComplete={onSlidingComplete}
|
|
17
|
+
onValueChange={props.onValueChange}/>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
return renderBrightness()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
23
|
export default LdvSaturation
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
2
|
-
interface LdvSliderProps {
|
|
3
|
-
title: string;
|
|
4
|
-
value: number;
|
|
5
|
-
min?: number | undefined;
|
|
6
|
-
max?: number | undefined;
|
|
7
|
-
onValueChange?: (v: number) => void | undefined;
|
|
8
|
-
onSlidingComplete: (v: number) => void;
|
|
9
|
-
style?: StyleProp<ViewStyle> | undefined;
|
|
10
|
-
sliderStyle?: StyleProp<ViewStyle> | undefined;
|
|
11
|
-
subTitleStr?: string | number;
|
|
12
|
-
titleStyle?: StyleProp<TextStyle> | undefined;
|
|
13
|
-
}
|
|
14
|
-
declare const LdvSlider: (props: LdvSliderProps) => JSX.Element;
|
|
15
|
-
export default LdvSlider;
|
|
1
|
+
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
2
|
+
interface LdvSliderProps {
|
|
3
|
+
title: string;
|
|
4
|
+
value: number;
|
|
5
|
+
min?: number | undefined;
|
|
6
|
+
max?: number | undefined;
|
|
7
|
+
onValueChange?: (v: number) => void | undefined;
|
|
8
|
+
onSlidingComplete: (v: number) => void;
|
|
9
|
+
style?: StyleProp<ViewStyle> | undefined;
|
|
10
|
+
sliderStyle?: StyleProp<ViewStyle> | undefined;
|
|
11
|
+
subTitleStr?: string | number;
|
|
12
|
+
titleStyle?: StyleProp<TextStyle> | undefined;
|
|
13
|
+
}
|
|
14
|
+
declare const LdvSlider: (props: LdvSliderProps) => JSX.Element;
|
|
15
|
+
export default LdvSlider;
|
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import {useReactive} from 'ahooks'
|
|
2
|
-
import React, {useEffect} from 'react'
|
|
3
|
-
import {StyleProp, StyleSheet, Text, TextStyle, View, ViewStyle} from 'react-native'
|
|
4
|
-
import {Slider, Utils} from 'tuya-panel-kit'
|
|
5
|
-
|
|
6
|
-
const cx = Utils.RatioUtils.convertX
|
|
7
|
-
|
|
8
|
-
interface LdvSliderProps {
|
|
9
|
-
title: string,
|
|
10
|
-
value: number,
|
|
11
|
-
min?: number | undefined,
|
|
12
|
-
max?: number | undefined,
|
|
13
|
-
onValueChange?: (v: number) => void | undefined,
|
|
14
|
-
onSlidingComplete: (v: number) => void,
|
|
15
|
-
style?: StyleProp<ViewStyle> | undefined,
|
|
16
|
-
sliderStyle?: StyleProp<ViewStyle> | undefined
|
|
17
|
-
subTitleStr?: string | number
|
|
18
|
-
titleStyle?: StyleProp<TextStyle> | undefined
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const LdvSlider = (props: LdvSliderProps) => {
|
|
22
|
-
const {value, onSlidingComplete, min, max, sliderStyle, subTitleStr, titleStyle, onValueChange} = props
|
|
23
|
-
|
|
24
|
-
const mMax = max || 100
|
|
25
|
-
const mMin = min ?? 1
|
|
26
|
-
const state = useReactive({
|
|
27
|
-
value: value,
|
|
28
|
-
})
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
state.value = value
|
|
31
|
-
}, [value])
|
|
32
|
-
return (
|
|
33
|
-
<View style={[styles.container, props.style]}>
|
|
34
|
-
<View style={styles.titleBg}>
|
|
35
|
-
<Text style={[styles.title, titleStyle]}>
|
|
36
|
-
{props.title}
|
|
37
|
-
</Text>
|
|
38
|
-
<Text style={styles.valueText}>
|
|
39
|
-
{subTitleStr ? subTitleStr : state.value + '%'}
|
|
40
|
-
</Text>
|
|
41
|
-
</View>
|
|
42
|
-
<Slider.Horizontal
|
|
43
|
-
style={[styles.slider, sliderStyle]}
|
|
44
|
-
styles={{thumb: styles.thumb}}
|
|
45
|
-
maximumValue={mMax}
|
|
46
|
-
minimumValue={mMin}
|
|
47
|
-
value={state.value}
|
|
48
|
-
stepValue={1}
|
|
49
|
-
canTouchTrack={true}
|
|
50
|
-
minimumTrackTintColor={'#666'}
|
|
51
|
-
maximumTrackTintColor={'rgba(120, 120, 128, 0.2)'}
|
|
52
|
-
onValueChange={(value) => {
|
|
53
|
-
state.value = value
|
|
54
|
-
onValueChange && onValueChange(value)
|
|
55
|
-
}}
|
|
56
|
-
onSlidingComplete={onSlidingComplete}
|
|
57
|
-
/>
|
|
58
|
-
</View>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const styles = StyleSheet.create({
|
|
63
|
-
container: {
|
|
64
|
-
flexDirection: 'column',
|
|
65
|
-
paddingHorizontal: cx(16),
|
|
66
|
-
},
|
|
67
|
-
titleBg: {
|
|
68
|
-
flexDirection: 'row',
|
|
69
|
-
justifyContent: 'space-between',
|
|
70
|
-
},
|
|
71
|
-
valueText: {
|
|
72
|
-
marginTop: cx(10),
|
|
73
|
-
fontSize: cx(14),
|
|
74
|
-
color: '#000',
|
|
75
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
76
|
-
},
|
|
77
|
-
title: {
|
|
78
|
-
marginTop: cx(10),
|
|
79
|
-
fontSize: cx(14),
|
|
80
|
-
color: '#000',
|
|
81
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
82
|
-
},
|
|
83
|
-
slider: {
|
|
84
|
-
marginTop: cx(8),
|
|
85
|
-
height: cx(28),
|
|
86
|
-
justifyContent: 'center',
|
|
87
|
-
},
|
|
88
|
-
thumb: {
|
|
89
|
-
backgroundColor: '#fff',
|
|
90
|
-
width: cx(28),
|
|
91
|
-
height: cx(28),
|
|
92
|
-
borderRadius: cx(14),
|
|
93
|
-
shadowColor: '#000000',
|
|
94
|
-
shadowOpacity: 0.2,
|
|
95
|
-
elevation: cx(8),
|
|
96
|
-
shadowRadius: cx(8),
|
|
97
|
-
shadowOffset: {
|
|
98
|
-
width: 0,
|
|
99
|
-
height: cx(4),
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
})
|
|
103
|
-
|
|
1
|
+
import {useReactive} from 'ahooks'
|
|
2
|
+
import React, {useEffect} from 'react'
|
|
3
|
+
import {StyleProp, StyleSheet, Text, TextStyle, View, ViewStyle} from 'react-native'
|
|
4
|
+
import {Slider, Utils} from 'tuya-panel-kit'
|
|
5
|
+
|
|
6
|
+
const cx = Utils.RatioUtils.convertX
|
|
7
|
+
|
|
8
|
+
interface LdvSliderProps {
|
|
9
|
+
title: string,
|
|
10
|
+
value: number,
|
|
11
|
+
min?: number | undefined,
|
|
12
|
+
max?: number | undefined,
|
|
13
|
+
onValueChange?: (v: number) => void | undefined,
|
|
14
|
+
onSlidingComplete: (v: number) => void,
|
|
15
|
+
style?: StyleProp<ViewStyle> | undefined,
|
|
16
|
+
sliderStyle?: StyleProp<ViewStyle> | undefined
|
|
17
|
+
subTitleStr?: string | number
|
|
18
|
+
titleStyle?: StyleProp<TextStyle> | undefined
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const LdvSlider = (props: LdvSliderProps) => {
|
|
22
|
+
const {value, onSlidingComplete, min, max, sliderStyle, subTitleStr, titleStyle, onValueChange} = props
|
|
23
|
+
|
|
24
|
+
const mMax = max || 100
|
|
25
|
+
const mMin = min ?? 1
|
|
26
|
+
const state = useReactive({
|
|
27
|
+
value: value,
|
|
28
|
+
})
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
state.value = value
|
|
31
|
+
}, [value])
|
|
32
|
+
return (
|
|
33
|
+
<View style={[styles.container, props.style]}>
|
|
34
|
+
<View style={styles.titleBg}>
|
|
35
|
+
<Text style={[styles.title, titleStyle]}>
|
|
36
|
+
{props.title}
|
|
37
|
+
</Text>
|
|
38
|
+
<Text style={styles.valueText}>
|
|
39
|
+
{subTitleStr ? subTitleStr : state.value + '%'}
|
|
40
|
+
</Text>
|
|
41
|
+
</View>
|
|
42
|
+
<Slider.Horizontal
|
|
43
|
+
style={[styles.slider, sliderStyle]}
|
|
44
|
+
styles={{thumb: styles.thumb}}
|
|
45
|
+
maximumValue={mMax}
|
|
46
|
+
minimumValue={mMin}
|
|
47
|
+
value={state.value}
|
|
48
|
+
stepValue={1}
|
|
49
|
+
canTouchTrack={true}
|
|
50
|
+
minimumTrackTintColor={'#666'}
|
|
51
|
+
maximumTrackTintColor={'rgba(120, 120, 128, 0.2)'}
|
|
52
|
+
onValueChange={(value) => {
|
|
53
|
+
state.value = value
|
|
54
|
+
onValueChange && onValueChange(value)
|
|
55
|
+
}}
|
|
56
|
+
onSlidingComplete={onSlidingComplete}
|
|
57
|
+
/>
|
|
58
|
+
</View>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const styles = StyleSheet.create({
|
|
63
|
+
container: {
|
|
64
|
+
flexDirection: 'column',
|
|
65
|
+
paddingHorizontal: cx(16),
|
|
66
|
+
},
|
|
67
|
+
titleBg: {
|
|
68
|
+
flexDirection: 'row',
|
|
69
|
+
justifyContent: 'space-between',
|
|
70
|
+
},
|
|
71
|
+
valueText: {
|
|
72
|
+
marginTop: cx(10),
|
|
73
|
+
fontSize: cx(14),
|
|
74
|
+
color: '#000',
|
|
75
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
76
|
+
},
|
|
77
|
+
title: {
|
|
78
|
+
marginTop: cx(10),
|
|
79
|
+
fontSize: cx(14),
|
|
80
|
+
color: '#000',
|
|
81
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
82
|
+
},
|
|
83
|
+
slider: {
|
|
84
|
+
marginTop: cx(8),
|
|
85
|
+
height: cx(28),
|
|
86
|
+
justifyContent: 'center',
|
|
87
|
+
},
|
|
88
|
+
thumb: {
|
|
89
|
+
backgroundColor: '#fff',
|
|
90
|
+
width: cx(28),
|
|
91
|
+
height: cx(28),
|
|
92
|
+
borderRadius: cx(14),
|
|
93
|
+
shadowColor: '#000000',
|
|
94
|
+
shadowOpacity: 0.2,
|
|
95
|
+
elevation: cx(8),
|
|
96
|
+
shadowRadius: cx(8),
|
|
97
|
+
shadowOffset: {
|
|
98
|
+
width: 0,
|
|
99
|
+
height: cx(4),
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
})
|
|
103
|
+
|
|
104
104
|
export default LdvSlider
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
interface Prop {
|
|
2
|
-
title: string;
|
|
3
|
-
color: string;
|
|
4
|
-
colorAlpha: number;
|
|
5
|
-
enable: boolean;
|
|
6
|
-
setEnable: any;
|
|
7
|
-
showSwitch?: boolean;
|
|
8
|
-
}
|
|
9
|
-
declare const LdvSwitch: (props: Prop) => JSX.Element;
|
|
10
|
-
export default LdvSwitch;
|
|
1
|
+
interface Prop {
|
|
2
|
+
title: string;
|
|
3
|
+
color: string;
|
|
4
|
+
colorAlpha: number;
|
|
5
|
+
enable: boolean;
|
|
6
|
+
setEnable: any;
|
|
7
|
+
showSwitch?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const LdvSwitch: (props: Prop) => JSX.Element;
|
|
10
|
+
export default LdvSwitch;
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {StyleSheet, Text, View} from 'react-native'
|
|
3
|
-
import {SwitchButton, Utils} from 'tuya-panel-kit'
|
|
4
|
-
import Spacer from './Spacer'
|
|
5
|
-
|
|
6
|
-
const {convertX: cx} = Utils.RatioUtils
|
|
7
|
-
const { withTheme } = Utils.ThemeUtils
|
|
8
|
-
|
|
9
|
-
interface Prop {
|
|
10
|
-
theme?: any
|
|
11
|
-
title: string
|
|
12
|
-
color: string
|
|
13
|
-
colorAlpha: number
|
|
14
|
-
enable: boolean
|
|
15
|
-
setEnable: (enable: boolean) => void
|
|
16
|
-
showSwitch?:boolean
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const LdvSwitch = (props: Prop) => {
|
|
20
|
-
const {title, color, colorAlpha, enable, setEnable, showSwitch = true} = props
|
|
21
|
-
return (
|
|
22
|
-
<View style={styles.titleBGView}>
|
|
23
|
-
<Text style={{...styles.title, color: props.theme.global.fontColor}}>{title}</Text>
|
|
24
|
-
<View style={[styles.colorBlock, {backgroundColor: color, opacity: colorAlpha}]}/>
|
|
25
|
-
<Spacer style={{flex: 1}} height={0} width={0}/>
|
|
26
|
-
{showSwitch && <SwitchButton value={enable} onValueChange={setEnable}/>}
|
|
27
|
-
</View>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const styles = StyleSheet.create({
|
|
32
|
-
titleBGView: {
|
|
33
|
-
flexDirection: 'row',
|
|
34
|
-
alignItems: 'center',
|
|
35
|
-
paddingHorizontal: cx(16),
|
|
36
|
-
},
|
|
37
|
-
colorBlock: {
|
|
38
|
-
width: cx(20),
|
|
39
|
-
height: cx(20),
|
|
40
|
-
marginStart: cx(12),
|
|
41
|
-
borderRadius: cx(4),
|
|
42
|
-
},
|
|
43
|
-
title: {
|
|
44
|
-
fontSize: cx(16),
|
|
45
|
-
// fontFamily: 'helvetica_neue_lt_std_bd',
|
|
46
|
-
fontWeight: 'bold',
|
|
47
|
-
paddingVertical: cx(16),
|
|
48
|
-
maxWidth: cx(220)
|
|
49
|
-
},
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
export default withTheme(LdvSwitch)
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {StyleSheet, Text, View} from 'react-native'
|
|
3
|
+
import {SwitchButton, Utils} from 'tuya-panel-kit'
|
|
4
|
+
import Spacer from './Spacer'
|
|
5
|
+
|
|
6
|
+
const {convertX: cx} = Utils.RatioUtils
|
|
7
|
+
const { withTheme } = Utils.ThemeUtils
|
|
8
|
+
|
|
9
|
+
interface Prop {
|
|
10
|
+
theme?: any
|
|
11
|
+
title: string
|
|
12
|
+
color: string
|
|
13
|
+
colorAlpha: number
|
|
14
|
+
enable: boolean
|
|
15
|
+
setEnable: (enable: boolean) => void
|
|
16
|
+
showSwitch?:boolean
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const LdvSwitch = (props: Prop) => {
|
|
20
|
+
const {title, color, colorAlpha, enable, setEnable, showSwitch = true} = props
|
|
21
|
+
return (
|
|
22
|
+
<View style={styles.titleBGView}>
|
|
23
|
+
<Text style={{...styles.title, color: props.theme.global.fontColor}}>{title}</Text>
|
|
24
|
+
<View style={[styles.colorBlock, {backgroundColor: color, opacity: colorAlpha}]}/>
|
|
25
|
+
<Spacer style={{flex: 1}} height={0} width={0}/>
|
|
26
|
+
{showSwitch && <SwitchButton value={enable} onValueChange={setEnable}/>}
|
|
27
|
+
</View>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const styles = StyleSheet.create({
|
|
32
|
+
titleBGView: {
|
|
33
|
+
flexDirection: 'row',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
paddingHorizontal: cx(16),
|
|
36
|
+
},
|
|
37
|
+
colorBlock: {
|
|
38
|
+
width: cx(20),
|
|
39
|
+
height: cx(20),
|
|
40
|
+
marginStart: cx(12),
|
|
41
|
+
borderRadius: cx(4),
|
|
42
|
+
},
|
|
43
|
+
title: {
|
|
44
|
+
fontSize: cx(16),
|
|
45
|
+
// fontFamily: 'helvetica_neue_lt_std_bd',
|
|
46
|
+
fontWeight: 'bold',
|
|
47
|
+
paddingVertical: cx(16),
|
|
48
|
+
maxWidth: cx(220)
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
export default withTheme(LdvSwitch)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { StyleProp, TextProps, ViewStyle } from 'react-native';
|
|
2
|
-
interface LdvTemperatureSliderProps {
|
|
3
|
-
title: string;
|
|
4
|
-
onSlidingComplete: (number: any) => void;
|
|
5
|
-
thumbColor: string;
|
|
6
|
-
value: number;
|
|
7
|
-
width?: number | undefined;
|
|
8
|
-
style?: StyleProp<ViewStyle> | undefined;
|
|
9
|
-
titleStyle?: StyleProp<TextProps> | undefined;
|
|
10
|
-
subTitleStr?: string | undefined;
|
|
11
|
-
}
|
|
12
|
-
declare const LdvTemperatureSlider: (props: LdvTemperatureSliderProps) => JSX.Element;
|
|
13
|
-
export default LdvTemperatureSlider;
|
|
1
|
+
import { StyleProp, TextProps, ViewStyle } from 'react-native';
|
|
2
|
+
interface LdvTemperatureSliderProps {
|
|
3
|
+
title: string;
|
|
4
|
+
onSlidingComplete: (number: any) => void;
|
|
5
|
+
thumbColor: string;
|
|
6
|
+
value: number;
|
|
7
|
+
width?: number | undefined;
|
|
8
|
+
style?: StyleProp<ViewStyle> | undefined;
|
|
9
|
+
titleStyle?: StyleProp<TextProps> | undefined;
|
|
10
|
+
subTitleStr?: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
declare const LdvTemperatureSlider: (props: LdvTemperatureSliderProps) => JSX.Element;
|
|
13
|
+
export default LdvTemperatureSlider;
|