@ledvance/ui-biz-bundle 1.1.104 → 1.1.106

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.
@@ -40,6 +40,7 @@ export interface TimeSchedulePageParams {
40
40
  isFanLight?: boolean;
41
41
  isUVCFan?: boolean;
42
42
  isPowerStrip?: boolean
43
+ isMoodStrip?: boolean
43
44
  featureId?: string
44
45
  applyForList: ApplyForItem[];
45
46
  applyForDisabled?: boolean; // 是否可以选择apply for
@@ -197,31 +198,31 @@ const TimeSchedulePage = (props: { theme?: ThemeType }) => {
197
198
  )}
198
199
  {params.applyForList.length > 1 && !!state.originList.length && !(params.isCeilingLight || params.isMixLight) && showTags}
199
200
  {state.timeScheduleList.length > 0 ? <FlatList
200
- data={state.timeScheduleList}
201
- renderItem={({ item }) => (
202
- <ScheduleCard
203
- item={item}
204
- tags={params.applyForList}
205
- showTag={params.applyForList.length > 1}
206
- onEnableChange={async enable => {
207
- state.loading = true;
208
- await modDeleteTimeSchedule('update', {
209
- ...item,
210
- enable,
211
- });
212
- state.loading = false;
213
- }}
214
- onPress={() => {
215
- navigateToEdit('update', item);
216
- }}
217
- />
218
- )}
219
- keyExtractor={item => item.id.toString()}
220
- ListEmptyComponent={<Spacer />}
221
- ListHeaderComponent={() => <Spacer height={cx(10)} />}
222
- ItemSeparatorComponent={() => <Spacer />}
223
- ListFooterComponent={() => <Spacer height={cx(30)} />}
224
- /> :
201
+ data={state.timeScheduleList}
202
+ renderItem={({ item }) => (
203
+ <ScheduleCard
204
+ item={item}
205
+ tags={params.applyForList}
206
+ showTag={params.applyForList.length > 1}
207
+ onEnableChange={async enable => {
208
+ state.loading = true;
209
+ await modDeleteTimeSchedule('update', {
210
+ ...item,
211
+ enable,
212
+ });
213
+ state.loading = false;
214
+ }}
215
+ onPress={() => {
216
+ navigateToEdit('update', item);
217
+ }}
218
+ />
219
+ )}
220
+ keyExtractor={item => item.id.toString()}
221
+ ListEmptyComponent={<Spacer />}
222
+ ListHeaderComponent={() => <Spacer height={cx(10)} />}
223
+ ItemSeparatorComponent={() => <Spacer />}
224
+ ListFooterComponent={() => <Spacer height={cx(30)} />}
225
+ /> :
225
226
  <View style={styles.emptyContainer}>
226
227
  <Spacer height={cx(60)} />
227
228
  <Image
@@ -238,12 +239,12 @@ const TimeSchedulePage = (props: { theme?: ThemeType }) => {
238
239
  />
239
240
  <Spacer height={cx(16)} />
240
241
  {!state.originList.length && <DeleteButton
241
- style={styles.addBtn}
242
- text={`${I18n.getLang('timeschedule_overview_empty_button_add_text')}`}
243
- textStyle={{ fontSize: cx(12) }}
244
- onPress={() => {
245
- navigateToEdit('add');
246
- }}
242
+ style={styles.addBtn}
243
+ text={`${I18n.getLang('timeschedule_overview_empty_button_add_text')}`}
244
+ textStyle={{ fontSize: cx(12) }}
245
+ onPress={() => {
246
+ navigateToEdit('add');
247
+ }}
247
248
  />}
248
249
  </View>}
249
250
  </ScrollView>
@@ -1,19 +1,23 @@
1
- import React, { memo, useMemo } from 'react';
2
- import { DeviceType, directOptions, FanLightData, ManualSettingProps, modeOptions, StripLightData } from '../Interface';
3
- import { View } from 'react-native';
1
+ import React, {memo, useMemo} from 'react';
2
+ import {DeviceType, directOptions, FanLightData, ManualSettingProps, modeOptions, StripLightData} from '../Interface';
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';
6
- import { Utils } from 'tuya-panel-kit';
7
- import { useCreation, useReactive, useUpdateEffect } from 'ahooks';
6
+ import {Utils} from 'tuya-panel-kit';
7
+ import {useCreation, useReactive, useUpdateEffect} from 'ahooks';
8
8
  import LdvSwitch from '@ledvance/base/src/components/ldvSwitch';
9
9
  import ColorTempAdjustView from '@ledvance/base/src/components/ColorTempAdjustView';
10
10
  import ColorAdjustView from '@ledvance/base/src/components/ColorAdjustView';
11
11
  import I18n from '@ledvance/base/src/i18n';
12
12
  import StripAdjustView from '@ledvance/base/src/components/StripAdjustView';
13
13
  import Spacer from '@ledvance/base/src/components/Spacer';
14
- import { FanAdjustViewContent } from '@ledvance/base/src/components/FanAdjustView';
14
+ import {FanAdjustViewContent} from '@ledvance/base/src/components/FanAdjustView';
15
15
  import SocketItem from '@ledvance/base/src/components/SocketItem'
16
16
  import res from '@ledvance/base/src/res';
17
+ import { cctToColor } from '@ledvance/base/src/utils/cctUtils';
18
+ import {hsv2Hex, mapFloatToRange } from '@ledvance/base/src/utils';
19
+ import {AdjustType} from "@ledvance/base/src/utils/interface";
20
+
17
21
  const { convertX: cx } = Utils.RatioUtils;
18
22
  const { withTheme } = Utils.ThemeUtils
19
23
 
@@ -66,6 +70,14 @@ function ManualSettings(props: ManualSettingProps) {
66
70
 
67
71
  const lightSourceCard = useMemo(() => {
68
72
  const { deviceData } = state;
73
+ const getBlockColor = () => {
74
+ if (!deviceData.isColorMode) return cctToColor(deviceData.temperature)
75
+ if (deviceData.isColorMode) {
76
+ const s = Math.round(mapFloatToRange(deviceData.s / 100, 30, 100))
77
+ return hsv2Hex(deviceData.h, s, 100)
78
+ }
79
+ return props.theme?.card?.background
80
+ };
69
81
  return (
70
82
  <View>
71
83
  {state.applyForList.map((item, idx) => (
@@ -73,7 +85,7 @@ function ManualSettings(props: ManualSettingProps) {
73
85
  <Card style={{ marginHorizontal: cx(24) }}>
74
86
  <LdvSwitch
75
87
  title={item.name || item.key}
76
- color={props.theme?.card.background}
88
+ color={getBlockColor()}
77
89
  colorAlpha={1}
78
90
  enable={item.enable}
79
91
  setEnable={(enable: boolean) => {
@@ -99,6 +111,7 @@ function ManualSettings(props: ManualSettingProps) {
99
111
  state.deviceData = {
100
112
  ...state.deviceData,
101
113
  isColorMode: mode,
114
+ adjustType: mode ? AdjustType.COLOUR : AdjustType.WHITE
102
115
  };
103
116
  state.manualFlag = Symbol()
104
117
  }}
@@ -190,6 +203,15 @@ function ManualSettings(props: ManualSettingProps) {
190
203
  }, [state.deviceData, state.applyForList, props.theme?.type]);
191
204
 
192
205
  const mixLightCard = useMemo(() => {
206
+ const {deviceData} = state;
207
+ const getBlockColor = ((type: string) => {
208
+ if (type === 'mainLight') return cctToColor(deviceData.temperature);
209
+ if (type === 'secondaryLight') {
210
+ const s = Math.round(mapFloatToRange(deviceData.s / 100, 30, 100));
211
+ return hsv2Hex(deviceData.h, s, 100);
212
+ }
213
+ return props.theme?.card?.background;
214
+ });
193
215
  return (
194
216
  <View>
195
217
  {state.applyForList.map((item, idx) => (
@@ -197,7 +219,7 @@ function ManualSettings(props: ManualSettingProps) {
197
219
  <Card style={{ marginHorizontal: cx(24) }}>
198
220
  <LdvSwitch
199
221
  title={item.key}
200
- color={props.theme?.card.background}
222
+ color={getBlockColor(item.type)}
201
223
  colorAlpha={1}
202
224
  enable={item.enable}
203
225
  setEnable={(enable: boolean) => {
@@ -318,6 +340,17 @@ function ManualSettings(props: ManualSettingProps) {
318
340
 
319
341
  const ceilingLightCard = useMemo(() => {
320
342
  const deviceData = state.deviceData as StripLightData
343
+ const getBlockColor = (type: string) => {
344
+ if (type === 'mainLight') {
345
+ return cctToColor(deviceData.temperature);
346
+ }
347
+ // deviceData.activeKey === 3为combination
348
+ if (type === 'secondaryLight' && deviceData.activeKey !== 3) {
349
+ const s = Math.round(mapFloatToRange(deviceData.s / 100, 30, 100));
350
+ return hsv2Hex(deviceData.h, s, 100);
351
+ }
352
+ return props.theme?.card.background;
353
+ }
321
354
  return (
322
355
  <View>
323
356
  {state.applyForList.map((item, idx) => (
@@ -325,7 +358,7 @@ function ManualSettings(props: ManualSettingProps) {
325
358
  <Card style={{ marginHorizontal: cx(24) }}>
326
359
  <LdvSwitch
327
360
  title={item.key}
328
- color={props.theme?.card.background}
361
+ color={getBlockColor(item.type)}
329
362
  colorAlpha={1}
330
363
  enable={item.enable}
331
364
  setEnable={(enable: boolean) => {