|
|
@ -30,7 +30,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.behaviors = behaviors; |
|
|
|
this.behaviors = behaviors; |
|
|
|
this.populate(o.items); |
|
|
|
this.populate(o.items); |
|
|
|
if(BI.isKey(o.value) || BI.isNotEmptyArray(o.value)){ |
|
|
|
if (BI.isKey(o.value) || BI.isNotEmptyArray(o.value)) { |
|
|
|
this.setValue(o.value); |
|
|
|
this.setValue(o.value); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -77,11 +77,12 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { |
|
|
|
|
|
|
|
|
|
|
|
_packageBtns: function (btns) { |
|
|
|
_packageBtns: function (btns) { |
|
|
|
var o = this.options; |
|
|
|
var o = this.options; |
|
|
|
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--) { |
|
|
|
btns = BI.map(btns, function (k, it) { |
|
|
|
btns = BI.map(btns, function (k, 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: it |
|
|
|
el: it |
|
|
|
}) |
|
|
|
}) |
|
|
|
] |
|
|
|
] |
|
|
@ -108,7 +109,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_packageLayout: function (items) { |
|
|
|
_packageLayout: function (items) { |
|
|
|
var o = this.options, layout = BI.deepClone(o.layouts[0]); |
|
|
|
var o = this.options, layout = BI.deepClone(BI.isArray(o.layouts) ? o.layouts[0] : o.layouts); |
|
|
|
|
|
|
|
|
|
|
|
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)) { |
|
|
@ -121,7 +122,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { |
|
|
|
// 如果是一个简单的layout
|
|
|
|
// 如果是一个简单的layout
|
|
|
|
_isSimpleLayout: function () { |
|
|
|
_isSimpleLayout: function () { |
|
|
|
var o = this.options; |
|
|
|
var o = this.options; |
|
|
|
return o.layouts.length === 1 && !BI.isArray(o.items[0]); |
|
|
|
return BI.isArray(o.layouts) ? (o.layouts.length === 1 && !BI.isArray(o.items[0])) : true; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
doBehavior: function () { |
|
|
|
doBehavior: function () { |
|
|
|