import { customElement, property, html, type TemplateResult, DeesElement, type CSSResult, } from '@design.estate/dees-element'; import * as domtools from '@design.estate/dees-domtools'; declare global { interface HTMLElementTagNameMap { 'dees-input-quantityselector': DeesInputQuantitySelector; } } @customElement('dees-input-quantityselector') export class DeesInputQuantitySelector extends DeesElement { public static demo = () => html``; // INSTANCE public changeSubject = new domtools.plugins.smartrx.rxjs.Subject(); @property() public label: string = 'Label'; @property({ type: String, reflect: true, }) public key: string; @property({ type: Number }) public value: number = 1; @property({ type: Boolean, }) public required: boolean = false; @property({ type: Boolean }) public disabled: boolean = false; constructor() { super(); } public render(): TemplateResult { return html` ${domtools.elementBasic.styles}
-
${this.value}
+
`; } public increase () { this.value++; this.changeSubject.next(this); } public decrease () { if (this.value > 0) { this.value--; } else { // nothing to do here } this.changeSubject.next(this); } }