Browse Source

value的一些小问题

master
windy 7 years ago
parent
commit
8d94280ef2
  1. 9
      demo/js/case/combo/demo.text_value_down_list_combo.js
  2. 14
      demo/js/case/combo/demo.text_vlaue_check_combo.js
  3. 48
      dist/bundle.js
  4. 24
      dist/case.js
  5. 23
      dist/demo.js
  6. 48
      dist/fineui.js
  7. 24
      dist/widget.js
  8. 3
      src/case/combo/iconcombo/combo.icon.js
  9. 3
      src/case/combo/iconcombo/trigger.iconcombo.js
  10. 6
      src/case/combo/icontextvaluecombo/combo.icontextvalue.js
  11. 3
      src/case/combo/icontextvaluecombo/popup.icontextvalue.js
  12. 3
      src/case/combo/staticcombo/combo.static.js
  13. 3
      src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js
  14. 3
      src/case/combo/textvaluecombo/combo.textvalue.js
  15. 24
      src/widget/downlist/popup.downlist.js

9
demo/js/case/combo/demo.text_value_down_list_combo.js

@ -41,9 +41,18 @@ Demo.TextValueDownListCombo = BI.inherit(BI.Widget, {
type: "bi.button",
width: 90,
height: 25,
text: "setValue",
handler: function () {
self.refs.setValue(2);
}
}, {
type: "bi.button",
width: 90,
height: 25,
text: "getValue",
handler: function () {
BI.Msg.alert("", JSON.stringify(self.refs.getValue()));
}
}],
vgap: 20
};

14
demo/js/case/combo/demo.text_vlaue_check_combo.js

