fix: Import dees-button in dees-form-submit for button functionality

This commit is contained in:
Juergen Kunz
2025-06-19 13:47:52 +00:00
parent d321db363d
commit 873579fc97
2 changed files with 9 additions and 3 deletions

View File

@ -0,0 +1,3 @@
import { html } from '@design.estate/dees-element';
export const demoFunc = () => html`<dees-form-submit>Submit Form</dees-form-submit>`;

View File

@ -1,3 +1,4 @@
import { demoFunc } from './dees-form-submit.demo.js';
import { import {
customElement, customElement,
html, html,
@ -16,7 +17,7 @@ declare global {
@customElement('dees-form-submit') @customElement('dees-form-submit')
export class DeesFormSubmit extends DeesElement { export class DeesFormSubmit extends DeesElement {
public static demo = () => html`<dees-form-submit>Submit Form</dees-form-submit>`; public static demo = demoFunc;
@property({ @property({
type: Boolean, type: Boolean,
@ -57,13 +58,15 @@ export class DeesFormSubmit extends DeesElement {
return; return;
} }
const parentElement: DeesForm = this.parentElement as DeesForm; const parentElement: DeesForm = this.parentElement as DeesForm;
if (parentElement && parentElement.gatherAndDispatch) {
parentElement.gatherAndDispatch(); parentElement.gatherAndDispatch();
} }
}
public async focus() { public async focus() {
const domtools = await this.domtoolsPromise; const domtools = await this.domtoolsPromise;
if (!this.disabled) { if (!this.disabled) {
domtools.convenience.smartdelay.delayFor(0); await domtools.convenience.smartdelay.delayFor(0);
this.submit(); this.submit();
} }
} }