From 63d9fcad97224087dd2712ec80197cb6f357168a Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 18 Dec 2021 18:56:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?chore:=20=E4=B9=B1=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/button/item.singleselect.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/case/button/item.singleselect.js b/src/case/button/item.singleselect.js index 910b579cd..8c5931f15 100644 --- a/src/case/button/item.singleselect.js +++ b/src/case/button/item.singleselect.js @@ -21,8 +21,6 @@ BI.SingleSelectItem = BI.inherit(BI.BasicButton, { text: o.text, keyword: o.keyword, value: o.value, - title: o.title || o.text, - warningTitle: o.warningTitle, py: o.py }); }, @@ -48,4 +46,4 @@ BI.SingleSelectItem = BI.inherit(BI.BasicButton, { }); BI.SingleSelectItem.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.single_select_item", BI.SingleSelectItem); \ No newline at end of file +BI.shortcut("bi.single_select_item", BI.SingleSelectItem); From a20bccfcf021158e3fc112a0dd2bb64f79dcfaf9 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 18 Dec 2021 22:11:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=E4=B9=B1=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../popup.searchtextvalue.js | 24 ++++++++++------- .../popup.textvaluecheck.js | 5 +++- .../combo/textvaluecombo/popup.textvalue.js | 26 +++++++++++-------- .../search/singleselect.search.loader.js | 25 +++++++++++------- .../singleselect/singleselect.loader.js | 23 +++++++++------- 5 files changed, 62 insertions(+), 41 deletions(-) diff --git a/src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js b/src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js index 0118cf84f..5244d5ff4 100644 --- a/src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js +++ b/src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js @@ -17,11 +17,7 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, { ref: function () { self.popup = this; }, - items: BI.createItems(o.items, { - type: "bi.single_select_item", - textAlign: o.textAlign, - height: 24 - }), + items: this._formatItems(o.items), chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, layouts: [{ type: "bi.vertical" @@ -45,6 +41,18 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, { }; }, + _formatItems: function (items) { + var o = this.options; + return BI.map(items, function (i, item) { + return BI.extend({ + type: "bi.single_select_item", + textAlign: o.textAlign, + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, + title: item.title || item.text + }, item); + }); + }, + // mounted之后做check mounted: function() { this.check(); @@ -53,11 +61,7 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, { populate: function (find, match, keyword) { var items = BI.concat(find, match); BI.SearchTextValueComboPopup.superclass.populate.apply(this, items); - items = BI.createItems(items, { - type: "bi.single_select_item", - height: 24 - }); - this.popup.populate(items, keyword); + this.popup.populate(this._formatItems(items), keyword); }, getValue: function () { diff --git a/src/case/combo/textvaluecheckcombo/popup.textvaluecheck.js b/src/case/combo/textvaluecheckcombo/popup.textvaluecheck.js index f5678d870..6e700145c 100644 --- a/src/case/combo/textvaluecheckcombo/popup.textvaluecheck.js +++ b/src/case/combo/textvaluecheckcombo/popup.textvaluecheck.js @@ -35,11 +35,14 @@ BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { }, _formatItems: function (items) { + var o = this.options; return BI.map(items, function (i, item) { return BI.extend({ type: "bi.single_select_item", cls: "bi-list-item", - height: 24 + textAlign: o.textAlign, + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, + title: item.title || item.text }, item); }); }, diff --git a/src/case/combo/textvaluecombo/popup.textvalue.js b/src/case/combo/textvaluecombo/popup.textvalue.js index 5b3c0a8ee..19840e4a9 100644 --- a/src/case/combo/textvaluecombo/popup.textvalue.js +++ b/src/case/combo/textvaluecombo/popup.textvalue.js @@ -11,11 +11,7 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, { var o = this.options, self = this; this.popup = BI.createWidget({ type: "bi.button_group", - items: BI.createItems(o.items, { - type: "bi.single_select_item", - textAlign: o.textAlign, - height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, - }), + items: this._formatItems(o.items), chooseType: o.chooseType, layouts: [{ type: "bi.vertical" @@ -39,13 +35,21 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, { }); }, + _formatItems: function (items) { + var o = this.options; + return BI.map(items, function (i, item) { + return BI.extend({ + type: "bi.single_select_item", + textAlign: o.textAlign, + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, + title: item.title || item.text + }, item); + }); + }, + populate: function (items) { BI.TextValueComboPopup.superclass.populate.apply(this, arguments); - items = BI.createItems(items, { - type: "bi.single_select_item", - height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, - }); - this.popup.populate(items); + this.popup.populate(this._formatItems(items)); }, getValue: function () { @@ -58,4 +62,4 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, { }); BI.TextValueComboPopup.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.text_value_combo_popup", BI.TextValueComboPopup); \ No newline at end of file +BI.shortcut("bi.text_value_combo_popup", BI.TextValueComboPopup); diff --git a/src/widget/singleselect/search/singleselect.search.loader.js b/src/widget/singleselect/search/singleselect.search.loader.js index 5d03f020c..a61ac843e 100644 --- a/src/widget/singleselect/search/singleselect.search.loader.js +++ b/src/widget/singleselect/search/singleselect.search.loader.js @@ -10,6 +10,9 @@ BI.SingleSelectSearchLoader = BI.inherit(BI.Widget, { return BI.extend(BI.SingleSelectSearchLoader.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-single-select-search-loader", allowNoSelect: false, + logic: { + dynamic: false + }, itemsCreator: BI.emptyFn, keywordGetter: BI.emptyFn, valueFormatter: BI.emptyFn @@ -86,16 +89,18 @@ BI.SingleSelectSearchLoader = BI.inherit(BI.Widget, { }, _createItems: function (items) { - return BI.createItems(items, { - type: this.options.allowNoSelect ? "bi.single_select_item" : "bi.single_select_radio_item", - cls: "bi-list-item-active", - logic: { - dynamic: false - }, - height: 25, - selected: false, - iconWrapperWidth: 26, - hgap: this.options.allowNoSelect ? 10 : 0 + var o = this.options; + return BI.map(items, function (i, item) { + return BI.extend({ + type: o.allowNoSelect ? "bi.single_select_item" : "bi.single_select_radio_item", + logic: o.logic, + cls: "bi-list-item-active", + height: 24, + selected: false, + iconWrapperWidth: 26, + hgap: o.allowNoSelect ? 10 : 0, + title: item.title || item.text + }, item); }); }, diff --git a/src/widget/singleselect/singleselect.loader.js b/src/widget/singleselect/singleselect.loader.js index 6318601ab..0cc2f6e60 100644 --- a/src/widget/singleselect/singleselect.loader.js +++ b/src/widget/singleselect/singleselect.loader.js @@ -108,14 +108,18 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, { }, _createItems: function (items) { - return BI.createItems(items, { - type: this.options.allowNoSelect ? "bi.single_select_item" : "bi.single_select_radio_item", - logic: this.options.logic, - cls: "bi-list-item-active", - height: 24, - selected: false, - iconWrapperWidth: 26, - hgap: this.options.allowNoSelect ? 10 : 0 + var o = this.options; + return BI.map(items, function (i, item) { + return BI.extend({ + type: o.allowNoSelect ? "bi.single_select_item" : "bi.single_select_radio_item", + logic: o.logic, + cls: "bi-list-item-active", + height: 24, + selected: false, + iconWrapperWidth: 26, + hgap: o.allowNoSelect ? 10 : 0, + title: item.title || item.text + }, item); }); }, @@ -126,7 +130,8 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, { }, 30); }, - _assertValue: function (val) {}, + _assertValue: function (val) { + }, setStartValue: function (v) { this._startValue = v;