Skip to content

Commit

Permalink
fix(components): [date-picker] month range should emit `calendar-chan…
Browse files Browse the repository at this point in the history
…ge` (#14262)
  • Loading branch information
Justineo committed Sep 13, 2023
1 parent d791229 commit 6e24736
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
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>

0 comments on commit 6e24736

Please sign in to comment.