@ledvance/ui-biz-bundle 1.1.77 → 1.1.79

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/ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.1.77",
7
+ "version": "1.1.79",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -56,11 +56,15 @@ const FlagEditPage = () => {
56
56
  }, [state.currentNode, state.currentWhiteNode])
57
57
 
58
58
  useUpdateEffect(() =>{
59
- state.currentNode = state.mood.colors[state.colorPaintBucketIdx]
59
+ if (state.colorPaintBucketIdx < state.mood.colors.length) {
60
+ state.currentNode = state.mood.colors[state.colorPaintBucketIdx]
61
+ }
60
62
  }, [JSON.stringify(state.mood.colors), state.colorPaintBucketIdx])
61
63
 
62
64
  useUpdateEffect(() =>{
63
- state.currentWhiteNode = state.mood.whiteColors[state.whitePaintBucketIdx]
65
+ if (state.whitePaintBucketIdx < state.mood.whiteColors.length) {
66
+ state.currentWhiteNode = state.mood.whiteColors[state.whitePaintBucketIdx]
67
+ }
64
68
  }, [JSON.stringify(state.mood.whiteColors), state.whitePaintBucketIdx])
65
69
 
66
70
  const checkMoodDataChanged = useMemo(() =>{
@@ -101,7 +101,7 @@ export const useFixedTime: UseFixedTimeType = (dpKey, isPlug, disableFeature) =>
101
101
  }
102
102
  }
103
103
  })
104
- }, 300)
104
+ }, 200)
105
105
 
106
106
  return () => clearTimeout(fixedTimer)
107
107
  }, [fixedTimeDp])
@@ -197,7 +197,7 @@ const fixedTimeDp2Obj = (fixedDp: string, isPlug?: boolean) => {
197
197
  brightness,
198
198
  temperature
199
199
  },
200
- isColorMode: !!(h && s && v)
200
+ isColorMode: !!(h !== 0 || s !== 0 || v !== 0)
201
201
  }
202
202
  })
203
203
  return {
@@ -38,15 +38,21 @@ const FixedTimeDetailPage = () => {
38
38
  const is24Hour = useSystemTimeFormate()
39
39
  const state = useReactive({
40
40
  loading: false,
41
- isColorMode: false,
42
- fixedTime: cloneDeep(params.scheduleItem)
41
+ fixedTime: cloneDeep(params.scheduleItem),
42
+ initFixedTime: cloneDeep(params.scheduleItem)
43
43
  })
44
44
 
45
45
  useEffect(() => {
46
46
  if (!params.isPlug && state.fixedTime.color) {
47
47
  const { brightness, temperature, h, s, v } = state.fixedTime.color
48
48
  const isColor = brightness === 0 && temperature === 0 && (h !== 0 || s !== 0 || v !== 0)
49
- state.isColorMode = isColor
49
+ if (isColor) {
50
+ state.fixedTime.color.brightness = 100;
51
+ } else {
52
+ state.fixedTime.color.s = 100;
53
+ state.fixedTime.color.v = 100;
54
+ }
55
+ state.initFixedTime = cloneDeep(state.fixedTime)
50
56
  }
51
57
  }, [])
52
58
 
@@ -66,8 +72,8 @@ const FixedTimeDetailPage = () => {
66
72
  }, [JSON.stringify(state.fixedTime)])
67
73
 
68
74
  const checkItemChanged = useMemo(() =>{
69
- return isEqual(state.fixedTime, params.scheduleItem)
70
- }, [params.scheduleItem, JSON.stringify(state.fixedTime)])
75
+ return isEqual(state.fixedTime, state.initFixedTime)
76
+ }, [state.initFixedTime, JSON.stringify(state.fixedTime)])
71
77
 
