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

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.56",
7
+ "version": "1.0.58",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -37,6 +37,8 @@ export interface SceneDataConfigType {
37
37
  colour_switch: boolean
38
38
  white_switch: boolean
39
39
  switch: boolean
40
+ switch_fan: boolean
41
+ fan_switch: boolean
40
42
  }
41
43
 
42
44
  export function useSwitchLed(params: MoodPageParams): boolean {
@@ -68,7 +70,19 @@ export function useMoodScene(params: MoodPageParams): [SceneDataType, (value: Sc
68
70
  if (mainDp && params.mainDp) {
69
71
  dps[params.mainDp] = mainDp
70
72
  dps[params.mainSwitch] = true
71
- dps[params.mainWorkMode] = WorkMode.Scene
73
+ dps[params.mainWorkMode] = WorkMode.Scene
74
+ if (params.isUVCFan){
75
+ dps[getGlobalParamsDp('fan_switch')] = mainLamp.fanEnable
76
+ // if (mainLamp.fanEnable){
77
+ // dps[getGlobalParamsDp('fan_speed')] = mainLamp.fanSpeed
78
+ // }
79
+ }
80
+ if (params.isFanLight && !params.isUVCFan){
81
+ dps[getGlobalParamsDp('switch_fan')] = mainLamp.fanEnable
82
+ // if (mainLamp.fanEnable){
83
+ // dps[getGlobalParamsDp('fan_speed')] = mainLamp.fanSpeed
84
+ // }
85
+ }
72
86
  }
73
87
  }
74
88
  if (secondaryLamp.nodes.length && params.isCeilingLight) {
@@ -98,6 +112,16 @@ export function useMoodScene(params: MoodPageParams): [SceneDataType, (value: Sc
98
112
  } else {
99
113
  config.switch_led = true
100
114
  }
115
+ if (params.isUVCFan || params.isFanLight){
116
+ if (mainLamp.fanEnable){
117
+ if(params.isUVCFan){
118
+ config.fan_switch = true
119
+ }
120
+ if (params.isFanLight && !params.isUVCFan){
121
+ config.switch_fan = true
122
+ }
123
+ }
124
+ }
101
125
  }
102
126
  if (secondaryLamp?.nodes?.length) {
103
127
  if (params.isCeilingLight) {
@@ -52,20 +52,20 @@ const MoodPage = () => {
52
52
  flag: Symbol(),
53
53
  });
54
54
 
55
- const moodIds = useMemo(() =>{
55
+ const moodIds = useMemo(() => {
56
56
  const mainIds = map(state.originMoods, 'id').filter(v => v !== undefined)
57
57
  const secondaryIds = map(state.originMoods.map(m => m.secondaryLamp) || [], 'id')
58
- return filter([...mainIds, ... secondaryIds], v => v !== undefined) as number[]
58
+ return filter([...mainIds, ...secondaryIds], v => v !== undefined) as number[]
59
59
  }, [JSON.stringify(state.originMoods)])
60
60
 
61
61
  useEffect(() => {
62
62
  state.timerId = setTimeout(() => {
63
- state.loading = true
63
+ state.loading = true
64
64
  getRemoteMoodList(
65
65
  uaGroupInfo.tyGroupId.toString(),
66
66
  params
67
67
  ).then(res => {
68
- state.loading = false
68
+ state.loading = false
69
69
  if (res.success && Array.isArray(res.data)) {
70
70
  state.originMoods = cloneDeep(res.data);
71
71
  console.log(state.originMoods, '< --- originMoods')
@@ -188,14 +188,14 @@ const MoodPage = () => {
188
188
  }
189
189
  const mood = mode === 'del' ? (newScene.length === 0 ? undefined : newScene[0]) : checkedMood;
190
190
  const res = await saveMoodList(uaGroupInfo.tyGroupId.toString(), newScene, params);
191
- console.log(res, '< --- save res')
192
191
  if (res.success) {
193
192
  state.originMoods = cloneDeep(newScene);
194
193
  setMoods(cloneDeep(newScene));
195
- if ((mode === 'del' && (params.isCeilingLight ?
196
- (moodInfo.scene?.mainLamp.id !== checkedMood.mainLamp.id || moodInfo.scene?.secondaryLamp.id !== checkedMood.secondaryLamp.id) :
197
- moodInfo.scene?.id !== checkedMood.id)) ||
198
- (params.isCeilingLight ? (workMode !== WorkMode.Scene && rgbicWorkMode !== WorkMode.Scene) : workMode !== WorkMode.Scene) || !switchLed) {
194
+ if (mode === 'del' && ((params.isCeilingLight ?
195
+ (moodInfo.scene?.mainLamp.id !== checkedMood.mainLamp.id || moodInfo.scene?.secondaryLamp.id !== checkedMood.secondaryLamp.id) :
196
+ moodInfo.scene?.id !== checkedMood.id) ||
197
+ (params.isCeilingLight ? (workMode !== WorkMode.Scene && rgbicWorkMode !== WorkMode.Scene) : workMode !== WorkMode.Scene) ||
198
+ !switchLed)) {
199
199
  return {
200
200
  success: true
201
201
  }
@@ -243,7 +243,7 @@ const MoodPage = () => {
243
243
  },
244
244
  [moodInfo]
245
245
  );
246
-
246
+
247
247
  const nameRepeat = useCallback((mood: MoodUIInfo) => {
248
248
  return !!state.originMoods.filter(m => !(params.isCeilingLight ? (m.mainLamp.id === mood.mainLamp.id && m.secondaryLamp.id === mood.secondaryLamp.id) : (m.id === mood.id))).find(m => m.name === mood.name)
249
249
  }, [state.originMoods, params.isCeilingLight])
@@ -47,11 +47,12 @@ const StaticMoodEditorPage = () => {
47
47
  const params = cloneDeep(routeParams);
48
48
  const moduleParams = params.moduleParams;
49
49
  const isMix = !!(moduleParams.isCeilingLight || moduleParams.isMixLight);
50
+ console.log(params.currentMood, '< -- currentMood')
50
51
  const state = useReactive<StaticMoodEditorPageState>({
51
52
  headline: '',
52
53
  mood: params.currentMood,
53
54
  mainNode: params.currentMood.mainLamp.nodes[0],
54
- secondaryNode: params.currentMood?.secondaryLamp?.nodes[0],
55
+ secondaryNode: params.currentMood?.secondaryLamp?.nodes?.[0],
55
56
  loading: false,
56
57
  });
57
58
 
@@ -144,6 +144,7 @@ export interface TimeScheduleDetailState {
144
144
  timeSchedule: Timer;
145
145
  dps: Record<string, any>;
146
146
  isManual: boolean;
147
+ initSelectedSkill: ApplyForItem[],
147
148
  selectedSkill: ApplyForItem[];
148
149
  unSelectedSkill: ApplyForItem[];
149
150
  loading: boolean;
@@ -42,6 +42,7 @@ import MoodItem from '../mood_new/MoodItem';
42
42
  import Summary from './components/Summary'
43
43
  import { getRemoteMoodList } from '../mood_new/MoodActions'
44
44
  import { MoodUIInfo } from '../mood_new/Interface';
45
+ import InfoText from '@ledvance/base/src/components/InfoText';
45
46
 
46
47
  const { convertX: cx } = Utils.RatioUtils;
47
48
  const { toFixedString } = Utils.NumberUtils;
@@ -62,6 +63,7 @@ const TimeScheduleDetailPage = () => {
62
63
  timeSchedule: props.mode === 'add' ? newTimeSchedule() : cloneDeep(props.timeSchedule),
63
64
  dps: props.mode === 'add' ? {} : props.timeSchedule.dps,
64
65
  isManual: true, // manual ,mood
66
+ initSelectedSkill: [] as ApplyForItem[],
65
67
  selectedSkill: [] as ApplyForItem[],
66
68
  unSelectedSkill: [] as ApplyForItem[],
67
69
  loading: false,
@@ -119,13 +121,11 @@ const TimeScheduleDetailPage = () => {
119
121
  state.isManual = isManual;
120
122
  state.mood = mood;
121
123
  }
122
-
124
+ state.initSelectedSkill = cloneDeep(state.selectedSkill)
123
125
  if (!(Array.isArray(moods) && moods.length)) {
124
126
  state.timerId = setTimeout(() => {
125
- console.log(props, '< --- timeSchedule props')
126
127
  getRemoteMoodList(uaGroupInfo.tyGroupId.toString(), props).then(res => {
127
128
  if (res.success && Array.isArray(res.data)) {
128
- console.log(res.data, '< --- timeSchedule mood')
129
129
  state.moods = cloneDeep(res.data);
130
130
  setMoods(cloneDeep(res.data));
131
131
  if (!state.mood) state.mood = cloneDeep(res.data[0]);
@@ -171,6 +171,7 @@ const TimeScheduleDetailPage = () => {
171
171
  : props.manualDataDp2Obj(props.timeSchedule.dps).deviceData;
172
172
  const before = {
173
173
  ...schedule,
174
+ selectedSkill: state.initSelectedSkill,
174
175
  dps: manual,
175
176
  isManual:
176
177
  props.mode === 'add' ? true : props.manualDataDp2Obj(props.timeSchedule.dps).isManual,
@@ -180,22 +181,28 @@ const TimeScheduleDetailPage = () => {
180
181
  before.mood = (before.isManual || props.mode === 'add') ? undefined : props.manualDataDp2Obj(props.timeSchedule.dps)?.mood
181
182
  const now = {
182
183
  ...state.timeSchedule,
184
+ selectedSkill: state.selectedSkill,
183
185
  dps: state.manualData,
184
186
  isManual: state.isManual,
185
187
  mood: state.isManual ? undefined : state.mood,
186
188
  id: 1,
187
189
  };
188
190
  return isEqual(before, now);
189
- }, [JSON.stringify(state.timeSchedule), state.manualData, state.isManual, state.mood]);
191
+ }, [JSON.stringify(state.timeSchedule), JSON.stringify(state.initSelectedSkill), JSON.stringify(state.selectedSkill), state.manualData, state.isManual, state.mood]);
192
+
193
+ const showMoodFanSelectText = useMemo(() =>{
194
+ return (props.isUVCFan || props.isFanLight) && !state.isManual && state.selectedSkill.length < 2
195
+ }, [props.isUVCFan, props.isFanLight, state.selectedSkill.length, state.isManual])
190
196
 
191
197
  const allowSubmit = useMemo(() => {
192
198
  return (
193
199
  (state.timeSchedule.aliasName.length && state.timeSchedule.aliasName.length < 33) &&
194
200
  state.selectedSkill.length &&
195
201
  (state.isManual ? state.isManual : !!state.mood) &&
196
- !isModify
202
+ !isModify &&
203
+ !showMoodFanSelectText
197
204
  );
198
- }, [state.timeSchedule.aliasName, state.selectedSkill, isModify, state.isManual, state.mood]);
205
+ }, [state.timeSchedule.aliasName, state.selectedSkill, isModify, state.isManual, state.mood, showMoodFanSelectText]);
199
206
 
200
207
  const showSelectedIcon = useMemo(() => {
201
208
  return props.applyForList.length !== 1 && !props.applyForDisabled;
@@ -354,6 +361,18 @@ const TimeScheduleDetailPage = () => {
354
361
  </>
355
362
  )}
356
363
  <Spacer height={cx(10)} />
364
+ {(!state.selectedSkill.length && !showMoodFanSelectText) && <InfoText
365
+ style={{marginHorizontal: cx(24)}}
366
+ icon={res.ic_warning_amber}
367
+ contentColor="#FF9500"
368
+ text={I18n.getLang('timeschedule_add_schedule_no_device_warning_text')}
369
+ />}
370
+ {showMoodFanSelectText && <InfoText
371
+ style={{marginHorizontal: cx(24)}}
372
+ icon={res.ic_warning_amber}
373
+ contentColor="#FF9500"
374
+ text={I18n.getLang('timeschedule_add_schedule_devicestate_sec_warning_text')}
375
+ />}
357
376
  {state.isManual ? (
358
377
  <ManualSettings
359
378
  dps={state.dps}
@@ -375,7 +394,7 @@ const TimeScheduleDetailPage = () => {
375
394
  }}
376
395
  />
377
396
  ) : (
378
- <FlatList
397
+ !showMoodFanSelectText ? <FlatList
379
398
  data={state.moods}
380
399
  renderItem={({ item }) => {
381
400
  return (
@@ -393,7 +412,7 @@ const TimeScheduleDetailPage = () => {
393
412
  ItemSeparatorComponent={() => <Spacer />}
394
413
  ListFooterComponent={() => <Spacer />}
395
414
  keyExtractor={item => `${item.name}`}
396
- />
415
+ /> : <View></View>
397
416
  )}
398
417
  <Spacer />
399
418