dees-catalog/ts_web/elements/dees-form-submit.ts

27 lines
674 B
TypeScript
Raw Normal View History

2021-05-05 20:55:49 +00:00
import { customElement, html, DeesElement, css, cssManager } from '@designestate/dees-element';
import { DeesForm } from './dees-form';
2020-09-13 16:24:48 +00:00
2021-02-13 21:52:36 +00:00
declare global {
interface HTMLElementTagNameMap {
'dees-form-submit': DeesFormSubmit;
}
}
2020-09-13 16:24:48 +00:00
@customElement('dees-form-submit')
2021-05-05 20:55:49 +00:00
export class DeesFormSubmit extends DeesElement {
constructor() {
super();
}
2020-09-13 16:24:48 +00:00
2021-05-05 20:55:49 +00:00
public static styles = [cssManager.defaultStyles, css``];
2020-09-13 16:24:48 +00:00
public render() {
2021-05-05 20:55:49 +00:00
return html` <dees-button @click="${this.submit}">${this.textContent}</dees-button> `;
2020-09-13 16:24:48 +00:00
}
public async submit() {
const parentElement: DeesForm = this.parentElement as DeesForm;
parentElement.gatherAndDispatch();
}
}