72
78
  const canSubmit = useMemo(() => {
73
79
  return state.fixedTime.name?.length > 0 && state.fixedTime.name?.length < 33 && !checkItemChanged && inRangeTime && state.fixedTime.channel !== undefined
@@ -91,11 +97,11 @@ const FixedTimeDetailPage = () => {
91
97
  }
92
98
  if (!params.isPlug && state.fixedTime.color) {
93
99
  editFixedTime.color = {
94
- h: state.isColorMode ? state.fixedTime.color?.h : 0,
95
- s: state.isColorMode ? state.fixedTime.color?.s : 0,
96
- v: state.isColorMode ? state.fixedTime.color?.v : 0,
97
- temperature: state.isColorMode ? 0 : state.fixedTime.color?.temperature,
98
- brightness: state.isColorMode ? 0 : state.fixedTime.color?.brightness
100
+ h: state.fixedTime.isColorMode ? state.fixedTime.color?.h : 0,
101
+ s: state.fixedTime.isColorMode ? state.fixedTime.color?.s : 0,
102
+ v: state.fixedTime.isColorMode ? state.fixedTime.color?.v : 0,
103
+ temperature: state.fixedTime.isColorMode ? 0 : state.fixedTime.color?.temperature,
104
+ brightness: state.fixedTime.isColorMode ? 0 : state.fixedTime.color?.brightness
99
105
  }
100
106
  }
101
107
  const res = await params.onPost(params.mode, editFixedTime)
@@ -190,9 +196,9 @@ const FixedTimeDetailPage = () => {
190
196
  isSupportColor={!!params.isSupportColor}
191
197
  isSupportBrightness={!!params.isSupportBrightness}
192
198
  isSupportTemperature={!!params.isSupportTemperature}
193
- isColorMode={state.isColorMode}
199
+ isColorMode={state.fixedTime.isColorMode ?? false}
194
200
  reserveSV={true}
195
- setIsColorMode={(v) => state.isColorMode = v}
201
+ setIsColorMode={(v) => state.fixedTime.isColorMode = v}
196
202
  h={state.fixedTime.color.h}
197
203
  s={state.fixedTime.color.s}
198
204
  v={state.fixedTime.color.v}
@@ -66,7 +66,7 @@ const AddMoodPage = () => {
66
66
  ? ui_biz_routerKey.ui_biz_dynamic_mix_mood_edit
67
67
  : ui_biz_routerKey.ui_biz_dynamic_mood_edit;
68
68
  const currentMood = moodItem.mainLamp
69
- ? { ...moodItem, id: mainId, mainLamp: { ...moodItem.mainLamp, id: mainId }, secondaryLamp: { ...moodItem.secondaryLamp, id: secondaryId } }
69
+ ? { ...moodItem, id: mainId, mainLamp: { ...moodItem.mainLamp, id: mainId }, secondaryLamp: { ...moodItem.secondaryLamp, id: moodItem.secondaryLamp?.nodes?.length ? secondaryId : -1 } }
70
70
  : newMood(mainId, secondaryId, moduleParams.isSupportColor, routeParams.isStatic, moduleParams);
71
71
  navigation.navigate(url, {
72
72
  ...routeParams,
@@ -182,7 +182,7 @@ function newMood(
182
182
  nodes: isStatic ? [node] : [node, { ...node }],
183
183
  },
184
184
  secondaryLamp: {
185
- id: secondaryId,
185
+ id: isStatic ? -1 : secondaryId,
186
186
  enable: true,
187
187
  mode: MoodJumpGradientMode.StripJump,
188
188
  speed: 75,
@@ -55,7 +55,8 @@ const MoodPage = () => {
55
55
  });
56
56
 
57
57
  const moodIds = useMemo(() => {
58
- const mainIds = map(state.originMoods, 'id').filter(v => v !== undefined)
58
+ // @ts-ignore
59
+ const mainIds = map(params.isCeilingLight ? (state.originMoods.map(m => m.mainLamp) || []) : state.originMoods, 'id').filter(v => v !== undefined)
59
60
  const secondaryIds = map(state.originMoods.map(m => m.secondaryLamp) || [], 'id')
60
61
  return filter([...mainIds, ...secondaryIds], v => v !== undefined) as number[]
61
62
  }, [JSON.stringify(state.originMoods)])
@@ -102,7 +102,7 @@ export const useRandomTime: UseFixedTimeType = (dpKey: string, isPlug?: boolean,
102
102
  }
103
103
  }
104
104
  })
105
- }, 300)
105
+ }, 200)
106
106
 
107
107
  return () => clearTimeout(randomTimer)
108
108
  }, [randomTimeDp])
@@ -195,7 +195,7 @@ const randomTimeDp2Obj = (randomDp: string, isPlug?: boolean) => {
195
195
  brightness,
196
196
  temperature
197
197
  },
198
- isColorMode: !!(h && s && v)
198
+ isColorMode: !!(h !== 0 || s !== 0 || v !== 0)
199
199
  }
200
200
  })