@ -6,13 +6,16 @@ Demo.TextValueCheckCombo = BI.inherit(BI.Widget, {
baseCls: ""
},
render: function () {
var self = this;
return {
type: "bi.horizontal_auto",
items: [{
type: "bi.text_value_check_combo",
ref: function () {
self.combo = this;
},
text: "默认值",
value: 1,
//value: 1,
width: 300,
items: [{
text: "MVC-1",
@ -24,6 +27,13 @@ Demo.TextValueCheckCombo = BI.inherit(BI.Widget, {
text: "MVC-3",
value: 3
}]
}, {
type: "bi.button",
width: 90,
height: 25,
handler: function () {
BI.Msg.alert("", JSON.stringify(self.combo.getValue()));
}
}],
vgap: 20
};

48
dist/bundle.js vendored

@ -67585,7 +67585,8 @@ BI.IconCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.iconCombo.getValue();
var value = this.iconCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {
@ -67686,7 +67687,8 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
}
this.button = BI.createWidget(o.el, {
type: "bi.icon_change_button",
cls: "icon-combo-trigger-icon " + iconCls,
cls: "icon-combo-trigger-icon",
iconCls: iconCls,
disableSelected: true,
width: o.width,
height: o.height,
@ -67783,7 +67785,8 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
});
this.popup = BI.createWidget({
type: "bi.icon_text_value_combo_popup",
items: o.items
items: o.items,
value: o.value
});
this.popup.on(BI.IconTextValueComboPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
@ -67813,7 +67816,8 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.textIconCombo.getValue();
var value = this.textIconCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {
@ -67844,7 +67848,8 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, {
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
@ -67944,7 +67949,8 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.combo.getValue();
var value = this.combo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
}
});
BI.StaticCombo.EVENT_CHANGE = "EVENT_CHANGE";
@ -68017,7 +68023,8 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.textIconCheckCombo.getValue();
var value = this.textIconCheckCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {
@ -68210,7 +68217,8 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.textIconCombo.getValue();
var value = this.textIconCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {
@ -80391,23 +80399,35 @@ BI.DownListPopup = BI.inherit(BI.Pane, {
},
_checkValues: function (values) {
var self = this;
var self = this, o = this.options;
var value = [];
BI.each(this.options.items, function (idx, itemGroup) {
BI.each(o.items, function (idx, itemGroup) {
BI.each(itemGroup, function (id, item) {
if(BI.isNotNull(item.children)){
var childValues = BI.pluck(item.children, "value");
if(BI.contains(childValues, values[idx])){
value.push(values[idx]);
if(BI.contains(childValues, valueGetter(idx))){
value.push(valueGetter(idx));
}
}else{
if(item.value === values[idx]){
value.push(values[idx]);
if(item.value === valueGetter(idx)){
value.push(valueGetter(idx));
}
}
})
});
return value;
function valueGetter(index) {
switch (o.chooseType) {
case BI.Selection.Single:
return values[0];
break;
case BI.Selection.Multi:
return values[index];
default:
break;
}
}
},
populate: function (items) {

24
dist/case.js vendored

@ -5291,7 +5291,8 @@ BI.IconCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.iconCombo.getValue();
var value = this.iconCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {
@ -5392,7 +5393,8 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
}
this.button = BI.createWidget(o.el, {
type: "bi.icon_change_button",
cls: "icon-combo-trigger-icon " + iconCls,
cls: "icon-combo-trigger-icon",
iconCls: iconCls,
disableSelected: true,
width: o.width,
height: o.height,
@ -5489,7 +5491,8 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
});
this.popup = BI.createWidget({
type: "bi.icon_text_value_combo_popup",
items: o.items
items: o.items,
value: o.value
});
this.popup.on(BI.IconTextValueComboPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
@ -5519,7 +5522,8 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.textIconCombo.getValue();
var value = this.textIconCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {
@ -5550,7 +5554,8 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, {
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
@ -5650,7 +5655,8 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.combo.getValue();
var value = this.combo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
}
});
BI.StaticCombo.EVENT_CHANGE = "EVENT_CHANGE";
@ -5723,7 +5729,8 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.textIconCheckCombo.getValue();
var value = this.textIconCheckCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {
@ -5916,7 +5923,8 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.textIconCombo.getValue();
var value = this.textIconCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {

23
dist/demo.js vendored

@ -1997,9 +1997,18 @@ Demo.TextValueDownListCombo = BI.inherit(BI.Widget, {
type: "bi.button",
width: 90,
height: 25,
text: "setValue",
handler: function () {
self.refs.setValue(2);
}
}, {
type: "bi.button",
width: 90,
height: 25,
text: "getValue",
handler: function () {
BI.Msg.alert("", JSON.stringify(self.refs.getValue()));
}
}],
vgap: 20
};
@ -2014,13 +2023,16 @@ Demo.TextValueCheckCombo = BI.inherit(BI.Widget, {
baseCls: ""
},
render: function () {
var self = this;
return {
type: "bi.horizontal_auto",
items: [{
type: "bi.text_value_check_combo",
ref: function () {
self.combo = this;
},
text: "默认值",
value: 1,
//value: 1,
width: 300,
items: [{
text: "MVC-1",
@ -2032,6 +2044,13 @@ Demo.TextValueCheckCombo = BI.inherit(BI.Widget, {
text: "MVC-3",
value: 3
}]
}, {
type: "bi.button",
width: 90,
height: 25,
handler: function () {
BI.Msg.alert("", JSON.stringify(self.combo.getValue()));
}
}],
vgap: 20
};

48
dist/fineui.js vendored

@ -69279,7 +69279,8 @@ BI.IconCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.iconCombo.getValue();
var value = this.iconCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {
@ -69380,7 +69381,8 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
}
this.button = BI.createWidget(o.el, {
type: "bi.icon_change_button",
cls: "icon-combo-trigger-icon " + iconCls,
cls: "icon-combo-trigger-icon",
iconCls: iconCls,
disableSelected: true,
width: o.width,
height: o.height,
@ -69477,7 +69479,8 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
});
this.popup = BI.createWidget({
type: "bi.icon_text_value_combo_popup",
items: o.items
items: o.items,
value: o.value
});
this.popup.on(BI.IconTextValueComboPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
@ -69507,7 +69510,8 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.textIconCombo.getValue();
var value = this.textIconCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {
@ -69538,7 +69542,8 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, {
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
@ -69638,7 +69643,8 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.combo.getValue();
var value = this.combo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
}
});
BI.StaticCombo.EVENT_CHANGE = "EVENT_CHANGE";
@ -69711,7 +69717,8 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.textIconCheckCombo.getValue();
var value = this.textIconCheckCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {
@ -69904,7 +69911,8 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.textIconCombo.getValue();
var value = this.textIconCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {
@ -82085,23 +82093,35 @@ BI.DownListPopup = BI.inherit(BI.Pane, {
},
_checkValues: function (values) {
var self = this;
var self = this, o = this.options;
var value = [];
BI.each(this.options.items, function (idx, itemGroup) {
BI.each(o.items, function (idx, itemGroup) {
BI.each(itemGroup, function (id, item) {
if(BI.isNotNull(item.children)){
var childValues = BI.pluck(item.children, "value");
if(BI.contains(childValues, values[idx])){
value.push(values[idx]);
if(BI.contains(childValues, valueGetter(idx))){
value.push(valueGetter(idx));
}
}else{
if(item.value === values[idx]){
value.push(values[idx]);
if(item.value === valueGetter(idx)){
value.push(valueGetter(idx));
}
}
})
});
return value;
function valueGetter(index) {
switch (o.chooseType) {
case BI.Selection.Single:
return values[0];
break;
case BI.Selection.Multi:
return values[index];
default:
break;
}
}
},
populate: function (items) {

24
dist/widget.js vendored

@ -3977,23 +3977,35 @@ BI.DownListPopup = BI.inherit(BI.Pane, {
},
_checkValues: function (values) {
var self = this;
var self = this, o = this.options;
var value = [];
BI.each(this.options.items, function (idx, itemGroup) {
BI.each(o.items, function (idx, itemGroup) {
BI.each(itemGroup, function (id, item) {
if(BI.isNotNull(item.children)){
var childValues = BI.pluck(item.children, "value");
if(BI.contains(childValues, values[idx])){
value.push(values[idx]);
if(BI.contains(childValues, valueGetter(idx))){
value.push(valueGetter(idx));
}
}else{
if(item.value === values[idx]){
value.push(values[idx]);
if(item.value === valueGetter(idx)){
value.push(valueGetter(idx));
}
}
})
});
return value;
function valueGetter(index) {
switch (o.chooseType) {
case BI.Selection.Single:
return values[0];
break;
case BI.Selection.Multi:
return values[index];
default:
break;
}
}
},
populate: function (items) {

3
src/case/combo/iconcombo/combo.icon.js

@ -85,7 +85,8 @@ BI.IconCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.iconCombo.getValue();
var value = this.iconCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {

3
src/case/combo/iconcombo/trigger.iconcombo.js

@ -27,7 +27,8 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
}
this.button = BI.createWidget(o.el, {
type: "bi.icon_change_button",
cls: "icon-combo-trigger-icon " + iconCls,
cls: "icon-combo-trigger-icon",
iconCls: iconCls,
disableSelected: true,
width: o.width,
height: o.height,

6
src/case/combo/icontextvaluecombo/combo.icontextvalue.js

@ -24,7 +24,8 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
});
this.popup = BI.createWidget({
type: "bi.icon_text_value_combo_popup",
items: o.items
items: o.items,
value: o.value
});
this.popup.on(BI.IconTextValueComboPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
@ -54,7 +55,8 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.textIconCombo.getValue();
var value = this.textIconCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {

3
src/case/combo/icontextvaluecombo/popup.icontextvalue.js

@ -20,7 +20,8 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, {
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
layouts: [{
type: "bi.vertical"
}]
}],
value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {

3
src/case/combo/staticcombo/combo.static.js

@ -62,7 +62,8 @@ BI.StaticCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.combo.getValue();
var value = this.combo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
}
});
BI.StaticCombo.EVENT_CHANGE = "EVENT_CHANGE";

3
src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js

@ -67,7 +67,8 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.textIconCheckCombo.getValue();
var value = this.textIconCheckCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {

3
src/case/combo/textvaluecombo/combo.textvalue.js

@ -57,7 +57,8 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
},
getValue: function () {
return this.textIconCombo.getValue();
var value = this.textIconCombo.getValue();
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]);
},
populate: function (items) {

24
src/widget/downlist/popup.downlist.js

@ -194,23 +194,35 @@ BI.DownListPopup = BI.inherit(BI.Pane, {
},
_checkValues: function (values) {
var self = this;
var self = this, o = this.options;
var value = [];
BI.each(this.options.items, function (idx, itemGroup) {
BI.each(o.items, function (idx, itemGroup) {
BI.each(itemGroup, function (id, item) {
if(BI.isNotNull(item.children)){
var childValues = BI.pluck(item.children, "value");
if(BI.contains(childValues, values[idx])){
value.push(values[idx]);
if(BI.contains(childValues, valueGetter(idx))){
value.push(valueGetter(idx));
}
}else{
if(item.value === values[idx]){
value.push(values[idx]);
if(item.value === valueGetter(idx)){
value.push(valueGetter(idx));
}
}
})
});
return value;
function valueGetter(index) {
switch (o.chooseType) {
case BI.Selection.Single:
return values[0];
break;
case BI.Selection.Multi:
return values[index];
default:
break;
}
}
},
populate: function (items) {

Loading…
Cancel
Save