@ledvance/group-ui-biz-bundle 1.0.54 → 1.0.56

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/group-ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.0.54",
7
+ "version": "1.0.56",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -8,15 +8,9 @@ import { Utils } from '@tuya/tuya-panel-lamp-sdk'
8
8
  import { useEffect, useState } from "react";
9
9
  import { getGlobalParamsDp } from "@ledvance/base/src/utils/common";
10
10
  import { Result } from "@ledvance/base/src/models/modules/Result";
11
+ import { FlagPageProps } from "@ledvance/group-ui-biz-bundle/src/modules/flags/FlagPage";
11
12
  const { nToHS, toFixed } = Utils
12
13
 
13
- interface LightType {
14
- isStringLight?: boolean
15
- isStripLight?: boolean
16
- isMixLight?: boolean
17
- isCeilingLight?: boolean
18
- }
19
-
20
14
  interface FlagMode {
21
15
  flagMode: boolean
22
16
  flagId?: number
@@ -28,6 +22,7 @@ interface FlagDataType {
28
22
 
29
23
  export interface FlagConfigType {
30
24
  switch_led: boolean
25
+ switch: boolean
31
26
  colour_switch: boolean
32
27
  white_switch: boolean
33
28
  work_mode: WorkMode
@@ -67,15 +62,21 @@ export function useRgbicWorkMode(): [WorkMode, (value: WorkMode) => Promise<Resu
67
62
 
68
63
  const featureId = 'Flag_data'
69
64
 
70
- type UseFlagType = (params: LightType) => [FlagDataType | undefined, (flagData: FlagDataType) => Promise<any>]
65
+ type UseFlagType = (params: FlagPageProps) => [FlagDataType | undefined, (flagData: FlagDataType) => Promise<any>]
71
66
 
72
67
  export const useFlag: UseFlagType = (params) => {
73
68
  return useFeatureHook<FlagConfigType, FlagDataType | undefined>('flagSceneConfig', undefined, undefined, (flagData) =>{
74
69
  if(flagData?.flag){
75
70
  const dps = {}
76
71
  const { flag } = flagData
77
- if (!(params.isStringLight || params.isCeilingLight)){
78
- dps[getGlobalParamsDp('scene_data')] = obj2Dp(flag, params)
72
+ if (!(params.isStripLight || params.isCeilingLight)){
73
+ const moodDp = obj2Dp(flag, params)
74
+ if (params.isStringLight){
75
+ dps[getGlobalParamsDp('rgbic_linerlight_scene')] = moodDp
76
+ }else{
77
+ dps[getGlobalParamsDp('scene_data')] = moodDp
78
+ }
79
+ dps[getGlobalParamsDp('work_mode')] = WorkMode.Scene
79
80
  }else{
80
81
  const paintHex = drawToolFormat({
81
82
  adjustCode: 3,
@@ -101,7 +102,7 @@ export const useFlag: UseFlagType = (params) => {
101
102
  dps[getGlobalParamsDp('work_mode')] = WorkMode.White
102
103
  dps[getGlobalParamsDp('rgbic_work_mode')] = WorkMode.Colour
103
104
  }
104
- dps[getGlobalParamsDp('switch_led')] = true
105
+ dps[params.switchLedCode] = true
105
106
  return dps
106
107
  }
107
108
  },
@@ -109,7 +110,7 @@ export const useFlag: UseFlagType = (params) => {
109
110
  if (flagData?.flag){
110
111
  const config = {}
111
112
  config['work_mode'] = params.isStripLight ? WorkMode.Colour : WorkMode.Scene
112
- config['switch_led'] = true
113
+ config[params.isMatterLight ? 'switch' : 'switch_led'] = true
113
114
  if (params.isCeilingLight){
114
115
  config['white_switch'] = true
115
116
  config['colour_switch'] = true
@@ -26,6 +26,7 @@ export interface FlagPageProps {
26
26
  isStripLight?: boolean
27
27
  isStringLight?: boolean
28
28
  isCeilingLight?: boolean
29
+ isMatterLight?: boolean
29
30
  isSupportTemperature?: boolean
30
31
  isSupportBrightness?: boolean
31
32
  switchLedCode: string
@@ -5,7 +5,7 @@ import {ui_biz_routerKey} from "../../navigation/Routers";
5
5
 
6
6
  const RandomTimeForPlugRouters: NavigationRoute[] = [
7
7
  {
8
- name: ui_biz_routerKey.group_ui_biz_fixed_time_plug,
8
+ name: ui_biz_routerKey.group_ui_biz_random_time_plug,
9
9
  component: RandomTimeForPlugPage,
10
10
  options:{
11
11
  hideTopbar: true,
@@ -13,7 +13,7 @@ const RandomTimeForPlugRouters: NavigationRoute[] = [
13
13
  }
14
14
  },
15
15
  {
16
- name: ui_biz_routerKey.group_ui_biz_fixed_time_plug_detail,
16
+ name: ui_biz_routerKey.group_ui_biz_random_time_plug_detail,
17
17
  component: RandomTimeForPlugDetailPage,
18
18
  options:{
19
19
  hideTopbar: true,
@@ -41,7 +41,8 @@ export enum UVCFanMode {
41
41
  }
42
42
 
43
43
 
44
- import { MoodInfo, MoodUIInfo } from "@ledvance/group-ui-biz-bundle/src/modules/mood/Interface";
44
+ import I18n from "@ledvance/base/src/i18n";
45
+ import { MoodInfo, MoodUIInfo } from "../mood_new/Interface";
45
46
 
46
47
  export interface Timer {
47
48
  status: number;
@@ -80,6 +81,8 @@ interface judgmentSupport {
80
81
  isStripLight?: boolean;
81
82
  isStringLight?: boolean;
82
83
  isMixLight?: boolean;
84
+ isFanLight?: boolean;
85
+ isUVCFan?: boolean;
83
86
  }
84
87
 
85
88
  export interface ManualSettingProps extends judgmentSupport {
@@ -94,7 +97,8 @@ export enum DeviceType {
94
97
  LightSource = 'lightSource',
95
98
  MixLight = 'mixLight',
96
99
  StripLight = 'stripLight',
97
- CeilingLight = 'ceilingLight'
100
+ CeilingLight = 'ceilingLight',
101
+ FanLight = 'fanLight'
98
102
  }
99
103
  // export type DeviceType = 'LightSource' | 'CeilingLight' | 'StringLight' | 'StripLight' | 'MixLight';
100
104
 
@@ -122,11 +126,19 @@ export interface StripLightData extends DeviceData {
122
126
  export interface CeilingLightData extends DeviceData, StripLightData, MixLightData {
123
127
  }
124
128
 
129
+ export interface FanLightData extends DeviceData {
130
+ fanSpeed: number
131
+ direction: 'forward' | 'reverse'
132
+ mode: 'nature' | 'normal'
133
+ disinfect: boolean
134
+ }
135
+
125
136
  export type ComponentConfig =
126
137
  | { type: DeviceType.LightSource; deviceData: DeviceData }
127
138
  | { type: DeviceType.MixLight; deviceData: MixLightData }
128
139
  | { type: DeviceType.StripLight; deviceData: StripLightData }
129
140
  | { type: DeviceType.CeilingLight; deviceData: CeilingLightData }
141
+ | { type: DeviceType.FanLight; deviceData: FanLightData }
130
142
 
131
143
  export interface TimeScheduleDetailState {
132
144
  timeSchedule: Timer;
@@ -148,3 +160,13 @@ export interface DeviceStateType {
148
160
  mood?: MoodInfo
149
161
  isManual: boolean
150
162
  }
163
+
164
+ export const directOptions = [
165
+ {label: I18n.getLang('ceiling_fan_tile_uvc_fan_direction_opt_1'), value: 'forward'},
166
+ {label: I18n.getLang('ceiling_fan_tile_uvc_fan_direction_opt_2'), value: 'reverse'}
167
+ ]
168
+
169
+ export const modeOptions = [
170
+ {label: I18n.getLang('ceiling_fan_tile_uvc_fan_mode_opt_1'), value: 'normal'},
171
+ {label: I18n.getLang('ceiling_fan_tile_uvc_fan_mode_opt_2'), value: 'nature'},
172
+ ]
@@ -32,6 +32,14 @@ export const defCeilingLihtDeviceData = {
32
32
  activeKey: 1
33
33
  }
34
34
 
35
+ export const defFanLightDeviceData = {
36
+ ...defDeviceData,
37
+ fanSpeed: 1,
38
+ direction: 'forward',
39
+ mode: 'normal',
40
+ disinfect: false
41
+ }
42
+
35
43
  export const addTimeSchedule = async (props: IAddSingleTime) => {
36
44
  try {
37
45
  const res = await commonApi.timerApi.addSingleTimer({
@@ -37,7 +37,7 @@ import DeleteButton from '@ledvance/base/src/components/DeleteButton';
37
37
  import SegmentControl from '@ledvance/base/src/components/segmentControl';
38
38
  import { useParams } from '@ledvance/base/src/hooks/Hooks';
39
39
  import ManualSettings from './components/ManuaSettings';
40
- import { defCeilingLihtDeviceData, defDeviceData, defMixDeviceData, defStripDeviceData } from './TimeScheduleActions';
40
+ import { defCeilingLihtDeviceData, defDeviceData, defMixDeviceData, defStripDeviceData, defFanLightDeviceData } from './TimeScheduleActions';
41
41
  import MoodItem from '../mood_new/MoodItem';
42
42
  import Summary from './components/Summary'
43
43
  import { getRemoteMoodList } from '../mood_new/MoodActions'
@@ -106,10 +106,10 @@ const TimeScheduleDetailPage = () => {
106
106
  state.unSelectedSkill = [];
107
107
  } else {
108
108
  const selectedList = cloneApplyList.filter(item =>
109
- Object.keys(timeSchedule.dps).includes(item.dp)
109
+ Object.keys(timeSchedule?.dps || {}).includes(item.dp)
110
110
  );
111
111
  const unSelectedList = cloneApplyList.filter(
112
- item => !Object.keys(timeSchedule.dps).includes(item.dp)
112
+ item => !Object.keys(timeSchedule?.dps || {}).includes(item.dp)
113
113
  );
114
114
  state.selectedSkill = mode === 'add' ? [] : selectedList;
115
115
  state.unSelectedSkill = mode === 'add' ? cloneApplyList : unSelectedList;
@@ -122,8 +122,10 @@ const TimeScheduleDetailPage = () => {
122
122
 
123
123
  if (!(Array.isArray(moods) && moods.length)) {
124
124
  state.timerId = setTimeout(() => {
125
+ console.log(props, '< --- timeSchedule props')
125
126
  getRemoteMoodList(uaGroupInfo.tyGroupId.toString(), props).then(res => {
126
127
  if (res.success && Array.isArray(res.data)) {
128
+ console.log(res.data, '< --- timeSchedule mood')
127
129
  state.moods = cloneDeep(res.data);
128
130
  setMoods(cloneDeep(res.data));
129
131
  if (!state.mood) state.mood = cloneDeep(res.data[0]);
@@ -196,8 +198,8 @@ const TimeScheduleDetailPage = () => {
196
198
  }, [state.timeSchedule.aliasName, state.selectedSkill, isModify, state.isManual, state.mood]);
197
199
 
198
200
  const showSelectedIcon = useMemo(() => {
199
- return state.selectedSkill.length !== 1 && !props.applyForDisabled;
200
- }, [state.selectedSkill.length, props.applyForDisabled]);
201
+ return props.applyForList.length !== 1 && !props.applyForDisabled;
202
+ }, [props.applyForList.length, props.applyForDisabled]);
201
203
 
202
204
  const getMoodItemEnable = useCallback((item: MoodUIInfo ) =>{
203
205
  return props.isCeilingLight ? ((item.mainLamp.id === state.mood?.mainLamp?.id) && (item.secondaryLamp.id === state.mood?.secondaryLamp?.id)) : item.id === state.mood?.id
@@ -286,8 +288,8 @@ const TimeScheduleDetailPage = () => {
286
288
  {I18n.getLang('timeschedule_add_schedule_subheadline_text')}
287
289
  </Text>
288
290
  <Spacer height={cx(10)} />
289
- <View style={styles.applyContent}>
290
- {props.applyForList.length === 0 ? (
291
+ <View style={[styles.applyContent, {paddingTop: state.selectedSkill.length ? cx(10) : 0}]}>
292
+ {state.selectedSkill.length === 0 ? (
291
293
  <Text>{I18n.getLang('timer_ceiling_fan_selectionfield_no_components_text')}</Text>
292
294
  ) : (
293
295
  state.selectedSkill.map(skill => (
@@ -529,6 +531,8 @@ const getDefaultManual = (props: TimeScheduleDetailPageParams): ComponentConfig
529
531
  ? DeviceType.MixLight
530
532
  : props.isCeilingLight
531
533
  ? DeviceType.CeilingLight
534
+ : props.isFanLight ?
535
+ DeviceType.FanLight
532
536
  : DeviceType.LightSource;
533
537
  const deviceData =
534
538
  deviceType === DeviceType.StripLight
@@ -537,6 +541,8 @@ const getDefaultManual = (props: TimeScheduleDetailPageParams): ComponentConfig
537
541
  ? defMixDeviceData
538
542
  : deviceType === DeviceType.CeilingLight
539
543
  ? defCeilingLihtDeviceData
544
+ : deviceType === DeviceType.FanLight
545
+ ? defFanLightDeviceData
540
546
  : defDeviceData;
541
547
  // @ts-ignore
542
548
  return {
@@ -565,7 +571,6 @@ const styles = StyleSheet.create({
565
571
  flex: 1,
566
572
  justifyContent: 'center',
567
573
  paddingHorizontal: cx(10),
568
- paddingTop: cx(10),
569
574
  },
570
575
  applyItem: {
571
576
  paddingLeft: cx(5),
@@ -33,8 +33,8 @@ export interface TimeSchedulePageParams {
33
33
  isMatterLight?: boolean;
34
34
  isCeilingLight?: boolean;
35
35
  isMixLight?: boolean;
36
- isSupportFan?: boolean;
37
- isSupportUVC?: boolean;
36
+ isFanLight?: boolean
37
+ isUVCFan?: boolean;
38
38
  applyForList: ApplyForItem[];
39
39
  applyForDisabled: boolean; // 是否可以选择apply for
40
40
  manualDataDp2Obj: (dps: Record<string, any>) => DeviceStateType;
@@ -1,5 +1,5 @@
1
1
  import React, { memo, useMemo } from 'react';
2
- import { CeilingLightData, DeviceType, ManualSettingProps, StripLightData } from '../Interface';
2
+ import { CeilingLightData, DeviceType, ManualSettingProps, StripLightData, directOptions, modeOptions } from '../Interface';
3
3
  import { View } from 'react-native';
4
4
  import Card from '@ledvance/base/src/components/Card';
5
5
  import LampAdjustView from '@ledvance/base/src/components/LampAdjustView';
@@ -14,6 +14,7 @@ import Spacer from '@ledvance/base/src/components/Spacer';
14
14
  import { useGroupDevices } from '@ledvance/base/src/models/modules/NativePropsSlice';
15
15
  import ApplyForDeviceList from '@ledvance/base/src/components/ApplyForDeviceList';
16
16
  import { cloneDeep } from 'lodash';
17
+ import { FanAdjustViewContent } from '@ledvance/base/src/components/FanAdjustView';
17
18
  const { convertX: cx } = Utils.RatioUtils;
18
19
 
19
20
  function ManualSettings(props: ManualSettingProps) {
@@ -50,7 +51,7 @@ function ManualSettings(props: ManualSettingProps) {
50
51
  ),
51
52
  },
52
53
  ];
53
- if(props.isCeilingLight){
54
+ if (props.isCeilingLight) {
54
55
  return tabs.filter(tab => tab.key !== 0)
55
56
  }
56
57
  if (!isSupportWhite) {
@@ -87,7 +88,7 @@ function ManualSettings(props: ManualSettingProps) {
87
88
  state.applyFlag = Symbol()
88
89
  }}
89
90
  />
90
- {item.enable && item.type !== 'socket' && (
91
+ {item.enable && (item.type !== 'socket' && item.type !== 'fan') && (
91
92
  <LampAdjustView
92
93
  isSupportColor={props.isSupportColor}
93
94
  isSupportBrightness={props.isSupportBrightness}
@@ -131,6 +132,54 @@ function ManualSettings(props: ManualSettingProps) {
131
132
  }}
132
133
  />
133
134
  )}
135
+
136
+ {item.enable && item.type === 'fan' && (
137
+ <FanAdjustViewContent
138
+ hideEnable={true}
139
+ fanEnable={item.enable}
140
+ maxFanSpeed={props.isUVCFan ? 20 : 3}
141
+ isSupportDirection={props.isUVCFan}
142
+ isSupportDisinfect={props.isUVCFan}
143
+ isSupportMode={props.isUVCFan}
144
+ directValue={''}
145
+ disinfect={true}
146
+ modeValue={''}
147
+ directOptions={directOptions}
148
+ modeOptions={modeOptions}
149
+ directChange={(direction: any) => {
150
+ state.deviceData = {
151
+ ...state.deviceData,
152
+ direction
153
+ }
154
+ state.manualFlag = Symbol()
155
+ }}
156
+ modeChange={(mode: any) => {
157
+ state.deviceData = {
158
+ ...state.deviceData,
159
+ mode
160
+ }
161
+ state.manualFlag = Symbol()
162
+ }}
163
+ disinfectChange={(disinfect: any) => {
164
+ state.deviceData = {
165
+ ...state.deviceData,
166
+ disinfect
167
+ }
168
+ state.manualFlag = Symbol()
169
+ }}
170
+ // @ts-ignore
171
+ fanSpeed={deviceData.fanSpeed}
172
+ onFanSwitch={() => {}}
173
+ onFanSpeedChangeComplete={(fanSpeed) => {
174
+ state.deviceData = {
175
+ ...state.deviceData,
176
+ fanSpeed
177
+ }
178
+ state.manualFlag = Symbol()
179
+ }}
180
+ />
181
+ )}
182
+
134
183
  <ApplyForDeviceList
135
184
  devices={cloneDeep(groupDevices)}
136
185
  />