Implement ComboRegionsSearch

This commit is contained in:
Paul Chavard 2020-10-07 17:41:51 +02:00
parent 1b57d94d93
commit 2c7ee82d31
3 changed files with 27 additions and 4 deletions

View file

@ -0,0 +1,21 @@
import React from 'react';
import { ReactQueryCacheProvider } from 'react-query';
import ComboSearch from './ComboSearch';
import { queryCache } from './shared/queryCache';
function ComboRegionsSearch(params) {
return (
<ReactQueryCacheProvider queryCache={queryCache}>
<ComboSearch
required={params.mandatory}
hiddenFieldId={params.hiddenFieldId}
scope="regions"
minimumInputLength={0}
transformResult={({ code, nom }) => [code, nom]}
/>
</ReactQueryCacheProvider>
);
}
export default ComboRegionsSearch;

View file

@ -0,0 +1,3 @@
import Loadable from '../components/Loadable';
export default Loadable(() => import('../components/ComboRegionsSearch'));

View file

@ -1,4 +1,3 @@
= form.select :value, [champ.value].compact,
{ include_blank: true },
required: champ.mandatory?,
class: 'select2 regions'
- hidden_field_id = SecureRandom.uuid
= form.hidden_field :value, { data: { uuid: hidden_field_id } }
= react_component("ComboRegionsSearch", mandatory: champ.mandatory?, hiddenFieldId: hidden_field_id)