1.3.0 • Published 5 months ago
@illa-design/date-picker v1.3.0
Datepicker
This component is used to select date, which can be year, month, week, day type, supports range selection, etc.
Installation
yarn add @illa-design/datepicker
Import Component
import { Datepicker } from "@illa-dedign/datepicker"
API
Datepicker Basic Properties
Props | Desc | Type | Default |
---|---|---|---|
disabled | Whether is disabled | boolean | boolean[] | - |
allowClear | Whether to allow clear | boolean | true |
position | The position of the picker | "top" | "tl" | "tr" | "bottom" | "bl" | "br" | - |
placeholder | The placeholder | string | string[] | - |
shortcuts | Preset time range quick selection | ShortcutType[] | - |
shortcutsPlacementLeft | Whether the preset range is placed on the left side of the panel | boolean | - |
error | Whether is error status | boolean | - |
size | Size | "small" | "medium" | "large" | "medium" |
popupVisible | Whether to show the popup | boolean | - |
onVisibleChange | Callback when opening or closing | (visible?: boolean) => void | - |
onChange | Callback when the value of the calendar component changes | (dateString: string, date: Dayjs) => void | - |
onSelect | Callback when the selected date changes but the component value does not change | (dateString: string, date: Dayjs) => void | - |
onClear | Callback after clear button is clicked | () => void | - |
editable | Whether to edit | boolean | true |
onSelectShortcut | The callback when the shortcut selection is clicked. | (shortcut: ShortcutType) => void | - |
locale | International configuration | Record<string, any> | - |
separator | Split symbol in range selector input box | ReactNode | - |
disabledDate | Unselectable date | (current?: Dayjs) => boolean | - |
onOk | Callback for confirm button click | (dateString: string, date: Dayjs) => void | - |
defaultPickerValue | Date displayed by default panel | CalendarValue | - |
utcOffset | Set timezone offset | number | - |
timezone | Set timezone | string | - |
DatePicker Basic Properties
type CalendarValue = number | string | Date | Dayjs
Props | Desc | Type | Default |
---|---|---|---|
format | The format of the display date, refer todayjs | string | ((value: Dayjs) => string) | "YYYY-MM-DD" |
defaultValue | Default value | CalendarValue | - |
value | Value | CalendarValue | - |
showTime | Whether to add time selection | boolean | TimePickerProps | - |
timepickerProps | The parameters of time display, refer to Timepicker, the function is the same as showTime. | TimePickerProps | - |
showNowBtn | Whether to display showTime, select the button of the current time. | boolean | true |
disabledTime | Unselectable time | (current?: Dayjs) => DisabledTimeProps | - |
MonthPicker Basic Properties
Props | Desc | Type | Default |
---|---|---|---|
format | The format of the display date, refer todayjs | string | "YYYY-MM" |
defaultValue | Default value | CalendarValue | - |
value | Value | CalendarValue | - |
YearPicker Basic Properties
Props | Desc | Type | Default |
---|---|---|---|
format | The format of the display date, refer todayjs | string | "YYYY" |
defaultValue | Default value | CalendarValue | - |
value | Value | CalendarValue | - |
RangePicker Basic Properties
Props | Desc | Type | Default |
---|---|---|---|
disabled | Whether is disabled | boolean | boolean[] | - |
format | The format of the display date, refer todayjs | string | "YYYY-MM-DD" |
onChange | Callback when the value of the calendar component changes | (dateString: string[], date: Dayjs[]) => void | - |
defaultValue | Default value | CalendarValue[] | - |
value | Value | CalendarValue[] | - |
mode | The type of range selector, which can be date, month | "date" | "month" | "week"' | "year" | "date" |
showTime | Whether to add time selection | boolean | TimePickerRangeProps | - |
placeholder | Placeholder | string[] | - |
timepickerProps | The parameters of time display, refer to Timepicker, the function is the same as showTime. | TimePickerProps | - |
onOk | Callback for confirm button click | (dateString: string[], date: Dayjs[]) => void | - |
disabledTime | Unselectable time | (current: Dayjs, type: 'start' | 'end') => DisabledTimeProps | - |
defaultPickerValue | Date displayed by default panel | CalendarValue[] | - |
Examples
Basic usage
<DatePicker placeholder={"DatePicker"} />
Set disabled status
<DatePicker placeholder={"DatePicker"} disabled />
Set year picker
ReactDOM.render(<MonthPicker style={{ width: 200 }} />, CONTAINER)
Set default value
<DatePicker
defaultValue='2019-06-03'
format={(value) => `custom format: ${value.format('YYYY-MM-DD')}`}
onSelect={onSelect}
onChange={onChange}
style={{ ...style, width: 240 }}
/>
1.2.0
5 months ago
1.3.0
5 months ago
1.0.29
10 months ago
1.0.28
10 months ago
1.0.27
11 months ago
1.0.31
9 months ago
1.0.30
10 months ago
1.1.0
8 months ago
1.0.22
1 year ago
1.0.21
1 year ago
1.0.26
12 months ago
1.0.25
12 months ago
1.0.24
1 year ago
1.0.23
1 year ago
1.0.19
1 year ago
1.0.18
1 year ago
1.0.17
1 year ago
1.0.20
1 year ago
1.0.16
1 year ago
1.0.15
1 year ago
1.0.14
1 year ago
1.0.9
1 year ago
1.0.8
1 year ago
1.0.7
1 year ago
1.0.6
2 years ago
1.0.11
1 year ago
1.0.10
1 year ago
1.0.13
1 year ago
1.0.12
1 year ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago
0.0.10
2 years ago
0.0.11
2 years ago
0.0.12
2 years ago
0.0.13
2 years ago
0.0.14
2 years ago
0.0.15
2 years ago
0.0.9
2 years ago
0.0.16
2 years ago
0.0.17
2 years ago
0.0.8
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago