@ledvance/ui-biz-bundle 1.1.122 → 1.1.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
|
@@ -72,6 +72,27 @@ interface ConflictItem {
|
|
|
72
72
|
endTime: number
|
|
73
73
|
weeks: number[]
|
|
74
74
|
enable: boolean
|
|
75
|
+
channel?: number
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const processConflictItems = <T extends ConflictItem>(
|
|
79
|
+
items: T[],
|
|
80
|
+
conflictItem: ConflictItem,
|
|
81
|
+
transformItem?: (item: T) => ConflictItem
|
|
82
|
+
): { hasConflict: boolean; newItems: T[] } => {
|
|
83
|
+
let hasConflict = false
|
|
84
|
+
const newItems = items.map(item => {
|
|
85
|
+
if (!item.enable || (item.channel !== undefined && item.channel !== conflictItem.channel)) return item
|
|
86
|
+
|
|
87
|
+
const checkItem = transformItem ? transformItem(item) : item
|
|
88
|
+
if (isConflictTask(checkItem, conflictItem)) {
|
|
89
|
+
hasConflict = true
|
|
90
|
+
return { ...item, enable: false }
|
|
91
|
+
}
|
|
92
|
+
return item
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
return { hasConflict, newItems }
|
|
75
96
|
}
|
|
76
97
|
|
|
77
98
|
export const useConflictTask = (conflictDps: ConflictDps, isPlug?: boolean): [(v: ConflictItem) => boolean, () => void] => {
|
|
@@ -101,75 +122,35 @@ export const useConflictTask = (conflictDps: ConflictDps, isPlug?: boolean): [(v
|
|
|
101
122
|
}
|
|
102
123
|
}
|
|
103
124
|
if (conflictDps.fixedTimeDpCode && fixedTime.length){
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
conflict = true
|
|
108
|
-
return {
|
|
109
|
-
...item,
|
|
110
|
-
enable: false
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return item
|
|
114
|
-
})
|
|
115
|
-
if (conflict){
|
|
116
|
-
newState[conflictDps.fixedTimeDpCode] = newFixedTime
|
|
125
|
+
const { hasConflict, newItems } = processConflictItems(fixedTime, conflictItem)
|
|
126
|
+
if (hasConflict) {
|
|
127
|
+
newState[conflictDps.fixedTimeDpCode] = newItems
|
|
117
128
|
}
|
|
118
129
|
}
|
|
119
130
|
if (conflictDps.randomTimeDpCode && randomTime.length){
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
conflict = true
|
|
124
|
-
return {
|
|
125
|
-
...item,
|
|
126
|
-
enable: false
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return item
|
|
130
|
-
})
|
|
131
|
-
if (conflict){
|
|
132
|
-
newState[conflictDps.randomTimeDpCode] = newRandomTime
|
|
131
|
+
const { hasConflict, newItems } = processConflictItems(randomTime, conflictItem)
|
|
132
|
+
if (hasConflict) {
|
|
133
|
+
newState[conflictDps.randomTimeDpCode] = newItems
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
if (conflictDps.sleepDpCode && sleepPlan.length){
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
conflict = true
|
|
144
|
-
return {
|
|
145
|
-
...item,
|
|
146
|
-
enable: false
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return item
|
|
150
|
-
})
|
|
151
|
-
if (conflict){
|
|
152
|
-
newState[conflictDps.sleepDpCode] = newSleepPlan
|
|
137
|
+
const { hasConflict, newItems } = processConflictItems(sleepPlan, conflictItem, (item) => ({
|
|
138
|
+
...item,
|
|
139
|
+
startTime: getStartTime(item),
|
|
140
|
+
endTime: getEndTime(item)
|
|
141
|
+
}))
|
|
142
|
+
if (hasConflict) {
|
|
143
|
+
newState[conflictDps.sleepDpCode] = newItems
|
|
153
144
|
}
|
|
154
145
|
}
|
|
155
146
|
if (conflictDps.wakeUpDpCode && wakeUpPlan.length){
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
conflict = true
|
|
164
|
-
return {
|
|
165
|
-
...item,
|
|
166
|
-
enable: false
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return item
|
|
170
|
-
})
|
|
171
|
-
if (conflict){
|
|
172
|
-
newState[conflictDps.wakeUpDpCode] = newWakeUpPlan
|
|
147
|
+
const { hasConflict, newItems } = processConflictItems(wakeUpPlan, conflictItem, (item) => ({
|
|
148
|
+
...item,
|
|
149
|
+
startTime: getStartTime(item),
|
|
150
|
+
endTime: getEndTime(item)
|
|
151
|
+
}))
|
|
152
|
+
if (hasConflict) {
|
|
153
|
+
newState[conflictDps.wakeUpDpCode] = newItems
|
|
173
154
|
}
|
|
174
155
|
}
|
|
175
156
|
if (conflictDps.switchIngCode && switchInching.enable){
|
|
@@ -139,7 +139,9 @@ const TimerPage = (props: {theme?: ThemeType}) => {
|
|
|
139
139
|
alignItems: 'center',
|
|
140
140
|
backgroundColor: props.theme?.global.background,
|
|
141
141
|
marginBottom: cx(8)
|
|
142
|
-
}}
|
|
142
|
+
}}
|
|
143
|
+
key={item.dpId}
|
|
144
|
+
>
|
|
143
145
|
<Text
|
|
144
146
|
style={{
|
|
145
147
|
color: props.theme?.global.fontColor,
|
|
@@ -95,7 +95,8 @@ const FixedTimePage = (props: { theme?: ThemeType }) => {
|
|
|
95
95
|
let itselfConflict = false
|
|
96
96
|
cloneList.forEach((item, idx) => {
|
|
97
97
|
const itself = mode === 'add' ? (idx === cloneList.length - 1) : fixedTime.index === item.index
|
|
98
|
-
|
|
98
|
+
const isSameChannel = item.channel !== undefined ? item.channel === fixedTime.channel : true
|
|
99
|
+
if (!itself && item.enable && isSameChannel && isConflictTask(item, fixedTime)){
|
|
99
100
|
itselfConflict = true
|
|
100
101
|
item.enable = false
|
|
101
102
|
}
|
|
@@ -96,7 +96,8 @@ const RandomTimePage = (props: { theme?: ThemeType }) => {
|
|
|
96
96
|
let itselfConflict = false
|
|
97
97
|
cloneList.forEach((item, idx) => {
|
|
98
98
|
const itself = mode === 'add' ? (idx === cloneList.length - 1) : randomTime.index === item.index
|
|
99
|
-
|
|
99
|
+
const isSameChannel = item.channel !== undefined ? item.channel === randomTime.channel : true
|
|
100
|
+
if (!itself && item.enable && isSameChannel && isConflictTask(item, randomTime)){
|
|
100
101
|
itselfConflict = true
|
|
101
102
|
item.enable = false
|
|
102
103
|
}
|