@ledvance/ui-biz-bundle 1.0.53 → 1.0.54
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/.temp/img.png
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ import { useDeviceId } from '@ledvance/base/src/models/modules/NativePropsSlice'
|
|
|
16
16
|
import res from '@ledvance/base/src/res'
|
|
17
17
|
import { useReactive } from 'ahooks'
|
|
18
18
|
import { dpItem, TimeSchedulePageRouteParams } from './TimeSchedulePage'
|
|
19
|
-
import { cloneDeep, differenceBy, isEqual } from 'lodash'
|
|
19
|
+
import { cloneDeep, differenceBy, isEqual, isNumber } from 'lodash'
|
|
20
20
|
import DeviceState from './DeviceState'
|
|
21
21
|
import { getHexByHSV, getHSVByHex } from '@ledvance/base/src/utils'
|
|
22
22
|
import { Buffer } from 'buffer'
|
|
@@ -87,7 +87,7 @@ const TimeScheduleEditPage = () => {
|
|
|
87
87
|
state.hour = scheduleItem.time.split(':')[0]
|
|
88
88
|
state.minute = scheduleItem.time.split(':')[1]
|
|
89
89
|
state.name = scheduleItem.aliasName
|
|
90
|
-
state.isNotification = scheduleItem.isAppPush
|
|
90
|
+
state.isNotification = !!scheduleItem.isAppPush
|
|
91
91
|
state.loop = scheduleItem.loops.split('').map((mItem: string) => parseInt(mItem))
|
|
92
92
|
state.selectedSkill = dps.reduce((pre, cur) => {
|
|
93
93
|
if (scheduleItem.dps[cur.dpId] !== undefined) {
|
|
@@ -106,8 +106,6 @@ const TimeScheduleEditPage = () => {
|
|
|
106
106
|
}
|
|
107
107
|
state.isManual = lightData.isManual
|
|
108
108
|
state.actionScene = lightData.actionScene
|
|
109
|
-
|
|
110
|
-
console.log('singleActions', JSON.stringify(state.singleActions))
|
|
111
109
|
return
|
|
112
110
|
}
|
|
113
111
|
|
|
@@ -175,7 +173,14 @@ const TimeScheduleEditPage = () => {
|
|
|
175
173
|
}
|
|
176
174
|
|
|
177
175
|
const saveEnable = () => {
|
|
178
|
-
return state.
|
|
176
|
+
return !state.loading && state.selectedSkill.length && state.name.length && state.name.length <= 32 &&
|
|
177
|
+
[
|
|
178
|
+
!isEqual(scheduleItem?.aliasName, state.name),
|
|
179
|
+
!isEqual(scheduleItem?.time, [state.hour, state.minute].join(':')),
|
|
180
|
+
!isEqual(scheduleItem?.loops, state.loop.join('')),
|
|
181
|
+
!isEqual(!!scheduleItem?.isAppPush, state.isNotification),
|
|
182
|
+
!isEqual(scheduleItem?.dps, getSendDps()),
|
|
183
|
+
].some(e => e)
|
|
179
184
|
}
|
|
180
185
|
|
|
181
186
|
const saveAction = () => {
|
|
@@ -229,6 +234,14 @@ const TimeScheduleEditPage = () => {
|
|
|
229
234
|
}
|
|
230
235
|
|
|
231
236
|
const getSendDps = () => {
|
|
237
|
+
if (props.lightData2dps) {
|
|
238
|
+
return props.lightData2dps({
|
|
239
|
+
singleActions: state.singleActions,
|
|
240
|
+
mixActions: state.mixActions,
|
|
241
|
+
actionScene: isNumber(state.actionScene?.id) ? state.actionScene : undefined,
|
|
242
|
+
isManual: state.isManual,
|
|
243
|
+
})
|
|
244
|
+
}
|
|
232
245
|
if (state.isManual) {
|
|
233
246
|
if (props.isDIMLamp) {
|
|
234
247
|
return {
|
|
@@ -349,13 +362,7 @@ const TimeScheduleEditPage = () => {
|
|
|
349
362
|
}
|
|
350
363
|
|
|
351
364
|
const getAllDps = () => {
|
|
352
|
-
const
|
|
353
|
-
singleActions: state.singleActions,
|
|
354
|
-
mixActions: state.mixActions,
|
|
355
|
-
actionScene: state.actionScene,
|
|
356
|
-
isManual: state.isManual,
|
|
357
|
-
}) : ''
|
|
358
|
-
const dpsValue = incommingValue || getSendDps()
|
|
365
|
+
const dpsValue = getSendDps()
|
|
359
366
|
if (state.isManual && !props.isMixRGBWLamp) {
|
|
360
367
|
let v = {}
|
|
361
368
|
state.selectedSkill.forEach(skill => {
|
|
@@ -371,7 +378,7 @@ const TimeScheduleEditPage = () => {
|
|
|
371
378
|
}
|
|
372
379
|
|
|
373
380
|
const setSendDps = useCallback((actions, type) => {
|
|
374
|
-
console.log('setSendDps', actions, type)
|
|
381
|
+
console.log('setSendDps --->', actions, type)
|
|
375
382
|
state[type] = actions
|
|
376
383
|
}, [])
|
|
377
384
|
|
|
@@ -431,17 +438,9 @@ const TimeScheduleEditPage = () => {
|
|
|
431
438
|
return (
|
|
432
439
|
<Page
|
|
433
440
|
backText={I18n.getLang('motion_detection_add_time_schedule_system_back_text')}
|
|
434
|
-
onBackClick={navigation.goBack}
|
|
435
441
|
rightButtonIcon={saveEnable() ? res.ic_check : res.ic_uncheck}
|
|
436
442
|
rightButtonIconClick={() => saveAction()}
|
|
437
|
-
rightButtonDisabled={
|
|
438
|
-
state.loading ||
|
|
439
|
-
(scheduleItem?.aliasName === state.name &&
|
|
440
|
-
JSON.stringify(scheduleItem?.time) === JSON.stringify([state.hour, state.minute].join(':')) &&
|
|
441
|
-
JSON.stringify(scheduleItem?.loops) === JSON.stringify(state.loop.join('')) &&
|
|
442
|
-
scheduleItem?.isAppPush === state.isNotification &&
|
|
443
|
-
isEqual(scheduleItem?.dps, getSendDps()))
|
|
444
|
-
}
|
|
443
|
+
rightButtonDisabled={!saveEnable()}
|
|
445
444
|
showBackDialog={true}
|
|
446
445
|
backDialogTitle={I18n.getLang('cancel_dialog_leave_unsaved_titel')}
|
|
447
446
|
backDialogContent={I18n.getLang('cancel_dialog_leave_unsaved_timeschedule_note')}>
|
|
@@ -459,8 +458,7 @@ const TimeScheduleEditPage = () => {
|
|
|
459
458
|
state.name = t
|
|
460
459
|
}}
|
|
461
460
|
showError={state.name.length > 32}
|
|
462
|
-
errorText={I18n.getLang('add_new_dynamic_mood_alert_text')}
|
|
463
|
-
/>
|
|
461
|
+
errorText={I18n.getLang('add_new_dynamic_mood_alert_text')}/>
|
|
464
462
|
{/* pick */}
|
|
465
463
|
<LdvPickerView
|
|
466
464
|
style={styles.picker}
|
|
@@ -468,14 +466,12 @@ const TimeScheduleEditPage = () => {
|
|
|
468
466
|
minute={state.minute}
|
|
469
467
|
setHour={v => (state.hour = v)}
|
|
470
468
|
setMinute={v => (state.minute = v)}
|
|
471
|
-
unit={['h', 'min']}
|
|
472
|
-
/>
|
|
469
|
+
unit={['h', 'min']}/>
|
|
473
470
|
{/* week */}
|
|
474
471
|
<LdvWeekView
|
|
475
472
|
value={state.loop}
|
|
476
473
|
style={styles.zeroMarginHorizontal}
|
|
477
|
-
onSelect={selectWeekAction}
|
|
478
|
-
/>
|
|
474
|
+
onSelect={selectWeekAction}/>
|
|
479
475
|
<Text style={styles.loopText}>{loopText(state.loop)}</Text>
|
|
480
476
|
{/* Apply for */}
|
|
481
477
|
<View>
|
|
@@ -496,13 +492,11 @@ const TimeScheduleEditPage = () => {
|
|
|
496
492
|
marginHorizontal: cx(8),
|
|
497
493
|
marginTop: cx(8),
|
|
498
494
|
borderRadius: 4,
|
|
499
|
-
}}
|
|
500
|
-
>
|
|
495
|
+
}}>
|
|
501
496
|
<FlatList
|
|
502
497
|
data={state.selectedSkill}
|
|
503
498
|
renderItem={item => renderItem(item)}
|
|
504
|
-
keyExtractor={(item) => item.dpId + 'selected'}
|
|
505
|
-
/>
|
|
499
|
+
keyExtractor={(item) => item.dpId + 'selected'}/>
|
|
506
500
|
</View>}
|
|
507
501
|
</View>
|
|
508
502
|
{state.skillList.map((item) => {
|
|
@@ -542,8 +536,7 @@ const TimeScheduleEditPage = () => {
|
|
|
542
536
|
isFanLamp={props.isFanLamp}
|
|
543
537
|
isSupportMode={props.isSupportMode}
|
|
544
538
|
isSupportBrightness={props.isSupportBrightness}
|
|
545
|
-
isSupportTemperature={props.isSupportTemperature}
|
|
546
|
-
/>
|
|
539
|
+
isSupportTemperature={props.isSupportTemperature}/>
|
|
547
540
|
{!hasSelected() && <View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
548
541
|
<Image style={{ width: cx(16), height: cx(16), tintColor: '#FF9500' }} source={res.ic_warning_amber}/>
|
|
549
542
|
<Text style={{
|
|
@@ -559,8 +552,7 @@ const TimeScheduleEditPage = () => {
|
|
|
559
552
|
value={state.isNotification}
|
|
560
553
|
onValueChange={value => {
|
|
561
554
|
state.isNotification = value
|
|
562
|
-
}}
|
|
563
|
-
/>
|
|
555
|
+
}}/>
|
|
564
556
|
</View>
|
|
565
557
|
{/* Summary */}
|
|
566
558
|
<View>
|
|
@@ -610,24 +602,26 @@ const TimeScheduleEditPage = () => {
|
|
|
610
602
|
<View style={{marginLeft: cx(16)}}>
|
|
611
603
|
{!!state.selectedSkill.length && <>
|
|
612
604
|
{(!!state.selectedSkill.filter(skill => skill.enable).length) && <>
|
|
613
|
-
<Text style={{marginLeft: cx(5)}}>{I18n.getLang('feature_summary_action_txt_1')}</Text>
|
|
605
|
+
<Text style={{ marginLeft: cx(5) }}>{I18n.getLang('feature_summary_action_txt_1')}</Text>
|
|
614
606
|
<View style={{ flexDirection: 'row' }}>{
|
|
615
607
|
state.selectedSkill.filter(skill => skill.enable).map(item => (
|
|
616
|
-
<View style={[styles.summaryRight, {marginLeft: cx(5), marginBottom: cx(5)}]}
|
|
608
|
+
<View style={[styles.summaryRight, { marginLeft: cx(5), marginBottom: cx(5) }]}
|
|
609
|
+
key={item.dpId}>
|
|
617
610
|
<Text style={[styles.rightItem]}
|
|
618
|
-
|
|
611
|
+
>{item.label}</Text>
|
|
619
612
|
</View>
|
|
620
613
|
))
|
|
621
614
|
}</View>
|
|
622
615
|
</>}
|
|
623
616
|
|
|
624
617
|
{(!!state.selectedSkill.filter(skill => !skill.enable).length) && <>
|
|
625
|
-
<Text style={{marginLeft: cx(5)}}>{I18n.getLang('feature_summary_action_txt_2')}</Text>
|
|
618
|
+
<Text style={{ marginLeft: cx(5) }}>{I18n.getLang('feature_summary_action_txt_2')}</Text>
|
|
626
619
|
<View style={{ flexDirection: 'row' }}>{
|
|
627
620
|
state.selectedSkill.filter(skill => !skill.enable).map(item => (
|
|
628
|
-
<View style={[styles.summaryRight, {marginLeft: cx(5), marginBottom: cx(5)}]}
|
|
621
|
+
<View style={[styles.summaryRight, { marginLeft: cx(5), marginBottom: cx(5) }]}
|
|
622
|
+
key={item.dpId}>
|
|
629
623
|
<Text style={[styles.rightItem]}
|
|
630
|
-
|
|
624
|
+
>{item.label}</Text>
|
|
631
625
|
</View>
|
|
632
626
|
))
|
|
633
627
|
}</View>
|
|
@@ -51,8 +51,6 @@ const TimeSchedulePage = () => {
|
|
|
51
51
|
const navigation = useNavigation()
|
|
52
52
|
const props = useRoute().params as TimeSchedulePageRouteParams
|
|
53
53
|
|
|
54
|
-
console.log('TimeSchedulePage params', props)
|
|
55
|
-
|
|
56
54
|
const { dps } = props
|
|
57
55
|
const state = useReactive({
|
|
58
56
|
timeScheduleList: [] as any[],
|
|
@@ -78,7 +76,6 @@ const TimeSchedulePage = () => {
|
|
|
78
76
|
const checkedTags = Object.keys(state.filterTags).filter(tag => state.filterTags[tag])
|
|
79
77
|
state.filterScheduleList = state.timeScheduleList.filter(item => checkedTags.every(tag => item.dps[tag] !== undefined))
|
|
80
78
|
}
|
|
81
|
-
console.log('过滤后ScheduleList', state.filterScheduleList)
|
|
82
79
|
}, [state.filterTags])
|
|
83
80
|
|
|
84
81
|
const navigateToEdit = useCallback((mode: 'add' | 'edit', scheduleItem?: any) => {
|
|
@@ -107,8 +104,6 @@ const TimeSchedulePage = () => {
|
|
|
107
104
|
})
|
|
108
105
|
state.timeScheduleList = originList
|
|
109
106
|
state.filterScheduleList = originList
|
|
110
|
-
console.log('获取TimerScheduleList', res)
|
|
111
|
-
console.log('获取TimerScheduleList', originList)
|
|
112
107
|
setTimeSchedule(getScheduleRunning())
|
|
113
108
|
}
|
|
114
109
|
}
|
|
@@ -182,8 +177,7 @@ const TimeSchedulePage = () => {
|
|
|
182
177
|
onPress={(item) => navigateToEdit('edit', item)}
|
|
183
178
|
onLongPress={(item) => {
|
|
184
179
|
deleteDialog(item).then()
|
|
185
|
-
}}
|
|
186
|
-
/>
|
|
180
|
+
}}/>
|
|
187
181
|
)
|
|
188
182
|
}
|
|
189
183
|
|
|
@@ -238,7 +232,7 @@ const TimeSchedulePage = () => {
|
|
|
238
232
|
data={state.filterScheduleList}
|
|
239
233
|
keyExtractor={(item: any) => item.id}
|
|
240
234
|
renderItem={renderItem}
|
|
241
|
-
ListFooterComponent={() => (<Spacer
|
|
235
|
+
ListFooterComponent={() => (<Spacer/>)}
|
|
242
236
|
/>
|
|
243
237
|
:
|
|
244
238
|
<View style={styles.emptyListCon}>
|