Browse Source

Merge pull request #145775 in DEC/fineui from master to feature/x

* commit '9a1ee961c5e62ecedcd80bd137f37b2ae07a0dd4':
  JSY-21914 fix: 处理报错
  KERNEL-12033 feat: 复选列表添加itemFormatter属性,支持自定义节点类型
research/test
superman 2 years ago
parent
commit
64629b5beb
  1. 1
      src/case/combo/textvaluecombo/combo.textvalue.js
  2. 2
      src/widget/multiselect/multiselect.combo.js
  3. 21
      src/widget/multiselect/multiselect.loader.js
  4. 18
      src/widget/multiselect/multiselect.loader.nobar.js
  5. 1
      src/widget/multiselect/multiselect.popup.view.js
  6. 1
      src/widget/multiselect/multiselect.popup.view.nobar.js
  7. 2
      src/widget/multiselect/search/multiselect.search.loader.js

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

@ -98,6 +98,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
el: trigger, el: trigger,
popup: { popup: {
el: popup, el: popup,
value: o.value,
maxHeight: 240, maxHeight: 240,
minHeight: 25 minHeight: 25
} }

2
src/widget/multiselect/multiselect.combo.js

@ -57,6 +57,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}, },
}, },
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
itemsCreator: BI.bind(this._itemsCreator4Trigger, this), itemsCreator: BI.bind(this._itemsCreator4Trigger, this),
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
value: this.storeValue, value: this.storeValue,
@ -162,6 +163,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
itemsCreator: o.itemsCreator, itemsCreator: o.itemsCreator,
itemHeight: o.itemHeight, itemHeight: o.itemHeight,
valueFormatter: o.valueFormatter, valueFormatter: o.valueFormatter,
itemFormatter: o.itemFormatter,
onLoaded: function () { onLoaded: function () {
BI.nextTick(function () { BI.nextTick(function () {
self.combo.adjustWidth(); self.combo.adjustWidth();

21
src/widget/multiselect/multiselect.loader.js

@ -64,7 +64,6 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
value: v, value: v,
title: txt, 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)) { if (BI.isKey(self._startValue) && !BI.contains(self.storeValue.value, self._startValue)) {
@ -74,7 +73,6 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
value: startValue, value: startValue,
title: txt, title: txt,
selected: true, selected: true,
...opts.itemFormatter(startValue),
}); });
} }
firstItems = self._createItems(json); firstItems = self._createItems(json);
@ -111,13 +109,18 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
_createItems: function (items) { _createItems: function (items) {
var allSelected = this.isAllSelected(); var allSelected = this.isAllSelected();
return BI.createItems(items, { var itemFormatter = this.options.itemFormatter;
type: "bi.multi_select_item", return BI.map(items, (i, item) => {
logic: this.options.logic, return {
cls: "bi-list-item-active", type: "bi.multi_select_item",
height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, logic: this.options.logic,
selected: allSelected, cls: "bi-list-item-active",
iconWrapperWidth: 36 height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
selected: allSelected,
iconWrapperWidth: 36,
...item,
...itemFormatter(item),
};
}); });
}, },

18
src/widget/multiselect/multiselect.loader.nobar.js

@ -113,12 +113,16 @@ BI.MultiSelectNoBarLoader = BI.inherit(BI.Widget, {
}, },
_createItems: function (items) { _createItems: function (items) {
return BI.createItems(items, { return BI.map(items, (index, item) => {
type: "bi.multi_select_item", return {
cls: "bi-list-item-active", type: "bi.multi_select_item",
logic: this.options.logic, cls: "bi-list-item-active",
height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, logic: this.options.logic,
iconWrapperWidth: 36 height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
iconWrapperWidth: 36,
...item,
...this.options.itemFormatter(item),
};
}); });
}, },
@ -168,7 +172,7 @@ BI.MultiSelectNoBarLoader = BI.inherit(BI.Widget, {
}, },
resetHeight: function (h) { resetHeight: function (h) {
this.button_group.element.css({"max-height": h / BI.pixRatio + BI.pixUnit}); this.button_group.element.css({ "max-height": h / BI.pixRatio + BI.pixUnit });
}, },
resetWidth: function () { resetWidth: function () {

1
src/widget/multiselect/multiselect.popup.view.js

@ -27,6 +27,7 @@ BI.MultiSelectPopupView = BI.inherit(BI.Widget, {
itemsCreator: opts.itemsCreator, itemsCreator: opts.itemsCreator,
itemHeight: opts.itemHeight, itemHeight: opts.itemHeight,
valueFormatter: opts.valueFormatter, valueFormatter: opts.valueFormatter,
itemFormatter: opts.itemFormatter,
onLoaded: opts.onLoaded, onLoaded: opts.onLoaded,
value: opts.value value: opts.value
}); });

1
src/widget/multiselect/multiselect.popup.view.nobar.js

@ -27,6 +27,7 @@ BI.MultiSelectNoBarPopupView = BI.inherit(BI.Widget, {
itemsCreator: opts.itemsCreator, itemsCreator: opts.itemsCreator,
itemHeight: opts.itemHeight, itemHeight: opts.itemHeight,
valueFormatter: opts.valueFormatter, valueFormatter: opts.valueFormatter,
itemFormatter: opts.itemFormatter,
onLoaded: opts.onLoaded, onLoaded: opts.onLoaded,
value: opts.value value: opts.value
}); });

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

@ -128,7 +128,7 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
title: v.text, title: v.text,
value: v.value, value: v.value,
selected: src.type === BI.Selection.All, selected: src.type === BI.Selection.All,
...o.itemFormatter(v.value), ...o.itemFormatter(v),
}; };
}); });
}, },

Loading…
Cancel
Save