@ledvance/ui-biz-bundle 1.1.71 → 1.1.72
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 +1 -1
- package/src/modules/timer/TimerPageAction.ts +11 -0
- package/src/navigation/Routers.ts +1 -0
- package/src/newModules/fixedTime/FixedTimeActions.ts +2 -2
- package/src/newModules/fixedTime/FixedTimeDetailPage.tsx +3 -3
- package/src/newModules/fixedTime/FixedTimePage.tsx +4 -4
- package/src/newModules/randomTime/RandomTimeActions.ts +2 -2
- package/src/newModules/randomTime/RandomTimeDetailPage.tsx +3 -3
- package/src/newModules/randomTime/RandomTimePage.tsx +4 -4
package/package.json
CHANGED
|
@@ -129,3 +129,14 @@ export const useProgress = (dps: dpItem[]) => {
|
|
|
129
129
|
...dp
|
|
130
130
|
}))
|
|
131
131
|
}
|
|
132
|
+
|
|
133
|
+
export function timeFormat(time: number): string {
|
|
134
|
+
let hour = Math.trunc(time / 3600)
|
|
135
|
+
const beforeMin = (time % 3600) / 60
|
|
136
|
+
let min = Math.ceil(beforeMin)
|
|
137
|
+
if (min === 60) {
|
|
138
|
+
hour += 1
|
|
139
|
+
min = 0
|
|
140
|
+
}
|
|
141
|
+
return `${hour > 0 ? `${hour} h ` : ''}${min > 0 ? `${min} min` : ''}`
|
|
142
|
+
}
|
|
@@ -91,7 +91,7 @@ export const useFixedTime: UseFixedTimeType = (dpKey, isPlug, disableFeature) =>
|
|
|
91
91
|
return {
|
|
92
92
|
...item,
|
|
93
93
|
index: idx,
|
|
94
|
-
name: featureItem ? featureItem?.n : `${I18n.getLang('randomtimecycle_sockets_headline_text')} ${idx + 1}`
|
|
94
|
+
name: featureItem && featureItem?.n ? featureItem?.n : `${I18n.getLang('randomtimecycle_sockets_headline_text')} ${idx + 1}`
|
|
95
95
|
}
|
|
96
96
|
})
|
|
97
97
|
setFixedTimeUiList(uiPlan)
|
|
@@ -218,7 +218,7 @@ const fixedTimeObj2Dp = (randomTimerData: FixedTimerData, isPlug?: boolean) => {
|
|
|
218
218
|
|
|
219
219
|
const fixedTimeToHex = (fixedTime: FixedTimer, isPlug?: boolean, isFeatureData?: boolean) => {
|
|
220
220
|
const { weeks, startTime, endTime, openTime, closeTime, channel, enable } = fixedTime
|
|
221
|
-
const channelStr = padStart((channel ?? 0).toString(2), 7, '0');
|
|
221
|
+
const channelStr = padStart((channel ?? (isPlug ? 0 : 1)).toString(2), 7, '0');
|
|
222
222
|
const powerChannel = parseInt(`${channelStr}${enable ? 1 : 0}`, 2);
|
|
223
223
|
const powerChannelStr = to16(powerChannel, 2);
|
|
224
224
|
const weeksValue: string = padStart([...weeks].reverse().join(''), 8, '0');
|
|
@@ -146,7 +146,7 @@ const FixedTimeDetailPage = () => {
|
|
|
146
146
|
{state.fixedTime.channel === undefined ?
|
|
147
147
|
<Text>{I18n.getLang('timer_ceiling_fan_selectionfield_no_components_text')}</Text> :
|
|
148
148
|
<View style={[styles.applyItem, { marginBottom: cx(10), borderRadius: 4 }]}>
|
|
149
|
-
<Text style={{ color: '#000' }}>{params.applyForList[state.fixedTime.channel]?.key}</Text>
|
|
149
|
+
<Text style={{ color: '#000' }}>{params.applyForList[params.isPlug ? state.fixedTime.channel : 0]?.key}</Text>
|
|
150
150
|
{params.applyForList.length > 1 && <TouchableOpacity
|
|
151
151
|
onPress={() => {
|
|
152
152
|
state.fixedTime.channel = undefined
|
|
@@ -158,13 +158,13 @@ const FixedTimeDetailPage = () => {
|
|
|
158
158
|
}
|
|
159
159
|
</View>
|
|
160
160
|
{params.applyForList.map((item, index) => {
|
|
161
|
-
if (state.fixedTime.channel === index) return null
|
|
161
|
+
if ((params.isPlug ? state.fixedTime.channel : 0)=== index) return null
|
|
162
162
|
return (
|
|
163
163
|
<TouchableOpacity
|
|
164
164
|
style={styles.applyItem}
|
|
165
165
|
key={item.key}
|
|
166
166
|
onPress={() => {
|
|
167
|
-
state.fixedTime.channel = index
|
|
167
|
+
state.fixedTime.channel = params.isPlug ? index : 1
|
|
168
168
|
}}>
|
|
169
169
|
<Text style={{ color: '#000' }}>{item.key}</Text>
|
|
170
170
|
<Image style={{ width: cx(16), height: cx(16) }} source={res.device_panel_timer_add} />
|
|
@@ -117,7 +117,7 @@ const FixedTimePage = () => {
|
|
|
117
117
|
loading={state.loading}
|
|
118
118
|
onBackClick={navigation.goBack}
|
|
119
119
|
onHeadlineIconClick={() => {
|
|
120
|
-
navigateToEdit('add', newFixedTime())
|
|
120
|
+
navigateToEdit('add', newFixedTime(!!params.isPlug))
|
|
121
121
|
}}
|
|
122
122
|
>
|
|
123
123
|
<ScrollView nestedScrollEnabled={true}>
|
|
@@ -185,7 +185,7 @@ const FixedTimePage = () => {
|
|
|
185
185
|
}}
|
|
186
186
|
textStyle={{ color: '#fff' }}
|
|
187
187
|
onPress={() => {
|
|
188
|
-
navigateToEdit('add', newFixedTime())
|
|
188
|
+
navigateToEdit('add', newFixedTime(!!params.isPlug))
|
|
189
189
|
}} />}
|
|
190
190
|
</View>}
|
|
191
191
|
</ScrollView>
|
|
@@ -230,7 +230,7 @@ const FixedTimeCard = memo((props: {
|
|
|
230
230
|
)
|
|
231
231
|
})
|
|
232
232
|
|
|
233
|
-
const newFixedTime = () => {
|
|
233
|
+
const newFixedTime = (isPlug: boolean) => {
|
|
234
234
|
const startTime = dayjs().hour() * 60 + dayjs().minute()
|
|
235
235
|
return {
|
|
236
236
|
name: '',
|
|
@@ -240,7 +240,7 @@ const newFixedTime = () => {
|
|
|
240
240
|
endTime: startTime + 60,
|
|
241
241
|
closeTime: 1,
|
|
242
242
|
openTime: 1,
|
|
243
|
-
channel: 0,
|
|
243
|
+
channel: isPlug ? 0 : 1,
|
|
244
244
|
color: {
|
|
245
245
|
h: 0,
|
|
246
246
|
s: 100,
|
|
@@ -91,7 +91,7 @@ export const useRandomTime: UseFixedTimeType = (dpKey: string, isPlug?: boolean,
|
|
|
91
91
|
return {
|
|
92
92
|
...item,
|
|
93
93
|
index: idx,
|
|
94
|
-
name: featureItem ? featureItem?.n : `${I18n.getLang('randomtimecycle_sockets_headline_text')} ${idx + 1}`
|
|
94
|
+
name: featureItem && featureItem?.n ? featureItem?.n : `${I18n.getLang('randomtimecycle_sockets_headline_text')} ${idx + 1}`
|
|
95
95
|
}
|
|
96
96
|
})
|
|
97
97
|
setRandomTimeUiList(uiPlan)
|
|
@@ -216,7 +216,7 @@ const randomTimeObj2Dp = (randomTimerData: RandomTimerData, isPlug?: boolean) =>
|
|
|
216
216
|
|
|
217
217
|
const randomTimeToHex = (randomTime: RandomTimer, isPlug?: boolean, isFeatureData?: boolean) => {
|
|
218
218
|
const { weeks, startTime, endTime, channel, enable } = randomTime
|
|
219
|
-
const channelStr = padStart((channel ?? 0).toString(2), 7, '0');
|
|
219
|
+
const channelStr = padStart((channel ?? (isPlug ? 0 : 1)).toString(2), 7, '0');
|
|
220
220
|
const powerChannel = parseInt(`${channelStr}${enable ? 1 : 0}`, 2);
|
|
221
221
|
const powerChannelStr = to16(powerChannel, 2);
|
|
222
222
|
const weeksValue: string = padStart([...weeks].reverse().join(''), 8, '0');
|
|
@@ -140,7 +140,7 @@ const RandomTimeDetailPage = () => {
|
|
|
140
140
|
{state.randomTime.channel === undefined ?
|
|
141
141
|
<Text>{I18n.getLang('timer_ceiling_fan_selectionfield_no_components_text')}</Text> :
|
|
142
142
|
<View style={[styles.applyItem, { marginBottom: cx(10), borderRadius: 4 }]}>
|
|
143
|
-
<Text style={{ color: '#000', fontSize: cx(12) }}>{params.applyForList[state.randomTime.channel]?.key}</Text>
|
|
143
|
+
<Text style={{ color: '#000', fontSize: cx(12) }}>{params.applyForList[params.isPlug ? state.randomTime.channel : 0]?.key}</Text>
|
|
144
144
|
{params.applyForList.length > 1 && <TouchableOpacity
|
|
145
145
|
onPress={() => {
|
|
146
146
|
state.randomTime.channel = undefined
|
|
@@ -152,13 +152,13 @@ const RandomTimeDetailPage = () => {
|
|
|
152
152
|
}
|
|
153
153
|
</View>
|
|
154
154
|
{params.applyForList.map((item, index) => {
|
|
155
|
-
if (state.randomTime.channel === index) return null
|
|
155
|
+
if ((params.isPlug ? state.randomTime.channel : 0) === index) return null
|
|
156
156
|
return (
|
|
157
157
|
<TouchableOpacity
|
|
158
158
|
style={styles.applyItem}
|
|
159
159
|
key={item.key}
|
|
160
160
|
onPress={() => {
|
|
161
|
-
state.randomTime.channel = index
|
|
161
|
+
state.randomTime.channel = params.isPlug ? index : 1
|
|
162
162
|
}}>
|
|
163
163
|
<Text style={{ color: '#000', fontSize: cx(12) }}>{item.key}</Text>
|
|
164
164
|
<Image style={{ width: cx(16), height: cx(16) }} source={res.device_panel_timer_add} />
|
|
@@ -118,7 +118,7 @@ const RandomTimePage = () => {
|
|
|
118
118
|
onBackClick={navigation.goBack}
|
|
119
119
|
loading={state.loading}
|
|
120
120
|
onHeadlineIconClick={() => {
|
|
121
|
-
navigateToEdit('add', newRandomTime())
|
|
121
|
+
navigateToEdit('add', newRandomTime(params.isPlug))
|
|
122
122
|
}}
|
|
123
123
|
>
|
|
124
124
|
<ScrollView nestedScrollEnabled={true}>
|
|
@@ -185,7 +185,7 @@ const RandomTimePage = () => {
|
|
|
185
185
|
}}
|
|
186
186
|
textStyle={{ color: '#fff' }}
|
|
187
187
|
onPress={() => {
|
|
188
|
-
navigateToEdit('add', newRandomTime())
|
|
188
|
+
navigateToEdit('add', newRandomTime(params.isPlug))
|
|
189
189
|
}} />}
|
|
190
190
|
</View>}
|
|
191
191
|
</ScrollView>
|
|
@@ -229,7 +229,7 @@ const RandomTimeCard = (props: {
|
|
|
229
229
|
)
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
const newRandomTime = () => {
|
|
232
|
+
const newRandomTime = (isPlug?: boolean) => {
|
|
233
233
|
const startTime = dayjs().hour() * 60 + dayjs().minute()
|
|
234
234
|
return {
|
|
235
235
|
name: '',
|
|
@@ -237,7 +237,7 @@ const newRandomTime = () => {
|
|
|
237
237
|
weeks: [0, 0, 0, 0, 0, 0, 0],
|
|
238
238
|
startTime: startTime,
|
|
239
239
|
endTime: startTime + 60,
|
|
240
|
-
channel: 0,
|
|
240
|
+
channel: isPlug ? 0 : 1,
|
|
241
241
|
color: {
|
|
242
242
|
h: 0,
|
|
243
243
|
s: 100,
|