Browse Source

Merge pull request #299 in ~GUY/fineui from ~WINDY/fineui:master to master

* commit '47e29bcf4715bd07a3c431d3bcffc0fce070e3fd':
  downlistcombo 支持传value
es6
windy 7 years ago
parent
commit
0a6072e067
  1. 10
      demo/js/widget/downlist/demo.downlist.js
  2. 59
      dist/bundle.js
  3. 10
      dist/demo.js
  4. 59
      dist/fineui.js
  5. 59
      dist/widget.js
  6. 3
      src/widget/downlist/combo.downlist.js
  7. 3
      src/widget/downlist/group.downlist.js
  8. 22
      src/widget/downlist/item.downlistgroup.js
  9. 31
      src/widget/downlist/popup.downlist.js

10
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"
},
{

59
dist/bundle.js vendored

@ -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 () {

10
dist/demo.js vendored

@ -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"
},
{

59
dist/fineui.js vendored

@ -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 () {

59
dist/widget.js vendored

@ -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 () {

3
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) {

3
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);

22
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";

31
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 () {

Loading…
Cancel
Save