mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[IMP] web_widget_numeric_step: Add auto_select option
This commit is contained in:
committed by
Thanakrit Pintana
parent
69a3d5f683
commit
7c266307d0
@@ -20,7 +20,8 @@ odoo.define("web_widget_numeric_step.field", function(require) {
|
||||
"keydown .input_numeric_step": "_onKeyDown",
|
||||
"change .input_numeric_step": "_onChange",
|
||||
"input .input_numeric_step": "_onInput",
|
||||
"onfocusout .widget_numeric_step": "_onFocusOut",
|
||||
"focusin .input_numeric_step": "_onFocusIn",
|
||||
"focusout .widget_numeric_step": "_onFocusOut",
|
||||
}),
|
||||
supportedFieldTypes: ["float", "integer"],
|
||||
|
||||
@@ -53,6 +54,7 @@ odoo.define("web_widget_numeric_step.field", function(require) {
|
||||
step: Number(this.nodeOptions.step) || 1,
|
||||
min: Number(min_val),
|
||||
max: Number(max_val),
|
||||
autoSelect: this.nodeOptions.auto_select,
|
||||
};
|
||||
|
||||
this._lazyOnChangeTrigger = _.debounce(
|
||||
@@ -215,6 +217,18 @@ odoo.define("web_widget_numeric_step.field", function(require) {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Auto select all content when user enters into fields with this
|
||||
* widget.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
_onFocusIn: function() {
|
||||
if (this._config.autoSelect) {
|
||||
this.$input.select();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {FocusoutEvent} ev
|
||||
|
||||
Reference in New Issue
Block a user