@ledvance/base 1.2.2 → 1.2.3
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/Stepper.d.ts +1 -0
- package/src/i18n/strings.d.ts +29 -0
- package/src/models/modules/NativePropsSlice.d.ts +6 -4
- package/src/models/modules/NativePropsSlice.tsx +14 -4
- package/src/utils/TypeUtils.d.ts +3 -0
- package/src/utils/TypeUtils.ts +1 -0
|
@@ -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
|
@@ -54,6 +54,7 @@ export declare class NativeApi {
|
|
|
54
54
|
static toDeviceSettingsPage(deviceId: string, isGroup?: boolean): void;
|
|
55
55
|
static toRoutinesPage(params: {
|
|
56
56
|
backTitle: string;
|
|
57
|
+
deviceId: string;
|
|
57
58
|
}): void;
|
|
58
59
|
static putJson(deviceId: string, featureType: string, json: string): Promise<Result<any>>;
|
|
59
60
|
static getJson(deviceId: string, featureType: string): Promise<Result<any>>;
|
package/src/i18n/strings.d.ts
CHANGED
|
@@ -473,6 +473,7 @@ declare const _default: {
|
|
|
473
473
|
string_lights_modes_blink_text: string;
|
|
474
474
|
string_lights_modes_chase_text: string;
|
|
475
475
|
string_lights_modes_dazzle_text: string;
|
|
476
|
+
devicemusic_devicemic_description_text: string;
|
|
476
477
|
strip_lights_modes_magic_rebound_text: string;
|
|
477
478
|
strip_lights_modes_magic_meteor: string;
|
|
478
479
|
string_lights_set_bulbs_title: string;
|
|
@@ -1016,6 +1017,7 @@ declare const _default: {
|
|
|
1016
1017
|
string_lights_modes_blink_text: string;
|
|
1017
1018
|
string_lights_modes_chase_text: string;
|
|
1018
1019
|
string_lights_modes_dazzle_text: string;
|
|
1020
|
+
devicemusic_devicemic_description_text: string;
|
|
1019
1021
|
strip_lights_modes_magic_rebound_text: string;
|
|
1020
1022
|
strip_lights_modes_magic_meteor: string;
|
|
1021
1023
|
string_lights_set_bulbs_title: string;
|
|
@@ -1559,6 +1561,7 @@ declare const _default: {
|
|
|
1559
1561
|
string_lights_modes_blink_text: string;
|
|
1560
1562
|
string_lights_modes_chase_text: string;
|
|
1561
1563
|
string_lights_modes_dazzle_text: string;
|
|
1564
|
+
devicemusic_devicemic_description_text: string;
|
|
1562
1565
|
strip_lights_modes_magic_rebound_text: string;
|
|
1563
1566
|
strip_lights_modes_magic_meteor: string;
|
|
1564
1567
|
string_lights_set_bulbs_title: string;
|
|
@@ -2102,6 +2105,7 @@ declare const _default: {
|
|
|
2102
2105
|
string_lights_modes_blink_text: string;
|
|
2103
2106
|
string_lights_modes_chase_text: string;
|
|
2104
2107
|
string_lights_modes_dazzle_text: string;
|
|
2108
|
+
devicemusic_devicemic_description_text: string;
|
|
2105
2109
|
strip_lights_modes_magic_rebound_text: string;
|
|
2106
2110
|
strip_lights_modes_magic_meteor: string;
|
|
2107
2111
|
string_lights_set_bulbs_title: string;
|
|
@@ -2645,6 +2649,7 @@ declare const _default: {
|
|
|
2645
2649
|
string_lights_modes_blink_text: string;
|
|
2646
2650
|
string_lights_modes_chase_text: string;
|
|
2647
2651
|
string_lights_modes_dazzle_text: string;
|
|
2652
|
+
devicemusic_devicemic_description_text: string;
|
|
2648
2653
|
strip_lights_modes_magic_rebound_text: string;
|
|
2649
2654
|
strip_lights_modes_magic_meteor: string;
|
|
2650
2655
|
string_lights_set_bulbs_title: string;
|
|
@@ -3188,6 +3193,7 @@ declare const _default: {
|
|
|
3188
3193
|
string_lights_modes_blink_text: string;
|
|
3189
3194
|
string_lights_modes_chase_text: string;
|
|
3190
3195
|
string_lights_modes_dazzle_text: string;
|
|
3196
|
+
devicemusic_devicemic_description_text: string;
|
|
3191
3197
|
strip_lights_modes_magic_rebound_text: string;
|
|
3192
3198
|
strip_lights_modes_magic_meteor: string;
|
|
3193
3199
|
string_lights_set_bulbs_title: string;
|
|
@@ -3731,6 +3737,7 @@ declare const _default: {
|
|
|
3731
3737
|
string_lights_modes_blink_text: string;
|
|
3732
3738
|
string_lights_modes_chase_text: string;
|
|
3733
3739
|
string_lights_modes_dazzle_text: string;
|
|
3740
|
+
devicemusic_devicemic_description_text: string;
|
|
3734
3741
|
strip_lights_modes_magic_rebound_text: string;
|
|
3735
3742
|
strip_lights_modes_magic_meteor: string;
|
|
3736
3743
|
string_lights_set_bulbs_title: string;
|
|
@@ -4274,6 +4281,7 @@ declare const _default: {
|
|
|
4274
4281
|
string_lights_modes_blink_text: string;
|
|
4275
4282
|
string_lights_modes_chase_text: string;
|
|
4276
4283
|
string_lights_modes_dazzle_text: string;
|
|
4284
|
+
devicemusic_devicemic_description_text: string;
|
|
4277
4285
|
strip_lights_modes_magic_rebound_text: string;
|
|
4278
4286
|
strip_lights_modes_magic_meteor: string;
|
|
4279
4287
|
string_lights_set_bulbs_title: string;
|
|
@@ -4817,6 +4825,7 @@ declare const _default: {
|
|
|
4817
4825
|
string_lights_modes_blink_text: string;
|
|
4818
4826
|
string_lights_modes_chase_text: string;
|
|
4819
4827
|
string_lights_modes_dazzle_text: string;
|
|
4828
|
+
devicemusic_devicemic_description_text: string;
|
|
4820
4829
|
strip_lights_modes_magic_rebound_text: string;
|
|
4821
4830
|
strip_lights_modes_magic_meteor: string;
|
|
4822
4831
|
string_lights_set_bulbs_title: string;
|
|
@@ -5360,6 +5369,7 @@ declare const _default: {
|
|
|
5360
5369
|
string_lights_modes_blink_text: string;
|
|
5361
5370
|
string_lights_modes_chase_text: string;
|
|
5362
5371
|
string_lights_modes_dazzle_text: string;
|
|
5372
|
+
devicemusic_devicemic_description_text: string;
|
|
5363
5373
|
strip_lights_modes_magic_rebound_text: string;
|
|
5364
5374
|
strip_lights_modes_magic_meteor: string;
|
|
5365
5375
|
string_lights_set_bulbs_title: string;
|
|
@@ -5903,6 +5913,7 @@ declare const _default: {
|
|
|
5903
5913
|
string_lights_modes_blink_text: string;
|
|
5904
5914
|
string_lights_modes_chase_text: string;
|
|
5905
5915
|
string_lights_modes_dazzle_text: string;
|
|
5916
|
+
devicemusic_devicemic_description_text: string;
|
|
5906
5917
|
strip_lights_modes_magic_rebound_text: string;
|
|
5907
5918
|
strip_lights_modes_magic_meteor: string;
|
|
5908
5919
|
string_lights_set_bulbs_title: string;
|
|
@@ -6446,6 +6457,7 @@ declare const _default: {
|
|
|
6446
6457
|
string_lights_modes_blink_text: string;
|
|
6447
6458
|
string_lights_modes_chase_text: string;
|
|
6448
6459
|
string_lights_modes_dazzle_text: string;
|
|
6460
|
+
devicemusic_devicemic_description_text: string;
|
|
6449
6461
|
strip_lights_modes_magic_rebound_text: string;
|
|
6450
6462
|
strip_lights_modes_magic_meteor: string;
|
|
6451
6463
|
string_lights_set_bulbs_title: string;
|
|
@@ -6989,6 +7001,7 @@ declare const _default: {
|
|
|
6989
7001
|
string_lights_modes_blink_text: string;
|
|
6990
7002
|
string_lights_modes_chase_text: string;
|
|
6991
7003
|
string_lights_modes_dazzle_text: string;
|
|
7004
|
+
devicemusic_devicemic_description_text: string;
|
|
6992
7005
|
strip_lights_modes_magic_rebound_text: string;
|
|
6993
7006
|
strip_lights_modes_magic_meteor: string;
|
|
6994
7007
|
string_lights_set_bulbs_title: string;
|
|
@@ -7532,6 +7545,7 @@ declare const _default: {
|
|
|
7532
7545
|
string_lights_modes_blink_text: string;
|
|
7533
7546
|
string_lights_modes_chase_text: string;
|
|
7534
7547
|
string_lights_modes_dazzle_text: string;
|
|
7548
|
+
devicemusic_devicemic_description_text: string;
|
|
7535
7549
|
strip_lights_modes_magic_rebound_text: string;
|
|
7536
7550
|
strip_lights_modes_magic_meteor: string;
|
|
7537
7551
|
string_lights_set_bulbs_title: string;
|
|
@@ -8075,6 +8089,7 @@ declare const _default: {
|
|
|
8075
8089
|
string_lights_modes_blink_text: string;
|
|
8076
8090
|
string_lights_modes_chase_text: string;
|
|
8077
8091
|
string_lights_modes_dazzle_text: string;
|
|
8092
|
+
devicemusic_devicemic_description_text: string;
|
|
8078
8093
|
strip_lights_modes_magic_rebound_text: string;
|
|
8079
8094
|
strip_lights_modes_magic_meteor: string;
|
|
8080
8095
|
string_lights_set_bulbs_title: string;
|
|
@@ -8618,6 +8633,7 @@ declare const _default: {
|
|
|
8618
8633
|
string_lights_modes_blink_text: string;
|
|
8619
8634
|
string_lights_modes_chase_text: string;
|
|
8620
8635
|
string_lights_modes_dazzle_text: string;
|
|
8636
|
+
devicemusic_devicemic_description_text: string;
|
|
8621
8637
|
strip_lights_modes_magic_rebound_text: string;
|
|
8622
8638
|
strip_lights_modes_magic_meteor: string;
|
|
8623
8639
|
string_lights_set_bulbs_title: string;
|
|
@@ -9161,6 +9177,7 @@ declare const _default: {
|
|
|
9161
9177
|
string_lights_modes_blink_text: string;
|
|
9162
9178
|
string_lights_modes_chase_text: string;
|
|
9163
9179
|
string_lights_modes_dazzle_text: string;
|
|
9180
|
+
devicemusic_devicemic_description_text: string;
|
|
9164
9181
|
strip_lights_modes_magic_rebound_text: string;
|
|
9165
9182
|
strip_lights_modes_magic_meteor: string;
|
|
9166
9183
|
string_lights_set_bulbs_title: string;
|
|
@@ -9704,6 +9721,7 @@ declare const _default: {
|
|
|
9704
9721
|
string_lights_modes_blink_text: string;
|
|
9705
9722
|
string_lights_modes_chase_text: string;
|
|
9706
9723
|
string_lights_modes_dazzle_text: string;
|
|
9724
|
+
devicemusic_devicemic_description_text: string;
|
|
9707
9725
|
strip_lights_modes_magic_rebound_text: string;
|
|
9708
9726
|
strip_lights_modes_magic_meteor: string;
|
|
9709
9727
|
string_lights_set_bulbs_title: string;
|
|
@@ -10247,6 +10265,7 @@ declare const _default: {
|
|
|
10247
10265
|
string_lights_modes_blink_text: string;
|
|
10248
10266
|
string_lights_modes_chase_text: string;
|
|
10249
10267
|
string_lights_modes_dazzle_text: string;
|
|
10268
|
+
devicemusic_devicemic_description_text: string;
|
|
10250
10269
|
strip_lights_modes_magic_rebound_text: string;
|
|
10251
10270
|
strip_lights_modes_magic_meteor: string;
|
|
10252
10271
|
string_lights_set_bulbs_title: string;
|
|
@@ -10790,6 +10809,7 @@ declare const _default: {
|
|
|
10790
10809
|
string_lights_modes_blink_text: string;
|
|
10791
10810
|
string_lights_modes_chase_text: string;
|
|
10792
10811
|
string_lights_modes_dazzle_text: string;
|
|
10812
|
+
devicemusic_devicemic_description_text: string;
|
|
10793
10813
|
strip_lights_modes_magic_rebound_text: string;
|
|
10794
10814
|
strip_lights_modes_magic_meteor: string;
|
|
10795
10815
|
string_lights_set_bulbs_title: string;
|
|
@@ -11333,6 +11353,7 @@ declare const _default: {
|
|
|
11333
11353
|
string_lights_modes_blink_text: string;
|
|
11334
11354
|
string_lights_modes_chase_text: string;
|
|
11335
11355
|
string_lights_modes_dazzle_text: string;
|
|
11356
|
+
devicemusic_devicemic_description_text: string;
|
|
11336
11357
|
strip_lights_modes_magic_rebound_text: string;
|
|
11337
11358
|
strip_lights_modes_magic_meteor: string;
|
|
11338
11359
|
string_lights_set_bulbs_title: string;
|
|
@@ -11876,6 +11897,7 @@ declare const _default: {
|
|
|
11876
11897
|
string_lights_modes_blink_text: string;
|
|
11877
11898
|
string_lights_modes_chase_text: string;
|
|
11878
11899
|
string_lights_modes_dazzle_text: string;
|
|
11900
|
+
devicemusic_devicemic_description_text: string;
|
|
11879
11901
|
strip_lights_modes_magic_rebound_text: string;
|
|
11880
11902
|
strip_lights_modes_magic_meteor: string;
|
|
11881
11903
|
string_lights_set_bulbs_title: string;
|
|
@@ -12419,6 +12441,7 @@ declare const _default: {
|
|
|
12419
12441
|
string_lights_modes_blink_text: string;
|
|
12420
12442
|
string_lights_modes_chase_text: string;
|
|
12421
12443
|
string_lights_modes_dazzle_text: string;
|
|
12444
|
+
devicemusic_devicemic_description_text: string;
|
|
12422
12445
|
strip_lights_modes_magic_rebound_text: string;
|
|
12423
12446
|
strip_lights_modes_magic_meteor: string;
|
|
12424
12447
|
string_lights_set_bulbs_title: string;
|
|
@@ -12962,6 +12985,7 @@ declare const _default: {
|
|
|
12962
12985
|
string_lights_modes_blink_text: string;
|
|
12963
12986
|
string_lights_modes_chase_text: string;
|
|
12964
12987
|
string_lights_modes_dazzle_text: string;
|
|
12988
|
+
devicemusic_devicemic_description_text: string;
|
|
12965
12989
|
strip_lights_modes_magic_rebound_text: string;
|
|
12966
12990
|
strip_lights_modes_magic_meteor: string;
|
|
12967
12991
|
string_lights_set_bulbs_title: string;
|
|
@@ -13505,6 +13529,7 @@ declare const _default: {
|
|
|
13505
13529
|
string_lights_modes_blink_text: string;
|
|
13506
13530
|
string_lights_modes_chase_text: string;
|
|
13507
13531
|
string_lights_modes_dazzle_text: string;
|
|
13532
|
+
devicemusic_devicemic_description_text: string;
|
|
13508
13533
|
strip_lights_modes_magic_rebound_text: string;
|
|
13509
13534
|
strip_lights_modes_magic_meteor: string;
|
|
13510
13535
|
string_lights_set_bulbs_title: string;
|
|
@@ -14048,6 +14073,7 @@ declare const _default: {
|
|
|
14048
14073
|
string_lights_modes_blink_text: string;
|
|
14049
14074
|
string_lights_modes_chase_text: string;
|
|
14050
14075
|
string_lights_modes_dazzle_text: string;
|
|
14076
|
+
devicemusic_devicemic_description_text: string;
|
|
14051
14077
|
strip_lights_modes_magic_rebound_text: string;
|
|
14052
14078
|
strip_lights_modes_magic_meteor: string;
|
|
14053
14079
|
string_lights_set_bulbs_title: string;
|
|
@@ -14591,6 +14617,7 @@ declare const _default: {
|
|
|
14591
14617
|
string_lights_modes_blink_text: string;
|
|
14592
14618
|
string_lights_modes_chase_text: string;
|
|
14593
14619
|
string_lights_modes_dazzle_text: string;
|
|
14620
|
+
devicemusic_devicemic_description_text: string;
|
|
14594
14621
|
strip_lights_modes_magic_rebound_text: string;
|
|
14595
14622
|
strip_lights_modes_magic_meteor: string;
|
|
14596
14623
|
string_lights_set_bulbs_title: string;
|
|
@@ -15134,6 +15161,7 @@ declare const _default: {
|
|
|
15134
15161
|
string_lights_modes_blink_text: string;
|
|
15135
15162
|
string_lights_modes_chase_text: string;
|
|
15136
15163
|
string_lights_modes_dazzle_text: string;
|
|
15164
|
+
devicemusic_devicemic_description_text: string;
|
|
15137
15165
|
strip_lights_modes_magic_rebound_text: string;
|
|
15138
15166
|
strip_lights_modes_magic_meteor: string;
|
|
15139
15167
|
string_lights_set_bulbs_title: string;
|
|
@@ -15677,6 +15705,7 @@ declare const _default: {
|
|
|
15677
15705
|
string_lights_modes_blink_text: string;
|
|
15678
15706
|
string_lights_modes_chase_text: string;
|
|
15679
15707
|
string_lights_modes_dazzle_text: string;
|
|
15708
|
+
devicemusic_devicemic_description_text: string;
|
|
15680
15709
|
strip_lights_modes_magic_rebound_text: string;
|
|
15681
15710
|
strip_lights_modes_magic_meteor: string;
|
|
15682
15711
|
string_lights_set_bulbs_title: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Dispatch } from 'react';
|
|
2
2
|
import { DpsResult, Result } from './Result';
|
|
3
3
|
import { DevInfo, DpValue } from 'tuya-panel-kit';
|
|
4
|
+
import { PropertyValueTypes } from '../../utils/TypeUtils';
|
|
4
5
|
export interface NativeProps {
|
|
5
6
|
familyName: string;
|
|
6
7
|
role: 0 | 1 | 2 | 3;
|
|
@@ -8,6 +9,7 @@ export interface NativeProps {
|
|
|
8
9
|
uaGroupInfo: UAGroupInfo;
|
|
9
10
|
timeSchedule?: boolean;
|
|
10
11
|
energieverbrauch?: object;
|
|
12
|
+
moods: any[];
|
|
11
13
|
}
|
|
12
14
|
export interface DeviceInfo {
|
|
13
15
|
devId: string;
|
|
@@ -37,6 +39,7 @@ interface DpState {
|
|
|
37
39
|
}
|
|
38
40
|
declare const useDeviceInfo: () => DevInfo<DpState>;
|
|
39
41
|
declare const useTimeSchedule: () => [v: boolean | undefined, f: any];
|
|
42
|
+
declare const useMoods: () => [any[], (v: any[]) => void];
|
|
40
43
|
declare const useEnergieverbrauch: () => (object | undefined)[];
|
|
41
44
|
export declare const useEngergyGeneration: () => boolean;
|
|
42
45
|
export declare function useUAGroupInfo(): UAGroupInfo;
|
|
@@ -47,11 +50,10 @@ export declare function useGroupConfig<T>(): [T, (dps: any, newConfig: T) => Pro
|
|
|
47
50
|
* @param key
|
|
48
51
|
* @param dpKey
|
|
49
52
|
*/
|
|
50
|
-
export declare function useGroupConfigFeature<GC, GCPT extends
|
|
51
|
-
|
|
52
|
-
}[keyof GC]>(key: keyof GC, dpKey?: string): [GCPT | undefined, (value: GCPT, dpValue: any, extraDps?: any, extraConfig?: any) => Promise<Result<any>>];
|
|
53
|
+
export declare function useGroupConfigFeature<GC, GCPT extends PropertyValueTypes<GC>>(key: keyof GC, dpKey?: string): [GCPT | undefined, (value: GCPT, dpValue: any, extraDps?: any, extraConfig?: any) => Promise<Result<any>>];
|
|
54
|
+
export declare function useFeatureHook<GC, T extends PropertyValueTypes<GC>>(featureKey: keyof GC, defValue: T, valueMapToDpValue?: (v: T) => any, extraDps?: any, extraConfig?: any): [T, (value: T) => Promise<Result<any>>];
|
|
53
55
|
export declare const useFanMaxSpeed: () => 3 | 20;
|
|
54
56
|
export declare const isUVCFanDevice: () => boolean;
|
|
55
57
|
export declare const ldvModules: import("@reduxjs/toolkit").Reducer<NativeProps, import("@reduxjs/toolkit").AnyAction>;
|
|
56
58
|
export declare const setNativeProps: import("@reduxjs/toolkit").ActionCreatorWithPayload<NativeProps, string>, setGroupNativeProps: import("@reduxjs/toolkit").ActionCreatorWithPayload<NativeProps, string>, setDps: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setTimeSchedule: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setEnergieverbrauch: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
|
|
57
|
-
export { asyncSetDps, simpleSetDps, simpleSetDp, useDeviceId, useDeviceInfo, useDp, useScaledDp, useDps, useFamilyName, useRole, useTimeSchedule, useEnergieverbrauch, };
|
|
59
|
+
export { asyncSetDps, simpleSetDps, simpleSetDp, useDeviceId, useDeviceInfo, useDp, useScaledDp, useDps, useFamilyName, useRole, useTimeSchedule, useMoods, useEnergieverbrauch, };
|
|
@@ -7,6 +7,7 @@ import { NativeApi } from '../../api/native'
|
|
|
7
7
|
import { useDispatch } from 'react-redux'
|
|
8
8
|
import { GlobalParams } from '../GlobalParams'
|
|
9
9
|
import { isNumber, snakeCase } from 'lodash'
|
|
10
|
+
import { PropertyValueTypes } from '../../utils/TypeUtils'
|
|
10
11
|
|
|
11
12
|
export interface NativeProps {
|
|
12
13
|
familyName: string
|
|
@@ -47,7 +48,7 @@ const initialState: NativeProps = {
|
|
|
47
48
|
},
|
|
48
49
|
timeSchedule: false,
|
|
49
50
|
energieverbrauch: {},
|
|
50
|
-
moods: []
|
|
51
|
+
moods: [],
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
// energy generation
|
|
@@ -104,7 +105,7 @@ const nativePropsSlice = createSlice({
|
|
|
104
105
|
},
|
|
105
106
|
setMoods(state, action: PayloadAction<any>) {
|
|
106
107
|
state.moods = action.payload
|
|
107
|
-
}
|
|
108
|
+
},
|
|
108
109
|
},
|
|
109
110
|
})
|
|
110
111
|
|
|
@@ -206,7 +207,7 @@ const useTimeSchedule = (): [v: boolean | undefined, f: any] => {
|
|
|
206
207
|
return [dps, setTimeScheduleFn]
|
|
207
208
|
}
|
|
208
209
|
|
|
209
|
-
const useMoods = (): [any[], (v:any[]) => void] =>{
|
|
210
|
+
const useMoods = (): [any[], (v: any[]) => void] => {
|
|
210
211
|
const dps = useSelector(store => store.ldvModules.moods)
|
|
211
212
|
const dispatch = useDispatch()
|
|
212
213
|
const setTimeScheduleFn = (value: any[]) => {
|
|
@@ -256,7 +257,7 @@ export function useGroupConfig<T>(): [T, (dps: any, newConfig: T) => Promise<Res
|
|
|
256
257
|
* @param key
|
|
257
258
|
* @param dpKey
|
|
258
259
|
*/
|
|
259
|
-
export function useGroupConfigFeature<GC, GCPT extends
|
|
260
|
+
export function useGroupConfigFeature<GC, GCPT extends PropertyValueTypes<GC>>
|
|
260
261
|
(key: keyof GC, dpKey?: string): [GCPT | undefined, (value: GCPT, dpValue: any, extraDps?: any, extraConfig?: any) => Promise<Result<any>>] {
|
|
261
262
|
const [groupConfig, setGroupConfig] = useGroupConfig<GC>()
|
|
262
263
|
const setGroupConfigFeature = async (value: GCPT, dpValue: any, extraDps?: any, extraConfig?: any) => {
|
|
@@ -275,6 +276,15 @@ export function useGroupConfigFeature<GC, GCPT extends { [K in keyof GC]: GC[K]
|
|
|
275
276
|
return [groupConfig[key] as (GCPT | undefined), setGroupConfigFeature]
|
|
276
277
|
}
|
|
277
278
|
|
|
279
|
+
export function useFeatureHook<GC, T extends PropertyValueTypes<GC>>(featureKey: keyof GC, defValue: T, valueMapToDpValue?: (v: T) => any, extraDps?: any, extraConfig?: any): [T, (value: T) => Promise<Result<any>>] {
|
|
280
|
+
const [featureHook, setFH] = useGroupConfigFeature<GC, T>(featureKey)
|
|
281
|
+
const setFeatureHook = useCallback(async (value: T) => {
|
|
282
|
+
const dpValue = valueMapToDpValue ? valueMapToDpValue(value) : value
|
|
283
|
+
return await setFH(value, dpValue, extraDps, extraConfig)
|
|
284
|
+
}, [setFH])
|
|
285
|
+
return [featureHook || defValue, setFeatureHook]
|
|
286
|
+
}
|
|
287
|
+
|
|
278
288
|
export const useFanMaxSpeed = () => {
|
|
279
289
|
const { productId } = useDeviceInfo()
|
|
280
290
|
return fanProductList.includes(productId) ? 20 : 3
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type PropertyValueTypes<T> = { [K in keyof T]: T[K] }[keyof T]
|