|
|
@ -15,9 +15,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, { |
|
|
|
value: 0, |
|
|
|
value: 0, |
|
|
|
allowBlank: false, |
|
|
|
allowBlank: false, |
|
|
|
errorText: "", |
|
|
|
errorText: "", |
|
|
|
step: 1, |
|
|
|
step: 1 |
|
|
|
min: BI.MIN, |
|
|
|
|
|
|
|
max: BI.MAX |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -29,16 +27,10 @@ BI.NumberEditor = BI.inherit(BI.Widget, { |
|
|
|
height: o.height - 2, |
|
|
|
height: o.height - 2, |
|
|
|
allowBlank: o.allowBlank, |
|
|
|
allowBlank: o.allowBlank, |
|
|
|
value: o.valueFormatter(o.value), |
|
|
|
value: o.valueFormatter(o.value), |
|
|
|
validationChecker: function (v) { |
|
|
|
validationChecker: o.validationChecker, |
|
|
|
if(!self._checkValueInRange(v)) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return o.validationChecker(v); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
errorText: o.errorText |
|
|
|
errorText: o.errorText |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { |
|
|
|
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { |
|
|
|
self._checkAdjustDisabled(o.value); |
|
|
|
|
|
|
|
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); |
|
|
|
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.TextEditor.EVENT_ERROR, function () { |
|
|
|
this.editor.on(BI.TextEditor.EVENT_ERROR, function () { |
|
|
@ -54,12 +46,10 @@ BI.NumberEditor = BI.inherit(BI.Widget, { |
|
|
|
type: "bi.icon_button", |
|
|
|
type: "bi.icon_button", |
|
|
|
forceNotSelected: true, |
|
|
|
forceNotSelected: true, |
|
|
|
trigger: "lclick,", |
|
|
|
trigger: "lclick,", |
|
|
|
cls: "add-up-font top-button bi-border-left bi-list-item-active2 icon-size-12", |
|
|
|
cls: "add-up-font top-button bi-border-left bi-list-item-active2 icon-size-12" |
|
|
|
disabled: BI.parseFloat(o.value) >= o.max |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
|
this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
|
self._finetuning(o.step); |
|
|
|
self._finetuning(o.step); |
|
|
|
self._checkAdjustDisabled(o.value); |
|
|
|
|
|
|
|
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); |
|
|
|
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); |
|
|
|
self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); |
|
|
|
self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -67,12 +57,10 @@ BI.NumberEditor = BI.inherit(BI.Widget, { |
|
|
|
type: "bi.icon_button", |
|
|
|
type: "bi.icon_button", |
|
|
|
trigger: "lclick,", |
|
|
|
trigger: "lclick,", |
|
|
|
forceNotSelected: true, |
|
|
|
forceNotSelected: true, |
|
|
|
cls: "minus-down-font bottom-button bi-border-left bi-list-item-active2 icon-size-12", |
|
|
|
cls: "minus-down-font bottom-button bi-border-left bi-list-item-active2 icon-size-12" |
|
|
|
disabled: BI.parseFloat(o.value) <= o.min |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
|
this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
|
self._finetuning(-o.step); |
|
|
|
self._finetuning(-o.step); |
|
|
|
self._checkAdjustDisabled(o.value); |
|
|
|
|
|
|
|
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); |
|
|
|
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); |
|
|
|
self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); |
|
|
|
self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -108,16 +96,6 @@ BI.NumberEditor = BI.inherit(BI.Widget, { |
|
|
|
return this.editor.isEditing(); |
|
|
|
return this.editor.isEditing(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_checkValueInRange: function(v) { |
|
|
|
|
|
|
|
var o = this.options; |
|
|
|
|
|
|
|
return !!(BI.isNumeric(v) && BI.parseFloat(v) >= o.min && BI.parseFloat(v) <= o.max); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_checkAdjustDisabled: function(v) { |
|
|
|
|
|
|
|
this.bottomBtn.setEnable(BI.parseFloat(v) > this.options.min); |
|
|
|
|
|
|
|
this.topBtn.setEnable(BI.parseFloat(v) < this.options.max); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 微调
|
|
|
|
// 微调
|
|
|
|
_finetuning: function (add) { |
|
|
|
_finetuning: function (add) { |
|
|
|
var v = BI.parseFloat(this.getValue()); |
|
|
|
var v = BI.parseFloat(this.getValue()); |
|
|
|