Skip to content

Commit

Permalink
fix #935 expose some members from AbstractSuggestBox class
Browse files Browse the repository at this point in the history
  • Loading branch information
vegegoku committed Jul 14, 2024
1 parent 70056a8 commit 65bad21
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,51 @@ default int getDelayedExecutionDefaultDelay() {
return 200;
}

/**
* Use to globally configure select/suggest box search box typeahead delay.
*
* @return the delay in milliseconds, default to 1000ms
*/
default int getDefaultSelectableBoxTypeAheadDelay() {
return 1000;
}

/**
* Use to globally configure Suggest box search box typeahead delay.
*
* @return the delay in milliseconds, default to {@link
* DelayedActionConfig#getDefaultSelectableBoxTypeAheadDelay()}
*/
default int getSuggestBoxTypeAheadDelay() {
return getDefaultSelectableBoxTypeAheadDelay();
}

/**
* Use to globally configure Select box search box typeahead delay.
*
* @return the delay in milliseconds, default to {@link
* DelayedActionConfig#getDefaultSelectableBoxTypeAheadDelay()}
*/
default int getSelectBoxTypeAheadDelay() {
return getDefaultSelectableBoxTypeAheadDelay();
}

/**
* Use to globally configure notification duration.
*
* @return the delay in milliseconds, default to 4000ms.
*/
default int getDefaultNotificationDuration() {
return 4000;
}

/**
* Use to globally configure the delay before a datebox start parsing the value while tying in the
* date box input.
*
* @return the delay in milliseconds, default to {@link
* DelayedActionConfig#getDelayedExecutionDefaultDelay()}.
*/
default int getDateBoxDefaultInputParseDelay() {
return getDelayedExecutionDefaultDelay();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public void setTypeAheadDelay(int typeAheadDelayInMillis) {
* the suggestions from the store, highlighting the matched portions, and updating the options
* menu.
*/
private void search() {
protected void search() {
if (store != null) {
loader.start();
optionsMenu.removeAll();
Expand Down Expand Up @@ -716,6 +716,39 @@ public C withOptionsMenu(ChildHandler<C, Menu<T>> handler) {
return (C) this;
}

/**
* Use to change the default search loader of a suggest box.
*
* @param loader
* @return same component instance
*/
public C setLoader(Loader loader) {
this.loader = loader;
return (C) this;
}

/**
* Use to apply a function on search loader of a suggest box.
*
* @param handler
* @return same component instance
*/
public C withLoader(ChildHandler<C, Loader> handler) {
handler.apply((C) this, loader);
return (C) this;
}

/**
* Use to apply a function on element hosting the suggest box search loader.
*
* @param handler
* @return same component instance
*/
public C withLoaderElement(ChildHandler<C, PrimaryAddOn<HTMLElement>> handler) {
handler.apply((C) this, loaderElement);
return (C) this;
}

/**
* An interface for rendering the value of a suggestion option in a suggest box.
*
Expand Down

0 comments on commit 65bad21

Please sign in to comment.