@ledvance/ui-biz-bundle 1.1.132 → 1.1.134

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 (38) hide show
  1. package/package.json +1 -1
  2. package/src/hooks/DeviceDpStateHooks.ts +2 -1
  3. package/src/modules/mood/DynamicMoodEditorPage.tsx +1 -1
  4. package/src/modules/mood/FantasyMoodEditPage.tsx +1 -1
  5. package/src/modules/mood/MixMood/MixMoodEditPage.tsx +1 -1
  6. package/src/modules/mood/StaticMoodEditorPage.tsx +2 -2
  7. package/src/newModules/biorhythm/BiorhythmActions.ts +22 -8
  8. package/src/newModules/biorhythm/BiorhythmPage.tsx +119 -80
  9. package/src/newModules/biorhythm/circular/RhythmsCircle.tsx +483 -0
  10. package/src/newModules/biorhythm/circular/conical-gradient/Android.tsx +63 -0
  11. package/src/newModules/biorhythm/circular/conical-gradient/Ios.tsx +26 -0
  12. package/src/newModules/biorhythm/circular/conical-gradient/Normal.tsx +187 -0
  13. package/src/newModules/biorhythm/circular/conical-gradient/index.android.tsx +164 -0
  14. package/src/newModules/biorhythm/circular/conical-gradient/index.ios.tsx +124 -0
  15. package/src/newModules/biorhythm/circular/conical-gradient/index.tsx +3 -0
  16. package/src/newModules/biorhythm/circular/conical-gradient/index.web.tsx +94 -0
  17. package/src/newModules/biorhythm/circular/conical-gradient/interface.ts +19 -0
  18. package/src/newModules/biorhythm/circular/conical-gradient/utils.ts +25 -0
  19. package/src/newModules/biorhythm/circular/interface.ts +114 -0
  20. package/src/newModules/diyScene/DiySceneEditorPage.tsx +4 -6
  21. package/src/newModules/energyConsumption/component/EnergyModal.tsx +3 -0
  22. package/src/newModules/lightMode/LightModePage.tsx +52 -145
  23. package/src/newModules/mood/DynamicMoodEditorPage.tsx +1 -1
  24. package/src/newModules/mood/MixDynamicMoodEditor.tsx +1 -1
  25. package/src/newModules/mood/MoodInfo.ts +1 -1
  26. package/src/newModules/mood/MoodPage.tsx +4 -5
  27. package/src/newModules/mood/StaticMoodEditorPage.tsx +1 -1
  28. package/src/newModules/powerOnBehavior/LightBehaviorPage.tsx +37 -120
  29. package/src/newModules/powerOnBehavior/PlugBehaviorPage.tsx +60 -141
  30. package/src/newModules/powerOnBehavior/PowerOnBehaviorActions.ts +13 -5
  31. package/src/newModules/sleepWakeUp/SleepWakeUpActions.ts +122 -59
  32. package/src/newModules/sleepWakeUp/SleepWakeUpPage.tsx +12 -11
  33. package/src/newModules/biorhythm/circular/ItemIcon.d.ts +0 -22
  34. package/src/newModules/biorhythm/circular/ItemIcon.tsx +0 -173
  35. package/src/newModules/biorhythm/circular/Progress.d.ts +0 -24
  36. package/src/newModules/biorhythm/circular/Progress.tsx +0 -372
  37. package/src/newModules/biorhythm/circular/TimeCircular.d.ts +0 -11
  38. package/src/newModules/biorhythm/circular/TimeCircular.tsx +0 -64
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.132",
7
+ "version": "1.1.134",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -112,7 +112,8 @@ export const useConflictTask = (conflictDps: ConflictDps, isPlug?: boolean): [(v
112
112
  const biorhythmTask = {
113
113
  startTime: 0,
114
114
  endTime: 1440,
115
- weeks: biorhythm.repeatPeriod.map(item => item.enabled ? 1 : 0)
115
+ weeks: biorhythm.repeatPeriod.map(item => item.enabled ? 1 : 0),
116
+ channel: 1
116
117
  }
117
118
  if (isConflictTask(conflictItem, biorhythmTask)){
118
119
  newState[conflictDps.biorhythmDpCode] = {
@@ -191,7 +191,7 @@ const DynamicMoodEditorPage = () => {
191
191
  maxLength={33}
192
192
  showError={state.mood.name.length > 32 || nameRepeat}
193
193
  tipColor={nameRepeat ? '#f00' : undefined}
194
- tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
194
+ tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
195
195
  errorText={Strings.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')}/>
196
196
  <Card style={styles.adjustCard}>
197
197
  <Spacer height={cx(16)}/>
@@ -227,7 +227,7 @@ const FantasyMoodEditPage = () => {
227
227
  showError={state.mood.name.length > 32 || nameRepeat}
228
228
  maxLength={33}
229
229
  tipColor={nameRepeat ? '#f00' : undefined}
230
- tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
230
+ tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
231
231
  errorText={I18n.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')} />
232
232
  <Card style={styles.adjustCard}>
233
233
  <Spacer height={cx(16)} />
@@ -191,7 +191,7 @@ const RgbcMoodEditPage = () => {
191
191
  showError={state.mood.name.length > 32 || nameRepeat}
192
192
  maxLength={33}
193
193
  tipColor={nameRepeat ? '#f00' : undefined}
194
- tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
194
+ tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
195
195
  errorText={I18n.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')} />
196
196
  {params.isStatic ? <Card style={styles.adjustCard}>
197
197
  <LdvSwitch
@@ -191,7 +191,7 @@ const StaticMoodEditorPage = () => {
191
191
  maxLength={33}
192
192
  showError={state.mood.name.length > 32 || nameRepeat}
193
193
  tipColor={nameRepeat ? '#f00' : undefined}
194
- tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
194
+ tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
195
195
  errorText={Strings.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')}/>
196
196
  <Card style={styles.adjustCard}>
197
197
  <Spacer height={cx(16)}/>
@@ -318,4 +318,4 @@ const styles = StyleSheet.create({
318
318
  },
319
319
  })
320
320
 
321
- export default StaticMoodEditorPage
321
+ export default StaticMoodEditorPage
@@ -10,7 +10,7 @@ import {
10
10
  Plan,
11
11
  RemoteBiorhythmBean,
12
12
  } from './BiorhythmBean'
13
- import { useCallback, useEffect, useState } from 'react'
13
+ import { useCallback, useEffect, useState, useRef } from 'react'
14
14
  import { NativeResult, Result } from '@ledvance/base/src/models/modules/Result'
15
15
  import { useDeviceId, useDp } from '@ledvance/base/src/models/modules/NativePropsSlice'
16
16
  import { getFeature, NativeApi, putFeature } from '@ledvance/base/src/api/native'
@@ -29,6 +29,8 @@ export const useBiorhythm: UseBiorhythmType = (dpKey: string, disabledFeature?:
29
29
  const [dp, setDp] = useDp<string, (v: string) => any>(dpKey)
30
30
  const deviceId = useDeviceId()
31
31
  const [biorhythmState, setBiorhythmState] = useState(dp2Obj(dp))
32
+ const isInternalUpdateRef = useRef(false)
33
+ const previousDpRef = useRef(dp)
32
34
 
33
35
  const getBiorhythm = useCallback(() => {
34
36
  const biorhythm = dp2Obj(dp)
@@ -46,27 +48,39 @@ export const useBiorhythm: UseBiorhythmType = (dpKey: string, disabledFeature?:
46
48
 
47
49
  useEffect(() => {
48
50
  if (disabledFeature) return
49
- biorhythmTimer = setTimeout(() => {
50
- getBiorhythm()
51
- }, 300)
52
-
53
- return () => {
54
- clearTimeout(biorhythmTimer)
55
- }
51
+ getBiorhythm()
56
52
  }, [])
57
53
 
58
54
  useUpdateEffect(() => {
55
+ if (isInternalUpdateRef.current || disabledFeature) {
56
+ if (isInternalUpdateRef.current) {
57
+ previousDpRef.current = dp
58
+ }
59
+ console.log('跳过更新', isInternalUpdateRef.current, disabledFeature)
60
+ isInternalUpdateRef.current = false
61
+ return
62
+ }
63
+ console.log('dp updateEffect', dp, previousDpRef.current, dp === previousDpRef.current)
64
+ if (dp?.toLocaleLowerCase() === previousDpRef.current?.toLocaleLowerCase()) {
65
+ return
66
+ }
59
67
  getBiorhythm()
60
68
  }, [dp])
61
69
 
62
70
  const setBiorhythmFn = async (biorhythmObj: BiorhythmBean, pushFeature: boolean = true) => {
63
71
  const dpValue = obj2Dp(biorhythmObj)
72
+ isInternalUpdateRef.current = true
73
+
64
74
  if (pushFeature) {
65
75
  const putFeatureRes = await putFeature(deviceId, biorhythmFeatureId, vo2Dto(biorhythmObj))
66
76
  if (putFeatureRes.result) {
77
+ setBiorhythmState(biorhythmObj)
67
78
  return setDp(dpValue)
79
+ } else {
80
+ isInternalUpdateRef.current = false
68
81
  }
69
82
  } else {
83
+ setBiorhythmState(biorhythmObj)
70
84
  return setDp(dpValue)
71
85
  }
72
86
  return { success: false }
@@ -25,7 +25,6 @@ import { setDataSource } from '@ledvance/base/src/components/weekSelect'
25
25
  import { BiorhythmEditPageParams } from './BiorhythmEditPage'
26
26
  import { useBiorhythm } from './BiorhythmActions'
27
27
  import { convertMinutesTo12HourFormat, showDialog as showCommonDialog } from '@ledvance/base/src/utils/common'
28
- import TimeCircular from './circular/TimeCircular'
29
28
  import Page from '@ledvance/base/src/components/Page'
30
29
  import Card from '@ledvance/base/src/components/Card'
31
30
  import Spacer from '@ledvance/base/src/components/Spacer'
@@ -33,6 +32,7 @@ import DeleteButton from '@ledvance/base/src/components/DeleteButton'
33
32
  import { useParams } from '@ledvance/base/src/hooks/Hooks'
34
33
  import ThemeType from '@ledvance/base/src/config/themeType'
35
34
  import { useConflictTask } from 'hooks/DeviceDpStateHooks'
35
+ import RhythmsCircle from './circular/RhythmsCircle'
36
36
 
37
37
  const cx = Utils.RatioUtils.convertX
38
38
  const { withTheme } = Utils.ThemeUtils
@@ -78,6 +78,14 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
78
78
  loading: false
79
79
  })
80
80
 
81
+ const timeImg = useMemo(() => {
82
+ if (is24Hour) {
83
+ return devicesJudge ? res.ic_warning_amber_sun : res.ic_warning_amber_new
84
+ } else {
85
+ return devicesJudge ? res.ic_warning_amber_sun_12 : res.ic_warning_amber_new_12
86
+ }
87
+ }, [is24Hour, devicesJudge])
88
+
81
89
  const showGradientTypeSelectModal = useCallback((show: boolean) => {
82
90
  state.showGradientTypeSelectModal = show
83
91
  }, [])
@@ -181,7 +189,7 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
181
189
  }
182
190
  }
183
191
 
184
- useEffect(() =>{
192
+ useEffect(() => {
185
193
  const weeks: string[] = setDataSource(
186
194
  biorhythm.repeatPeriod.map(item => {
187
195
  return item?.enabled ? 1 : 0
@@ -229,20 +237,20 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
229
237
  const sunHomeText = string => {
230
238
  const text = string.split('SUN@HOME')
231
239
  return text?.length === 1 && <Text style={{ fontSize: cx(14), color: props.theme?.global.fontColor }}>{text[0]}</Text> ||
232
- <Text style={{
233
- fontSize: cx(14),
234
- flexDirection: 'row',
235
- }}>
236
- <Text style={{color: props.theme?.global.fontColor }}>{text[0]}</Text>
237
- <Text onPress={openLink}
238
- style={{
239
- fontFamily: 'helvetica_neue_lt_std_roman',
240
- color: props.theme?.button.primary,
241
- textDecorationLine: 'underline',
242
- flexWrap: 'wrap',
243
- }}>SUN@HOME</Text>
244
- <Text style={{color: props.theme?.global.fontColor }}>{text[1]}</Text>
245
- </Text>
240
+ <Text style={{
241
+ fontSize: cx(14),
242
+ flexDirection: 'row',
243
+ }}>
244
+ <Text style={{ color: props.theme?.global.fontColor }}>{text[0]}</Text>
245
+ <Text onPress={openLink}
246
+ style={{
247
+ fontFamily: 'helvetica_neue_lt_std_roman',
248
+ color: props.theme?.button.primary,
249
+ textDecorationLine: 'underline',
250
+ flexWrap: 'wrap',
251
+ }}>SUN@HOME</Text>
252
+ <Text style={{ color: props.theme?.global.fontColor }}>{text[1]}</Text>
253
+ </Text>
246
254
  }
247
255
 
248
256
  const randomIcon = () => {
@@ -257,6 +265,17 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
257
265
  return availableChart[randomIndex]
258
266
  }
259
267
 
268
+ const convertPlandata = useCallback(() => {
269
+ return state.planList.map(item => {
270
+ return {
271
+ ...item,
272
+ noActiveColor: '#474e5d',
273
+ activeColor: '#F7EB2A',
274
+ color: item?.brightness === 0 ? '#000' : !params.isSupportTemperature && cctToColor(1) || cctToColor(item.colorTemperature.toFixed(), item?.brightness)
275
+ }
276
+ }).filter(plan => plan.enable)
277
+ }, [JSON.stringify(state.planList), params.isSupportTemperature])
278
+
260
279
  return (
261
280
  <>
262
281
  <Page
@@ -272,7 +291,8 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
272
291
  startTime: 0,
273
292
  endTime: 1440,
274
293
  weeks: biorhythm.repeatPeriod.map(item => item.enabled ? 1 : 0),
275
- enable: biorhythm.enable
294
+ enable: biorhythm.enable,
295
+ channel: 1
276
296
  }
277
297
  if (enable && checkConflict(biorhythmTask)) {
278
298
  return showCommonDialog({
@@ -347,10 +367,10 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
347
367
  })}
348
368
  </View>
349
369
  <View style={{ marginHorizontal: cx(24), marginTop: cx(20) }}>
350
- <Text style={{color: props.theme?.global.fontColor}}>{state.weekString}</Text>
370
+ <Text style={{ color: props.theme?.global.fontColor }}>{state.weekString}</Text>
351
371
  </View>
352
372
  <View style={{ marginHorizontal: cx(24), marginTop: cx(16) }}>
353
- <Text style={{color: props.theme?.global.fontColor}}>
373
+ <Text style={{ color: props.theme?.global.fontColor }}>
354
374
  {I18n.getLang('bio_ryhthm_default_selectionfield_topic_text')}
355
375
  </Text>
356
376
  <TouchableOpacity
@@ -389,7 +409,7 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
389
409
  </TouchableOpacity>
390
410
  </View>
391
411
  <View style={{ height: cx(20) }} />
392
- <TimeCircular
412
+ {/* <TimeCircular
393
413
  planEdit={true}
394
414
  planList={state.planList}
395
415
  onPanMoved={(id, time) => {
@@ -403,7 +423,26 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
403
423
  }}
404
424
  replaceStatus={devicesJudge}
405
425
  gradient={state.gradient === BiorhythmGradientType.DirectGradient}
406
- isSupportTemperature={!params.isSupportTemperature} />
426
+ isSupportTemperature={!params.isSupportTemperature} /> */}
427
+ <View style={{ alignItems: 'center', justifyContent: 'center' }}>
428
+ <RhythmsCircle
429
+ size={250}
430
+ ringWidth={40}
431
+ thumbSize={36}
432
+ timeImg={timeImg}
433
+ gradientMode={state.gradient === BiorhythmGradientType.EntireGradient}
434
+ data={convertPlandata()}
435
+ onRelease={(planList) => {
436
+ state.planList = state.planList.map(item => {
437
+ return {
438
+ ...item,
439
+ time: planList.find(p => p.index === item.index)?.time
440
+ }
441
+ })
442
+ state.flag = Symbol()
443
+ }}
444
+ />
445
+ </View>
407
446
  <View
408
447
  style={{
409
448
  flexDirection: 'row',
@@ -413,66 +452,66 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
413
452
  marginTop: cx(26),
414
453
  }}>
415
454
  {state.planList.length === 8 && <View
416
- style={{ marginVertical: cx(10), flexDirection: 'row', alignItems: 'center', width: width - cx(48) }}>
417
- <Image style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.warning }} source={{uri: res.ic_warning_amber}} />
418
- <Text
419
- style={{
420
- flexWrap: 'wrap',
421
- fontSize: cx(12),
422
- color: props.theme?.global.fontColor
423
- }}>{I18n.getLang('add_new_trigger_time_warning_max_number_text')}</Text>
455
+ style={{ marginVertical: cx(10), flexDirection: 'row', alignItems: 'center', width: width - cx(48) }}>
456
+ <Image style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.warning }} source={{ uri: res.ic_warning_amber }} />
457
+ <Text
458
+ style={{
459
+ flexWrap: 'wrap',
460
+ fontSize: cx(12),
461
+ color: props.theme?.global.fontColor
462
+ }}>{I18n.getLang('add_new_trigger_time_warning_max_number_text')}</Text>
424
463
  </View>}
425
464
  {state.planList.length < 8 &&
426
- <>
427
- <Text
428
- style={{
429
- fontSize: cx(16),
430
- fontWeight: 'bold',
431
- color: props.theme?.global.fontColor,
432
- }}>{I18n.getLang('bio_ryhthm_default_subheadline_text')}</Text>
433
- <TouchableOpacity
434
- onPress={() => {
435
- const ids: number[] = state.planList.map(p => p.index)
436
- const newPlan: Plan = {
437
- index: Math.max(...ids) + 1,
438
- icon: res.rhythm_icon1,
439
- time: 0,
440
- name: '',
441
- colorTemperature: 0,
442
- brightness: 100,
443
- action: [
444
- {
445
- uri: 'model/attribute/set/LightCtrl/ColorTemperature',
446
- startValue: `${colorTemperatureValue(0)}`,
447
- },
448
- {
449
- uri: 'model/attribute/set/LightCtrl/Brightness',
450
- startValue: '100',
451
- },
452
- ],
453
- enable: true,
454
- iconId: randomIcon(),
455
- }
456
- const editPageParams: BiorhythmEditPageParams = {
457
- planData: newPlan,
458
- isAdd: true,
459
- onPlanEdited,
460
- onPlanDelete,
461
- minimumEnable,
462
- nameRepeat,
463
- iconIdList: state.planList?.map(item => {
464
- return item.iconId
465
- }),
466
- isMixRGBWLamp: !!params.isMixLight,
467
- isSupportTemperature: params.isSupportTemperature,
468
- isSupportBrightness: params.isSupportBrightness,
469
- showDeleteBtn
470
- }
471
- navigation.navigate(ui_biz_routerKey.bi_biz_biological_edit, editPageParams)
472
- }}>
473
- <Image source={{uri: res.biorhythom_add}} style={{ height: cx(24), width: cx(24), tintColor: props.theme?.icon.primary }} />
474
- </TouchableOpacity>
475
- </>
465
+ <>
466
+ <Text
467
+ style={{
468
+ fontSize: cx(16),
469
+ fontWeight: 'bold',
470
+ color: props.theme?.global.fontColor,
471
+ }}>{I18n.getLang('bio_ryhthm_default_subheadline_text')}</Text>
472
+ <TouchableOpacity
473
+ onPress={() => {
474
+ const ids: number[] = state.planList.map(p => p.index)
475
+ const newPlan: Plan = {
476
+ index: Math.max(...ids) + 1,
477
+ icon: res.rhythm_icon1,
478
+ time: 0,
479
+ name: '',
480
+ colorTemperature: 0,
481
+ brightness: 100,
482
+ action: [
483
+ {
484
+ uri: 'model/attribute/set/LightCtrl/ColorTemperature',
485
+ startValue: `${colorTemperatureValue(0)}`,
486
+ },
487
+ {
488
+ uri: 'model/attribute/set/LightCtrl/Brightness',
489
+ startValue: '100',
490
+ },
491
+ ],
492
+ enable: true,
493
+ iconId: randomIcon(),
494
+ }
495
+ const editPageParams: BiorhythmEditPageParams = {
496
+ planData: newPlan,
497
+ isAdd: true,
498
+ onPlanEdited,
499
+ onPlanDelete,
500
+ minimumEnable,
501
+ nameRepeat,
502
+ iconIdList: state.planList?.map(item => {
503
+ return item.iconId
504
+ }),
505
+ isMixRGBWLamp: !!params.isMixLight,
506
+ isSupportTemperature: params.isSupportTemperature,
507
+ isSupportBrightness: params.isSupportBrightness,
508
+ showDeleteBtn
509
+ }
510
+ navigation.navigate(ui_biz_routerKey.bi_biz_biological_edit, editPageParams)
511
+ }}>
512
+ <Image source={{ uri: res.biorhythom_add }} style={{ height: cx(24), width: cx(24), tintColor: props.theme?.icon.primary }} />
513
+ </TouchableOpacity>
514
+ </>
476
515
  }
477
516
  </View>
478
517
  <FlatList
@@ -521,7 +560,7 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
521
560
  <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', marginTop: cx(16) }}>
522
561
  <View style={{ flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
523
562
  <Image
524
- source={{uri: setImg(item?.iconId)} || type && { uri: item?.icon } || item?.icon}
563
+ source={{ uri: setImg(item?.iconId) }}
525
564
  style={{
526
565
  width: cx(24),
527
566
  height: cx(24),