@ledvance/base 1.1.89 → 1.1.91
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/.temp/uaDevInfo.txt +51 -0
- package/package.json +1 -1
- package/src/api/native.d.ts +1 -0
- package/src/components/DrawToolView.d.ts +5 -2
- package/src/components/DrawToolView.tsx +138 -131
- package/src/components/StripLightView.d.ts +13 -1
- package/src/components/StripLightView.tsx +25 -0
- package/src/components/StripLightView.ts +0 -4
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
@ColumnInfo(name = "device_id")
|
|
2
|
+
val deviceId: String,
|
|
3
|
+
@ColumnInfo(name = "device_name")
|
|
4
|
+
val deviceName: String,
|
|
5
|
+
@ColumnInfo(name = "cat_id")
|
|
6
|
+
val catId: String,
|
|
7
|
+
@ColumnInfo(name = "channel_no")
|
|
8
|
+
val channelNo: Int,
|
|
9
|
+
@ColumnInfo(name = "device_category")
|
|
10
|
+
val deviceCategory: String,
|
|
11
|
+
@ColumnInfo(name = "device_image")
|
|
12
|
+
val deviceImage: String,
|
|
13
|
+
@ColumnInfo(name = "tuya_device_id")
|
|
14
|
+
val tuyaDeviceId: String,
|
|
15
|
+
// deviceType 对应 ProductInfo 的 productId
|
|
16
|
+
@ColumnInfo(name = "device_type")
|
|
17
|
+
val deviceType: String,
|
|
18
|
+
@ColumnInfo(name = "offline_time")
|
|
19
|
+
val offlineTime: String,
|
|
20
|
+
@ColumnInfo(name = "rn_package")
|
|
21
|
+
val rnPackage: String?,
|
|
22
|
+
@ColumnInfo(name = "status")
|
|
23
|
+
val status: Int,
|
|
24
|
+
@ColumnInfo(name = "create_time")
|
|
25
|
+
val createTime: String,
|
|
26
|
+
@ColumnInfo(name = "version")
|
|
27
|
+
val version: String,
|
|
28
|
+
@ColumnInfo(name = "user_id")
|
|
29
|
+
val userId: String,
|
|
30
|
+
@ColumnInfo(name = "family_id")
|
|
31
|
+
val familyId: Long,
|
|
32
|
+
@ColumnInfo(name = "room_id")
|
|
33
|
+
val roomId: Long,
|
|
34
|
+
@ColumnInfo(name = "room_name")
|
|
35
|
+
val roomName: String,
|
|
36
|
+
@ColumnInfo(name = "is_shared")
|
|
37
|
+
val isShared: Int,
|
|
38
|
+
@ColumnInfo(name = "local_index")
|
|
39
|
+
val localIndex: String,
|
|
40
|
+
@ColumnInfo(name = "resource_category")
|
|
41
|
+
val resourceCategory: String,
|
|
42
|
+
@ColumnInfo(name = "resource_id")
|
|
43
|
+
val resourceId: String,
|
|
44
|
+
@ColumnInfo(name = "resource_identifier")
|
|
45
|
+
val resourceIdentifier: String,
|
|
46
|
+
@ColumnInfo(name = "resource_type")
|
|
47
|
+
val resourceType: Int,
|
|
48
|
+
@ColumnInfo(name = "index")
|
|
49
|
+
val index: Int = 0,
|
|
50
|
+
@ColumnInfo(name = "switch_state")
|
|
51
|
+
val switchState: Boolean = true
|
package/package.json
CHANGED
package/src/api/native.d.ts
CHANGED
|
@@ -65,4 +65,5 @@ export declare const queryDpIds: (dpIds: string, deviceId: string) => Promise<un
|
|
|
65
65
|
export declare const formatNumber: (num: number, fixed: number, shoGroup?: boolean) => string;
|
|
66
66
|
export declare const getTimeZone: () => string;
|
|
67
67
|
export declare const getSystemTimeFormat: () => Promise<number>;
|
|
68
|
+
export declare const getMicrophoneAccess: () => Promise<boolean>;
|
|
68
69
|
export {};
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { ViewProps } from 'react-native';
|
|
1
3
|
export declare type Node = {
|
|
2
4
|
color: string;
|
|
3
5
|
backgroundColor?: string;
|
|
4
6
|
};
|
|
5
|
-
interface DrawToolViewProps {
|
|
7
|
+
interface DrawToolViewProps extends PropsWithChildren<ViewProps> {
|
|
6
8
|
switchLed?: boolean;
|
|
7
9
|
showEnable?: boolean;
|
|
8
10
|
setEnable: (enable: boolean) => void;
|
|
9
|
-
adjustType?:
|
|
11
|
+
adjustType?: 1 | 2 | 3;
|
|
10
12
|
setAdjustType: (type: number) => void;
|
|
11
13
|
stripStyle?: 'ONLY_LINE' | 'WITH_BEAD';
|
|
12
14
|
nodes: Node[];
|
|
13
15
|
fixCount?: number;
|
|
16
|
+
touchingMode?: 'CLICK' | 'TOUCH';
|
|
14
17
|
nodeTouch: (idx: number) => void;
|
|
15
18
|
fingerUp: (idxList: string) => void;
|
|
16
19
|
hideLightView?: boolean;
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useReactive } from
|
|
5
|
-
import Card from
|
|
6
|
-
import res from '@
|
|
7
|
-
import I18n from '@
|
|
8
|
-
import LdvSwitch from '
|
|
9
|
-
import LampAdjustView from '
|
|
10
|
-
import { hsv2Hex, mapFloatToRange } from '@
|
|
11
|
-
import Spacer from
|
|
12
|
-
import DeleteButton from
|
|
13
|
-
import Stepper from '
|
|
14
|
-
const { convertX: cx } = Utils.RatioUtils
|
|
1
|
+
import React, { PropsWithChildren, useCallback, useEffect, useMemo } from 'react'
|
|
2
|
+
import { Image, StyleSheet, Text, TouchableOpacity, View, ViewProps } from 'react-native'
|
|
3
|
+
import { Modal, Utils } from 'tuya-panel-kit'
|
|
4
|
+
import { useReactive } from 'ahooks'
|
|
5
|
+
import Card from './Card'
|
|
6
|
+
import res from '@res'
|
|
7
|
+
import I18n from '@i18n'
|
|
8
|
+
import LdvSwitch from './ldvSwitch'
|
|
9
|
+
import LampAdjustView from './LampAdjustView'
|
|
10
|
+
import { hsv2Hex, mapFloatToRange } from '@utils'
|
|
11
|
+
import Spacer from './Spacer'
|
|
12
|
+
import DeleteButton from './DeleteButton'
|
|
13
|
+
import Stepper from './Stepper'
|
|
15
14
|
import StripLightView from './StripLightView'
|
|
16
|
-
import { nativeEventEmitter} from '
|
|
15
|
+
import { nativeEventEmitter } from '../api/nativeEventEmitter'
|
|
16
|
+
|
|
17
|
+
const { convertX: cx } = Utils.RatioUtils
|
|
17
18
|
|
|
18
19
|
export type Node = {
|
|
19
20
|
color: string,
|
|
20
21
|
backgroundColor?: string
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
interface DrawToolViewProps {
|
|
24
|
+
interface DrawToolViewProps extends PropsWithChildren<ViewProps> {
|
|
24
25
|
switchLed?: boolean
|
|
25
26
|
showEnable?: boolean
|
|
26
27
|
setEnable: (enable: boolean) => void
|
|
27
|
-
adjustType?:
|
|
28
|
+
adjustType?: 1 | 2 | 3 // 1 全选, 2 单选, 3 擦除
|
|
28
29
|
setAdjustType: (type: number) => void
|
|
29
30
|
stripStyle?: 'ONLY_LINE' | 'WITH_BEAD'
|
|
30
31
|
nodes: Node[]
|
|
31
32
|
fixCount?: number
|
|
33
|
+
touchingMode?: 'CLICK' | 'TOUCH'
|
|
32
34
|
nodeTouch: (idx: number) => void
|
|
33
35
|
fingerUp: (idxList: string) => void
|
|
34
36
|
hideLightView?: boolean
|
|
@@ -52,11 +54,12 @@ interface DrawToolViewProps {
|
|
|
52
54
|
ledNum?: number
|
|
53
55
|
setLedNum: (num: number) => void
|
|
54
56
|
}
|
|
57
|
+
|
|
55
58
|
const DrawToolView = (props: DrawToolViewProps) => {
|
|
56
59
|
const state = useReactive({
|
|
57
60
|
visible: false,
|
|
58
61
|
ledNum: props.ledNum || 5,
|
|
59
|
-
width: 0
|
|
62
|
+
width: 0,
|
|
60
63
|
})
|
|
61
64
|
|
|
62
65
|
useEffect(() => {
|
|
@@ -69,7 +72,7 @@ const DrawToolView = (props: DrawToolViewProps) => {
|
|
|
69
72
|
}
|
|
70
73
|
}, [])
|
|
71
74
|
|
|
72
|
-
const onLayout = (event) => {
|
|
75
|
+
const onLayout = (event: any) => {
|
|
73
76
|
const { width } = event.nativeEvent.layout
|
|
74
77
|
state.width = width
|
|
75
78
|
}
|
|
@@ -86,125 +89,129 @@ const DrawToolView = (props: DrawToolViewProps) => {
|
|
|
86
89
|
return '#ffffff'
|
|
87
90
|
}, [props.isColorMode, props.h, props.s])
|
|
88
91
|
|
|
89
|
-
return
|
|
90
|
-
<
|
|
91
|
-
title={I18n.getLang('light_sources_tile_tw_lighting_headline')}
|
|
92
|
-
color={'#fff'}
|
|
93
|
-
colorAlpha={1}
|
|
94
|
-
enable={!!props.switchLed}
|
|
95
|
-
showSwitch={!!props.showEnable}
|
|
96
|
-
setEnable={props.setEnable}
|
|
97
|
-
/>
|
|
98
|
-
{(props.showEnable && props.switchLed || !props.showEnable) && <>
|
|
99
|
-
<View style={styles.container}>
|
|
100
|
-
<View style={styles.adjustButtons}>
|
|
101
|
-
<TouchableOpacity
|
|
102
|
-
onPress={() => {
|
|
103
|
-
props.setAdjustType(1)
|
|
104
|
-
}}>
|
|
105
|
-
<Image
|
|
106
|
-
style={[styles.adjustButton, { tintColor: props.adjustType === 1 ? '#f60' : '#666' }]}
|
|
107
|
-
source={res.ic_paint_bucket} />
|
|
108
|
-
</TouchableOpacity>
|
|
109
|
-
<TouchableOpacity
|
|
110
|
-
onPress={() => {
|
|
111
|
-
props.setAdjustType(3)
|
|
112
|
-
}}>
|
|
113
|
-
<Image
|
|
114
|
-
style={[styles.adjustButton, { tintColor: props.adjustType === 3 ? '#f60' : '#666' }]}
|
|
115
|
-
source={res.ic_disabled_light} />
|
|
116
|
-
</TouchableOpacity>
|
|
117
|
-
<TouchableOpacity
|
|
118
|
-
onPress={() => {
|
|
119
|
-
props.setAdjustType(2)
|
|
120
|
-
}}>
|
|
121
|
-
<Image
|
|
122
|
-
style={[styles.adjustButton, { tintColor: props.adjustType === 2 ? '#f60' : '#666' }]}
|
|
123
|
-
source={res.ic_colorize} />
|
|
124
|
-
</TouchableOpacity>
|
|
125
|
-
{!props.hideLedNum && <TouchableOpacity
|
|
126
|
-
onPress={() => {
|
|
127
|
-
state.visible = true
|
|
128
|
-
}}
|
|
129
|
-
style={[styles.adjustButton, { alignItems: 'center', justifyContent: 'center', backgroundColor: '#f60', borderRadius: cx(5) }]}>
|
|
130
|
-
<Text style={{ color: '#fff', fontSize: cx(18), fontWeight: 'bold' }}>{props.ledNum || 5}</Text>
|
|
131
|
-
</TouchableOpacity>}
|
|
132
|
-
</View>
|
|
133
|
-
<StripLightView
|
|
134
|
-
style={{ height, flex: 1 }}
|
|
135
|
-
nodes={JSON.stringify(props.nodes)}
|
|
136
|
-
fixCount={props.fixCount || 5}
|
|
137
|
-
stripStyle={props.stripStyle || 'WITH_BEAD'}
|
|
138
|
-
width={state.width}
|
|
139
|
-
onLayout={onLayout}
|
|
140
|
-
/>
|
|
141
|
-
</View>
|
|
92
|
+
return (
|
|
93
|
+
<Card style={{ marginHorizontal: cx(24) }}>
|
|
142
94
|
<LdvSwitch
|
|
143
|
-
title={I18n.getLang('
|
|
144
|
-
color={
|
|
95
|
+
title={I18n.getLang('light_sources_tile_tw_lighting_headline')}
|
|
96
|
+
color={'#fff'}
|
|
145
97
|
colorAlpha={1}
|
|
146
|
-
enable={
|
|
147
|
-
showSwitch={
|
|
148
|
-
setEnable={
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
98
|
+
enable={!!props.switchLed}
|
|
99
|
+
showSwitch={!!props.showEnable}
|
|
100
|
+
setEnable={props.setEnable}/>
|
|
101
|
+
{(props.showEnable && props.switchLed || !props.showEnable) && <>
|
|
102
|
+
<View style={styles.container}>
|
|
103
|
+
<View style={styles.adjustButtons}>
|
|
104
|
+
<TouchableOpacity
|
|
105
|
+
onPress={() => {
|
|
106
|
+
props.setAdjustType(1)
|
|
107
|
+
}}>
|
|
108
|
+
<Image
|
|
109
|
+
style={[styles.adjustButton, { tintColor: props.adjustType === 1 ? '#f60' : '#666' }]}
|
|
110
|
+
source={res.ic_paint_bucket}/>
|
|
111
|
+
</TouchableOpacity>
|
|
112
|
+
<TouchableOpacity
|
|
113
|
+
onPress={() => {
|
|
114
|
+
props.setAdjustType(3)
|
|
115
|
+
}}>
|
|
116
|
+
<Image
|
|
117
|
+
style={[styles.adjustButton, { tintColor: props.adjustType === 3 ? '#f60' : '#666' }]}
|
|
118
|
+
source={res.ic_disabled_light}/>
|
|
119
|
+
</TouchableOpacity>
|
|
120
|
+
<TouchableOpacity
|
|
121
|
+
onPress={() => {
|
|
122
|
+
props.setAdjustType(2)
|
|
123
|
+
}}>
|
|
124
|
+
<Image
|
|
125
|
+
style={[styles.adjustButton, { tintColor: props.adjustType === 2 ? '#f60' : '#666' }]}
|
|
126
|
+
source={res.ic_colorize}/>
|
|
127
|
+
</TouchableOpacity>
|
|
128
|
+
{!props.hideLedNum && <TouchableOpacity
|
|
129
|
+
onPress={() => {
|
|
130
|
+
state.visible = true
|
|
131
|
+
}}
|
|
132
|
+
style={[styles.adjustButton, {
|
|
133
|
+
alignItems: 'center',
|
|
134
|
+
justifyContent: 'center',
|
|
135
|
+
backgroundColor: '#f60',
|
|
136
|
+
borderRadius: cx(5),
|
|
137
|
+
}]}>
|
|
138
|
+
<Text style={{ color: '#fff', fontSize: cx(18), fontWeight: 'bold' }}>{props.ledNum || 5}</Text>
|
|
139
|
+
</TouchableOpacity>}
|
|
140
|
+
</View>
|
|
141
|
+
<StripLightView
|
|
142
|
+
style={{ height, flex: 1 }}
|
|
143
|
+
nodes={props.nodes}
|
|
144
|
+
fixCount={props.fixCount || 5}
|
|
145
|
+
stripStyle={props.stripStyle || 'WITH_BEAD'}
|
|
146
|
+
touchingMode={props.touchingMode || 'TOUCH'}
|
|
147
|
+
width={state.width}
|
|
148
|
+
onLayout={onLayout}/>
|
|
149
|
+
</View>
|
|
150
|
+
<LdvSwitch
|
|
151
|
+
title={I18n.getLang('add_new_dynamic_mood_lights_field_headline2_text')}
|
|
152
|
+
color={getBlockColor()}
|
|
153
|
+
colorAlpha={1}
|
|
154
|
+
enable={false}
|
|
155
|
+
showSwitch={false}
|
|
156
|
+
setEnable={() => {
|
|
157
|
+
}}/>
|
|
158
|
+
<LampAdjustView
|
|
159
|
+
isSupportColor={!!props.isSupportColor}
|
|
160
|
+
isSupportTemperature={!!props.isSupportTemperature}
|
|
161
|
+
isSupportBrightness={!!props.isSupportBrightness}
|
|
162
|
+
isColorMode={!!props.isColorMode}
|
|
163
|
+
reserveSV={true}
|
|
164
|
+
setIsColorMode={props.setIsColorMode}
|
|
165
|
+
h={props.h} s={props.s} v={props.v}
|
|
166
|
+
onHSVChange={props.onHSVChange}
|
|
167
|
+
onHSVChangeComplete={props.onHSVChangeComplete}
|
|
168
|
+
colorTemp={props.temperature}
|
|
169
|
+
brightness={props.brightness}
|
|
170
|
+
onCCTChange={props.onCCTChange}
|
|
171
|
+
onCCTChangeComplete={props.onCCTChangeComplete}
|
|
172
|
+
onBrightnessChange={props.onBrightnessChange}
|
|
173
|
+
onBrightnessChangeComplete={props.onBrightnessChangeComplete}/>
|
|
174
|
+
{!props.hideLedNum && <Modal
|
|
175
|
+
visible={state.visible}
|
|
176
|
+
onMaskPress={() => {
|
|
193
177
|
state.visible = false
|
|
194
178
|
}}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
179
|
+
alignContainer="center"
|
|
180
|
+
style={{ width: '100%', height: cx(100) }}>
|
|
181
|
+
<Card style={{ marginHorizontal: cx(24), marginTop: cx(50), alignItems: 'center' }}>
|
|
182
|
+
<Spacer/>
|
|
183
|
+
<Stepper
|
|
184
|
+
min={5}
|
|
185
|
+
max={48}
|
|
186
|
+
stepValue={1}
|
|
187
|
+
editable={true}
|
|
188
|
+
value={state.ledNum}
|
|
189
|
+
onValueChange={(v) => {
|
|
190
|
+
state.ledNum = v
|
|
191
|
+
}}/>
|
|
192
|
+
<Spacer/>
|
|
193
|
+
<DeleteButton
|
|
194
|
+
text={I18n.getLang('auto_scan_system_wifi_confirm')}
|
|
195
|
+
style={{ width: cx(150), height: cx(40), backgroundColor: '#f60' }}
|
|
196
|
+
textStyle={{ fontSize: cx(14) }}
|
|
197
|
+
onPress={() => {
|
|
198
|
+
props.setLedNum(state.ledNum)
|
|
199
|
+
state.visible = false
|
|
200
|
+
}}/>
|
|
201
|
+
<Spacer/>
|
|
202
|
+
</Card>
|
|
203
|
+
</Modal>}
|
|
204
|
+
{props.children}
|
|
205
|
+
</>}
|
|
206
|
+
</Card>
|
|
207
|
+
)
|
|
201
208
|
}
|
|
202
209
|
|
|
203
210
|
const styles = StyleSheet.create({
|
|
204
211
|
container: {
|
|
205
212
|
paddingLeft: cx(10),
|
|
206
213
|
flexDirection: 'row',
|
|
207
|
-
alignItems: 'center'
|
|
214
|
+
alignItems: 'center',
|
|
208
215
|
},
|
|
209
216
|
title: {
|
|
210
217
|
color: '#000',
|
|
@@ -214,12 +221,12 @@ const styles = StyleSheet.create({
|
|
|
214
221
|
fontWeight: 'bold',
|
|
215
222
|
},
|
|
216
223
|
adjustButtons: {
|
|
217
|
-
width: cx(50)
|
|
224
|
+
width: cx(50),
|
|
218
225
|
},
|
|
219
226
|
adjustButton: {
|
|
220
227
|
width: cx(44),
|
|
221
|
-
height: cx(44)
|
|
222
|
-
}
|
|
228
|
+
height: cx(44),
|
|
229
|
+
},
|
|
223
230
|
})
|
|
224
231
|
|
|
225
232
|
export default DrawToolView
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
|
|
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;
|
|
2
14
|
export default StripLightView;
|
|
@@ -0,0 +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
|
+
|
|
25
|
+
export default StripLightView
|