@ledvance/ui-biz-bundle 1.1.164 → 1.1.166

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.164",
7
+ "version": "1.1.166",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -9,16 +9,15 @@ import { useParams } from '@ledvance/base/src/hooks/Hooks'
9
9
  import I18n from '@ledvance/base/src/i18n'
10
10
  import { useDeviceInfo, useSystemTimeFormate, } from '@ledvance/base/src/models/modules/NativePropsSlice'
11
11
  import res from '@ledvance/base/src/res'
12
- import { xLog } from '@ledvance/base/src/utils'
13
12
  import { cctToColor } from '@ledvance/base/src/utils/cctUtils'
14
13
  import { convertMinutesTo12HourFormat, loopText, showDialog } from '@ledvance/base/src/utils/common'
15
14
  import { useNavigation } from '@react-navigation/native'
16
15
  import { useDebounceFn, useReactive, useUpdateEffect } from 'ahooks'
17
16
  import { useConflictTask } from 'hooks/DeviceDpStateHooks'
18
17
  import { cloneDeep, sortBy } from 'lodash'
19
- import React, { useCallback, useEffect, useMemo, useState } from 'react'
20
- import { FlatList, Image, Linking, ScrollView, Switch, Text, TouchableOpacity, View, AsyncStorage } from 'react-native'
21
- import { Dialog, Modal, Utils } from 'tuya-panel-kit'
18
+ import React, { useCallback, useMemo, useState } from 'react'
19
+ import { FlatList, Image, Linking, ScrollView, Text, TouchableOpacity, View } from 'react-native'
20
+ import { Dialog, Modal, SwitchButton, Utils } from 'tuya-panel-kit'
22
21
  import { ui_biz_routerKey } from '../../navigation/Routers'
23
22
  import { replaceImg, useBiorhythm, useStorageBiorhythm } from './BiorhythmActions'
