@ledvance/ui-biz-bundle 1.1.128 → 1.1.130

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.128",
7
+ "version": "1.1.130",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -44,7 +44,7 @@ const BarChartWithTouch = (props: BarChartProps) => {
44
44
  }, [dataKwhY]);
45
45
  const gridRight = useMemo(() => {
46
46
  const max = Math.max(...dataPriceY.map(it => Number(it)))
47
- return max > 999 ? '12%' : '10%'
47
+ return max > 999 ? '15%' : '10%'
48
48
  }, [dataPriceY])
49
49
  const option = {
50
50
  tooltip: {
@@ -25,7 +25,7 @@ export interface HSV {
25
25
  v: number;
26
26
  }
27
27
 
28
- export type Category = 'light' | 'socket' | 'fan' | 'mainLight' | 'secondaryLight'
28
+ export type Category = 'light' | 'socket' | 'fan' | 'mainLight' | 'secondaryLight' | 'shutter'
29
29
 
30
30
  export interface ApplyForItem {
31
31
  name?: string
@@ -54,7 +54,7 @@ export interface ManualSettingProps extends judgmentSupport {
54
54
  applyForList: ApplyForItem[];
55
55
  dps: Record<string, any>;
56
56
  manualData: ComponentConfig;
57
- onManualChange?: (manualData: PlugData | DeviceData | MixLightData | StripLightData) => void
57
+ onManualChange?: (manualData: PlugData | DeviceData | MixLightData | StripLightData | ShutterData) => void
58
58
  onApplyChange?: (applyForList: ApplyForItem[]) => void
59
59
  }
60
60
 
@@ -67,6 +67,7 @@ export enum DeviceType {
67
67
  CeilingLight = 'ceilingLight',
68
68
  FanLight = 'fanLight',
69
69
  MoodStrip = 'moodStrip',
70
+ Shutter = 'shutter',
70
71
  }
71
72
  // export type DeviceType = 'LightSource' | 'CeilingLight' | 'StringLight' | 'StripLight' | 'MixLight';
72
73
 
@@ -106,6 +107,10 @@ export interface MoodStripData extends DeviceData {
106
107
  adjustType: AdjustType
107
108
  }
108
109
 
110
+ export interface ShutterData extends DeviceData {
111
+ percentControl: number
112
+ }
113
+
109
114
  export type ComponentConfig =
110
115
  | { type: DeviceType.LightSource; deviceData: DeviceData }
111
116
  | { type: DeviceType.MixLight; deviceData: MixLightData }
@@ -114,7 +119,7 @@ export type ComponentConfig =
114
119
  | { type: DeviceType.FanLight; deviceData: FanLightData }
115
120
  | { type: DeviceType.PowerStrip; deviceData: DeviceData}
116
121
  | { type: DeviceType.MoodStrip; deviceData: MoodStripData}
117
-
122
+ | { type: DeviceType.Shutter; deviceData: ShutterData}
118
123
  export interface TimeScheduleDetailState {
119
124
  timeSchedule: Timer;
120
125
  dps: Record<string, any>;
@@ -38,6 +38,10 @@ export const defMoodStripDeviceData = {
38
38
  adjustType: AdjustType.COLOUR
39
39
  };
40
40
 
41
+ export const defShutterDeviceData = {
42
+ percentControl: 100
43
+ };
44
+
41
45
  export const getTimeSchedule = async (deviceId: string): Promise<Timer[]> => {
42
46
  const res = await NativeApi.getAllTaskTimer(deviceId);
43
47
  if (res.success && Array.isArray(res.data)) {
@@ -25,7 +25,8 @@ import {
25
25
  defFanLightDeviceData,
26
26
  defMixDeviceData,
27
27
  defMoodStripDeviceData,
28
- defStripDeviceData
28
+ defStripDeviceData,
29
+ defShutterDeviceData
29
30
  } from './TimeScheduleActions';
30
31
  import MoodItem from '../mood/MoodItem';
31
32
  import {getRemoteMoodList} from '../mood/MoodActions';
@@ -228,6 +229,31 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
228
229
  return params.isCeilingLight ? ((item.mainLamp.id === (state.mood as MoodInfo)?.mainLamp?.id) && (item.secondaryLamp.id === (state.mood as MoodInfo)?.secondaryLamp?.id)) : item.id === state.mood?.id
229
230
  }, [state.mood, params.isCeilingLight])
230
231
 
232
+ const renderSkillGroup = (skills: ApplyForItem[], i18nString: string) => {
233
+ if (!skills.length) return null;
234
+
235
+ return (
236
+ <>
237
+ <Text style={{ fontSize: cx(14), color: props.theme?.global.fontColor }}>
238
+ {i18nString}
239
+ </Text>
240
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
241
+ {skills.map(item => (
242
+ <View
243
+ style={[
244
+ styles.summaryRight,
245
+ { marginRight: cx(5), marginBottom: cx(5) },
246
+ ]}
247
+ key={item.dp}
248
+ >
249
+ <Text style={styles.rightItem}>{item.key}</Text>
250
+ </View>
251
+ ))}
252
+ </View>
253
+ </>
254
+ );
255
+ };
256
+
231
257
  const styles = StyleSheet.create({
232
258
  cardContainer: {
233
259
  marginHorizontal: cx(24),
@@ -589,65 +615,26 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
589
615
  time={is24HourClock
590
616
  ? state.timeSchedule.time
591
617
  : convertTo12HourFormat(state.timeSchedule.time)}
592
- actions={<View style={{ flex: 1 }}>
593
- {state.isManual
594
- ? !!state.selectedSkill.length && (
595
- <>
596
- {!!state.selectedSkill.filter(skill => skill.enable).length && (
618
+ actions={
619
+ <View style={{ flex: 1 }}>
620
+ {state.isManual ? (
621
+ state.selectedSkill.length ? (
597
622
  <>
598
- <Text style={{ fontSize: cx(14), color: props.theme?.global.fontColor }}>
599
- {I18n.getLang('feature_summary_action_txt_1')}
600
- </Text>
601
- <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
602
- {state.selectedSkill
603
- .filter(skill => skill.enable)
604
- .map(item => (
605
- <View
606
- style={[
607
- styles.summaryRight,
608
- { marginRight: cx(5), marginBottom: cx(5) },
609
- ]}
610
- key={item.dp}
611
- >
612
- <Text style={[styles.rightItem]}>{item.key}</Text>
613
- </View>
614
- ))}
615
- </View>
623
+ {renderSkillGroup(state.selectedSkill.filter(skill => skill.enable), I18n.getLang(params.isShutter ? 'curtain_summary_action_txt_1' : 'feature_summary_action_txt_1'))}
624
+ {renderSkillGroup(state.selectedSkill.filter(skill => !skill.enable), I18n.getLang(params.isShutter ? 'curtain_summary_action_txt_2' : 'feature_summary_action_txt_2'))}
616
625
  </>
617
- )}
618
-
619
- {!!state.selectedSkill.filter(skill => !skill.enable).length && (
620
- <>
621
- <Text style={{ fontSize: cx(14), color: props.theme?.global.fontColor }}>
622
- {I18n.getLang('feature_summary_action_txt_2')}
623
- </Text>
624
- <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
625
- {state.selectedSkill
626
- .filter(skill => !skill.enable)
627
- .map((item) => (
628
- <View
629
- style={[
630
- styles.summaryRight,
631
- { marginRight: cx(5), marginBottom: cx(5) },
632
- ]}
633
- key={item.dp}
634
- >
635
- <Text style={[styles.rightItem]}>{item.key}</Text>
636
- </View>
637
- ))}
626
+ ) : null
627
+ ) : (
628
+ state.moodName ? (
629
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
630
+ <View style={[styles.summaryRight, { marginLeft: cx(5) }]}>
631
+ <Text style={styles.rightItem}>{state.moodName}</Text>
638
632
  </View>
639
- </>
640
- )}
641
- </>
642
- )
643
- : !!state.moodName && (
644
- <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
645
- <View style={[styles.summaryRight, { marginLeft: cx(5) }]}>
646
- <Text style={styles.rightItem}>{state.moodName}</Text>
647
- </View>
648
- </View>
649
- )}
650
- </View>}
633
+ </View>
634
+ ) : null
635
+ )}
636
+ </View>
637
+ }
651
638
  />
652
639
  <Spacer height={cx(30)} />
653
640
 
@@ -694,38 +681,39 @@ const newTimeSchedule = () => {
694
681
  };
695
682
 
696
683
  const getDefaultManual = (props: TimeScheduleDetailPageParams): ComponentConfig => {
697
- const deviceType =
698
- props.isStripLight
699
- ? DeviceType.StripLight
700
- : props.isMixLight
701
- ? DeviceType.MixLight
702
- : props.isPowerStrip
703
- ? DeviceType.PowerStrip
704
- : props.isFanLight
705
- ? DeviceType.FanLight
706
- : props.isCeilingLight
707
- ? DeviceType.CeilingLight
708
- : props.isMoodStrip
709
- ? DeviceType.MoodStrip
710
- : DeviceType.LightSource
711
- const deviceData =
712
- (deviceType === DeviceType.StripLight || deviceType === DeviceType.CeilingLight)
713
- ? defStripDeviceData
714
- : deviceType === DeviceType.MixLight
715
- ? defMixDeviceData
716
- : deviceType === DeviceType.FanLight
717
- ? defFanLightDeviceData
718
- : deviceType === DeviceType.MoodStrip
719
- ? defMoodStripDeviceData
720
- : defDeviceData;
684
+ const deviceTypeMap: Record<string, DeviceType> = {
685
+ isStripLight: DeviceType.StripLight,
686
+ isMixLight: DeviceType.MixLight,
687
+ isPowerStrip: DeviceType.PowerStrip,
688
+ isFanLight: DeviceType.FanLight,
689
+ isCeilingLight: DeviceType.CeilingLight,
690
+ isMoodStrip: DeviceType.MoodStrip,
691
+ isShutter: DeviceType.Shutter
692
+ };
693
+
694
+ const deviceType = Object.entries(deviceTypeMap)
695
+ .find(([key]) => props[key as keyof TimeScheduleDetailPageParams])
696
+ ?.[1] || DeviceType.LightSource;
697
+
698
+ const deviceDataMap: Record<DeviceType, any> = {
699
+ [DeviceType.StripLight]: defStripDeviceData,
700
+ [DeviceType.CeilingLight]: defStripDeviceData,
701
+ [DeviceType.MixLight]: defMixDeviceData,
702
+ [DeviceType.FanLight]: defFanLightDeviceData,
703
+ [DeviceType.MoodStrip]: defMoodStripDeviceData,
704
+ [DeviceType.Shutter]: defShutterDeviceData,
705
+ [DeviceType.PowerStrip]: defDeviceData,
706
+ [DeviceType.LightSource]: defDeviceData,
707
+ [DeviceType.Plug]: defDeviceData
708
+ };
721
709
 
722
710
  return {
723
711
  type: deviceType as any,
724
712
  deviceData: {
725
- ...deviceData,
713
+ ...deviceDataMap[deviceType],
726
714
  isColorMode: props.isSupportColor,
727
715
  },
728
716
  };
729
717
  };
730
718
 
731
- export default withTheme(TimeScheduleDetailPage)
719
+ export default withTheme(TimeScheduleDetailPage) as React.ComponentType<any>
@@ -42,6 +42,7 @@ export interface TimeSchedulePageParams {
42
42
  isUVCFan?: boolean;
43
43
  isPowerStrip?: boolean
44
44
  isMoodStrip?: boolean
45
+ isShutter?: boolean
45
46
  featureId?: string
46
47
  applyForList: ApplyForItem[];
47
48
  applyForDisabled?: boolean; // 是否可以选择apply for
@@ -1,29 +1,31 @@
1
- import React, {memo, useMemo} from 'react';
1
+ import React, { memo, useMemo } from 'react';
2
2
  import {
3
3
  DeviceType,
4
4
  directOptions,
5
5
  FanLightData,
6
6
  ManualSettingProps,
7
7
  modeOptions,
8
+ ShutterData,
8
9
  StripLightData
9
10
  } from '../Interface';
10
- import {View} from 'react-native';
11
+ import { View } from 'react-native';
11
12
  import Card from '@ledvance/base/src/components/Card';
12
13
  import LampAdjustView from '@ledvance/base/src/components/LampAdjustView';
13
- import {Utils} from 'tuya-panel-kit';
14
- import {useCreation, useReactive, useUpdateEffect} from 'ahooks';
14
+ import { Utils } from 'tuya-panel-kit';
15
+ import { useCreation, useReactive, useUpdateEffect } from 'ahooks';
15
16
  import LdvSwitch from '@ledvance/base/src/components/ldvSwitch';
16
17
  import ColorTempAdjustView from '@ledvance/base/src/components/ColorTempAdjustView';
17
18
  import ColorAdjustView from '@ledvance/base/src/components/ColorAdjustView';
18
19
  import I18n from '@ledvance/base/src/i18n';
19
20
  import StripAdjustView from '@ledvance/base/src/components/StripAdjustView';
20
21
  import Spacer from '@ledvance/base/src/components/Spacer';
21
- import {FanAdjustViewContent} from '@ledvance/base/src/components/FanAdjustView';
22
+ import { FanAdjustViewContent } from '@ledvance/base/src/components/FanAdjustView';
22
23
  import SocketItem from '@ledvance/base/src/components/SocketItem'
23
24
  import res from '@ledvance/base/src/res';
24
25
  import { cctToColor } from '@ledvance/base/src/utils/cctUtils';
25
- import {hsv2Hex, mapFloatToRange } from '@ledvance/base/src/utils';
26
- import {AdjustType, ApplyForItem} from "@ledvance/base/src/utils/interface";
26
+ import { hsv2Hex, mapFloatToRange } from '@ledvance/base/src/utils';
27
+ import { AdjustType, ApplyForItem } from "@ledvance/base/src/utils/interface";
28
+ import LdvSlider from '@ledvance/base/src/components/ldvSlider';
27
29
 
28
30
  const { convertX: cx } = Utils.RatioUtils;
29
31
  const { withTheme } = Utils.ThemeUtils
@@ -94,7 +96,7 @@ function ManualSettings(props: ManualSettingProps) {
94
96
  <Card style={{ marginHorizontal: cx(24) }}>
95
97
  <LdvSwitch
96
98
  title={item.name || item.key}
97
- color={getBlockColor(item)}
99
+ color={getBlockColor(item as any)}
98
100
  colorAlpha={1}
99
101
  enable={item.enable}
100
102
  setEnable={(enable: boolean) => {
@@ -212,7 +214,7 @@ function ManualSettings(props: ManualSettingProps) {
212
214
  }, [state.deviceData, state.applyForList, props.theme?.type]);
213
215
 
214
216
  const mixLightCard = useMemo(() => {
215
- const {deviceData} = state;
217
+ const { deviceData } = state;
216
218
  const getBlockColor = ((type: string) => {
217
219
  if (type === 'mainLight') return cctToColor(deviceData.temperature);
218
220
  if (type === 'secondaryLight') {
@@ -489,7 +491,32 @@ function ManualSettings(props: ManualSettingProps) {
489
491
  ))}
490
492
  </View>
491
493
  )
492
- }, [state.deviceData, state.applyForList])
494
+ }, [state.deviceData, state.applyForList, props.theme?.type])
495
+
496
+ const shutterCard = useMemo(() => {
497
+ return (
498
+ <Card style={{ marginHorizontal: cx(24) }}>
499
+ <Spacer height={cx(16)} />
500
+ <LdvSlider
501
+ title={'Curtain'}
502
+ value={(state.deviceData as ShutterData).percentControl}
503
+ min={0}
504
+ max={100}
505
+ onSlidingComplete={async (value) => {
506
+ (state.deviceData as ShutterData).percentControl = value
507
+ state.applyForList = state.applyForList.map((apply) => {
508
+ return {
509
+ ...apply,
510
+ enable: value > 0
511
+ }
512
+ })
513
+ state.applyFlag = Symbol()
514
+ }}
515
+ />
516
+ <Spacer />
517
+ </Card>
518
+ )
519
+ }, [state.deviceData, state.applyForList, props.theme?.type])
493
520
 
494
521
  const componentRender = useMemo(() => {
495
522
  const component =
@@ -501,7 +528,9 @@ function ManualSettings(props: ManualSettingProps) {
501
528
  ? ceilingLightCard
502
529
  : props.manualData.type === DeviceType.PowerStrip
503
530
  ? powerStripCard
504
- : lightSourceCard;
531
+ : props.manualData.type === DeviceType.Shutter
532
+ ? shutterCard
533
+ : lightSourceCard;
505
534
  return component;
506
535
  }, [props.manualData, state.applyForList, state.deviceData, props.theme?.type]);
507
536
 
@@ -509,4 +538,4 @@ function ManualSettings(props: ManualSettingProps) {
509
538
  return <View>{componentRender}</View>;
510
539
  }
511
540
 
512
- export default memo(withTheme(ManualSettings))
541
+ export default memo(withTheme(ManualSettings)) as React.ComponentType<ManualSettingProps>
@@ -40,6 +40,7 @@ const ScheduleCard = (props: ScheduleCardProps) => {
40
40
  infoContainer: {
41
41
  flex: 1,
42
42
  marginTop: cx(16),
43
+ marginBottom: cx(16),
43
44
  flexDirection: 'column',
44
45
  marginLeft: cx(16),
45
46
  },
@@ -64,22 +65,20 @@ const ScheduleCard = (props: ScheduleCardProps) => {
64
65
  },
65
66
  switchContainer: {
66
67
  marginRight: cx(16),
68
+ // backgroundColor: 'red',
67
69
  marginTop: cx(16),
68
70
  },
69
71
  switch: {},
70
72
  typeContainer: {
71
73
  flexDirection: 'row',
72
- flexWrap: 'wrap',
73
- marginVertical: cx(8),
74
- marginHorizontal: cx(16),
74
+ marginTop: cx(8),
75
75
  },
76
76
  tag: {
77
77
  borderRadius: cx(16),
78
78
  height: cx(16),
79
79
  backgroundColor: '#E6E7E8',
80
80
  marginRight: cx(10),
81
- marginBottom: cx(6),
82
- paddingHorizontal: cx(10)
81
+ paddingHorizontal: cx(12)
83
82
  },
84
83
  tagTitle: {
85
84
  fontSize: cx(10),
@@ -91,7 +90,7 @@ const ScheduleCard = (props: ScheduleCardProps) => {
91
90
  return (
92
91
  <Card
93
92
  style={styles.card}
94
- containerStyle={[style]}
93
+ containerStyle={[styles.container, style]}
95
94
  onPress={() => {
96
95
  onPress(item);
97
96
  }}
@@ -99,33 +98,31 @@ const ScheduleCard = (props: ScheduleCardProps) => {
99
98
  onLongPress && onLongPress(item)
100
99
  }}
101
100
  >
102
- <View style={styles.container}>
103
- <View style={styles.infoContainer}>
104
- <Text style={styles.time}>{is24HourClock ? item.time : convertTo12HourFormat(item.time)}</Text>
105
- <Text style={styles.loop}>
106
- {loopText(item.loops.split('').map(loop => parseInt(loop)), item.time)}
107
- </Text>
108
- <Text style={styles.name}>{item.name}</Text>
109
- </View>
110
- <View style={styles.switchContainer}>
111
- <SwitchButton
112
- value={item.enable}
113
- thumbStyle={{ elevation: 0 }}
114
- onValueChange={() => {
115
- onEnableChange(!item.enable);
116
- }}
117
- />
118
- </View>
101
+ <View style={styles.infoContainer}>
102
+ <Text style={styles.time}>{is24HourClock ? item.time : convertTo12HourFormat(item.time)}</Text>
103
+ <Text style={styles.loop}>
104
+ {loopText(item.loops.split('').map(loop => parseInt(loop)), item.time)}
105
+ </Text>
106
+ <Text style={styles.name}>{item.name}</Text>
107
+ {showTag && <View style={styles.typeContainer}>
108
+ {showTags.map(tag => (
109
+ <View style={styles.tag} key={tag.dp}>
110
+ <Text style={styles.tagTitle}>
111
+ {tag.key}
112
+ </Text>
113
+ </View>
114
+ ))}
115
+ </View>}
116
+ </View>
117
+ <View style={styles.switchContainer}>
118
+ <SwitchButton
119
+ value={item.enable}
120
+ thumbStyle={{ elevation: 0 }}
121
+ onValueChange={() => {
122
+ onEnableChange(!item.enable);
123
+ }}
124
+ />
119
125
  </View>
120
- {showTag && <View style={styles.typeContainer}>
121
- {showTags.map(tag => (
122
- <View style={styles.tag} key={tag.dp}>
123
- <Text style={styles.tagTitle}>
124
- {tag.key}
125
- </Text>
126
- </View>
127
- ))}
128
- </View>}
129
126
  </Card>
130
127
  )
131
128