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