Skip to content

Commit

Permalink
return this
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspk06 committed Sep 20, 2023
1 parent 6215ca0 commit 46c7e0d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ui/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -525,6 +532,7 @@ class AutocompleteUI {
}
}
}
return this;
}

public setMarkerColor(color: string) {
Expand All @@ -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) {
Expand All @@ -542,6 +551,7 @@ class AutocompleteUI {
} else {
this.inputField.removeEventListener('blur', this.close.bind(this), true);
}
return this;
}
}

Expand Down

0 comments on commit 46c7e0d

Please sign in to comment.