factorial-form
Advanced tools
Comparing version 3.3.0 to 3.3.1
@@ -103,2 +103,16 @@ declare type Type = 'date' | 'timestamp' | 'number' | 'string' | 'file' | 'boolean' | 'cents' | 'any'; | ||
handleErrors(fn: () => Promise<any>): Promise<any>; | ||
/** | ||
* whether if any of the fields have an error | ||
*/ | ||
get hasErrors(): Boolean; | ||
/** | ||
* returns an array of strings with the keys | ||
* of the fields that are dirty | ||
*/ | ||
get dirtyFieldsKeys(): string[]; | ||
/** | ||
* returns an array of strings with the keys | ||
* of the fields that has value | ||
*/ | ||
get fieldsWithValueKeys(): string[]; | ||
} | ||
@@ -105,0 +119,0 @@ |
@@ -89,2 +89,19 @@ 'use strict'; | ||
function __read(o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
} | ||
/** | ||
@@ -248,3 +265,6 @@ * Support any input that may contains decimals | ||
isDirty: mobx.computed, | ||
serialized: mobx.computed | ||
serialized: mobx.computed, | ||
hasErrors: mobx.computed, | ||
dirtyFieldsKeys: mobx.computed, | ||
fieldsWithValueKeys: mobx.computed, | ||
}); | ||
@@ -411,2 +431,50 @@ } | ||
}; | ||
Object.defineProperty(Form.prototype, "hasErrors", { | ||
/** | ||
* whether if any of the fields have an error | ||
*/ | ||
get: function () { | ||
return some__default['default'](this.fields, function (field) { return field.errors !== null; }); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(Form.prototype, "dirtyFieldsKeys", { | ||
/** | ||
* returns an array of strings with the keys | ||
* of the fields that are dirty | ||
*/ | ||
get: function () { | ||
return Object.entries(this.fields) | ||
.filter(function (_a) { | ||
var _b = __read(_a, 2); _b[0]; var field = _b[1]; | ||
return field.isDirty; | ||
}) | ||
.map(function (_a) { | ||
var _b = __read(_a, 2), key = _b[0]; _b[1]; | ||
return key; | ||
}); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(Form.prototype, "fieldsWithValueKeys", { | ||
/** | ||
* returns an array of strings with the keys | ||
* of the fields that has value | ||
*/ | ||
get: function () { | ||
return Object.entries(this.fields) | ||
.filter(function (_a) { | ||
var _b = __read(_a, 2); _b[0]; var field = _b[1]; | ||
return field.hasValue; | ||
}) | ||
.map(function (_a) { | ||
var _b = __read(_a, 2), key = _b[0]; _b[1]; | ||
return key; | ||
}); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
return Form; | ||
@@ -413,0 +481,0 @@ }()); |
{ | ||
"name": "factorial-form", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"description": "Factorial form library", | ||
@@ -5,0 +5,0 @@ "repository": { |
44913
1169