@ledvance/group-ui-biz-bundle 1.0.123 → 1.0.126

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/group-ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.0.123",
7
+ "version": "1.0.126",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -23,15 +23,12 @@ export const useBiorhythm = (): [BiorhythmBean, (value: BiorhythmBean) => Promis
23
23
  return obj2Dp(val)
24
24
  })
25
25
  const supportOldData = useCallback((oldData: BiorhythmBean) =>{
26
- const repeatPeriod = [...oldData.repeatPeriod]
27
- repeatPeriod.sort((a, b) => a.index - b.index)
28
26
  return {
29
27
  ...oldData,
30
- repeatPeriod: repeatPeriod,
31
28
  planList: oldData.planList.map(p => {
32
29
  // @ts-ignore 老数据中使用的是startTime
33
30
  if (!p.hasOwnProperty('time') && p.startTime){
34
- // @ts-ignore
31
+ // @ts-ignore
35
32
  const t = p.startTime.split(':')
36
33
  return {
37
34
  ...p,
@@ -75,7 +72,6 @@ export function dp2Obj(dp: string): BiorhythmBean {
75
72
  enabled: p === '1',
76
73
  }
77
74
  })
78
- repeatPeriod.sort((a, b) => a.index - b.index)
79
75
  dpCopy = dpCopy.slice(2)
80
76
  // 节点个数 (每个节点长度18),最多8个节点
81
77
  hex2Int(dpCopy.slice(0, 2))
@@ -207,9 +203,8 @@ function obj2Dp(obj: BiorhythmBean): string {
207
203
  const versionHex = '00'
208
204
  const enableHex = obj.enable ? '01' : '00'
209
205
  const gradientHex = obj.gradient === BiorhythmGradientType.EntireGradient ? '00' : '0F'
210
- const newRepeatPeriod = [obj.repeatPeriod[obj.repeatPeriod.length - 1], ...obj.repeatPeriod.slice(0, -1)]
211
206
  const repeatPeriodHex = parseInt(
212
- newRepeatPeriod
207
+ obj.repeatPeriod
213
208
  .map(p => (p.enabled ? '1' : '0'))
214
209
  .reverse()
215
210
  .join(''),
@@ -22,6 +22,7 @@ import I18n from '@ledvance/base/src/i18n'
22
22
  import res from '@ledvance/base/src/res'
23
23
  import { ui_biz_routerKey } from '../../navigation/Routers'
24
24
  import { cctToColor } from '@ledvance/base/src/utils/cctUtils'
25
+ import { setDataSource } from '@ledvance/base/src/components/weekSelect'
25
26
  import { BiorhythmEditPageParams } from './BiorhythmDetailPage'
26
27
  import { useBiorhythm } from './BiorhythmActions'
27
28
  import { convertMinutesTo12HourFormat, showDialog as showCommonDialog, showDialog } from '@ledvance/base/src/utils/common'
@@ -184,7 +185,11 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
184
185
  }, [JSON.stringify(biorhythm)])
185
186
 
186
187
  useEffect(() => {
187
- const weeks = biorhythm.repeatPeriod.filter(it => it.enabled).map(it => it.title)
188
+ const weeks: string[] = setDataSource(
189
+ biorhythm.repeatPeriod.map(item => {
190
+ return item?.enabled ? 1 : 0
191
+ })).filter(item => item.enabled)
192
+ .map(item => item.title)
188
193
 
189
194
  if (weeks.length > 0) {
190
195
  // / more than one
@@ -214,20 +219,20 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
214
219
  const sunHomeText = string => {
215
220
  const text = string.split('SUN@HOME')
216
221
  return text?.length === 1 && <Text style={{ fontSize: cx(14), color: props.theme?.global.fontColor }}>{text[0]}</Text> ||
217
- <Text style={{
218
- fontSize: cx(14),
219
- flexDirection: 'row',
220
- }}>
221
- <Text style={{ color: props.theme?.global.fontColor }}>{text[0]}</Text>
222
- <Text onPress={openLink}
223
- style={{
224
- fontFamily: 'helvetica_neue_lt_std_roman',
225
- color: props.theme?.button.primary,
226
- textDecorationLine: 'underline',
227
- flexWrap: 'wrap',
228
- }}>SUN@HOME</Text>
229
- <Text style={{ color: props.theme?.global.fontColor }}>{text[1]}</Text>
230
- </Text>
222
+ <Text style={{
223
+ fontSize: cx(14),
224
+ flexDirection: 'row',
225
+ }}>
226
+ <Text style={{ color: props.theme?.global.fontColor }}>{text[0]}</Text>
227
+ <Text onPress={openLink}
228
+ style={{
229
+ fontFamily: 'helvetica_neue_lt_std_roman',
230
+ color: props.theme?.button.primary,
231
+ textDecorationLine: 'underline',
232
+ flexWrap: 'wrap',
233
+ }}>SUN@HOME</Text>
234
+ <Text style={{ color: props.theme?.global.fontColor }}>{text[1]}</Text>
235
+ </Text>
231
236
  }
232
237
 
233
238
  const randomIcon = () => {
@@ -428,66 +433,66 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
428
433
  marginTop: cx(26),
429
434
  }}>
430
435
  {state.planList.length === 8 && <View
431
- style={{ marginVertical: cx(10), flexDirection: 'row', alignItems: 'center', width: width - cx(48) }}>
432
- <Image style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.warning }} source={{ uri: res.ic_warning_amber }} />
433
- <Text
434
- style={{
435
- flexWrap: 'wrap',
436
- fontSize: cx(12),
437
- color: props.theme?.global.fontColor
438
- }}>{I18n.getLang('add_new_trigger_time_warning_max_number_text')}</Text>
436
+ style={{ marginVertical: cx(10), flexDirection: 'row', alignItems: 'center', width: width - cx(48) }}>
437
+ <Image style={{ width: cx(16), height: cx(16), tintColor: props.theme?.global.warning }} source={{ uri: res.ic_warning_amber }} />
438
+ <Text
439
+ style={{
440
+ flexWrap: 'wrap',
441
+ fontSize: cx(12),
442
+ color: props.theme?.global.fontColor
443
+ }}>{I18n.getLang('add_new_trigger_time_warning_max_number_text')}</Text>
439
444
  </View>}
440
445
  {state.planList.length < 8 &&
441
- <>
442
- <Text
443
- style={{
444
- fontSize: cx(16),
445
- fontWeight: 'bold',
446
- color: props.theme?.global.fontColor,
447
- }}>{I18n.getLang('bio_ryhthm_default_subheadline_text')}</Text>
448
- <TouchableOpacity
449
- onPress={() => {
450
- const ids: number[] = state.planList.map(p => p.id)
451
- const newPlan: Plan = {
452
- id: Math.max(...ids) + 1,
453
- icon: res.rhythm_icon1,
454
- time: 0,
455
- name: '',
456
- colorTemperature: 0,
457
- brightness: 100,
458
- action: [
459
- {
460
- uri: 'model/attribute/set/LightCtrl/ColorTemperature',
461
- startValue: `${colorTemperatureValue(0)}`,
462
- },
463
- {
464
- uri: 'model/attribute/set/LightCtrl/Brightness',
465
- startValue: '100',
466
- },
467
- ],
468
- enable: true,
469
- iconId: randomIcon(),
470
- }
471
- const editPageParams: BiorhythmEditPageParams = {
472
- planData: newPlan,
473
- isAdd: true,
474
- onPlanEdited,
475
- onPlanDelete,
476
- nameRepeat,
477
- minimumEnable,
478
- iconIdList: state.planList?.map(item => {
479
- return item.iconId
480
- }),
481
- isMixLight: params.isMixLight,
482
- isSupportTemperature: params.isSupportTemperature,
483
- isSupportBrightness: params.isSupportBrightness,
484
- showDeleteBtn
485
- }
486
- navigation.navigate(ui_biz_routerKey.group_ui_biz_biological_detail, editPageParams)
487
- }}>
488
- <Image source={{ uri: res.biorhythom_add }} style={{ height: cx(24), width: cx(24), tintColor: props.theme?.icon.primary }} />
489
- </TouchableOpacity>
490
- </>
446
+ <>
447
+ <Text
448
+ style={{
449
+ fontSize: cx(16),
450
+ fontWeight: 'bold',
451
+ color: props.theme?.global.fontColor,
452
+ }}>{I18n.getLang('bio_ryhthm_default_subheadline_text')}</Text>
453
+ <TouchableOpacity
454
+ onPress={() => {
455
+ const ids: number[] = state.planList.map(p => p.id)
456
+ const newPlan: Plan = {
457
+ id: Math.max(...ids) + 1,
458
+ icon: res.rhythm_icon1,
459
+ time: 0,
460
+ name: '',
461
+ colorTemperature: 0,
462
+ brightness: 100,
463
+ action: [
464
+ {
465
+ uri: 'model/attribute/set/LightCtrl/ColorTemperature',
466
+ startValue: `${colorTemperatureValue(0)}`,
467
+ },
468
+ {
469
+ uri: 'model/attribute/set/LightCtrl/Brightness',
470
+ startValue: '100',
471
+ },
472
+ ],
473
+ enable: true,
474
+ iconId: randomIcon(),
475
+ }
476
+ const editPageParams: BiorhythmEditPageParams = {
477
+ planData: newPlan,
478
+ isAdd: true,
479
+ onPlanEdited,
480
+ onPlanDelete,
481
+ nameRepeat,
482
+ minimumEnable,
483
+ iconIdList: state.planList?.map(item => {
484
+ return item.iconId
485
+ }),
486
+ isMixLight: params.isMixLight,
487
+ isSupportTemperature: params.isSupportTemperature,
488
+ isSupportBrightness: params.isSupportBrightness,
489
+ showDeleteBtn
490
+ }
491
+ navigation.navigate(ui_biz_routerKey.group_ui_biz_biological_detail, editPageParams)
492
+ }}>
493
+ <Image source={{ uri: res.biorhythom_add }} style={{ height: cx(24), width: cx(24), tintColor: props.theme?.icon.primary }} />
494
+ </TouchableOpacity>
495
+ </>
491
496
  }
492
497
  </View>
493
498
  <FlatList