@ledvance/base 1.2.82 → 1.2.83
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 +848 -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 -65
- 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 +23723 -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 -11
- 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,132 +1,132 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {StyleProp, StyleSheet, Text, View, ViewStyle} from 'react-native'
|
|
3
|
-
import {LinearGradient, Slider, Utils} from 'tuya-panel-kit'
|
|
4
|
-
import {Rect} from 'react-native-svg'
|
|
5
|
-
|
|
6
|
-
const cx = Utils.RatioUtils.convertX
|
|
7
|
-
|
|
8
|
-
const temperatures = {
|
|
9
|
-
'0%': 'rgb(254, 172, 90)',
|
|
10
|
-
'22%': 'rgb(249, 209, 164)',
|
|
11
|
-
'41%': 'rgb(254, 244, 223)',
|
|
12
|
-
'60%': 'rgb(252, 250, 242)',
|
|
13
|
-
'80%': 'rgb(226, 235, 248)',
|
|
14
|
-
'100%': 'rgb(194, 217, 254)',
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const colors = {
|
|
18
|
-
'0%': 'rgb(255, 0, 0)',
|
|
19
|
-
'17%': 'rgb(249, 238, 0)',
|
|
20
|
-
'35%': 'rgb(96, 255, 66)',
|
|
21
|
-
'55%': 'rgb(0, 249, 255)',
|
|
22
|
-
'65%': 'rgb(43, 0, 255)',
|
|
23
|
-
'80%': 'rgb(180, 0, 255)',
|
|
24
|
-
'100%': 'rgb(255, 0, 0)',
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const TEMP_KEY = 'temperature'
|
|
28
|
-
|
|
29
|
-
interface LdvColorSliderProps {
|
|
30
|
-
title: string,
|
|
31
|
-
type: string,
|
|
32
|
-
onValueChange?: (number) => void | undefined,
|
|
33
|
-
onSlidingComplete: (number) => void,
|
|
34
|
-
thumbColor: string,
|
|
35
|
-
value: number,
|
|
36
|
-
width?: number | undefined,
|
|
37
|
-
style?: StyleProp<ViewStyle> | undefined
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const LdvColorSlider = (props: LdvColorSliderProps) => {
|
|
41
|
-
const {title, type, onSlidingComplete, thumbColor, value} = props
|
|
42
|
-
let dataSource = type === TEMP_KEY ? temperatures : colors
|
|
43
|
-
let max = type === TEMP_KEY ? 100 : 359
|
|
44
|
-
let min = type === TEMP_KEY ? 0 : 0
|
|
45
|
-
const width = props.width || (Utils.RatioUtils.width - cx(80))
|
|
46
|
-
return (
|
|
47
|
-
<View style={[styles.container, props.style]}>
|
|
48
|
-
<Text style={styles.title}>
|
|
49
|
-
{title}
|
|
50
|
-
</Text>
|
|
51
|
-
<Slider.Horizontal
|
|
52
|
-
style={{...styles.shadeSlider, width}}
|
|
53
|
-
styles={{track: styles.sliderTrack, thumb: {...styles.shadeThumb, backgroundColor: thumbColor}}}
|
|
54
|
-
maximumValue={max}
|
|
55
|
-
minimumValue={min}
|
|
56
|
-
value={value}
|
|
57
|
-
stepValue={1}
|
|
58
|
-
canTouchTrack={true}
|
|
59
|
-
theme={{
|
|
60
|
-
trackRadius: cx(15),
|
|
61
|
-
}}
|
|
62
|
-
onlyMaximumTrack={true}
|
|
63
|
-
renderMaximumTrack={() => {
|
|
64
|
-
return (
|
|
65
|
-
<View style={{flex: 1, borderRadius: cx(15)}}>
|
|
66
|
-
<LinearGradient
|
|
67
|
-
style={{...styles.sliderLinearGradient, width}}
|
|
68
|
-
x1="0%"
|
|
69
|
-
y1="0%"
|
|
70
|
-
x2="100%"
|
|
71
|
-
y2="0%"
|
|
72
|
-
stops={dataSource}>
|
|
73
|
-
<Rect {...styles.sliderLinearGradient} width={width}/>
|
|
74
|
-
</LinearGradient>
|
|
75
|
-
</View>
|
|
76
|
-
)
|
|
77
|
-
}}
|
|
78
|
-
onValueChange={props.onValueChange}
|
|
79
|
-
onSlidingComplete={onSlidingComplete}
|
|
80
|
-
/>
|
|
81
|
-
</View>
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const styles = StyleSheet.create({
|
|
86
|
-
container: {
|
|
87
|
-
height: cx(57),
|
|
88
|
-
flexDirection: 'column',
|
|
89
|
-
paddingStart: cx(16),
|
|
90
|
-
},
|
|
91
|
-
title: {
|
|
92
|
-
marginTop: cx(4),
|
|
93
|
-
fontSize: cx(14),
|
|
94
|
-
color: '#000',
|
|
95
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
96
|
-
},
|
|
97
|
-
shadeSlider: {
|
|
98
|
-
marginTop: cx(8),
|
|
99
|
-
height: cx(28),
|
|
100
|
-
justifyContent: 'center',
|
|
101
|
-
},
|
|
102
|
-
sliderTrack: {
|
|
103
|
-
marginTop: cx(9),
|
|
104
|
-
marginBottom: cx(9),
|
|
105
|
-
flex: 1,
|
|
106
|
-
borderRadius: cx(15),
|
|
107
|
-
},
|
|
108
|
-
shadeThumb: {
|
|
109
|
-
backgroundColor: 'rgb(0, 249, 255)',
|
|
110
|
-
width: cx(28),
|
|
111
|
-
height: cx(28),
|
|
112
|
-
borderRadius: cx(14),
|
|
113
|
-
borderColor: 'white',
|
|
114
|
-
borderWidth: 1,
|
|
115
|
-
shadowColor: '#000000',
|
|
116
|
-
shadowOpacity: 0.2,
|
|
117
|
-
shadowRadius: cx(8),
|
|
118
|
-
elevation: cx(8),
|
|
119
|
-
shadowOffset: {
|
|
120
|
-
width: 0,
|
|
121
|
-
height: cx(4),
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
sliderLinearGradient: {
|
|
125
|
-
height: cx(12),
|
|
126
|
-
},
|
|
127
|
-
presetView: {
|
|
128
|
-
height: cx(60),
|
|
129
|
-
},
|
|
130
|
-
})
|
|
131
|
-
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {StyleProp, StyleSheet, Text, View, ViewStyle} from 'react-native'
|
|
3
|
+
import {LinearGradient, Slider, Utils} from 'tuya-panel-kit'
|
|
4
|
+
import {Rect} from 'react-native-svg'
|
|
5
|
+
|
|
6
|
+
const cx = Utils.RatioUtils.convertX
|
|
7
|
+
|
|
8
|
+
const temperatures = {
|
|
9
|
+
'0%': 'rgb(254, 172, 90)',
|
|
10
|
+
'22%': 'rgb(249, 209, 164)',
|
|
11
|
+
'41%': 'rgb(254, 244, 223)',
|
|
12
|
+
'60%': 'rgb(252, 250, 242)',
|
|
13
|
+
'80%': 'rgb(226, 235, 248)',
|
|
14
|
+
'100%': 'rgb(194, 217, 254)',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const colors = {
|
|
18
|
+
'0%': 'rgb(255, 0, 0)',
|
|
19
|
+
'17%': 'rgb(249, 238, 0)',
|
|
20
|
+
'35%': 'rgb(96, 255, 66)',
|
|
21
|
+
'55%': 'rgb(0, 249, 255)',
|
|
22
|
+
'65%': 'rgb(43, 0, 255)',
|
|
23
|
+
'80%': 'rgb(180, 0, 255)',
|
|
24
|
+
'100%': 'rgb(255, 0, 0)',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const TEMP_KEY = 'temperature'
|
|
28
|
+
|
|
29
|
+
interface LdvColorSliderProps {
|
|
30
|
+
title: string,
|
|
31
|
+
type: string,
|
|
32
|
+
onValueChange?: (number) => void | undefined,
|
|
33
|
+
onSlidingComplete: (number) => void,
|
|
34
|
+
thumbColor: string,
|
|
35
|
+
value: number,
|
|
36
|
+
width?: number | undefined,
|
|
37
|
+
style?: StyleProp<ViewStyle> | undefined
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const LdvColorSlider = (props: LdvColorSliderProps) => {
|
|
41
|
+
const {title, type, onSlidingComplete, thumbColor, value} = props
|
|
42
|
+
let dataSource = type === TEMP_KEY ? temperatures : colors
|
|
43
|
+
let max = type === TEMP_KEY ? 100 : 359
|
|
44
|
+
let min = type === TEMP_KEY ? 0 : 0
|
|
45
|
+
const width = props.width || (Utils.RatioUtils.width - cx(80))
|
|
46
|
+
return (
|
|
47
|
+
<View style={[styles.container, props.style]}>
|
|
48
|
+
<Text style={styles.title}>
|
|
49
|
+
{title}
|
|
50
|
+
</Text>
|
|
51
|
+
<Slider.Horizontal
|
|
52
|
+
style={{...styles.shadeSlider, width}}
|
|
53
|
+
styles={{track: styles.sliderTrack, thumb: {...styles.shadeThumb, backgroundColor: thumbColor}}}
|
|
54
|
+
maximumValue={max}
|
|
55
|
+
minimumValue={min}
|
|
56
|
+
value={value}
|
|
57
|
+
stepValue={1}
|
|
58
|
+
canTouchTrack={true}
|
|
59
|
+
theme={{
|
|
60
|
+
trackRadius: cx(15),
|
|
61
|
+
}}
|
|
62
|
+
onlyMaximumTrack={true}
|
|
63
|
+
renderMaximumTrack={() => {
|
|
64
|
+
return (
|
|
65
|
+
<View style={{flex: 1, borderRadius: cx(15)}}>
|
|
66
|
+
<LinearGradient
|
|
67
|
+
style={{...styles.sliderLinearGradient, width}}
|
|
68
|
+
x1="0%"
|
|
69
|
+
y1="0%"
|
|
70
|
+
x2="100%"
|
|
71
|
+
y2="0%"
|
|
72
|
+
stops={dataSource}>
|
|
73
|
+
<Rect {...styles.sliderLinearGradient} width={width}/>
|
|
74
|
+
</LinearGradient>
|
|
75
|
+
</View>
|
|
76
|
+
)
|
|
77
|
+
}}
|
|
78
|
+
onValueChange={props.onValueChange}
|
|
79
|
+
onSlidingComplete={onSlidingComplete}
|
|
80
|
+
/>
|
|
81
|
+
</View>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const styles = StyleSheet.create({
|
|
86
|
+
container: {
|
|
87
|
+
height: cx(57),
|
|
88
|
+
flexDirection: 'column',
|
|
89
|
+
paddingStart: cx(16),
|
|
90
|
+
},
|
|
91
|
+
title: {
|
|
92
|
+
marginTop: cx(4),
|
|
93
|
+
fontSize: cx(14),
|
|
94
|
+
color: '#000',
|
|
95
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
96
|
+
},
|
|
97
|
+
shadeSlider: {
|
|
98
|
+
marginTop: cx(8),
|
|
99
|
+
height: cx(28),
|
|
100
|
+
justifyContent: 'center',
|
|
101
|
+
},
|
|
102
|
+
sliderTrack: {
|
|
103
|
+
marginTop: cx(9),
|
|
104
|
+
marginBottom: cx(9),
|
|
105
|
+
flex: 1,
|
|
106
|
+
borderRadius: cx(15),
|
|
107
|
+
},
|
|
108
|
+
shadeThumb: {
|
|
109
|
+
backgroundColor: 'rgb(0, 249, 255)',
|
|
110
|
+
width: cx(28),
|
|
111
|
+
height: cx(28),
|
|
112
|
+
borderRadius: cx(14),
|
|
113
|
+
borderColor: 'white',
|
|
114
|
+
borderWidth: 1,
|
|
115
|
+
shadowColor: '#000000',
|
|
116
|
+
shadowOpacity: 0.2,
|
|
117
|
+
shadowRadius: cx(8),
|
|
118
|
+
elevation: cx(8),
|
|
119
|
+
shadowOffset: {
|
|
120
|
+
width: 0,
|
|
121
|
+
height: cx(4),
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
sliderLinearGradient: {
|
|
125
|
+
height: cx(12),
|
|
126
|
+
},
|
|
127
|
+
presetView: {
|
|
128
|
+
height: cx(60),
|
|
129
|
+
},
|
|
130
|
+
})
|
|
131
|
+
|
|
132
132
|
export default LdvColorSlider
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
|
-
interface Props {
|
|
4
|
-
style?: StyleProp<ViewStyle>;
|
|
5
|
-
textStyle?: StyleProp<TextStyle>;
|
|
6
|
-
title: string;
|
|
7
|
-
rightComponent?: any;
|
|
8
|
-
onPress?: any;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
}
|
|
11
|
-
declare const LdvItemView: React.FC<Props>;
|
|
12
|
-
export default LdvItemView;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
|
+
interface Props {
|
|
4
|
+
style?: StyleProp<ViewStyle>;
|
|
5
|
+
textStyle?: StyleProp<TextStyle>;
|
|
6
|
+
title: string;
|
|
7
|
+
rightComponent?: any;
|
|
8
|
+
onPress?: any;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const LdvItemView: React.FC<Props>;
|
|
12
|
+
export default LdvItemView;
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { StyleProp, StyleSheet, Text, TextStyle, TouchableOpacity, View, ViewStyle } from 'react-native'
|
|
3
|
-
import { Utils } from 'tuya-panel-kit'
|
|
4
|
-
|
|
5
|
-
const { convertX } = Utils.RatioUtils
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
style?: StyleProp<ViewStyle>
|
|
9
|
-
textStyle?: StyleProp<TextStyle>
|
|
10
|
-
title: string
|
|
11
|
-
rightComponent?: any
|
|
12
|
-
onPress?: any
|
|
13
|
-
disabled?: boolean
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const LdvItemView: React.FC<Props> = (props) => {
|
|
17
|
-
const { rightComponent, title, style, onPress, disabled, textStyle } = props
|
|
18
|
-
return (
|
|
19
|
-
<TouchableOpacity onPress={onPress} disabled={disabled}>
|
|
20
|
-
<View style={[styles.bg, style]}>
|
|
21
|
-
<Text style={[styles.text, textStyle]}>
|
|
22
|
-
{title}
|
|
23
|
-
</Text>
|
|
24
|
-
{rightComponent && rightComponent()}
|
|
25
|
-
</View>
|
|
26
|
-
</TouchableOpacity>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const styles = StyleSheet.create({
|
|
31
|
-
bg: {
|
|
32
|
-
height: convertX(50),
|
|
33
|
-
flexDirection: 'row',
|
|
34
|
-
justifyContent: 'space-between',
|
|
35
|
-
alignItems: 'center',
|
|
36
|
-
marginHorizontal: convertX(24),
|
|
37
|
-
},
|
|
38
|
-
text: {
|
|
39
|
-
fontSize: convertX(16),
|
|
40
|
-
fontWeight: 'bold',
|
|
41
|
-
},
|
|
42
|
-
})
|
|
43
|
-
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleProp, StyleSheet, Text, TextStyle, TouchableOpacity, View, ViewStyle } from 'react-native'
|
|
3
|
+
import { Utils } from 'tuya-panel-kit'
|
|
4
|
+
|
|
5
|
+
const { convertX } = Utils.RatioUtils
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
style?: StyleProp<ViewStyle>
|
|
9
|
+
textStyle?: StyleProp<TextStyle>
|
|
10
|
+
title: string
|
|
11
|
+
rightComponent?: any
|
|
12
|
+
onPress?: any
|
|
13
|
+
disabled?: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const LdvItemView: React.FC<Props> = (props) => {
|
|
17
|
+
const { rightComponent, title, style, onPress, disabled, textStyle } = props
|
|
18
|
+
return (
|
|
19
|
+
<TouchableOpacity onPress={onPress} disabled={disabled}>
|
|
20
|
+
<View style={[styles.bg, style]}>
|
|
21
|
+
<Text style={[styles.text, textStyle]}>
|
|
22
|
+
{title}
|
|
23
|
+
</Text>
|
|
24
|
+
{rightComponent && rightComponent()}
|
|
25
|
+
</View>
|
|
26
|
+
</TouchableOpacity>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const styles = StyleSheet.create({
|
|
31
|
+
bg: {
|
|
32
|
+
height: convertX(50),
|
|
33
|
+
flexDirection: 'row',
|
|
34
|
+
justifyContent: 'space-between',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
marginHorizontal: convertX(24),
|
|
37
|
+
},
|
|
38
|
+
text: {
|
|
39
|
+
fontSize: convertX(16),
|
|
40
|
+
fontWeight: 'bold',
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
|
|
44
44
|
export default LdvItemView
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
-
interface LdvPickerViewProps {
|
|
3
|
-
hour: string;
|
|
4
|
-
minute: string;
|
|
5
|
-
setHour: (string: any) => void;
|
|
6
|
-
setMinute: (string: any) => void;
|
|
7
|
-
style?: StyleProp<ViewStyle> | undefined;
|
|
8
|
-
unit?: string[];
|
|
9
|
-
minutesStep?: number;
|
|
10
|
-
maxHour?: number;
|
|
11
|
-
}
|
|
12
|
-
declare const LdvPickerView: (props: LdvPickerViewProps) => JSX.Element;
|
|
13
|
-
export default LdvPickerView;
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
interface LdvPickerViewProps {
|
|
3
|
+
hour: string;
|
|
4
|
+
minute: string;
|
|
5
|
+
setHour: (string: any) => void;
|
|
6
|
+
setMinute: (string: any) => void;
|
|
7
|
+
style?: StyleProp<ViewStyle> | undefined;
|
|
8
|
+
unit?: string[];
|
|
9
|
+
minutesStep?: number;
|
|
10
|
+
maxHour?: number;
|
|
11
|
+
}
|
|
12
|
+
declare const LdvPickerView: (props: LdvPickerViewProps) => JSX.Element;
|
|
13
|
+
export default LdvPickerView;
|
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import React, { useMemo } from 'react'
|
|
2
|
-
import {StyleProp, StyleSheet, Text, View, ViewStyle} from 'react-native'
|
|
3
|
-
import {Picker, Utils} from 'tuya-panel-kit'
|
|
4
|
-
import _ from 'lodash'
|
|
5
|
-
|
|
6
|
-
const {convertX} = Utils.RatioUtils
|
|
7
|
-
const { withTheme } = Utils.ThemeUtils
|
|
8
|
-
|
|
9
|
-
const pickerTheme = {
|
|
10
|
-
fontSize: 20,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface LdvPickerViewProps {
|
|
14
|
-
theme?: any
|
|
15
|
-
hour: string,
|
|
16
|
-
minute: string,
|
|
17
|
-
setHour: (string) => void,
|
|
18
|
-
setMinute: (string) => void,
|
|
19
|
-
style?: StyleProp<ViewStyle> | undefined,
|
|
20
|
-
unit?: string[]
|
|
21
|
-
minutesStep?: number
|
|
22
|
-
maxHour?: number // 不包含关系
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const LdvPickerView = (props: LdvPickerViewProps) => {
|
|
26
|
-
|
|
27
|
-
const {hour, minute, unit, setHour, setMinute, minutesStep = 1, maxHour = 24} = props
|
|
28
|
-
const hours = useMemo(() => _.times(maxHour, (n) => _.padStart(n.toString(), 2, '0')), [])
|
|
29
|
-
const minutes = useMemo(() => _.times(60 / minutesStep, (n) => _.padStart((n * minutesStep).toString(), 2, '0')) , [props.minutesStep])
|
|
30
|
-
|
|
31
|
-
const styles = StyleSheet.create({
|
|
32
|
-
pickerContainer: {
|
|
33
|
-
flexDirection: 'row',
|
|
34
|
-
alignItems: 'center',
|
|
35
|
-
},
|
|
36
|
-
picker: {
|
|
37
|
-
flex: 1,
|
|
38
|
-
backgroundColor: props.theme.card.background,
|
|
39
|
-
},
|
|
40
|
-
pickerLeft: {},
|
|
41
|
-
pickerItem: {},
|
|
42
|
-
picContainer: {
|
|
43
|
-
flex: 1,
|
|
44
|
-
position: 'relative',
|
|
45
|
-
},
|
|
46
|
-
pickerUnit: {
|
|
47
|
-
position: 'absolute',
|
|
48
|
-
right: convertX(20),
|
|
49
|
-
top: '44%',
|
|
50
|
-
},
|
|
51
|
-
})
|
|
52
|
-
return (
|
|
53
|
-
<View style={[styles.pickerContainer, props.style]}>
|
|
54
|
-
<View style={styles.picContainer}>
|
|
55
|
-
<Picker
|
|
56
|
-
style={[styles.picker, styles.pickerLeft]}
|
|
57
|
-
loop={true}
|
|
58
|
-
theme={pickerTheme}
|
|
59
|
-
itemStyle={styles.pickerItem}
|
|
60
|
-
textSize={convertX(14)}
|
|
61
|
-
selectedValue={hour}
|
|
62
|
-
itemAlign={'center'}
|
|
63
|
-
onValueChange={value => setHour(value as string)}>
|
|
64
|
-
{hours.map((value) => (
|
|
65
|
-
<Picker.Item key={value} value={value} label={value}/>
|
|
66
|
-
))}
|
|
67
|
-
</Picker>
|
|
68
|
-
{unit ? <View style={styles.pickerUnit}>
|
|
69
|
-
<Text style={{color: props.theme.global.fontColor, fontSize: convertX(18)}}>
|
|
70
|
-
{unit[0]}
|
|
71
|
-
</Text>
|
|
72
|
-
</View> : null}
|
|
73
|
-
</View>
|
|
74
|
-
<View style={styles.picContainer}>
|
|
75
|
-
<Picker
|
|
76
|
-
style={[styles.picker, styles.pickerLeft]}
|
|
77
|
-
loop={true}
|
|
78
|
-
theme={pickerTheme}
|
|
79
|
-
itemStyle={styles.pickerItem}
|
|
80
|
-
textSize={convertX(14)}
|
|
81
|
-
selectedValue={minute}
|
|
82
|
-
onValueChange={value => setMinute(value as string)}>
|
|
83
|
-
{minutes.map((value) => (
|
|
84
|
-
<Picker.Item key={value} value={value} label={value}/>
|
|
85
|
-
))}
|
|
86
|
-
</Picker>
|
|
87
|
-
{unit ? <View style={styles.pickerUnit}>
|
|
88
|
-
<Text style={{color: props.theme.global.fontColor, fontSize: convertX(18)}}>
|
|
89
|
-
{unit[1]}
|
|
90
|
-
</Text>
|
|
91
|
-
</View> : null}
|
|
92
|
-
</View>
|
|
93
|
-
</View>
|
|
94
|
-
)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export default withTheme(LdvPickerView)
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
import {StyleProp, StyleSheet, Text, View, ViewStyle} from 'react-native'
|
|
3
|
+
import {Picker, Utils} from 'tuya-panel-kit'
|
|
4
|
+
import _ from 'lodash'
|
|
5
|
+
|
|
6
|
+
const {convertX} = Utils.RatioUtils
|
|
7
|
+
const { withTheme } = Utils.ThemeUtils
|
|
8
|
+
|
|
9
|
+
const pickerTheme = {
|
|
10
|
+
fontSize: 20,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface LdvPickerViewProps {
|
|
14
|
+
theme?: any
|
|
15
|
+
hour: string,
|
|
16
|
+
minute: string,
|
|
17
|
+
setHour: (string) => void,
|
|
18
|
+
setMinute: (string) => void,
|
|
19
|
+
style?: StyleProp<ViewStyle> | undefined,
|
|
20
|
+
unit?: string[]
|
|
21
|
+
minutesStep?: number
|
|
22
|
+
maxHour?: number // 不包含关系
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const LdvPickerView = (props: LdvPickerViewProps) => {
|
|
26
|
+
|
|
27
|
+
const {hour, minute, unit, setHour, setMinute, minutesStep = 1, maxHour = 24} = props
|
|
28
|
+
const hours = useMemo(() => _.times(maxHour, (n) => _.padStart(n.toString(), 2, '0')), [])
|
|
29
|
+
const minutes = useMemo(() => _.times(60 / minutesStep, (n) => _.padStart((n * minutesStep).toString(), 2, '0')) , [props.minutesStep])
|
|
30
|
+
|
|
31
|
+
const styles = StyleSheet.create({
|
|
32
|
+
pickerContainer: {
|
|
33
|
+
flexDirection: 'row',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
},
|
|
36
|
+
picker: {
|
|
37
|
+
flex: 1,
|
|
38
|
+
backgroundColor: props.theme.card.background,
|
|
39
|
+
},
|
|
40
|
+
pickerLeft: {},
|
|
41
|
+
pickerItem: {},
|
|
42
|
+
picContainer: {
|
|
43
|
+
flex: 1,
|
|
44
|
+
position: 'relative',
|
|
45
|
+
},
|
|
46
|
+
pickerUnit: {
|
|
47
|
+
position: 'absolute',
|
|
48
|
+
right: convertX(20),
|
|
49
|
+
top: '44%',
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
return (
|
|
53
|
+
<View style={[styles.pickerContainer, props.style]}>
|
|
54
|
+
<View style={styles.picContainer}>
|
|
55
|
+
<Picker
|
|
56
|
+
style={[styles.picker, styles.pickerLeft]}
|
|
57
|
+
loop={true}
|
|
58
|
+
theme={pickerTheme}
|
|
59
|
+
itemStyle={styles.pickerItem}
|
|
60
|
+
textSize={convertX(14)}
|
|
61
|
+
selectedValue={hour}
|
|
62
|
+
itemAlign={'center'}
|
|
63
|
+
onValueChange={value => setHour(value as string)}>
|
|
64
|
+
{hours.map((value) => (
|
|
65
|
+
<Picker.Item key={value} value={value} label={value}/>
|
|
66
|
+
))}
|
|
67
|
+
</Picker>
|
|
68
|
+
{unit ? <View style={styles.pickerUnit}>
|
|
69
|
+
<Text style={{color: props.theme.global.fontColor, fontSize: convertX(18)}}>
|
|
70
|
+
{unit[0]}
|
|
71
|
+
</Text>
|
|
72
|
+
</View> : null}
|
|
73
|
+
</View>
|
|
74
|
+
<View style={styles.picContainer}>
|
|
75
|
+
<Picker
|
|
76
|
+
style={[styles.picker, styles.pickerLeft]}
|
|
77
|
+
loop={true}
|
|
78
|
+
theme={pickerTheme}
|
|
79
|
+
itemStyle={styles.pickerItem}
|
|
80
|
+
textSize={convertX(14)}
|
|
81
|
+
selectedValue={minute}
|
|
82
|
+
onValueChange={value => setMinute(value as string)}>
|
|
83
|
+
{minutes.map((value) => (
|
|
84
|
+
<Picker.Item key={value} value={value} label={value}/>
|
|
85
|
+
))}
|
|
86
|
+
</Picker>
|
|
87
|
+
{unit ? <View style={styles.pickerUnit}>
|
|
88
|
+
<Text style={{color: props.theme.global.fontColor, fontSize: convertX(18)}}>
|
|
89
|
+
{unit[1]}
|
|
90
|
+
</Text>
|
|
91
|
+
</View> : null}
|
|
92
|
+
</View>
|
|
93
|
+
</View>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export default withTheme(LdvPickerView)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const LdvPresetView: (props: any) => JSX.Element;
|
|
2
|
-
export default LdvPresetView;
|
|
1
|
+
declare const LdvPresetView: (props: any) => JSX.Element;
|
|
2
|
+
export default LdvPresetView;
|