react-calendar
Advanced tools
Comparing version 4.2.0 to 4.2.1
@@ -6,13 +6,3 @@ import React, { Component } from 'react'; | ||
import type { formatDay as defaultFormatDay, formatLongDate as defaultFormatLongDate, formatMonth as defaultFormatMonth, formatMonthYear as defaultFormatMonthYear, formatShortWeekday as defaultFormatShortWeekday, formatWeekday as defaultFormatWeekday, formatYear as defaultFormatYear } from './shared/dateFormatter'; | ||
declare const defaultProps: { | ||
goToRangeStartOnSelect: boolean; | ||
maxDate: Date; | ||
maxDetail: string; | ||
minDate: Date; | ||
minDetail: string; | ||
returnValue: string; | ||
showNavigation: boolean; | ||
showNeighboringMonth: boolean; | ||
}; | ||
type CalendarProps = typeof defaultProps & { | ||
type CalendarProps = { | ||
activeStartDate?: Date; | ||
@@ -53,4 +43,4 @@ allowPartialRange?: boolean; | ||
onClickYear?: OnChangeFunc; | ||
onDrillDown?: () => void; | ||
onDrillUp?: () => void; | ||
onDrillDown?: ({ action, activeStartDate, value, view }: OnArgs) => void; | ||
onDrillUp?: ({ action, activeStartDate, value, view }: OnArgs) => void; | ||
onViewChange?: ({ action, activeStartDate, value, view }: OnArgs) => void; | ||
@@ -162,3 +152,3 @@ prev2AriaLabel?: string; | ||
*/ | ||
getProcessedValue(value: Date): Date | (Date | null)[] | null; | ||
getProcessedValue(value: Date): Date | [Date | null, Date | null] | null; | ||
setStateAndCallCallbacks: (nextState: { | ||
@@ -165,0 +155,0 @@ action: Action; |
@@ -210,3 +210,4 @@ "use strict"; | ||
var _a = _this, previousActiveStartDate = _a.activeStartDate, previousView = _a.view; | ||
var _b = _this.props, allowPartialRange = _b.allowPartialRange, onActiveStartDateChange = _b.onActiveStartDateChange, onChange = _b.onChange, onViewChange = _b.onViewChange, selectRange = _b.selectRange; | ||
var _b = _this | ||
.props, allowPartialRange = _b.allowPartialRange, onActiveStartDateChange = _b.onActiveStartDateChange, onChange = _b.onChange, onViewChange = _b.onViewChange, selectRange = _b.selectRange; | ||
var prevArgs = { | ||
@@ -266,3 +267,3 @@ action: undefined, | ||
} | ||
onChange([nextState.value || null], event); | ||
onChange([nextState.value || null, null], event); | ||
} | ||
@@ -369,3 +370,4 @@ } | ||
var view = _this.view; | ||
var _a = _this.props, onClickDay = _a.onClickDay, onClickDecade = _a.onClickDecade, onClickMonth = _a.onClickMonth, onClickYear = _a.onClickYear; | ||
var _a = _this | ||
.props, onClickDay = _a.onClickDay, onClickDecade = _a.onClickDecade, onClickMonth = _a.onClickMonth, onClickYear = _a.onClickYear; | ||
var callback = (function () { | ||
@@ -405,3 +407,5 @@ switch (view) { | ||
var activeStartDateState = this.state.activeStartDate; | ||
return activeStartDateProps || activeStartDateState || getInitialActiveStartDate(this.props); | ||
return (activeStartDateProps || | ||
activeStartDateState || | ||
getInitialActiveStartDate(this.props)); | ||
}, | ||
@@ -564,3 +568,4 @@ enumerable: false, | ||
Calendar.prototype.render = function () { | ||
var _a = this.props, className = _a.className, inputRef = _a.inputRef, selectRange = _a.selectRange, showDoubleView = _a.showDoubleView; | ||
var _a = this | ||
.props, className = _a.className, inputRef = _a.inputRef, selectRange = _a.selectRange, showDoubleView = _a.showDoubleView; | ||
var _b = this, onMouseLeave = _b.onMouseLeave, value = _b.value; | ||
@@ -567,0 +572,0 @@ var valueArray = Array.isArray(value) ? value : [value]; |
@@ -7,6 +7,8 @@ /// <reference types="react" /> | ||
export type Detail = 'century' | 'decade' | 'year' | 'month'; | ||
export type LooseValue = string | Date | null | (string | Date | null)[]; | ||
type LooseValuePiece = string | Date | null; | ||
export type LooseValue = LooseValuePiece | [LooseValuePiece, LooseValuePiece]; | ||
export type Range<T> = [T, T]; | ||
export type RangeType = 'century' | 'decade' | 'year' | 'month' | 'day'; | ||
export type Value = Date | null | (Date | null)[]; | ||
type ValuePiece = Date | null; | ||
export type Value = ValuePiece | [ValuePiece, ValuePiece]; | ||
export type View = 'century' | 'decade' | 'year' | 'month'; | ||
@@ -23,3 +25,3 @@ export type NavigationLabelArgs = { | ||
activeStartDate: Date | null; | ||
value: Date | null | (Date | null)[]; | ||
value: Value; | ||
view: View; | ||
@@ -34,4 +36,5 @@ }; | ||
}; | ||
export type TileClassNameFunc = (args: TileArgs) => string; | ||
export type TileClassNameFunc = (args: TileArgs) => ClassName; | ||
export type TileContentFunc = (args: TileArgs) => React.ReactNode; | ||
export type TileDisabledFunc = (args: TileArgs) => boolean; | ||
export {}; |
@@ -6,13 +6,3 @@ import React, { Component } from 'react'; | ||
import type { formatDay as defaultFormatDay, formatLongDate as defaultFormatLongDate, formatMonth as defaultFormatMonth, formatMonthYear as defaultFormatMonthYear, formatShortWeekday as defaultFormatShortWeekday, formatWeekday as defaultFormatWeekday, formatYear as defaultFormatYear } from './shared/dateFormatter'; | ||
declare const defaultProps: { | ||
goToRangeStartOnSelect: boolean; | ||
maxDate: Date; | ||
maxDetail: string; | ||
minDate: Date; | ||
minDetail: string; | ||
returnValue: string; | ||
showNavigation: boolean; | ||
showNeighboringMonth: boolean; | ||
}; | ||
type CalendarProps = typeof defaultProps & { | ||
type CalendarProps = { | ||
activeStartDate?: Date; | ||
@@ -53,4 +43,4 @@ allowPartialRange?: boolean; | ||
onClickYear?: OnChangeFunc; | ||
onDrillDown?: () => void; | ||
onDrillUp?: () => void; | ||
onDrillDown?: ({ action, activeStartDate, value, view }: OnArgs) => void; | ||
onDrillUp?: ({ action, activeStartDate, value, view }: OnArgs) => void; | ||
onViewChange?: ({ action, activeStartDate, value, view }: OnArgs) => void; | ||
@@ -162,3 +152,3 @@ prev2AriaLabel?: string; | ||
*/ | ||
getProcessedValue(value: Date): Date | (Date | null)[] | null; | ||
getProcessedValue(value: Date): Date | [Date | null, Date | null] | null; | ||
setStateAndCallCallbacks: (nextState: { | ||
@@ -165,0 +155,0 @@ action: Action; |
@@ -182,3 +182,4 @@ var __extends = (this && this.__extends) || (function () { | ||
var _a = _this, previousActiveStartDate = _a.activeStartDate, previousView = _a.view; | ||
var _b = _this.props, allowPartialRange = _b.allowPartialRange, onActiveStartDateChange = _b.onActiveStartDateChange, onChange = _b.onChange, onViewChange = _b.onViewChange, selectRange = _b.selectRange; | ||
var _b = _this | ||
.props, allowPartialRange = _b.allowPartialRange, onActiveStartDateChange = _b.onActiveStartDateChange, onChange = _b.onChange, onViewChange = _b.onViewChange, selectRange = _b.selectRange; | ||
var prevArgs = { | ||
@@ -238,3 +239,3 @@ action: undefined, | ||
} | ||
onChange([nextState.value || null], event); | ||
onChange([nextState.value || null, null], event); | ||
} | ||
@@ -341,3 +342,4 @@ } | ||
var view = _this.view; | ||
var _a = _this.props, onClickDay = _a.onClickDay, onClickDecade = _a.onClickDecade, onClickMonth = _a.onClickMonth, onClickYear = _a.onClickYear; | ||
var _a = _this | ||
.props, onClickDay = _a.onClickDay, onClickDecade = _a.onClickDecade, onClickMonth = _a.onClickMonth, onClickYear = _a.onClickYear; | ||
var callback = (function () { | ||
@@ -377,3 +379,5 @@ switch (view) { | ||
var activeStartDateState = this.state.activeStartDate; | ||
return activeStartDateProps || activeStartDateState || getInitialActiveStartDate(this.props); | ||
return (activeStartDateProps || | ||
activeStartDateState || | ||
getInitialActiveStartDate(this.props)); | ||
}, | ||
@@ -536,3 +540,4 @@ enumerable: false, | ||
Calendar.prototype.render = function () { | ||
var _a = this.props, className = _a.className, inputRef = _a.inputRef, selectRange = _a.selectRange, showDoubleView = _a.showDoubleView; | ||
var _a = this | ||
.props, className = _a.className, inputRef = _a.inputRef, selectRange = _a.selectRange, showDoubleView = _a.showDoubleView; | ||
var _b = this, onMouseLeave = _b.onMouseLeave, value = _b.value; | ||
@@ -539,0 +544,0 @@ var valueArray = Array.isArray(value) ? value : [value]; |
@@ -7,6 +7,8 @@ /// <reference types="react" /> | ||
export type Detail = 'century' | 'decade' | 'year' | 'month'; | ||
export type LooseValue = string | Date | null | (string | Date | null)[]; | ||
type LooseValuePiece = string | Date | null; | ||
export type LooseValue = LooseValuePiece | [LooseValuePiece, LooseValuePiece]; | ||
export type Range<T> = [T, T]; | ||
export type RangeType = 'century' | 'decade' | 'year' | 'month' | 'day'; | ||
export type Value = Date | null | (Date | null)[]; | ||
type ValuePiece = Date | null; | ||
export type Value = ValuePiece | [ValuePiece, ValuePiece]; | ||
export type View = 'century' | 'decade' | 'year' | 'month'; | ||
@@ -23,3 +25,3 @@ export type NavigationLabelArgs = { | ||
activeStartDate: Date | null; | ||
value: Date | null | (Date | null)[]; | ||
value: Value; | ||
view: View; | ||
@@ -34,4 +36,5 @@ }; | ||
}; | ||
export type TileClassNameFunc = (args: TileArgs) => string; | ||
export type TileClassNameFunc = (args: TileArgs) => ClassName; | ||
export type TileContentFunc = (args: TileArgs) => React.ReactNode; | ||
export type TileDisabledFunc = (args: TileArgs) => boolean; | ||
export {}; |
{ | ||
"name": "react-calendar", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"description": "Ultimate calendar for your React app.", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
@@ -11,4 +11,6 @@ import type { CALENDAR_TYPES } from './const'; | ||
export type LooseValue = string | Date | null | (string | Date | null)[]; | ||
type LooseValuePiece = string | Date | null; | ||
export type LooseValue = LooseValuePiece | [LooseValuePiece, LooseValuePiece]; | ||
export type Range<T> = [T, T]; | ||
@@ -18,4 +20,6 @@ | ||
export type Value = Date | null | (Date | null)[]; | ||
type ValuePiece = Date | null; | ||
export type Value = ValuePiece | [ValuePiece, ValuePiece]; | ||
export type View = 'century' | 'decade' | 'year' | 'month'; | ||
@@ -40,3 +44,3 @@ | ||
activeStartDate: Date | null; | ||
value: Date | null | (Date | null)[]; | ||
value: Value; | ||
view: View; | ||
@@ -59,3 +63,3 @@ }; | ||
export type TileClassNameFunc = (args: TileArgs) => string; | ||
export type TileClassNameFunc = (args: TileArgs) => ClassName; | ||
@@ -62,0 +66,0 @@ export type TileContentFunc = (args: TileArgs) => React.ReactNode; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
602305
13077