@ledvance/base 1.3.33 → 1.3.35
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/localazy.json +2 -1
- package/package.json +1 -1
- package/src/components/AdvanceList.tsx +1 -0
- package/src/components/ApplyForDeviceItem.tsx +2 -1
- package/src/components/Card.tsx +3 -2
- package/src/components/SocketItem.tsx +1 -0
- package/src/components/Tag.tsx +8 -4
- package/src/components/ldvPickerView.tsx +4 -2
- package/src/config/dark-theme.ts +5 -0
- package/src/config/light-theme.ts +5 -0
- package/src/i18n/index.ts +11 -9
- package/src/i18n/strings.ts +677 -650
- package/src/utils/common.ts +33 -29
- package/translateKey.txt +1 -0
package/src/utils/common.ts
CHANGED
|
@@ -3,7 +3,7 @@ import I18n from '../i18n/index'
|
|
|
3
3
|
import { formatNumber, openDownloadFile } from 'api/native'
|
|
4
4
|
import dayjs from 'dayjs'
|
|
5
5
|
import RNFetchBlob from 'rn-fetch-blob'
|
|
6
|
-
import { isEqual } from 'lodash'
|
|
6
|
+
import { cloneDeep, isEqual } from 'lodash'
|
|
7
7
|
import { Dialog, Utils } from 'tuya-panel-kit'
|
|
8
8
|
import {GlobalParams} from "../models/GlobalParams";
|
|
9
9
|
|
|
@@ -300,6 +300,11 @@ interface DialogProps {
|
|
|
300
300
|
onCancel?: () => void
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
+
// 获取文本的默认值
|
|
304
|
+
const getText = (text: string | undefined, defaultText: string | undefined, show: boolean) => {
|
|
305
|
+
return show ? text || defaultText || '' : '';
|
|
306
|
+
};
|
|
307
|
+
|
|
303
308
|
export function showDialog(props: DialogProps) {
|
|
304
309
|
const {
|
|
305
310
|
method,
|
|
@@ -312,31 +317,21 @@ export function showDialog(props: DialogProps) {
|
|
|
312
317
|
onConfirm,
|
|
313
318
|
onCancel
|
|
314
319
|
} = props
|
|
320
|
+
|
|
321
|
+
const defDialogProps = {
|
|
322
|
+
title,
|
|
323
|
+
confirmText: getText(confirmText, I18n.getLang('conflict_dialog_save_item_fixedtimecycle_answer_yes_text'), showConfirmText),
|
|
324
|
+
cancelText: getText(cancelText, I18n.getLang('conflict_dialog_save_item_fixedtimecycle_answer_no_text'), showCancelText),
|
|
325
|
+
subTitle,
|
|
326
|
+
onConfirm,
|
|
327
|
+
motionConfig: {
|
|
328
|
+
hideDuration: 0,
|
|
329
|
+
showDuration: 100
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
const cancelProps = onCancel ? { onCancel } : {};
|
|
315
333
|
return (
|
|
316
|
-
method === 'confirm' ?
|
|
317
|
-
Dialog.confirm({
|
|
318
|
-
title: title,
|
|
319
|
-
cancelText: showCancelText && (cancelText || I18n.getLang('conflict_dialog_save_item_fixedtimecycle_answer_no_text')) || '',
|
|
320
|
-
confirmText: showConfirmText && (confirmText || I18n.getLang('conflict_dialog_save_item_fixedtimecycle_answer_yes_text')) || '',
|
|
321
|
-
subTitle,
|
|
322
|
-
onConfirm,
|
|
323
|
-
onCancel,
|
|
324
|
-
motionConfig: {
|
|
325
|
-
hideDuration: 0,
|
|
326
|
-
showDuration: 100
|
|
327
|
-
}
|
|
328
|
-
})
|
|
329
|
-
:
|
|
330
|
-
Dialog.alert({
|
|
331
|
-
title: title,
|
|
332
|
-
confirmText: showConfirmText && (confirmText || I18n.getLang('conflict_dialog_save_item_fixedtimecycle_answer_yes_text')) || '',
|
|
333
|
-
subTitle,
|
|
334
|
-
onConfirm,
|
|
335
|
-
motionConfig: {
|
|
336
|
-
hideDuration: 0,
|
|
337
|
-
showDuration: 100
|
|
338
|
-
}
|
|
339
|
-
})
|
|
334
|
+
method === 'confirm' ? Dialog.confirm({ ...defDialogProps, ...cancelProps }) : Dialog.alert(defDialogProps)
|
|
340
335
|
)
|
|
341
336
|
}
|
|
342
337
|
|
|
@@ -448,17 +443,26 @@ export function isConflictTask(task1, task2) {
|
|
|
448
443
|
function checkOverlap(start1, end1, start2, end2) {
|
|
449
444
|
return (start1 <= end2 && start2 <= end1);
|
|
450
445
|
}
|
|
446
|
+
const cloneTask1 = cloneDeep(task1)
|
|
447
|
+
const cloneTask2 = cloneDeep(task2)
|
|
448
|
+
const weekDay = dayjs().day()
|
|
449
|
+
if (cloneTask1.weeks.every(w => Number(w) === 0)){
|
|
450
|
+
cloneTask1.weeks[weekDay] = 1
|
|
451
|
+
}
|
|
452
|
+
if (cloneTask2.weeks.every(w => Number(w) === 0)){
|
|
453
|
+
cloneTask2.weeks[weekDay] = 1
|
|
454
|
+
}
|
|
451
455
|
// 检查一周的每一天
|
|
452
456
|
for (let i = 0; i < 7; i++) {
|
|
453
457
|
// 如果 task1 在该天执行
|
|
454
|
-
if (Number(
|
|
455
|
-
const [start1, end1] = [
|
|
458
|
+
if (Number(cloneTask1.weeks[i]) === 1) {
|
|
459
|
+
const [start1, end1] = [cloneTask1.startTime, cloneTask1.endTime];
|
|
456
460
|
const task1CrossDay = start1 > end1;
|
|
457
461
|
|
|
458
462
|
// 如果 task2 在该天或跨天执行
|
|
459
463
|
for (let j = 0; j < 7; j++) {
|
|
460
|
-
if (Number(
|
|
461
|
-
const [start2, end2] = [
|
|
464
|
+
if (Number(cloneTask2.weeks[j]) === 1) {
|
|
465
|
+
const [start2, end2] = [cloneTask2.startTime, cloneTask2.endTime];
|
|
462
466
|
const task2CrossDay = start2 > end2;
|
|
463
467
|
// 检查当前天是否有重叠
|
|
464
468
|
if (i === j && checkOverlap(start1, end1, start2, end2)) {
|
package/translateKey.txt
CHANGED