Browse Source
* commit '02bd6ee4688c80944d9be51fdd2fcc78b1dea945': REPORT-20994 feat: 单选下拉树新增选中值es6
guy
5 years ago
19 changed files with 2163 additions and 102 deletions
@ -0,0 +1,92 @@ |
|||||||
|
/** |
||||||
|
* Created by GUY on 2016/1/26. |
||||||
|
* |
||||||
|
* @class BI.MultiLayerSelectTreeInsertSearchPane |
||||||
|
* @extends BI.Pane |
||||||
|
*/ |
||||||
|
|
||||||
|
BI.MultiLayerSelectTreeInsertSearchPane = BI.inherit(BI.Widget, { |
||||||
|
|
||||||
|
props: function() { |
||||||
|
return { |
||||||
|
baseCls: "bi-multilayer-select-tree-popup", |
||||||
|
tipText: BI.i18nText("BI-No_Selected_Item"), |
||||||
|
isDefaultInit: false, |
||||||
|
itemsCreator: BI.emptyFn, |
||||||
|
items: [], |
||||||
|
value: "" |
||||||
|
}; |
||||||
|
}, |
||||||
|
|
||||||
|
render: function() { |
||||||
|
var self = this, o = this.options; |
||||||
|
this.tree = BI.createWidget({ |
||||||
|
type: "bi.multilayer_select_level_tree", |
||||||
|
isDefaultInit: o.isDefaultInit, |
||||||
|
items: o.items, |
||||||
|
itemsCreator: o.itemsCreator === BI.emptyFn ? BI.emptyFn : function (op, callback) { |
||||||
|
o.itemsCreator(op, function (res) { |
||||||
|
callback(res); |
||||||
|
self.setKeyword(o.keywordGetter()); |
||||||
|
}); |
||||||
|
}, |
||||||
|
keywordGetter: o.keywordGetter, |
||||||
|
value: o.value, |
||||||
|
scrollable: null, |
||||||
|
listeners: [{ |
||||||
|
eventName: BI.Controller.EVENT_CHANGE, |
||||||
|
action: function () { |
||||||
|
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||||
|
} |
||||||
|
}, { |
||||||
|
eventName: BI.MultiLayerSelectLevelTree.EVENT_CHANGE, |
||||||
|
action: function () { |
||||||
|
self.fireEvent(BI.MultiLayerSelectTreeInsertSearchPane.EVENT_CHANGE); |
||||||
|
} |
||||||
|
}] |
||||||
|
}); |
||||||
|
return { |
||||||
|
type: "bi.vertical", |
||||||
|
scrolly: false, |
||||||
|
scrollable: true, |
||||||
|
vgap: 5, |
||||||
|
items: [{ |
||||||
|
type: "bi.text_button", |
||||||
|
invisible: true, |
||||||
|
text: BI.i18nText("BI-Basic_Click_To_Add_Text", ""), |
||||||
|
height: 24, |
||||||
|
cls: "bi-high-light", |
||||||
|
hgap: 5, |
||||||
|
ref: function (_ref) { |
||||||
|
self.addNotMatchTip = _ref; |
||||||
|
}, |
||||||
|
handler: function () { |
||||||
|
self.fireEvent(BI.MultiLayerSelectTreeInsertSearchPane.EVENT_ADD_ITEM, o.keywordGetter()); |
||||||
|
} |
||||||
|
}, this.tree] |
||||||
|
}; |
||||||
|
}, |
||||||
|
|
||||||
|
setKeyword: function (keyword) { |
||||||
|
var showTip = BI.isEmptyArray(this.tree.getAllLeaves()); |
||||||
|
this.addNotMatchTip.setVisible(showTip); |
||||||
|
showTip && this.addNotMatchTip.setText(BI.i18nText("BI-Basic_Click_To_Add_Text", keyword)); |
||||||
|
}, |
||||||
|
|
||||||
|
getValue: function () { |
||||||
|
return this.tree.getValue(); |
||||||
|
}, |
||||||
|
|
||||||
|
setValue: function (v) { |
||||||
|
v = BI.isArray(v) ? v : [v]; |
||||||
|
this.tree.setValue(v); |
||||||
|
}, |
||||||
|
|
||||||
|
populate: function (items) { |
||||||
|
this.tree.populate(items); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.MultiLayerSelectTreeInsertSearchPane.EVENT_ADD_ITEM = "EVENT_ADD_ITEM"; |
||||||
|
BI.MultiLayerSelectTreeInsertSearchPane.EVENT_CHANGE = "EVENT_CHANGE"; |
||||||
|
BI.shortcut("bi.multilayer_select_tree_insert_search_pane", BI.MultiLayerSelectTreeInsertSearchPane); |
@ -0,0 +1,92 @@ |
|||||||
|
/** |
||||||
|
* Created by GUY on 2016/1/26. |
||||||
|
* |
||||||
|
* @class BI.MultiLayerSingleTreeInsertSearchPane |
||||||
|
* @extends BI.Pane |
||||||
|
*/ |
||||||
|
|
||||||
|
BI.MultiLayerSingleTreeInsertSearchPane = BI.inherit(BI.Widget, { |
||||||
|
|
||||||
|
props: function() { |
||||||
|
return { |
||||||
|
baseCls: "bi-multilayer-single-tree-popup", |
||||||
|
tipText: BI.i18nText("BI-No_Selected_Item"), |
||||||
|
isDefaultInit: false, |
||||||
|
itemsCreator: BI.emptyFn, |
||||||
|
items: [], |
||||||
|
value: "" |
||||||
|
}; |
||||||
|
}, |
||||||
|
|
||||||
|
render: function() { |
||||||
|
var self = this, o = this.options; |
||||||
|
this.tree = BI.createWidget({ |
||||||
|
type: "bi.multilayer_select_level_tree", |
||||||
|
isDefaultInit: o.isDefaultInit, |
||||||
|
items: o.items, |
||||||
|
itemsCreator: o.itemsCreator === BI.emptyFn ? BI.emptyFn : function (op, callback) { |
||||||
|
o.itemsCreator(op, function (res) { |
||||||
|
callback(res); |
||||||
|
self.setKeyword(o.keywordGetter()); |
||||||
|
}); |
||||||
|
}, |
||||||
|
keywordGetter: o.keywordGetter, |
||||||
|
value: o.value, |
||||||
|
scrollable: null, |
||||||
|
listeners: [{ |
||||||
|
eventName: BI.Controller.EVENT_CHANGE, |
||||||
|
action: function () { |
||||||
|
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||||
|
} |
||||||
|
}, { |
||||||
|
eventName: BI.MultiLayerSelectLevelTree.EVENT_CHANGE, |
||||||
|
action: function () { |
||||||
|
self.fireEvent(BI.MultiLayerSingleTreeInsertSearchPane.EVENT_CHANGE); |
||||||
|
} |
||||||
|
}] |
||||||
|
}); |
||||||
|
return { |
||||||
|
type: "bi.vertical", |
||||||
|
scrolly: false, |
||||||
|
scrollable: true, |
||||||
|
vgap: 5, |
||||||
|
items: [{ |
||||||
|
type: "bi.text_button", |
||||||
|
invisible: true, |
||||||
|
text: BI.i18nText("BI-Basic_Click_To_Add_Text", ""), |
||||||
|
height: 24, |
||||||
|
cls: "bi-high-light", |
||||||
|
hgap: 5, |
||||||
|
ref: function (_ref) { |
||||||
|
self.addNotMatchTip = _ref; |
||||||
|
}, |
||||||
|
handler: function () { |
||||||
|
self.fireEvent(BI.MultiLayerSingleTreeInsertSearchPane.EVENT_ADD_ITEM, o.keywordGetter()); |
||||||
|
} |
||||||
|
}, this.tree] |
||||||
|
}; |
||||||
|
}, |
||||||
|
|
||||||
|
setKeyword: function (keyword) { |
||||||
|
var showTip = BI.isEmptyArray(this.tree.getAllLeaves()); |
||||||
|
this.addNotMatchTip.setVisible(showTip); |
||||||
|
showTip && this.addNotMatchTip.setText(BI.i18nText("BI-Basic_Click_To_Add_Text", keyword)); |
||||||
|
}, |
||||||
|
|
||||||
|
getValue: function () { |
||||||
|
return this.tree.getValue(); |
||||||
|
}, |
||||||
|
|
||||||
|
setValue: function (v) { |
||||||
|
v = BI.isArray(v) ? v : [v]; |
||||||
|
this.tree.setValue(v); |
||||||
|
}, |
||||||
|
|
||||||
|
populate: function (items) { |
||||||
|
this.tree.populate(items); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.MultiLayerSingleTreeInsertSearchPane.EVENT_ADD_ITEM = "EVENT_ADD_ITEM"; |
||||||
|
BI.MultiLayerSingleTreeInsertSearchPane.EVENT_CHANGE = "EVENT_CHANGE"; |
||||||
|
BI.shortcut("bi.multilayer_single_tree_insert_search_pane", BI.MultiLayerSingleTreeInsertSearchPane); |
Loading…
Reference in new issue