Skip to content

Commit

Permalink
feat: add visible option for WfsSearchField
Browse files Browse the repository at this point in the history
  • Loading branch information
simonseyock committed May 15, 2024
1 parent 698d913 commit a26f844
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Field/WfsSearchField/WfsSearchField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export type WfsSearchFieldProps = {
onBeforeSearch?: (value: string) => string;
onChange?: (val: OlFeature[] | undefined) => undefined;
value?: OlFeature[] | undefined;
visible?: boolean;
} & SearchConfig & Omit<WfsQueryArgs, 'searchConfig' | 'searchTerm'> & Omit<AutoCompleteProps, 'onChange'>;

const defaultClassName = `${CSS_PREFIX}wfssearch`;
Expand Down Expand Up @@ -63,6 +64,7 @@ export const WfsSearchField: FC<WfsSearchFieldProps> = ({
wfsFormatOptions,
onFetchError,
onFetchSuccess,
visible,
...passThroughProps
}) => {

Expand Down Expand Up @@ -228,6 +230,10 @@ export const WfsSearchField: FC<WfsSearchFieldProps> = ({
);
}

if (!visible) {
return null;
}

return (
<AutoComplete<string>
allowClear={true}
Expand Down

0 comments on commit a26f844

Please sign in to comment.