@ledvance/base 1.0.37 → 1.1.1

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
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/base",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.0.37",
7
+ "version": "1.1.1",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@reduxjs/toolkit": "^1.8.6",
@@ -17,4 +17,7 @@ export declare class NativeApi {
17
17
  static putJson(deviceId: string, featureType: string, json: string): Promise<Result<any>>;
18
18
  static getJson(deviceId: string, featureType: string): Promise<Result<string>>;
19
19
  }
20
+ export declare const openDownloadFile: (filePath: string) => Promise<unknown>;
20
21
  export declare const queryDpIds: (dpIds: string, deviceId: string) => Promise<unknown>;
22
+ export declare const formatNumber: (num: number, fixed: number) => string;
23
+ export declare const getTimeZone: () => string;
@@ -0,0 +1,9 @@
1
+ import { StyleProp, ViewStyle, TextStyle } from 'react-native';
2
+ interface DeleteButtonProps {
3
+ text: string;
4
+ onPress: () => void;
5
+ style?: StyleProp<ViewStyle>;
6
+ textStyle?: StyleProp<TextStyle>;
7
+ }
8
+ declare const DeleteButton: (props: DeleteButtonProps) => JSX.Element;
9
+ export default DeleteButton;
@@ -6,8 +6,10 @@ interface PageProps extends PropsWithChildren<ViewProps> {
6
6
  rightButtonIcon?: string;
7
7
  rightButtonIconClick?: () => void;
8
8
  headlineText?: string;
9
- headlineIcon?: string;
9
+ headlineIcon?: string | number;
10
10
  onHeadlineIconClick?: () => void;
11
+ showGreenery?: boolean;
12
+ greeneryIcon?: string | undefined | number;
11
13
  }
12
14
  declare const Page: (props: PageProps) => JSX.Element;
13
15
  export default Page;
@@ -2,6 +2,8 @@ interface LdvTopNameProps {
2
2
  title: string;
3
3
  rightIcon?: string | undefined | number;
4
4
  rightIconClick?: () => void;
5
+ showGreenery?: boolean;
6
+ greeneryIcon?: string | undefined | number;
5
7
  }
6
8
  declare const LdvTopName: (props: LdvTopNameProps) => JSX.Element;
7
9
  export default LdvTopName;
@@ -5,14 +5,31 @@ import {DevInfo, DpValue, Theme, TYSdk} from 'tuya-panel-kit'
5
5
  import {actions, store} from './models'
6
6
  import {addListener} from 'api/nativeEventEmitter'
7
7
  import {NativeApi} from 'api/native'
8
- import {setNativeProps} from './models/modules/NativePropsSlice'
8
+ import {
9
+ DeviceInfo,
10
+ NativeProps,
11
+ setGroupNativeProps,
12
+ setNativeProps,
13
+ UAGroupInfo,
14
+ } from './models/modules/NativePropsSlice'
9
15
  import {DpSchema, GlobalParams} from './models/GlobalParams'
10
16
  import Connect from './components/connect'
11
17
 
12
18
  interface Props {
13
- devInfo: DevInfo;
14
- preload?: boolean;
15
- ldvDevInfo: any;
19
+ devInfo: DevInfo
20
+ preload?: boolean
21
+ ldvDevInfo: LdvDevInfo
22
+ uaGroupInfo: UAGroupInfoProps
23
+ }
24
+
25
+ interface LdvDevInfo extends DeviceInfo {
26
+ schema: any
27
+ familyName: string
28
+ }
29
+
30
+ interface UAGroupInfoProps extends UAGroupInfo {
31
+ schema: any
32
+ familyName: string
16
33
  }
17
34
 
18
35
  const TYEvent = TYSdk.event
@@ -91,16 +108,64 @@ const composeLayout = (component: React.ComponentType) => {
91
108
  TYDevice.getDeviceInfo().then(data => dispatch(actions.common.devInfoChange(data)))
92
109
  }
93
110
 
