|
|
@ -13,6 +13,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { |
|
|
|
height: 24, |
|
|
|
height: 24, |
|
|
|
allowClear: false, |
|
|
|
allowClear: false, |
|
|
|
valueFormatter: BI.emptyFn, |
|
|
|
valueFormatter: BI.emptyFn, |
|
|
|
|
|
|
|
defaultText: "", |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -26,6 +27,7 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { |
|
|
|
height: o.height, |
|
|
|
height: o.height, |
|
|
|
readonly: o.readonly, |
|
|
|
readonly: o.readonly, |
|
|
|
text: obj.text, |
|
|
|
text: obj.text, |
|
|
|
|
|
|
|
defaultText: o.defaultText, |
|
|
|
textCls: obj.textCls, |
|
|
|
textCls: obj.textCls, |
|
|
|
textHgap: o.textHgap, |
|
|
|
textHgap: o.textHgap, |
|
|
|
textVgap: o.textVgap, |
|
|
|
textVgap: o.textVgap, |
|
|
@ -48,13 +50,13 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_digest: function (vals, items) { |
|
|
|
_digest: function (val, items) { |
|
|
|
var o = this.options; |
|
|
|
var o = this.options; |
|
|
|
vals = BI.isArray(vals) ? vals : [vals]; |
|
|
|
val = BI.isArray(val) ? val[0] : val; |
|
|
|
var result = []; |
|
|
|
var result = []; |
|
|
|
var formatItems = BI.Tree.transformToArrayFormat(items); |
|
|
|
var formatItems = BI.Tree.transformToArrayFormat(items); |
|
|
|
BI.each(formatItems, function (i, item) { |
|
|
|
BI.each(formatItems, function (i, item) { |
|
|
|
if (BI.deepContains(vals, item.value) && !BI.contains(result, item.text || item.value)) { |
|
|
|
if (val === item.value && !BI.contains(result, item.text || item.value)) { |
|
|
|
result.push(item.text || item.value); |
|
|
|
result.push(item.text || item.value); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -62,12 +64,18 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { |
|
|
|
if (result.length > 0) { |
|
|
|
if (result.length > 0) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
textCls: "", |
|
|
|
textCls: "", |
|
|
|
text: o.valueFormatter(vals[0]) || result.join(","), // 只保留单个value的场景,后续会把BI.isArray(vals) ? vals : [vals];这种都去掉
|
|
|
|
text: o.valueFormatter(val) || result.join(","), |
|
|
|
}; |
|
|
|
}; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
var text = BI.isFunction(o.text) ? o.text() : o.text; |
|
|
|
|
|
|
|
if (BI.isEmptyString(text)) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
textCls: "bi-water-mark", |
|
|
|
textCls: "bi-tips", |
|
|
|
text: BI.isFunction(o.text) ? o.text() : o.text |
|
|
|
text: "" |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
text: o.text |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -77,8 +85,8 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { |
|
|
|
this.trigger.setText(text); |
|
|
|
this.trigger.setText(text); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setValue: function (vals) { |
|
|
|
setValue: function (val) { |
|
|
|
var formatValue = this._digest(vals, this.options.items); |
|
|
|
var formatValue = this._digest(val, this.options.items); |
|
|
|
this.trigger.setTextCls(formatValue.textCls); |
|
|
|
this.trigger.setTextCls(formatValue.textCls); |
|
|
|
this.trigger.setText(formatValue.text); |
|
|
|
this.trigger.setText(formatValue.text); |
|
|
|
}, |
|
|
|
}, |
|
|
|