@ledvance/group-ui-biz-bundle 1.0.50 → 1.0.51
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
|
@@ -11,15 +11,35 @@ import {hex2Int, spliceByStep} from '@ledvance/base/src/utils/common'
|
|
|
11
11
|
import I18n from '@ledvance/base/src/i18n'
|
|
12
12
|
import BiologicalRes from './res/BiologicalRes'
|
|
13
13
|
import { to16 } from '@tuya/tuya-panel-lamp-sdk/lib/utils'
|
|
14
|
+
import { useCallback } from 'react'
|
|
15
|
+
import { Result } from '@ledvance/base/src/models/modules/Result'
|
|
14
16
|
|
|
15
17
|
interface BiorhythmConfig {
|
|
16
18
|
rhythm_mode: BiorhythmBean
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
export const useBiorhythm = () => {
|
|
20
|
-
|
|
21
|
+
export const useBiorhythm = (): [BiorhythmBean, (value: BiorhythmBean) => Promise<Result<any>>] => {
|
|
22
|
+
const [config, setConfig] = useFeatureHook<BiorhythmConfig, BiorhythmBean>('rhythm_mode', getDefBiorhythmUIState(), (val) => {
|
|
21
23
|
return obj2Dp(val)
|
|
22
24
|
})
|
|
25
|
+
const supportOldData = useCallback((oldData: BiorhythmBean) =>{
|
|
26
|
+
return {
|
|
27
|
+
...oldData,
|
|
28
|
+
planList: oldData.planList.map(p => {
|
|
29
|
+
// @ts-ignore 老数据中使用的是startTime
|
|
30
|
+
if (!p.hasOwnProperty('time') && p.startTime){
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
const t = p.startTime.split(':')
|
|
33
|
+
return {
|
|
34
|
+
...p,
|
|
35
|
+
time: Number(t[0]) * 60 + Number(t[1])
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return p
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
}, [])
|
|
42
|
+
return [supportOldData(config), setConfig]
|
|
23
43
|
}
|
|
24
44
|
|
|
25
45
|
export function dp2Obj(dp: string): BiorhythmBean {
|
|
@@ -39,7 +39,7 @@ export interface FlagConfigType {
|
|
|
39
39
|
export const useFlagMode = () : [FlagMode, (flagMode: FlagMode) => Promise<Result<any>>] =>{
|
|
40
40
|
const uaGroupInfo = useUAGroupInfo()
|
|
41
41
|
const [config, setConfig] = useGroupEzvizConfig<FlagConfigType, FlagMode>('flagMode', undefined)
|
|
42
|
-
const [cloudConfig, setCloudConfig] = useState()
|
|
42
|
+
const [cloudConfig, setCloudConfig] = useState<FlagMode>({flagMode: false, flagId: undefined})
|
|
43
43
|
useEffect(() =>{
|
|
44
44
|
if (!config) {
|
|
45
45
|
getFlagMode(uaGroupInfo.tyGroupId.toString()).then(res =>{
|