All notable changes to this project will be documented in this file.
withValidation
has been removed, use the new hookuseValiation
insteadwithField
has been deprecated, use the new hookuseField
instead- removed some utils that were not intended for public use
- default empty value of a field is now undefined instead of an empty string
- Added
useValidation
hook as replacement forwithValidation
- Added
useField
hook as replacement forwithField
- Added
useFormEventListener
hook for easy access to form events - Added
useFormText
hook for easy access to form formatted texts - Added
reset
toFormContext
- The
Form
will now throw an error if a duplicate field name is used.
- Bugfix: stop event propagation of
submit
andreset
form events
- Added
useFormContext
hook for easy access to the form context - Added
validators.withAsyncParam
wrapper function to call async validators with parameters - Added
disabled
andplaintext
props toField
to override global form state locally - Added
disabled
andplaintext
props toFieldGroup
to override global form state locally
- Migrated to react 16.8 to enable hooks functionality
- Deprecated
withForm
-useFormContext
- Bugfix: Added
null
as allowed return type forForm.onValidate
callback
- Re-relase due to npm publish issue
- Migrated to rollup to improve package size and tree shaking
- Fixed typing issue with
validators
in typescript 3.2+
- Made production package size smaller
- Enabled tree shaking
- Fixed a bug where a valid result in
Form.onValidate
(for example result{ testField: undefined }
) would be treated as invalid - Fixed a bug where the
ValidationWrapper
would always ignoreasyncValidationWait
- Added prop
resetOnSubmit
toForm
. When set to true, the form will trigger a form reset after a successful submit. Default setting: false - Added option for custom required validators. The form will now recognize a custom required validator if a synchronous validator is tagged with
isDefaultValidator = true
- Added prop
busy
toForm
. This allows to force the form into a busy state. Useful for example to disable the form buttons during data loading.
Changed default usage of form fields
In order to provide the best typescript experience we had to ditch the conect of <Field component={Input}>
. From version 2.0.0 onwards the field component is used directly, e.g.: <Input name="demo" label="Demo Input" />
. The field component will still accept the field props. Developers who want to make their own field components now need to wrap those with the new withField
higher order component. A full migration guide will be available soon.
- Removed deprecated
Form.onFieldValueChanged
callback - Fixed a bug where a form field would revert its value to '' if its current value evaulated to value == false.
- Added
isRequired
to field meta. It is true if the field / input component contains a required validator.
- Changed behaviour of
defaultValues
- the Field value will only be overwritten if the Field isn't touched - Added
values
toForm
- basically they behave like the old defaultValues, but will override any defaultValues if present
- Added
FormText
component, a wrapper forformContext.stringFormatter
- Added
defaultValue
toField
- it will override thedefaultValues
of the Form - Added
value
toField
- it will override thevalues
of the Form - Added
defaultValues
toFieldGroup
- it will override thedefaultValues
of the Form - Added
values
toFieldGroup
- it will override thevalues
of the Form - Fixed missing id field to
fieldShape
- Improved error message when trying to use Fields or FieldGroups outside of a form
- Support for async onSubmit callback, will keep the form busy until the Promise resolves
- Added submit callback to form context, which will trigger the form submit handler
- Added
FormButton
- Fixed a bug where the state of an unmounted Field has been set
- Added displayName props
- Removed unsupported info prop on Input (only supported in
react-ocean-forms-bootstrap
input)
- Fixed a bug where getDisplayValue wasn't called when the form plaintext or disabled state changed
- Changed listener logic of the form context to make it usable in more use cases:
- context.registerListener now needs a callback function as second parameter
- the listener callback will be called with fieldName, eventName and eventArgs (added eventName)
- Added onChange and onBlur callback to Field
- Added className to Form, which will be mapped to the html form
- Added plaintext mode to Form, which only displays the plaintext value
- Added getDisplayValue and getSubmitValue lifecycle hooks to Field
- Initial release of the current code base