Browse Source

KERNEL-11422 feat: 给下拉框都添加valueFormatter属性

es6
zsmj 2 years ago
parent
commit
abe1b1989b
  1. 4
      src/widget/multilayerselecttree/multilayerselecttree.combo.js
  2. 16
      src/widget/multilayerselecttree/multilayerselecttree.trigger.js

4
src/widget/multilayerselecttree/multilayerselecttree.combo.js

@ -36,6 +36,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
var baseConfig = this._getBaseConfig();
if (o.allowEdit) {
return {
type: "bi.absolute",
@ -65,6 +66,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, {
value: o.value,
tipType: o.tipType,
warningTitle: o.warningTitle,
valueFormatter: o.valueFormatter,
}
}, { cls });
},
@ -287,4 +289,4 @@ BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiLayerSelectTreeCombo.EVENT_STOP = "EVENT_STOP";
BI.MultiLayerSelectTreeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.MultiLayerSelectTreeCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);
BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);

16
src/widget/multilayerselecttree/multilayerselecttree.trigger.js

@ -19,7 +19,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
if (o.itemsCreator === BI.emptyFn) {
this._initData();
}
return {
type: "bi.horizontal_fill",
items: [
@ -103,7 +103,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
},
width: "fill",
rgap: 24
},
},
]
};
},
@ -181,15 +181,11 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
return o.valueFormatter(v);
}
if (o.itemsCreator === BI.emptyFn) {
var result = BI.find(o.items, function (i, item) {
return item.value === v;
});
return BI.isNotNull(result) ? result.text : o.text;
}
var result = BI.find(o.items, function (i, item) {
return item.value === v;
});
return v;
return BI.isNotNull(result) ? result.text : (o.text ?? v);
},
_getShowText: function () {

Loading…
Cancel
Save