From 0fbeaaa27ef70d52338ce7e9f7eac01995681626 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Tue, 24 Jul 2018 10:08:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8Bmulritextvaluecombo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../case/combo/demo.search_text_value_combo.js | 13 ++++++++++++- dist/bundle.js | 16 ++++++++++++++-- dist/demo.js | 13 ++++++++++++- dist/fineui.js | 16 ++++++++++++++-- dist/widget.js | 16 ++++++++++++++-- .../multitextvalue.combo.search.js | 16 ++++++++++++++-- 6 files changed, 80 insertions(+), 10 deletions(-) diff --git a/demo/js/case/combo/demo.search_text_value_combo.js b/demo/js/case/combo/demo.search_text_value_combo.js index 3e192c484..f1a6826eb 100644 --- a/demo/js/case/combo/demo.search_text_value_combo.js +++ b/demo/js/case/combo/demo.search_text_value_combo.js @@ -6,7 +6,7 @@ Demo.SearchTextValueCombo = BI.inherit(BI.Widget, { baseCls: "" }, render: function () { - var combo; + var combo, searchCombo; return { type: "bi.horizontal_auto", items: [{ @@ -67,6 +67,9 @@ Demo.SearchTextValueCombo = BI.inherit(BI.Widget, { value: { type: 1, value: ["1", "2", "柳州市城贸金属材料有限责任公司", "3"] + }, + ref: function () { + searchCombo = this; } }, { type: "bi.button", @@ -76,6 +79,14 @@ Demo.SearchTextValueCombo = BI.inherit(BI.Widget, { handler: function () { combo.setValue(11); } + }, { + type: "bi.button", + text: "getValue()", + width: 90, + height: 25, + handler: function () { + BI.Msg.toast(JSON.stringify(searchCombo.getValue())); + } }], vgap: 20 }; diff --git a/dist/bundle.js b/dist/bundle.js index dbcb51c28..c33f1ed85 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -104552,7 +104552,11 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, { }, setValue: function (v) { - this.storeValue = BI.deepClone(v || {}); + var obj = { + type: BI.Selection.Multi, + value: v || [] + }; + this.storeValue = BI.deepClone(obj); this._updateAllValue(); this._assertValue(this.storeValue); this.combo.setValue(this.storeValue); @@ -104560,7 +104564,15 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, { }, getValue: function () { - return BI.deepClone(this.storeValue); + var obj = BI.deepClone(this.storeValue), self = this; + if(obj.type === BI.Selection.All) { + var values = []; + BI.each(this.options.items, function (idx, item) { + !BI.contains(self.storeValue.value, item.value) && values.push(item.value); + }); + return values; + } + return obj.value; }, _populate: function () { diff --git a/dist/demo.js b/dist/demo.js index b6e6d2acf..b867907de 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -2077,7 +2077,7 @@ Demo.SearchTextValueCombo = BI.inherit(BI.Widget, { baseCls: "" }, render: function () { - var combo; + var combo, searchCombo; return { type: "bi.horizontal_auto", items: [{ @@ -2138,6 +2138,9 @@ Demo.SearchTextValueCombo = BI.inherit(BI.Widget, { value: { type: 1, value: ["1", "2", "柳州市城贸金属材料有限责任公司", "3"] + }, + ref: function () { + searchCombo = this; } }, { type: "bi.button", @@ -2147,6 +2150,14 @@ Demo.SearchTextValueCombo = BI.inherit(BI.Widget, { handler: function () { combo.setValue(11); } + }, { + type: "bi.button", + text: "getValue()", + width: 90, + height: 25, + handler: function () { + BI.Msg.toast(JSON.stringify(searchCombo.getValue())); + } }], vgap: 20 }; diff --git a/dist/fineui.js b/dist/fineui.js index 072e70b4f..a554b6f68 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -104801,7 +104801,11 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, { }, setValue: function (v) { - this.storeValue = BI.deepClone(v || {}); + var obj = { + type: BI.Selection.Multi, + value: v || [] + }; + this.storeValue = BI.deepClone(obj); this._updateAllValue(); this._assertValue(this.storeValue); this.combo.setValue(this.storeValue); @@ -104809,7 +104813,15 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, { }, getValue: function () { - return BI.deepClone(this.storeValue); + var obj = BI.deepClone(this.storeValue), self = this; + if(obj.type === BI.Selection.All) { + var values = []; + BI.each(this.options.items, function (idx, item) { + !BI.contains(self.storeValue.value, item.value) && values.push(item.value); + }); + return values; + } + return obj.value; }, _populate: function () { diff --git a/dist/widget.js b/dist/widget.js index d943647a0..923f65a94 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -16549,7 +16549,11 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, { }, setValue: function (v) { - this.storeValue = BI.deepClone(v || {}); + var obj = { + type: BI.Selection.Multi, + value: v || [] + }; + this.storeValue = BI.deepClone(obj); this._updateAllValue(); this._assertValue(this.storeValue); this.combo.setValue(this.storeValue); @@ -16557,7 +16561,15 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, { }, getValue: function () { - return BI.deepClone(this.storeValue); + var obj = BI.deepClone(this.storeValue), self = this; + if(obj.type === BI.Selection.All) { + var values = []; + BI.each(this.options.items, function (idx, item) { + !BI.contains(self.storeValue.value, item.value) && values.push(item.value); + }); + return values; + } + return obj.value; }, _populate: function () { diff --git a/src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js b/src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js index e170da417..f7806d621 100644 --- a/src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js +++ b/src/widget/searchmultitextvaluecombo/multitextvalue.combo.search.js @@ -442,7 +442,11 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, { }, setValue: function (v) { - this.storeValue = BI.deepClone(v || {}); + var obj = { + type: BI.Selection.Multi, + value: v || [] + }; + this.storeValue = BI.deepClone(obj); this._updateAllValue(); this._assertValue(this.storeValue); this.combo.setValue(this.storeValue); @@ -450,7 +454,15 @@ BI.SearchMultiTextValueCombo = BI.inherit(BI.Single, { }, getValue: function () { - return BI.deepClone(this.storeValue); + var obj = BI.deepClone(this.storeValue), self = this; + if(obj.type === BI.Selection.All) { + var values = []; + BI.each(this.options.items, function (idx, item) { + !BI.contains(self.storeValue.value, item.value) && values.push(item.value); + }); + return values; + } + return obj.value; }, _populate: function () {