24
23
  import {
@@ -243,7 +242,7 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
243
242
  backText={deviceInfo.name}
244
243
  onBackClick={navigation.goBack}
245
244
  headlineTopContent={
246
- <View style={{flexDirection: 'row', justifyContent: 'flex-end'}}>
245
+ <View style={{flexDirection: 'row', justifyContent: 'flex-end', marginBottom: cx(10)}}>
247
246
  <TouchableOpacity
248
247
  style={{paddingLeft: cx(16)}}
249
248
  onPress={() => {
@@ -274,10 +273,8 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
274
273
  </TouchableOpacity>
275
274
  </View>}
276
275
  headlineText={I18n.getLang('add_new_trigger_time_system_back_text')}
277
- headlineIconContent={<Switch
276
+ headlineIconContent={<SwitchButton
278
277
  value={state.enable}
279
- thumbColor={props.theme?.icon.primary}
280
- trackColor={{ false: '#00000026', true: '#ff660036' }}
281
278
  onValueChange={async enable => {
282
279
  const biorhythmTask = {
283
280
  startTime: 0,
@@ -542,10 +539,8 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
542
539
  {convertMinutesTo12HourFormat(item.time, is24Hour)}
543
540
  </Text>
544
541
  </View>
545
- <Switch
542
+ <SwitchButton
546
543
  value={item.enable}
547
- thumbColor={props.theme?.icon.primary}
548
- trackColor={{ false: '#00000026', true: '#ff660036' }}
549
544
  onValueChange={e => {
550
545
  item.enable = e
551
546
  requestSetBiorhythm()
@@ -3,7 +3,6 @@ import I18n from '@ledvance/base/src/i18n'
3
3
  import { useDp } from '@ledvance/base/src/models/modules/NativePropsSlice'
4
4
  import {
5
5
  DpReportSataData,
6
- DpResultByMonthResData,
7
6
  getDataWithSpecified,
8
7
  getDpResultByHour,
9
8
  getDpResultByMonth,
@@ -148,7 +147,8 @@ export interface PowerDataItem {
148
147
  key: string
149
148
  chartTitle: string
150
149
  time: number,
151
- value: number
150
+ value: number,
151
+ interval: number,
152
152
  }
153
153
 
154
154
  // 常量抽离(便于维护)
@@ -161,21 +161,6 @@ const RETRY_CONFIG = {
161
161
  backoffFactor: 2,
162
162
  } as const;
163
163
 
164
- /**
165
- * 创建一个0值填充的数据点
166
- * @param timePoint Dayjs对象
167
- * @returns PowerDataItem
168
- */
169
- function createZeroPaddingPoint(timePoint: dayjs.Dayjs): PowerDataItem {
170
- const timeMs = timePoint.valueOf();
171
- return {
172
- key: timePoint.format('HH:mm:ss'),
173
- chartTitle: timePoint.format('MM/DD/YYYY HH:mm:ss'),
174
- time: timeMs,
175
- value: 0,
176
- };
177
- }
178
-
179
164
  /**
180
165
  * 获取设备功率数据
181
166
  * @param devId 设备ID
@@ -205,7 +190,8 @@ export async function getPowerData(devId: string, powerDpCode: string, interval:
205
190
  key: dp.timeStr,
206
191
  chartTitle: dayjs.unix(dp.timeStamp).format('MM/DD/YYYY HH:mm:ss'),
207
192
  time: dp.timeStamp * 1000,
208
- value: parseFloat(dp.value) / 10
193
+ value: parseFloat(dp.value) / 10,
194
+ interval: interval
209
195
  }
210
196
  })
211
197
  }
@@ -3,12 +3,13 @@ import React from 'react'
3
3
  import { Text, TouchableOpacity, View } from 'react-native'
4
4
  import PowerLineChart from '../component/PowerLineChart'
5
5
  import { EmptyDataView } from './EmptyDataView'
6
+ import { PowerRangeInterval } from '../co2Data'
6
7
 
7
8
  const INTERVAL_OPTIONS = [
8
- { label: 'charttime_type1', value: 24 * 60 },
9
- { label: 'charttime_type2', value: 6 * 60 },
10
- { label: 'charttime_type3', value: 60 },
11
- { label: 'charttime_type4', value: 5 },
9
+ { label: 'charttime_type1', value: PowerRangeInterval.DAY_1 },
10
+ { label: 'charttime_type2', value: PowerRangeInterval.HOUR_6 },
11
+ { label: 'charttime_type3', value: PowerRangeInterval.HOUR_1 },
12
+ { label: 'charttime_type4', value: PowerRangeInterval.MINUTE_5 },
12
13
  ]
13
14
 
14
15
  export const PowerChartSection = ({ isLandscape, state, actions, styles, theme, chartHeight }) => {
@@ -23664,3 +23664,10 @@ export enum ChartType {
23664
23664
  kWh = 'kWh',
23665
23665
  Watt = 'Watt',
23666
23666
  }
23667
+
23668
+ export enum PowerRangeInterval {
23669
+ MINUTE_5 = 5,
23670
+ HOUR_1 = 1 * 60,
23671
+ HOUR_6 = 6 * 60,
23672
+ DAY_1 = 24 * 60,
23673
+ }
@@ -5,6 +5,7 @@ import React, { useRef } from 'react'
5
5
  import { View } from 'react-native'
6
6
  import { Utils } from 'tuya-panel-kit'
7
7
  import { PowerDataItem } from '../EnergyConsumptionActions'
8
+ import { PowerRangeInterval } from '../co2Data'
8
9
  import dayjs from 'dayjs'
9
10
 
10
11
  const { withTheme } = Utils.ThemeUtils
@@ -24,6 +25,8 @@ const GAP_THRESHOLD_MS = 5 * 1000 // 5 秒
24
25
  */
25
26
  function fillGaps(items: PowerDataItem[]): PowerDataItem[] {
26
27
  if (!items || items.length < 2) return items
28
+ // MINUTE_5 模式下数据点本身间隔约 30s,不做间隙补充
29
+ if (items[0].interval === PowerRangeInterval.MINUTE_5) return items
27
30
  const result: PowerDataItem[] = []
28
31
  for (let i = 0; i < items.length; i++) {
29
32
  result.push(items[i])
@@ -45,10 +48,11 @@ function fillGaps(items: PowerDataItem[]): PowerDataItem[] {
45
48
  }
46
49
  const gapDayjs = dayjs(gapTime)
47
50
  result.push({
48
- key: gapDayjs.format('YYYY-MM-DD HH:mm:ss'),
51
+ key: gapDayjs.format('MM/DD/YYYY HH:mm:ss'),
49
52
  chartTitle: gapDayjs.format('MM/DD/YYYY HH:mm:ss'),
50
53
  time: gapTime,
51
54
  value: gapValue,
55
+ interval: cur.interval,
52
56
  })
53
57
  }
54
58
  }
@@ -73,7 +77,18 @@ const PowerLineChart = (props: PowerLineChartProps) => {
73
77
  show: true,
74
78
  triggerOn: 'mousemove|click',
75
79
  trigger: 'axis',
76
- position: ['30%', '50%']
80
+ position: ['30%', '50%'],
81
+ formatter: function (params) {
82
+ if (!params || !params.length) return ''
83
+ var item = params[0]
84
+ var date = new Date(item.value[0])
85
+ function pad(num) {
86
+ return num < 10 ? '0' + num : num
87
+ }
88
+ var time = pad(date.getMonth() + 1) + '/' + pad(date.getDate()) + '/' + date.getFullYear() + ' ' +
89
+ pad(date.getHours()) + ':' + pad(date.getMinutes()) + ':' + pad(date.getSeconds())
90
+ return (time + '<br/>' + item.marker + item.seriesName + ': ' + '<b>' + item.value[1] + '</b>')
91
+ }
77
92
  },
78
93
  grid: {
79
94
  right: '5%'
@@ -454,59 +454,61 @@ const TimeScheduleDetailPage = (props: { theme?: ThemeType }) => {
454
454
  <Spacer height={cx(30)} />
455
455
 
456
456
  {/* Apply for */}
457
- <View style={styles.cardContainer}>
458
- <Text style={styles.itemTitle}>
459
- {I18n.getLang('timeschedule_add_schedule_subheadline_text')}
460
- </Text>
461
- <Spacer height={cx(10)} />
462
- <View style={[styles.applyContent, { paddingTop: state.selectedSkill.length ? cx(10) : 0 }]}>
463
- {state.selectedSkill.length === 0 ? (
464
- <Text style={{color: props.theme?.global.fontColor}}>{I18n.getLang('timer_ceiling_fan_selectionfield_no_components_text')}</Text>
465
- ) : (
466
- state.selectedSkill.map(skill => (
467
- <View
468
- style={[styles.applyItem, { marginBottom: cx(10), borderRadius: 4 }]}
469
- key={skill.dp}
457
+ {(!params.applyForDisabled && params.applyForList.length > 1) && (
458
+ <View style={styles.cardContainer}>
459
+ <Text style={styles.itemTitle}>
460
+ {I18n.getLang('timeschedule_add_schedule_subheadline_text')}
461
+ </Text>
462
+ <Spacer height={cx(10)} />
463
+ <View style={[styles.applyContent, { paddingTop: state.selectedSkill.length ? cx(10) : 0 }]}>
464
+ {state.selectedSkill.length === 0 ? (
465
+ <Text style={{color: props.theme?.global.fontColor}}>{I18n.getLang('timer_ceiling_fan_selectionfield_no_components_text')}</Text>
466
+ ) : (
467
+ state.selectedSkill.map(skill => (
468
+ <View
469
+ style={[styles.applyItem, { marginBottom: cx(10), borderRadius: 4 }]}
470
+ key={skill.dp}
471
+ >
472
+ <Text style={{ color: props.theme?.global.fontColor, fontSize: cx(12) }}>{skill.key}</Text>
473
+ {showSelectedIcon && (
474
+ <TouchableOpacity
475
+ onPress={() => {
476
+ state.selectedSkill = state.selectedSkill.filter(s => skill.dp !== s.dp);
477
+ state.unSelectedSkill = [...state.unSelectedSkill, skill];
478
+ }}
479
+ style={{ paddingHorizontal: cx(5) }}
480
+ >
481
+ <Image
482
+ style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.fontColor }}
483
+ source={{ uri: res.ic_arrows_nav_clear}}
484
+ />
485
+ </TouchableOpacity>
486
+ )}
487
+ </View>
488
+ ))
489
+ )}
490
+ </View>
491
+ {state.unSelectedSkill.map((item: ApplyForItem) => {
492
+ return (
493
+ <TouchableOpacity
494
+ style={styles.applyItem}
495
+ key={item.dp}
496
+ onPress={() => {
497
+ state.selectedSkill = [...state.selectedSkill, item];
498
+ state.unSelectedSkill = state.unSelectedSkill.filter(s => item.dp !== s.dp);
499
+ }}
470
500
  >
471
- <Text style={{ color: props.theme?.global.fontColor, fontSize: cx(12) }}>{skill.key}</Text>
472
- {showSelectedIcon && (
473
- <TouchableOpacity
474
- onPress={() => {
475
- state.selectedSkill = state.selectedSkill.filter(s => skill.dp !== s.dp);
476
- state.unSelectedSkill = [...state.unSelectedSkill, skill];
477
- }}
478
- style={{ paddingHorizontal: cx(5) }}
479
- >
480
- <Image
481
- style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.fontColor }}
482
- source={{ uri: res.ic_arrows_nav_clear}}
483
- />
484
- </TouchableOpacity>
485
- )}
486
- </View>
487
- ))
488
- )}
501
+ <Text style={{ color: props.theme?.global.fontColor, fontSize: cx(12) }}>{item.key}</Text>
502
+ <Image
503
+ style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.fontColor }}
504
+ source={{ uri: res.device_panel_timer_add}}
505
+ />
506
+ </TouchableOpacity>
507
+ );
508
+ })}
509
+ <Spacer />
489
510
  </View>
490
- {state.unSelectedSkill.map((item: ApplyForItem) => {
491
- return (
492
- <TouchableOpacity
493
- style={styles.applyItem}
494
- key={item.dp}
495
- onPress={() => {
496
- state.selectedSkill = [...state.selectedSkill, item];
497
- state.unSelectedSkill = state.unSelectedSkill.filter(s => item.dp !== s.dp);
498
- }}
499
- >
500
- <Text style={{ color: props.theme?.global.fontColor, fontSize: cx(12) }}>{item.key}</Text>
501
- <Image
502
- style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.fontColor }}
503
- source={{ uri: res.device_panel_timer_add}}
504
- />
505
- </TouchableOpacity>
506
- );
507
- })}
508
- <Spacer />
509
- </View>
511
+ )}
510
512
 
511
513
  {/* device state */}
512
514
  <Text style={[styles.itemTitle, styles.cardContainer]}>
@@ -101,6 +101,8 @@ function ManualSettings(props: ManualSettingProps) {
101
101
  title={item.name || item.key}
102
102
  color={getBlockColor(item as any)}
103
103
  colorAlpha={1}
104
+ onText={I18n.getLang('routine_push_msg_on')}
105
+ offText={I18n.getLang('watchapp_entitystate_off')}
104
106
  enable={item.enable}
105
107
  setEnable={(enable: boolean) => {
106
108
  state.applyForList = state.applyForList.map((apply, index) => {
@@ -259,6 +261,8 @@ function ManualSettings(props: ManualSettingProps) {
259
261
  title={item.key}
260
262
  color={getBlockColor(item.type)}
261
263
  colorAlpha={1}
264
+ onText={I18n.getLang('routine_push_msg_on')}
265
+ offText={I18n.getLang('watchapp_entitystate_off')}
262
266
  enable={item.enable}
263
267
  setEnable={(enable: boolean) => {
264
268
  state.applyForList[idx].enable = enable;
@@ -329,6 +333,8 @@ function ManualSettings(props: ManualSettingProps) {
329
333
  title={state.applyForList[0]?.name || state.applyForList[0]?.key}
330
334
  color={getBlockColor()}
331
335
  colorAlpha={1}
336
+ onText={I18n.getLang('routine_push_msg_on')}
337
+ offText={I18n.getLang('watchapp_entitystate_off')}
332
338
  enable={state.applyForList[0]?.enable}
333
339
  setEnable={(enable: boolean) => {
334
340
  state.applyForList[0].enable = enable;
@@ -408,6 +414,8 @@ function ManualSettings(props: ManualSettingProps) {
408
414
  title={item.key}
409
415
  color={getBlockColor(item.type)}
410
416
  colorAlpha={1}
417
+ onText={I18n.getLang('routine_push_msg_on')}
418
+ offText={I18n.getLang('watchapp_entitystate_off')}
411
419
  enable={item.enable}
412
420
  setEnable={(enable: boolean) => {
413
421
  state.applyForList[idx].enable = enable;
@@ -499,6 +507,8 @@ function ManualSettings(props: ManualSettingProps) {
499
507
  icon={{ uri: PowerStripIcon[item.index ?? 0] }}
500
508
  disabledEdit={true}
501
509
  onNameChange={() => { }}
510
+ onText={I18n.getLang('routine_push_msg_on')}
511
+ offText={I18n.getLang('watchapp_entitystate_off')}
502
512
  enabled={item.enable}
503
513
  onSwitchChange={async enable => {
504
514
  state.applyForList = state.applyForList.map((apply, index) => {