修改日历与弹出窗
This commit is contained in:
@@ -24,9 +24,6 @@ const DayDialog: React.FC<DayDialogProps> = ({
|
||||
onChange,
|
||||
}) => {
|
||||
const [selected, setSelected] = useState<Date | Date[]>(value || new Date());
|
||||
const [selectedBackup, setSelectedBackup] = useState<Date[]>(
|
||||
Array.isArray(value) ? [...(value as Date[])] : [value as Date]
|
||||
);
|
||||
const calendarRef = useRef<CalendarUIRef>(null);
|
||||
const [type, setType] = useState<"year" | "month" | "time">("year");
|
||||
const [pendingJump, setPendingJump] = useState<{
|
||||
@@ -47,26 +44,6 @@ const DayDialog: React.FC<DayDialogProps> = ({
|
||||
}
|
||||
|
||||
const handleChange = (d: Date | Date[]) => {
|
||||
if (searchType === "range") {
|
||||
if (Array.isArray(d)) {
|
||||
if (d.length === 2) {
|
||||
return;
|
||||
} else if (d.length === 1) {
|
||||
if (selectedBackup.length === 0 || selectedBackup.length === 2) {
|
||||
setSelected([...d]);
|
||||
setSelectedBackup([...d]);
|
||||
} else {
|
||||
setSelected(
|
||||
[...selectedBackup, d[0]].sort(
|
||||
(a, b) => a.getTime() - b.getTime()
|
||||
)
|
||||
);
|
||||
setSelectedBackup([]);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Array.isArray(d)) {
|
||||
setSelected(d[0]);
|
||||
} else {
|
||||
|
||||
@@ -25,7 +25,10 @@ const HourDialog: React.FC<HourDialogProps> = ({
|
||||
const handleConfirm = () => {
|
||||
const value = hourMinutePickerRef.current?.getValue();
|
||||
if (onChange) {
|
||||
onChange(value);
|
||||
const [hour, minute] = value || [];
|
||||
const hours = hour.toString().padStart(2, "0");
|
||||
const minutes = minute.toString().padStart(2, "0");
|
||||
onChange([hours, minutes]);
|
||||
}
|
||||
dialogClose();
|
||||
};
|
||||
|
||||
@@ -51,8 +51,6 @@ const CustomPicker = ({
|
||||
Array.isArray(currentValue) &&
|
||||
valuesList.length === currentValue.length &&
|
||||
valuesList.every((v: any, idx: number) => v === currentValue[idx])
|
||||
|
||||
console.log(isSame,valuesList, 'isSameisSameisSameisSame');
|
||||
if (!isSame) {
|
||||
setCurrentValue(valuesList)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user