|
|
|
@ -13,6 +13,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
|
|
|
|
|
text: "", |
|
|
|
|
value: "", |
|
|
|
|
defaultText: "", |
|
|
|
|
el: {}, |
|
|
|
|
allowClear: false, |
|
|
|
|
status: "success", // success | warning | error,
|
|
|
|
|
title: null, |
|
|
|
@ -71,7 +72,9 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
...o.el |
|
|
|
|
}; |
|
|
|
|
let changeTag = false; |
|
|
|
|
const popup = { |
|
|
|
|
type: "bi.text_value_combo_popup", |
|
|
|
|
ref: ref => this.popup = ref, |
|
|
|
@ -81,9 +84,12 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
|
|
|
|
|
{ |
|
|
|
|
eventName: BI.TextValueComboPopup.EVENT_CHANGE, |
|
|
|
|
action: (...args) => { |
|
|
|
|
changeTag = true; |
|
|
|
|
this.setValue(this.popup.getValue()); |
|
|
|
|
this.combo.hideView(); |
|
|
|
|
this.fireEvent(BI.TextValueCombo.EVENT_CHANGE, ...args); |
|
|
|
|
if (o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) { |
|
|
|
|
this.combo.hideView(); |
|
|
|
|
this.fireEvent(BI.TextValueCombo.EVENT_CHANGE, ...args); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: BI.Controller.EVENT_CHANGE, |
|
|
|
@ -101,6 +107,21 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
|
|
|
|
|
direction: o.direction, |
|
|
|
|
adjustLength: 2, |
|
|
|
|
el: trigger, |
|
|
|
|
listeners: [ |
|
|
|
|
{ |
|
|
|
|
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, |
|
|
|
|
action: (...args) => { |
|
|
|
|
changeTag = false; |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW, |
|
|
|
|
action: (...args) => { |
|
|
|
|
if (changeTag) { |
|
|
|
|
this.fireEvent(BI.TextValueCombo.EVENT_CHANGE, ...args); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
popup: { |
|
|
|
|
el: popup, |
|
|
|
|
value: o.value, |
|
|
|
@ -112,7 +133,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
|
|
|
|
|
|
|
|
|
|
mounted: function () { |
|
|
|
|
const o = this.options; |
|
|
|
|
if (BI.isKey(o.value)) { |
|
|
|
|
if (BI.isKey(o.value) || BI.isObject(o.value)) { |
|
|
|
|
this._checkError(o.value); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -131,11 +152,9 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
|
|
|
|
|
|
|
|
|
|
var vals = BI.isArray(v) ? v : [v]; |
|
|
|
|
|
|
|
|
|
var result = BI.find(this.options.items, function (idx, item) { |
|
|
|
|
return BI.contains(vals, item.value); |
|
|
|
|
}); |
|
|
|
|
var result = BI.intersection(BI.map(this.options.items, (i, item) => item.value), vals); |
|
|
|
|
|
|
|
|
|
if (BI.isNull(result)) { |
|
|
|
|
if (result.length !== vals.length) { |
|
|
|
|
this.setStatus("error"); |
|
|
|
|
} else { |
|
|
|
|
this.setStatus("success"); |
|
|
|
|