@felte/core
Advanced tools
Comparing version 1.0.0-next.2 to 1.0.0-next.3
@@ -514,2 +514,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) { | ||
@@ -574,2 +587,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) { | ||
@@ -626,2 +655,3 @@ const initialValue = _get(initialValues, path); | ||
resetField, | ||
addField, | ||
setInitialValues: (values) => { | ||
@@ -628,0 +658,0 @@ initialValues = values; |
{ | ||
"name": "@felte/core", | ||
"version": "1.0.0-next.2", | ||
"version": "1.0.0-next.3", | ||
"description": "Core package for FelteJS", | ||
@@ -27,3 +27,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@felte/common": "1.0.0-next.1" | ||
"@felte/common": "1.0.0-next.2" | ||
}, | ||
@@ -30,0 +30,0 @@ "publishConfig": { |
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
273420
2340
+ Added@felte/common@1.0.0-next.2(transitive)
- Removed@felte/common@1.0.0-next.1(transitive)
Updated@felte/common@1.0.0-next.2