|
|
|
@ -1,3 +1,31 @@
|
|
|
|
|
(function() { |
|
|
|
|
function transformItems(items) { |
|
|
|
|
if (!items) return items; |
|
|
|
|
var result = BI.cloneDeep(items); |
|
|
|
|
var isComplexItmes = BI.some(items, function (_, item) { |
|
|
|
|
return BI.isArray(item); |
|
|
|
|
}); |
|
|
|
|
// 传一维数组,帮转二维
|
|
|
|
|
if (!isComplexItmes) { |
|
|
|
|
result = [result]; |
|
|
|
|
} |
|
|
|
|
// 帮转 el
|
|
|
|
|
BI.each(result, function (_, arr) { |
|
|
|
|
BI.each(arr, function (_, item) { |
|
|
|
|
if (item.children && !item.el) { |
|
|
|
|
item.el = { |
|
|
|
|
text: item.text, |
|
|
|
|
icon: item.icon, |
|
|
|
|
cls: item.cls, |
|
|
|
|
iconCls1: item.iconCls1,
|
|
|
|
|
value: item.value |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Created by roy on 15/8/14. |
|
|
|
|
*/ |
|
|
|
@ -47,7 +75,7 @@ BI.DownListCombo = BI.inherit(BI.Widget, {
|
|
|
|
|
ref: function (ref) { |
|
|
|
|
self.popupView = ref; |
|
|
|
|
}, |
|
|
|
|
items: o.items, |
|
|
|
|
items: transformItems(o.items), |
|
|
|
|
chooseType: o.chooseType, |
|
|
|
|
value: o.value, |
|
|
|
|
listeners: [{ |
|
|
|
@ -108,3 +136,4 @@ BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE";
|
|
|
|
|
BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; |
|
|
|
|
|
|
|
|
|
BI.shortcut("bi.down_list_combo", BI.DownListCombo); |
|
|
|
|
}()); |
|
|
|
|