@ledvance/base 1.3.27 → 1.3.28
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/components/TextField.tsx +3 -1
- package/src/hooks/Hooks.ts +8 -2
- package/src/i18n/strings.ts +6490 -6490
- package/src/models/modules/NativePropsSlice.tsx +1 -1
- package/src/utils/common.ts +38 -0
|
@@ -436,7 +436,7 @@ export function useFeatureHook<GC, T extends PropertyValueTypes<GC>>(
|
|
|
436
436
|
valueMapToDpValue?: (v: T) => any,
|
|
437
437
|
getExtraDps?: (v: T) => any,
|
|
438
438
|
getExtraConfig?: (v: T) => any,
|
|
439
|
-
): [T, (value: T) => Promise<Result<any>>] {
|
|
439
|
+
): [T, (value: T, extraDps?: any, extraConfig?: any) => Promise<Result<any>>] {
|
|
440
440
|
const [featureHook, setFH] = useGroupConfigFeature<GC, T>(featureKey)
|
|
441
441
|
const setFeatureHook = useCallback(async (value: T, extraDps?: any, extraConfig?: any) => {
|
|
442
442
|
const dpValue = valueMapToDpValue ? valueMapToDpValue(value) : value
|
package/src/utils/common.ts
CHANGED
|
@@ -396,3 +396,41 @@ export function withErrorHandling<T extends any[], R>(
|
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
|
+
|
|
400
|
+
export function isConflictTask(task1, task2) {
|
|
401
|
+
// 检查两个时间段是否有重叠
|
|
402
|
+
function checkOverlap(start1, end1, start2, end2) {
|
|
403
|
+
return (start1 <= end2 && start2 <= end1);
|
|
404
|
+
}
|
|
405
|
+
// 检查一周的每一天
|
|
406
|
+
for (let i = 0; i < 7; i++) {
|
|
407
|
+
// 如果 task1 在该天执行
|
|
408
|
+
if (Number(task1.weeks[i]) === 1) {
|
|
409
|
+
const [start1, end1] = [task1.startTime, task1.endTime];
|
|
410
|
+
const task1CrossDay = start1 > end1;
|
|
411
|
+
|
|
412
|
+
// 如果 task2 在该天或跨天执行
|
|
413
|
+
for (let j = 0; j < 7; j++) {
|
|
414
|
+
if (Number(task2.weeks[j]) === 1) {
|
|
415
|
+
const [start2, end2] = [task2.startTime, task2.endTime];
|
|
416
|
+
const task2CrossDay = start2 > end2;
|
|
417
|
+
// 检查当前天是否有重叠
|
|
418
|
+
if (i === j && checkOverlap(start1, end1, start2, end2)) {
|
|
419
|
+
return true;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// 检查 task1 跨天并延伸到次日的情况
|
|
423
|
+
if (task1CrossDay && ((i + 1) % 7 === j) && checkOverlap(0, end1, start2, end2)) {
|
|
424
|
+
return true;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// 检查 task2 跨天并延伸到次日的情况
|
|
428
|
+
if (task2CrossDay && ((j + 1) % 7 === i) && checkOverlap(0, end2, start1, end1)) {
|
|
429
|
+
return true;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
return false;
|
|
436
|
+
}
|