From f25ffb11bb67aa6ec10a40ad6b449b2497ea0f02 Mon Sep 17 00:00:00 2001 From: iapyang Date: Mon, 18 Jul 2022 10:21:14 +0800 Subject: [PATCH 1/4] refactor: eslint fix --- src/core/system.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/core/system.js b/src/core/system.js index 652a9c256..b0ebda3bf 100644 --- a/src/core/system.js +++ b/src/core/system.js @@ -29,12 +29,11 @@ "L": 24 }; - var provider = function () { - + function provider () { this.SYSTEM = system; this.setSize = function (opt) { - BI.deepExtend(system, {size: opt}); + BI.deepExtend(system, { size: opt }); }; this.setResponsiveMode = function (mode) { @@ -91,10 +90,10 @@ } }); }; - }; + } BI.provider("bi.provider.system", provider); -})(); +}()); BI.prepares.push(function () { BI.SIZE_CONSANTS = BI.Providers.getProvider("bi.provider.system").getSize(); From 064c68e2a6739cfd8b95ef465c391d503e74d179 Mon Sep 17 00:00:00 2001 From: iapyang Date: Mon, 18 Jul 2022 17:21:45 +0800 Subject: [PATCH 2/4] =?UTF-8?q?KERNEL-9708=20refactor:=20=E6=8F=90?= =?UTF-8?q?=E5=8F=96=E5=88=B0system=E4=B8=AD=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/1.pane.js | 26 ++------------------------ src/core/system.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 24 deletions(-) diff --git a/src/base/1.pane.js b/src/base/1.pane.js index 8df568ead..015be58b8 100644 --- a/src/base/1.pane.js +++ b/src/base/1.pane.js @@ -40,30 +40,8 @@ BI.Pane = BI.inherit(BI.Widget, { loading: function () { var self = this, o = this.options; - var isIE = BI.isIE(); - var loadingAnimation = BI.createWidget({ - type: "bi.horizontal", - cls: "bi-loading-widget" + (isIE ? " wave-loading hack" : ""), - height: this._getSize(60), - width: this._getSize(60), - hgap: this._getSize(10), - vgap: 2.5, - items: isIE ? [] : [{ - type: "bi.layout", - cls: "animate-rect rect1", - height: this._getSize(50), - width: this._getSize(5) - }, { - type: "bi.layout", - cls: "animate-rect rect2", - height: this._getSize(50), - width: this._getSize(5) - }, { - type: "bi.layout", - cls: "animate-rect rect3", - height: this._getSize(50), - width: this._getSize(5) - }] + var loadingAnimation = BI.Providers.getProvider("bi.provider.system").getLoading({ + loadingSize: o.loadingSize }); // pane在同步方式下由items决定tipText的显示与否 // loading的异步情况下由loaded后对面板的populate的时机决定 diff --git a/src/core/system.js b/src/core/system.js index b0ebda3bf..545057e49 100644 --- a/src/core/system.js +++ b/src/core/system.js @@ -19,6 +19,40 @@ TOAST_TOP: 10, H_GAP_SIZE: "M", V_GAP_SIZE: "S" + }, + loadingCreator: function(config) { + var loadingSize = (config ? config.loadingSize : "small") || "small"; + + var isIE = BI.isIE(); + + function getSize(v) { + return Math.ceil(v / (loadingSize === "small" ? 2 : 1)); + } + + return { + type: "bi.horizontal", + cls: "bi-loading-widget" + (isIE ? " wave-loading hack" : ""), + height: getSize(60), + width: getSize(60), + hgap: getSize(10), + vgap: 2.5, + items: isIE ? [] : [{ + type: "bi.layout", + cls: "animate-rect rect1", + height: getSize(50), + width: getSize(5) + }, { + type: "bi.layout", + cls: "animate-rect rect2", + height: getSize(50), + width: getSize(5) + }, { + type: "bi.layout", + cls: "animate-rect rect3", + height: getSize(50), + width: getSize(5) + }] + }; } }; @@ -59,6 +93,10 @@ BI.extend(system.dependencies, moduleConfig); }; + this.setLoadingCreator = function(creator) { + system.loadingCreator = creator; + }; + this.$get = function () { return BI.inherit(BI.OB, { @@ -87,6 +125,10 @@ getDependencies: function () { return system.dependencies; + }, + + getLoading: function(config) { + return system.loadingCreator(config); } }); }; From d8e99784a37a91d5bc49cda41c10e34190c4c519 Mon Sep 17 00:00:00 2001 From: iapyang Date: Wed, 20 Jul 2022 10:06:37 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=E5=87=86=E5=A4=87demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/替换loading动画.html | 104 ++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 examples/替换loading动画.html diff --git a/examples/替换loading动画.html b/examples/替换loading动画.html new file mode 100644 index 000000000..9ae3707d4 --- /dev/null +++ b/examples/替换loading动画.html @@ -0,0 +1,104 @@ + + + + + + + + Document + + + + + + +
+ + + + \ No newline at end of file From 56497d7b2eac8693c895bc0df2f6fdc70a806b08 Mon Sep 17 00:00:00 2001 From: iapyang Date: Wed, 20 Jul 2022 10:28:21 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat:=20config=E4=B8=AD=E4=BC=A0=E4=B8=8Bco?= =?UTF-8?q?ntext?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/1.pane.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/base/1.pane.js b/src/base/1.pane.js index 015be58b8..0a4c93a96 100644 --- a/src/base/1.pane.js +++ b/src/base/1.pane.js @@ -41,7 +41,8 @@ BI.Pane = BI.inherit(BI.Widget, { loading: function () { var self = this, o = this.options; var loadingAnimation = BI.Providers.getProvider("bi.provider.system").getLoading({ - loadingSize: o.loadingSize + loadingSize: o.loadingSize, + context: this }); // pane在同步方式下由items决定tipText的显示与否 // loading的异步情况下由loaded后对面板的populate的时机决定