@ledvance/base 1.3.58 → 1.3.60
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 +4 -1
- package/package.json +1 -1
- package/src/components/BatteryPercentageView.tsx +1 -1
- package/src/components/HybridSwitchView.tsx +118 -0
- package/src/composeLayout.tsx +6 -4
- package/src/i18n/strings.ts +323 -239
- package/src/models/GlobalParams.ts +5 -7
- package/src/res/Biological_Rhythm.png +0 -0
- package/src/res/Biological_Rhythm_12.png +0 -0
- package/src/res/Biological_Rhythm_new.png +0 -0
- package/src/res/Biological_Rhythm_new_12.png +0 -0
- package/src/res/index.ts +5 -5
- package/src/utils/common.ts +5 -1
- package/translateKey.txt +4 -1
package/localazy.json
CHANGED
|
@@ -1188,7 +1188,10 @@
|
|
|
1188
1188
|
"MATCH:motion_detection_alarm_interval",
|
|
1189
1189
|
"MATCH:camera_operation_site_error",
|
|
1190
1190
|
"MATCH:camera_calibration",
|
|
1191
|
-
"MATCH:camera_calibration_desc"
|
|
1191
|
+
"MATCH:camera_calibration_desc",
|
|
1192
|
+
"MATCH:switchstate1selection",
|
|
1193
|
+
"MATCH:switchstate2selection",
|
|
1194
|
+
"MATCH:switchstate3selection"
|
|
1192
1195
|
],
|
|
1193
1196
|
"replacements": {
|
|
1194
1197
|
"REGEX:% %1\\$s.*?\\)%": "{0}",
|
package/package.json
CHANGED
|
@@ -67,7 +67,7 @@ const BatteryPercentageView = (props: BatteryProps) => {
|
|
|
67
67
|
theme={{batteryColor: props.theme?.global.secondFontColor || '#000'}}
|
|
68
68
|
/>
|
|
69
69
|
</View>
|
|
70
|
-
<Text style={[styles.content, value
|
|
70
|
+
<Text style={[styles.content, value <= middleValue ? styles.low : null]}>{value}%</Text>
|
|
71
71
|
</Card>
|
|
72
72
|
)
|
|
73
73
|
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { View, Text, TouchableOpacity, StyleSheet, StyleProp, ViewStyle, Platform } from 'react-native'
|
|
3
|
+
import { Utils } from 'tuya-panel-kit'
|
|
4
|
+
import LinearGradient from 'react-native-linear-gradient'
|
|
5
|
+
import Card from '@ledvance/base/src/components/Card'
|
|
6
|
+
import ThemeType from '@ledvance/base/src/config/themeType'
|
|
7
|
+
import Spacer from '@ledvance/base/src/components/Spacer'
|
|
8
|
+
|
|
9
|
+
const { convertX: cx } = Utils.RatioUtils
|
|
10
|
+
const { withTheme } = Utils.ThemeUtils
|
|
11
|
+
|
|
12
|
+
interface HybridSwitchViewProps {
|
|
13
|
+
theme?: ThemeType
|
|
14
|
+
style?: StyleProp<ViewStyle>
|
|
15
|
+
switchChannels: boolean[]
|
|
16
|
+
onSwitchChange?: (index: number, value: boolean) => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const HybridSwitchView = (props: HybridSwitchViewProps) => {
|
|
20
|
+
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
root: {
|
|
23
|
+
paddingHorizontal: cx(16),
|
|
24
|
+
},
|
|
25
|
+
switchPanelContainer: {
|
|
26
|
+
flex: 1,
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
},
|
|
30
|
+
switchPanelCardTitle: {
|
|
31
|
+
color: props.theme?.global.fontColor,
|
|
32
|
+
fontSize: cx(16),
|
|
33
|
+
fontWeight: 'bold',
|
|
34
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
35
|
+
},
|
|
36
|
+
switchPanel: {
|
|
37
|
+
width: cx(120),
|
|
38
|
+
height: cx(120),
|
|
39
|
+
borderRadius: cx(6),
|
|
40
|
+
justifyContent: 'center',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
borderWidth: cx(3),
|
|
43
|
+
borderColor: '#ECECEC',
|
|
44
|
+
overflow: 'hidden',
|
|
45
|
+
backgroundColor: '#F3F1F1',
|
|
46
|
+
},
|
|
47
|
+
container: {
|
|
48
|
+
width: cx(90),
|
|
49
|
+
height: cx(90),
|
|
50
|
+
flexDirection: 'row',
|
|
51
|
+
borderRadius: cx(6),
|
|
52
|
+
borderWidth: 1,
|
|
53
|
+
borderColor: '#B8B7B7',
|
|
54
|
+
overflow: 'hidden'
|
|
55
|
+
},
|
|
56
|
+
touchContainer: {
|
|
57
|
+
flex: 1,
|
|
58
|
+
borderRightWidth: 1,
|
|
59
|
+
borderColor: '#9E9E9E',
|
|
60
|
+
},
|
|
61
|
+
innerPanel: {
|
|
62
|
+
flex: 1,
|
|
63
|
+
backgroundColor: '#F8F8F8',
|
|
64
|
+
justifyContent: 'flex-end',
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
},
|
|
67
|
+
insertColor: {
|
|
68
|
+
width: '100%',
|
|
69
|
+
height: cx(10),
|
|
70
|
+
backgroundColor: '#FF6A00',
|
|
71
|
+
},
|
|
72
|
+
indicator: {
|
|
73
|
+
width: cx(20),
|
|
74
|
+
height: cx(2),
|
|
75
|
+
borderRadius: cx(1),
|
|
76
|
+
backgroundColor: '#F60',
|
|
77
|
+
marginBottom: cx(15),
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<Card style={[styles.root, props.style]}>
|
|
83
|
+
<Spacer width={cx(16)} />
|
|
84
|
+
<Text style={styles.switchPanelCardTitle}>Hybrid Switch</Text>
|
|
85
|
+
<Spacer />
|
|
86
|
+
<View style={styles.switchPanelContainer}>
|
|
87
|
+
<LinearGradient
|
|
88
|
+
colors={['#FFFFFF', '#F3F1F1']}
|
|
89
|
+
style={styles.switchPanel}
|
|
90
|
+
>
|
|
91
|
+
<View style={styles.container}>
|
|
92
|
+
{props.switchChannels.map((channel, index) => (
|
|
93
|
+
<TouchableOpacity
|
|
94
|
+
key={index}
|
|
95
|
+
activeOpacity={Platform.OS === 'ios' ? 0.5 : 0.9}
|
|
96
|
+
onPress={() => {
|
|
97
|
+
props.onSwitchChange?.(index, !channel)
|
|
98
|
+
}}
|
|
99
|
+
style={[styles.touchContainer, { borderRightWidth: index === props.switchChannels.length - 1 ? 0 : 1 }]}
|
|
100
|
+
>
|
|
101
|
+
<View style={styles.innerPanel}>
|
|
102
|
+
<View style={[styles.indicator, { backgroundColor: channel ? '#F60' : '#585858' }]} />
|
|
103
|
+
<LinearGradient
|
|
104
|
+
colors={['#DDDDDD', '#EBEBEB']}
|
|
105
|
+
style={styles.insertColor}
|
|
106
|
+
/>
|
|
107
|
+
</View>
|
|
108
|
+
</TouchableOpacity>
|
|
109
|
+
))}
|
|
110
|
+
</View>
|
|
111
|
+
</LinearGradient>
|
|
112
|
+
<Spacer height={cx(30)}/>
|
|
113
|
+
</View>
|
|
114
|
+
</Card>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export default withTheme(HybridSwitchView)
|
package/src/composeLayout.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
setTimeZone,
|
|
16
16
|
UAGroupInfo,
|
|
17
17
|
} from './models/modules/NativePropsSlice'
|
|
18
|
-
import {
|
|
18
|
+
import { LdvDpSchema, GlobalParams } from './models/GlobalParams'
|
|
19
19
|
import Connect from './components/connect'
|
|
20
20
|
import darkTheme from "./config/dark-theme";
|
|
21
21
|
import lightTheme from "./config/light-theme";
|
|
@@ -204,17 +204,19 @@ const composeLayout = (component: React.ComponentType) => {
|
|
|
204
204
|
|
|
205
205
|
setDpSchemaMap(schema: string): any {
|
|
206
206
|
// 处理物模型协议和dps
|
|
207
|
-
const dpSchemaMap: Record<string,
|
|
207
|
+
const dpSchemaMap: Record<string, LdvDpSchema> = {}
|
|
208
208
|
const dps = {}
|
|
209
209
|
JSON.parse(schema || '[]')
|
|
210
210
|
.forEach((schemaItem: any) => {
|
|
211
|
-
|
|
211
|
+
const dpSchema = {
|
|
212
212
|
name: schemaItem.name,
|
|
213
213
|
dp: schemaItem.id,
|
|
214
214
|
type: schemaItem.type,
|
|
215
215
|
mode: schemaItem.mode,
|
|
216
216
|
property: schemaItem.property,
|
|
217
|
-
}
|
|
217
|
+
};
|
|
218
|
+
dpSchemaMap[schemaItem.code] = dpSchema
|
|
219
|
+
dpSchemaMap[schemaItem.id] = dpSchema
|
|
218
220
|
dps[schemaItem.id] = null
|
|
219
221
|
})
|
|
220
222
|
GlobalParams.dpSchemaMap = dpSchemaMap
|