From e8b6ac8b15368c538b0c12c9b73965b1f4f932d0 Mon Sep 17 00:00:00 2001 From: "DESKTOP-49I29QK\\zsmj" Date: Thu, 22 Mar 2018 09:06:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?loader=20=E5=92=8CcreateWidgets=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/fix/fix.compact.js | 10 ++++++++++ src/core/base.js | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dist/fix/fix.compact.js b/dist/fix/fix.compact.js index a974a3aa2..d38183d32 100644 --- a/dist/fix/fix.compact.js +++ b/dist/fix/fix.compact.js @@ -93,6 +93,16 @@ return result; }; + $(function () { + var populate = BI.Loader.prototype.populate; + BI.Loader.prototype.populate = function () { + pushContext(this); + var result = populate.apply(this, arguments); + popContext(); + return result; + }; + }); + var _init = BI.Widget.prototype._init; BI.Widget.prototype._init = function () { var self = this; diff --git a/src/core/base.js b/src/core/base.js index ca4a970d6..e2b1b6771 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -78,10 +78,16 @@ if (!window.BI) { return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View); }, - createWidgets: function (items, options) { + createWidgets: function (items, options, context) { if (!BI.isArray(items)) { throw new Error("cannot create Widgets"); } + if (BI.isWidget(options)) { + context = options; + options = {}; + } else { + options || (options = {}); + } return BI.map(BI.flatten(items), function (i, item) { return BI.createWidget(item, BI.deepClone(options)); }); From e6b10ffc084a50265e7318341ba30fa49e3f0b5f Mon Sep 17 00:00:00 2001 From: "DESKTOP-49I29QK\\zsmj" Date: Thu, 22 Mar 2018 09:08:18 +0800 Subject: [PATCH 2/2] update --- dist/bundle.js | 18 +++++++++++++++++- dist/core.js | 8 +++++++- utils/utils.js | 8 +++++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/dist/bundle.js b/dist/bundle.js index 8e5f37c84..579e7e2d0 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -19435,10 +19435,16 @@ if (!window.BI) { return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View); }, - createWidgets: function (items, options) { + createWidgets: function (items, options, context) { if (!BI.isArray(items)) { throw new Error("cannot create Widgets"); } + if (BI.isWidget(options)) { + context = options; + options = {}; + } else { + options || (options = {}); + } return BI.map(BI.flatten(items), function (i, item) { return BI.createWidget(item, BI.deepClone(options)); }); @@ -35369,6 +35375,16 @@ Data.Source = BISource = { return result; }; + $(function () { + var populate = BI.Loader.prototype.populate; + BI.Loader.prototype.populate = function () { + pushContext(this); + var result = populate.apply(this, arguments); + popContext(); + return result; + }; + }); + var _init = BI.Widget.prototype._init; BI.Widget.prototype._init = function () { var self = this; diff --git a/dist/core.js b/dist/core.js index ac2f4a5bc..2b2948c7a 100644 --- a/dist/core.js +++ b/dist/core.js @@ -19435,10 +19435,16 @@ if (!window.BI) { return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View); }, - createWidgets: function (items, options) { + createWidgets: function (items, options, context) { if (!BI.isArray(items)) { throw new Error("cannot create Widgets"); } + if (BI.isWidget(options)) { + context = options; + options = {}; + } else { + options || (options = {}); + } return BI.map(BI.flatten(items), function (i, item) { return BI.createWidget(item, BI.deepClone(options)); }); diff --git a/utils/utils.js b/utils/utils.js index acdce716a..1ee5e281f 100644 --- a/utils/utils.js +++ b/utils/utils.js @@ -10643,10 +10643,16 @@ if (!window.BI) { return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View); }, - createWidgets: function (items, options) { + createWidgets: function (items, options, context) { if (!BI.isArray(items)) { throw new Error("cannot create Widgets"); } + if (BI.isWidget(options)) { + context = options; + options = {}; + } else { + options || (options = {}); + } return BI.map(BI.flatten(items), function (i, item) { return BI.createWidget(item, BI.deepClone(options)); });