Comparing version 0.24.0 to 1.0.0
@@ -74,6 +74,6 @@ import { ComposibleValidatable, Validator } from './types'; | ||
/** | ||
* If the page wants to reinitialize the field with a new value, | ||
* If the page wants to reinitialize the field, | ||
* it should call this function | ||
*/ | ||
reinitValue: (value?: TValue) => void; | ||
reset: (value?: TValue) => void; | ||
readonly hasError: boolean; | ||
@@ -80,0 +80,0 @@ validating: boolean; |
@@ -105,6 +105,6 @@ "use strict"; | ||
/** | ||
* If the page wants to reinitialize the field with a new value, | ||
* If the page wants to reinitialize the field, | ||
* it should call this function | ||
*/ | ||
this.reinitValue = function (value) { | ||
this.reset = function (value) { | ||
if (value === void 0) { value = _this._initValue; } | ||
@@ -283,3 +283,3 @@ // If a previous validation comes back ignore it | ||
mobx_1.action | ||
], FieldState.prototype, "reinitValue", void 0); | ||
], FieldState.prototype, "reset", void 0); | ||
__decorate([ | ||
@@ -286,0 +286,0 @@ mobx_1.observable |
@@ -70,2 +70,6 @@ import { ComposibleValidatable, Validator } from './types'; | ||
/** | ||
* Resets all the fields in the form | ||
*/ | ||
reset: () => void; | ||
/** | ||
* Auto validation | ||
@@ -72,0 +76,0 @@ */ |
@@ -77,2 +77,8 @@ "use strict"; | ||
/** | ||
* Resets all the fields in the form | ||
*/ | ||
this.reset = function () { | ||
_this.getValues().map(function (v) { return v.reset(); }); | ||
}; | ||
/** | ||
* Auto validation | ||
@@ -301,2 +307,5 @@ */ | ||
__decorate([ | ||
mobx_1.action | ||
], FormState.prototype, "reset", void 0); | ||
__decorate([ | ||
mobx_1.observable | ||
@@ -303,0 +312,0 @@ ], FormState.prototype, "autoValidationEnabled", void 0); |
@@ -32,2 +32,4 @@ /** A truthy string or falsy values */ | ||
export interface ComposibleValidatable<TValue> extends Validatable<TValue> { | ||
/** Allows a convinient reset for all fields */ | ||
reset: () => void; | ||
/** Used to tell the parent about validation */ | ||
@@ -34,0 +36,0 @@ on$ChangeAfterValidation: () => void; |
{ | ||
"name": "formstate", | ||
"version": "0.24.0", | ||
"version": "1.0.0", | ||
"description": "Painless and simple MobX form management", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -133,6 +133,6 @@ import { observable, action, computed, runInAction } from 'mobx'; | ||
/** | ||
* If the page wants to reinitialize the field with a new value, | ||
* If the page wants to reinitialize the field, | ||
* it should call this function | ||
*/ | ||
@action reinitValue = (value: TValue = this._initValue) => { | ||
@action reset = (value: TValue = this._initValue) => { | ||
// If a previous validation comes back ignore it | ||
@@ -139,0 +139,0 @@ this.preventNextQueuedValidation = true; |
@@ -141,2 +141,9 @@ import { observable, action, computed, runInAction, isObservable, isArrayLike } from 'mobx'; | ||
/** | ||
* Resets all the fields in the form | ||
*/ | ||
@action reset = () => { | ||
this.getValues().map(v => v.reset()); | ||
} | ||
/** | ||
* Auto validation | ||
@@ -143,0 +150,0 @@ */ |
@@ -78,2 +78,5 @@ import * as utils from '../internal/utils'; | ||
export interface ComposibleValidatable<TValue> extends Validatable<TValue> { | ||
/** Allows a convinient reset for all fields */ | ||
reset: () => void; | ||
/** Used to tell the parent about validation */ | ||
@@ -80,0 +83,0 @@ on$ChangeAfterValidation: () => void; |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
75429
2031
0
28