@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,130 +1,130 @@
|
|
|
1
|
-
import { exchangeNumber, localeNumber } from "@ledvance/base/src/utils/common";
|
|
2
|
-
import res from "@res";
|
|
3
|
-
import { useReactive } from "ahooks";
|
|
4
|
-
import React, { memo, useCallback } from "react";
|
|
5
|
-
import { TouchableOpacity, View, Image, TextInput, StyleSheet, StyleProp, ViewStyle } from "react-native";
|
|
6
|
-
import { Utils } from "tuya-panel-kit";
|
|
7
|
-
|
|
8
|
-
const { add, subtract, inMaxMin } = Utils.NumberUtils
|
|
9
|
-
|
|
10
|
-
const { convertX: cx } = Utils.RatioUtils
|
|
11
|
-
|
|
12
|
-
export interface StepperProps {
|
|
13
|
-
value: number | string
|
|
14
|
-
stepValue?: number // 1
|
|
15
|
-
min?: number // 0
|
|
16
|
-
max?: number // 99
|
|
17
|
-
editable?: boolean
|
|
18
|
-
selectionColor?: string
|
|
19
|
-
isRealTime?: boolean
|
|
20
|
-
isBeyond?: boolean // 允许超出边界值
|
|
21
|
-
onValueChange?: ((value: number) => void)
|
|
22
|
-
disabled?: boolean
|
|
23
|
-
style?: StyleProp<ViewStyle>
|
|
24
|
-
buttonStyle?: StyleProp<ViewStyle>
|
|
25
|
-
inputStyle?: StyleProp<ViewStyle>
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const Stepper = (props: StepperProps) => {
|
|
29
|
-
const state = useReactive({
|
|
30
|
-
value: localeNumber(Number(props.value), 1) ?? 0,
|
|
31
|
-
stepValue: props.stepValue ?? 1,
|
|
32
|
-
min: props.min ?? 0,
|
|
33
|
-
max: props.max ?? 99
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
const handlePress = useCallback((isAdd: boolean) => {
|
|
37
|
-
const v = inMaxMin(state.min, state.max, isAdd ? add(Number(exchangeNumber(state.value)), state.stepValue) : subtract(Number(exchangeNumber(state.value)), state.stepValue))
|
|
38
|
-
state.value = localeNumber(v, 1)
|
|
39
|
-
props.onValueChange && props.onValueChange(v)
|
|
40
|
-
}, [])
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const handleChangeText = useCallback((v: string) => {
|
|
44
|
-
const newValue = exchangeNumber(v)
|
|
45
|
-
const idx = newValue.indexOf('.')
|
|
46
|
-
if (newValue[0] === '.' ||
|
|
47
|
-
(newValue.length === 2 && newValue[0] === '0' && newValue[1] !== '.') ||
|
|
48
|
-
newValue.split('').filter(item => item === '.').length > 1 ||
|
|
49
|
-
(!props.isBeyond && (Number(newValue) > state.max || Number(newValue) < state.min)) ||
|
|
50
|
-
(idx !== -1 && newValue.length > idx + 2)) {
|
|
51
|
-
return
|
|
52
|
-
}
|
|
53
|
-
if (props.isRealTime) {
|
|
54
|
-
if (typeof v === 'string' && !v.length) {
|
|
55
|
-
props.onValueChange && props.onValueChange(0)
|
|
56
|
-
} else {
|
|
57
|
-
props.onValueChange && props.onValueChange(Number(exchangeNumber(v)))
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
state.value = v
|
|
61
|
-
}, [])
|
|
62
|
-
|
|
63
|
-
const handleEndText = useCallback(() => {
|
|
64
|
-
if (typeof state.value === 'string' && !state.value.length) {
|
|
65
|
-
props.onValueChange && props.onValueChange(state.min)
|
|
66
|
-
state.value = state.min.toString()
|
|
67
|
-
} else {
|
|
68
|
-
props.onValueChange && props.onValueChange(Number(exchangeNumber(state.value)))
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
}, [])
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<View style={[styles.stepperContainer, props.style]}>
|
|
75
|
-
<TouchableOpacity
|
|
76
|
-
style={[styles.stepperButton, props.buttonStyle]}
|
|
77
|
-
onPress={() => handlePress(false)}
|
|
78
|
-
>
|
|
79
|
-
<Image width={cx(16)} height={cx(16)} source={res.ic_minus} />
|
|
80
|
-
</TouchableOpacity>
|
|
81
|
-
<TextInput
|
|
82
|
-
style={[styles.stepperInput, props.inputStyle]}
|
|
83
|
-
value={state.value.toString()}
|
|
84
|
-
keyboardType="numeric"
|
|
85
|
-
onChangeText={handleChangeText}
|
|
86
|
-
maxLength={4}
|
|
87
|
-
enablesReturnKeyAutomatically={true}
|
|
88
|
-
onEndEditing={handleEndText}
|
|
89
|
-
editable={props.editable || props.disabled}
|
|
90
|
-
/>
|
|
91
|
-
<TouchableOpacity
|
|
92
|
-
style={[styles.stepperButton, props.buttonStyle]}
|
|
93
|
-
onPress={() => handlePress(true)}
|
|
94
|
-
>
|
|
95
|
-
<Image style={{ width: cx(20), height: cx(20) }} source={res.ic_plus} />
|
|
96
|
-
</TouchableOpacity>
|
|
97
|
-
</View>
|
|
98
|
-
)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const styles = StyleSheet.create({
|
|
102
|
-
stepperContainer: {
|
|
103
|
-
flexDirection: 'row',
|
|
104
|
-
alignItems: 'center',
|
|
105
|
-
backgroundColor: '#f5f5f5',
|
|
106
|
-
padding: cx(2),
|
|
107
|
-
borderRadius: cx(12),
|
|
108
|
-
width: cx(150),
|
|
109
|
-
},
|
|
110
|
-
stepperButton: {
|
|
111
|
-
width: cx(52),
|
|
112
|
-
height: cx(28),
|
|
113
|
-
backgroundColor: '#fff',
|
|
114
|
-
borderRadius: cx(10),
|
|
115
|
-
alignItems: 'center',
|
|
116
|
-
justifyContent: 'center',
|
|
117
|
-
},
|
|
118
|
-
stepperInput: {
|
|
119
|
-
width: cx(42),
|
|
120
|
-
height: cx(22),
|
|
121
|
-
color: '#333',
|
|
122
|
-
fontSize: cx(16),
|
|
123
|
-
padding: 0,
|
|
124
|
-
alignItems: 'center',
|
|
125
|
-
justifyContent: 'center',
|
|
126
|
-
textAlign: 'center',
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
export default memo(Stepper)
|
|
1
|
+
import { exchangeNumber, localeNumber } from "@ledvance/base/src/utils/common";
|
|
2
|
+
import res from "@res";
|
|
3
|
+
import { useReactive } from "ahooks";
|
|
4
|
+
import React, { memo, useCallback } from "react";
|
|
5
|
+
import { TouchableOpacity, View, Image, TextInput, StyleSheet, StyleProp, ViewStyle } from "react-native";
|
|
6
|
+
import { Utils } from "tuya-panel-kit";
|
|
7
|
+
|
|
8
|
+
const { add, subtract, inMaxMin } = Utils.NumberUtils
|
|
9
|
+
|
|
10
|
+
const { convertX: cx } = Utils.RatioUtils
|
|
11
|
+
|
|
12
|
+
export interface StepperProps {
|
|
13
|
+
value: number | string
|
|
14
|
+
stepValue?: number // 1
|
|
15
|
+
min?: number // 0
|
|
16
|
+
max?: number // 99
|
|
17
|
+
editable?: boolean
|
|
18
|
+
selectionColor?: string
|
|
19
|
+
isRealTime?: boolean
|
|
20
|
+
isBeyond?: boolean // 允许超出边界值
|
|
21
|
+
onValueChange?: ((value: number) => void)
|
|
22
|
+
disabled?: boolean
|
|
23
|
+
style?: StyleProp<ViewStyle>
|
|
24
|
+
buttonStyle?: StyleProp<ViewStyle>
|
|
25
|
+
inputStyle?: StyleProp<ViewStyle>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const Stepper = (props: StepperProps) => {
|
|
29
|
+
const state = useReactive({
|
|
30
|
+
value: localeNumber(Number(props.value), 1) ?? 0,
|
|
31
|
+
stepValue: props.stepValue ?? 1,
|
|
32
|
+
min: props.min ?? 0,
|
|
33
|
+
max: props.max ?? 99
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const handlePress = useCallback((isAdd: boolean) => {
|
|
37
|
+
const v = inMaxMin(state.min, state.max, isAdd ? add(Number(exchangeNumber(state.value)), state.stepValue) : subtract(Number(exchangeNumber(state.value)), state.stepValue))
|
|
38
|
+
state.value = localeNumber(v, 1)
|
|
39
|
+
props.onValueChange && props.onValueChange(v)
|
|
40
|
+
}, [])
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
const handleChangeText = useCallback((v: string) => {
|
|
44
|
+
const newValue = exchangeNumber(v)
|
|
45
|
+
const idx = newValue.indexOf('.')
|
|
46
|
+
if (newValue[0] === '.' ||
|
|
47
|
+
(newValue.length === 2 && newValue[0] === '0' && newValue[1] !== '.') ||
|
|
48
|
+
newValue.split('').filter(item => item === '.').length > 1 ||
|
|
49
|
+
(!props.isBeyond && (Number(newValue) > state.max || Number(newValue) < state.min)) ||
|
|
50
|
+
(idx !== -1 && newValue.length > idx + 2)) {
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
if (props.isRealTime) {
|
|
54
|
+
if (typeof v === 'string' && !v.length) {
|
|
55
|
+
props.onValueChange && props.onValueChange(0)
|
|
56
|
+
} else {
|
|
57
|
+
props.onValueChange && props.onValueChange(Number(exchangeNumber(v)))
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
state.value = v
|
|
61
|
+
}, [])
|
|
62
|
+
|
|
63
|
+
const handleEndText = useCallback(() => {
|
|
64
|
+
if (typeof state.value === 'string' && !state.value.length) {
|
|
65
|
+
props.onValueChange && props.onValueChange(state.min)
|
|
66
|
+
state.value = state.min.toString()
|
|
67
|
+
} else {
|
|
68
|
+
props.onValueChange && props.onValueChange(Number(exchangeNumber(state.value)))
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
}, [])
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<View style={[styles.stepperContainer, props.style]}>
|
|
75
|
+
<TouchableOpacity
|
|
76
|
+
style={[styles.stepperButton, props.buttonStyle]}
|
|
77
|
+
onPress={() => handlePress(false)}
|
|
78
|
+
>
|
|
79
|
+
<Image width={cx(16)} height={cx(16)} source={res.ic_minus} />
|
|
80
|
+
</TouchableOpacity>
|
|
81
|
+
<TextInput
|
|
82
|
+
style={[styles.stepperInput, props.inputStyle]}
|
|
83
|
+
value={state.value.toString()}
|
|
84
|
+
keyboardType="numeric"
|
|
85
|
+
onChangeText={handleChangeText}
|
|
86
|
+
maxLength={4}
|
|
87
|
+
enablesReturnKeyAutomatically={true}
|
|
88
|
+
onEndEditing={handleEndText}
|
|
89
|
+
editable={props.editable || props.disabled}
|
|
90
|
+
/>
|
|
91
|
+
<TouchableOpacity
|
|
92
|
+
style={[styles.stepperButton, props.buttonStyle]}
|
|
93
|
+
onPress={() => handlePress(true)}
|
|
94
|
+
>
|
|
95
|
+
<Image style={{ width: cx(20), height: cx(20) }} source={res.ic_plus} />
|
|
96
|
+
</TouchableOpacity>
|
|
97
|
+
</View>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const styles = StyleSheet.create({
|
|
102
|
+
stepperContainer: {
|
|
103
|
+
flexDirection: 'row',
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
backgroundColor: '#f5f5f5',
|
|
106
|
+
padding: cx(2),
|
|
107
|
+
borderRadius: cx(12),
|
|
108
|
+
width: cx(150),
|
|
109
|
+
},
|
|
110
|
+
stepperButton: {
|
|
111
|
+
width: cx(52),
|
|
112
|
+
height: cx(28),
|
|
113
|
+
backgroundColor: '#fff',
|
|
114
|
+
borderRadius: cx(10),
|
|
115
|
+
alignItems: 'center',
|
|
116
|
+
justifyContent: 'center',
|
|
117
|
+
},
|
|
118
|
+
stepperInput: {
|
|
119
|
+
width: cx(42),
|
|
120
|
+
height: cx(22),
|
|
121
|
+
color: '#333',
|
|
122
|
+
fontSize: cx(16),
|
|
123
|
+
padding: 0,
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
justifyContent: 'center',
|
|
126
|
+
textAlign: 'center',
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
export default memo(Stepper)
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ColorAdjustViewProps } from "@ledvance/base/src/components/ColorAdjustView";
|
|
2
|
-
import { ColorTempAdjustViewProps } from "@ledvance/base/src/components/ColorTempAdjustView";
|
|
3
|
-
declare type TabsNode = {
|
|
4
|
-
key: number | string;
|
|
5
|
-
title: string;
|
|
6
|
-
};
|
|
7
|
-
interface StripAdjustViewProps extends ColorAdjustViewProps, ColorTempAdjustViewProps {
|
|
8
|
-
lampTabs: TabsNode[];
|
|
9
|
-
activeKey: number | string;
|
|
10
|
-
onActiveKeyChange: (key: number | string) => void;
|
|
11
|
-
colorDiskActiveKey?: number | undefined;
|
|
12
|
-
onColorDiskChange?: (color: string[], idx: number) => void;
|
|
13
|
-
}
|
|
14
|
-
declare const StripAdjustView: (props: StripAdjustViewProps) => JSX.Element;
|
|
15
|
-
export default StripAdjustView;
|
|
16
|
-
export declare const ColorList: string[][];
|
|
1
|
+
import { ColorAdjustViewProps } from "@ledvance/base/src/components/ColorAdjustView";
|
|
2
|
+
import { ColorTempAdjustViewProps } from "@ledvance/base/src/components/ColorTempAdjustView";
|
|
3
|
+
declare type TabsNode = {
|
|
4
|
+
key: number | string;
|
|
5
|
+
title: string;
|
|
6
|
+
};
|
|
7
|
+
interface StripAdjustViewProps extends ColorAdjustViewProps, ColorTempAdjustViewProps {
|
|
8
|
+
lampTabs: TabsNode[];
|
|
9
|
+
activeKey: number | string;
|
|
10
|
+
onActiveKeyChange: (key: number | string) => void;
|
|
11
|
+
colorDiskActiveKey?: number | undefined;
|
|
12
|
+
onColorDiskChange?: (color: string[], idx: number) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const StripAdjustView: (props: StripAdjustViewProps) => JSX.Element;
|
|
15
|
+
export default StripAdjustView;
|
|
16
|
+
export declare const ColorList: string[][];
|
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { FlatList, TouchableOpacity, View, Image } from "react-native";
|
|
3
|
-
import ColorAdjustView, { ColorAdjustViewProps } from "@ledvance/base/src/components/ColorAdjustView";
|
|
4
|
-
import ColorTempAdjustView, { ColorTempAdjustViewProps } from "@ledvance/base/src/components/ColorTempAdjustView";
|
|
5
|
-
import Spacer from "@ledvance/base/src/components/Spacer";
|
|
6
|
-
import { TabBar, Utils } from "tuya-panel-kit";
|
|
7
|
-
import { ColorDisk } from "@tuya/tuya-panel-lamp-sdk";
|
|
8
|
-
import res from "@ledvance/base/src/res";
|
|
9
|
-
const { convertX: cx } = Utils.RatioUtils
|
|
10
|
-
|
|
11
|
-
type TabsNode = {
|
|
12
|
-
key: number | string
|
|
13
|
-
title: string
|
|
14
|
-
}
|
|
15
|
-
interface StripAdjustViewProps extends ColorAdjustViewProps, ColorTempAdjustViewProps {
|
|
16
|
-
lampTabs: TabsNode[]
|
|
17
|
-
activeKey: number | string
|
|
18
|
-
onActiveKeyChange: (key: number | string) => void
|
|
19
|
-
colorDiskActiveKey? : number | undefined
|
|
20
|
-
onColorDiskChange?: (color: string[], idx: number) => void
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const StripAdjustView = (props: StripAdjustViewProps) => {
|
|
24
|
-
return (
|
|
25
|
-
<View>
|
|
26
|
-
<TabBar
|
|
27
|
-
type='radio'
|
|
28
|
-
tabs={props.lampTabs}
|
|
29
|
-
style={{ borderRadius: cx(8), backgroundColor: '#f6f6f6', height: cx(40), marginHorizontal: cx(16) }}
|
|
30
|
-
tabTextStyle={{ color: '#000' }}
|
|
31
|
-
tabActiveTextStyle={{ color: '#000', fontWeight: 'bold' }}
|
|
32
|
-
activeKey={props.activeKey}
|
|
33
|
-
onChange={props.onActiveKeyChange}
|
|
34
|
-
/>
|
|
35
|
-
{
|
|
36
|
-
props.activeKey === 1 &&
|
|
37
|
-
<>
|
|
38
|
-
<Spacer height={cx(10)} />
|
|
39
|
-
<ColorAdjustView
|
|
40
|
-
h={props.h}
|
|
41
|
-
s={props.s}
|
|
42
|
-
v={props.v}
|
|
43
|
-
minSaturation={1}
|
|
44
|
-
reserveSV={true}
|
|
45
|
-
onHSVChange={props.onHSVChange}
|
|
46
|
-
onHSVChangeComplete={props.onHSVChangeComplete} />
|
|
47
|
-
<Spacer />
|
|
48
|
-
</>
|
|
49
|
-
}
|
|
50
|
-
{
|
|
51
|
-
props.activeKey === 0 &&
|
|
52
|
-
<>
|
|
53
|
-
<Spacer height={cx(10)} />
|
|
54
|
-
<ColorTempAdjustView
|
|
55
|
-
minBrightness={1}
|
|
56
|
-
isSupportTemperature={props.isSupportTemperature}
|
|
57
|
-
isSupportBrightness={props.isSupportBrightness}
|
|
58
|
-
colorTemp={props.colorTemp}
|
|
59
|
-
brightness={props.brightness}
|
|
60
|
-
onCCTChange={props.onCCTChange}
|
|
61
|
-
onCCTChangeComplete={props.onCCTChangeComplete}
|
|
62
|
-
onBrightnessChange={props.onBrightnessChange}
|
|
63
|
-
onBrightnessChangeComplete={props.onBrightnessChangeComplete} />
|
|
64
|
-
<Spacer />
|
|
65
|
-
</>
|
|
66
|
-
}
|
|
67
|
-
{
|
|
68
|
-
props.activeKey === 3 &&
|
|
69
|
-
<FlatList
|
|
70
|
-
numColumns={6}
|
|
71
|
-
style={{
|
|
72
|
-
marginHorizontal: cx(16),
|
|
73
|
-
}}
|
|
74
|
-
data={ColorList}
|
|
75
|
-
renderItem={({ item, index }) => {
|
|
76
|
-
return (
|
|
77
|
-
<TouchableOpacity
|
|
78
|
-
onPress={() => {
|
|
79
|
-
props.onColorDiskChange && props.onColorDiskChange(item, index)
|
|
80
|
-
}}
|
|
81
|
-
style={{
|
|
82
|
-
width: '16.66%', alignItems: 'center',
|
|
83
|
-
justifyContent: 'center',
|
|
84
|
-
}}>
|
|
85
|
-
<ColorDisk
|
|
86
|
-
radius={cx(20)}
|
|
87
|
-
colors={item}
|
|
88
|
-
/>
|
|
89
|
-
{props.colorDiskActiveKey === index && <View style={{ width: cx(44), height: cx(44), borderRadius: cx(44), borderColor: '#f60', borderWidth: cx(2), alignItems: 'center', justifyContent: 'center', position: 'absolute' }}>
|
|
90
|
-
<Image source={{ uri: res.ic_check }} style={{ width: cx(40), height: cx(40), tintColor: '#fff' }} />
|
|
91
|
-
</View>}
|
|
92
|
-
</TouchableOpacity>
|
|
93
|
-
)
|
|
94
|
-
}}
|
|
95
|
-
ListHeaderComponent={() => <Spacer height={cx(10)} />}
|
|
96
|
-
ItemSeparatorComponent={() => <Spacer height={cx(10)} />}
|
|
97
|
-
ListFooterComponent={() => <Spacer height={cx(10)} />}
|
|
98
|
-
keyExtractor={(_, idx) => idx.toString()}
|
|
99
|
-
/>
|
|
100
|
-
}
|
|
101
|
-
</View>
|
|
102
|
-
)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export default StripAdjustView
|
|
106
|
-
|
|
107
|
-
export const ColorList = [
|
|
108
|
-
['#F4A4BF', '#F65997','#F5075A','#F52071'],
|
|
109
|
-
['#E393FE','#E294FE','#94E3FC','#A7C5FF'],
|
|
110
|
-
['#2661FC', '#4D21B2','#F5085A','#FDFB42'],
|
|
111
|
-
['#F66252','#F9B241', '#41C6FC','#E5EF66'],
|
|
112
|
-
['#CBF0FF','#94E3FC','#41C6FC','#52D6FB'],
|
|
113
|
-
['#76BC41','#95D35F','#F1F6B6','#B2DD8D'],
|
|
114
|
-
['#76BC41','#D9EC39','#F66B05','#F9AB03'],
|
|
115
|
-
['#F54019','#F66B05','#76BC41','#F9AA04'],
|
|
116
|
-
['#4D21B2','#2661FC','#FDF76C','#BD39F4'],
|
|
117
|
-
['#B18DFD','#8550FB','#4D21B2','#5E30E9'],
|
|
118
|
-
['#F9AB03','#F9B241','#FCD9A7','#FAC678'],
|
|
119
|
-
['#F9AC02','#41C6FC','#F54019','#5E30E9'],
|
|
120
|
-
['#B2DD8D','#52D6FB','#8550FB','#41C6FC'],
|
|
121
|
-
['#9A2ABD','#F65997','#F5085A','#F66B05','#FDFB42'],
|
|
122
|
-
['#4D21B2','#5E30E9','#8550FB','#B18DFD','#D9C9FF'],
|
|
123
|
-
['#F77370','#F65250','#F53B3C','#F52929','#F50204'],
|
|
124
|
-
['#2660FC','#76A7FE','#FAC678','#F9AB03','#F66B05'],
|
|
125
|
-
['#E294FE','#FDF76C','#95D35F','#52D6FB','#B18DFD'],
|
|
126
|
-
['#3B88FD','#5E30E9','#F50821','#F66B05','#F9AB03'],
|
|
127
|
-
['#76BC41','#95D35F','#B2DD8D','#D9EC39','#E8F291'],
|
|
128
|
-
['#52D6FB','#F9B241','#F66B05','#D356FC','#9A2ABD'],
|
|
129
|
-
['#F9AEC7','#F88ABA','#F65590','#F65C79','#F64A49', '#F50803'],
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FlatList, TouchableOpacity, View, Image } from "react-native";
|
|
3
|
+
import ColorAdjustView, { ColorAdjustViewProps } from "@ledvance/base/src/components/ColorAdjustView";
|
|
4
|
+
import ColorTempAdjustView, { ColorTempAdjustViewProps } from "@ledvance/base/src/components/ColorTempAdjustView";
|
|
5
|
+
import Spacer from "@ledvance/base/src/components/Spacer";
|
|
6
|
+
import { TabBar, Utils } from "tuya-panel-kit";
|
|
7
|
+
import { ColorDisk } from "@tuya/tuya-panel-lamp-sdk";
|
|
8
|
+
import res from "@ledvance/base/src/res";
|
|
9
|
+
const { convertX: cx } = Utils.RatioUtils
|
|
10
|
+
|
|
11
|
+
type TabsNode = {
|
|
12
|
+
key: number | string
|
|
13
|
+
title: string
|
|
14
|
+
}
|
|
15
|
+
interface StripAdjustViewProps extends ColorAdjustViewProps, ColorTempAdjustViewProps {
|
|
16
|
+
lampTabs: TabsNode[]
|
|
17
|
+
activeKey: number | string
|
|
18
|
+
onActiveKeyChange: (key: number | string) => void
|
|
19
|
+
colorDiskActiveKey? : number | undefined
|
|
20
|
+
onColorDiskChange?: (color: string[], idx: number) => void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const StripAdjustView = (props: StripAdjustViewProps) => {
|
|
24
|
+
return (
|
|
25
|
+
<View>
|
|
26
|
+
<TabBar
|
|
27
|
+
type='radio'
|
|
28
|
+
tabs={props.lampTabs}
|
|
29
|
+
style={{ borderRadius: cx(8), backgroundColor: '#f6f6f6', height: cx(40), marginHorizontal: cx(16) }}
|
|
30
|
+
tabTextStyle={{ color: '#000' }}
|
|
31
|
+
tabActiveTextStyle={{ color: '#000', fontWeight: 'bold' }}
|
|
32
|
+
activeKey={props.activeKey}
|
|
33
|
+
onChange={props.onActiveKeyChange}
|
|
34
|
+
/>
|
|
35
|
+
{
|
|
36
|
+
props.activeKey === 1 &&
|
|
37
|
+
<>
|
|
38
|
+
<Spacer height={cx(10)} />
|
|
39
|
+
<ColorAdjustView
|
|
40
|
+
h={props.h}
|
|
41
|
+
s={props.s}
|
|
42
|
+
v={props.v}
|
|
43
|
+
minSaturation={1}
|
|
44
|
+
reserveSV={true}
|
|
45
|
+
onHSVChange={props.onHSVChange}
|
|
46
|
+
onHSVChangeComplete={props.onHSVChangeComplete} />
|
|
47
|
+
<Spacer />
|
|
48
|
+
</>
|
|
49
|
+
}
|
|
50
|
+
{
|
|
51
|
+
props.activeKey === 0 &&
|
|
52
|
+
<>
|
|
53
|
+
<Spacer height={cx(10)} />
|
|
54
|
+
<ColorTempAdjustView
|
|
55
|
+
minBrightness={1}
|
|
56
|
+
isSupportTemperature={props.isSupportTemperature}
|
|
57
|
+
isSupportBrightness={props.isSupportBrightness}
|
|
58
|
+
colorTemp={props.colorTemp}
|
|
59
|
+
brightness={props.brightness}
|
|
60
|
+
onCCTChange={props.onCCTChange}
|
|
61
|
+
onCCTChangeComplete={props.onCCTChangeComplete}
|
|
62
|
+
onBrightnessChange={props.onBrightnessChange}
|
|
63
|
+
onBrightnessChangeComplete={props.onBrightnessChangeComplete} />
|
|
64
|
+
<Spacer />
|
|
65
|
+
</>
|
|
66
|
+
}
|
|
67
|
+
{
|
|
68
|
+
props.activeKey === 3 &&
|
|
69
|
+
<FlatList
|
|
70
|
+
numColumns={6}
|
|
71
|
+
style={{
|
|
72
|
+
marginHorizontal: cx(16),
|
|
73
|
+
}}
|
|
74
|
+
data={ColorList}
|
|
75
|
+
renderItem={({ item, index }) => {
|
|
76
|
+
return (
|
|
77
|
+
<TouchableOpacity
|
|
78
|
+
onPress={() => {
|
|
79
|
+
props.onColorDiskChange && props.onColorDiskChange(item, index)
|
|
80
|
+
}}
|
|
81
|
+
style={{
|
|
82
|
+
width: '16.66%', alignItems: 'center',
|
|
83
|
+
justifyContent: 'center',
|
|
84
|
+
}}>
|
|
85
|
+
<ColorDisk
|
|
86
|
+
radius={cx(20)}
|
|
87
|
+
colors={item}
|
|
88
|
+
/>
|
|
89
|
+
{props.colorDiskActiveKey === index && <View style={{ width: cx(44), height: cx(44), borderRadius: cx(44), borderColor: '#f60', borderWidth: cx(2), alignItems: 'center', justifyContent: 'center', position: 'absolute' }}>
|
|
90
|
+
<Image source={{ uri: res.ic_check }} style={{ width: cx(40), height: cx(40), tintColor: '#fff' }} />
|
|
91
|
+
</View>}
|
|
92
|
+
</TouchableOpacity>
|
|
93
|
+
)
|
|
94
|
+
}}
|
|
95
|
+
ListHeaderComponent={() => <Spacer height={cx(10)} />}
|
|
96
|
+
ItemSeparatorComponent={() => <Spacer height={cx(10)} />}
|
|
97
|
+
ListFooterComponent={() => <Spacer height={cx(10)} />}
|
|
98
|
+
keyExtractor={(_, idx) => idx.toString()}
|
|
99
|
+
/>
|
|
100
|
+
}
|
|
101
|
+
</View>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export default StripAdjustView
|
|
106
|
+
|
|
107
|
+
export const ColorList = [
|
|
108
|
+
['#F4A4BF', '#F65997','#F5075A','#F52071'],
|
|
109
|
+
['#E393FE','#E294FE','#94E3FC','#A7C5FF'],
|
|
110
|
+
['#2661FC', '#4D21B2','#F5085A','#FDFB42'],
|
|
111
|
+
['#F66252','#F9B241', '#41C6FC','#E5EF66'],
|
|
112
|
+
['#CBF0FF','#94E3FC','#41C6FC','#52D6FB'],
|
|
113
|
+
['#76BC41','#95D35F','#F1F6B6','#B2DD8D'],
|
|
114
|
+
['#76BC41','#D9EC39','#F66B05','#F9AB03'],
|
|
115
|
+
['#F54019','#F66B05','#76BC41','#F9AA04'],
|
|
116
|
+
['#4D21B2','#2661FC','#FDF76C','#BD39F4'],
|
|
117
|
+
['#B18DFD','#8550FB','#4D21B2','#5E30E9'],
|
|
118
|
+
['#F9AB03','#F9B241','#FCD9A7','#FAC678'],
|
|
119
|
+
['#F9AC02','#41C6FC','#F54019','#5E30E9'],
|
|
120
|
+
['#B2DD8D','#52D6FB','#8550FB','#41C6FC'],
|
|
121
|
+
['#9A2ABD','#F65997','#F5085A','#F66B05','#FDFB42'],
|
|
122
|
+
['#4D21B2','#5E30E9','#8550FB','#B18DFD','#D9C9FF'],
|
|
123
|
+
['#F77370','#F65250','#F53B3C','#F52929','#F50204'],
|
|
124
|
+
['#2660FC','#76A7FE','#FAC678','#F9AB03','#F66B05'],
|
|
125
|
+
['#E294FE','#FDF76C','#95D35F','#52D6FB','#B18DFD'],
|
|
126
|
+
['#3B88FD','#5E30E9','#F50821','#F66B05','#F9AB03'],
|
|
127
|
+
['#76BC41','#95D35F','#B2DD8D','#D9EC39','#E8F291'],
|
|
128
|
+
['#52D6FB','#F9B241','#F66B05','#D356FC','#9A2ABD'],
|
|
129
|
+
['#F9AEC7','#F88ABA','#F65590','#F65C79','#F64A49', '#F50803'],
|
|
130
130
|
]
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ViewProps } from 'react-native';
|
|
2
|
-
export interface LightNode {
|
|
3
|
-
color: string;
|
|
4
|
-
backgroundColor?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface StripLightViewProps extends ViewProps {
|
|
7
|
-
nodes: LightNode[];
|
|
8
|
-
fixCount: number;
|
|
9
|
-
stripStyle: 'ONLY_LINE' | 'WITH_BEAD';
|
|
10
|
-
touchingMode?: 'CLICK' | 'TOUCH';
|
|
11
|
-
width: number;
|
|
12
|
-
}
|
|
13
|
-
declare const StripLightView: (props: StripLightViewProps) => JSX.Element;
|
|
14
|
-
export default StripLightView;
|
|
1
|
+
import { ViewProps } from 'react-native';
|
|
2
|
+
export interface LightNode {
|
|
3
|
+
color: string;
|
|
4
|
+
backgroundColor?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface StripLightViewProps extends ViewProps {
|
|
7
|
+
nodes: LightNode[];
|
|
8
|
+
fixCount: number;
|
|
9
|
+
stripStyle: 'ONLY_LINE' | 'WITH_BEAD';
|
|
10
|
+
touchingMode?: 'CLICK' | 'TOUCH';
|
|
11
|
+
width: number;
|
|
12
|
+
}
|
|
13
|
+
declare const StripLightView: (props: StripLightViewProps) => JSX.Element;
|
|
14
|
+
export default StripLightView;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { requireNativeComponent, ViewProps } from 'react-native'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
const NativeStripLightView = requireNativeComponent('StripLightView')
|
|
5
|
-
|
|
6
|
-
export interface LightNode {
|
|
7
|
-
color: string
|
|
8
|
-
backgroundColor?: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface StripLightViewProps extends ViewProps {
|
|
12
|
-
nodes: LightNode[]
|
|
13
|
-
fixCount: number
|
|
14
|
-
stripStyle: 'ONLY_LINE' | 'WITH_BEAD'
|
|
15
|
-
touchingMode?: 'CLICK' | 'TOUCH'
|
|
16
|
-
width: number
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const StripLightView = (props: StripLightViewProps) => {
|
|
20
|
-
return (
|
|
21
|
-
<NativeStripLightView {...props} nodes={JSON.stringify(props.nodes)}/>
|
|
22
|
-
)
|
|
23
|
-
}
|
|
24
|
-
|
|
1
|
+
import { requireNativeComponent, ViewProps } from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
const NativeStripLightView = requireNativeComponent('StripLightView')
|
|
5
|
+
|
|
6
|
+
export interface LightNode {
|
|
7
|
+
color: string
|
|
8
|
+
backgroundColor?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface StripLightViewProps extends ViewProps {
|
|
12
|
+
nodes: LightNode[]
|
|
13
|
+
fixCount: number
|
|
14
|
+
stripStyle: 'ONLY_LINE' | 'WITH_BEAD'
|
|
15
|
+
touchingMode?: 'CLICK' | 'TOUCH'
|
|
16
|
+
width: number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const StripLightView = (props: StripLightViewProps) => {
|
|
20
|
+
return (
|
|
21
|
+
<NativeStripLightView {...props} nodes={JSON.stringify(props.nodes)}/>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
25
|
export default StripLightView
|