From dd1f7839f9c93c6fab9bf17a2119bdfdcb2d4faa Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 1 Apr 2022 20:06:06 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E6=9B=B4=E6=96=B0=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/singleselect/singleselect.combo.js | 2 ++ src/widget/singleselect/singleselect.insert.combo.js | 2 ++ src/widget/singleselect/singleselect.loader.js | 10 ++++++++-- src/widget/singleselect/singleselect.popup.view.js | 2 ++ src/widget/singleselect/singleselectlist.insert.js | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/widget/singleselect/singleselect.combo.js b/src/widget/singleselect/singleselect.combo.js index fb873438f..fae620c93 100644 --- a/src/widget/singleselect/singleselect.combo.js +++ b/src/widget/singleselect/singleselect.combo.js @@ -10,6 +10,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, { baseCls: "bi-single-select-combo", allowNoSelect: false, itemsCreator: BI.emptyFn, + itemWrapper: BI.emptyFn, valueFormatter: BI.emptyFn, height: 24, allowEdit: true @@ -107,6 +108,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, { } }], itemsCreator: o.itemsCreator, + itemWrapper: o.itemWrapper, valueFormatter: o.valueFormatter, onLoaded: function () { BI.nextTick(function () { diff --git a/src/widget/singleselect/singleselect.insert.combo.js b/src/widget/singleselect/singleselect.insert.combo.js index b8b21cd09..46754e1dc 100644 --- a/src/widget/singleselect/singleselect.insert.combo.js +++ b/src/widget/singleselect/singleselect.insert.combo.js @@ -10,6 +10,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, { baseCls: "bi-single-select-combo", allowNoSelect: false, itemsCreator: BI.emptyFn, + itemWrapper: BI.emptyFn, valueFormatter: BI.emptyFn, height: 24, allowEdit: true, @@ -118,6 +119,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, { } }], itemsCreator: o.itemsCreator, + itemWrapper: o.itemWrapper, valueFormatter: o.valueFormatter, onLoaded: function () { BI.nextTick(function () { diff --git a/src/widget/singleselect/singleselect.loader.js b/src/widget/singleselect/singleselect.loader.js index 1f27b6425..645bdad66 100644 --- a/src/widget/singleselect/singleselect.loader.js +++ b/src/widget/singleselect/singleselect.loader.js @@ -22,6 +22,7 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, { allowNoSelect: false, valueFormatter: BI.emptyFn, itemsCreator: BI.emptyFn, + itemWrapper: BI.emptyFn, onLoaded: BI.emptyFn }); }, @@ -69,7 +70,12 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, { if (op.times === 1 && !BI.isUndefined(self.storeValue)) { var json = BI.map([self.storeValue], function (i, v) { var txt = opts.valueFormatter(v) || v; - return { + return opts.itemWrapper({ + text: txt, + value: v, + title: txt, + selected: true + }) || { text: txt, value: v, title: txt, @@ -117,7 +123,7 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, { height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, selected: false, iconWrapperWidth: 26, - hgap: o.allowNoSelect ? 10 : 0, + textHgap: o.allowNoSelect ? 10 : 0, title: item.title || item.text }, item); }); diff --git a/src/widget/singleselect/singleselect.popup.view.js b/src/widget/singleselect/singleselect.popup.view.js index 4e33c004f..ffa8766bd 100644 --- a/src/widget/singleselect/singleselect.popup.view.js +++ b/src/widget/singleselect/singleselect.popup.view.js @@ -14,6 +14,7 @@ BI.SingleSelectPopupView = BI.inherit(BI.Widget, { maxHeight: 400, valueFormatter: BI.emptyFn, itemsCreator: BI.emptyFn, + itemWrapper: BI.emptyFn, onLoaded: BI.emptyFn }); }, @@ -26,6 +27,7 @@ BI.SingleSelectPopupView = BI.inherit(BI.Widget, { type: "bi.single_select_loader", allowNoSelect: opts.allowNoSelect, itemsCreator: opts.itemsCreator, + itemWrapper: opts.itemWrapper, valueFormatter: opts.valueFormatter, onLoaded: opts.onLoaded, value: opts.value diff --git a/src/widget/singleselect/singleselectlist.insert.js b/src/widget/singleselect/singleselectlist.insert.js index db1722abc..f9bce32e6 100644 --- a/src/widget/singleselect/singleselectlist.insert.js +++ b/src/widget/singleselect/singleselectlist.insert.js @@ -9,6 +9,7 @@ BI.SingleSelectInsertList = BI.inherit(BI.Single, { baseCls: "bi-multi-select-insert-list", allowNoSelect: false, itemsCreator: BI.emptyFn, + itemWrapper: BI.emptyFn, valueFormatter: BI.emptyFn, searcherHeight: 24, }); @@ -30,6 +31,7 @@ BI.SingleSelectInsertList = BI.inherit(BI.Single, { cls: "popup-single-select-list bi-border-left bi-border-right bi-border-bottom", itemsCreator: o.itemsCreator, valueFormatter: o.valueFormatter, + itemWrapper: o.itemWrapper, logic: { dynamic: true },