elexis/lib/$Button.ts
defaultkavy 658df2d8e6 v0.0.2
new: $Image
enhance: $ parameter accept null and undefined
new: $Dialog
new: $Canvas
add: $.rem()
fix: Router resolve path error with param resolve
fix: $Container.insert() render error with undefined child
change: Route builder function parameter with one object
enhance: $Node event listener with event type
add: $Node.inDOM()
2024-02-13 19:38:46 +08:00

23 lines
1.0 KiB
TypeScript

import { $Container, $ContainerOptions } from "./$Container";
import { FormElementMethod, $FormElementMethod } from "./$Form";
import { $State } from "./$State";
export interface $ButtonOptions extends $ContainerOptions {}
//@ts-expect-error
export interface $Button extends $FormElementMethod {}
@FormElementMethod
export class $Button extends $Container<HTMLButtonElement> {
constructor(options?: $ButtonOptions) {
super('button', options);
}
disabled(): boolean;
disabled(disabled: boolean | $State<boolean>): this;
disabled(disabled?: boolean | $State<boolean>) { return $.fluent(this, arguments, () => this.dom.disabled, () => $.set(this.dom, 'disabled', disabled))}
type(): ButtonType;
type(type: ButtonType): this;
type(type?: ButtonType) { return $.fluent(this, arguments, () => this.dom.type as ButtonType, () => $.set(this.dom, 'type', type))}
checkValidity() { return this.dom.checkValidity() }
reportValidity() { return this.dom.reportValidity() }
}