diff --git a/src/components/calendar/Calendar.js b/src/components/calendar/Calendar.js index 2a914e9573..68890aef02 100644 --- a/src/components/calendar/Calendar.js +++ b/src/components/calendar/Calendar.js @@ -1593,13 +1593,9 @@ export class Calendar extends Component { this.enableModality(); } else { - if (this.props.appendTo) { - DomHandler.absolutePosition(this.overlayRef.current, this.inputElement); - this.overlayRef.current.style.minWidth = DomHandler.getWidth(this.container) + 'px'; - } - else { - DomHandler.relativePosition(this.overlayRef.current, this.inputElement); - } + const container = this.inputElement.parentElement; + this.overlayRef.current.style.minWidth = DomHandler.getOuterWidth(container) + 'px'; + DomHandler.absolutePosition(this.overlayRef.current, container); } } @@ -2715,18 +2711,22 @@ export class Calendar extends Component { } renderMonthView() { - const backwardNavigator = this.renderBackwardNavigator(); - const forwardNavigator = this.renderForwardNavigator(); + const backwardNavigator = this.renderBackwardNavigator(true); + const forwardNavigator = this.renderForwardNavigator(true); const yearElement = this.renderTitleYearElement(this.getViewDate().getFullYear()); const months = this.renderMonthViewMonths(); return ( <> -
- {backwardNavigator} - {forwardNavigator} -
- {yearElement} +
+
+
+ {backwardNavigator} +
+ {yearElement} +
+ {forwardNavigator} +
@@ -2986,7 +2986,7 @@ export class Calendar extends Component { this.container = el} id={this.id} className={className} style={this.props.style}> {input} {button} - {datePicker} {timePicker} @@ -2997,4 +2997,3 @@ export class Calendar extends Component { ); } } - diff --git a/src/components/calendar/CalendarPanel.js b/src/components/calendar/CalendarPanel.js index b97978c7b5..cd42d6f51e 100644 --- a/src/components/calendar/CalendarPanel.js +++ b/src/components/calendar/CalendarPanel.js @@ -31,10 +31,7 @@ class CalendarPanelComponent extends Component { render() { let element = this.renderElement(); - if (this.props.appendTo) - return ReactDOM.createPortal(element, this.props.appendTo); - else - return element; + return this.props.inline ? element : ReactDOM.createPortal(element, this.props.appendTo || document.body); } }