소스 검색

Adds debouncing to graph search

main
Keith Daulton 2 년 전
부모
커밋
379ed4baca
1개의 변경된 파일10개의 추가작업 그리고 9개의 파일을 삭제
  1. +10
    -9
      src/webviews/apps/shared/components/search/search-input.ts

+ 10
- 9
src/webviews/apps/shared/components/search/search-input.ts 파일 보기

@ -431,7 +431,7 @@ export class SearchInput extends FASTElement {
handleClear(_e: Event) {
this.value = '';
this.emitSearch();
this.debouncedEmitSearch();
}
updateHelpText() {
@ -450,33 +450,33 @@ export class SearchInput extends FASTElement {
debouncedUpdateHelpText = debounce(this.updateHelpText.bind(this), 200);
handleInputClick(_e: MouseEvent) {
this.updateHelpText();
this.debouncedUpdateHelpText();
}
handleInput(e: InputEvent) {
const value = (e.target as HTMLInputElement)?.value;
this.value = value;
this.updateHelpText();
this.emitSearch();
this.debouncedUpdateHelpText();
this.debouncedEmitSearch();
}
handleMatchAll(_e: Event) {
this.matchAll = !this.matchAll;
this.emitSearch();
this.debouncedEmitSearch();
}
handleMatchCase(_e: Event) {
this.matchCase = !this.matchCase;
this.emitSearch();
this.debouncedEmitSearch();
}
handleMatchRegex(_e: Event) {
this.matchRegex = !this.matchRegex;
this.emitSearch();
this.debouncedEmitSearch();
}
handleKeyup(_e: KeyboardEvent) {
this.updateHelpText();
this.debouncedUpdateHelpText();
}
handleShortcutKeys(e: KeyboardEvent) {
@ -503,7 +503,7 @@ export class SearchInput extends FASTElement {
handleInsertToken(token: string) {
this.value += `${this.value.length > 0 ? ' ' : ''}${token}`;
window.requestAnimationFrame(() => {
this.updateHelpText();
this.debouncedUpdateHelpText();
this.input.focus();
});
}
@ -517,6 +517,7 @@ export class SearchInput extends FASTElement {
};
this.$emit('change', search);
}
private debouncedEmitSearch = debounce(this.emitSearch.bind(this), 250);
setCustomValidity(errorMessage: string = '') {
this.errorMessage = errorMessage;

불러오는 중...
취소
저장