diff --git a/plugin.xml b/plugin.xml
index 751f243..e3bad33 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -3,12 +3,13 @@
com.finebi.plugin.screenadaptive
yes
- 1.1.33
+ 1.1.34
10.0
2019-08-16
fay
[2019-10-24]修复IE中有空白部分的情况
[2019-08-28]为BI模板添加模板自适应功能。
]]>
diff --git a/src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js b/src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js
index 09987e2..eca5b69 100644
--- a/src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js
+++ b/src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js
@@ -18,6 +18,7 @@
var injectBubblesShow = null;
var adjustHeight = BI.Combo.prototype.adjustHeight;
var originalRender = BI.Widget._renderEngine;
+ var injectSearch = BI.Searcher.prototype._assertPopupView;
var injectCreate = BI.createWidget;
@@ -216,6 +217,10 @@
jQuery.event.fix = function ( e ) {
return correctEvent(injectEventFix.call(this, e));
};
+
+
+ // Popovers
+ BI.Popovers = new BI.PopoverController({render: fixedContainer});
if (BI.isIE()) {
BI.Combo.prototype.adjustHeight = function (e) {
adjustHeight.call(this, e);
@@ -224,7 +229,17 @@
this.popupView.element[0].style.left = (parseInt(this.popupView.element[0].style.left) * scale - document.body.scrollLeft) + "px";
this.popupView.element[0].style.top = (parseInt(this.popupView.element[0].style.top) * scale + transformY - document.body.scrollTop) + "px";
} else {
-
+ var cBounds = this.popupView.element[0].getBoundingClientRect();
+ var pBounds = this.popupView.element[0].parentElement.getBoundingClientRect();
+ if (parseInt(cBounds.top) >= parseInt(pBounds.top) && parseInt(cBounds.left) >= parseInt(pBounds.left)) {
+ this.popupView.element[0].style.top = (parseInt(pBounds.bottom) + transformY - document.body.scrollTop) + "px";
+ this.popupView.element[0].style.left = (parseInt(pBounds.left) + transformY - document.body.scrollTop) + "px";
+ }
+
+ if (parseInt(cBounds.top) >= parseInt(pBounds.top) && parseInt(cBounds.left) < parseInt(pBounds.left)) {
+ this.popupView.element[0].style.top = (parseInt(pBounds.bottom) + transformY - document.body.scrollTop) + "px";
+ this.popupView.element[0].style.left = (parseInt(pBounds.left) + transformY - document.body.scrollTop) + "px";
+ }
}
this.popupView.element[0].style.transform = "scale(" + scale+ ")";
this.popupView.element[0].style.transformOrigin = "top left";
@@ -246,6 +261,26 @@
tooltip.element[0].style.transform = "scale(" + scale+ ")";
tooltip.element[0].style.transformOrigin = "top left";
}
+
+ var tempAdd = BI.Popovers.add;
+ BI.Popovers.add = function (name, popover, options, context) {
+ tempAdd.call(this, name, popover, options, context);
+ if (this.floatContainer[name].options.cls && this.floatContainer[name].options.cls.includes("bi-popup-view")) {
+ this.floatContainer[name].element[0].style.setProperty("position", "absolute", "important");
+ }
+ }
+
+ // Searcher
+ BI.Searcher.prototype._assertPopupView = function () {
+ injectSearch.call(this);
+ var self = this;
+ if (this.popupView) {
+ BI.nextTick(function () {
+ self.popupView.element[0].parentElement.style.transform = "scale(" + scale + ")";
+ self.popupView.element[0].parentElement.style.transformOrigin = "left top";
+ })
+ }
+ }
}
BI.createWidget = function () {
@@ -255,10 +290,6 @@
return injectCreate.apply(this, arguments);
};
- // Popovers
- BI.Popovers = new BI.PopoverController({render: fixedContainer});
-
- //
BI.Widget.registerRenderEngine({
createElement: function (widget) {
if (widget === "body") {
@@ -291,6 +322,8 @@
BI.Popovers = new BI.PopoverController();
BI.Widget.registerRenderEngine(originalRender);
+ BI.Searcher.prototype._assertPopupView = injectSearch;
+
document.body.onmousedown = null;
window.removeEventListener('resize', updateScale);
window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)').
diff --git a/src/main/resources/com/finebi/plugin/web/scripts/entry.js b/src/main/resources/com/finebi/plugin/web/scripts/entry.js
index 09987e2..eca5b69 100644
--- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js
+++ b/src/main/resources/com/finebi/plugin/web/scripts/entry.js
@@ -18,6 +18,7 @@
var injectBubblesShow = null;
var adjustHeight = BI.Combo.prototype.adjustHeight;
var originalRender = BI.Widget._renderEngine;
+ var injectSearch = BI.Searcher.prototype._assertPopupView;
var injectCreate = BI.createWidget;
@@ -216,6 +217,10 @@
jQuery.event.fix = function ( e ) {
return correctEvent(injectEventFix.call(this, e));
};
+
+
+ // Popovers
+ BI.Popovers = new BI.PopoverController({render: fixedContainer});
if (BI.isIE()) {
BI.Combo.prototype.adjustHeight = function (e) {
adjustHeight.call(this, e);
@@ -224,7 +229,17 @@
this.popupView.element[0].style.left = (parseInt(this.popupView.element[0].style.left) * scale - document.body.scrollLeft) + "px";
this.popupView.element[0].style.top = (parseInt(this.popupView.element[0].style.top) * scale + transformY - document.body.scrollTop) + "px";
} else {
-
+ var cBounds = this.popupView.element[0].getBoundingClientRect();
+ var pBounds = this.popupView.element[0].parentElement.getBoundingClientRect();
+ if (parseInt(cBounds.top) >= parseInt(pBounds.top) && parseInt(cBounds.left) >= parseInt(pBounds.left)) {
+ this.popupView.element[0].style.top = (parseInt(pBounds.bottom) + transformY - document.body.scrollTop) + "px";
+ this.popupView.element[0].style.left = (parseInt(pBounds.left) + transformY - document.body.scrollTop) + "px";
+ }
+
+ if (parseInt(cBounds.top) >= parseInt(pBounds.top) && parseInt(cBounds.left) < parseInt(pBounds.left)) {
+ this.popupView.element[0].style.top = (parseInt(pBounds.bottom) + transformY - document.body.scrollTop) + "px";
+ this.popupView.element[0].style.left = (parseInt(pBounds.left) + transformY - document.body.scrollTop) + "px";
+ }
}
this.popupView.element[0].style.transform = "scale(" + scale+ ")";
this.popupView.element[0].style.transformOrigin = "top left";
@@ -246,6 +261,26 @@
tooltip.element[0].style.transform = "scale(" + scale+ ")";
tooltip.element[0].style.transformOrigin = "top left";
}
+
+ var tempAdd = BI.Popovers.add;
+ BI.Popovers.add = function (name, popover, options, context) {
+ tempAdd.call(this, name, popover, options, context);
+ if (this.floatContainer[name].options.cls && this.floatContainer[name].options.cls.includes("bi-popup-view")) {
+ this.floatContainer[name].element[0].style.setProperty("position", "absolute", "important");
+ }
+ }
+
+ // Searcher
+ BI.Searcher.prototype._assertPopupView = function () {
+ injectSearch.call(this);
+ var self = this;
+ if (this.popupView) {
+ BI.nextTick(function () {
+ self.popupView.element[0].parentElement.style.transform = "scale(" + scale + ")";
+ self.popupView.element[0].parentElement.style.transformOrigin = "left top";
+ })
+ }
+ }
}
BI.createWidget = function () {
@@ -255,10 +290,6 @@
return injectCreate.apply(this, arguments);
};
- // Popovers
- BI.Popovers = new BI.PopoverController({render: fixedContainer});
-
- //
BI.Widget.registerRenderEngine({
createElement: function (widget) {
if (widget === "body") {
@@ -291,6 +322,8 @@
BI.Popovers = new BI.PopoverController();
BI.Widget.registerRenderEngine(originalRender);
+ BI.Searcher.prototype._assertPopupView = injectSearch;
+
document.body.onmousedown = null;
window.removeEventListener('resize', updateScale);
window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)').