201
201
  return {
@@ -35,21 +35,28 @@ const RandomTimeDetailPage = () => {
35
35
  const is24Hour = useSystemTimeFormate()
36
36
  const state = useReactive({
37
37
  loading: false,
38
- isColorMode: false,
39
- randomTime: cloneDeep(params.scheduleItem)
38
+ randomTime: cloneDeep(params.scheduleItem),
39
+ initRandomTime: cloneDeep(params.scheduleItem)
40
40
  })
41
41
 
42
42
  useEffect(() => {
43
43
  if (!params.isPlug && state.randomTime.color) {
44
44
  const { brightness, temperature, h, s, v } = state.randomTime.color
45
45
  const isColor = brightness === 0 && temperature === 0 && (h !== 0 || s !== 0 || v !== 0)
46
- state.isColorMode = isColor
46
+ state.randomTime.isColorMode = isColor
47
+ if (isColor) {
48
+ state.randomTime.color.brightness = 100;
49
+ } else {
50
+ state.randomTime.color.s = 100;
51
+ state.randomTime.color.v = 100;
52
+ }
53
+ state.initRandomTime = cloneDeep(state.randomTime)
47
54
  }
48
55
  }, [])
49
56
 
50
57
  const checkItemChanged = useMemo(() =>{
51
- return isEqual(state.randomTime, params.scheduleItem)
52
- }, [params.scheduleItem, JSON.stringify(state.randomTime)])
58
+ return isEqual(state.randomTime, state.initRandomTime)
59
+ }, [JSON.stringify(state.initRandomTime), JSON.stringify(state.randomTime)])
53
60
 
