Releases: MrWolfZ/ngrx-forms
Releases · MrWolfZ/ngrx-forms
6.1.0
6.0.0
This major release contains only a bugfix which is a breaking change.
Breaking Changes
5.2.3
5.2.1
5.2.0
Features
-
add function
onNgrxFormsAction
that allows specifying a reducer for ngrx-forms actions withcreateReducer
from ngrx 8 (5cdf9c6)It can be used as follows:
import { createReducer } from '@ngrx/store'; import { onNgrxForms, onNgrxFormsAction, SetValueAction, updateGroup, validate, wrapReducerWithFormStateUpdate, } from 'ngrx-forms'; import { required } from 'ngrx-forms/validation'; export interface LoginFormValue { username: string; password: string; stayLoggedIn: boolean; } export const initialLoginFormValue: LoginFormValue = { username: '', password: '', stayLoggedIn: false, }; export const validateLoginForm = updateGroup<LoginFormValue>({ username: validate(required), password: validate(required), }); const reducer = createReducer( { loginForm: createFormGroupState('loginForm', initialLoginFormValue), // your other properties... }, onNgrxForms(), // use this to call a reducer for a specific ngrx-forms action; // note that this must be placed after onNgrxForms onNgrxFormsAction(SetValueAction, (state, action) => { if (action.controlId === 'loginForm.username') { // react to username changing... // action is of type SetValueAction } return state; }), // your other reducers... );
5.1.0
Features
-
add functions
onNgrxForms
andwrapReducerWithFormStateUpdate
to allow better integration withcreateReducer
from ngrx 8 (ac95be2), closes #147They can be used as follows:
import { createReducer } from '@ngrx/store'; import { onNgrxForms, updateGroup, validate, wrapReducerWithFormStateUpdate } from 'ngrx-forms'; import { required } from 'ngrx-forms/validation'; export interface LoginFormValue { username: string; password: string; stayLoggedIn: boolean; } export const initialLoginFormValue: LoginFormValue = { username: '', password: '', stayLoggedIn: false, }; export const validateLoginForm = updateGroup<LoginFormValue>({ username: validate(required), password: validate(required), }); const rawReducer = createReducer( { loginForm: createFormGroupState('loginForm', initialLoginFormValue), // your other properties... }, onNgrxForms(), // your other reducers... ); // wrapReducerWithFormStateUpdate calls the update function // after the given reducer; you can wrap this reducer again // if you have multiple forms in your state export const reducer = wrapReducerWithFormStateUpdate( rawReducer, // point to the form state to update s => s.loginForm, // this function is always called after the reducer validateLoginForm, );
-
add update functions for async validations (8985e99)
-
export constant
ALL_NGRX_FORMS_ACTION_TYPES
that is an array of all action types ngrx-forms provides (09aad36)
Bugfixes
5.0.3
5.0.2
5.0.1
5.0.0
This is a compatibility release for Angular 8 and TypeScript 3.4.
Breaking Changes
- update peer dependencies to require Angular
>=8.0.0
- update peer dependencies to require TypeScript
>=3.4.0
Features
- refactor
FormState
andUnboxed
conditional type definitions to be simpler, which can improve build times and IDE performance (e9f504b), (24b25db)
Build Improvements
- switch to ng-packagr for building the library (2d126c5)
- add dtslint tests to ensure stability of
FormState
andUnboxed
types (255c648)