fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.7 KiB

7 years ago
/**
*
* 在搜索框中输入文本弹出的面板
* @class BI.MultiSelectSearchInsertPane
* @extends Widget
*/
BI.MultiSelectSearchInsertPane = BI.inherit(BI.Widget, {
constants: {
height: 24,
lgap: 10,
tgap: 5
},
_defaultConfig: function () {
return BI.extend(BI.MultiSelectSearchInsertPane.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-multi-select-search-pane bi-card",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
keywordGetter: BI.emptyFn,
itemHeight: 24
7 years ago
});
},
_init: function () {
BI.MultiSelectSearchInsertPane.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.addNotMatchTip = BI.createWidget({
type: "bi.label",
text: BI.i18nText("BI-Basic_Press_Enter_To_Add_Text", ""),
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
cls: "bi-keyword-red-mark",
hgap: 5,
7 years ago
});
this.loader = BI.createWidget({
type: "bi.multi_select_search_loader",
keywordGetter: o.keywordGetter,
valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
7 years ago
itemsCreator: function (op, callback) {
o.itemsCreator.apply(self, [op, function (res) {
callback(res);
self.setKeyword(o.keywordGetter());
}]);
},
itemHeight: o.itemHeight,
7 years ago
value: o.value
});
this.loader.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.resizer = BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
el: this.addNotMatchTip,
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
7 years ago
}, {
el: this.loader,
}],
7 years ago
});
},
setKeyword: function (keyword) {
this.addNotMatchTip.setText(BI.i18nText("BI-Basic_Press_Enter_To_Add_Text", keyword));
5 years ago
},
7 years ago
isAllSelected: function () {
return this.loader.isAllSelected();
},
hasMatched: function () {
return false;
7 years ago
},
setValue: function (v) {
this.loader.setValue(v);
},
getValue: function () {
return this.loader.getValue();
},
empty: function () {
this.loader.empty();
},
populate: function (items) {
this.loader.populate.apply(this.loader, arguments);
}
});
BI.MultiSelectSearchInsertPane.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multi_select_search_insert_pane", BI.MultiSelectSearchInsertPane);