@ledvance/base 1.2.14 → 1.2.16

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.2.14",
7
+ "version": "1.2.16",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@reduxjs/toolkit": "^1.8.6",
@@ -0,0 +1,8 @@
1
+ import { ViewProps } from 'react-native';
2
+ import { PropsWithChildren } from 'react';
3
+ export interface CircularProgressProps extends PropsWithChildren<ViewProps> {
4
+ progress: number;
5
+ size: number;
6
+ strokeWidth: number;
7
+ }
8
+ export declare function CircularProgress(props: CircularProgressProps): JSX.Element;
@@ -0,0 +1,43 @@
1
+ import { View, ViewProps } from 'react-native'
2
+ import { Progress } from 'tuya-panel-kit'
3
+ import React, { PropsWithChildren } from 'react'
4
+
5
+ export interface CircularProgressProps extends PropsWithChildren<ViewProps> {
6
+ progress: number
7
+ size: number
8
+ strokeWidth: number
9
+ }
10
+
11
+ export function CircularProgress(props: CircularProgressProps) {
12
+ return <Progress
13
+ foreColor={{
14
+ '0%': '#f60',
15
+ '100%': '#f60',
16
+ }}
17
+ style={[{ width: props.size, height: props.size }, props.style]}
18
+ disabled={true}
19
+ needMaxCircle={true}
20
+ thumbRadius={Math.trunc(props.strokeWidth / 2)}
21
+ thumbStroke={'#f60'}
22
+ thumbFill={'#f60'}
23
+ thumbStrokeWidth={0}
24
+ scaleHeight={props.strokeWidth}
25
+ value={props.progress}
26
+ startDegree={270}
27
+ andDegree={360}
28
+ renderCenterView={
29
+ <View
30
+ style={{
31
+ position: 'absolute',
32
+ width: props.size - props.strokeWidth,
33
+ height: props.size - props.strokeWidth,
34
+ marginStart: props.strokeWidth,
35
+ marginTop: props.strokeWidth,
36
+ flexDirection: 'row',
37
+ justifyContent: 'center',
38
+ alignItems: 'center',
39
+ }}>
40
+ {props.children}
41
+ </View>
42
+ }/>
43
+ }
@@ -50,7 +50,7 @@ const initialState: NativeProps = {
50
50
  timeSchedule: false,
51
51
  energieverbrauch: {},
52
52
  moods: [],
53
- groupDevices: []
53
+ groupDevices: [],
54
54
  }
55
55
 
56
56
  // energy generation
@@ -108,9 +108,9 @@ const nativePropsSlice = createSlice({
108
108
  setMoods(state, action: PayloadAction<any>) {
109
109
  state.moods = action.payload
110
110
  },
111
- setGroupDevices(state, action: PayloadAction<any>){
111
+ setGroupDevices(state, action: PayloadAction<any>) {
112
112
  state.groupDevices = action.payload
113
- }
113
+ },
114
114
  },
115
115
  })
116
116
 
@@ -221,7 +221,7 @@ const useMoods = (): [any[], (v: any[]) => void] => {
221
221
  return [dps, setMoodsFn]
222
222
  }
223
223
 
224
- const useGroupDevices = (): [any[], (v: any[]) => void] =>{
224
+ const useGroupDevices = (): [any[], (v: any[]) => void] => {
225
225
  const dps = useSelector(store => store.ldvModules.groupDevices)
226
226
  const dispatch = useDispatch()
227
227
  const setGroupDevicesFn = (value: any[]) => {
@@ -275,9 +275,16 @@ export function useGroupConfigFeature<GC, GCPT extends PropertyValueTypes<GC>>
275
275
  (key: keyof GC, dpKey?: string): [GCPT | undefined, (value: GCPT, dpValue: any, extraDps?: any, extraConfig?: any) => Promise<Result<any>>] {
276
276
  const [groupConfig, setGroupConfig] = useGroupConfig<GC>()
277
277
  const setGroupConfigFeature = async (value: GCPT, dpValue: any, extraDps?: any, extraConfig?: any) => {
278
+ const sendDpKey = !!dpKey ? dpKey : GlobalParams.dpSchemaMap[snakeCase(key as string)]?.dp
279
+
280
+ const sendDps = {}
281
+ if (sendDpKey) {
282
+ sendDps[sendDpKey] = dpValue
283
+ }
284
+
278
285
  return await setGroupConfig(
279
286
  {
280
- [!!dpKey ? dpKey : GlobalParams.dpSchemaMap[snakeCase(key as string)].dp]: dpValue,
287
+ ...sendDps,
281
288
  ...(extraDps || {}),
282
289
  },
283
290
  {
@@ -0,0 +1,6 @@
1
+ export enum WorkMode {
2
+ White = 'white',
3
+ Colour = 'colour',
4
+ Scene = 'scene',
5
+ Music = 'music',
6
+ }
@@ -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