From e01ee2d21e92a24064a4f653a7d10530a2b1a8e2 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 10 Dec 2021 13:32:00 +0100 Subject: [PATCH] datetime-picker.js: Support input groups --- public/js/icinga/behavior/datetime-picker.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/public/js/icinga/behavior/datetime-picker.js b/public/js/icinga/behavior/datetime-picker.js index b5821f191..5a5f5d39a 100644 --- a/public/js/icinga/behavior/datetime-picker.js +++ b/public/js/icinga/behavior/datetime-picker.js @@ -113,9 +113,17 @@ } } - var fp = Flatpickr(this, options); + var element = this; + if (!! options.wrap) { + element = this.parentNode; + } + + var fp = Flatpickr(element, options); fp.calendarContainer.classList.add('icinga-datetime-picker'); - this.parentNode.insertBefore(_this.renderIcon(), fp.altInput.nextSibling); + + if (! !!options.wrap) { + this.parentNode.insertBefore(_this.renderIcon(), fp.altInput.nextSibling); + } _this._pickers.set(fp, containerId); });