@ledvance/base 1.3.87 → 1.3.89
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/localazy.json +7 -1
- package/package.json +1 -1
- package/src/components/LdvPickerView.tsx +151 -0
- package/src/i18n/strings.ts +515 -347
- package/src/models/TuyaApi.ts +65 -3
- package/translateKey.txt +7 -1
- package/tsconfig.json +72 -46
- package/src/api/native.d.ts +0 -71
- package/src/api/nativeEventEmitter.d.ts +0 -3
- package/src/components/AdvanceCard.d.ts +0 -25
- package/src/components/AdvanceList.d.ts +0 -9
- package/src/components/ApplyForDeviceItem.d.ts +0 -6
- package/src/components/ApplyForDeviceList.d.ts +0 -7
- package/src/components/ApplyForText.d.ts +0 -6
- package/src/components/Card.d.ts +0 -10
- package/src/components/Cell.d.ts +0 -21
- package/src/components/CircularProgress.d.ts +0 -8
- package/src/components/ColorAdjustView.d.ts +0 -12
- package/src/components/ColorExtractor.d.ts +0 -73
- package/src/components/ColorTempAdjustView.d.ts +0 -13
- package/src/components/ColorsLine.d.ts +0 -7
- package/src/components/CustomListDialog.d.ts +0 -15
- package/src/components/DeleteButton.d.ts +0 -10
- package/src/components/Dialog.d.ts +0 -10
- package/src/components/DrawToolView.d.ts +0 -46
- package/src/components/FanAdjustView.d.ts +0 -23
- package/src/components/InfoText.d.ts +0 -11
- package/src/components/LampAdjustView.d.ts +0 -10
- package/src/components/LampAdjustView2.d.ts +0 -24
- package/src/components/LinearGradientLine.d.ts +0 -9
- package/src/components/MoodColorsLine.d.ts +0 -9
- package/src/components/Page.d.ts +0 -21
- package/src/components/Popup.d.ts +0 -7
- package/src/components/Segmented.d.ts +0 -14
- package/src/components/SocketItem.d.ts +0 -13
- package/src/components/Spacer.d.ts +0 -7
- package/src/components/Stepper.d.ts +0 -19
- package/src/components/StripAdjustView.d.ts +0 -16
- package/src/components/StripLightView.d.ts +0 -14
- package/src/components/Tag.d.ts +0 -8
- package/src/components/TextButton.d.ts +0 -9
- package/src/components/TextField.d.ts +0 -9
- package/src/components/TextFieldStyleButton.d.ts +0 -8
- package/src/components/UATabTitle.d.ts +0 -6
- package/src/components/UATabs.d.ts +0 -12
- package/src/components/connect.d.ts +0 -10
- package/src/components/ldvColorBrightness.d.ts +0 -1
- package/src/components/ldvColorSlider.d.ts +0 -14
- package/src/components/ldvItemView.d.ts +0 -12
- package/src/components/ldvPickerView.d.ts +0 -13
- package/src/components/ldvPickerView.tsx +0 -105
- package/src/components/ldvPresetView.d.ts +0 -2
- package/src/components/ldvSaturation.d.ts +0 -2
- package/src/components/ldvSlider.d.ts +0 -15
- package/src/components/ldvSwitch.d.ts +0 -10
- package/src/components/ldvTemperatureSlider.d.ts +0 -13
- package/src/components/ldvTopBar.d.ts +0 -10
- package/src/components/ldvTopName.d.ts +0 -9
- package/src/components/segmentControl.d.ts +0 -1
- package/src/components/weekSelect.d.ts +0 -7
- package/src/composeLayout.d.ts +0 -30
- package/src/hooks/Hooks.d.ts +0 -2
- package/src/i18n/index.d.ts +0 -16
- package/src/i18n/strings.d.ts +0 -15953
- package/src/models/GlobalParams.d.ts +0 -14
- package/src/models/TuyaApi.d.ts +0 -29
- package/src/models/combine.d.ts +0 -26
- package/src/models/configureStore.d.ts +0 -9
- package/src/models/index.d.ts +0 -31
- package/src/models/modules/NativePropsSlice.d.ts +0 -61
- package/src/models/modules/Result.d.ts +0 -14
- package/src/models/modules/common.d.ts +0 -44
- package/src/res/index.d.ts +0 -70
- package/src/utils/ColorParser.d.ts +0 -66
- package/src/utils/ColorUtils.d.ts +0 -71
- package/src/utils/Support.d.ts +0 -13
- package/src/utils/TypeUtils.d.ts +0 -3
- package/src/utils/cctUtils.d.ts +0 -1
- package/src/utils/common.d.ts +0 -35
- package/src/utils/index.d.ts +0 -26
- package/src/utils/interface.d.ts +0 -6
- package/src/utils/loopsCompare.d.ts +0 -1
package/localazy.json
CHANGED
|
@@ -1230,7 +1230,13 @@
|
|
|
1230
1230
|
"MATCH:repeater_select_other_router",
|
|
1231
1231
|
"MATCH:repeater_password_error_length",
|
|
1232
1232
|
"MATCH:repeater_password_error_space",
|
|
1233
|
-
"MATCH:cancel_dialog_leave_unsaved_repeater_note"
|
|
1233
|
+
"MATCH:cancel_dialog_leave_unsaved_repeater_note",
|
|
1234
|
+
"MATCH:chartdisplay_energy",
|
|
1235
|
+
"MATCH:chartdisplay_power",
|
|
1236
|
+
"MATCH:charttime_type1",
|
|
1237
|
+
"MATCH:charttime_type2",
|
|
1238
|
+
"MATCH:charttime_type3",
|
|
1239
|
+
"MATCH:charttime_type4"
|
|
1234
1240
|
],
|
|
1235
1241
|
"replacements": {
|
|
1236
1242
|
"REGEX:% %1\\$s.*?\\)%": "{0}",
|
package/package.json
CHANGED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useState } 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
|
+
import ThemeType from '../config/themeType'
|
|
6
|
+
|
|
7
|
+
const { convertX } = Utils.RatioUtils
|
|
8
|
+
const { withTheme } = Utils.ThemeUtils
|
|
9
|
+
|
|
10
|
+
const pickerTheme = {
|
|
11
|
+
fontSize: 20,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface LdvPickerViewProps {
|
|
15
|
+
theme?: ThemeType
|
|
16
|
+
hour: string,
|
|
17
|
+
minute: string,
|
|
18
|
+
setHour: (hour: string) => void,
|
|
19
|
+
setMinute: (minute: string) => void,
|
|
20
|
+
style?: StyleProp<ViewStyle> | undefined,
|
|
21
|
+
unit?: string[]
|
|
22
|
+
minutesStep?: number
|
|
23
|
+
minMinute?: number
|
|
24
|
+
maxMinute?: number // 不包含关系
|
|
25
|
+
minHour?: number
|
|
26
|
+
maxHour?: number // 不包含关系
|
|
27
|
+
hourLoop?: boolean
|
|
28
|
+
minuteLoop?: boolean
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const LdvPickerView = (props: LdvPickerViewProps) => {
|
|
32
|
+
|
|
33
|
+
const {
|
|
34
|
+
hour,
|
|
35
|
+
minute,
|
|
36
|
+
unit,
|
|
37
|
+
setHour,
|
|
38
|
+
setMinute,
|
|
39
|
+
minutesStep = 1,
|
|
40
|
+
minHour = 0,
|
|
41
|
+
maxHour = 24,
|
|
42
|
+
minMinute = 0,
|
|
43
|
+
maxMinute = 60,
|
|
44
|
+
hourLoop = true,
|
|
45
|
+
minuteLoop = true,
|
|
46
|
+
} = props
|
|
47
|
+
|
|
48
|
+
const hours = useMemo(() => _.times(maxHour)
|
|
49
|
+
.filter(it => it >= minHour)
|
|
50
|
+
.map(it => _.padStart(it.toString(), 2, '0')),
|
|
51
|
+
[minHour, maxHour])
|
|
52
|
+
const minutes = useMemo(() => _.times(maxMinute / minutesStep)
|
|
53
|
+
.filter(it => it >= minMinute)
|
|
54
|
+
.map(it => _.padStart(it.toString(), 2, '0')),
|
|
55
|
+
[minMinute, maxMinute, minutesStep])
|
|
56
|
+
|
|
57
|
+
const [innerMinute, setInnerMinute] = useState(minute)
|
|
58
|
+
const [innerHour, setInnerHour] = useState(hour)
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
setInnerHour(hour)
|
|
62
|
+
}, [hour])
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
setInnerMinute(minute)
|
|
66
|
+
}, [minute])
|
|
67
|
+
|
|
68
|
+
const styles = StyleSheet.create({
|
|
69
|
+
pickerContainer: {
|
|
70
|
+
flexDirection: 'row',
|
|
71
|
+
alignItems: 'center',
|
|
72
|
+
},
|
|
73
|
+
picker: {
|
|
74
|
+
flex: 1,
|
|
75
|
+
backgroundColor: props.theme?.card.background,
|
|
76
|
+
},
|
|
77
|
+
pickerLeft: {},
|
|
78
|
+
pickerItem: {},
|
|
79
|
+
picContainer: {
|
|
80
|
+
flex: 1,
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
flexDirection: 'row',
|
|
83
|
+
},
|
|
84
|
+
pickerUnit: {
|
|
85
|
+
position: 'absolute',
|
|
86
|
+
right: convertX(20),
|
|
87
|
+
top: '44%',
|
|
88
|
+
},
|
|
89
|
+
})
|
|
90
|
+
return (
|
|
91
|
+
<View key={props.theme?.type} style={[styles.pickerContainer, props.style]}>
|
|
92
|
+
<View style={styles.picContainer}>
|
|
93
|
+
<Picker
|
|
94
|
+
accessibilityLabel={'HourPicker'}
|
|
95
|
+
accessibilityHint={hour}
|
|
96
|
+
itemTextColor="#aeadb5"
|
|
97
|
+
style={[styles.picker, styles.pickerLeft]}
|
|
98
|
+
loop={hourLoop}
|
|
99
|
+
theme={pickerTheme}
|
|
100
|
+
itemStyle={styles.pickerItem}
|
|
101
|
+
textSize={convertX(14)}
|
|
102
|
+
selectedValue={innerHour}
|
|
103
|
+
itemAlign={'center'}
|
|
104
|
+
onValueChange={value => {
|
|
105
|
+
const newValue = Math.min(Math.max(Number(value), minHour), maxHour - 1).toString().padStart(2, '0')
|
|
106
|
+
setInnerHour(newValue)
|
|
107
|
+
setHour(newValue)
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
{hours.map((value) => (
|
|
111
|
+
<Picker.Item key={value} value={value} label={value}/>
|
|
112
|
+
))}
|
|
113
|
+
</Picker>
|
|
114
|
+
{unit ? <View style={styles.pickerUnit}>
|
|
115
|
+
<Text style={{ color: props.theme?.global.fontColor, fontSize: convertX(18) }}>
|
|
116
|
+
{unit[0]}
|
|
117
|
+
</Text>
|
|
118
|
+
</View> : null}
|
|
119
|
+
</View>
|
|
120
|
+
<View style={styles.picContainer}>
|
|
121
|
+
<Picker
|
|
122
|
+
accessibilityLabel={'MinutePicker'}
|
|
123
|
+
accessibilityHint={minute}
|
|
124
|
+
itemTextColor="#aeadb5"
|
|
125
|
+
style={[styles.picker, styles.pickerLeft]}
|
|
126
|
+
loop={minuteLoop}
|
|
127
|
+
theme={pickerTheme}
|
|
128
|
+
itemStyle={styles.pickerItem}
|
|
129
|
+
textSize={convertX(14)}
|
|
130
|
+
selectedValue={innerMinute}
|
|
131
|
+
onValueChange={value => {
|
|
132
|
+
const newValue = Math.min(Math.max(Number(value), minMinute), maxMinute - 1).toString().padStart(2, '0')
|
|
133
|
+
setInnerMinute(newValue)
|
|
134
|
+
setMinute(newValue)
|
|
135
|
+
}}
|
|
136
|
+
>
|
|
137
|
+
{minutes.map((value) => (
|
|
138
|
+
<Picker.Item key={value} value={value} label={value}/>
|
|
139
|
+
))}
|
|
140
|
+
</Picker>
|
|
141
|
+
{unit ? <View style={styles.pickerUnit}>
|
|
142
|
+
<Text style={{ color: props.theme?.global.fontColor, fontSize: convertX(18) }}>
|
|
143
|
+
{unit[1]}
|
|
144
|
+
</Text>
|
|
145
|
+
</View> : null}
|
|
146
|
+
</View>
|
|
147
|
+
</View>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export default withTheme(LdvPickerView)
|