Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class SearchComponent extends React.Component<
SearchProps,
{ localValue: string }
> {
private inputRef = React.createRef<HTMLInputElement>();
onDebouncedSearch = debounce(this.props.onSearch, 400);
constructor(props: SearchProps) {
super(props);
Expand All @@ -112,12 +113,16 @@ class SearchComponent extends React.Component<
clearSearch = () => {
this.setState({ localValue: "" });
this.onDebouncedSearch("");
if (this.inputRef.current) {
this.inputRef.current.focus();
}
};

render() {
return (
<SearchComponentWrapper>
<SearchInputWrapper
inputRef={this.inputRef}
autoFocus={this.props.autoFocus}
className={`${this.props.className} t--search-input`}
leftIcon="search"
Expand Down
11 changes: 10 additions & 1 deletion app/client/src/widgets/MultiSelectTreeWidget/component/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,16 @@ function MultiTreeSelectComponent({
const clearButton = useMemo(
() =>
filter ? (
<Button icon="cross" minimal onClick={() => setFilter("")} />
<Button
icon="cross"
minimal
onClick={() => {
if (inputRef.current) {
inputRef.current.focus();
}
setFilter("");
}}
/>
) : null,
[filter],
);
Expand Down
11 changes: 10 additions & 1 deletion app/client/src/widgets/MultiSelectWidgetV2/component/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,16 @@ function MultiSelectComponent({
const clearButton = useMemo(
() =>
filter ? (
<Button icon="cross" minimal onClick={() => setFilter("")} />
<Button
icon="cross"
minimal
onClick={() => {
if (inputRef.current) {
inputRef.current.focus();
}
setFilter("");
}}
/>
) : null,
[filter],
);
Expand Down
2 changes: 2 additions & 0 deletions app/client/src/widgets/SelectWidget/component/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class SelectComponent extends React.Component<
};

onQueryChange = debounce((filterValue: string) => {
console.log(">> inside query change")
Comment thread
saiprabhu-dandanayak marked this conversation as resolved.
Outdated
if (equal(filterValue, this.props.filterText)) return;
this.props.onFilterChange(filterValue);
this.listRef?.current?.scrollTo(0);
Expand Down Expand Up @@ -409,6 +410,7 @@ class SelectComponent extends React.Component<
onClose: this.handleCloseList,
// onActiveItemChange is called twice abd puts the focus on the first item https://github.com/palantir/blueprint/issues/4192
onOpening: () => {
console.log(">>> opend...")
Comment thread
saiprabhu-dandanayak marked this conversation as resolved.
Outdated
if (!this.props.selectedIndex) {
return this.handleActiveItemChange(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,16 @@ function SingleSelectTreeComponent({
const clearButton = useMemo(
() =>
filter ? (
<Button icon="cross" minimal onClick={() => setFilter("")} />
<Button
icon="cross"
minimal
onClick={() => {
if (inputRef.current) {
inputRef.current.focus();
}
setFilter("");
}}
/>
) : null,
[filter],
);
Expand Down