[IMP] web: make it possible to add classes to fields

`additionalClasses` can now be set on field components to add certain
classes the wrapper should have.
This is useful in case css rules have been defined on a field widget
that we want to inherit from.

X-original-commit: e882c892ad2bf476a6d25cbd90e72974c5453a38
Part-of: odoo/odoo#100764
This commit is contained in:
William Braeckman
2022-09-22 12:23:26 +02:00
parent 4c9de9b786
commit 699994fccf
@@ -99,6 +99,11 @@ export class Field extends Component {
[`o_field_${this.type}`]: true,
[_class]: Boolean(_class),
};
if (this.FieldComponent.additionalClasses) {
for (const cls of this.FieldComponent.additionalClasses) {
classNames[cls] = true;
}
}
// generate field decorations classNames (only if field-specific decorations
// have been defined in an attribute, e.g. decoration-danger="other_field = 5")