fix(field): value delegation compatible with FormatMixin

This commit is contained in:
Joren Broekema 2019-08-14 13:46:53 +02:00 committed by Thijs Louisse
parent b38c6c3978
commit 3217c1a739

View file

@ -102,11 +102,16 @@ export class LionField extends FormControlMixin(
} }
connectedCallback() { connectedCallback() {
// TODO: Normally we put super calls on top for predictability,
// here we temporarily need to do attribute delegation before,
// so the FormatMixin uses the right value. Should be solved
// when value delegation is part of the calculation loop of
// FormatMixin
this._delegateInitialValueAttr();
super.connectedCallback(); super.connectedCallback();
this._onChange = this._onChange.bind(this); this._onChange = this._onChange.bind(this);
this.inputElement.addEventListener('change', this._onChange); this.inputElement.addEventListener('change', this._onChange);
this._delegateInitialValueAttr();
this.classList.add('form-field'); // eslint-disable-line this.classList.add('form-field'); // eslint-disable-line
} }