|
|
@ -1,7 +1,35 @@ |
|
|
|
/** |
|
|
|
(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. |
|
|
|
* Created by roy on 15/8/14. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
BI.DownListCombo = BI.inherit(BI.Widget, { |
|
|
|
BI.DownListCombo = BI.inherit(BI.Widget, { |
|
|
|
_defaultConfig: function () { |
|
|
|
_defaultConfig: function () { |
|
|
|
return BI.extend(BI.DownListCombo.superclass._defaultConfig.apply(this, arguments), { |
|
|
|
return BI.extend(BI.DownListCombo.superclass._defaultConfig.apply(this, arguments), { |
|
|
|
baseCls: "bi-down-list-combo", |
|
|
|
baseCls: "bi-down-list-combo", |
|
|
@ -47,7 +75,7 @@ BI.DownListCombo = BI.inherit(BI.Widget, { |
|
|
|
ref: function (ref) { |
|
|
|
ref: function (ref) { |
|
|
|
self.popupView = ref; |
|
|
|
self.popupView = ref; |
|
|
|
}, |
|
|
|
}, |
|
|
|
items: o.items, |
|
|
|
items: transformItems(o.items), |
|
|
|
chooseType: o.chooseType, |
|
|
|
chooseType: o.chooseType, |
|
|
|
value: o.value, |
|
|
|
value: o.value, |
|
|
|
listeners: [{ |
|
|
|
listeners: [{ |
|
|
@ -102,9 +130,10 @@ BI.DownListCombo = BI.inherit(BI.Widget, { |
|
|
|
adjustHeight: function () { |
|
|
|
adjustHeight: function () { |
|
|
|
this.downlistcombo.adjustHeight(); |
|
|
|
this.downlistcombo.adjustHeight(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|
BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|
BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE"; |
|
|
|
BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE"; |
|
|
|
BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; |
|
|
|
BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; |
|
|
|
|
|
|
|
|
|
|
|
BI.shortcut("bi.down_list_combo", BI.DownListCombo); |
|
|
|
BI.shortcut("bi.down_list_combo", BI.DownListCombo); |
|
|
|
|
|
|
|
}()); |
|
|
|