Merge pull request #2740 from tugcekucukoglu/calendar

Fixed #2684 - Add hideOnRangeSelection property to Calendar
pull/2753/head
Tuğçe Küçükoğlu 2022-07-04 11:05:17 +03:00 committed by GitHub
commit d5dd8d30a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 0 deletions

View File

@ -198,6 +198,12 @@ const CalendarProps = [
default: "false", default: "false",
description: "Whether to hide the overlay on date selection when showTime is enabled." 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", name: "timeSeparator",
type: "string", type: "string",

View File

@ -215,6 +215,10 @@ export interface CalendarProps {
* Whether to hide the overlay on date selection when showTime is enabled. * Whether to hide the overlay on date selection when showTime is enabled.
*/ */
hideOnDateTimeSelect?: boolean | undefined; hideOnDateTimeSelect?: boolean | undefined;
/**
* Whether to hide the overlay on date selection is completed when selectionMode is range.
*/
hideOnRangeSelection?: boolean | undefined;
/** /**
* Separator of time selector. * Separator of time selector.
* Default value is ':'. * Default value is ':'.

View File

@ -283,6 +283,10 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
hideOnRangeSelection: {
type: Boolean,
default: false
},
timeSeparator: { timeSeparator: {
type: String, type: String,
default: ':' default: ':'
@ -939,6 +943,12 @@ export default {
if (modelVal !== null) { if (modelVal !== null) {
this.updateModel(modelVal); this.updateModel(modelVal);
} }
if (this.isRangeSelection() && this.hideOnRangeSelection && modelVal[1] !== null) {
setTimeout(() => {
this.overlayVisible = false;
}, 150);
}
this.$emit('date-select', date); this.$emit('date-select', date);
}, },
updateModel(value) { updateModel(value) {

View File

@ -398,6 +398,12 @@ export default {
<td>false</td> <td>false</td>
<td>Whether to hide the overlay on date selection when showTime is enabled.</td> <td>Whether to hide the overlay on date selection when showTime is enabled.</td>
</tr> </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> <tr>
<td>timeSeparator</td> <td>timeSeparator</td>
<td>string</td> <td>string</td>