|
|
@ -36,6 +36,7 @@ export interface CalendarProps {
|
|
|
|
style?: React.CSSProperties;
|
|
|
|
style?: React.CSSProperties;
|
|
|
|
onPanelChange?: (date?: moment.Moment, mode?: CalendarMode) => void;
|
|
|
|
onPanelChange?: (date?: moment.Moment, mode?: CalendarMode) => void;
|
|
|
|
onSelect?: (date?: moment.Moment) => void;
|
|
|
|
onSelect?: (date?: moment.Moment) => void;
|
|
|
|
|
|
|
|
onChange?: (date?: moment.Moment) => void;
|
|
|
|
disabledDate?: (current: moment.Moment) => boolean;
|
|
|
|
disabledDate?: (current: moment.Moment) => boolean;
|
|
|
|
validRange ?: [moment.Moment, moment.Moment];
|
|
|
|
validRange ?: [moment.Moment, moment.Moment];
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -53,6 +54,7 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
|
|
|
|
mode: 'month',
|
|
|
|
mode: 'month',
|
|
|
|
onSelect: noop,
|
|
|
|
onSelect: noop,
|
|
|
|
onPanelChange: noop,
|
|
|
|
onPanelChange: noop,
|
|
|
|
|
|
|
|
onChange: noop,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
static propTypes = {
|
|
|
@ -68,6 +70,7 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
|
|
|
|
onPanelChange: PropTypes.func,
|
|
|
|
onPanelChange: PropTypes.func,
|
|
|
|
value: PropTypes.object,
|
|
|
|
value: PropTypes.object,
|
|
|
|
onSelect: PropTypes.func,
|
|
|
|
onSelect: PropTypes.func,
|
|
|
|
|
|
|
|
onChange: PropTypes.func,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
constructor(props: CalendarProps) {
|
|
|
|
constructor(props: CalendarProps) {
|
|
|
@ -157,10 +160,13 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onPanelChange(value: moment.Moment, mode: CalendarMode | undefined) {
|
|
|
|
onPanelChange(value: moment.Moment, mode: CalendarMode | undefined) {
|
|
|
|
const { onPanelChange } = this.props;
|
|
|
|
const { onPanelChange, onChange } = this.props;
|
|
|
|
if (onPanelChange) {
|
|
|
|
if (onPanelChange) {
|
|
|
|
onPanelChange(value, mode);
|
|
|
|
onPanelChange(value, mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (onChange && value !== this.state.value) {
|
|
|
|
|
|
|
|
onChange(value);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onSelect = (value: moment.Moment) => {
|
|
|
|
onSelect = (value: moment.Moment) => {
|
|
|
|