94
- this.initReduxNativeProps(props.ldvDevInfo)
111
+ if (!!props.ldvDevInfo) {
112
+ this.initReduxDeviceNativeProps(props.ldvDevInfo)
113
+ } else {
114
+ this.initReduxGroupNativeProps(props.uaGroupInfo)
115
+ }
95
116
  }
96
117
 
97
- initReduxNativeProps(ldvDevInfo) {
118
+ initReduxDeviceNativeProps(ldvDevInfo: LdvDevInfo) {
98
119
  console.log('原生数据:', JSON.stringify(ldvDevInfo))
99
120
  NativeApi.log('原生数据: ' + JSON.stringify(ldvDevInfo))
121
+ const dps = this.setDpSchemaMap(ldvDevInfo.schema)
122
+ const nativeProps: NativeProps = {
123
+ deviceInfo: {
124
+ devId: ldvDevInfo.devId,
125
+ dps: {...dps, ...JSON.parse(ldvDevInfo.dps)},
126
+ pId: ldvDevInfo.pId,
127
+ },
128
+ uaGroupInfo: {
129
+ tyGroupId: -1,
130
+ dps: {},
131
+ pId: '',
132
+ },
133
+ familyName: ldvDevInfo.familyName,
134
+ }
135
+ NativeApi.showObj(nativeProps)
136
+ console.log('Redux 初始数据:', JSON.stringify(nativeProps))
137
+ NativeApi.log('Redux 初始数据:' + JSON.stringify(nativeProps))
138
+ dispatch(setNativeProps(nativeProps))
139
+ }
140
+
141
+ initReduxGroupNativeProps(uaGroupInfo: UAGroupInfoProps) {
142
+ console.log('原生数据:', JSON.stringify(uaGroupInfo))
143
+ NativeApi.log('原生数据: ' + JSON.stringify(uaGroupInfo))
144
+ const dps = this.setDpSchemaMap(uaGroupInfo.schema)
145
+ const nativeProps: NativeProps = {
146
+ deviceInfo: {
147
+ devId: '',
148
+ dps: {},
149
+ pId: '',
150
+ },
151
+ uaGroupInfo: {
152
+ tyGroupId: uaGroupInfo.tyGroupId,
153
+ dps: {...dps, ...JSON.parse(uaGroupInfo.dps)},
154
+ pId: uaGroupInfo.pId,
155
+ },
156
+ familyName: uaGroupInfo.familyName,
157
+ }
158
+ NativeApi.showObj(nativeProps)
159
+ console.log('Redux 初始数据:', JSON.stringify(nativeProps))
160
+ NativeApi.log('Redux 初始数据:' + JSON.stringify(nativeProps))
161
+ dispatch(setGroupNativeProps(nativeProps))
162
+ }
163
+
164
+ setDpSchemaMap(schema: string): any {
100
165
  // 处理物模型协议和dps
101
166
  const dpSchemaMap: Record<string, DpSchema> = {}
102
167
  const dps = {}
103
- JSON.parse(this.props.ldvDevInfo.schema || [])
168
+ JSON.parse(schema || '[]')
104
169
  .forEach(schemaItem => {
105
170
  dpSchemaMap[schemaItem.code] = {
106
171
  name: schemaItem.name,
@@ -111,17 +176,8 @@ const composeLayout = (component: React.ComponentType) => {
111
176
  }
112
177
  dps[schemaItem.id] = null
113
178
  })
114
- const nativeProps = {
115
- devId: ldvDevInfo.devId,
116
- pId: ldvDevInfo.pId,
117
- familyName: ldvDevInfo.familyName,
118
- dps: {...dps, ...JSON.parse(ldvDevInfo.dps)},
119
- }
120
179
  GlobalParams.dpSchemaMap = dpSchemaMap
121
- NativeApi.showObj(nativeProps)
122
- console.log('Redux 初始数据:', JSON.stringify(nativeProps))
123
- NativeApi.log('Redux 初始数据:' + JSON.stringify(nativeProps))
124
- dispatch(setNativeProps(nativeProps))
180
+ return dps
125
181
  }
126
182
 
127
183
  render() {
@@ -373,6 +373,8 @@ declare const _default: {
373
373
  string_light_pp_field_sm_add_error1: string;
374
374
  feature_activate_dialog_text: string;
375
375
  edit_timeschedule_bttn_text: string;
376
+ edit_wakeupschedule_bttn_text: string;
377
+ edit_sleepschedule_bttn_text: string;
376
378
  };
377
379
  cs: {
378
380
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -748,6 +750,8 @@ declare const _default: {
748
750
  string_light_pp_field_sm_add_error1: string;
749
751
  feature_activate_dialog_text: string;
750
752
  edit_timeschedule_bttn_text: string;
753
+ edit_wakeupschedule_bttn_text: string;
754
+ edit_sleepschedule_bttn_text: string;
751
755
  };
752
756
  en: {
753
757
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -1123,6 +1127,8 @@ declare const _default: {
1123
1127
  string_light_pp_field_sm_add_error1: string;
1124
1128
  feature_activate_dialog_text: string;
1125
1129
  edit_timeschedule_bttn_text: string;
1130
+ edit_wakeupschedule_bttn_text: string;
1131
+ edit_sleepschedule_bttn_text: string;
1126
1132
  };
1127
1133
  bg: {
1128
1134
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -1498,6 +1504,8 @@ declare const _default: {
1498
1504
  string_light_pp_field_sm_add_error1: string;
1499
1505
  feature_activate_dialog_text: string;
1500
1506
  edit_timeschedule_bttn_text: string;
1507
+ edit_wakeupschedule_bttn_text: string;
1508
+ edit_sleepschedule_bttn_text: string;
1501
1509
  };
1502
1510
  da: {
1503
1511
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -1873,6 +1881,8 @@ declare const _default: {
1873
1881
  string_light_pp_field_sm_add_error1: string;
1874
1882
  feature_activate_dialog_text: string;
1875
1883
  edit_timeschedule_bttn_text: string;
1884
+ edit_wakeupschedule_bttn_text: string;
1885
+ edit_sleepschedule_bttn_text: string;
1876
1886
  };
1877
1887
  de: {
1878
1888
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -2248,6 +2258,8 @@ declare const _default: {
2248
2258
  string_light_pp_field_sm_add_error1: string;
2249
2259
  feature_activate_dialog_text: string;
2250
2260
  edit_timeschedule_bttn_text: string;
2261
+ edit_wakeupschedule_bttn_text: string;
2262
+ edit_sleepschedule_bttn_text: string;
2251
2263
  };
2252
2264
  el: {
2253
2265
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -2623,6 +2635,8 @@ declare const _default: {
2623
2635
  string_light_pp_field_sm_add_error1: string;
2624
2636
  feature_activate_dialog_text: string;
2625
2637
  edit_timeschedule_bttn_text: string;
2638
+ edit_wakeupschedule_bttn_text: string;
2639
+ edit_sleepschedule_bttn_text: string;
2626
2640
  };
2627
2641
  es: {
2628
2642
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -2998,6 +3012,8 @@ declare const _default: {
2998
3012
  string_light_pp_field_sm_add_error1: string;
2999
3013
  feature_activate_dialog_text: string;
3000
3014
  edit_timeschedule_bttn_text: string;
3015
+ edit_wakeupschedule_bttn_text: string;
3016
+ edit_sleepschedule_bttn_text: string;
3001
3017
  };
3002
3018
  et: {
3003
3019
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -3373,6 +3389,8 @@ declare const _default: {
3373
3389
  string_light_pp_field_sm_add_error1: string;
3374
3390
  feature_activate_dialog_text: string;
3375
3391
  edit_timeschedule_bttn_text: string;
3392
+ edit_wakeupschedule_bttn_text: string;
3393
+ edit_sleepschedule_bttn_text: string;
3376
3394
  };
3377
3395
  fi: {
3378
3396
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -3748,6 +3766,8 @@ declare const _default: {
3748
3766
  string_light_pp_field_sm_add_error1: string;
3749
3767
  feature_activate_dialog_text: string;
3750
3768
  edit_timeschedule_bttn_text: string;
3769
+ edit_wakeupschedule_bttn_text: string;
3770
+ edit_sleepschedule_bttn_text: string;
3751
3771
  };
3752
3772
  fr: {
3753
3773
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -4123,6 +4143,8 @@ declare const _default: {
4123
4143
  string_light_pp_field_sm_add_error1: string;
4124
4144
  feature_activate_dialog_text: string;
4125
4145
  edit_timeschedule_bttn_text: string;
4146
+ edit_wakeupschedule_bttn_text: string;
4147
+ edit_sleepschedule_bttn_text: string;
4126
4148
  };
4127
4149
  hr: {
4128
4150
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -4498,6 +4520,8 @@ declare const _default: {
4498
4520
  string_light_pp_field_sm_add_error1: string;
4499
4521
  feature_activate_dialog_text: string;
4500
4522
  edit_timeschedule_bttn_text: string;
4523
+ edit_wakeupschedule_bttn_text: string;
4524
+ edit_sleepschedule_bttn_text: string;
4501
4525
  };
4502
4526
  hu: {
4503
4527
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -4873,6 +4897,8 @@ declare const _default: {
4873
4897
  string_light_pp_field_sm_add_error1: string;
4874
4898
  feature_activate_dialog_text: string;
4875
4899
  edit_timeschedule_bttn_text: string;
4900
+ edit_wakeupschedule_bttn_text: string;
4901
+ edit_sleepschedule_bttn_text: string;
4876
4902
  };
4877
4903
  it: {
4878
4904
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -5248,6 +5274,8 @@ declare const _default: {
5248
5274
  string_light_pp_field_sm_add_error1: string;
5249
5275
  feature_activate_dialog_text: string;
5250
5276
  edit_timeschedule_bttn_text: string;
5277
+ edit_wakeupschedule_bttn_text: string;
5278
+ edit_sleepschedule_bttn_text: string;
5251
5279
  };
5252
5280
  ko: {
5253
5281
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -5623,6 +5651,8 @@ declare const _default: {
5623
5651
  string_light_pp_field_sm_add_error1: string;
5624
5652
  feature_activate_dialog_text: string;
5625
5653
  edit_timeschedule_bttn_text: string;
5654
+ edit_wakeupschedule_bttn_text: string;
5655
+ edit_sleepschedule_bttn_text: string;
5626
5656
  };
5627
5657
  lt: {
5628
5658
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -5998,6 +6028,8 @@ declare const _default: {
5998
6028
  string_light_pp_field_sm_add_error1: string;
5999
6029
  feature_activate_dialog_text: string;
6000
6030
  edit_timeschedule_bttn_text: string;
6031
+ edit_wakeupschedule_bttn_text: string;
6032
+ edit_sleepschedule_bttn_text: string;
6001
6033
  };
6002
6034
  lv: {
6003
6035
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -6373,6 +6405,8 @@ declare const _default: {
6373
6405
  string_light_pp_field_sm_add_error1: string;
6374
6406
  feature_activate_dialog_text: string;
6375
6407
  edit_timeschedule_bttn_text: string;
6408
+ edit_wakeupschedule_bttn_text: string;
6409
+ edit_sleepschedule_bttn_text: string;
6376
6410
  };
6377
6411
  nb: {
6378
6412
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -6748,6 +6782,8 @@ declare const _default: {
6748
6782
  string_light_pp_field_sm_add_error1: string;
6749
6783
  feature_activate_dialog_text: string;
6750
6784
  edit_timeschedule_bttn_text: string;
6785
+ edit_wakeupschedule_bttn_text: string;
6786
+ edit_sleepschedule_bttn_text: string;
6751
6787
  };
6752
6788
  nl: {
6753
6789
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -7123,6 +7159,8 @@ declare const _default: {
7123
7159
  string_light_pp_field_sm_add_error1: string;
7124
7160
  feature_activate_dialog_text: string;
7125
7161
  edit_timeschedule_bttn_text: string;
7162
+ edit_wakeupschedule_bttn_text: string;
7163
+ edit_sleepschedule_bttn_text: string;
7126
7164
  };
7127
7165
  pl: {
7128
7166
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -7498,6 +7536,8 @@ declare const _default: {
7498
7536
  string_light_pp_field_sm_add_error1: string;
7499
7537
  feature_activate_dialog_text: string;
7500
7538
  edit_timeschedule_bttn_text: string;
7539
+ edit_wakeupschedule_bttn_text: string;
7540
+ edit_sleepschedule_bttn_text: string;
7501
7541
  };
7502
7542
  'pt-BR': {
7503
7543
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -7873,6 +7913,8 @@ declare const _default: {
7873
7913
  string_light_pp_field_sm_add_error1: string;
7874
7914
  feature_activate_dialog_text: string;
7875
7915
  edit_timeschedule_bttn_text: string;
7916
+ edit_wakeupschedule_bttn_text: string;
7917
+ edit_sleepschedule_bttn_text: string;
7876
7918
  };
7877
7919
  pt_BR: {
7878
7920
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -8248,6 +8290,8 @@ declare const _default: {
8248
8290
  string_light_pp_field_sm_add_error1: string;
8249
8291
  feature_activate_dialog_text: string;
8250
8292
  edit_timeschedule_bttn_text: string;
8293
+ edit_wakeupschedule_bttn_text: string;
8294
+ edit_sleepschedule_bttn_text: string;
8251
8295
  };
8252
8296
  ro: {
8253
8297
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -8623,6 +8667,8 @@ declare const _default: {
8623
8667
  string_light_pp_field_sm_add_error1: string;
8624
8668
  feature_activate_dialog_text: string;
8625
8669
  edit_timeschedule_bttn_text: string;
8670
+ edit_wakeupschedule_bttn_text: string;
8671
+ edit_sleepschedule_bttn_text: string;
8626
8672
  };
8627
8673
  ru: {
8628
8674
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -8998,6 +9044,8 @@ declare const _default: {
8998
9044
  string_light_pp_field_sm_add_error1: string;
8999
9045
  feature_activate_dialog_text: string;
9000
9046
  edit_timeschedule_bttn_text: string;
9047
+ edit_wakeupschedule_bttn_text: string;
9048
+ edit_sleepschedule_bttn_text: string;
9001
9049
  };
9002
9050
  sk: {
9003
9051
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -9373,6 +9421,8 @@ declare const _default: {
9373
9421
  string_light_pp_field_sm_add_error1: string;
9374
9422
  feature_activate_dialog_text: string;
9375
9423
  edit_timeschedule_bttn_text: string;
9424
+ edit_wakeupschedule_bttn_text: string;
9425
+ edit_sleepschedule_bttn_text: string;
9376
9426
  };
9377
9427
  sv: {
9378
9428
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -9748,6 +9798,8 @@ declare const _default: {
9748
9798
  string_light_pp_field_sm_add_error1: string;
9749
9799
  feature_activate_dialog_text: string;
9750
9800
  edit_timeschedule_bttn_text: string;
9801
+ edit_wakeupschedule_bttn_text: string;
9802
+ edit_sleepschedule_bttn_text: string;
9751
9803
  };
9752
9804
  tr: {
9753
9805
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -10123,6 +10175,8 @@ declare const _default: {
10123
10175
  string_light_pp_field_sm_add_error1: string;
10124
10176
  feature_activate_dialog_text: string;
10125
10177
  edit_timeschedule_bttn_text: string;
10178
+ edit_wakeupschedule_bttn_text: string;
10179
+ edit_sleepschedule_bttn_text: string;
10126
10180
  };
10127
10181
  uk: {
10128
10182
  add_new_dynamic_mood_color_changing_mode_value: string;
@@ -10498,6 +10552,8 @@ declare const _default: {
10498
10552
  string_light_pp_field_sm_add_error1: string;
10499
10553
  feature_activate_dialog_text: string;
10500
10554
  edit_timeschedule_bttn_text: string;
10555
+ edit_wakeupschedule_bttn_text: string;
10556
+ edit_sleepschedule_bttn_text: string;
10501
10557
  };
10502
10558
  };
10503
10559
  export default _default;