From 1f781eb78a4a49bdd1928f18184cf9405e937aee Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 3 Apr 2021 23:09:52 +0200 Subject: [PATCH] web/elements: make ak-spinner-button work with ModalForm Signed-off-by: Jens Langhammer --- web/src/elements/buttons/SpinnerButton.ts | 26 +++++++---------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/web/src/elements/buttons/SpinnerButton.ts b/web/src/elements/buttons/SpinnerButton.ts index 637e7b1ac..14e6ca6ac 100644 --- a/web/src/elements/buttons/SpinnerButton.ts +++ b/web/src/elements/buttons/SpinnerButton.ts @@ -12,10 +12,7 @@ export class SpinnerButton extends LitElement { isRunning = false; @property() - form?: string; - - @property() - callAction: () => void = this.defaultCallAction; + callAction: () => void = () => {}; static get styles(): CSSResult[] { return [ @@ -55,25 +52,18 @@ export class SpinnerButton extends LitElement { } defaultCallAction(): void { - if (this.isRunning === true) { - return; - } - if (this.form) { - // Since the form= attribute is only used within a modal button, - // we can assume the form is always two levels up - this.parentElement?.parentElement?.querySelector(`#${this.form}`)?.dispatchEvent(new Event("submit", { - bubbles: true, - cancelable: true, - })); - } - this.setLoading(); } render(): TemplateResult { return html`