下载账单页面
This commit is contained in:
@@ -7,7 +7,8 @@ import dayjs from 'dayjs'
|
||||
import styles from './index.module.scss'
|
||||
export interface DialogCalendarCardProps {
|
||||
value?: Date
|
||||
onChange?: (date: Date) => void
|
||||
searchType?: 'single' | 'range' | 'multiple'
|
||||
onChange?: (date: Date | Date[]) => void
|
||||
visible: boolean
|
||||
onClose: () => void
|
||||
title?: React.ReactNode
|
||||
@@ -15,6 +16,7 @@ export interface DialogCalendarCardProps {
|
||||
|
||||
const DialogCalendarCard: React.FC<DialogCalendarCardProps> = ({
|
||||
visible,
|
||||
searchType,
|
||||
onClose,
|
||||
title,
|
||||
value,
|
||||
@@ -60,6 +62,14 @@ const DialogCalendarCard: React.FC<DialogCalendarCardProps> = ({
|
||||
}
|
||||
|
||||
const handleChange = (d: Date | Date[]) => {
|
||||
if (searchType === 'range') {
|
||||
if (Array.isArray(d)) {
|
||||
if (d.length === 2) {
|
||||
onChange?.(d as Date[])
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Array.isArray(d)) {
|
||||
setSelected(d[0])
|
||||
} else {
|
||||
@@ -120,10 +130,11 @@ const DialogCalendarCard: React.FC<DialogCalendarCardProps> = ({
|
||||
zIndex={1000}
|
||||
>
|
||||
{
|
||||
type === 'year' &&
|
||||
type === 'year' &&
|
||||
<View className={styles['calendar-container']}>
|
||||
<CalendarUI
|
||||
ref={calendarRef}
|
||||
type={searchType}
|
||||
value={selected}
|
||||
onChange={handleChange}
|
||||
showQuickActions={false}
|
||||
@@ -131,16 +142,16 @@ const DialogCalendarCard: React.FC<DialogCalendarCardProps> = ({
|
||||
/></View>
|
||||
}
|
||||
{
|
||||
type === 'month' && <PickerCommon
|
||||
type === 'month' && <PickerCommon
|
||||
ref={pickerRef}
|
||||
onChange={handleDateTimePickerChange}
|
||||
type="month"
|
||||
value={[selected.getFullYear(), selected.getMonth() + 1]}
|
||||
/>
|
||||
|
||||
|
||||
}
|
||||
{
|
||||
type === 'time' && <PickerCommon
|
||||
type === 'time' && <PickerCommon
|
||||
ref={hourMinutePickerRef}
|
||||
type="hour"
|
||||
value={[selectedHour, selectedMinute]}
|
||||
|
||||
Reference in New Issue
Block a user