[IMP] web_editor: align numeric inputs text without units to the right

Before this commit, the input widgets that do not have units have their
text aligned to the left. However, when the content is numeric, it would
be better if the number was on the right, just as when there is a unit.

This commit also considers as numeric an input widget that has the
`data-step` attribute (and not only the `data-unit` attribute) and
forces the text alignment to the right in this case.

task-2798576

closes odoo/odoo#89055

Signed-off-by: Dieleman Guillaume <gdi@odoo.com>
This commit is contained in:
Soukéina Bojabza
2023-05-15 12:55:58 +02:00
parent fdfd5042f8
commit fa0cd18f9d
@@ -1222,12 +1222,13 @@ const InputUserValueWidget = UnitUserValueWidget.extend({
await this._super(...arguments);
const unit = this.el.dataset.unit;
const step = this.el.dataset.step;
this.inputEl = document.createElement('input');
this.inputEl.setAttribute('type', 'text');
this.inputEl.setAttribute('autocomplete', 'chrome-off');
this.inputEl.setAttribute('placeholder', this.el.getAttribute('placeholder') || '');
this.inputEl.classList.toggle('text-start', !unit);
this.inputEl.classList.toggle('text-end', !!unit);
this.inputEl.classList.toggle('text-start', !unit && !step);
this.inputEl.classList.toggle('text-end', !!unit || !!step);
this.containerEl.appendChild(this.inputEl);
var unitEl = document.createElement('span');