Skip to content

Commit

Permalink
unset width maxheight, only handle | null
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspk06 committed Nov 12, 2024
1 parent f32adad commit cf06a9e
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/ui/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,14 +509,22 @@ class AutocompleteUI {
return this;
}

public setWidth(width: number | string) {
this.config.width = width;
public setWidth(width: number | string | null) {
if (width === null) {
this.config.width = undefined;
} else if (typeof width === 'string' || typeof width === 'number') {
this.config.width = width;
}
setWidth(this.wrapper, this.config);
return this;
}

public setMaxHeight(height: number | string) {
this.config.maxHeight = height;
public setMaxHeight(height: number | string | null) {
if (height === null) {
this.config.maxHeight = undefined;
} else if (typeof height === 'string' || typeof height === 'number') {
this.config.maxHeight = height;
}
setHeight(this.resultsList, this.config);
return this;
}
Expand All @@ -532,17 +540,17 @@ class AutocompleteUI {
return this;
}

public setLang(lang: string | undefined | null) {
if (lang === undefined || lang === null) {
public setLang(lang: string | null) {
if (lang === null) {
this.config.lang = undefined;
} else if (typeof lang === 'string') {
this.config.lang = lang;
}
return this;
}

public setPostalCode(postalCode: string | undefined | null) {
if (postalCode === undefined || postalCode === null) {
public setPostalCode(postalCode: string | null) {
if (postalCode === null) {
this.config.postalCode = undefined;
} else if (typeof postalCode === 'string') {
this.config.postalCode = postalCode;
Expand Down

0 comments on commit cf06a9e

Please sign in to comment.