diff --git a/api-generator/components/calendar.js b/api-generator/components/calendar.js index d9eeb84cf..bccfcaedc 100644 --- a/api-generator/components/calendar.js +++ b/api-generator/components/calendar.js @@ -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", diff --git a/src/components/calendar/Calendar.d.ts b/src/components/calendar/Calendar.d.ts index d60d36e1c..1dc49ed08 100755 --- a/src/components/calendar/Calendar.d.ts +++ b/src/components/calendar/Calendar.d.ts @@ -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 ':'. diff --git a/src/components/calendar/Calendar.vue b/src/components/calendar/Calendar.vue index 2de385c33..0a537fbd4 100755 --- a/src/components/calendar/Calendar.vue +++ b/src/components/calendar/Calendar.vue @@ -283,6 +283,10 @@ export default { type: Boolean, default: false }, + hideOnRangeSelection: { + type: Boolean, + default: false + }, timeSeparator: { type: String, default: ':' @@ -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) { diff --git a/src/views/calendar/CalendarDoc.vue b/src/views/calendar/CalendarDoc.vue index 9dc814cdd..dab1a72da 100755 --- a/src/views/calendar/CalendarDoc.vue +++ b/src/views/calendar/CalendarDoc.vue @@ -398,6 +398,12 @@ export default {