|
|
@ -12,12 +12,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { |
|
|
|
valueFormatter: BI.emptyFn, |
|
|
|
valueFormatter: BI.emptyFn, |
|
|
|
itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, |
|
|
|
itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, |
|
|
|
height: 24, |
|
|
|
height: 24, |
|
|
|
allowEdit: true |
|
|
|
allowEdit: true, |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_init: function () { |
|
|
|
_init: function () { |
|
|
|
var self = this, o = this.options; |
|
|
|
var self = this; var o = this.options; |
|
|
|
BI.MultiSelectCombo.superclass._init.apply(this, arguments); |
|
|
|
BI.MultiSelectCombo.superclass._init.apply(this, arguments); |
|
|
|
var assertShowValue = function () { |
|
|
|
var assertShowValue = function () { |
|
|
|
if (BI.isKey(self._startValue)) { |
|
|
|
if (BI.isKey(self._startValue)) { |
|
|
@ -52,13 +52,13 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { |
|
|
|
left: 0, |
|
|
|
left: 0, |
|
|
|
top: 0, |
|
|
|
top: 0, |
|
|
|
right: 0, |
|
|
|
right: 0, |
|
|
|
bottom: 25 |
|
|
|
bottom: 25, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
valueFormatter: o.valueFormatter, |
|
|
|
valueFormatter: o.valueFormatter, |
|
|
|
itemsCreator: BI.bind(this._itemsCreator4Trigger, this), |
|
|
|
itemsCreator: BI.bind(this._itemsCreator4Trigger, this), |
|
|
|
itemHeight: o.itemHeight, |
|
|
|
itemHeight: o.itemHeight, |
|
|
|
value: this.storeValue |
|
|
|
value: this.storeValue, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.trigger.on(BI.MultiSelectTrigger.EVENT_FOCUS, function () { |
|
|
|
this.trigger.on(BI.MultiSelectTrigger.EVENT_FOCUS, function () { |
|
|
@ -143,22 +143,22 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { |
|
|
|
assertShowValue(); |
|
|
|
assertShowValue(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
self.fireEvent(BI.MultiSelectCombo.EVENT_CLICK_ITEM); |
|
|
|
self.fireEvent(BI.MultiSelectCombo.EVENT_CLICK_ITEM); |
|
|
|
} |
|
|
|
}, |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM, |
|
|
|
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM, |
|
|
|
action: function () { |
|
|
|
action: function () { |
|
|
|
self._defaultState(); |
|
|
|
self._defaultState(); |
|
|
|
} |
|
|
|
}, |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR, |
|
|
|
eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR, |
|
|
|
action: function () { |
|
|
|
action: function () { |
|
|
|
self._dataChange = true; |
|
|
|
self._dataChange = true; |
|
|
|
self.setValue(); |
|
|
|
self.setValue(); |
|
|
|
self._defaultState(); |
|
|
|
self._defaultState(); |
|
|
|
} |
|
|
|
}, |
|
|
|
}], |
|
|
|
}], |
|
|
|
itemsCreator: o.itemsCreator, |
|
|
|
itemsCreator: o.itemsCreator, |
|
|
|
itemsHeight: o.itemsHeight, |
|
|
|
itemHeight: o.itemHeight, |
|
|
|
valueFormatter: o.valueFormatter, |
|
|
|
valueFormatter: o.valueFormatter, |
|
|
|
onLoaded: function () { |
|
|
|
onLoaded: function () { |
|
|
|
BI.nextTick(function () { |
|
|
|
BI.nextTick(function () { |
|
|
@ -167,12 +167,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { |
|
|
|
self.numberCounter.adjustView(); |
|
|
|
self.numberCounter.adjustView(); |
|
|
|
self.trigger.getSearcher().adjustView(); |
|
|
|
self.trigger.getSearcher().adjustView(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
value: o.value, |
|
|
|
value: o.value, |
|
|
|
hideChecker: function (e) { |
|
|
|
hideChecker: function (e) { |
|
|
|
return triggerBtn.element.find(e.target).length === 0 && self.numberCounter.element.find(e.target).length === 0; |
|
|
|
return triggerBtn.element.find(e.target).length === 0 && self.numberCounter.element.find(e.target).length === 0; |
|
|
|
} |
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { |
|
|
|
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { |
|
|
@ -200,7 +200,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { |
|
|
|
type: "bi.trigger_icon_button", |
|
|
|
type: "bi.trigger_icon_button", |
|
|
|
width: o.height, |
|
|
|
width: o.height, |
|
|
|
height: o.height, |
|
|
|
height: o.height, |
|
|
|
cls: "multi-select-trigger-icon-button" |
|
|
|
cls: "multi-select-trigger-icon-button", |
|
|
|
}); |
|
|
|
}); |
|
|
|
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () { |
|
|
|
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () { |
|
|
|
self.numberCounter.hideView(); |
|
|
|
self.numberCounter.hideView(); |
|
|
@ -218,12 +218,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { |
|
|
|
left: 0, |
|
|
|
left: 0, |
|
|
|
top: 0, |
|
|
|
top: 0, |
|
|
|
right: 0, |
|
|
|
right: 0, |
|
|
|
bottom: 25 |
|
|
|
bottom: 25, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
valueFormatter: o.valueFormatter, |
|
|
|
valueFormatter: o.valueFormatter, |
|
|
|
itemsCreator: BI.bind(this._itemsCreator4Trigger, this), |
|
|
|
itemsCreator: BI.bind(this._itemsCreator4Trigger, this), |
|
|
|
value: this.storeValue |
|
|
|
value: this.storeValue, |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () { |
|
|
|
this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () { |
|
|
|
if (!self.combo.isViewVisible()) { |
|
|
|
if (!self.combo.isViewVisible()) { |
|
|
@ -260,26 +260,26 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { |
|
|
|
left: 0, |
|
|
|
left: 0, |
|
|
|
right: 0, |
|
|
|
right: 0, |
|
|
|
top: 0, |
|
|
|
top: 0, |
|
|
|
bottom: 0 |
|
|
|
bottom: 0, |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
el: triggerBtn, |
|
|
|
el: triggerBtn, |
|
|
|
right: 0, |
|
|
|
right: 0, |
|
|
|
top: 0, |
|
|
|
top: 0, |
|
|
|
bottom: 0 |
|
|
|
bottom: 0, |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
el: { |
|
|
|
el: { |
|
|
|
type: "bi.vertical_adapt", |
|
|
|
type: "bi.vertical_adapt", |
|
|
|
items: [this.numberCounter] |
|
|
|
items: [this.numberCounter], |
|
|
|
}, |
|
|
|
}, |
|
|
|
right: o.height, |
|
|
|
right: o.height, |
|
|
|
top: 0, |
|
|
|
top: 0, |
|
|
|
height: o.height |
|
|
|
height: o.height, |
|
|
|
}] |
|
|
|
}], |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_itemsCreator4Trigger: function (op, callback) { |
|
|
|
_itemsCreator4Trigger: function (op, callback) { |
|
|
|
var self = this, o = this.options; |
|
|
|
var self = this; var o = this.options; |
|
|
|
o.itemsCreator(op, function (res) { |
|
|
|
o.itemsCreator(op, function (res) { |
|
|
|
if (op.times === 1 && BI.isNotNull(op.keywords)) { |
|
|
|
if (op.times === 1 && BI.isNotNull(op.keywords)) { |
|
|
|
// 预防trigger内部把当前的storeValue改掉
|
|
|
|
// 预防trigger内部把当前的storeValue改掉
|
|
|
@ -310,12 +310,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_joinKeywords: function (keywords, callback) { |
|
|
|
_joinKeywords: function (keywords, callback) { |
|
|
|
var self = this, o = this.options; |
|
|
|
var self = this; var o = this.options; |
|
|
|
this._assertValue(this.storeValue); |
|
|
|
this._assertValue(this.storeValue); |
|
|
|
this.requesting = true; |
|
|
|
this.requesting = true; |
|
|
|
o.itemsCreator({ |
|
|
|
o.itemsCreator({ |
|
|
|
type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, |
|
|
|
type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, |
|
|
|
keywords: keywords |
|
|
|
keywords: keywords, |
|
|
|
}, function (ob) { |
|
|
|
}, function (ob) { |
|
|
|
var values = BI.map(ob.items, "value"); |
|
|
|
var values = BI.map(ob.items, "value"); |
|
|
|
digest(values); |
|
|
|
digest(values); |
|
|
@ -333,12 +333,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_joinAll: function (res, callback) { |
|
|
|
_joinAll: function (res, callback) { |
|
|
|
var self = this, o = this.options; |
|
|
|
var self = this; var o = this.options; |
|
|
|
this._assertValue(res); |
|
|
|
this._assertValue(res); |
|
|
|
this.requesting = true; |
|
|
|
this.requesting = true; |
|
|
|
o.itemsCreator({ |
|
|
|
o.itemsCreator({ |
|
|
|
type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, |
|
|
|
type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, |
|
|
|
keywords: [this.trigger.getKey()] |
|
|
|
keywords: [this.trigger.getKey()], |
|
|
|
}, function (ob) { |
|
|
|
}, function (ob) { |
|
|
|
var items = BI.map(ob.items, "value"); |
|
|
|
var items = BI.map(ob.items, "value"); |
|
|
|
if (self.storeValue.type === res.type) { |
|
|
|
if (self.storeValue.type === res.type) { |
|
|
@ -353,7 +353,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { |
|
|
|
}); |
|
|
|
}); |
|
|
|
change && (self.storeValue.value = BI.values(map)); |
|
|
|
change && (self.storeValue.value = BI.values(map)); |
|
|
|
self._adjust(callback); |
|
|
|
self._adjust(callback); |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
var selectedMap = self._makeMap(self.storeValue.value); |
|
|
|
var selectedMap = self._makeMap(self.storeValue.value); |
|
|
|
var notSelectedMap = self._makeMap(res.value); |
|
|
|
var notSelectedMap = self._makeMap(res.value); |
|
|
@ -374,7 +375,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_adjust: function (callback) { |
|
|
|
_adjust: function (callback) { |
|
|
|
var self = this, o = this.options; |
|
|
|
var self = this; var o = this.options; |
|
|
|
adjust(); |
|
|
|
adjust(); |
|
|
|
callback(); |
|
|
|
callback(); |
|
|
|
|
|
|
|
|
|
|
@ -388,7 +389,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_join: function (res, callback) { |
|
|
|
_join: function (res, callback) { |
|
|
|
var self = this, o = this.options; |
|
|
|
var self = this; var o = this.options; |
|
|
|
this._assertValue(res); |
|
|
|
this._assertValue(res); |
|
|
|
this._assertValue(this.storeValue); |
|
|
|
this._assertValue(this.storeValue); |
|
|
|
if (this.storeValue.type === res.type) { |
|
|
|
if (this.storeValue.type === res.type) { |
|
|
@ -410,7 +411,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { |
|
|
|
}); |
|
|
|
}); |
|
|
|
change && (this.storeValue.value = BI.values(map)); |
|
|
|
change && (this.storeValue.value = BI.values(map)); |
|
|
|
self._adjust(callback); |
|
|
|
self._adjust(callback); |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
this._joinAll(res, callback); |
|
|
|
this._joinAll(res, callback); |
|
|
|
}, |
|
|
|
}, |
|
|
@ -446,12 +448,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { |
|
|
|
populate: function () { |
|
|
|
populate: function () { |
|
|
|
this._populate.apply(this, arguments); |
|
|
|
this._populate.apply(this, arguments); |
|
|
|
this.numberCounter.populateSwitcher.apply(this.numberCounter, arguments); |
|
|
|
this.numberCounter.populateSwitcher.apply(this.numberCounter, arguments); |
|
|
|
} |
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
BI.extend(BI.MultiSelectCombo, { |
|
|
|
BI.extend(BI.MultiSelectCombo, { |
|
|
|
REQ_GET_DATA_LENGTH: 1, |
|
|
|
REQ_GET_DATA_LENGTH: 1, |
|
|
|
REQ_GET_ALL_DATA: -1 |
|
|
|
REQ_GET_ALL_DATA: -1, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
BI.MultiSelectCombo.EVENT_BLUR = "EVENT_BLUR"; |
|
|
|
BI.MultiSelectCombo.EVENT_BLUR = "EVENT_BLUR"; |
|
|
|