28 lines
768 B
JavaScript
28 lines
768 B
JavaScript
import BaseFormInput from './base-form-input';
|
|
import $ from 'jquery'
|
|
|
|
export default BaseFormInput.extend({
|
|
classNames: ['form-group'],
|
|
min: 0,
|
|
max: 64,
|
|
step: 1,
|
|
didReceiveAttrs() {
|
|
this._super(...arguments);
|
|
this.getVal() || this.setVal(0);
|
|
},
|
|
didInsertElement() {
|
|
let me = this;
|
|
$('input[type=text]', me.element).ace_spinner({
|
|
value: me.getVal(),
|
|
min: me.get('min'),
|
|
max: me.get('max'),
|
|
step: me.get('step'),
|
|
btn_up_class: 'btn-info',
|
|
btn_down_class: 'btn-info'})
|
|
.closest('.ace-spinner')
|
|
.on('changed.fu.spinbox', function() {
|
|
me.setVal($('input[type=text]', me.element).val());
|
|
});
|
|
}
|
|
});
|