Skip to content

Commit

Permalink
Merge branch hotfix/v8.1.3 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
papacarlo committed Sep 4, 2024
2 parents 1019d21 + eff2375 commit 514ed8c
Show file tree
Hide file tree
Showing 35 changed files with 186 additions and 136 deletions.
10 changes: 5 additions & 5 deletions apps/common/main/lib/component/ComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ define([
var $list = this.cmpEl.find('ul'),
isMenuAbsolute = $list.hasClass('menu-absolute');
if (this.options.restoreMenuHeightAndTop || isMenuAbsolute) {
var offset = this.cmpEl.offset(),
parentTop = this.options.menuAlignEl ? this.options.menuAlignEl.offset().top : 0,
var offset = Common.Utils.getOffset(this.cmpEl),
parentTop = this.options.menuAlignEl ? Common.Utils.getOffset(this.options.menuAlignEl).top : 0,
marginTop = parseInt($list.css('margin-top')),
menuTop = offset.top - parentTop + this.cmpEl.outerHeight() + marginTop,
menuLeft = offset.left;
Expand Down Expand Up @@ -386,16 +386,16 @@ define([
}
}
var cg = Common.Utils.croppedGeometry(),
parentTop = this.options.menuAlignEl ? this.options.menuAlignEl.offset().top : cg.top,
parentTop = this.options.menuAlignEl ? Common.Utils.getOffset(this.options.menuAlignEl).top : cg.top,
parentHeight = this.options.menuAlignEl ? this.options.menuAlignEl.outerHeight() : cg.height - 10,
menuH = $list.outerHeight(),
menuTop = $list.get(0).getBoundingClientRect().top,
menuTop = Common.Utils.getBoundingClientRect($list.get(0)).top,
newH = menuH;

if (menuH < this.restoreMenuHeight)
newH = this.restoreMenuHeight;

var offset = this.cmpEl.offset();
var offset = Common.Utils.getOffset(this.cmpEl);
if (menuTop<offset.top) { // menu is shown at top
if (offset.top - parentTop < newH)
newH = offset.top - parentTop;
Expand Down
34 changes: 17 additions & 17 deletions apps/common/main/lib/component/DataView.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,12 +802,12 @@ define([
scrollToRecord: function (record, force, offsetTop) {
if (!record) return;
var innerEl = $(this.el).find('.inner'),
inner_top = innerEl.offset().top + (offsetTop ? offsetTop : 0),
inner_top = Common.Utils.getOffset(innerEl).top + (offsetTop ? offsetTop : 0),
idx = _.indexOf(this.store.models, record),
div = (idx>=0 && this.dataViewItems.length>idx) ? $(this.dataViewItems[idx].el) : innerEl.find('#' + record.get('id'));
if (div.length<=0) return;

var div_top = div.offset().top,
var div_top = Common.Utils.getOffset(div).top,
div_first = $(this.dataViewItems[0].el),
div_first_top = (div_first.length>0) ? div_first[0].clientTop : 0;
if (force || div_top < inner_top + div_first_top || div_top+div.outerHeight()*0.9 > inner_top + div_first_top + innerEl.height()) {
Expand Down Expand Up @@ -1055,13 +1055,13 @@ define([

var el = $(this.dataViewItems[0].el),
itemW = el.outerWidth() + parseFloat(el.css('margin-left')) + parseFloat(el.css('margin-right')),
offsetLeft = this.$el.offset().left,
offsetTop = el.offset().top,
offsetLeft = Common.Utils.getOffset(this.$el).left,
offsetTop = Common.Utils.getOffset(el).top,
prevtop = -1, topIdx = 0, leftIdx = 0;

for (var i=0; i<this.dataViewItems.length; i++) {
var top = $(this.dataViewItems[i].el).offset().top - offsetTop;
leftIdx = Math.floor(($(this.dataViewItems[i].el).offset().left - offsetLeft)/itemW + 0.01);
var top = Common.Utils.getOffset($(this.dataViewItems[i].el)).top - offsetTop;
leftIdx = Math.floor((Common.Utils.getOffset($(this.dataViewItems[i].el)).left - offsetLeft)/itemW + 0.01);
if (top>prevtop) {
prevtop = top;
this._layoutParams.itemsIndexes.push([]);
Expand Down Expand Up @@ -1360,14 +1360,14 @@ define([
scrollToRecord: function (record) {
if (!record) return;
var innerEl = $(this.el).find('.inner'),
inner_top = innerEl.offset().top,
inner_top = Common.Utils.getOffset(innerEl).top,
idx = _.indexOf(this.store.models, record),
div = (idx>=0 && this.dataViewItems.length>idx) ? this.dataViewItems[idx].el : innerEl.find('#' + record.get('id'));
if (div.length<=0) return;

var div_top = div.offset().top,
var div_top = Common.Utils.getOffset(div).top,
div_first = this.dataViewItems[0].el,
div_first_top = (div_first.length>0) ? div_first[0].offsetTop : 0;
div_first_top = (div_first.length>0) ? Common.Utils.getOffsetTop(div_first[0]) : 0;
if (div_top < inner_top + div_first_top || div_top+div.outerHeight() > inner_top + innerEl.height()) {
if (this.scroller) {
this.scroller.scrollTop(innerEl.scrollTop() + div_top - inner_top - div_first_top, 0);
Expand Down Expand Up @@ -1552,14 +1552,14 @@ define([

var el = this.dataViewItems[0].el,
itemW = el.outerWidth() + parseFloat(el.css('margin-left')) + parseFloat(el.css('margin-right')),
offsetLeft = this.$el.offset().left,
offsetTop = el.offset().top,
offsetLeft = Common.Utils.getOffset(this.$el).left,
offsetTop = Common.Utils.getOffset(el).top,
prevtop = -1, topIdx = 0, leftIdx = 0;

for (var i=0; i<this.dataViewItems.length; i++) {
var item = this.dataViewItems[i];
var top = item.el.offset().top - offsetTop;
leftIdx = Math.floor((item.el.offset().left - offsetLeft)/itemW);
var top = Common.Utils.getOffset(item.el).top - offsetTop;
leftIdx = Math.floor((Common.Utils.getOffset(item.el).left - offsetLeft)/itemW);
if (top>prevtop) {
prevtop = top;
this._layoutParams.itemsIndexes.push([]);
Expand Down Expand Up @@ -1938,15 +1938,15 @@ define([
}

var itemW = el.outerWidth() + parseInt(el.css('margin-left')) + parseInt(el.css('margin-right')),
offsetLeft = this.$el.offset().left,
offsetTop = el.offset().top,
offsetLeft = Common.Utils.getOffset(this.$el).left,
offsetTop = Common.Utils.getOffset(el).top,
prevtop = -1, topIdx = 0, leftIdx = first;

for (var i=0; i<this.dataViewItems.length; i++) {
var item = this.dataViewItems[i];
if (item.el.is(":visible")) {
var top = item.el.offset().top - offsetTop;
leftIdx = Math.floor((item.el.offset().left - offsetLeft) / itemW);
var top = Common.Utils.getOffset(item.el).top - offsetTop;
leftIdx = Math.floor((Common.Utils.getOffset(item.el).left - offsetLeft) / itemW);
if (top > prevtop) {
prevtop = top;
this._layoutParams.itemsIndexes.push([]);
Expand Down
6 changes: 3 additions & 3 deletions apps/common/main/lib/component/HSBColorPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ define([
var onSBAreaMouseMove = function(event, element, eOpts){
if (arrowSatBrightness.length>0 && areaSatBrightness.length>0) {
var pos = [
Math.max(0, Math.min(100, (parseInt((event.pageX*Common.Utils.zoom() - areaSatBrightness.offset().left) / areaSatBrightness.width() * 100)))),
Math.max(0, Math.min(100, (parseInt((event.pageY*Common.Utils.zoom() - areaSatBrightness.offset().top) / areaSatBrightness.height() * 100))))
Math.max(0, Math.min(100, (parseInt((event.pageX*Common.Utils.zoom() - Common.Utils.getOffset(areaSatBrightness).left) / areaSatBrightness.width() * 100)))),
Math.max(0, Math.min(100, (parseInt((event.pageY*Common.Utils.zoom() - Common.Utils.getOffset(areaSatBrightness).top) / areaSatBrightness.height() * 100))))
];

arrowSatBrightness.css('left', pos[0] + '%');
Expand All @@ -156,7 +156,7 @@ define([

var onHueAreaMouseMove = function(event, element, eOpts){
if (arrowHue&& areaHue) {
var pos = Math.max(0, Math.min(100, (parseInt((event.pageY*Common.Utils.zoom() - areaHue.offset().top) / areaHue.height() * 100))));
var pos = Math.max(0, Math.min(100, (parseInt((event.pageY*Common.Utils.zoom() - Common.Utils.getOffset(areaHue).top) / areaHue.height() * 100))));
arrowHue.css('top', pos + '%');

hueVal = parseInt(360 * pos / 100.0);
Expand Down
2 changes: 1 addition & 1 deletion apps/common/main/lib/component/ListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ define([
var div_top = div.position().top,
div_height = div.outerHeight(),
div_first = this.dataViewItems[0].el,
div_first_top = div_first ? div_first.offsetTop : 0,
div_first_top = div_first ? Common.Utils.getOffsetTop(div_first) : 0,
newpos;

if (force || div_top<div_first_top)
Expand Down
4 changes: 2 additions & 2 deletions apps/common/main/lib/component/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ define([
var menuRoot = this.menuRoot,
menuParent = this.menuAlignEl || menuRoot.parent(),
m = this.menuAlign.match(/^([a-z]+)-([a-z]+)/),
offset = menuParent.offset(),
offset = Common.Utils.getOffset(menuParent),
docW = Common.Utils.innerWidth() - 10,
docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number
menuW = menuRoot.outerWidth(),
Expand Down Expand Up @@ -1154,7 +1154,7 @@ define([
var menuRoot = this.menuRoot,
menuParent = this.menuAlignEl || menuRoot.parent(),
m = this.menuAlign.match(/^([a-z]+)-([a-z]+)/),
offset = menuParent.offset(),
offset = Common.Utils.getOffset(menuParent),
docW = Common.Utils.innerWidth(),
docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number
menuW = menuRoot.outerWidth(),
Expand Down
2 changes: 1 addition & 1 deletion apps/common/main/lib/component/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ define([
el.tooltip({
title : me.options.hint,
placement : me.options.hintAnchor||function(tip, element) {
var pos = this.getPosition(),
var pos = Common.Utils.getBoundingClientRect(element),
actualWidth = tip.offsetWidth,
actualHeight = tip.offsetHeight,
innerWidth = Common.Utils.innerWidth(),
Expand Down
16 changes: 8 additions & 8 deletions apps/common/main/lib/component/Mixtbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,17 +427,17 @@ define([
hasTabInvisible: function() {
if ($boxTabs.length<1) return false;

var _left_bound_ = Math.round($boxTabs.offset().left),
var _left_bound_ = Math.round(Common.Utils.getOffset($boxTabs).left),
_right_bound_ = Math.round(_left_bound_ + $boxTabs.width());

var tab = this.$tabs.filter(Common.UI.isRTL() ? ':visible:last' : ':visible:first').get(0);
if ( !tab ) return false;

var rect = tab.getBoundingClientRect();
var rect = Common.Utils.getBoundingClientRect(tab);

if ( !(Math.round(rect.left) < _left_bound_) ) {
tab = this.$tabs.filter(Common.UI.isRTL() ? ':visible:first' : ':visible:last').get(0);
rect = tab.getBoundingClientRect();
rect = Common.Utils.getBoundingClientRect(tab);

if (!(Math.round(rect.right) > _right_bound_))
return false;
Expand Down Expand Up @@ -539,7 +539,7 @@ define([
me.$boxpanels.width() - $active.outerWidth() + item.el.width());
}
item.el.css('width', checkedwidth ? (checkedwidth + parseFloat(item.el.css('padding-left')) + parseFloat(item.el.css('padding-right'))) + 'px' : item.width);
data.rightedge = $active.get(0).getBoundingClientRect().right;
data.rightedge = Common.Utils.getBoundingClientRect($active.get(0)).right;
}
}
}
Expand Down Expand Up @@ -763,7 +763,7 @@ define([
if (_rightedge <= _maxright) // stop moving items
break;

var rect = item.get(0).getBoundingClientRect(),
var rect = Common.Utils.getBoundingClientRect(item.get(0)),
item_width = item.outerWidth(),
children = item.children();
if (!item.attr('inner-width') && item.attr('group-state') !== 'open') {
Expand Down Expand Up @@ -794,7 +794,7 @@ define([
hideAllMenus = true;
break;
} else {
var child_rect = child.get(0).getBoundingClientRect(),
var child_rect = Common.Utils.getBoundingClientRect(child.get(0)),
child_width = child.outerWidth();
if ((Common.UI.isRTL() ? box_controls_width - child_rect.right : child_rect.left)+child_width>_maxright) {
if (!last_group) {
Expand Down Expand Up @@ -973,9 +973,9 @@ define([

onMoreShow: function(btn, e) {
var moreContainer = btn.panel.parent(),
parentxy = moreContainer.parent().offset(),
parentxy = Common.Utils.getOffset(moreContainer.parent()),
target = btn.$el,
showxy = target.offset(),
showxy = Common.Utils.getOffset(target),
right = Common.Utils.innerWidth() - (showxy.left - parentxy.left + target.width()),
top = showxy.top - parentxy.top + target.height() + 10;

Expand Down
Loading

0 comments on commit 514ed8c

Please sign in to comment.