Skip to content

Releases: MrWolfZ/ngrx-forms

6.1.0

24 Nov 17:15
Compare
Choose a tag to compare

Features

  • add support for local form states outside of the ngrx store (#166), closes #165, see the user guide for more details, thanks @mucaho for implementing this great feature

6.0.0

19 Nov 16:40
Compare
Choose a tag to compare

This major release contains only a bugfix which is a breaking change.

Breaking Changes

  • do not treat empty strings or arrays as an error in minLength validation function (#164), thanks @Sloff for reporting and fixing this bug

    If you require these values to be treated as errors use minLength together with required (e.g. validate(required, minLength(2)))

5.2.3

28 Oct 16:13
Compare
Choose a tag to compare

Bugfixes

  • use project tsconfig.json with ng-packagr during build; this bug lead to incorrect type definitions (#163), thanks @tomvandezande for reporting and fixing this bug

Note: version 5.2.2 is skipped due to an invalid package having been published.

5.2.1

12 Jul 17:05
Compare
Choose a tag to compare

Bugfixes

  • ensure form states are correctly updated from actions when using onNgrxFormsAction with onNgrxForms (ee5dccf)

5.2.0

11 Jul 16:45
Compare
Choose a tag to compare

Features

  • add function onNgrxFormsAction that allows specifying a reducer for ngrx-forms actions with createReducer 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

07 Jul 16:04
Compare
Choose a tag to compare

Features

  • add functions onNgrxForms and wrapReducerWithFormStateUpdate to allow better integration with createReducer from ngrx 8 (ac95be2), closes #147

    They 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

  • allow setting async errors if the validation is not pending (3f5c6d0)
  • allow clearing async errors on groups and arrays if the validation is not pending (ff13472)

5.0.3

07 Jul 11:08
Compare
Choose a tag to compare

Bugfixes

  • remove readonly modifier from array control state value (28e781c), thanks @dzonatan for reporting this bug, closes #155

5.0.2

08 Jun 19:05
Compare
Choose a tag to compare

This is a follow-up fix to version 5.0.1 which did not completely fix #153.

Bugfixes

  • remove direct reference to Event since that causes errors in NativeScript applications (1ac565a), thanks @bufke for reporting this bug, closes #153

5.0.1

08 Jun 15:28
Compare
Choose a tag to compare

Bugfixes

  • remove any references to UIEvent since that causes errors in NativeScript applications (70cdbc2), thanks @bufke for reporting this bug, closes #153

5.0.0

02 Jun 06:35
Compare
Choose a tag to compare

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 and Unboxed 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 and Unboxed types (255c648)

Bugfixes

  • allow enabling empty disabled array states (8a33d12), thanks @nihique for reporting this bug, closes #149