@ledvance/base 1.2.33 → 1.2.35

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.33",
7
+ "version": "1.2.35",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@reduxjs/toolkit": "^1.8.6",
@@ -12,6 +12,7 @@ export interface AdvancedData {
12
12
  statusColor: string
13
13
  router: { key: string, params?: any }
14
14
  dp?: { key: string, code: string }
15
+ icons?: number | string
15
16
  }
16
17
 
17
18
  const enableStatusColor = 'rgb(0, 201, 49)'
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback } from 'react'
2
- import { FlatList, StyleSheet, View } from 'react-native'
2
+ import { FlatList, StyleSheet, View, Image } from 'react-native'
3
3
  import AdvanceCard, { AdvancedData } from './AdvanceCard'
4
4
  import Spacer from './Spacer'
5
5
  import { useNavigation } from '@react-navigation/core'
@@ -25,15 +25,23 @@ function AdvanceList(props: AdvanceListProps) {
25
25
  if (!onAdvanceItemClick || onAdvanceItemClick(item, index)) {
26
26
  navigation.navigate(item.router.key, item.router.params)
27
27
  }
28
- }}/>
28
+ }}>
29
+ {item.icons && <View style={{
30
+ height: cx(118),
31
+ justifyContent: 'center',
32
+ alignItems: 'center',
33
+ }}>
34
+ <Image source={item.icons} style={{ width: cx(80), height: cx(80) }} />
35
+ </View>}
36
+ </AdvanceCard>
29
37
  </View>
30
38
  ), [navigation, onAdvanceItemClick])
31
39
 
32
40
  const keyExtractor = useCallback((item: AdvancedData, index: number) => item.dp?.code || `key-${index}`, [])
33
41
 
34
- const Header = useCallback(() => <Spacer height={cx(10)}/>, [])
35
- const Separator = useCallback(() => <Spacer/>, [])
36
- const Footer = useCallback(() => <Spacer height={cx(30)}/>, [])
42
+ const Header = useCallback(() => <Spacer height={cx(10)} />, [])
43
+ const Separator = useCallback(() => <Spacer />, [])
44
+ const Footer = useCallback(() => <Spacer height={cx(30)} />, [])
37
45
 
38
46
  return (
39
47
  <FlatList
@@ -44,7 +52,7 @@ function AdvanceList(props: AdvanceListProps) {
44
52
  keyExtractor={keyExtractor}
45
53
  ListHeaderComponent={Header}
46
54
  ItemSeparatorComponent={Separator}
47
- ListFooterComponent={Footer}/>
55
+ ListFooterComponent={Footer} />
48
56
  )
49
57
  }
50
58
 
@@ -19,6 +19,7 @@ export interface NativeProps {
19
19
  energieverbrauch?: object
20
20
  moods: any[]
21
21
  flags: any[]
22
+ isFlagMode: boolean
22
23
  is24HourClock: boolean
23
24
  }
24
25
 
@@ -55,6 +56,7 @@ const initialState: NativeProps = {
55
56
  energieverbrauch: {},
56
57
  moods: [],
57
58
  flags: [],
59
+ isFlagMode: false,
58
60
  is24HourClock: true
59
61
  }
60
62
 
@@ -119,6 +121,9 @@ const nativePropsSlice = createSlice({
119
121
  setFlags(state, action: PayloadAction<any>) {
120
122
  state.flags = action.payload
121
123
  },
124
+ setFlagMode(state, action: PayloadAction<any>) {
125
+ state.isFlagMode = action.payload
126
+ },
122
127
  setGroupDevices(state, action: PayloadAction<any>) {
123
128
  state.uaGroupInfo.groupDevices = action.payload
124
129
  },
@@ -244,6 +249,15 @@ const useFlags = (): [any[], (v: any[]) => void] => {
244
249
  return [dps, setFlagsFn]
245
250
  }
246
251
 
252
+ const useFlagMode = (): [boolean, (v: boolean) => void] =>{
253
+ const dps = useSelector(store => store.ldvModules.isFlagMode)
254
+ const dispatch = useDispatch()
255
+ const setFlagModeFn = (value: boolean) => {
256
+ dispatch(setFlagMode(value))
257
+ }
258
+ return [dps, setFlagModeFn]
259
+ }
260
+
247
261
  const useGroupDevices = (): [GroupDeviceInfo[], (v: GroupDeviceInfo[]) => void] => {
248
262
  const dps = useSelector(store => store.ldvModules.uaGroupInfo.groupDevices)
249
263
  const dispatch = useDispatch()
@@ -360,6 +374,7 @@ export const {
360
374
  setTimeSchedule,
361
375
  setMoods,
362
376
  setFlags,
377
+ setFlagMode,
363
378
  setGroupDevices,
364
379
  setSystemTimeFormat,
365
380
  setEnergieverbrauch,
@@ -379,6 +394,7 @@ export {
379
394
  useTimeSchedule,
380
395
  useMoods,
381
396
  useFlags,
397
+ useFlagMode,
382
398
  useGroupDevices,
383
399
  useSystemTimeFormate,
384
400
  useEnergieverbrauch,