Browse Source

Pull request #49: BI-68076B fix: 二级菜单

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

* commit '2e47ce1515fcea3b960ed8b7cdfc0482d69e5c00':
  BI-68076B fix: 二级菜单
persist/10.0
fay 5 years ago
parent
commit
308bdd8384
  1. 2
      plugin.xml
  2. 26
      src/main/resources/com/finebi/plugin/web/plugin.screen_adaptive.js
  3. 26
      src/main/resources/com/finebi/plugin/web/scripts/entry.js

2
plugin.xml

@ -3,7 +3,7 @@
<id>com.finebi.plugin.screenadaptive</id>
<name><![CDATA[BI模板屏幕自适应]]></name>
<active>yes</active>
<version>1.1.41</version>
<version>1.1.42</version>
<env-version>10.0</env-version>
<jartime>2019-08-16</jartime>
<vendor>fay</vendor>

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

@ -110,7 +110,7 @@
wrapper.style.overflow = "hidden";
html.style.backgroundColor = "#ffffff";
scrollContainer.style.overflowX = "auto";
scrollContainer.style.overflowX = globalScaleRatio === null ? "hidden" : "auto";
scrollContainer.style.overflowY = "auto";
fixedWrapper.style.overflow = "hidden";
fixedWrapper.style.width = bounds.width * scale + "px";
@ -284,37 +284,37 @@
if (BI.isIE()) {
BI.Combo.prototype.adjustHeight = function (e) {
adjustHeight.call(this, e);
var transformX = 0, transformY = 0;
var transformX = scrollContainer.scrollLeft;
var transformY = scrollContainer.scrollTop;
if (this.popupView) {
if (!checkInPopupView(this.popupView.element[0])) {
transformX = scrollContainer.scrollLeft;
transformY = scrollContainer.scrollTop;
this.popupView.element[0].style.left = parseInt(this.popupView.element[0].style.left) * scale - transformX + "px";
this.popupView.element[0].style.top = parseInt(this.popupView.element[0].style.top) * scale - transformY + "px";
} else {
var cBounds = BI.extend({}, this.popupView.element[0].getBoundingClientRect());
var pBounds = BI.extend({}, this.popupView.element[0].parentElement.getBoundingClientRect());
var hasScale = this.popupView.element[0].style.transform && this.popupView.element[0].style.transform.includes("scale");
var minWidth = parseInt(this.popupView.element[0].style.minWidth);
var minHeight = parseInt(this.popupView.element[0].style.minHeight);
cBounds.width = Math.max(cBounds.width, minWidth * scale);
cBounds.height = Math.max(cBounds.height, minHeight * scale);
if (cBounds.left + cBounds.width - scrollContainer.scrollLeft> body.clientWidth * scale) {
this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px";
if ((cBounds.left * scale + cBounds.width * (hasScale ? 1 : scale)) - transformX > body.clientWidth) {
this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px";
this.popupView.element[0].style.left = parseInt(this.popupView.element[0].style.left) * scale - transformX + "px";
} else if (this.options.direction === "right") {
this.popupView.element[0].style.top = parseInt(pBounds.top) - transformY + "px";
this.popupView.element[0].style.left = parseInt(pBounds.right) - transformX + "px";
this.popupView.element[0].style.top = parseInt(pBounds.top) + "px";
this.popupView.element[0].style.left = parseInt(pBounds.right) + "px";
} else if (parseInt(cBounds.top) >= parseInt(pBounds.top) && parseInt(cBounds.left) >= parseInt(pBounds.left)) {
this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px";
this.popupView.element[0].style.left = parseInt(pBounds.left) - transformX + "px";
this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px";
this.popupView.element[0].style.left = parseInt(pBounds.left) + "px";
}else if (parseInt(cBounds.top) >= parseInt(pBounds.top) && parseInt(cBounds.left) < parseInt(pBounds.left)) {
this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px";
this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px";
this.popupView.element[0].style.left = parseInt(Math.min(pBounds.left, body.clientWidth - cBounds.width)) - transformX + "px";
} else {
this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px";
this.popupView.element[0].style.left = parseInt(cBounds.left) * scale - transformX + "px";
this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px";
this.popupView.element[0].style.left = parseInt(cBounds.left) * scale + "px";
}
}
this.popupView.element[0].style.transform = "scale(" + scale+ ")";

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

@ -110,7 +110,7 @@
wrapper.style.overflow = "hidden";
html.style.backgroundColor = "#ffffff";
scrollContainer.style.overflowX = "auto";
scrollContainer.style.overflowX = globalScaleRatio === null ? "hidden" : "auto";
scrollContainer.style.overflowY = "auto";
fixedWrapper.style.overflow = "hidden";
fixedWrapper.style.width = bounds.width * scale + "px";
@ -284,37 +284,37 @@
if (BI.isIE()) {
BI.Combo.prototype.adjustHeight = function (e) {
adjustHeight.call(this, e);
var transformX = 0, transformY = 0;
var transformX = scrollContainer.scrollLeft;
var transformY = scrollContainer.scrollTop;
if (this.popupView) {
if (!checkInPopupView(this.popupView.element[0])) {
transformX = scrollContainer.scrollLeft;
transformY = scrollContainer.scrollTop;
this.popupView.element[0].style.left = parseInt(this.popupView.element[0].style.left) * scale - transformX + "px";
this.popupView.element[0].style.top = parseInt(this.popupView.element[0].style.top) * scale - transformY + "px";
} else {
var cBounds = BI.extend({}, this.popupView.element[0].getBoundingClientRect());
var pBounds = BI.extend({}, this.popupView.element[0].parentElement.getBoundingClientRect());
var hasScale = this.popupView.element[0].style.transform && this.popupView.element[0].style.transform.includes("scale");
var minWidth = parseInt(this.popupView.element[0].style.minWidth);
var minHeight = parseInt(this.popupView.element[0].style.minHeight);
cBounds.width = Math.max(cBounds.width, minWidth * scale);
cBounds.height = Math.max(cBounds.height, minHeight * scale);
if (cBounds.left + cBounds.width - scrollContainer.scrollLeft> body.clientWidth * scale) {
this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px";
if ((cBounds.left * scale + cBounds.width * (hasScale ? 1 : scale)) - transformX > body.clientWidth) {
this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px";
this.popupView.element[0].style.left = parseInt(this.popupView.element[0].style.left) * scale - transformX + "px";
} else if (this.options.direction === "right") {
this.popupView.element[0].style.top = parseInt(pBounds.top) - transformY + "px";
this.popupView.element[0].style.left = parseInt(pBounds.right) - transformX + "px";
this.popupView.element[0].style.top = parseInt(pBounds.top) + "px";
this.popupView.element[0].style.left = parseInt(pBounds.right) + "px";
} else if (parseInt(cBounds.top) >= parseInt(pBounds.top) && parseInt(cBounds.left) >= parseInt(pBounds.left)) {
this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px";
this.popupView.element[0].style.left = parseInt(pBounds.left) - transformX + "px";
this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px";
this.popupView.element[0].style.left = parseInt(pBounds.left) + "px";
}else if (parseInt(cBounds.top) >= parseInt(pBounds.top) && parseInt(cBounds.left) < parseInt(pBounds.left)) {
this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px";
this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px";
this.popupView.element[0].style.left = parseInt(Math.min(pBounds.left, body.clientWidth - cBounds.width)) - transformX + "px";
} else {
this.popupView.element[0].style.top = parseInt(pBounds.bottom) - transformY + "px";
this.popupView.element[0].style.left = parseInt(cBounds.left) * scale - transformX + "px";
this.popupView.element[0].style.top = parseInt(pBounds.bottom) + "px";
this.popupView.element[0].style.left = parseInt(cBounds.left) * scale + "px";
}
}
this.popupView.element[0].style.transform = "scale(" + scale+ ")";

Loading…
Cancel
Save