@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.
- package/package.json +1 -1
- package/src/modules/timer/TimerPageAction.ts +0 -1
- package/src/navigation/Routers.ts +3 -1
- package/src/newModules/diyScene/DefaultScenes.ts +438 -0
- package/src/newModules/diyScene/DiySceneActions.ts +232 -0
- package/src/newModules/diyScene/DiySceneEditorPage.tsx +359 -0
- package/src/newModules/diyScene/DiyScenePage.tsx +297 -0
- package/src/newModules/diyScene/Router.ts +25 -0
- package/src/newModules/energyConsumption/EnergyConsumptionActions.ts +15 -2
- package/src/newModules/energyConsumption/EnergyConsumptionChart.tsx +31 -10
- package/src/newModules/energyConsumption/component/DateSwitch.tsx +111 -0
- package/src/newModules/energyConsumption/component/NewBarChart.tsx +16 -3
- package/src/newModules/mood/MoodPage.tsx +3 -3
- package/src/newModules/timeSchedule/Interface.ts +19 -7
- package/src/newModules/timeSchedule/TimeScheduleActions.ts +6 -0
- package/src/newModules/timeSchedule/TimeScheduleDetailPage.tsx +134 -57
- package/src/newModules/timeSchedule/TimeSchedulePage.tsx +32 -31
- package/src/newModules/timeSchedule/components/ManuaSettings.tsx +42 -9
|
@@ -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
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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, {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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 {
|
|
7
|
-
import {
|
|
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 {
|
|
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={
|
|
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={
|
|
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={
|
|
361
|
+
color={getBlockColor(item.type)}
|
|
329
362
|
colorAlpha={1}
|
|
330
363
|
enable={item.enable}
|
|
331
364
|
setEnable={(enable: boolean) => {
|