add insideParent property

(cherry picked from commit ebc3c8630e)
This commit is contained in:
Maksim Degtyarev 2019-01-16 16:23:06 +03:00 committed by Valera
parent 9ab5953f50
commit b11add5663
4 changed files with 30 additions and 14 deletions

View File

@ -636,7 +636,8 @@ var datetimepickerFactory = function ($) {
beforeShowDay: null,
enterLikeTab: true,
showApplyButton: false
showApplyButton: false,
insideParent: false,
};
var dateHelper = null,
@ -1355,8 +1356,11 @@ var datetimepickerFactory = function ($) {
.append(calendar)
.append(applyButton);
$(options.parentID)
.append(datetimepicker);
if (options.insideParent) {
$(input).parent().append(datetimepicker);
} else {
$(options.parentID).append(datetimepicker);
}
XDSoft_datetime = function () {
var _this = this;
@ -2182,7 +2186,7 @@ var datetimepickerFactory = function ($) {
}
});
if (dateInputHasFixedAncestor) {
if (dateInputHasFixedAncestor && !options.insideParent) {
position = 'fixed';
//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 = {
position: position,
left: left,
left: options.insideParent ? dateInputElem.offsetLeft : left,
top: '', //Initialize to prevent previous values interfering with new ones.
bottom: '' //Initialize to prevent previous values interfering with new ones.
};
datetimepickerCss[verticalAnchorEdge] = verticalPosition;
if (options.insideParent) {
datetimepickerCss[verticalAnchorEdge] = dateInputElem.offsetTop + dateInputElem.offsetHeight;
} else {
datetimepickerCss[verticalAnchorEdge] = verticalPosition;
}
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,
enterLikeTab: true,
showApplyButton: false
showApplyButton: false,
insideParent: false,
};
var dateHelper = null,
@ -1346,8 +1347,11 @@ var datetimepickerFactory = function ($) {
.append(calendar)
.append(applyButton);
$(options.parentID)
.append(datetimepicker);
if (options.insideParent) {
$(input).parent().append(datetimepicker);
} else {
$(options.parentID).append(datetimepicker);
}
XDSoft_datetime = function () {
var _this = this;
@ -2173,7 +2177,7 @@ var datetimepickerFactory = function ($) {
}
});
if (dateInputHasFixedAncestor) {
if (dateInputHasFixedAncestor && !options.insideParent) {
position = 'fixed';
//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 = {
position: position,
left: left,
left: options.insideParent ? dateInputElem.offsetLeft : left,
top: '', //Initialize to prevent previous values interfering with new ones.
bottom: '' //Initialize to prevent previous values interfering with new ones.
};
datetimepickerCss[verticalAnchorEdge] = verticalPosition;
if (options.insideParent) {
datetimepickerCss[verticalAnchorEdge] = dateInputElem.offsetTop + dateInputElem.offsetHeight;
} else {
datetimepickerCss[verticalAnchorEdge] = verticalPosition;
}
datetimepicker.css(datetimepickerCss);
};