Browse Source

Pull request #2921: KERNEL-12033 feat: 复选列表添加itemFormatter属性,支持自定义节点类型

Merge in VISUAL/fineui from ~DAILER/fineui:master to master

* commit '6f019d1ec08735fe3bb43a5a50583c0a3bc858f5':
  KERNEL-12033 feat: 复选列表添加itemFormatter属性,支持自定义节点类型
es6
Dailer 2 years ago
parent
commit
9067f73f9f
  1. 6
      src/widget/multiselect/multiselect.loader.js
  2. 1
      src/widget/multiselect/search/multiselect.search.insert.pane.js
  3. 6
      src/widget/multiselect/search/multiselect.search.loader.js
  4. 1
      src/widget/multiselect/search/multiselect.search.pane.js
  5. 2
      src/widget/multiselectlist/multiselectlist.insert.js

6
src/widget/multiselect/multiselect.loader.js

@ -62,7 +62,8 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
text: txt,
value: v,
title: txt,
selected: self.storeValue.type === BI.Selection.Multi
selected: self.storeValue.type === BI.Selection.Multi,
...opts.itemFormatter(v),
};
});
if (BI.isKey(self._startValue) && !BI.contains(self.storeValue.value, self._startValue)) {
@ -71,7 +72,8 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
text: txt,
value: startValue,
title: txt,
selected: true
selected: true,
...opts.itemFormatter(startValue),
});
}
firstItems = self._createItems(json);

1
src/widget/multiselect/search/multiselect.search.insert.pane.js

@ -39,6 +39,7 @@ BI.MultiSelectSearchInsertPane = BI.inherit(BI.Widget, {
type: "bi.multi_select_search_loader",
keywordGetter: o.keywordGetter,
valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
itemsCreator: function (op, callback) {
o.itemsCreator.apply(self, [op, function (res) {
callback(res);

6
src/widget/multiselect/search/multiselect.search.loader.js

@ -12,6 +12,7 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
itemsCreator: BI.emptyFn,
keywordGetter: BI.emptyFn,
valueFormatter: BI.emptyFn,
itemFormatter: BI.emptyFn,
itemHeight: 24
});
},
@ -113,7 +114,7 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
var newValues = BI.map(values, function (i, v) {
return {
text: o.valueFormatter(v) || v,
value: v
value: v,
};
});
if (BI.isKey(keyword)) {
@ -125,7 +126,8 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
text: v.text,
title: v.text,
value: v.value,
selected: src.type === BI.Selection.All
selected: src.type === BI.Selection.All,
...o.itemFormatter(v.value),
};
});
},

1
src/widget/multiselect/search/multiselect.search.pane.js

@ -31,6 +31,7 @@ BI.MultiSelectSearchPane = BI.inherit(BI.Widget, {
type: "bi.multi_select_search_loader",
keywordGetter: o.keywordGetter,
valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
itemsCreator: function (op, callback) {
o.itemsCreator.apply(self, [op, function (res) {
callback(res);

2
src/widget/multiselectlist/multiselectlist.insert.js

@ -28,6 +28,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
itemsCreator: o.itemsCreator,
itemHeight: o.itemHeight,
valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
logic: {
dynamic: false
},
@ -45,6 +46,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
type: "bi.multi_select_search_insert_pane",
cls: "bi-border-left bi-border-right bi-border-bottom",
valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
keywordGetter: function () {
return self.trigger.getKeyword();
},

Loading…
Cancel
Save