From 68f5b25fa634799ed04f1d47422fad97bd040847 Mon Sep 17 00:00:00 2001 From: fay Date: Tue, 2 Jun 2020 16:20:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?BI-66198=20fix:=20=E4=B8=8D=E7=9F=A5?= =?UTF-8?q?=E9=81=93=E7=AE=97=E6=98=AF=E4=B8=BB=E7=BA=BFbug=E8=BF=98?= =?UTF-8?q?=E6=98=AFchrome=E7=9A=84bug=E8=BF=98=E6=98=AF=E6=8F=92=E4=BB=B6?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/ScreenAdaptiveComponent.java | 5 + .../plugin/web/css/plugin.screen_adaptive.css | 3 + .../plugin/web/plugin.screen_adaptive.js | 114 ++++++++++-------- .../com/finebi/plugin/web/scripts/entry.js | 114 ++++++++++-------- 4 files changed, 132 insertions(+), 104 deletions(-) create mode 100644 src/main/resources/com/finebi/plugin/web/css/plugin.screen_adaptive.css diff --git a/src/main/java/com/finebi/plugin/ScreenAdaptiveComponent.java b/src/main/java/com/finebi/plugin/ScreenAdaptiveComponent.java index e2bfda5..0cfcbb5 100644 --- a/src/main/java/com/finebi/plugin/ScreenAdaptiveComponent.java +++ b/src/main/java/com/finebi/plugin/ScreenAdaptiveComponent.java @@ -16,4 +16,9 @@ public class ScreenAdaptiveComponent extends Component { public ScriptPath script() { return ScriptPath.build("com/finebi/plugin/web/plugin.screen_adaptive.js"); } + + @Override + public StylePath style() { + return StylePath.build("/com/finebi/plugin/web/css/plugin.screen_adaptive.css"); + } } \ No newline at end of file diff --git a/src/main/resources/com/finebi/plugin/web/css/plugin.screen_adaptive.css b/src/main/resources/com/finebi/plugin/web/css/plugin.screen_adaptive.css new file mode 100644 index 0000000..d8696db --- /dev/null +++ b/src/main/resources/com/finebi/plugin/web/css/plugin.screen_adaptive.css @@ -0,0 +1,3 @@ +.bi-show-widget-tool-factory { + z-index: 1; +} \ No newline at end of file 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 94f9a4d..0bb1e3d 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 @@ -27,11 +27,57 @@ var adjustHeight = BI.Combo.prototype.adjustHeight; var originalRender = BI.Widget._renderEngine; var injectSearch = BI.Searcher.prototype._search; - var injectSearchView = BI.Searcher.prototype.setValue; + var injectSearchSetValue = BI.Searcher.prototype.setValue; + var injectSearchAdjustView = BI.Searcher.prototype._assertPopupView; var injectTooltipsShow = BI.TooltipsController.prototype.show; var injectSwitcherPopup = BI.Switcher.prototype.adjustView; var injectCreate = BI.createWidget; + var callback = function () {}; + + BI.Searcher.prototype._search = function (result, searchResult, keyword) { + var self = this, o = this.options, keyword = o.allowSearchBlank ? this.editor.getValue() : this._getLastSearchKeyword(); + if (keyword === "" || this._stop) { + return; + } + if (o.isAutoSearch) { + var items = (o.adapter && ((o.adapter.getItems && o.adapter.getItems()) || o.adapter.attr("items"))) || []; + var finding = BI.Func.getSearchResult(items, keyword); + var match = finding.match, find = finding.find; + this.popupView.populate(find, match, keyword); + o.isAutoSync && o.adapter && o.adapter.getValue && this.popupView.setValue(o.adapter.getValue()); + self.fireEvent(BI.Searcher.EVENT_SEARCHING); + callback && callback.call(self); + if (self.popupView) { + BI.defer(function () { + self.popupView.element[0].parentElement.style.left = parseInt(self.popupView.element[0].parentElement.style.left) * scale + "px"; + self.popupView.element[0].parentElement.style.top = parseInt(self.popupView.element[0].parentElement.style.top) * scale + "px"; + self.popupView.element[0].parentElement.style.transform = "scale(" + scale + ")"; + self.popupView.element[0].parentElement.style.transformOrigin = "left top"; + }) + } + return; + } + this.popupView.loading && this.popupView.loading(); + o.onSearch({ + times: 1, + keyword: keyword, + selectedValues: o.adapter && o.adapter.getValue() + }, function (searchResult, matchResult) { + if (!self._stop) { + var args = [].slice.call(arguments); + if (args.length > 0) { + args.push(keyword); + } + BI.Maskers.show(self.getName()); + self.popupView.populate.apply(self.popupView, args); + o.isAutoSync && o.adapter && o.adapter.getValue && self.popupView.setValue(o.adapter.getValue()); + self.popupView.loaded && self.popupView.loaded(); + self.fireEvent(BI.Searcher.EVENT_SEARCHING); + callback && callback.call(self); + } + }); + }; // 修正事件偏移 function correctEvent(e) { @@ -277,7 +323,7 @@ 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(pBounds.left) - transformX + "px"; + this.popupView.element[0].style.left = parseInt(cBounds.left) * scale - transformX + "px"; } } this.popupView.element[0].style.transform = "scale(" + scale+ ")"; @@ -304,62 +350,26 @@ } // Searcher - BI.Searcher.prototype._search = function (result, searchResult, keyword) { - var self = this, o = this.options, keyword = o.allowSearchBlank ? this.editor.getValue() : this._getLastSearchKeyword(); - if (keyword === "" || this._stop) { - return; - } - if (o.isAutoSearch) { - var items = (o.adapter && ((o.adapter.getItems && o.adapter.getItems()) || o.adapter.attr("items"))) || []; - var finding = BI.Func.getSearchResult(items, keyword); - var match = finding.match, find = finding.find; - this.popupView.populate(find, match, keyword); - o.isAutoSync && o.adapter && o.adapter.getValue && this.popupView.setValue(o.adapter.getValue()); - self.fireEvent(BI.Searcher.EVENT_SEARCHING); - if (self.popupView) { - BI.defer(function () { - self.popupView.element[0].parentElement.style.left = parseInt(self.popupView.element[0].parentElement.style.left) * scale + "px"; - self.popupView.element[0].parentElement.style.top = parseInt(self.popupView.element[0].parentElement.style.top) * scale + "px"; - self.popupView.element[0].parentElement.style.transform = "scale(" + scale + ")"; - self.popupView.element[0].parentElement.style.transformOrigin = "left top"; - }) + callback = function () { + var self = this; + BI.defer(function () { + if (self.popupView && self.popupView.element[0].parentElement) { + self.popupView.element[0].parentElement.style.left = parseInt(self.popupView.element[0].parentElement.style.left) * scale + "px"; + self.popupView.element[0].parentElement.style.top = parseInt(self.popupView.element[0].parentElement.style.top) * scale + "px"; + self.popupView.element[0].parentElement.style.transform = "scale(" + scale + ")"; + self.popupView.element[0].parentElement.style.transformOrigin = "left top"; } - return; - } - this.popupView.loading && this.popupView.loading(); - o.onSearch({ - times: 1, - keyword: keyword, - selectedValues: o.adapter && o.adapter.getValue() - }, function (searchResult, matchResult) { - if (!self._stop) { - var args = [].slice.call(arguments); - if (args.length > 0) { - args.push(keyword); - } - BI.Maskers.show(self.getName()); - self.popupView.populate.apply(self.popupView, args); - o.isAutoSync && o.adapter && o.adapter.getValue && self.popupView.setValue(o.adapter.getValue()); - self.popupView.loaded && self.popupView.loaded(); - self.fireEvent(BI.Searcher.EVENT_SEARCHING); - if (self.popupView) { - self.popupView.element[0].parentElement.style.left = parseInt(self.popupView.element[0].parentElement.style.left) * scale + "px"; - self.popupView.element[0].parentElement.style.top = parseInt(self.popupView.element[0].parentElement.style.top) * scale + "px"; - self.popupView.element[0].parentElement.style.transform = "scale(" + scale + ")"; - self.popupView.element[0].parentElement.style.transformOrigin = "left top"; - } - } - }); - }; + }) + } + BI.Searcher.prototype.setValue = function () { - injectSearchView.call(this, arguments); + injectSearchSetValue.call(this, arguments); if (this.popupView && this.popupView.element[0].parentElement) { this.popupView.element[0].parentElement.style.left = parseInt(this.popupView.element[0].parentElement.style.left) * scale + "px"; this.popupView.element[0].parentElement.style.top = parseInt(this.popupView.element[0].parentElement.style.top) * scale + "px"; this.popupView.element[0].parentElement.style.transform = "scale(" + scale + ")"; this.popupView.element[0].parentElement.style.transformOrigin = "left top"; } - } // switcher @@ -478,8 +488,8 @@ BI.Popovers = new BI.PopoverController(); BI.Widget.registerRenderEngine(originalRender); - BI.Searcher.prototype._search = injectSearch; - BI.Searcher.prototype.setValue = injectSearchView; + callback = function () {} + BI.Searcher.prototype.setValue = injectSearchSetValue; BI.Switcher.prototype.adjustView = injectSwitcherPopup; BI.TooltipsController.prototype.show = injectTooltipsShow; 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 94f9a4d..0bb1e3d 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/src/main/resources/com/finebi/plugin/web/scripts/entry.js @@ -27,11 +27,57 @@ var adjustHeight = BI.Combo.prototype.adjustHeight; var originalRender = BI.Widget._renderEngine; var injectSearch = BI.Searcher.prototype._search; - var injectSearchView = BI.Searcher.prototype.setValue; + var injectSearchSetValue = BI.Searcher.prototype.setValue; + var injectSearchAdjustView = BI.Searcher.prototype._assertPopupView; var injectTooltipsShow = BI.TooltipsController.prototype.show; var injectSwitcherPopup = BI.Switcher.prototype.adjustView; var injectCreate = BI.createWidget; + var callback = function () {}; + + BI.Searcher.prototype._search = function (result, searchResult, keyword) { + var self = this, o = this.options, keyword = o.allowSearchBlank ? this.editor.getValue() : this._getLastSearchKeyword(); + if (keyword === "" || this._stop) { + return; + } + if (o.isAutoSearch) { + var items = (o.adapter && ((o.adapter.getItems && o.adapter.getItems()) || o.adapter.attr("items"))) || []; + var finding = BI.Func.getSearchResult(items, keyword); + var match = finding.match, find = finding.find; + this.popupView.populate(find, match, keyword); + o.isAutoSync && o.adapter && o.adapter.getValue && this.popupView.setValue(o.adapter.getValue()); + self.fireEvent(BI.Searcher.EVENT_SEARCHING); + callback && callback.call(self); + if (self.popupView) { + BI.defer(function () { + self.popupView.element[0].parentElement.style.left = parseInt(self.popupView.element[0].parentElement.style.left) * scale + "px"; + self.popupView.element[0].parentElement.style.top = parseInt(self.popupView.element[0].parentElement.style.top) * scale + "px"; + self.popupView.element[0].parentElement.style.transform = "scale(" + scale + ")"; + self.popupView.element[0].parentElement.style.transformOrigin = "left top"; + }) + } + return; + } + this.popupView.loading && this.popupView.loading(); + o.onSearch({ + times: 1, + keyword: keyword, + selectedValues: o.adapter && o.adapter.getValue() + }, function (searchResult, matchResult) { + if (!self._stop) { + var args = [].slice.call(arguments); + if (args.length > 0) { + args.push(keyword); + } + BI.Maskers.show(self.getName()); + self.popupView.populate.apply(self.popupView, args); + o.isAutoSync && o.adapter && o.adapter.getValue && self.popupView.setValue(o.adapter.getValue()); + self.popupView.loaded && self.popupView.loaded(); + self.fireEvent(BI.Searcher.EVENT_SEARCHING); + callback && callback.call(self); + } + }); + }; // 修正事件偏移 function correctEvent(e) { @@ -277,7 +323,7 @@ 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(pBounds.left) - transformX + "px"; + this.popupView.element[0].style.left = parseInt(cBounds.left) * scale - transformX + "px"; } } this.popupView.element[0].style.transform = "scale(" + scale+ ")"; @@ -304,62 +350,26 @@ } // Searcher - BI.Searcher.prototype._search = function (result, searchResult, keyword) { - var self = this, o = this.options, keyword = o.allowSearchBlank ? this.editor.getValue() : this._getLastSearchKeyword(); - if (keyword === "" || this._stop) { - return; - } - if (o.isAutoSearch) { - var items = (o.adapter && ((o.adapter.getItems && o.adapter.getItems()) || o.adapter.attr("items"))) || []; - var finding = BI.Func.getSearchResult(items, keyword); - var match = finding.match, find = finding.find; - this.popupView.populate(find, match, keyword); - o.isAutoSync && o.adapter && o.adapter.getValue && this.popupView.setValue(o.adapter.getValue()); - self.fireEvent(BI.Searcher.EVENT_SEARCHING); - if (self.popupView) { - BI.defer(function () { - self.popupView.element[0].parentElement.style.left = parseInt(self.popupView.element[0].parentElement.style.left) * scale + "px"; - self.popupView.element[0].parentElement.style.top = parseInt(self.popupView.element[0].parentElement.style.top) * scale + "px"; - self.popupView.element[0].parentElement.style.transform = "scale(" + scale + ")"; - self.popupView.element[0].parentElement.style.transformOrigin = "left top"; - }) + callback = function () { + var self = this; + BI.defer(function () { + if (self.popupView && self.popupView.element[0].parentElement) { + self.popupView.element[0].parentElement.style.left = parseInt(self.popupView.element[0].parentElement.style.left) * scale + "px"; + self.popupView.element[0].parentElement.style.top = parseInt(self.popupView.element[0].parentElement.style.top) * scale + "px"; + self.popupView.element[0].parentElement.style.transform = "scale(" + scale + ")"; + self.popupView.element[0].parentElement.style.transformOrigin = "left top"; } - return; - } - this.popupView.loading && this.popupView.loading(); - o.onSearch({ - times: 1, - keyword: keyword, - selectedValues: o.adapter && o.adapter.getValue() - }, function (searchResult, matchResult) { - if (!self._stop) { - var args = [].slice.call(arguments); - if (args.length > 0) { - args.push(keyword); - } - BI.Maskers.show(self.getName()); - self.popupView.populate.apply(self.popupView, args); - o.isAutoSync && o.adapter && o.adapter.getValue && self.popupView.setValue(o.adapter.getValue()); - self.popupView.loaded && self.popupView.loaded(); - self.fireEvent(BI.Searcher.EVENT_SEARCHING); - if (self.popupView) { - self.popupView.element[0].parentElement.style.left = parseInt(self.popupView.element[0].parentElement.style.left) * scale + "px"; - self.popupView.element[0].parentElement.style.top = parseInt(self.popupView.element[0].parentElement.style.top) * scale + "px"; - self.popupView.element[0].parentElement.style.transform = "scale(" + scale + ")"; - self.popupView.element[0].parentElement.style.transformOrigin = "left top"; - } - } - }); - }; + }) + } + BI.Searcher.prototype.setValue = function () { - injectSearchView.call(this, arguments); + injectSearchSetValue.call(this, arguments); if (this.popupView && this.popupView.element[0].parentElement) { this.popupView.element[0].parentElement.style.left = parseInt(this.popupView.element[0].parentElement.style.left) * scale + "px"; this.popupView.element[0].parentElement.style.top = parseInt(this.popupView.element[0].parentElement.style.top) * scale + "px"; this.popupView.element[0].parentElement.style.transform = "scale(" + scale + ")"; this.popupView.element[0].parentElement.style.transformOrigin = "left top"; } - } // switcher @@ -478,8 +488,8 @@ BI.Popovers = new BI.PopoverController(); BI.Widget.registerRenderEngine(originalRender); - BI.Searcher.prototype._search = injectSearch; - BI.Searcher.prototype.setValue = injectSearchView; + callback = function () {} + BI.Searcher.prototype.setValue = injectSearchSetValue; BI.Switcher.prototype.adjustView = injectSwitcherPopup; BI.TooltipsController.prototype.show = injectTooltipsShow; From a241a6b2dfb7adf94b16176af8d4c9c4580a02df Mon Sep 17 00:00:00 2001 From: fay Date: Tue, 2 Jun 2020 18:43:31 +0800 Subject: [PATCH 2/2] BI-66198 --- .../resources/com/finebi/plugin/web/plugin.screen_adaptive.js | 2 +- src/main/resources/com/finebi/plugin/web/scripts/entry.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 0bb1e3d..d575dd4 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 @@ -116,7 +116,7 @@ wrapper.style.transformOrigin = "top left"; wrapper.style["-ms-transform"] = "scale(" + bounds.scale+ ")"; wrapper.style["-ms-transform-origin"] = "top left"; - wrapper.style.overflowY = "auto"; + wrapper.style.overflowY = "hidden"; html.style.backgroundColor = "#ffffff"; scrollContainer.style.overflowX = "auto"; 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 0bb1e3d..d575dd4 100644 --- a/src/main/resources/com/finebi/plugin/web/scripts/entry.js +++ b/src/main/resources/com/finebi/plugin/web/scripts/entry.js @@ -116,7 +116,7 @@ wrapper.style.transformOrigin = "top left"; wrapper.style["-ms-transform"] = "scale(" + bounds.scale+ ")"; wrapper.style["-ms-transform-origin"] = "top left"; - wrapper.style.overflowY = "auto"; + wrapper.style.overflowY = "hidden"; html.style.backgroundColor = "#ffffff"; scrollContainer.style.overflowX = "auto";