factorial-form
Advanced tools
Comparing version 2.1.1 to 2.1.2
# Changelog | ||
## `2.1.2` | ||
- Fixes last release. It was not published correctly due to bug in tslib. | ||
## `2.1.1` | ||
@@ -4,0 +8,0 @@ |
@@ -22,2 +22,3 @@ declare type Type = 'date' | 'timestamp' | 'number' | 'string' | 'file' | 'boolean' | 'cents' | 'any'; | ||
clean(): void; | ||
reset(): void; | ||
setErrors(errors: Array<string> | null): void; | ||
@@ -55,2 +56,3 @@ } | ||
constructor(values: Values, schema: Schema); | ||
get serialized(): Values; | ||
data(): Values; | ||
@@ -60,7 +62,12 @@ has(attribute: string): boolean; | ||
/** | ||
* Cleans all the forms by reseting their original | ||
* values | ||
* Cleans all the forms by changing their original | ||
* values to correspond to their current values | ||
*/ | ||
cleanAll(): void; | ||
/** | ||
* Reset all the forms to their original | ||
* values thereby discarding all changes made | ||
*/ | ||
resetAll(): void; | ||
/** | ||
* Resets all the error fields | ||
@@ -67,0 +74,0 @@ */ |
@@ -199,2 +199,5 @@ 'use strict'; | ||
}; | ||
Field.prototype.reset = function () { | ||
this.value = this.originalValue; | ||
}; | ||
Field.prototype.setErrors = function (errors) { | ||
@@ -225,7 +228,16 @@ this.errors = errors; | ||
values: mobx.computed, | ||
isDirty: mobx.computed | ||
isDirty: mobx.computed, | ||
serialized: mobx.computed | ||
}); | ||
} | ||
Object.defineProperty(Form.prototype, "serialized", { | ||
get: function () { | ||
return flat__default['default'].unflatten(mapValues__default['default'](this.fields, function (field) { return field._mapOut(); })); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
// @deprecated | ||
Form.prototype.data = function () { | ||
return flat__default['default'].unflatten(mapValues__default['default'](this.fields, function (field) { return field._mapOut(); })); | ||
return this.serialized; | ||
}; | ||
@@ -242,4 +254,4 @@ Form.prototype.has = function (attribute) { | ||
/** | ||
* Cleans all the forms by reseting their original | ||
* values | ||
* Cleans all the forms by changing their original | ||
* values to correspond to their current values | ||
*/ | ||
@@ -252,2 +264,11 @@ Form.prototype.cleanAll = function () { | ||
/** | ||
* Reset all the forms to their original | ||
* values thereby discarding all changes made | ||
*/ | ||
Form.prototype.resetAll = function () { | ||
forEach__default['default'](this.fields, function (field) { | ||
return field.reset(); | ||
}); | ||
}; | ||
/** | ||
* Resets all the error fields | ||
@@ -254,0 +275,0 @@ */ |
{ | ||
"name": "factorial-form", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Factorial form library", | ||
@@ -39,3 +39,3 @@ "repository": { | ||
"ts-jest": "27.0.3", | ||
"tslib": "2.3.0", | ||
"tslib": "2.3.1", | ||
"typescript": "4.3.2" | ||
@@ -42,0 +42,0 @@ }, |
40717
1000