Browse Source

Pull request #1617: REPORT-44591 重新设计单选下拉树的valueFormatter,存在o.valueFormatter时优先使用

Merge in VISUAL/fineui from ~TELLER/fineui:bugfix to master

* commit '2aef70b44820f997ba5fa5d20e70f17ac1bc917c':
  REPORT-44591 fix: 重新设计单选下拉树的valueFormatter,存在o.valueFormatter时优先使用
es6
Teller 4 years ago
parent
commit
a55b760d05
  1. 11
      src/widget/multilayerselecttree/multilayerselecttree.trigger.js
  2. 12
      src/widget/multilayersingletree/multilayersingletree.trigger.js

11
src/widget/multilayerselecttree/multilayerselecttree.trigger.js

@ -7,9 +7,6 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
return { return {
extraCls: "bi-multi-layer-select-tree-trigger bi-border bi-focus-shadow bi-border-radius", extraCls: "bi-multi-layer-select-tree-trigger bi-border bi-focus-shadow bi-border-radius",
height: 24, height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
watermark: BI.i18nText("BI-Basic_Search"), watermark: BI.i18nText("BI-Basic_Search"),
allowSearchValue: false, allowSearchValue: false,
@ -202,13 +199,19 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, {
_digest: function (v) { _digest: function (v) {
var o = this.options; var o = this.options;
if (BI.isFunction(o.valueFormatter)) {
return o.valueFormatter(v);
}
if (o.itemsCreator === BI.emptyFn) { if (o.itemsCreator === BI.emptyFn) {
var result = BI.find(o.items, function (i, item) { var result = BI.find(o.items, function (i, item) {
return item.value === v; return item.value === v;
}); });
return BI.isNotNull(result) ? result.text : o.text; return BI.isNotNull(result) ? result.text : o.text;
} }
return o.valueFormatter(v);
return v;
}, },
_getShowText: function () { _getShowText: function () {

12
src/widget/multilayersingletree/multilayersingletree.trigger.js

@ -7,9 +7,6 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
return { return {
extraCls: "bi-multi-layer-single-tree-trigger bi-border bi-focus-shadow bi-border-radius", extraCls: "bi-multi-layer-single-tree-trigger bi-border bi-focus-shadow bi-border-radius",
height: 24, height: 24,
valueFormatter: function (v) {
return v;
},
itemsCreator: BI.emptyFn, itemsCreator: BI.emptyFn,
watermark: BI.i18nText("BI-Basic_Search"), watermark: BI.i18nText("BI-Basic_Search"),
allowSearchValue: false, allowSearchValue: false,
@ -202,13 +199,20 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, {
_digest: function (v) { _digest: function (v) {
var o = this.options; var o = this.options;
if (BI.isFunction(o.valueFormatter)) {
return o.valueFormatter(v);
}
if (o.itemsCreator === BI.emptyFn) { if (o.itemsCreator === BI.emptyFn) {
var result = BI.find(o.items, function (i, item) { var result = BI.find(o.items, function (i, item) {
return item.value === v; return item.value === v;
}); });
return BI.isNotNull(result) ? result.text : o.text; return BI.isNotNull(result) ? result.text : o.text;
} }
return o.valueFormatter(v);
return v;
}, },

Loading…
Cancel
Save