Tools for awaiting ready -- still can't make focus() work
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { waitForAnimationFrame } from "./event";
|
||||
import { SLElem } from "./slelem";
|
||||
import { SLIcon } from "./slicon";
|
||||
|
||||
@@ -6,34 +7,34 @@ export class SLInput extends SLElem {
|
||||
super("sl-input");
|
||||
}
|
||||
|
||||
public addIcon(name: string, slot: "prefix" | "suffix"): SLIcon {
|
||||
addIcon(name: string, slot: "prefix" | "suffix"): SLIcon {
|
||||
const icon = new SLIcon(name);
|
||||
icon.setSlot(slot);
|
||||
this.append(icon);
|
||||
return icon;
|
||||
}
|
||||
|
||||
public addPrefixIcon(name: string): SLIcon {
|
||||
addPrefixIcon(name: string): SLIcon {
|
||||
return this.addIcon(name, "prefix");
|
||||
}
|
||||
|
||||
public addSuffixIcon(name: string): SLIcon {
|
||||
addSuffixIcon(name: string): SLIcon {
|
||||
return this.addIcon(name, "suffix");
|
||||
}
|
||||
|
||||
public clear() {
|
||||
clear() {
|
||||
(this.elem as HTMLInputElement).value = "";
|
||||
}
|
||||
|
||||
public getValue(): string {
|
||||
getValue(): string {
|
||||
return (this.elem as HTMLInputElement).value;
|
||||
}
|
||||
|
||||
public focus() {
|
||||
focus() {
|
||||
(this.elem as HTMLInputElement).focus();
|
||||
}
|
||||
|
||||
public setPill() {
|
||||
setPill() {
|
||||
this.setAttribute("pill", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user