mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2024-12-24 00:01:36 +01:00
Merge branch 'form-reference' into 'dev'
Added reference to form element. See merge request turris/reforis/foris-js!86
This commit is contained in:
commit
01fb897180
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "foris",
|
"name": "foris",
|
||||||
"version": "3.3.0",
|
"version": "3.4.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "foris",
|
"name": "foris",
|
||||||
"version": "3.3.0",
|
"version": "3.4.0",
|
||||||
"description": "Set of components and utils for Foris and its plugins.",
|
"description": "Set of components and utils for Foris and its plugins.",
|
||||||
"author": "CZ.NIC, z.s.p.o.",
|
"author": "CZ.NIC, z.s.p.o.",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -39,19 +39,21 @@ ForisForm.propTypes = {
|
||||||
wsAction: PropTypes.string,
|
wsAction: PropTypes.string,
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
/** Function to prepare data recived from the API before using in forms. */
|
/** Function to prepare data recived from the API before using in forms. */
|
||||||
prepData: PropTypes.func.isRequired,
|
prepData: PropTypes.func,
|
||||||
/** Function to prepare data from form before submitting. */
|
/** Function to prepare data from form before submitting. */
|
||||||
prepDataToSubmit: PropTypes.func.isRequired,
|
prepDataToSubmit: PropTypes.func,
|
||||||
/** Function to handle response to POST request. */
|
/** Function to handle response to POST request. */
|
||||||
postCallback: PropTypes.func.isRequired,
|
postCallback: PropTypes.func,
|
||||||
/** Validate data and provide validation object. Then validation errors passed to children. */
|
/** Validate data and provide validation object. Then validation errors passed to children. */
|
||||||
validator: PropTypes.func.isRequired,
|
validator: PropTypes.func,
|
||||||
/** Disables form */
|
/** Disables form */
|
||||||
disabled: PropTypes.bool,
|
disabled: PropTypes.bool,
|
||||||
/** reForis form components. */
|
|
||||||
children: PropTypes.node.isRequired,
|
|
||||||
/** Optional override of form submit callback */
|
/** Optional override of form submit callback */
|
||||||
onSubmitOverridden: PropTypes.func,
|
onSubmitOverridden: PropTypes.func,
|
||||||
|
/** Optional override of form submit callback */
|
||||||
|
formReference: PropTypes.object,
|
||||||
|
/** reForis form components. */
|
||||||
|
children: PropTypes.node.isRequired,
|
||||||
|
|
||||||
// eslint-disable-next-line react/no-unused-prop-types
|
// eslint-disable-next-line react/no-unused-prop-types
|
||||||
customWSProp(props) {
|
customWSProp(props) {
|
||||||
|
@ -88,6 +90,7 @@ export function ForisForm({
|
||||||
validator,
|
validator,
|
||||||
disabled,
|
disabled,
|
||||||
onSubmitOverridden,
|
onSubmitOverridden,
|
||||||
|
formReference,
|
||||||
children,
|
children,
|
||||||
}) {
|
}) {
|
||||||
const [formState, onFormChangeHandler, resetFormData] = useForm(validator, prepData);
|
const [formState, onFormChangeHandler, resetFormData] = useForm(validator, prepData);
|
||||||
|
@ -163,7 +166,7 @@ export function ForisForm({
|
||||||
return (
|
return (
|
||||||
<div className={formFieldsSize}>
|
<div className={formFieldsSize}>
|
||||||
<Prompt message={getMessageOnLeavingPage} />
|
<Prompt message={getMessageOnLeavingPage} />
|
||||||
<form onSubmit={onSubmit}>
|
<form onSubmit={onSubmit} ref={formReference}>
|
||||||
{childrenWithFormProps}
|
{childrenWithFormProps}
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
<SubmitButton
|
<SubmitButton
|
||||||
|
|
Loading…
Reference in New Issue
Block a user