@ledvance/base 1.3.26 → 1.3.28

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.
Files changed (34) hide show
  1. package/localazy.json +35 -0
  2. package/package.json +1 -1
  3. package/src/api/nativeEventEmitter.ts +10 -0
  4. package/src/components/BallDirectionView.tsx +184 -0
  5. package/src/components/DiySceneItem.tsx +95 -0
  6. package/src/components/DiySceneNodeView.tsx +103 -0
  7. package/src/components/MoodStripAdjustView.tsx +128 -0
  8. package/src/components/TextField.tsx +3 -1
  9. package/src/hooks/Hooks.ts +8 -2
  10. package/src/i18n/strings.ts +7362 -6417
  11. package/src/models/TuyaApi.ts +61 -8
  12. package/src/models/modules/NativePropsSlice.tsx +35 -2
  13. package/src/res/index.ts +14 -2
  14. package/src/res/materialiconsOutlinedArrowsNavKeyboardArrowLeft.png +0 -0
  15. package/src/res/materialiconsOutlinedArrowsNavKeyboardArrowLeft@2x.png +0 -0
  16. package/src/res/materialiconsOutlinedArrowsNavKeyboardArrowLeft@3x.png +0 -0
  17. package/src/res/materialiconsOutlinedArrowsNavKeyboardArrowRight.png +0 -0
  18. package/src/res/materialiconsOutlinedArrowsNavKeyboardArrowRight@2x.png +0 -0
  19. package/src/res/materialiconsOutlinedArrowsNavKeyboardArrowRight@3x.png +0 -0
  20. package/src/res/src_res_all.png +0 -0
  21. package/src/res/src_res_colorring@2x.png +0 -0
  22. package/src/res/src_res_colorring@3x.png +0 -0
  23. package/src/res/src_res_cycle.png +0 -0
  24. package/src/res/src_res_half.png +0 -0
  25. package/src/res/src_res_halfborder.png +0 -0
  26. package/src/res/src_res_halfcircle@3x.png +0 -0
  27. package/src/res/src_res_like.png +0 -0
  28. package/src/res/src_res_minus.png +0 -0
  29. package/src/res/src_res_ringdown@2x.png +0 -0
  30. package/src/res/src_res_ringdown@3x.png +0 -0
  31. package/src/res/src_res_unlike.png +0 -0
  32. package/src/utils/common.ts +38 -0
  33. package/src/utils/interface.ts +37 -2
  34. package/translateKey.txt +36 -1
@@ -1,4 +1,5 @@
1
1
  import {commonApi} from '@tuya/tuya-panel-api'
2
+ import { IGetDpResultByHourResponse, IGetDpResultByMonthResponse } from '@tuya/tuya-panel-api/lib/common/interface'
2
3
 
