Skip to content

Commit

Permalink
Fixed #2684 - Add hideOnRangeSelection property to Calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Jun 30, 2022
1 parent 819da95 commit 91cdaee
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api-generator/components/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ const CalendarProps = [
default: "false",
description: "Whether to hide the overlay on date selection when showTime is enabled."
},
{
name: "hideOnRangeSelection",
type: "boolean",
default: "false",
description: "Whether to hide the overlay on date selection is completed when selectionMode is range."
},
{
name: "timeSeparator",
type: "string",
Expand Down
4 changes: 4 additions & 0 deletions src/components/calendar/Calendar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ export interface CalendarProps {
* Whether to hide the overlay on date selection when showTime is enabled.
*/
hideOnDateTimeSelect?: boolean | undefined;
/**
* Whether to hide the overlay on date selection is completed when selectionMode is range.
*/
hideOnRangeSelection?: boolean | undefined;
/**
* Separator of time selector.
* Default value is ':'.
Expand Down
10 changes: 10 additions & 0 deletions src/components/calendar/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ export default {
type: Boolean,
default: false
},
hideOnRangeSelection: {
type: Boolean,
default: false
},
timeSeparator: {
type: String,
default: ':'
Expand Down Expand Up @@ -939,6 +943,12 @@ export default {
if (modelVal !== null) {
this.updateModel(modelVal);
}
if (this.isRangeSelection() && this.hideOnRangeSelection && modelVal[1] !== null) {
setTimeout(() => {
this.overlayVisible = false;
}, 150);
}
this.$emit('date-select', date);
},
updateModel(value) {
Expand Down
6 changes: 6 additions & 0 deletions src/views/calendar/CalendarDoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,12 @@ export default {
<td>false</td>
<td>Whether to hide the overlay on date selection when showTime is enabled.</td>
</tr>
<tr>
<td>hideOnRangeSelection</td>
<td>boolean</td>
<td>false</td>
<td>Whether to hide the overlay on date selection is completed when selectionMode is range.</td>
</tr>
<tr>
<td>timeSeparator</td>
<td>string</td>
Expand Down

0 comments on commit 91cdaee

Please sign in to comment.