forked from Techsystech/web
commit
a601e73680
|
@ -1,6 +1,11 @@
|
||||||
.widget_numeric_step {
|
.widget_numeric_step {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.numeric_step_editing_cell {
|
.numeric_step_editing_cell {
|
||||||
min-width: 120px;
|
min-width: 120px;
|
||||||
|
|
||||||
|
.input_numeric_step {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ odoo.define('web_widget_numeric_step.field', function (require) {
|
||||||
'keydown .input_numeric_step': '_onKeyDown',
|
'keydown .input_numeric_step': '_onKeyDown',
|
||||||
'change .input_numeric_step': '_onChange',
|
'change .input_numeric_step': '_onChange',
|
||||||
'input .input_numeric_step': '_onInput',
|
'input .input_numeric_step': '_onInput',
|
||||||
|
'onfocusout .widget_numeric_step': '_onFocusOut',
|
||||||
}),
|
}),
|
||||||
supportedFieldTypes: ['float', 'integer'],
|
supportedFieldTypes: ['float', 'integer'],
|
||||||
|
|
||||||
|
@ -32,6 +33,9 @@ odoo.define('web_widget_numeric_step.field', function (require) {
|
||||||
DELAY_THROTTLE_CHANGE: 200,
|
DELAY_THROTTLE_CHANGE: 200,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
*/
|
||||||
init: function () {
|
init: function () {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
|
@ -124,7 +128,9 @@ odoo.define('web_widget_numeric_step.field', function (require) {
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
_renderEdit: function () {
|
_renderEdit: function () {
|
||||||
$("td.o_numeric_step_cell").addClass("numeric_step_editing_cell");
|
_.defer(function () {
|
||||||
|
this.$el.parents("td.o_numeric_step_cell").addClass("numeric_step_editing_cell");
|
||||||
|
}.bind(this));
|
||||||
this._prepareInput(this.$el.find('input.input_numeric_step'));
|
this._prepareInput(this.$el.find('input.input_numeric_step'));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -134,7 +140,7 @@ odoo.define('web_widget_numeric_step.field', function (require) {
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
_renderReadonly: function () {
|
_renderReadonly: function () {
|
||||||
$("td.o_numeric_step_cell").removeClass("numeric_step_editing_cell");
|
this.$el.parents("td.numeric_step_editing_cell").removeClass("numeric_step_editing_cell");
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -166,7 +172,21 @@ odoo.define('web_widget_numeric_step.field', function (require) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_clearStepInterval: function () {
|
||||||
|
clearTimeout(this._auto_step_interval);
|
||||||
|
this._auto_step_interval = false;
|
||||||
|
this._click_delay = this.DEF_CLICK_DELAY;
|
||||||
|
},
|
||||||
|
|
||||||
// Handle Events
|
// Handle Events
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @param {MouseClickEvent} ev
|
||||||
|
*/
|
||||||
_onStepClick: function (ev) {
|
_onStepClick: function (ev) {
|
||||||
if (!this._autoStep) {
|
if (!this._autoStep) {
|
||||||
var mode = ev.target.dataset.mode;
|
var mode = ev.target.dataset.mode;
|
||||||
|
@ -175,19 +195,38 @@ odoo.define('web_widget_numeric_step.field', function (require) {
|
||||||
this._autoStep = false;
|
this._autoStep = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @param {MouseClickEvent} ev
|
||||||
|
*/
|
||||||
_onStepMouseDown: function (ev) {
|
_onStepMouseDown: function (ev) {
|
||||||
if (!this._auto_step_interval) {
|
if (ev.button === 0 && !this._auto_step_interval) {
|
||||||
this._auto_step_interval = setTimeout(
|
this._auto_step_interval = setTimeout(
|
||||||
$.proxy(this, "_whileMouseDown", ev), this._click_delay);
|
$.proxy(this, "_whileMouseDown", ev), this._click_delay);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMouseUp: function () {
|
/**
|
||||||
clearTimeout(this._auto_step_interval);
|
* @private
|
||||||
this._auto_step_interval = false;
|
* @param {FocusoutEvent} ev
|
||||||
this._click_delay = this.DEF_CLICK_DELAY;
|
*/
|
||||||
|
_onFocusOut: function (evt) {
|
||||||
|
if (this._auto_step_interval) {
|
||||||
|
this._clearStepInterval();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_onMouseUp: function () {
|
||||||
|
this._clearStepInterval();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @param {MouseClickEvent} ev
|
||||||
|
*/
|
||||||
_whileMouseDown: function (ev) {
|
_whileMouseDown: function (ev) {
|
||||||
this._autoStep = true;
|
this._autoStep = true;
|
||||||
var mode = ev.target.dataset.mode;
|
var mode = ev.target.dataset.mode;
|
||||||
|
|
Loading…
Reference in New Issue