add insideParent property

This commit is contained in:
Maksim Degtyarev 2019-01-16 16:23:06 +03:00
parent 2801f1a8b1
commit ebc3c8630e
4 changed files with 30 additions and 14 deletions

View File

@ -636,7 +636,8 @@ var datetimepickerFactory = function ($) {
beforeShowDay: null, beforeShowDay: null,
enterLikeTab: true, enterLikeTab: true,
showApplyButton: false showApplyButton: false,
insideParent: false,
}; };
var dateHelper = null, var dateHelper = null,
@ -1355,8 +1356,11 @@ var datetimepickerFactory = function ($) {
.append(calendar) .append(calendar)
.append(applyButton); .append(applyButton);
$(options.parentID) if (options.insideParent) {
.append(datetimepicker); $(input).parent().append(datetimepicker);
} else {
$(options.parentID).append(datetimepicker);
}
XDSoft_datetime = function () { XDSoft_datetime = function () {
var _this = this; var _this = this;
@ -2182,7 +2186,7 @@ var datetimepickerFactory = function ($) {
} }
}); });
if (dateInputHasFixedAncestor) { if (dateInputHasFixedAncestor && !options.insideParent) {
position = 'fixed'; position = 'fixed';
//If the picker won't fit entirely within the viewport then display it above the date input. //If the picker won't fit entirely within the viewport then display it above the date input.
@ -2222,12 +2226,16 @@ var datetimepickerFactory = function ($) {
datetimepickerCss = { datetimepickerCss = {
position: position, position: position,
left: left, left: options.insideParent ? dateInputElem.offsetLeft : left,
top: '', //Initialize to prevent previous values interfering with new ones. top: '', //Initialize to prevent previous values interfering with new ones.
bottom: '' //Initialize to prevent previous values interfering with new ones. bottom: '' //Initialize to prevent previous values interfering with new ones.
}; };
if (options.insideParent) {
datetimepickerCss[verticalAnchorEdge] = dateInputElem.offsetTop + dateInputElem.offsetHeight;
} else {
datetimepickerCss[verticalAnchorEdge] = verticalPosition; datetimepickerCss[verticalAnchorEdge] = verticalPosition;
}
datetimepicker.css(datetimepickerCss); datetimepicker.css(datetimepickerCss);
}; };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -627,7 +627,8 @@ var datetimepickerFactory = function ($) {
beforeShowDay: null, beforeShowDay: null,
enterLikeTab: true, enterLikeTab: true,
showApplyButton: false showApplyButton: false,
insideParent: false,
}; };
var dateHelper = null, var dateHelper = null,
@ -1346,8 +1347,11 @@ var datetimepickerFactory = function ($) {
.append(calendar) .append(calendar)
.append(applyButton); .append(applyButton);
$(options.parentID) if (options.insideParent) {
.append(datetimepicker); $(input).parent().append(datetimepicker);
} else {
$(options.parentID).append(datetimepicker);
}
XDSoft_datetime = function () { XDSoft_datetime = function () {
var _this = this; var _this = this;
@ -2173,7 +2177,7 @@ var datetimepickerFactory = function ($) {
} }
}); });
if (dateInputHasFixedAncestor) { if (dateInputHasFixedAncestor && !options.insideParent) {
position = 'fixed'; position = 'fixed';
//If the picker won't fit entirely within the viewport then display it above the date input. //If the picker won't fit entirely within the viewport then display it above the date input.
@ -2213,12 +2217,16 @@ var datetimepickerFactory = function ($) {
datetimepickerCss = { datetimepickerCss = {
position: position, position: position,
left: left, left: options.insideParent ? dateInputElem.offsetLeft : left,
top: '', //Initialize to prevent previous values interfering with new ones. top: '', //Initialize to prevent previous values interfering with new ones.
bottom: '' //Initialize to prevent previous values interfering with new ones. bottom: '' //Initialize to prevent previous values interfering with new ones.
}; };
if (options.insideParent) {
datetimepickerCss[verticalAnchorEdge] = dateInputElem.offsetTop + dateInputElem.offsetHeight;
} else {
datetimepickerCss[verticalAnchorEdge] = verticalPosition; datetimepickerCss[verticalAnchorEdge] = verticalPosition;
}
datetimepicker.css(datetimepickerCss); datetimepicker.css(datetimepickerCss);
}; };