54
61
  const canSubmit = useMemo(() => {
55
62
  return state.randomTime.name?.length > 0 && state.randomTime.name?.length < 33 && !checkItemChanged && state.randomTime.channel !== undefined
@@ -85,11 +92,11 @@ const RandomTimeDetailPage = () => {
85
92
  }
86
93
  if (!params.isPlug && state.randomTime.color) {
87
94
  editRandomTime.color = {
88
- h: state.isColorMode ? state.randomTime.color?.h : 0,
89
- s: state.isColorMode ? state.randomTime.color?.s : 0,
90
- v: state.isColorMode ? state.randomTime.color?.v : 0,
91
- temperature: state.isColorMode ? 0 : state.randomTime.color?.temperature,
92
- brightness: state.isColorMode ? 0 : state.randomTime.color?.brightness
95
+ h: state.randomTime.isColorMode ? state.randomTime.color?.h : 0,
96
+ s: state.randomTime.isColorMode ? state.randomTime.color?.s : 0,
97
+ v: state.randomTime.isColorMode ? state.randomTime.color?.v : 0,
98
+ temperature: state.randomTime.isColorMode ? 0 : state.randomTime.color?.temperature,
99
+ brightness: state.randomTime.isColorMode ? 0 : state.randomTime.color?.brightness
93
100
  }
94
101
  }
95
102
  const res = await params.onPost(params.mode, editRandomTime)
@@ -184,9 +191,9 @@ const RandomTimeDetailPage = () => {
184
191
  isSupportColor={!!params.isSupportColor}
185
192
  isSupportBrightness={!!params.isSupportBrightness}
186
193
  isSupportTemperature={!!params.isSupportTemperature}
187
- isColorMode={state.isColorMode}
194
+ isColorMode={state.randomTime.isColorMode ?? false}
188
195
  reserveSV={true}
189
- setIsColorMode={(v) => state.isColorMode = v}
196
+ setIsColorMode={(v) => state.randomTime.isColorMode = v}
190
197
  h={state.randomTime.color.h}
191
198
  s={state.randomTime.color.s}
192
199
  v={state.randomTime.color.v}
@@ -9,6 +9,7 @@ import { useParams } from '@ledvance/base/src/hooks/Hooks';
9
9
  import Card from '@ledvance/base/src/components/Card';
10
10
  import Spacer from '@ledvance/base/src/components/Spacer';
11
11
  import { Utils } from 'tuya-panel-kit'
12
+ import {showDialog} from "@ledvance/base/src/utils/common";
12
13
 
13
14
  const { convertX: cx } = Utils.RatioUtils
14
15
 
@@ -38,9 +39,26 @@ const RemoteControlPage = () => {
38
39
  colorAlpha={1}
39
40
  enable={remoteControl}
40
41
  setEnable={async v => {
41
- state.loading = true;
42
- await setRemoteControl(v);
43
- state.loading = false;
42
+ if (state.loading) {
43
+ return
44
+ }
45
+ if (v) {
46
+ showDialog({
47
+ method: 'confirm',
48
+ title: I18n.getLang('Remotecontrol_Title'),
49
+ subTitle: I18n.getLang('Remotecontrol_description'),
50
+ onConfirm: async (_, { close }) => {
51
+ close()
52
+ state.loading = true
53
+ await setRemoteControl(v)
54
+ state.loading = false
55
+ }
56
+ })
57
+ } else {
58
+ state.loading = true
59
+ await setRemoteControl(v)
60
+ state.loading = false
61
+ }
44
62
  }}
45
63
  />
46
64
  </Card>
@@ -121,7 +121,7 @@ const wakeUpDp2Obj = (dp: string): WakeUpData | undefined => {
121
121
  enable, weeks, delay, hour, minute, h, s, v, brightness, temperature, last, nodeHex, isSleep: false,
122
122
  startTime,
123
123
  endTime,
124
- isColorMode: !!(h && s && v)
124
+ isColorMode: !!(h !== 0 || s !== 0 || v !== 0)
125
125
  }
126
126
  })
127
127
  return {
@@ -266,7 +266,7 @@ export const sleepDp2Obj = (dp: string): SleepData | undefined => {
266
266
  enable, weeks, delay, hour, minute, h, s, v, brightness, temperature, nodeHex, isSleep: true,
267
267
  startTime,
268
268
  endTime,
269
- isColorMode: !!(h && s && v)
269
+ isColorMode: !!(h !== 0 || s !== 0 || v !== 0)
270
270
  }
271
271
  })
272
272
  return {
@@ -92,9 +92,6 @@ export interface StripLightData extends DeviceData {
92
92
  colorDiskActiveKey: number
93
93
  }
94
94
 
95
- export interface CeilingLightData extends DeviceData, StripLightData, MixLightData {
96
- }
97
-
98
95
  export interface FanLightData extends DeviceData {
99
96
  fanSpeed: number
100
97
  direction: 'forward' | 'reverse'
@@ -106,7 +103,6 @@ export type ComponentConfig =
106
103
  | { type: DeviceType.LightSource; deviceData: DeviceData }
107
104
  | { type: DeviceType.MixLight; deviceData: MixLightData }
108
105
  | { type: DeviceType.StripLight; deviceData: StripLightData }
109
- | { type: DeviceType.CeilingLight; deviceData: CeilingLightData }
110
106
  | { type: DeviceType.FanLight; deviceData: FanLightData }
111
107
  | { type: DeviceType.PowerStrip; deviceData: DeviceData}
112
108
 
@@ -19,10 +19,19 @@ export const defMixDeviceData = {
19
19
 
20
20
  export const defStripDeviceData = {
21
21
  ...defDeviceData,
22
- activeKey: 0,
22
+ activeKey: 1,
23
23
  colors: ColorList[0],
24
+ colorDiskActiveKey: 0
24
25
  };
25
26
 
27
+ export const defFanLightDeviceData = {
28
+ ...defDeviceData,
29
+ fanSpeed: 1,
30
+ direction: 'forward',
31
+ mode: 'normal',
32
+ disinfect: false
33
+ }
34
+
26
35
  export const getTimeSchedule = async (deviceId: string): Promise<Timer[]> => {
27
36
  const res = await NativeApi.getAllTaskTimer(deviceId);
28
37
  if (res.success && Array.isArray(res.data)) {
@@ -39,10 +39,10 @@ import InfoText from '@ledvance/base/src/components/InfoText';
39
39
  import SegmentControl from '@ledvance/base/src/components/segmentControl';
40
40
  import { useParams } from '@ledvance/base/src/hooks/Hooks';
41
41
  import ManualSettings from './components/ManuaSettings';
42
- import { defDeviceData, defMixDeviceData, defStripDeviceData } from './TimeScheduleActions';
42
+ import { defDeviceData, defFanLightDeviceData, defMixDeviceData, defStripDeviceData } from './TimeScheduleActions';
43
43
  import MoodItem from '../mood/MoodItem';
44
44
  import { getRemoteMoodList } from '../mood/MoodActions';
45
- import { MoodUIInfo } from '@ledvance/ui-biz-bundle/src/newModules/mood/Interface';
45
+ import { MoodUIInfo } from '../mood/Interface';
46
46
  import Summary from '@ledvance/base/src/components/Summary'
47
47
 
48
48
  const { convertX: cx } = Utils.RatioUtils;
@@ -161,11 +161,8 @@ const TimeScheduleDetailPage = (props: { theme?: any }) => {
161
161
  if (typeof time === 'number') {
162
162
  return `${toFixedString(Math.trunc(time / 60), 2)}:${toFixedString(time % 60, 2)}`;
163
163
  }
164
- if (typeof time === 'string') {
165
- const t = time.split(':');
166
- return Number(t[0]) * 60 + Number(t[1]);
167
- }
168
- return time;
164
+ const t = time.split(':');
165
+ return Number(t[0]) * 60 + Number(t[1]);
169
166
  }, []);
170
167
 
171
168
  const isModify = useMemo(() => {
@@ -460,6 +457,7 @@ const TimeScheduleDetailPage = (props: { theme?: any }) => {
460
457
  isSupportBrightness={params.isSupportBrightness}
461
458
  isSupportTemperature={params.isSupportTemperature}
462
459
  isStripLight={params.isStripLight}
460
+ isCeilingLight={params.isCeilingLight}
463
461
  manualData={state.manualData}
464
462
  onManualChange={manual => {
465
463
  state.manualData = {
@@ -622,21 +620,28 @@ const newTimeSchedule = () => {
622
620
 
623
621
  const getDefaultManual = (props: TimeScheduleDetailPageParams): ComponentConfig => {
624
622
  const deviceType =
625
- props.isStripLight || props.isCeilingLight
623
+ props.isStripLight
626
624
  ? DeviceType.StripLight
627
625
  : props.isMixLight
628
626
  ? DeviceType.MixLight
629
627
  : props.isPowerStrip
630
628
  ? DeviceType.PowerStrip
631
- : DeviceType.LightSource;
632
- const deviceData =
633
- deviceType === DeviceType.StripLight
634
- ? defStripDeviceData
635
- : deviceType === DeviceType.MixLight
636
- ? defMixDeviceData
637
- : defDeviceData;
638
- // @ts-ignore
629
+ : props.isFanLight
630
+ ? DeviceType.FanLight
631
+ : props.isCeilingLight
632
+ ? DeviceType.CeilingLight
633
+ : DeviceType.LightSource
634
+ const deviceData =
635
+ (deviceType === DeviceType.StripLight || deviceType === DeviceType.CeilingLight)
636
+ ? defStripDeviceData
637
+ : deviceType === DeviceType.MixLight
638
+ ? defMixDeviceData
639
+ : deviceType === DeviceType.FanLight
640
+ ? defFanLightDeviceData
641
+ : defDeviceData;
642
+
639
643
  return {
644
+ // @ts-ignore
640
645
  type: deviceType,
641
646
  deviceData: {
642
647
  ...deviceData,
@@ -41,7 +41,7 @@ export interface TimeSchedulePageParams {
41
41
  isPowerStrip?: boolean
42
42
  featureId?: string
43
43
  applyForList: ApplyForItem[];
44
- applyForDisabled: boolean; // 是否可以选择apply for
44
+ applyForDisabled?: boolean; // 是否可以选择apply for
45
45
  manualDataDp2Obj: (dps: Record<string, any>) => DeviceStateType;
46
46
  manualDataObj2Dp: (deviceState: DeviceStateType, applyForList: ApplyForItem[]) => Record<string, any>;
47
47
  }
@@ -194,7 +194,7 @@ const TimeSchedulePage = (props: { theme?: any }) => {
194
194
  iconStyle={{ tintColor: props.theme.global.warning }}
195
195
  />
196
196
  )}
197
- {params.applyForList.length > 1 && !!state.originList.length && showTags}
197
+ {params.applyForList.length > 1 && !!state.originList.length && !(params.isCeilingLight || params.isMixLight) && showTags}
198
198
  {state.timeScheduleList.length > 0 ? <FlatList
199
199
  data={state.timeScheduleList}
200
200
  renderItem={({ item }) => (
@@ -72,7 +72,7 @@ function ManualSettings(props: ManualSettingProps) {
72
72
  <View key={item.dp}>
73
73
  <Card style={{ marginHorizontal: cx(24) }}>
74
74
  <LdvSwitch
75
- title={item.key}
75
+ title={item.name || item.key}
76
76
  color={props.theme.card.background}
77
77
  colorAlpha={1}
78
78
  enable={item.enable}
@@ -253,7 +253,7 @@ function ManualSettings(props: ManualSettingProps) {
253
253
  const deviceData = state.deviceData as StripLightData
254
254
  return (
255
255
  <View>
256
- <Card>
256
+ <Card style={{ marginHorizontal: cx(24) }}>
257
257
  <LdvSwitch
258
258
  title={I18n.getLang('light_sources_tile_tw_lighting_headline')}
259
259
  color={props.theme.card.background}