From ddde2f09991deb15edeb1a91f37d2de798f79d47 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Sat, 10 Oct 2020 11:13:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?BI-73644=20pane=E5=92=8CloadingPane?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8A=A0=E8=BD=BD=E6=97=B6=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=8F=90=E7=A4=BA=E6=96=87=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 3 +++ src/base/pane.js | 47 +++++++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/changelog.md b/changelog.md index d250d3e416..6f14474d0c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # 更新日志 +2.0(2020-10) +- pane和loadingPane支持加载时自定义提示文本 + 2.0(2020-09) - combo增加click-blur(点击显示,blur消失)作为触发条件功能 - allCountPager支持是否显示总行数 diff --git a/src/base/pane.js b/src/base/pane.js index 4018a8d3df..a39a65c2b2 100644 --- a/src/base/pane.js +++ b/src/base/pane.js @@ -12,6 +12,7 @@ BI.Pane = BI.inherit(BI.Widget, { return BI.extend(BI.Pane.superclass._defaultConfig.apply(this, arguments), { _baseCls: "bi-pane", tipText: BI.i18nText("BI-No_Selected_Item"), + loadingText: "", overlap: true, onLoaded: BI.emptyFn }); @@ -67,11 +68,9 @@ BI.Pane = BI.inherit(BI.Widget, { if (o.overlap === true) { if (!BI.Layers.has(this.getName())) { BI.createWidget({ - type: "bi.absolute_center_adapt", + type: "bi.center_adapt", cls: "loading-container", - items: [{ - el: loadingAnimation - }], + items: this._getLoadingTipItems(loadingAnimation), element: BI.Layers.make(this.getName(), this) }); } @@ -80,28 +79,40 @@ BI.Pane = BI.inherit(BI.Widget, { this._loading = loadingAnimation; this._loading.element.css("zIndex", 1); BI.createWidget({ - type: "bi.absolute_center_adapt", + type: "bi.center_adapt", element: this, cls: "loading-container", - items: [{ - el: this._loading, - left: 0, - right: 0, - top: 0 - }] + items: this._getLoadingTipItems(this._loading) }); } this.element.addClass("loading-status"); }, + _getLoadingTipItems: function (loadingTip) { + var o = this.options; + var loadingTipItems = [{ + type: "bi.horizontal_adapt", + items: [loadingTip] + }]; + BI.isNotEmptyString(o.loadingText) && loadingTipItems.push({ + type: "bi.text", + text: o.loadingText + }); + + return [{ + type: "bi.vertical", + items: loadingTipItems + }]; + }, + loaded: function () { - var self = this, o = this.options; - BI.Layers.remove(self.getName()); - this._loading && this._loading.destroy(); - this._loading && (this._loading = null); - o.onLoaded(); - self.fireEvent(BI.Pane.EVENT_LOADED); - this.element.removeClass("loading-status"); + // var self = this, o = this.options; + // BI.Layers.remove(self.getName()); + // this._loading && this._loading.destroy(); + // this._loading && (this._loading = null); + // o.onLoaded(); + // self.fireEvent(BI.Pane.EVENT_LOADED); + // this.element.removeClass("loading-status"); }, check: function () { From ca8fa7187473615acdb868d888a12c2734075d09 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Sat, 10 Oct 2020 11:18:40 +0800 Subject: [PATCH 2/2] update --- src/base/pane.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/base/pane.js b/src/base/pane.js index a39a65c2b2..a77976f61b 100644 --- a/src/base/pane.js +++ b/src/base/pane.js @@ -106,13 +106,13 @@ BI.Pane = BI.inherit(BI.Widget, { }, loaded: function () { - // var self = this, o = this.options; - // BI.Layers.remove(self.getName()); - // this._loading && this._loading.destroy(); - // this._loading && (this._loading = null); - // o.onLoaded(); - // self.fireEvent(BI.Pane.EVENT_LOADED); - // this.element.removeClass("loading-status"); + var self = this, o = this.options; + BI.Layers.remove(self.getName()); + this._loading && this._loading.destroy(); + this._loading && (this._loading = null); + o.onLoaded(); + self.fireEvent(BI.Pane.EVENT_LOADED); + this.element.removeClass("loading-status"); }, check: function () {