fix not working onchange with Shoelace components: need to bind sl-change instead of change

adding change handler to invoker mixing to enable/disable invoker when value changes
This commit is contained in:
ralf 2022-07-27 12:33:37 +02:00
parent 1b9e2367e1
commit 0ad3cf9832
2 changed files with 15 additions and 2 deletions

View File

@ -148,14 +148,14 @@ const Et2InputWidgetMixin = <T extends Constructor<LitElement>>(superclass : T)
this.node = this.getInputNode();
this.updateComplete.then(() =>
{
this.addEventListener("change", this._oldChange);
this.addEventListener(typeof (<any>this).handleChange === 'function' ? 'sl-change' : 'change', this._oldChange);
});
}
disconnectedCallback()
{
super.disconnectedCallback();
this.removeEventListener("change", this._oldChange);
this.removeEventListener(typeof (<any>this).handleChange === 'function' ? 'sl-change' : 'change', this._oldChange);
}
/**

View File

@ -179,6 +179,19 @@ export const Et2InvokerMixin = dedupeMixin(<T extends Constructor<LitElement>>(s
}
}
/**
* Reimplemented to enable/disable invoker on content change
*
* @param _ev
* @returns
*/
_oldChange(_ev: Event): boolean
{
this._toggleInvokerDisabled();
return super._oldChange(_ev);
}
/** @param {import('@lion/core').PropertyValues } changedProperties */
firstUpdated(changedProperties)
{