From 47e29bcf4715bd07a3c431d3bcffc0fce070e3fd Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 18 Jan 2018 10:23:06 +0800 Subject: [PATCH] =?UTF-8?q?downlistcombo=20=E6=94=AF=E6=8C=81=E4=BC=A0valu?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/js/widget/downlist/demo.downlist.js | 10 ++-- dist/bundle.js | 59 +++++++++++++---------- dist/demo.js | 10 ++-- dist/fineui.js | 59 +++++++++++++---------- dist/widget.js | 59 +++++++++++++---------- src/widget/downlist/combo.downlist.js | 3 +- src/widget/downlist/group.downlist.js | 3 +- src/widget/downlist/item.downlistgroup.js | 22 ++++----- src/widget/downlist/popup.downlist.js | 31 +++++++----- 9 files changed, 140 insertions(+), 116 deletions(-) diff --git a/demo/js/widget/downlist/demo.downlist.js b/demo/js/widget/downlist/demo.downlist.js index cc832342e..8bfaae8da 100644 --- a/demo/js/widget/downlist/demo.downlist.js +++ b/demo/js/widget/downlist/demo.downlist.js @@ -26,6 +26,7 @@ Demo.Downlist = BI.inherit(BI.Widget, { self.downlist = _ref; }, cls: "layout-bg3", + value: [{"childValue":22,"value":11},{"value":18},{"value":20}], height: 30, width: 100, items: [ @@ -38,8 +39,7 @@ Demo.Downlist = BI.inherit(BI.Widget, { children: [{ text: "column 1.1", value: 21, - cls: "dot-e-font", - selected: true + cls: "dot-e-font" }, { text: "column 1.222222222222222222222222222222222222", cls: "dot-e-font", @@ -70,8 +70,7 @@ Demo.Downlist = BI.inherit(BI.Widget, { [{ text: "column 8", value: 18, - cls: "dot-e-font", - selected: true + cls: "dot-e-font" }, { @@ -83,8 +82,7 @@ Demo.Downlist = BI.inherit(BI.Widget, { [{ text: "column 10", value: 20, - cls: "dot-e-font", - selected: true + cls: "dot-e-font" }, { diff --git a/dist/bundle.js b/dist/bundle.js index e5e0460ff..af62bcde3 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -79855,7 +79855,8 @@ BI.DownListCombo = BI.inherit(BI.Widget, { this.popupview = BI.createWidget({ type: "bi.down_list_popup", items: o.items, - chooseType: o.chooseType + chooseType: o.chooseType, + value: o.value }); this.popupview.on(BI.DownListPopup.EVENT_CHANGE, function (value) { @@ -79949,7 +79950,8 @@ BI.DownListGroup = BI.inherit(BI.Widget, { type: "bi.vertical", hgap: 0, vgap: 0 - }] + }], + value: o.value }); this.downlistgroup.on(BI.Controller.EVENT_CHANGE, function (type) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -80076,7 +80078,8 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe type: "bi.icon_button", cls: o.iconCls1, width: 25, - forceNotSelected: true + forceNotSelected: true, + selected: this._digest(o.value) }); this.icon2 = BI.createWidget({ @@ -80118,6 +80121,14 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe }); }, + _digest: function (v) { + var self = this, o = this.options; + v = BI.isArray(v) ? v : [v]; + return BI.any(v, function (idx, value) { + return BI.contains(o.childValues, value); + }); + }, + hover: function () { BI.DownListGroupItem.superclass.hover.apply(this, arguments); this.icon1.element.addClass("hover"); @@ -80147,16 +80158,7 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe }, setValue: function (v) { - var self = this, o = this.options; - v = BI.isArray(v) ? v : [v]; - BI.find(v, function (idx, value) { - if (BI.contains(o.childValues, value)) { - self.icon1.setSelected(true); - return true; - } - self.icon1.setSelected(false); - - }); + this.icon1.setSelected(this._digest(v)); } }); BI.DownListGroupItem.EVENT_CHANGE = "EVENT_CHANGE"; @@ -80201,6 +80203,7 @@ BI.DownListPopup = BI.inherit(BI.Pane, { hgap: this.constants.hgap, vgap: this.constants.vgap }], + value: this._digest(o.value), chooseType: o.chooseType }); @@ -80338,6 +80341,22 @@ BI.DownListPopup = BI.inherit(BI.Pane, { return fatherValue + "_" + childValue; }, + _digest: function (valueItem) { + var self = this; + var valueArray = []; + BI.each(valueItem, function (i, item) { + var value; + if (BI.isNotNull(item.childValue)) { + value = self._createChildValue(item.value, item.childValue); + } else { + value = item.value; + } + valueArray.push(value); + } + ); + return valueArray; + }, + populate: function (items) { BI.DownListPopup.superclass.populate.apply(this, arguments); var self = this; @@ -80354,19 +80373,7 @@ BI.DownListPopup = BI.inherit(BI.Pane, { }, setValue: function (valueItem) { - var self = this; - var valueArray = []; - BI.each(valueItem, function (i, item) { - var value; - if (BI.isNotNull(item.childValue)) { - value = self._createChildValue(item.value, item.childValue); - } else { - value = item.value; - } - valueArray.push(value); - } - ); - this.popup.setValue(valueArray); + this.popup.setValue(this._digest(valueItem)); }, getValue: function () { diff --git a/dist/demo.js b/dist/demo.js index b8f14edbe..551376d34 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -12336,6 +12336,7 @@ BI.shortcut("demo.date_time", Demo.CustomDateTime);Demo.Downlist = BI.inherit(BI self.downlist = _ref; }, cls: "layout-bg3", + value: [{"childValue":22,"value":11},{"value":18},{"value":20}], height: 30, width: 100, items: [ @@ -12348,8 +12349,7 @@ BI.shortcut("demo.date_time", Demo.CustomDateTime);Demo.Downlist = BI.inherit(BI children: [{ text: "column 1.1", value: 21, - cls: "dot-e-font", - selected: true + cls: "dot-e-font" }, { text: "column 1.222222222222222222222222222222222222", cls: "dot-e-font", @@ -12380,8 +12380,7 @@ BI.shortcut("demo.date_time", Demo.CustomDateTime);Demo.Downlist = BI.inherit(BI [{ text: "column 8", value: 18, - cls: "dot-e-font", - selected: true + cls: "dot-e-font" }, { @@ -12393,8 +12392,7 @@ BI.shortcut("demo.date_time", Demo.CustomDateTime);Demo.Downlist = BI.inherit(BI [{ text: "column 10", value: 20, - cls: "dot-e-font", - selected: true + cls: "dot-e-font" }, { diff --git a/dist/fineui.js b/dist/fineui.js index 330dc9cde..5bec5a6e6 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -81549,7 +81549,8 @@ BI.DownListCombo = BI.inherit(BI.Widget, { this.popupview = BI.createWidget({ type: "bi.down_list_popup", items: o.items, - chooseType: o.chooseType + chooseType: o.chooseType, + value: o.value }); this.popupview.on(BI.DownListPopup.EVENT_CHANGE, function (value) { @@ -81643,7 +81644,8 @@ BI.DownListGroup = BI.inherit(BI.Widget, { type: "bi.vertical", hgap: 0, vgap: 0 - }] + }], + value: o.value }); this.downlistgroup.on(BI.Controller.EVENT_CHANGE, function (type) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -81770,7 +81772,8 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe type: "bi.icon_button", cls: o.iconCls1, width: 25, - forceNotSelected: true + forceNotSelected: true, + selected: this._digest(o.value) }); this.icon2 = BI.createWidget({ @@ -81812,6 +81815,14 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe }); }, + _digest: function (v) { + var self = this, o = this.options; + v = BI.isArray(v) ? v : [v]; + return BI.any(v, function (idx, value) { + return BI.contains(o.childValues, value); + }); + }, + hover: function () { BI.DownListGroupItem.superclass.hover.apply(this, arguments); this.icon1.element.addClass("hover"); @@ -81841,16 +81852,7 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe }, setValue: function (v) { - var self = this, o = this.options; - v = BI.isArray(v) ? v : [v]; - BI.find(v, function (idx, value) { - if (BI.contains(o.childValues, value)) { - self.icon1.setSelected(true); - return true; - } - self.icon1.setSelected(false); - - }); + this.icon1.setSelected(this._digest(v)); } }); BI.DownListGroupItem.EVENT_CHANGE = "EVENT_CHANGE"; @@ -81895,6 +81897,7 @@ BI.DownListPopup = BI.inherit(BI.Pane, { hgap: this.constants.hgap, vgap: this.constants.vgap }], + value: this._digest(o.value), chooseType: o.chooseType }); @@ -82032,6 +82035,22 @@ BI.DownListPopup = BI.inherit(BI.Pane, { return fatherValue + "_" + childValue; }, + _digest: function (valueItem) { + var self = this; + var valueArray = []; + BI.each(valueItem, function (i, item) { + var value; + if (BI.isNotNull(item.childValue)) { + value = self._createChildValue(item.value, item.childValue); + } else { + value = item.value; + } + valueArray.push(value); + } + ); + return valueArray; + }, + populate: function (items) { BI.DownListPopup.superclass.populate.apply(this, arguments); var self = this; @@ -82048,19 +82067,7 @@ BI.DownListPopup = BI.inherit(BI.Pane, { }, setValue: function (valueItem) { - var self = this; - var valueArray = []; - BI.each(valueItem, function (i, item) { - var value; - if (BI.isNotNull(item.childValue)) { - value = self._createChildValue(item.value, item.childValue); - } else { - value = item.value; - } - valueArray.push(value); - } - ); - this.popup.setValue(valueArray); + this.popup.setValue(this._digest(valueItem)); }, getValue: function () { diff --git a/dist/widget.js b/dist/widget.js index 2d05cd2e7..56dcea129 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -3474,7 +3474,8 @@ BI.DownListCombo = BI.inherit(BI.Widget, { this.popupview = BI.createWidget({ type: "bi.down_list_popup", items: o.items, - chooseType: o.chooseType + chooseType: o.chooseType, + value: o.value }); this.popupview.on(BI.DownListPopup.EVENT_CHANGE, function (value) { @@ -3568,7 +3569,8 @@ BI.DownListGroup = BI.inherit(BI.Widget, { type: "bi.vertical", hgap: 0, vgap: 0 - }] + }], + value: o.value }); this.downlistgroup.on(BI.Controller.EVENT_CHANGE, function (type) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -3695,7 +3697,8 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe type: "bi.icon_button", cls: o.iconCls1, width: 25, - forceNotSelected: true + forceNotSelected: true, + selected: this._digest(o.value) }); this.icon2 = BI.createWidget({ @@ -3737,6 +3740,14 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe }); }, + _digest: function (v) { + var self = this, o = this.options; + v = BI.isArray(v) ? v : [v]; + return BI.any(v, function (idx, value) { + return BI.contains(o.childValues, value); + }); + }, + hover: function () { BI.DownListGroupItem.superclass.hover.apply(this, arguments); this.icon1.element.addClass("hover"); @@ -3766,16 +3777,7 @@ BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inhe }, setValue: function (v) { - var self = this, o = this.options; - v = BI.isArray(v) ? v : [v]; - BI.find(v, function (idx, value) { - if (BI.contains(o.childValues, value)) { - self.icon1.setSelected(true); - return true; - } - self.icon1.setSelected(false); - - }); + this.icon1.setSelected(this._digest(v)); } }); BI.DownListGroupItem.EVENT_CHANGE = "EVENT_CHANGE"; @@ -3820,6 +3822,7 @@ BI.DownListPopup = BI.inherit(BI.Pane, { hgap: this.constants.hgap, vgap: this.constants.vgap }], + value: this._digest(o.value), chooseType: o.chooseType }); @@ -3957,6 +3960,22 @@ BI.DownListPopup = BI.inherit(BI.Pane, { return fatherValue + "_" + childValue; }, + _digest: function (valueItem) { + var self = this; + var valueArray = []; + BI.each(valueItem, function (i, item) { + var value; + if (BI.isNotNull(item.childValue)) { + value = self._createChildValue(item.value, item.childValue); + } else { + value = item.value; + } + valueArray.push(value); + } + ); + return valueArray; + }, + populate: function (items) { BI.DownListPopup.superclass.populate.apply(this, arguments); var self = this; @@ -3973,19 +3992,7 @@ BI.DownListPopup = BI.inherit(BI.Pane, { }, setValue: function (valueItem) { - var self = this; - var valueArray = []; - BI.each(valueItem, function (i, item) { - var value; - if (BI.isNotNull(item.childValue)) { - value = self._createChildValue(item.value, item.childValue); - } else { - value = item.value; - } - valueArray.push(value); - } - ); - this.popup.setValue(valueArray); + this.popup.setValue(this._digest(valueItem)); }, getValue: function () { diff --git a/src/widget/downlist/combo.downlist.js b/src/widget/downlist/combo.downlist.js index e3e5cec5b..76419dfdd 100644 --- a/src/widget/downlist/combo.downlist.js +++ b/src/widget/downlist/combo.downlist.js @@ -22,7 +22,8 @@ BI.DownListCombo = BI.inherit(BI.Widget, { this.popupview = BI.createWidget({ type: "bi.down_list_popup", items: o.items, - chooseType: o.chooseType + chooseType: o.chooseType, + value: o.value }); this.popupview.on(BI.DownListPopup.EVENT_CHANGE, function (value) { diff --git a/src/widget/downlist/group.downlist.js b/src/widget/downlist/group.downlist.js index 592a94038..c7cc2ce49 100644 --- a/src/widget/downlist/group.downlist.js +++ b/src/widget/downlist/group.downlist.js @@ -28,7 +28,8 @@ BI.DownListGroup = BI.inherit(BI.Widget, { type: "bi.vertical", hgap: 0, vgap: 0 - }] + }], + value: o.value }); this.downlistgroup.on(BI.Controller.EVENT_CHANGE, function (type) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); diff --git a/src/widget/downlist/item.downlistgroup.js b/src/widget/downlist/item.downlistgroup.js index 8e788f7a5..4e4451ce0 100644 --- a/src/widget/downlist/item.downlistgroup.js +++ b/src/widget/downlist/item.downlistgroup.js @@ -28,7 +28,8 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, { type: "bi.icon_button", cls: o.iconCls1, width: 25, - forceNotSelected: true + forceNotSelected: true, + selected: this._digest(o.value) }); this.icon2 = BI.createWidget({ @@ -70,6 +71,14 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, { }); }, + _digest: function (v) { + var self = this, o = this.options; + v = BI.isArray(v) ? v : [v]; + return BI.any(v, function (idx, value) { + return BI.contains(o.childValues, value); + }); + }, + hover: function () { BI.DownListGroupItem.superclass.hover.apply(this, arguments); this.icon1.element.addClass("hover"); @@ -99,16 +108,7 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, { }, setValue: function (v) { - var self = this, o = this.options; - v = BI.isArray(v) ? v : [v]; - BI.find(v, function (idx, value) { - if (BI.contains(o.childValues, value)) { - self.icon1.setSelected(true); - return true; - } - self.icon1.setSelected(false); - - }); + this.icon1.setSelected(this._digest(v)); } }); BI.DownListGroupItem.EVENT_CHANGE = "EVENT_CHANGE"; diff --git a/src/widget/downlist/popup.downlist.js b/src/widget/downlist/popup.downlist.js index 089352b70..458d8d857 100644 --- a/src/widget/downlist/popup.downlist.js +++ b/src/widget/downlist/popup.downlist.js @@ -39,6 +39,7 @@ BI.DownListPopup = BI.inherit(BI.Pane, { hgap: this.constants.hgap, vgap: this.constants.vgap }], + value: this._digest(o.value), chooseType: o.chooseType }); @@ -176,6 +177,22 @@ BI.DownListPopup = BI.inherit(BI.Pane, { return fatherValue + "_" + childValue; }, + _digest: function (valueItem) { + var self = this; + var valueArray = []; + BI.each(valueItem, function (i, item) { + var value; + if (BI.isNotNull(item.childValue)) { + value = self._createChildValue(item.value, item.childValue); + } else { + value = item.value; + } + valueArray.push(value); + } + ); + return valueArray; + }, + populate: function (items) { BI.DownListPopup.superclass.populate.apply(this, arguments); var self = this; @@ -192,19 +209,7 @@ BI.DownListPopup = BI.inherit(BI.Pane, { }, setValue: function (valueItem) { - var self = this; - var valueArray = []; - BI.each(valueItem, function (i, item) { - var value; - if (BI.isNotNull(item.childValue)) { - value = self._createChildValue(item.value, item.childValue); - } else { - value = item.value; - } - valueArray.push(value); - } - ); - this.popup.setValue(valueArray); + this.popup.setValue(this._digest(valueItem)); }, getValue: function () {