Browse Source

BI-119658 feat: MultiSelectCombo支持搜索自定义itemFormatter

research/test
zsmj 2 years ago
parent
commit
a105c140ec
  1. 13
      src/widget/multiselect/multiselect.combo.nobar.js
  2. 14
      src/widget/multiselect/multiselect.insert.combo.js
  3. 13
      src/widget/multiselect/multiselect.insert.combo.nobar.js
  4. 10
      src/widget/multiselect/multiselect.insert.trigger.js
  5. 7
      src/widget/multiselect/multiselect.trigger.js
  6. 16
      src/widget/multiselect/search/multiselect.search.loader.js
  7. 7
      src/widget/multiselect/trigger/searcher.multiselect.insert.js
  8. 7
      src/widget/multiselect/trigger/searcher.multiselect.js

13
src/widget/multiselect/multiselect.combo.nobar.js

@ -54,6 +54,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight,
value: {
type: BI.Selection.Multi,
@ -134,7 +135,8 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
listeners: [
{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self._dataChange = true;
@ -156,7 +158,8 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
self.setValue();
self._defaultState();
}
}],
}
],
itemsCreator: o.itemsCreator,
itemHeight: o.itemHeight,
valueFormatter: o.valueFormatter,
@ -262,7 +265,8 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
items: [
{
el: this.combo,
left: 0,
right: 0,
@ -281,7 +285,8 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
right: o.height,
top: 0,
height: o.height
}]
}
]
});
},

14
src/widget/multiselect/multiselect.insert.combo.js

@ -55,6 +55,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight,
value: this.storeValue,
});
@ -138,7 +139,8 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
listeners: [
{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self._dataChange = true;
@ -160,9 +162,11 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
self.setValue();
self._defaultState();
}
}],
}
],
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight,
onLoaded: function () {
BI.nextTick(function () {
@ -260,7 +264,8 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
items: [
{
el: this.combo,
left: 0,
right: 0,
@ -279,7 +284,8 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
right: o.height,
top: 0,
height: o.height,
}]
}
]
});
},

13
src/widget/multiselect/multiselect.insert.combo.nobar.js

@ -54,6 +54,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
},
valueFormatter: o.valueFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight,
value: {
type: BI.Selection.Multi,
@ -129,7 +130,8 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
listeners: [
{
eventName: BI.MultiSelectPopupView.EVENT_CHANGE,
action: function () {
self._dataChange = true;
@ -150,7 +152,8 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
self.setValue();
self._defaultState();
}
}],
}
],
itemsCreator: o.itemsCreator,
itemHeight: o.itemHeight,
valueFormatter: o.valueFormatter,
@ -256,7 +259,8 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
items: [
{
el: this.combo,
left: 0,
right: 0,
@ -275,7 +279,8 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
right: o.height,
top: 0,
height: o.height
}]
}
]
});
},

10
src/widget/multiselect/multiselect.insert.trigger.js

@ -40,6 +40,7 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
defaultText: o.defaultText,
itemsCreator: o.itemsCreator,
valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
itemHeight: o.itemHeight,
watermark: o.watermark,
popup: {},
@ -86,13 +87,15 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
}, {
el: BI.createWidget(),
width: 24
}]
}
]
});
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
items: [
{
el: {
type: "bi.text",
title: function () {
@ -103,7 +106,8 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
right: 24,
top: 0,
bottom: 0
}]
}
]
});
},

7
src/widget/multiselect/multiselect.trigger.js

@ -41,6 +41,7 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
itemsCreator: o.itemsCreator,
itemHeight: o.itemHeight,
valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
watermark: o.watermark,
popup: {},
adapter: o.adapter,
@ -88,7 +89,8 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
items: [
{
el: {
type: "bi.text",
title: function () {
@ -104,7 +106,8 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
right: 24,
top: 0,
bottom: 0
}]
}
]
});
},

16
src/widget/multiselect/search/multiselect.search.loader.js

@ -51,9 +51,11 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
return true;
}
},
layouts: [{
layouts: [
{
type: "bi.vertical"
}]
}
]
}
}
},
@ -92,7 +94,10 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
_createItems: function (items) {
var allSelected = this.isAllSelected();
return BI.createItems(items, {
var itemFormatter = this.options.itemFormatter;
return BI.map(items, (index, item) => {
return {
type: "bi.multi_select_item",
logic: {
dynamic: false
@ -100,7 +105,10 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
selected: allSelected,
cls: "bi-list-item-active",
iconWrapperWidth: 36
iconWrapperWidth: 36,
...item,
...itemFormatter(item)
};
});
},

7
src/widget/multiselect/trigger/searcher.multiselect.insert.js

@ -29,7 +29,8 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
height: o.height,
text: o.text,
defaultText: o.defaultText,
listeners: [{
listeners: [
{
eventName: BI.MultiSelectEditor.EVENT_FOCUS,
action: function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_FOCUS);
@ -39,7 +40,8 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
action: function () {
self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_BLUR);
}
}]
}
]
});
this.searcher = BI.createWidget({
@ -56,6 +58,7 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
popup: BI.extend({
type: "bi.multi_select_search_insert_pane",
valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
keywordGetter: function () {
return self.editor.getKeyword();
},

7
src/widget/multiselect/trigger/searcher.multiselect.js

@ -29,7 +29,8 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
text: o.text,
defaultText: o.defaultText,
watermark: o.watermark,
listeners: [{
listeners: [
{
eventName: BI.MultiSelectEditor.EVENT_FOCUS,
action: function () {
self.fireEvent(BI.MultiSelectSearcher.EVENT_FOCUS);
@ -39,7 +40,8 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
action: function () {
self.fireEvent(BI.MultiSelectSearcher.EVENT_BLUR);
}
}]
}
]
});
this.searcher = BI.createWidget({
@ -55,6 +57,7 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
popup: BI.extend({
type: "bi.multi_select_search_pane",
valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
keywordGetter: function () {
return self.editor.getValue();
},

Loading…
Cancel
Save