Browse Source

无JIRA feat: text_value_combo多选功能完善

es6
zsmj 2 years ago
parent
commit
2f91a2c93f
  1. 26
      demo/js/case/combo/demo.text_value_combo.js
  2. 3
      src/case/combo/textvaluecombo/combo.textvalue.js
  3. 26
      src/case/trigger/trigger.text.select.js

26
demo/js/case/combo/demo.text_value_combo.js

@ -146,7 +146,7 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
type: "bi.button",
text: "setValue(1)",
handler: function () {
combo1.setValue();
combo1.setValue(1);
},
},
vgap: 10,
@ -184,6 +184,30 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
vgap: 10,
}
]
}),
this.createCombo("支持复选", {
type: "bi.vertical",
items: [
{
type: "bi.text_value_combo",
ref: function () {
combo2 = this;
},
width: 300,
items: items,
allowClear: true,
defaultText: "请选择",
chooseType: BI.Selection.Multi,
listeners: [
{
eventName: BI.TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
}
}
]
}
]
})
]
};

3
src/case/combo/textvaluecombo/combo.textvalue.js

@ -100,7 +100,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
eventName: BI.TextValueComboPopup.EVENT_CLEAR,
action: (...args) => {
changeTag = true;
this.setValue([]);
this._clear();
this.combo.hideView();
}
}, {
@ -151,6 +151,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
},
_clear: function () {
this.trigger.setText("");
this.combo.setValue();
this.setStatus("success");
},

26
src/case/trigger/trigger.text.select.js

@ -20,15 +20,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
_init: function () {
BI.SelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var obj = this._digest(o.value, o.items);
var text = this._digest(o.value, o.items);
this.trigger = BI.createWidget({
type: "bi.text_trigger",
element: this,
height: o.height,
readonly: o.readonly,
text: obj.text,
text: text,
defaultText: o.defaultText,
textCls: obj.textCls,
textHgap: o.textHgap,
textVgap: o.textVgap,
textLgap: o.textLgap,
@ -73,21 +72,9 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
});
if (result.length > 0 && val.length === 0) {
return {
textCls: "",
text: result.join(","),
};
return result.join(",");
} else {
var text = BI.isFunction(o.text) ? o.text() : o.text;
if (BI.isEmptyString(text)) {
return {
textCls: "bi-tips",
text: ""
};
}
return {
text,
};
return BI.isFunction(o.text) ? o.text() : o.text;
}
},
@ -97,9 +84,8 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
},
setValue: function (val) {
var formatValue = this._digest(val, this.options.items);
this.trigger.setTextCls(formatValue.textCls);
this.trigger.setText(formatValue.text);
var formatText = this._digest(val, this.options.items);
this.trigger.setText(formatText);
},
setTipType: function (v) {

Loading…
Cancel
Save