Releases: Andrei15193/react-model-view-viewmodel
3.0.0
This release is focused mostly on revamping the form model and providing a complete implementation for observable collections, along side observable sets and observable maps.
After using the library in more complex ways, I have managed to distill the form definitions and provide a better implementation that allows for just about any level of complexity without having to know about all features.
Using forms is as simple as it needs to be depending on the use case. If you have a simple form and need a bunch of fields, then all you would do is define the form and initialize the fields.
Validation has been revamped as well, making it easier to add and remove validators along side triggers which have been extended to include collection changed triggers (all observable collections are supported) as well as collection item changes in case there is need to validate for uniqueness of a field value or check if individual amounts in a list of items sum up to the total.
Documentation is now being generated using typedoc, check the wiki, a lot has been added especially to the Form class.
Breaking Changes
- Everything related to forms has breaking changes, please take a migration effort into consideration when switching to this version
- Collections no longer use spread operator when initializing with items, an iterable is being used as an optional parameter.
- A number of hooks have been updated or removed.
- The
input
component has been removed. - Event handler type definitions have been updated to include type-safety using generics.
Summary
- New form model.
- New validation model (including triggers).
- Improved observable collection, see Splice for All (React MVVM Version 3 Proposal) for more information.
- ObservableMap and ObservableSet have joined the collections.
- Improved event and event handler interfaces, see More Type-Safety (React MVVM Version 3 Proposal) for more information.
- A dependency resolver implementation has been added, see IDependencyContainer and Dependency Resolver (React MVVM Version 3 Proposal) for more information.
3.0.0-rc.1
This release is focused mostly on revamping the form model and providing a complete implementation for observable collections, along side observable sets and observable maps.
After using the library in more complex ways, I have managed to distill the form definitions and provide a better implementation that allows for just about any level of complexity without having to know about all features.
Using forms is as simple as it needs to be depending on the use case. If you have a simple form and need a bunch of fields, then all you would do is define the form and initialize the fields.
Validation has been revamped as well, making it easier to add and remove validators along side triggers which have been extended to include collection changed triggers (all observable collections are supported) as well as collection item changes in case there is need to validate for uniqueness of a field value or check if individual amounts in a list of items sum up to the total.
Documentation is now being generated using typedoc, check the wiki, a lot has been added especially to the Form class.
Breaking Changes
- Everything related to forms has breaking changes, please take a migration effort into consideration when switching to this version
- Collections no longer use spread operator when initializing with items, an iterable is being used as an optional parameter.
- A number of hooks have been updated or removed.
- The
input
component has been removed. - Event handler type definitions have been updated to include type-safety using generics.
Summary
- New form model.
- New validation model (including triggers).
- Improved observable collection, see Splice for All (React MVVM Version 3 Proposal) for more information.
- ObservableMap and ObservableSet have joined the collections.
- Improved event and event handler interfaces, see More Type-Safety (React MVVM Version 3 Proposal) for more information.
- A dependency resolver implementation has been added, see IDependencyContainer and Dependency Resolver (React MVVM Version 3 Proposal) for more information.
2.2.0
This is more or less a consolidation release. After using the library for a while and encountering different scenarios I have come to the conclusion that some adjustments need to be made to improve it.
Hook Naming and Unification
With this release I am unifying the view model related hooks under useViewModel
for useViewModelType
and watchViewModel
, while useViewModelFactory
is renamed to useViewModelMemo
.
The existing hooks will still work, they have been marked as deprecated and their implementations are now based on the new ones.
For more information, check the wiki.
With this release, all hooks will follow the proper naming conventions, the ones that do not have been marked as deprecated and will be removed with the next major release. For more information see Reusing Logic with Custom Hooks - Hook names always start with use
.
Form Field Flag Deprecations
The .isFocused
and .isTouched
flags have been marked as deprecated. The former is not exactly a UI logic concern, but rather a purely UI presentation concern, the components handle the focus state of the inputs, not the view model. The latter was removed as not all forms may need this and can easily be added back, along side any other desired properties, though form extensibility.
Form Extensibility
Forms have been updated to allow easier extensibility, the base types are still available, however it is easier to have custom fields and reuse/extend the form field collection type.
Fields follow the config-style approach for constructors allowing for instances to be created and have their properties set in one go. This works well with subclasses as the base config interface can be extended to include more fields.
Tutorials
The tutorials are covered as GitHub Discussions as this allows for easier maintenance and long-term support. People can add comments and react. The ToDo list tutorial will be retired along with the repository for it, the tutorials can be run on CodeSandbox.
For more information check the Guides and Tutorials category.
2.2.0-rc.3
Bug Fixes
- Separated
useViewModel
callback overload into separateuseViewModelMemo
hook. There is no guaranteed way of checking whether a function can be used with thenew
operator or not in JavaScript other than attempting a call. This makes it impossible to safely distinguish between the type and callback overload. More information here: https://stackoverflow.com/questions/30758961/how-to-check-if-a-variable-is-an-es6-class-declaration.
2.2.0-rc.2
Bug Fixes
- Fixed
useViewModel
when changing the instance without unmounting the component.
2.2.0-rc.1
This is more or less a consolidation release. After using the library for a while and encountering different scenarios I have come to the conclusion that some adjustments need to be made to improve it.
Hook Naming and Unification
With this release I am unifying the view model related hooks under a single useViewModel
one. The useViewModelType
, useViewModelFactory
, and watchViewModel
hooks have been marked as deprecated and their implementation is now based on the useViewModel
one. They will continue to function the exact same way, however they will be removed with the next major release.
The new useViewModel
hook has 3 overloads, we can now specify deps and constructor arguments (which also act as deps), for more info see the documentation.
All hooks will follow the proper naming conventions, the ones that do not follow the conventions have been marked as deprecated and will be removed with the next major release. For more information see Reusing Logic with Custom Hooks - Hook names always start with use
.
Form Field Flag Deprecations
The .isFocused
and .isTouched
flags have been marked as deprecated. The former is not exactly a UI logic concern, but rather a purely UI presentation concern, the components handle the focus state of the inputs, not the view model. The latter was removed as not all forms may need this and can easily be added back, along side any other desired properties, though form extensibility.
Form Extensibility
Forms have been updated to allow easier extensibility, the base types are still available, however it is easier to have custom fields and reuse/extend the form field collection type.
For more information around the reasoning around these decisions see the Discussions / React [email protected] announcement.
2.1.0
2.0.1
2.0.0
New Features
- Added
ReadOnlyObservableCollection
andObservableCollection
classes
Breaking Changes
- Removed
observableCollection
function in favour of new classes - Added
itemAdded
anditemRemoved
events toINotifyCollectionChanged<TItem>
interface
2.0.0-beta.1
New Features
- Added
ReadOnlyObservableCollection
andObservableCollection
classes
Breaking Changes
- Removed
observableCollection
function in favour of new classes - Added
itemAdded
anditemRemoved
events toINotifyCollectionChanged<TItem>
interface