From d25385b4f349c4af141c7e206b0f8650b10de4ee Mon Sep 17 00:00:00 2001 From: imp Date: Tue, 7 Dec 2021 15:35:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20virtualgroup?= =?UTF-8?q?=20layouts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/group.virtual.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/base/combination/group.virtual.js b/src/base/combination/group.virtual.js index cccddd14e..ed21ba209 100644 --- a/src/base/combination/group.virtual.js +++ b/src/base/combination/group.virtual.js @@ -22,12 +22,13 @@ BI.VirtualGroup = BI.inherit(BI.Widget, { _packageBtns: function (items) { var o = this.options; var map = this.buttonMap = {}; - for (var i = o.layouts.length - 1; i > 0; i--) { + var layouts = BI.isArray(o.layouts) ? o.layouts : [o.layouts]; + for (var i = layouts.length - 1; i > 0; i--) { items = BI.map(items, function (k, it) { var el = BI.stripEL(it); - return BI.extend({}, o.layouts[i], { + return BI.extend({}, layouts[i], { items: [ - BI.extend({}, o.layouts[i].el, { + BI.extend({}, layouts[i].el, { el: BI.extend({ ref: function (_ref) { if (BI.isKey(map[el.value])) { @@ -44,7 +45,9 @@ BI.VirtualGroup = BI.inherit(BI.Widget, { }, _packageLayout: function (items) { - var o = this.options, layout = BI.deepClone(o.layouts[0]); + var o = this.options; + var layouts = BI.isArray(o.layouts) ? o.layouts : [o.layouts]; + var layout = BI.deepClone(layouts[0]); var lay = BI.formatEL(layout).el; while (lay && lay.items && !BI.isEmpty(lay.items)) { @@ -100,7 +103,6 @@ BI.VirtualGroup = BI.inherit(BI.Widget, { }, populate: function (items) { - var self = this; items = items || []; this.options.items = items; items = this._packageBtns(items); @@ -113,4 +115,4 @@ BI.VirtualGroup = BI.inherit(BI.Widget, { }); BI.VirtualGroup.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.virtual_group", BI.VirtualGroup); \ No newline at end of file +BI.shortcut("bi.virtual_group", BI.VirtualGroup);