-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚧 [#5016] Referentielijsten dataSrc for options
- Loading branch information
Showing
10 changed files
with
235 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {useFormikContext} from 'formik'; | ||
import {FormattedMessage, useIntl} from 'react-intl'; | ||
|
||
import {TextField} from '@/components/formio'; | ||
|
||
const NAME = 'openForms.code'; | ||
|
||
/** | ||
* The `ReferentielijstenTabelCode` component is used to specify the code of the tabel | ||
* in Referentielijsten API for which the items will be fetched | ||
*/ | ||
export const ReferentielijstenTabelCode: React.FC = () => { | ||
const intl = useIntl(); | ||
const {setFieldValue} = useFormikContext(); | ||
const name = `editform-${NAME}`; | ||
return ( | ||
<TextField | ||
name={name} | ||
label={ | ||
<FormattedMessage | ||
description="Label for 'openForms.code' builder field" | ||
defaultMessage="Referentielijsten table code" | ||
/> | ||
} | ||
tooltip={intl.formatMessage({ | ||
description: "Description for the 'openForms.code' builder field", | ||
defaultMessage: `The code of the table from which the options will be retrieved.`, | ||
})} | ||
onChange={event => setFieldValue(NAME, event.target.value)} | ||
/> | ||
); | ||
}; | ||
|
||
export default ReferentielijstenTabelCode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* Components to manage options/values for fields that support this, such as: | ||
* | ||
* - select | ||
* - selectboxes | ||
* - radio | ||
*/ | ||
export {default as ReferentielijstenService} from './service'; | ||
export {default as ReferentielijstenTabelCode} from './code'; |
42 changes: 42 additions & 0 deletions
42
src/components/builder/values/referentielijsten/service.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import {useFormikContext} from 'formik'; | ||
import {FormattedMessage, useIntl} from 'react-intl'; | ||
|
||
import {Select} from '@/components/formio'; | ||
|
||
const NAME = 'openForms.service'; | ||
|
||
/** | ||
* The `ReferentielijstenService` component is used to specify the slug of the service | ||
* that is used to retrieve options from | ||
*/ | ||
export const ReferentielijstenService: React.FC = () => { | ||
const intl = useIntl(); | ||
const {setFieldValue} = useFormikContext(); | ||
const name = `editform-${NAME}`; | ||
return ( | ||
<Select | ||
name={name} | ||
label={ | ||
<FormattedMessage | ||
description="Label for 'openForms.service' builder field" | ||
defaultMessage="Referentielijsten service" | ||
/> | ||
} | ||
tooltip={intl.formatMessage({ | ||
description: "Description for the 'openForms.service' builder field", | ||
defaultMessage: `The identifier of the Referentielijsten service from which the options will be retrieved.`, | ||
})} | ||
onChange={event => setFieldValue(NAME, event.target.value)} | ||
isClearable | ||
// TODO should be dynamic | ||
options={[ | ||
{label: 'Foo', value: 'foo'}, | ||
{label: 'Bar', value: 'bar'}, | ||
]} | ||
valueProperty="value" | ||
emptyValue="" | ||
/> | ||
); | ||
}; | ||
|
||
export default ReferentielijstenService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters