@ledvance/group-ui-biz-bundle 1.0.122 → 1.0.123
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
|
@@ -23,12 +23,15 @@ 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)
|
|
26
28
|
return {
|
|
27
29
|
...oldData,
|
|
30
|
+
repeatPeriod: repeatPeriod,
|
|
28
31
|
planList: oldData.planList.map(p => {
|
|
29
32
|
// @ts-ignore 老数据中使用的是startTime
|
|
30
33
|
if (!p.hasOwnProperty('time') && p.startTime){
|
|
31
|
-
|
|
34
|
+
// @ts-ignore
|
|
32
35
|
const t = p.startTime.split(':')
|
|
33
36
|
return {
|
|
34
37
|
...p,
|
|
@@ -72,6 +75,7 @@ export function dp2Obj(dp: string): BiorhythmBean {
|
|
|
72
75
|
enabled: p === '1',
|
|
73
76
|
}
|
|
74
77
|
})
|
|
78
|
+
repeatPeriod.sort((a, b) => a.index - b.index)
|
|
75
79
|
dpCopy = dpCopy.slice(2)
|
|
76
80
|
// 节点个数 (每个节点长度18),最多8个节点
|
|
77
81
|
hex2Int(dpCopy.slice(0, 2))
|
|
@@ -203,8 +207,9 @@ function obj2Dp(obj: BiorhythmBean): string {
|
|
|
203
207
|
const versionHex = '00'
|
|
204
208
|
const enableHex = obj.enable ? '01' : '00'
|
|
205
209
|
const gradientHex = obj.gradient === BiorhythmGradientType.EntireGradient ? '00' : '0F'
|
|
210
|
+
const newRepeatPeriod = [obj.repeatPeriod[obj.repeatPeriod.length - 1], ...obj.repeatPeriod.slice(0, -1)]
|
|
206
211
|
const repeatPeriodHex = parseInt(
|
|
207
|
-
|
|
212
|
+
newRepeatPeriod
|
|
208
213
|
.map(p => (p.enabled ? '1' : '0'))
|
|
209
214
|
.reverse()
|
|
210
215
|
.join(''),
|
|
@@ -22,7 +22,6 @@ 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'
|
|
26
25
|
import { BiorhythmEditPageParams } from './BiorhythmDetailPage'
|
|
27
26
|
import { useBiorhythm } from './BiorhythmActions'
|
|
28
27
|
import { convertMinutesTo12HourFormat, showDialog as showCommonDialog, showDialog } from '@ledvance/base/src/utils/common'
|
|
@@ -185,11 +184,7 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
185
184
|
}, [JSON.stringify(biorhythm)])
|
|
186
185
|
|
|
187
186
|
useEffect(() => {
|
|
188
|
-
const weeks
|
|
189
|
-
biorhythm.repeatPeriod.map(item => {
|
|
190
|
-
return item?.enabled ? 1 : 0
|
|
191
|
-
})).filter(item => item.enabled)
|
|
192
|
-
.map(item => item.title)
|
|
187
|
+
const weeks = biorhythm.repeatPeriod.filter(it => it.enabled).map(it => it.title)
|
|
193
188
|
|
|
194
189
|
if (weeks.length > 0) {
|
|
195
190
|
// / more than one
|
|
@@ -219,20 +214,20 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
219
214
|
const sunHomeText = string => {
|
|
220
215
|
const text = string.split('SUN@HOME')
|
|
221
216
|
return text?.length === 1 && <Text style={{ fontSize: cx(14), color: props.theme?.global.fontColor }}>{text[0]}</Text> ||
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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>
|
|
236
231
|
}
|
|
237
232
|
|
|
238
233
|
const randomIcon = () => {
|
|
@@ -433,66 +428,66 @@ const BiorhythmPage = (props: { theme?: ThemeType }) => {
|
|
|
433
428
|
marginTop: cx(26),
|
|
434
429
|
}}>
|
|
435
430
|
{state.planList.length === 8 && <View
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
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>
|
|
444
439
|
</View>}
|
|
445
440
|
{state.planList.length < 8 &&
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
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
|
+
</>
|
|
496
491
|
}
|
|
497
492
|
</View>
|
|
498
493
|
<FlatList
|
|
@@ -94,6 +94,11 @@ const RhythmsCircle: React.FC<RhythmsCircleProps & { gradientMode?: boolean }> =
|
|
|
94
94
|
const getRingColors = (data: IData[]) => {
|
|
95
95
|
type ColorStop = { color: string; angle: number };
|
|
96
96
|
|
|
97
|
+
// 防止数据为空时崩溃
|
|
98
|
+
if (!data || !data.length) {
|
|
99
|
+
return [{ color: '#000', angle: 0 }, { color: '#000', angle: fullDeg }]
|
|
100
|
+
}
|
|
101
|
+
|
|
97
102
|
// 角度规范化函数:确保角度在0到2π范围内
|
|
98
103
|
const normalizeAngle = (angle: number) => {
|
|
99
104
|
while (angle < 0) {
|