From 46c7e0d4a052d0a41126747ead0baf67d8047c08 Mon Sep 17 00:00:00 2001 From: Jason Liu Date: Wed, 20 Sep 2023 16:01:30 -0400 Subject: [PATCH] return this --- src/ui/autocomplete.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ui/autocomplete.ts b/src/ui/autocomplete.ts index 6bf4b91e..48aae741 100644 --- a/src/ui/autocomplete.ts +++ b/src/ui/autocomplete.ts @@ -465,11 +465,13 @@ class AutocompleteUI { public setPlaceholder(placeholder: string) { this.config.placeholder = placeholder; this.inputField.placeholder = placeholder; + return this; } public setDisabled(disabled: boolean) { this.config.disabled = disabled; this.inputField.disabled = disabled; + return this; } public setResponsive(responsive: boolean) { @@ -483,24 +485,29 @@ class AutocompleteUI { this.inputField.style.width = formatCSSValue(this.config.width || DEFAULT_WIDTH); this.inputField.style.maxWidth = 'none'; } + return this; } public setWidth(width: number | string) { this.config.width = width; setWidth(this.wrapper, this.config); + return this; } public setMaxHeight(height: number | string) { this.config.maxHeight = height; setHeight(this.resultsList, this.config); + return this; } public setThreshold(threshold: number) { this.config.threshold = threshold; + return this; } public setLimit(limit: number) { this.config.limit = limit; + return this; } public setShowMarkers(showMarkers: boolean) { @@ -525,6 +532,7 @@ class AutocompleteUI { } } } + return this; } public setMarkerColor(color: string) { @@ -533,6 +541,7 @@ class AutocompleteUI { for (let i = 0; i < marker.length; i++) { marker[i].setAttribute('src', getMarkerIcon(color)); } + return this; } public setHideResultsOnBlur(hideResultsOnBlur: boolean) { @@ -542,6 +551,7 @@ class AutocompleteUI { } else { this.inputField.removeEventListener('blur', this.close.bind(this), true); } + return this; } }