2020-10-07 17:44:04 +02:00
|
|
|
import React, { useCallback } from 'react';
|
2021-02-16 13:54:16 +01:00
|
|
|
import { QueryClientProvider } from 'react-query';
|
2020-10-07 17:44:04 +02:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import ComboSearch from './ComboSearch';
|
2021-02-16 13:54:16 +01:00
|
|
|
import { queryClient } from './shared/queryClient';
|
2020-10-07 17:44:04 +02:00
|
|
|
|
|
|
|
function ComboAdresseSearch({
|
|
|
|
transformResult = ({ properties: { label } }) => [label, label],
|
2021-05-06 18:51:19 +02:00
|
|
|
allowInputValues = true,
|
2022-01-05 11:34:43 +01:00
|
|
|
...props
|
2020-10-07 17:44:04 +02:00
|
|
|
}) {
|
|
|
|
const transformResults = useCallback((_, { features }) => features);
|
|
|
|
|
|
|
|
return (
|
2021-02-16 13:54:16 +01:00
|
|
|
<QueryClientProvider client={queryClient}>
|
2020-10-07 17:44:04 +02:00
|
|
|
<ComboSearch
|
|
|
|
allowInputValues={allowInputValues}
|
|
|
|
scope="adresse"
|
|
|
|
minimumInputLength={2}
|
|
|
|
transformResult={transformResult}
|
|
|
|
transformResults={transformResults}
|
2022-01-05 11:34:43 +01:00
|
|
|
{...props}
|
2020-10-07 17:44:04 +02:00
|
|
|
/>
|
2021-02-16 13:54:16 +01:00
|
|
|
</QueryClientProvider>
|
2020-10-07 17:44:04 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
ComboAdresseSearch.propTypes = {
|
|
|
|
transformResult: PropTypes.func,
|
2022-01-05 11:34:43 +01:00
|
|
|
allowInputValues: PropTypes.bool
|
2020-10-07 17:44:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export default ComboAdresseSearch;
|