@ledvance/base 1.2.26 → 1.2.28
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/package.json +1 -1
- package/src/components/ApplyForDeviceItem.tsx +20 -8
- package/src/components/MoodColorsLine.tsx +3 -2
- package/src/components/Stepper.tsx +19 -15
- package/src/i18n/strings.ts +835 -226
- package/src/res/index.ts +1 -0
- package/src/res/offlineWifi.png +0 -0
- package/src/res/offlineWifi@2x.png +0 -0
- package/src/res/offlineWifi@3x.png +0 -0
- package/src/utils/index.ts +10 -0
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ import React from 'react'
|
|
|
3
3
|
import { Utils } from 'tuya-panel-kit'
|
|
4
4
|
import { DeviceInfo } from '../api/native'
|
|
5
5
|
import Spacer from './Spacer'
|
|
6
|
+
import res from '../res'
|
|
6
7
|
|
|
7
8
|
const cx = Utils.RatioUtils.convertX
|
|
8
9
|
|
|
@@ -13,16 +14,21 @@ export interface ApplyForDeviceItemProps {
|
|
|
13
14
|
const ApplyForDeviceItem = (props: ApplyForDeviceItemProps) => {
|
|
14
15
|
return (
|
|
15
16
|
<View style={styles.root}>
|
|
16
|
-
<View style={
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<View style={styles.
|
|
22
|
-
<
|
|
17
|
+
<View style={{ flex: 1 }}>
|
|
18
|
+
<View style={styles.deviceInfo}>
|
|
19
|
+
<Image style={styles.deviceIcon} source={{ uri: props.deviceInfo.deviceIcon }} />
|
|
20
|
+
<Text style={styles.deviceName}>{props.deviceInfo.deviceName}</Text>
|
|
21
|
+
</View>
|
|
22
|
+
<View style={styles.deviceRoomInfo}>
|
|
23
|
+
<View style={styles.roomNameTag}>
|
|
24
|
+
<Text style={styles.roomName}>{props.deviceInfo.roomName}</Text>
|
|
25
|
+
</View>
|
|
23
26
|
</View>
|
|
27
|
+
<Spacer height={cx(6)} />
|
|
28
|
+
</View>
|
|
29
|
+
<View style={[styles.offlineIcon, {marginRight: cx(5)}]}>
|
|
30
|
+
{!props.deviceInfo.status && <Image style={styles.offlineIcon} source={res.offline_wifi} />}
|
|
24
31
|
</View>
|
|
25
|
-
<Spacer height={cx(6)}/>
|
|
26
32
|
</View>
|
|
27
33
|
)
|
|
28
34
|
}
|
|
@@ -31,6 +37,8 @@ const styles = StyleSheet.create({
|
|
|
31
37
|
root: {
|
|
32
38
|
marginHorizontal: cx(8),
|
|
33
39
|
backgroundColor: '#fff',
|
|
40
|
+
flexDirection: 'row',
|
|
41
|
+
alignItems: 'center'
|
|
34
42
|
},
|
|
35
43
|
deviceInfo: {
|
|
36
44
|
flex: 1,
|
|
@@ -67,6 +75,10 @@ const styles = StyleSheet.create({
|
|
|
67
75
|
fontSize: cx(10),
|
|
68
76
|
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
69
77
|
},
|
|
78
|
+
offlineIcon: {
|
|
79
|
+
width: cx(24),
|
|
80
|
+
height: cx(24)
|
|
81
|
+
}
|
|
70
82
|
})
|
|
71
83
|
|
|
72
84
|
export default ApplyForDeviceItem
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import LinearGradientLine from './LinearGradientLine'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import {Utils} from 'tuya-panel-kit'
|
|
4
|
-
import {StyleSheet} from 'react-native'
|
|
4
|
+
import {StyleProp, StyleSheet, ViewStyle} from 'react-native'
|
|
5
5
|
import ColorsLine from './ColorsLine'
|
|
6
6
|
|
|
7
7
|
const cx = Utils.RatioUtils.convertX
|
|
@@ -13,13 +13,14 @@ interface MoodColorsLineProps {
|
|
|
13
13
|
height?: number
|
|
14
14
|
type: MoodColorsLineType
|
|
15
15
|
colors: string[]
|
|
16
|
+
nodeStyle?: StyleProp<ViewStyle>
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export default function MoodColorsLine(props: MoodColorsLineProps) {
|
|
19
20
|
const width = props.width || cx(295)
|
|
20
21
|
const height = props.height || cx(24)
|
|
21
22
|
if (props.type === 'separate' || props.colors.length < 2) {
|
|
22
|
-
return (<ColorsLine colors={props.colors} style={{width, height}}/>)
|
|
23
|
+
return (<ColorsLine colors={props.colors} style={{width, height}} nodeStyle={props.nodeStyle}/>)
|
|
23
24
|
} else {
|
|
24
25
|
return (
|
|
25
26
|
<LinearGradientLine
|
|
@@ -5,7 +5,7 @@ import React, { memo, useCallback } from "react";
|
|
|
5
5
|
import { TouchableOpacity, View, Image, TextInput, StyleSheet, StyleProp, ViewStyle } from "react-native";
|
|
6
6
|
import { Utils } from "tuya-panel-kit";
|
|
7
7
|
|
|
8
|
-
const { add, subtract, inMaxMin} = Utils.NumberUtils
|
|
8
|
+
const { add, subtract, inMaxMin } = Utils.NumberUtils
|
|
9
9
|
|
|
10
10
|
const { convertX: cx } = Utils.RatioUtils
|
|
11
11
|
|
|
@@ -14,6 +14,7 @@ export interface StepperProps {
|
|
|
14
14
|
stepValue?: number // 1
|
|
15
15
|
min?: number // 0
|
|
16
16
|
max?: number // 99
|
|
17
|
+
precision?: number
|
|
17
18
|
editable?: boolean
|
|
18
19
|
selectionColor?: string
|
|
19
20
|
isRealTime?: boolean
|
|
@@ -30,7 +31,8 @@ const Stepper = (props: StepperProps) => {
|
|
|
30
31
|
value: localeNumber(Number(props.value), 1) ?? 0,
|
|
31
32
|
stepValue: props.stepValue ?? 1,
|
|
32
33
|
min: props.min ?? 0,
|
|
33
|
-
max: props.max ?? 99
|
|
34
|
+
max: props.max ?? 99,
|
|
35
|
+
precision: props.precision ?? 0
|
|
34
36
|
})
|
|
35
37
|
|
|
36
38
|
const handlePress = useCallback((isAdd: boolean) => {
|
|
@@ -40,34 +42,36 @@ const Stepper = (props: StepperProps) => {
|
|
|
40
42
|
}, [])
|
|
41
43
|
|
|
42
44
|
|
|
43
|
-
const handleChangeText = useCallback((v: string) =>{
|
|
45
|
+
const handleChangeText = useCallback((v: string) => {
|
|
44
46
|
const newValue = exchangeNumber(v)
|
|
45
47
|
const idx = newValue.indexOf('.')
|
|
46
|
-
if(newValue[0] === '.' ||
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
if (newValue[0] === '.' ||
|
|
49
|
+
(newValue.length === 2 && newValue[0] === '0' && newValue[1] !== '.') ||
|
|
50
|
+
newValue.split('').filter(item => item === '.').length > 1 ||
|
|
51
|
+
(!props.isBeyond && (Number(newValue) > state.max || Number(newValue) < state.min)) ||
|
|
52
|
+
(idx !== -1 && newValue.length > idx + 2)) {
|
|
51
53
|
return
|
|
52
54
|
}
|
|
53
|
-
if(props.isRealTime){
|
|
55
|
+
if (props.isRealTime) {
|
|
54
56
|
if (typeof v === 'string' && !v.length) {
|
|
55
57
|
props.onValueChange && props.onValueChange(0)
|
|
56
|
-
}else{
|
|
57
|
-
|
|
58
|
+
} else {
|
|
59
|
+
const num = Number(exchangeNumber(v))
|
|
60
|
+
props.onValueChange && props.onValueChange(Number(num.toFixed(props.precision)))
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
state.value = v
|
|
61
64
|
}, [])
|
|
62
65
|
|
|
63
|
-
const handleEndText = useCallback(() =>{
|
|
66
|
+
const handleEndText = useCallback(() => {
|
|
64
67
|
if (typeof state.value === 'string' && !state.value.length) {
|
|
65
68
|
props.onValueChange && props.onValueChange(state.min)
|
|
66
69
|
state.value = state.min.toString()
|
|
67
|
-
}else{
|
|
68
|
-
|
|
70
|
+
} else {
|
|
71
|
+
const num = Number(exchangeNumber(state.value))
|
|
72
|
+
props.onValueChange && props.onValueChange(Number(num.toFixed(props.precision)))
|
|
69
73
|
}
|
|
70
|
-
|
|
74
|
+
|
|
71
75
|
}, [])
|
|
72
76
|
|
|
73
77
|
return (
|