@ledvance/base 1.2.14 → 1.2.15
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
|
@@ -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
|
-
|
|
287
|
+
...sendDps,
|
|
281
288
|
...(extraDps || {}),
|
|
282
289
|
},
|
|
283
290
|
{
|