|
|
@ -39,9 +39,33 @@ BI.NumberEditor = BI.inherit(BI.Widget, { |
|
|
|
if (o.validationChecker === BI.emptyFn && !self._checkValueInRange(parsedValue)) { |
|
|
|
if (o.validationChecker === BI.emptyFn && !self._checkValueInRange(parsedValue)) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return o.validationChecker(parsedValue); |
|
|
|
return o.validationChecker(parsedValue); |
|
|
|
}, |
|
|
|
}, |
|
|
|
errorText: o.errorText |
|
|
|
errorText: o.errorText, |
|
|
|
|
|
|
|
listeners: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
eventName: BI.SignEditor.EVENT_QUICK_DOWN, |
|
|
|
|
|
|
|
action: e => { |
|
|
|
|
|
|
|
if ([BI.KeyCode.UP, BI.KeyCode.DOWN].includes(e.keyCode)) { |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
eventName: BI.SignEditor.EVENT_KEY_DOWN, |
|
|
|
|
|
|
|
action: (keycode) => { |
|
|
|
|
|
|
|
if (keycode === BI.KeyCode.UP) { |
|
|
|
|
|
|
|
this._finetuning(o.step); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (keycode === BI.KeyCode.DOWN) { |
|
|
|
|
|
|
|
this._finetuning(-o.step); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { |
|
|
|
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { |
|
|
|
// 大多数时候valueFormatter往往需要配合valueParser一起使用
|
|
|
|
// 大多数时候valueFormatter往往需要配合valueParser一起使用
|
|
|
@ -68,7 +92,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, { |
|
|
|
forceNotSelected: true, |
|
|
|
forceNotSelected: true, |
|
|
|
trigger: "lclick,", |
|
|
|
trigger: "lclick,", |
|
|
|
debounce: false, |
|
|
|
debounce: false, |
|
|
|
cls: (o.simple ? "solid-triangle-top-font " : "add-up-font bi-border-left ") + "top-button bi-list-item-active2 icon-size-12" |
|
|
|
cls: (o.simple ? "solid-triangle-top-font " : "add-up-font bi-border-left ") + "top-button bi-list-item-active2 icon-size-12", |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
|
this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
|
self._finetuning(o.step); |
|
|
|
self._finetuning(o.step); |
|
|
@ -80,7 +104,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, { |
|
|
|
trigger: "lclick,", |
|
|
|
trigger: "lclick,", |
|
|
|
forceNotSelected: true, |
|
|
|
forceNotSelected: true, |
|
|
|
debounce: false, |
|
|
|
debounce: false, |
|
|
|
cls: (o.simple ? "solid-triangle-bottom-font " : "minus-down-font bi-border-left ") + "bottom-button bi-list-item-active2 icon-size-12" |
|
|
|
cls: (o.simple ? "solid-triangle-bottom-font " : "minus-down-font bi-border-left ") + "bottom-button bi-list-item-active2 icon-size-12", |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
|
this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
|
self._finetuning(-o.step); |
|
|
|
self._finetuning(-o.step); |
|
|
@ -101,17 +125,17 @@ BI.NumberEditor = BI.inherit(BI.Widget, { |
|
|
|
{ |
|
|
|
{ |
|
|
|
column: 0, |
|
|
|
column: 0, |
|
|
|
row: 0, |
|
|
|
row: 0, |
|
|
|
el: this.topBtn |
|
|
|
el: this.topBtn, |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
column: 0, |
|
|
|
column: 0, |
|
|
|
row: 1, |
|
|
|
row: 1, |
|
|
|
el: this.bottomBtn |
|
|
|
el: this.bottomBtn, |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
], |
|
|
|
}, |
|
|
|
}, |
|
|
|
width: 23 |
|
|
|
width: 23, |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
], |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -125,6 +149,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, { |
|
|
|
|
|
|
|
|
|
|
|
_checkValueInRange: function (v) { |
|
|
|
_checkValueInRange: function (v) { |
|
|
|
var o = this.options; |
|
|
|
var o = this.options; |
|
|
|
|
|
|
|
|
|
|
|
return !!(BI.isNumeric(v) && BI.parseFloat(v) >= o.min && BI.parseFloat(v) <= o.max); |
|
|
|
return !!(BI.isNumeric(v) && BI.parseFloat(v) >= o.min && BI.parseFloat(v) <= o.max); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|