@ledvance/base 1.3.27 → 1.3.29
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/api/nativeEventEmitter.ts +2 -2
- package/src/components/AdvanceList.tsx +1 -1
- package/src/components/BallDirectionView.tsx +1 -1
- package/src/components/Card.tsx +1 -1
- package/src/components/Cell.tsx +67 -59
- package/src/components/MoodStripAdjustView.tsx +1 -1
- package/src/components/Page.tsx +2 -2
- package/src/components/Segmented.tsx +1 -1
- package/src/components/TextField.tsx +3 -1
- package/src/components/ldvSwitch.tsx +1 -1
- package/src/components/ldvTopBar.tsx +1 -1
- package/src/components/weekSelect.tsx +1 -1
- package/src/hooks/Hooks.ts +8 -2
- package/src/i18n/strings.ts +12703 -12703
- package/src/models/modules/NativePropsSlice.tsx +3 -3
- package/src/utils/common.ts +41 -0
|
@@ -176,7 +176,7 @@ const nativePropsSlice = createSlice({
|
|
|
176
176
|
setTimeZone(state, action: PayloadAction<any>) {
|
|
177
177
|
state.timeZone = action.payload
|
|
178
178
|
},
|
|
179
|
-
|
|
179
|
+
setGestureControlValues(state, action: PayloadAction<any>) {
|
|
180
180
|
const keys = Object.keys(action.payload)
|
|
181
181
|
keys.forEach(key => {
|
|
182
182
|
state.gestureControlValues[key] = action.payload[key]
|
|
@@ -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
|
|
@@ -488,7 +488,7 @@ export const {
|
|
|
488
488
|
setSystemTimeFormat,
|
|
489
489
|
setTimeZone,
|
|
490
490
|
setEnergieverbrauch,
|
|
491
|
-
|
|
491
|
+
setGestureControlValues,
|
|
492
492
|
} = nativePropsSlice.actions
|
|
493
493
|
|
|
494
494
|
export {
|
package/src/utils/common.ts
CHANGED
|
@@ -259,6 +259,7 @@ interface DialogProps {
|
|
|
259
259
|
confirmText?: string
|
|
260
260
|
subTitle?: string
|
|
261
261
|
onConfirm: (data: any, args: { close: () => void }) => void
|
|
262
|
+
onCancel: () => void
|
|
262
263
|
}
|
|
263
264
|
|
|
264
265
|
export function showDialog(props: DialogProps) {
|
|
@@ -271,6 +272,7 @@ export function showDialog(props: DialogProps) {
|
|
|
271
272
|
confirmText,
|
|
272
273
|
subTitle,
|
|
273
274
|
onConfirm,
|
|
275
|
+
onCancel
|
|
274
276
|
} = props
|
|
275
277
|
return (
|
|
276
278
|
method === 'confirm' ?
|
|
@@ -280,6 +282,7 @@ export function showDialog(props: DialogProps) {
|
|
|
280
282
|
confirmText: showConfirmText && (confirmText || I18n.getLang('conflict_dialog_save_item_fixedtimecycle_answer_yes_text')) || '',
|
|
281
283
|
subTitle,
|
|
282
284
|
onConfirm,
|
|
285
|
+
onCancel,
|
|
283
286
|
motionConfig: {
|
|
284
287
|
hideDuration: 0,
|
|
285
288
|
showDuration: 100
|
|
@@ -396,3 +399,41 @@ export function withErrorHandling<T extends any[], R>(
|
|
|
396
399
|
}
|
|
397
400
|
}
|
|
398
401
|
}
|
|
402
|
+
|
|
403
|
+
export function isConflictTask(task1, task2) {
|
|
404
|
+
// 检查两个时间段是否有重叠
|
|
405
|
+
function checkOverlap(start1, end1, start2, end2) {
|
|
406
|
+
return (start1 <= end2 && start2 <= end1);
|
|
407
|
+
}
|
|
408
|
+
// 检查一周的每一天
|
|
409
|
+
for (let i = 0; i < 7; i++) {
|
|
410
|
+
// 如果 task1 在该天执行
|
|
411
|
+
if (Number(task1.weeks[i]) === 1) {
|
|
412
|
+
const [start1, end1] = [task1.startTime, task1.endTime];
|
|
413
|
+
const task1CrossDay = start1 > end1;
|
|
414
|
+
|
|
415
|
+
// 如果 task2 在该天或跨天执行
|
|
416
|
+
for (let j = 0; j < 7; j++) {
|
|
417
|
+
if (Number(task2.weeks[j]) === 1) {
|
|
418
|
+
const [start2, end2] = [task2.startTime, task2.endTime];
|
|
419
|
+
const task2CrossDay = start2 > end2;
|
|
420
|
+
// 检查当前天是否有重叠
|
|
421
|
+
if (i === j && checkOverlap(start1, end1, start2, end2)) {
|
|
422
|
+
return true;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// 检查 task1 跨天并延伸到次日的情况
|
|
426
|
+
if (task1CrossDay && ((i + 1) % 7 === j) && checkOverlap(0, end1, start2, end2)) {
|
|
427
|
+
return true;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// 检查 task2 跨天并延伸到次日的情况
|
|
431
|
+
if (task2CrossDay && ((j + 1) % 7 === i) && checkOverlap(0, end2, start1, end1)) {
|
|
432
|
+
return true;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return false;
|
|
439
|
+
}
|