@ledvance/base 1.3.57 → 1.3.59
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 +6 -1
- package/package.json +1 -1
- package/src/components/BatteryPercentageView.tsx +1 -1
- package/src/components/HybridSwitchView.tsx +118 -0
- package/src/components/OptionGroup.tsx +128 -0
- package/src/components/ldvSwitch.tsx +2 -2
- package/src/composeLayout.tsx +6 -4
- package/src/i18n/strings.ts +2604 -1300
- 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 +5 -0
package/localazy.json
CHANGED
|
@@ -1183,7 +1183,12 @@
|
|
|
1183
1183
|
"MATCH:camera_site_overview_warning_max_number_text",
|
|
1184
1184
|
"MATCH:camera_site_overview_empty_button_add_text",
|
|
1185
1185
|
"MATCH:camera_site_overview_empty_information_text",
|
|
1186
|
-
"MATCH:camera_settings_onvif_ip_topic"
|
|
1186
|
+
"MATCH:camera_settings_onvif_ip_topic",
|
|
1187
|
+
"MATCH:camera_settings_power_management_settings_topic",
|
|
1188
|
+
"MATCH:motion_detection_alarm_interval",
|
|
1189
|
+
"MATCH:camera_operation_site_error",
|
|
1190
|
+
"MATCH:camera_calibration",
|
|
1191
|
+
"MATCH:camera_calibration_desc"
|
|
1187
1192
|
],
|
|
1188
1193
|
"replacements": {
|
|
1189
1194
|
"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)
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import ThemeType from "../config/themeType";
|
|
2
|
+
import {Utils} from "tuya-panel-kit";
|
|
3
|
+
import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native'
|
|
4
|
+
import Spacer from "./Spacer";
|
|
5
|
+
import res from "../res";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import Card from "./Card";
|
|
8
|
+
|
|
9
|
+
const {convertX: cx} = Utils.RatioUtils
|
|
10
|
+
const {withTheme} = Utils.ThemeUtils
|
|
11
|
+
|
|
12
|
+
interface OptionGroupProps {
|
|
13
|
+
theme?: ThemeType
|
|
14
|
+
tips: string
|
|
15
|
+
selected: any
|
|
16
|
+
options: OptionItemProps[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface OptionItemProps {
|
|
20
|
+
title: string
|
|
21
|
+
value: any
|
|
22
|
+
content?: string
|
|
23
|
+
enable?: boolean
|
|
24
|
+
onPress?: (value: any) => void
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const OptionGroup = (props: OptionGroupProps) => {
|
|
28
|
+
const styles = StyleSheet.create({
|
|
29
|
+
modeSelectGroup: {
|
|
30
|
+
marginHorizontal: cx(24),
|
|
31
|
+
backgroundColor: props.theme?.container.background,
|
|
32
|
+
borderRadius: cx(4),
|
|
33
|
+
},
|
|
34
|
+
modeTip: {
|
|
35
|
+
marginHorizontal: cx(8),
|
|
36
|
+
color: props.theme?.global.fontColor,
|
|
37
|
+
fontSize: cx(14),
|
|
38
|
+
fontWeight: 'bold',
|
|
39
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
40
|
+
},
|
|
41
|
+
modeSelectCard: {
|
|
42
|
+
marginHorizontal: cx(8),
|
|
43
|
+
},
|
|
44
|
+
line: {
|
|
45
|
+
height: cx(1),
|
|
46
|
+
marginHorizontal: cx(12),
|
|
47
|
+
backgroundColor: props.theme?.container.divider,
|
|
48
|
+
},
|
|
49
|
+
itemRoot: {
|
|
50
|
+
flexDirection: 'row',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
paddingHorizontal: cx(12),
|
|
53
|
+
paddingBottom: cx(8),
|
|
54
|
+
},
|
|
55
|
+
itemTextGroup: {
|
|
56
|
+
flex: 1,
|
|
57
|
+
marginEnd: cx(12),
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
},
|
|
60
|
+
itemTitle: {
|
|
61
|
+
color: props.theme?.global.fontColor,
|
|
62
|
+
fontSize: cx(14),
|
|
63
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
64
|
+
},
|
|
65
|
+
itemContent: {
|
|
66
|
+
color: props.theme?.global.secondFontColor,
|
|
67
|
+
fontSize: cx(14),
|
|
68
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
const OptionItem = (props: OptionItemProps) => {
|
|
73
|
+
return (
|
|
74
|
+
<TouchableOpacity onPress={() => props.onPress && props.onPress(props.value)}>
|
|
75
|
+
<View style={styles.itemRoot}>
|
|
76
|
+
<View style={styles.itemTextGroup}>
|
|
77
|
+
<Text style={styles.itemTitle}>{props.title}</Text>
|
|
78
|
+
<Spacer height={cx(4)}/>
|
|
79
|
+
{
|
|
80
|
+
props.content ? <Text style={styles.itemContent}>{props.content}</Text>
|
|
81
|
+
: <></>
|
|
82
|
+
}
|
|
83
|
+
</View>
|
|
84
|
+
<Image
|
|
85
|
+
source={{uri: res.ic_check}}
|
|
86
|
+
style={{
|
|
87
|
+
width: cx(32),
|
|
88
|
+
height: cx(32),
|
|
89
|
+
marginEnd: cx(4),
|
|
90
|
+
display: props.enable ? 'flex' : 'none',
|
|
91
|
+
}}/>
|
|
92
|
+
</View>
|
|
93
|
+
</TouchableOpacity>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<View style={styles.modeSelectGroup}>
|
|
99
|
+
<Spacer height={cx(8)}/>
|
|
100
|
+
<Text style={styles.modeTip}>
|
|
101
|
+
{props.tips}
|
|
102
|
+
</Text>
|
|
103
|
+
<Spacer height={cx(8)}/>
|
|
104
|
+
<Card style={styles.modeSelectCard}>
|
|
105
|
+
<Spacer height={cx(12)}/>
|
|
106
|
+
{
|
|
107
|
+
props.options.map((item, index) => {
|
|
108
|
+
return (
|
|
109
|
+
<React.Fragment key={`Fragment${index}`}>
|
|
110
|
+
<OptionItem
|
|
111
|
+
key={index}
|
|
112
|
+
{...item}
|
|
113
|
+
enable={item.value === props.selected}
|
|
114
|
+
/>
|
|
115
|
+
{
|
|
116
|
+
index !== props.options.length - 1 ? <><View style={styles.line}/><Spacer height={cx(12)}/></> : <></>
|
|
117
|
+
}
|
|
118
|
+
</React.Fragment>
|
|
119
|
+
)
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
</Card>
|
|
123
|
+
<Spacer height={cx(12)}/>
|
|
124
|
+
</View>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export default withTheme(OptionGroup)
|
|
@@ -10,7 +10,7 @@ interface Prop {
|
|
|
10
10
|
theme?: ThemeType
|
|
11
11
|
title: string
|
|
12
12
|
color?: string
|
|
13
|
-
colorAlpha
|
|
13
|
+
colorAlpha?: number
|
|
14
14
|
enable: boolean
|
|
15
15
|
setEnable: (enable: boolean) => void
|
|
16
16
|
showSwitch?:boolean
|
|
@@ -21,7 +21,7 @@ interface Prop {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const LdvSwitch = (props: Prop) => {
|
|
24
|
-
const {title, color, colorAlpha, enable, description, titleStyle, setEnable, leftValue, rightValue, showSwitch = true} = props
|
|
24
|
+
const {title, color, colorAlpha = 0, enable, description, titleStyle, setEnable, leftValue, rightValue, showSwitch = true} = props
|
|
25
25
|
return (
|
|
26
26
|
<View style={styles.titleBGView}>
|
|
27
27
|
<View style={{flexDirection: 'column', flex: 1}}>
|
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
|