@felte/react
Advanced tools
Comparing version 1.0.0-next.2 to 1.0.0-next.3
@@ -568,2 +568,15 @@ 'use strict'; | ||
function addAtIndex(storeValue, path, value, index) { | ||
return _update(storeValue, path, (oldValue) => { | ||
if (!Array.isArray(oldValue)) | ||
return oldValue; | ||
if (typeof index === 'undefined') { | ||
oldValue.push(value); | ||
} | ||
else { | ||
oldValue.splice(index, 0, value); | ||
} | ||
return oldValue; | ||
}); | ||
} | ||
function isUpdater(value) { | ||
@@ -628,2 +641,18 @@ return typeof value === 'function'; | ||
} | ||
function addField(path, value, index) { | ||
errors.update(($errors) => { | ||
return addAtIndex($errors, path, null, index); | ||
}); | ||
warnings.update(($warnings) => { | ||
return addAtIndex($warnings, path, null, index); | ||
}); | ||
touched.update(($touched) => { | ||
return addAtIndex($touched, path, false, index); | ||
}); | ||
data.update(($data) => { | ||
const newData = addAtIndex($data, path, value, index); | ||
setTimeout(() => formNode && setForm(formNode, newData)); | ||
return newData; | ||
}); | ||
} | ||
function resetField(path) { | ||
@@ -680,2 +709,3 @@ const initialValue = _get(initialValues, path); | ||
resetField, | ||
addField, | ||
setInitialValues: (values) => { | ||
@@ -682,0 +712,0 @@ initialValues = values; |
{ | ||
"name": "@felte/react", | ||
"version": "1.0.0-next.2", | ||
"version": "1.0.0-next.3", | ||
"description": "An extensible form library for ReactJS", | ||
@@ -29,3 +29,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@felte/core": "1.0.0-next.2", | ||
"@felte/core": "1.0.0-next.3", | ||
"svelte": "^3.44.3" | ||
@@ -40,3 +40,3 @@ }, | ||
"devDependencies": { | ||
"@felte/common": "1.0.0-next.1", | ||
"@felte/common": "1.0.0-next.2", | ||
"@testing-library/jest-dom": "^5.11.9", | ||
@@ -43,0 +43,0 @@ "@testing-library/react-hooks": "^7.0.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
491346
2687
+ Added@felte/common@1.0.0-next.2(transitive)
+ Added@felte/core@1.0.0-next.3(transitive)
- Removed@felte/common@1.0.0-next.1(transitive)
- Removed@felte/core@1.0.0-next.2(transitive)
Updated@felte/core@1.0.0-next.3