@ledvance/base 1.2.23 → 1.2.24
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
CHANGED
package/src/composeLayout.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import { NativeApi } from 'api/native'
|
|
|
8
8
|
import {
|
|
9
9
|
DeviceInfo,
|
|
10
10
|
NativeProps,
|
|
11
|
+
setGroupDevices,
|
|
11
12
|
setGroupNativeProps,
|
|
12
13
|
setNativeProps,
|
|
13
14
|
UAGroupInfo,
|
|
@@ -114,6 +115,7 @@ const composeLayout = (component: React.ComponentType) => {
|
|
|
114
115
|
this.initReduxDeviceNativeProps(props.ldvDevInfo)
|
|
115
116
|
} else {
|
|
116
117
|
this.initReduxGroupNativeProps(props.uaGroupInfo)
|
|
118
|
+
this.initGroupDevices(props.uaGroupInfo?.tyGroupId)
|
|
117
119
|
}
|
|
118
120
|
}
|
|
119
121
|
|
|
@@ -132,9 +134,11 @@ const composeLayout = (component: React.ComponentType) => {
|
|
|
132
134
|
dps: {},
|
|
133
135
|
pId: '',
|
|
134
136
|
config: {},
|
|
137
|
+
groupDevices: []
|
|
135
138
|
},
|
|
136
139
|
familyName: ldvDevInfo.familyName,
|
|
137
140
|
role: ldvDevInfo.role,
|
|
141
|
+
moods: []
|
|
138
142
|
}
|
|
139
143
|
NativeApi.showObj(nativeProps)
|
|
140
144
|
console.log('Redux 初始数据:', JSON.stringify(nativeProps))
|
|
@@ -159,9 +163,11 @@ const composeLayout = (component: React.ComponentType) => {
|
|
|
159
163
|
config: {
|
|
160
164
|
...JSON.parse(uaGroupInfo.config || '{}'),
|
|
161
165
|
},
|
|
166
|
+
groupDevices: []
|
|
162
167
|
},
|
|
163
168
|
familyName: uaGroupInfo.familyName,
|
|
164
169
|
role: uaGroupInfo.role,
|
|
170
|
+
moods: []
|
|
165
171
|
}
|
|
166
172
|
NativeApi.showObj(nativeProps)
|
|
167
173
|
console.log('Redux 初始数据:', JSON.stringify(nativeProps))
|
|
@@ -169,6 +175,14 @@ const composeLayout = (component: React.ComponentType) => {
|
|
|
169
175
|
dispatch(setGroupNativeProps(nativeProps))
|
|
170
176
|
}
|
|
171
177
|
|
|
178
|
+
async initGroupDevices(tyGroupId: number){
|
|
179
|
+
if(!tyGroupId) return
|
|
180
|
+
const res = await NativeApi.getGroupDevices(tyGroupId)
|
|
181
|
+
if(res.success && Array.isArray(res.data)){
|
|
182
|
+
dispatch(setGroupDevices(res.data))
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
172
186
|
setDpSchemaMap(schema: string): any {
|
|
173
187
|
// 处理物模型协议和dps
|
|
174
188
|
const dpSchemaMap: Record<string, DpSchema> = {}
|
|
@@ -17,7 +17,6 @@ export interface NativeProps {
|
|
|
17
17
|
timeSchedule?: boolean
|
|
18
18
|
energieverbrauch?: object
|
|
19
19
|
moods: any[]
|
|
20
|
-
groupDevices: any[]
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
export interface DeviceInfo {
|
|
@@ -31,6 +30,7 @@ export interface UAGroupInfo {
|
|
|
31
30
|
pId: string
|
|
32
31
|
dps: any
|
|
33
32
|
config: any
|
|
33
|
+
groupDevices: DeviceInfo[]
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const initialState: NativeProps = {
|
|
@@ -46,11 +46,11 @@ const initialState: NativeProps = {
|
|
|
46
46
|
pId: '',
|
|
47
47
|
dps: {},
|
|
48
48
|
config: {},
|
|
49
|
+
groupDevices: []
|
|
49
50
|
},
|
|
50
51
|
timeSchedule: false,
|
|
51
52
|
energieverbrauch: {},
|
|
52
53
|
moods: [],
|
|
53
|
-
groupDevices: [],
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// energy generation
|
|
@@ -84,6 +84,9 @@ const nativePropsSlice = createSlice({
|
|
|
84
84
|
if (!!action.payload.familyName) {
|
|
85
85
|
state.familyName = action.payload.familyName
|
|
86
86
|
}
|
|
87
|
+
if (isNumber(action.payload.role)) {
|
|
88
|
+
state.role = action.payload.role
|
|
89
|
+
}
|
|
87
90
|
if (!!action.payload.uaGroupInfo.pId) {
|
|
88
91
|
state.uaGroupInfo.pId = action.payload.uaGroupInfo.pId
|
|
89
92
|
}
|
|
@@ -109,7 +112,7 @@ const nativePropsSlice = createSlice({
|
|
|
109
112
|
state.moods = action.payload
|
|
110
113
|
},
|
|
111
114
|
setGroupDevices(state, action: PayloadAction<any>) {
|
|
112
|
-
state.groupDevices = action.payload
|
|
115
|
+
state.uaGroupInfo.groupDevices = action.payload
|
|
113
116
|
},
|
|
114
117
|
},
|
|
115
118
|
})
|
|
@@ -222,7 +225,7 @@ const useMoods = (): [any[], (v: any[]) => void] => {
|
|
|
222
225
|
}
|
|
223
226
|
|
|
224
227
|
const useGroupDevices = (): [any[], (v: any[]) => void] => {
|
|
225
|
-
const dps = useSelector(store => store.ldvModules.groupDevices)
|
|
228
|
+
const dps = useSelector(store => store.ldvModules.uaGroupInfo.groupDevices)
|
|
226
229
|
const dispatch = useDispatch()
|
|
227
230
|
const setGroupDevicesFn = (value: any[]) => {
|
|
228
231
|
dispatch(setGroupDevices(value))
|
|
@@ -311,7 +314,7 @@ export function useFeatureHook<GC, T extends PropertyValueTypes<GC>>(
|
|
|
311
314
|
const extraConfig = getExtraConfig ? getExtraConfig(value) : undefined
|
|
312
315
|
return await setFH(value, dpValue, extraDps, extraConfig)
|
|
313
316
|
}, [setFH])
|
|
314
|
-
return [featureHook
|
|
317
|
+
return [featureHook ?? defValue, setFeatureHook]
|
|
315
318
|
}
|
|
316
319
|
|
|
317
320
|
export const useFanMaxSpeed = () => {
|
package/.temp/uaDevInfo.txt
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
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
|