[IMP] web_widget_numeric_step: option to add classes

New option so we can add new classes to the input or remove existing
ones so we can style the input at our will.

TT49390
This commit is contained in:
David
2024-07-12 13:22:29 +02:00
parent 1cfc596853
commit 160a39c409
4 changed files with 16 additions and 3 deletions

View File

@@ -49,12 +49,13 @@ odoo.define("web_widget_numeric_step.field", function (require) {
min_val = this.nodeOptions.max;
max_val = this.nodeOptions.min;
}
this._config = {
step: Number(this.nodeOptions.step) || 1,
min: Number(min_val),
max: Number(max_val),
autoSelect: this.nodeOptions.auto_select,
addClasses: this.nodeOptions.add_class,
removeClasses: this.nodeOptions.remove_class,
};
this._lazyOnChangeTrigger = _.debounce(
@@ -139,6 +140,12 @@ odoo.define("web_widget_numeric_step.field", function (require) {
.addClass("numeric_step_editing_cell")
);
this._prepareInput(this.$el.find("input.input_numeric_step"));
if (this._config.addClasses) {
this.$input.addClass(this._config.addClasses);
}
if (this._config.removeClasses) {
this.$input.removeClass(this._config.removeClasses);
}
},
/**