3
4
  export interface PagingResult<T> {
4
5
  data: T
@@ -25,7 +26,7 @@ export async function getDpReportSataData(
25
26
  offset: number,
26
27
  limit: number,
27
28
  sortType?: 'ASC' | 'DESC',
28
- ): Promise<DpReportSataResData> {
29
+ ): Promise<DpReportSataResData | undefined> {
29
30
  const params = {
30
31
  devId: deviceId,
31
32
  dpIds: dpIds.join(','),
@@ -33,7 +34,20 @@ export async function getDpReportSataData(
33
34
  limit: limit,
34
35
  sortType: sortType || 'DESC',
35
36
  }
36
- return commonApi.statApi.getDpReportLog(params)
37
+ const maxRetries = 3; // 设置重试次数的最大值
38
+ let retry = 0;
39
+
40
+ while (retry <= maxRetries) {
41
+ try {
42
+ const res = await commonApi.statApi.getDpReportLog(params);
43
+ return res;
44
+ } catch (err) {
45
+ retry++;
46
+ if (retry > maxRetries) {
47
+ return undefined;
48
+ }
49
+ }
50
+ }
37
51
  }
38
52
 
39
53
  export interface DpResultByMonthResData {
@@ -46,13 +60,26 @@ export async function getDpResultByMonth(
46
60
  devId: string,
47
61
  dpId: string,
48
62
  type: 'sum' | 'minux' | 'mac',
49
- ): Promise<DpResultByMonthResData> {
63
+ ): Promise<IGetDpResultByMonthResponse | undefined> {
50
64
  const params = {
51
65
  devId,
52
66
  dpId,
53
67
  type,
54
68
  }
55
- return commonApi.statApi.getDpResultByMonth(params) as any
69
+ const maxRetries = 3; // 设置重试次数的最大值
70
+ let retry = 0;
71
+
72
+ while (retry <= maxRetries) {
73
+ try {
74
+ const res = await commonApi.statApi.getDpResultByMonth(params);
75
+ return res;
76
+ } catch (err) {
77
+ retry++;
78
+ if (retry > maxRetries) {
79
+ return undefined;
80
+ }
81
+ }
82
+ }
56
83
  }
57
84
 
58
85
  export interface DpResultByDataWithSpecifiedResData {
@@ -66,7 +93,7 @@ export async function getDataWithSpecified(
66
93
  startDay: string,
67
94
  endDay: string,
68
95
  type: 'sum' | 'minux' | 'avg',
69
- ): Promise<DpResultByDataWithSpecifiedResData> {
96
+ ): Promise<DpResultByDataWithSpecifiedResData | undefined> {
70
97
  const params = {
71
98
  devId,
72
99
  dpId,
@@ -74,7 +101,20 @@ export async function getDataWithSpecified(
74
101
  endDay,
75
102
  type,
76
103
  }
77
- return commonApi.statApi.getDataWithSpecified(params) as any
104
+ const maxRetries = 3; // 设置重试次数的最大值
105
+ let retry = 0;
106
+
107
+ while (retry <= maxRetries) {
108
+ try {
109
+ const res = await commonApi.statApi.getDataWithSpecified(params);
110
+ return res;
111
+ } catch (err) {
112
+ retry++;
113
+ if (retry > maxRetries) {
114
+ return undefined;
115
+ }
116
+ }
117
+ }
78
118
  }
79
119
 
80
120
  export async function getDpResultByHour(
@@ -82,12 +122,25 @@ export async function getDpResultByHour(
82
122
  dpId: string,
83
123
  date: string,
84
124
  type: 'sum' | 'minux' | 'avg',
85
- ): Promise<DpResultByDataWithSpecifiedResData> {
125
+ ): Promise<IGetDpResultByHourResponse | undefined> {
86
126
  const params = {
87
127
  devId,
88
128
  dpId,
89
129
  date,
90
130
  type,
91
131
  }
92
- return commonApi.statApi.getDpResultByHour(params) as any
132
+ const maxRetries = 3; // 设置重试次数的最大值
133
+ let retry = 0;
134
+
135
+ while (retry <= maxRetries) {
136
+ try {
137
+ const res = await commonApi.statApi.getDpResultByHour(params);
138
+ return res;
139
+ } catch (err) {
140
+ retry++;
141
+ if (retry > maxRetries) {
142
+ return undefined;
143
+ }
144
+ }
145
+ }
93
146
  }
@@ -22,6 +22,7 @@ export interface NativeProps {
22
22
  flagModeState: FlagModeState
23
23
  is24HourClock: boolean
24
24
  timeZone: string
25
+ gestureControlValues: GestureControlType
25
26
  }
26
27
 
27
28
  interface FlagModeState {
@@ -46,6 +47,13 @@ export interface UAGroupInfo {
46
47
  icon?: string
47
48
  }
48
49
 
50
+ export interface GestureControlType {
51
+ isEnd: boolean
52
+ switch?: boolean
53
+ hue?: number
54
+ brightness?: number
55
+ }
56
+
49
57
  const initialState: NativeProps = {
50
58
  familyName: '',
51
59
  role: 2,
@@ -73,7 +81,10 @@ const initialState: NativeProps = {
73
81
  flagId: undefined
74
82
  },
75
83
  is24HourClock: true,
76
- timeZone: 'Europe/Berlin'
84
+ timeZone: 'Europe/Berlin',
85
+ gestureControlValues: {
86
+ isEnd: false
87
+ }
77
88
  }
78
89
 
79
90
  // energy generation
@@ -164,6 +175,12 @@ const nativePropsSlice = createSlice({
164
175
  },
165
176
  setTimeZone(state, action: PayloadAction<any>) {
166
177
  state.timeZone = action.payload
178
+ },
179
+ setGestrueControlValues(state, action: PayloadAction<any>) {
180
+ const keys = Object.keys(action.payload)
181
+ keys.forEach(key => {
182
+ state.gestureControlValues[key] = action.payload[key]
183
+ })
167
184
  }
168
185
  },
169
186
  })
@@ -419,7 +436,7 @@ export function useFeatureHook<GC, T extends PropertyValueTypes<GC>>(
419
436
  valueMapToDpValue?: (v: T) => any,
420
437
  getExtraDps?: (v: T) => any,
421
438
  getExtraConfig?: (v: T) => any,
422
- ): [T, (value: T) => Promise<Result<any>>] {
439
+ ): [T, (value: T, extraDps?: any, extraConfig?: any) => Promise<Result<any>>] {
423
440
  const [featureHook, setFH] = useGroupConfigFeature<GC, T>(featureKey)
424
441
  const setFeatureHook = useCallback(async (value: T, extraDps?: any, extraConfig?: any) => {
425
442
  const dpValue = valueMapToDpValue ? valueMapToDpValue(value) : value
@@ -432,6 +449,20 @@ export function useFeatureHook<GC, T extends PropertyValueTypes<GC>>(
432
449
  return [featureHook ?? defValue, setFeatureHook]
433
450
  }
434
451
 
452
+ function useGestureControl<K extends keyof GestureControlType>(key: K): [GestureControlType[K]] {
453
+ const value = useSelector((store) => {
454
+ const rawValue = store.ldvModules.gestureControlValues[key]
455
+ // 根据特定键的类型处理转换
456
+ if (['switch', 'isEnd'].includes(key) && typeof rawValue === 'number') {
457
+ return (rawValue === 1) as GestureControlType[K]
458
+ }
459
+
460
+ return rawValue as GestureControlType[K]
461
+ })
462
+
463
+ return [value]
464
+ }
465
+
435
466
  export const useFanMaxSpeed = () => {
436
467
  const { productId } = useDeviceInfo()
437
468
  return fanProductList.includes(productId) ? 20 : 3
@@ -457,6 +488,7 @@ export const {
457
488
  setSystemTimeFormat,
458
489
  setTimeZone,
459
490
  setEnergieverbrauch,
491
+ setGestrueControlValues,
460
492
  } = nativePropsSlice.actions
461
493
 
462
494
  export {
@@ -481,4 +513,5 @@ export {
481
513
  useTimeZone,
482
514
  useTimeZoneCity,
483
515
  useEnergieverbrauch,
516
+ useGestureControl
484
517
  }
package/src/res/index.ts CHANGED
@@ -79,5 +79,17 @@ export default {
79
79
  ic_water_alert_free: require('./pic_water_alert_free.png'),
80
80
  flag_icon: require('./flag_icon.png'),
81
81
  arrow_temp_up: require('./arrow_temp_up.png'),
82
- arrow_temp_down: require('./arrow_temp_down.png')
83
- }
82
+ arrow_temp_down: require('./arrow_temp_down.png'),
83
+ arrow_left: require('./materialiconsOutlinedArrowsNavKeyboardArrowLeft.png'),
84
+ arrow_right: require('./materialiconsOutlinedArrowsNavKeyboardArrowRight.png'),
85
+ ringdown: require('./src_res_ringdown.png'),
86
+ halfcircle: require('./src_res_halfcircle.png'),
87
+ coloring: require('./src_res_colorring.png'),
88
+ all: require('./src_res_all.png'),
89
+ half: require('./src_res_half.png'),
90
+ halfborder: require('./src_res_halfborder.png'),
91
+ un_like: require('./src_res_unlike.png'),
92
+ like: require('./src_res_like.png'),
93
+ cycle: require('./src_res_cycle.png'),
94
+ minus: require('./src_res_minus.png'),
95
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -396,3 +396,41 @@ export function withErrorHandling<T extends any[], R>(
396
396
  }
397
397
  }
398
398
  }
399
+
400
+ export function isConflictTask(task1, task2) {
401
+ // 检查两个时间段是否有重叠
402
+ function checkOverlap(start1, end1, start2, end2) {
403
+ return (start1 <= end2 && start2 <= end1);
404
+ }
405
+ // 检查一周的每一天
406
+ for (let i = 0; i < 7; i++) {
407
+ // 如果 task1 在该天执行
408
+ if (Number(task1.weeks[i]) === 1) {
409
+ const [start1, end1] = [task1.startTime, task1.endTime];
410
+ const task1CrossDay = start1 > end1;
411
+
412
+ // 如果 task2 在该天或跨天执行
413
+ for (let j = 0; j < 7; j++) {
414
+ if (Number(task2.weeks[j]) === 1) {
415
+ const [start2, end2] = [task2.startTime, task2.endTime];
416
+ const task2CrossDay = start2 > end2;
417
+ // 检查当前天是否有重叠
418
+ if (i === j && checkOverlap(start1, end1, start2, end2)) {
419
+ return true;
420
+ }
421
+
422
+ // 检查 task1 跨天并延伸到次日的情况
423
+ if (task1CrossDay && ((i + 1) % 7 === j) && checkOverlap(0, end1, start2, end2)) {
424
+ return true;
425
+ }
426
+
427
+ // 检查 task2 跨天并延伸到次日的情况
428
+ if (task2CrossDay && ((j + 1) % 7 === i) && checkOverlap(0, end2, start1, end1)) {
429
+ return true;
430
+ }
431
+ }
432
+ }
433
+ }
434
+ }
435
+ return false;
436
+ }
@@ -7,7 +7,8 @@ export enum WorkMode {
7
7
  Night = 'night',
8
8
  Disinfect = 'disinfect',
9
9
  Rhythm = 'rhythm',
10
- Plan = 'plan'
10
+ Plan = 'plan',
11
+ LoveScene = 'love_scene'
11
12
  }
12
13
 
13
14
  export type Category = 'light' | 'socket' | 'fan' | 'mainLight' | 'secondaryLight'
@@ -53,5 +54,39 @@ export interface JudgeTimeScheduleProps {
53
54
 
54
55
  export enum SceneStatusType {
55
56
  Mood = 'Mood',
56
- Flag = 'Flag'
57
+ Flag = 'Flag',
58
+ Scene = 'Scene',
59
+ DIY = 'DIY'
60
+ }
61
+
62
+ export enum AdjustType {
63
+ WHITE = '00',
64
+ COLOUR = '01',
65
+ LOVE = '03'
66
+ }
67
+
68
+ export interface HSV {
69
+ h: number
70
+ s: number
71
+ v: number
72
+ }
73
+
74
+ export interface DiySceneInfo {
75
+ id: number
76
+ type: 'Static' | 'Dynamic' | 'DIY'
77
+ name: string
78
+ speed?: number
79
+ nodes: DiySceneNode[]
80
+ duration?: number
81
+ mode?: number
82
+ h?: number
83
+ s?: number
84
+ v?: number
85
+ colorTemp?: number
86
+ brightness?: number
87
+ }
88
+
89
+ export interface DiySceneNode {
90
+ top: HSV
91
+ bottom: HSV
57
92
  }
package/translateKey.txt CHANGED
@@ -922,6 +922,41 @@ energyconsumption_emptydata
922
922
  date_type
923
923
  cancel_dialog_leave_unsaved_vacation_note
924
924
  mood_string_mode_light_show
925
+ mood_strip_mode_favorite
926
+ mood_overview_field_chip_diy
927
+ love_mood_alert_title
928
+ love_mood_alert_content
929
+ mood_strip_default_mood_focus
930
+ mood_strip_default_mood_lavender
931
+ mood_strip_default_mood_lavender_true_colors
932
+ mood_strip_default_mood_night_light
933
+ mood_strip_default_mood_cozy
934
+ mood_strip_default_mood_atmosphere
935
+ mood_strip_default_mood_relax
936
+ mood_strip_default_mood_sky
937
+ mood_strip_default_mood_ocean
938
+ mood_strip_default_mood_warmth
939
+ mood_strip_default_mood_romance
940
+ mood_strip_default_mood_jungle
941
+ mood_strip_default_mood_sunset
942
+ mood_strip_default_mood_missing
943
+ mood_strip_default_mood_party
944
+ mood_strip_default_mood_rainbow
945
+ mood_strip_default_mood_meditation
946
+ mood_strip_default_mood_wake_time
947
+ mood_strip_default_mood_spring
948
+ mood_strip_default_mood_halloween
949
+ mood_strip_default_mood_christmas
950
+ mood_strip_default_mood_noble
951
+ mood_strip_default_mood_energy
952
+ mood_strip_default_mood_deep_dive
953
+ mood_strip_default_mood_mojito
954
+ mood_strip_default_mood_forest
955
+ mood_strip_default_mood_cyberpunk
956
+ mood_strip_default_mood_summer
957
+ mood_strip_default_mood_fall
958
+ mood_strip_default_mood_club
959
+ mood_strip_default_mood_candlelight
925
960
  thermostat_scene
926
961
  thermostat_vacationplan
927
962
  thermostat_automatictab
@@ -935,4 +970,4 @@ thermostat_editscene
935
970
  thermostat_inputlosteditscene
936
971
  thermostat_infocancelscene
937
972
  thermostat_cancelscene
938
- thermostat_deletescene
973
+ thermostat_deletescene