Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(components): [date-picker] month range should emit calendar-change #14262

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/en-US/component/date-picker.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ Note, date time locale (month name, first day of the week ...) are also configur

## Events

| Name | Description | Parameters |
| --------------- | ------------------------------------------------------------------------- | ----------------------------- |
| change | triggers when user confirms the value | `(val: typeof v-model)` |
| blur | triggers when Input blurs | `(e: FocusEvent)` |
| focus | triggers when Input focuses | `(e: FocusEvent)` |
| calendar-change | triggers when the calendar selected date is changed. Only for `daterange` | `(val: [Date, null \| Date])` |
| panel-change | triggers when the navigation button click. | `(date, mode, view)` |
| visible-change | triggers when the DatePicker's dropdown appears/disappears | `(visibility: boolean)` |
| Name | Description | Parameters |
| --------------- | ---------------------------------------------------------- | ----------------------------- |
| change | triggers when user confirms the value | `(val: typeof v-model)` |
| blur | triggers when Input blurs | `(e: FocusEvent)` |
| focus | triggers when Input focuses | `(e: FocusEvent)` |
| calendar-change | triggers when the calendar selected date is changed. | `(val: [Date, null \| Date])` |
| panel-change | triggers when the navigation button click. | `(date, mode, view)` |
| visible-change | triggers when the DatePicker's dropdown appears/disappears | `(visibility: boolean)` |

## Methods

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ const handleRangePick = (val: RangePickValue, close = true) => {
if (maxDate.value === maxDate_ && minDate.value === minDate_) {
return
}
emit('calendar-change', [minDate_.toDate(), maxDate_ && maxDate_.toDate()])
maxDate.value = maxDate_
minDate.value = minDate_

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export const panelMonthRangeProps = buildProps({
...panelRangeSharedProps,
} as const)

export const panelMonthRangeEmits = ['pick', 'set-picker-option']
export const panelMonthRangeEmits = [
'pick',
'set-picker-option',
'calendar-change',
]

export type PanelMonthRangeProps = ExtractPropTypes<typeof panelMonthRangeProps>
Loading