Browse Source

Pull request #29: BI-65018 & BI-65037 & BI-65031

Merge in PG2/plugin-bi-screen-adaptive from ~FAY/plugin-bi-screen-adaptive:release/10.0 to release/10.0

* commit '758850ccbf946f7bebed3e811c151096bb4c36f2':
  BI-65018 & BI-65037 & BI-65031
release/10.0
fay 5 years ago
parent
commit
efbb2e4328
  1. 3
      plugin.xml
  2. 43
      src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js
  3. 43
      src/main/resources/com/finebi/plugin/web/scripts/entry.js

3
plugin.xml

@ -3,12 +3,13 @@
<id>com.finebi.plugin.screenadaptive</id> <id>com.finebi.plugin.screenadaptive</id>
<name><![CDATA[BI模板屏幕自适应]]></name> <name><![CDATA[BI模板屏幕自适应]]></name>
<active>yes</active> <active>yes</active>
<version>1.1.33</version> <version>1.1.34</version>
<env-version>10.0</env-version> <env-version>10.0</env-version>
<jartime>2019-08-16</jartime> <jartime>2019-08-16</jartime>
<vendor>fay</vendor> <vendor>fay</vendor>
<description><![CDATA[预览BI模板时,根据屏幕的宽度自适应显示模板]]></description> <description><![CDATA[预览BI模板时,根据屏幕的宽度自适应显示模板]]></description>
<change-notes><![CDATA[ <change-notes><![CDATA[
[2020-05-09]修复IE中有空白部分的情况<br/>
[2019-10-24]修复IE中有空白部分的情况<br/> [2019-10-24]修复IE中有空白部分的情况<br/>
[2019-08-28]为BI模板添加模板自适应功能。<br/> [2019-08-28]为BI模板添加模板自适应功能。<br/>
]]></change-notes> ]]></change-notes>

43
src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js

@ -18,6 +18,7 @@
var injectBubblesShow = null; var injectBubblesShow = null;
var adjustHeight = BI.Combo.prototype.adjustHeight; var adjustHeight = BI.Combo.prototype.adjustHeight;
var originalRender = BI.Widget._renderEngine; var originalRender = BI.Widget._renderEngine;
var injectSearch = BI.Searcher.prototype._assertPopupView;
var injectCreate = BI.createWidget; var injectCreate = BI.createWidget;
@ -216,6 +217,10 @@
jQuery.event.fix = function ( e ) { jQuery.event.fix = function ( e ) {
return correctEvent(injectEventFix.call(this, e)); return correctEvent(injectEventFix.call(this, e));
}; };
// Popovers
BI.Popovers = new BI.PopoverController({render: fixedContainer});
if (BI.isIE()) { if (BI.isIE()) {
BI.Combo.prototype.adjustHeight = function (e) { BI.Combo.prototype.adjustHeight = function (e) {
adjustHeight.call(this, 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.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"; this.popupView.element[0].style.top = (parseInt(this.popupView.element[0].style.top) * scale + transformY - document.body.scrollTop) + "px";
} else { } 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.transform = "scale(" + scale+ ")";
this.popupView.element[0].style.transformOrigin = "top left"; this.popupView.element[0].style.transformOrigin = "top left";
@ -246,6 +261,26 @@
tooltip.element[0].style.transform = "scale(" + scale+ ")"; tooltip.element[0].style.transform = "scale(" + scale+ ")";
tooltip.element[0].style.transformOrigin = "top left"; 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 () { BI.createWidget = function () {
@ -255,10 +290,6 @@
return injectCreate.apply(this, arguments); return injectCreate.apply(this, arguments);
}; };
// Popovers
BI.Popovers = new BI.PopoverController({render: fixedContainer});
//
BI.Widget.registerRenderEngine({ BI.Widget.registerRenderEngine({
createElement: function (widget) { createElement: function (widget) {
if (widget === "body") { if (widget === "body") {
@ -291,6 +322,8 @@
BI.Popovers = new BI.PopoverController(); BI.Popovers = new BI.PopoverController();
BI.Widget.registerRenderEngine(originalRender); BI.Widget.registerRenderEngine(originalRender);
BI.Searcher.prototype._assertPopupView = injectSearch;
document.body.onmousedown = null; document.body.onmousedown = null;
window.removeEventListener('resize', updateScale); window.removeEventListener('resize', updateScale);
window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)'). window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)').

43
src/main/resources/com/finebi/plugin/web/scripts/entry.js

@ -18,6 +18,7 @@
var injectBubblesShow = null; var injectBubblesShow = null;
var adjustHeight = BI.Combo.prototype.adjustHeight; var adjustHeight = BI.Combo.prototype.adjustHeight;
var originalRender = BI.Widget._renderEngine; var originalRender = BI.Widget._renderEngine;
var injectSearch = BI.Searcher.prototype._assertPopupView;
var injectCreate = BI.createWidget; var injectCreate = BI.createWidget;
@ -216,6 +217,10 @@
jQuery.event.fix = function ( e ) { jQuery.event.fix = function ( e ) {
return correctEvent(injectEventFix.call(this, e)); return correctEvent(injectEventFix.call(this, e));
}; };
// Popovers
BI.Popovers = new BI.PopoverController({render: fixedContainer});
if (BI.isIE()) { if (BI.isIE()) {
BI.Combo.prototype.adjustHeight = function (e) { BI.Combo.prototype.adjustHeight = function (e) {
adjustHeight.call(this, 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.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"; this.popupView.element[0].style.top = (parseInt(this.popupView.element[0].style.top) * scale + transformY - document.body.scrollTop) + "px";
} else { } 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.transform = "scale(" + scale+ ")";
this.popupView.element[0].style.transformOrigin = "top left"; this.popupView.element[0].style.transformOrigin = "top left";
@ -246,6 +261,26 @@
tooltip.element[0].style.transform = "scale(" + scale+ ")"; tooltip.element[0].style.transform = "scale(" + scale+ ")";
tooltip.element[0].style.transformOrigin = "top left"; 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 () { BI.createWidget = function () {
@ -255,10 +290,6 @@
return injectCreate.apply(this, arguments); return injectCreate.apply(this, arguments);
}; };
// Popovers
BI.Popovers = new BI.PopoverController({render: fixedContainer});
//
BI.Widget.registerRenderEngine({ BI.Widget.registerRenderEngine({
createElement: function (widget) { createElement: function (widget) {
if (widget === "body") { if (widget === "body") {
@ -291,6 +322,8 @@
BI.Popovers = new BI.PopoverController(); BI.Popovers = new BI.PopoverController();
BI.Widget.registerRenderEngine(originalRender); BI.Widget.registerRenderEngine(originalRender);
BI.Searcher.prototype._assertPopupView = injectSearch;
document.body.onmousedown = null; document.body.onmousedown = null;
window.removeEventListener('resize', updateScale); window.removeEventListener('resize', updateScale);
window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)'). window.matchMedia && window.matchMedia('screen and (min-resolution: 2dppx)').

Loading…
Cancel
Save