Implement ComboRegionsSearch
This commit is contained in:
parent
1b57d94d93
commit
2c7ee82d31
3 changed files with 27 additions and 4 deletions
21
app/javascript/components/ComboRegionsSearch.js
Normal file
21
app/javascript/components/ComboRegionsSearch.js
Normal 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;
|
3
app/javascript/loaders/ComboRegionsSearch.js
Normal file
3
app/javascript/loaders/ComboRegionsSearch.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import Loadable from '../components/Loadable';
|
||||||
|
|
||||||
|
export default Loadable(() => import('../components/ComboRegionsSearch'));
|
|
@ -1,4 +1,3 @@
|
||||||
= form.select :value, [champ.value].compact,
|
- hidden_field_id = SecureRandom.uuid
|
||||||
{ include_blank: true },
|
= form.hidden_field :value, { data: { uuid: hidden_field_id } }
|
||||||
required: champ.mandatory?,
|
= react_component("ComboRegionsSearch", mandatory: champ.mandatory?, hiddenFieldId: hidden_field_id)
|
||||||
class: 'select2 regions'
|
|
||||||
|
|
Loading…
Reference in a new issue