Browse Source

无jira任务 virtualgroup layouts

es6
imp 3 years ago
parent
commit
d25385b4f3
  1. 14
      src/base/combination/group.virtual.js

14
src/base/combination/group.virtual.js

@ -22,12 +22,13 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
_packageBtns: function (items) { _packageBtns: function (items) {
var o = this.options; var o = this.options;
var map = this.buttonMap = {}; 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) { items = BI.map(items, function (k, it) {
var el = BI.stripEL(it); var el = BI.stripEL(it);
return BI.extend({}, o.layouts[i], { return BI.extend({}, layouts[i], {
items: [ items: [
BI.extend({}, o.layouts[i].el, { BI.extend({}, layouts[i].el, {
el: BI.extend({ el: BI.extend({
ref: function (_ref) { ref: function (_ref) {
if (BI.isKey(map[el.value])) { if (BI.isKey(map[el.value])) {
@ -44,7 +45,9 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
}, },
_packageLayout: function (items) { _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; var lay = BI.formatEL(layout).el;
while (lay && lay.items && !BI.isEmpty(lay.items)) { while (lay && lay.items && !BI.isEmpty(lay.items)) {
@ -100,7 +103,6 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
}, },
populate: function (items) { populate: function (items) {
var self = this;
items = items || []; items = items || [];
this.options.items = items; this.options.items = items;
items = this._packageBtns(items); items = this._packageBtns(items);
@ -113,4 +115,4 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
}); });
BI.VirtualGroup.EVENT_CHANGE = "EVENT_CHANGE"; BI.VirtualGroup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.virtual_group", BI.VirtualGroup); BI.shortcut("bi.virtual_group", BI.VirtualGroup);

Loading…
Cancel
Save