2022-02-14 14:40:40 +08:00
|
|
|
import type { Dayjs } from 'dayjs';
|
|
|
|
import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs';
|
2022-07-13 23:06:28 +08:00
|
|
|
import genPurePanel from '../_util/PurePanel';
|
2022-05-07 14:31:54 +08:00
|
|
|
import type {
|
2023-04-12 17:20:08 +08:00
|
|
|
RangePickerProps as BaseRangePickerProps,
|
2020-01-14 19:46:05 +08:00
|
|
|
PickerDateProps,
|
2022-06-22 14:57:09 +08:00
|
|
|
PickerProps,
|
2020-01-14 19:46:05 +08:00
|
|
|
} from './generatePicker';
|
2022-05-07 14:31:54 +08:00
|
|
|
import generatePicker from './generatePicker';
|
2020-01-14 19:46:05 +08:00
|
|
|
|
2022-02-14 14:40:40 +08:00
|
|
|
export type DatePickerProps = PickerProps<Dayjs>;
|
|
|
|
export type MonthPickerProps = Omit<PickerDateProps<Dayjs>, 'picker'>;
|
|
|
|
export type WeekPickerProps = Omit<PickerDateProps<Dayjs>, 'picker'>;
|
|
|
|
export type RangePickerProps = BaseRangePickerProps<Dayjs>;
|
2015-08-25 17:27:38 +08:00
|
|
|
|
2022-02-14 14:40:40 +08:00
|
|
|
const DatePicker = generatePicker<Dayjs>(dayjsGenerateConfig);
|
2016-08-19 17:11:06 +08:00
|
|
|
|
2023-04-12 17:20:08 +08:00
|
|
|
export type DatePickerType = typeof DatePicker & {
|
|
|
|
_InternalPanelDoNotUseOrYouWillBeFired: typeof PurePanel;
|
|
|
|
_InternalRangePanelDoNotUseOrYouWillBeFired: typeof PureRangePanel;
|
|
|
|
generatePicker: typeof generatePicker;
|
|
|
|
};
|
|
|
|
|
2022-07-11 14:58:59 +08:00
|
|
|
// We don't care debug panel
|
|
|
|
/* istanbul ignore next */
|
|
|
|
const PurePanel = genPurePanel(DatePicker, 'picker');
|
2023-04-12 17:20:08 +08:00
|
|
|
(DatePicker as DatePickerType)._InternalPanelDoNotUseOrYouWillBeFired = PurePanel;
|
2023-02-20 10:51:18 +08:00
|
|
|
const PureRangePanel = genPurePanel(DatePicker.RangePicker, 'picker');
|
2023-04-12 17:20:08 +08:00
|
|
|
(DatePicker as DatePickerType)._InternalRangePanelDoNotUseOrYouWillBeFired = PureRangePanel;
|
|
|
|
(DatePicker as DatePickerType).generatePicker = generatePicker;
|
2022-07-11 14:58:59 +08:00
|
|
|
|
2023-04-12 17:20:08 +08:00
|
|
|
export default DatePicker as DatePickerType;
|