import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { ifDefined } from "lit-html/directives/if-defined"; import { COMMON_STYLES } from "../../common/styles"; @customElement("ak-table-search") export class TableSearch extends LitElement { @property() value?: string; @property() onSearch?: (value: string) => void; static get styles(): CSSResult[] { return COMMON_STYLES; } render(): TemplateResult { return html`
{ e.preventDefault(); if (!this.onSearch) return; const el = this.shadowRoot?.querySelector("input[type=search]"); if (!el) return; if (el.value === "") return; this.onSearch(el?.value); }}> { if (!this.onSearch) return; this.onSearch((ev.target as HTMLInputElement).value); }}>
`; } }