|
|
|
@ -22,113 +22,87 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
|
|
|
|
|
o.items = BI.isFunction(o.items) ? this.__watch(o.items, function (context, newValue) { |
|
|
|
|
self.populate(newValue); |
|
|
|
|
}) : o.items; |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
type: "bi.absolute", |
|
|
|
|
items: [{ |
|
|
|
|
type: "bi.combo", |
|
|
|
|
cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-focus-shadow", |
|
|
|
|
container: o.container, |
|
|
|
|
adjustLength: 2, |
|
|
|
|
toggle: false, |
|
|
|
|
ref: function () { |
|
|
|
|
self.combo = this; |
|
|
|
|
}, |
|
|
|
|
el: { |
|
|
|
|
type: "bi.search_text_value_trigger", |
|
|
|
|
cls: "search-text-value-trigger", |
|
|
|
|
watermark: o.watermark, |
|
|
|
|
ref: function () { |
|
|
|
|
self.trigger = this; |
|
|
|
|
}, |
|
|
|
|
items: o.items, |
|
|
|
|
height: o.height - (o.simple ? 1 : 2), |
|
|
|
|
text: o.text, |
|
|
|
|
defaultText: o.defaultText, |
|
|
|
|
value: o.value, |
|
|
|
|
tipType: o.tipType, |
|
|
|
|
warningTitle: o.warningTitle, |
|
|
|
|
title: o.title, |
|
|
|
|
allowClear: o.allowClear, |
|
|
|
|
listeners: [{ |
|
|
|
|
eventName: BI.SearchTextValueTrigger.EVENT_CHANGE, |
|
|
|
|
action: function () { |
|
|
|
|
self.setValue(this.getValue()); |
|
|
|
|
self.combo.hideView(); |
|
|
|
|
self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: BI.SearchTextValueTrigger.EVENT_CLEAR, |
|
|
|
|
action: function () { |
|
|
|
|
self.setValue(); |
|
|
|
|
self.combo.hideView(); |
|
|
|
|
self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: BI.SearchTextValueTrigger.EVENT_CLEAR, |
|
|
|
|
action: function () { |
|
|
|
|
self._clear(); |
|
|
|
|
} |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
popup: { |
|
|
|
|
el: { |
|
|
|
|
type: "bi.combo", |
|
|
|
|
cls: (o.simple ? "bi-border-bottom" : "bi-border") + " bi-focus-shadow", |
|
|
|
|
container: o.container, |
|
|
|
|
adjustLength: 2, |
|
|
|
|
toggle: false, |
|
|
|
|
type: "bi.text_value_combo_popup", |
|
|
|
|
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, |
|
|
|
|
value: o.value, |
|
|
|
|
items: o.items, |
|
|
|
|
ref: function () { |
|
|
|
|
self.combo = this; |
|
|
|
|
}, |
|
|
|
|
el: { |
|
|
|
|
type: "bi.search_text_value_trigger", |
|
|
|
|
cls: "search-text-value-trigger", |
|
|
|
|
watermark: o.watermark, |
|
|
|
|
ref: function () { |
|
|
|
|
self.trigger = this; |
|
|
|
|
}, |
|
|
|
|
items: o.items, |
|
|
|
|
height: o.height - (o.simple ? 1 : 2), |
|
|
|
|
text: o.text, |
|
|
|
|
defaultText: o.defaultText, |
|
|
|
|
value: o.value, |
|
|
|
|
tipType: o.tipType, |
|
|
|
|
warningTitle: o.warningTitle, |
|
|
|
|
title: o.title, |
|
|
|
|
allowClear: o.allowClear, |
|
|
|
|
listeners: [{ |
|
|
|
|
eventName: BI.SearchTextValueTrigger.EVENT_CHANGE, |
|
|
|
|
action: function () { |
|
|
|
|
self.setValue(this.getValue()); |
|
|
|
|
self.combo.hideView(); |
|
|
|
|
self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: BI.SearchTextValueTrigger.EVENT_CLEAR, |
|
|
|
|
action: function () { |
|
|
|
|
self.setValue(); |
|
|
|
|
self.combo.hideView(); |
|
|
|
|
self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE); |
|
|
|
|
} |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
popup: { |
|
|
|
|
el: { |
|
|
|
|
type: "bi.text_value_combo_popup", |
|
|
|
|
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, |
|
|
|
|
value: o.value, |
|
|
|
|
items: o.items, |
|
|
|
|
ref: function () { |
|
|
|
|
self.popup = this; |
|
|
|
|
self.trigger.getSearcher().setAdapter(self.popup); |
|
|
|
|
}, |
|
|
|
|
listeners: [{ |
|
|
|
|
eventName: BI.TextValueComboPopup.EVENT_CHANGE, |
|
|
|
|
action: function () { |
|
|
|
|
self.setValue(this.getValue()); |
|
|
|
|
self.combo.hideView(); |
|
|
|
|
self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE); |
|
|
|
|
} |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
value: o.value, |
|
|
|
|
maxHeight: 252, |
|
|
|
|
minHeight: 25 |
|
|
|
|
self.popup = this; |
|
|
|
|
self.trigger.getSearcher().setAdapter(self.popup); |
|
|
|
|
}, |
|
|
|
|
listeners: [{ |
|
|
|
|
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW, |
|
|
|
|
eventName: BI.TextValueComboPopup.EVENT_CHANGE, |
|
|
|
|
action: function () { |
|
|
|
|
self.trigger.stopEditing(); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent(BI.SearchTextValueCombo.EVENT_BEFORE_POPUPVIEW); |
|
|
|
|
} |
|
|
|
|
}], |
|
|
|
|
hideChecker: function (e) { |
|
|
|
|
return self.triggerBtn.element.find(e.target).length === 0; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
left: 0, |
|
|
|
|
right: 0, |
|
|
|
|
bottom: 0, |
|
|
|
|
top: 0 |
|
|
|
|
}, { |
|
|
|
|
el: { |
|
|
|
|
type: "bi.trigger_icon_button", |
|
|
|
|
cls: "trigger-icon-button", |
|
|
|
|
ref: function () { |
|
|
|
|
self.triggerBtn = this; |
|
|
|
|
}, |
|
|
|
|
width: o.height, |
|
|
|
|
height: o.height, |
|
|
|
|
handler: function () { |
|
|
|
|
if (self.combo.isViewVisible()) { |
|
|
|
|
self.setValue(this.getValue()); |
|
|
|
|
self.combo.hideView(); |
|
|
|
|
} else { |
|
|
|
|
self.combo.showView(); |
|
|
|
|
self.fireEvent(BI.SearchTextValueCombo.EVENT_CHANGE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
right: 0, |
|
|
|
|
bottom: 0, |
|
|
|
|
top: 0 |
|
|
|
|
}] |
|
|
|
|
value: o.value, |
|
|
|
|
maxHeight: 252, |
|
|
|
|
minHeight: 25 |
|
|
|
|
}, |
|
|
|
|
listeners: [{ |
|
|
|
|
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW, |
|
|
|
|
action: function () { |
|
|
|
|
self.trigger.stopEditing(); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent(BI.SearchTextValueCombo.EVENT_BEFORE_POPUPVIEW); |
|
|
|
|
} |
|
|
|
|
}], |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -139,6 +113,11 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_clear: function () { |
|
|
|
|
this.trigger.attr("text", ""); |
|
|
|
|
this.setValue([]); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_checkError: function (v) { |
|
|
|
|
if (BI.isNull(v) || BI.isEmptyArray(v) || BI.isEmptyString(v)) { |
|
|
|
|
this.trigger.options.tipType = "success"; |
|
|
|
|