Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@felte/react

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@felte/react - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

dist/esm/packages/core/dist/esm/packages/common/dist/esm/utils/debounce.js

2

dist/esm/packages/core/dist/esm/create-field.js

@@ -34,3 +34,3 @@ import { isFormControl, isElement } from './packages/common/dist/esm/utils/typeGuards.js';

bubbles: true,
cancelable: true,
composed: true,
});

@@ -37,0 +37,0 @@ control.dispatchEvent(customEvent);

@@ -17,2 +17,3 @@ import { __rest } from './external/.pnpm/tslib@2.3.1/external/tslib/tslib.es6.js';

import { _set } from './packages/common/dist/esm/utils/set.js';
import { debounce } from './packages/common/dist/esm/utils/debounce.js';
import { _defaultsDeep } from './packages/common/dist/esm/utils/defaultsDeep.js';

@@ -273,2 +274,6 @@ import { _isPlainObject } from './packages/common/dist/esm/utils/isPlainObject.js';

function unsetTaggedForRemove(formControls) {
let currentData = get(data);
let currentTouched = get(touched);
let currentErrors = get(errors);
let currentWarnings = get(warnings);
for (const control of formControls.reverse()) {

@@ -290,16 +295,28 @@ if (control.hasAttribute('data-felte-keep-on-remove') &&

}
data.update(($data) => {
return _unset($data, fieldName);
});
touched.update(($touched) => {
return _unset($touched, fieldName);
});
errors.update(($errors) => {
return _unset($errors, fieldName);
});
warnings.update(($warnings) => {
return _unset($warnings, fieldName);
});
currentData = _unset(currentData, fieldName);
currentTouched = _unset(currentTouched, fieldName);
currentErrors = _unset(currentErrors, fieldName);
currentWarnings = _unset(currentWarnings, fieldName);
}
data.set(currentData);
touched.set(currentTouched);
errors.set(currentErrors);
warnings.set(currentWarnings);
}
const updateAddedNodes = debounce(() => {
_getCurrentExtenders().forEach((extender) => { var _a; return (_a = extender.destroy) === null || _a === void 0 ? void 0 : _a.call(extender); });
_setCurrentExtenders(extender.map(callExtender('UPDATE')));
const { defaultData: newDefaultData, defaultTouched: newDefaultTouched, } = getFormDefaultValues(node);
data.update(($data) => _defaultsDeep($data, newDefaultData));
touched.update(($touched) => {
return _defaultsDeep($touched, newDefaultTouched);
});
}, 0);
let removedFormControls = [];
const updateRemovedNodes = debounce(() => {
_getCurrentExtenders().forEach((extender) => { var _a; return (_a = extender.destroy) === null || _a === void 0 ? void 0 : _a.call(extender); });
_setCurrentExtenders(extender.map(callExtender('UPDATE')));
unsetTaggedForRemove(removedFormControls);
removedFormControls = [];
}, 0);
function mutationCallback(mutationList) {

@@ -320,9 +337,3 @@ for (const mutation of mutationList) {

continue;
_getCurrentExtenders().forEach((extender) => { var _a; return (_a = extender.destroy) === null || _a === void 0 ? void 0 : _a.call(extender); });
_setCurrentExtenders(extender.map(callExtender('UPDATE')));
const { defaultData: newDefaultData, defaultTouched: newDefaultTouched, } = getFormDefaultValues(node);
data.update(($data) => _defaultsDeep($data, newDefaultData));
touched.update(($touched) => {
return _defaultsDeep($touched, newDefaultTouched);
});
updateAddedNodes();
}

@@ -336,5 +347,4 @@ if (mutation.removedNodes.length > 0) {

continue;
_getCurrentExtenders().forEach((extender) => { var _a; return (_a = extender.destroy) === null || _a === void 0 ? void 0 : _a.call(extender); });
_setCurrentExtenders(extender.map(callExtender('UPDATE')));
unsetTaggedForRemove(formControls);
removedFormControls.push(...formControls);
updateRemovedNodes();
}

@@ -341,0 +351,0 @@ }

@@ -8,2 +8,3 @@ import { deepSetTouched } from './deep-set-touched.js';

import { mergeErrors, runValidations } from './packages/common/dist/esm/utils/executeValidation.js';
import { debounce } from './packages/common/dist/esm/utils/debounce.js';
import { _mergeWith } from './packages/common/dist/esm/utils/mergeWith.js';

@@ -77,11 +78,2 @@ import { _isPlainObject } from './packages/common/dist/esm/utils/isPlainObject.js';

}
function debounce(func, timeout = 300) {
let timer;
return (...args) => {
clearTimeout(timer);
timer = setTimeout(() => {
func.apply(this, args);
}, timeout);
};
}
// A `derived` store factory that can defer subscription and be constructed

@@ -120,3 +112,3 @@ // with any store factory.

function createStores(storeFactory, config) {
var _a, _b, _c, _d, _e, _f, _g;
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
const derived = createDerivedFactory(storeFactory);

@@ -215,4 +207,4 @@ const initialValues = (config.initialValues = config.initialValues

const validateDebouncedWarnings = cancellableValidation(debouncedWarnings);
const _validateDebouncedErrors = debounce(validateDebouncedErrors, (_c = (_b = config.debounced) === null || _b === void 0 ? void 0 : _b.validateTimeout) !== null && _c !== void 0 ? _c : (_d = config.debounced) === null || _d === void 0 ? void 0 : _d.timeout);
const _validateDebouncedWarnings = debounce(validateDebouncedWarnings, (_f = (_e = config.debounced) === null || _e === void 0 ? void 0 : _e.warnTimeout) !== null && _f !== void 0 ? _f : (_g = config.debounced) === null || _g === void 0 ? void 0 : _g.timeout);
const _validateDebouncedErrors = debounce(validateDebouncedErrors, (_e = (_c = (_b = config.debounced) === null || _b === void 0 ? void 0 : _b.validateTimeout) !== null && _c !== void 0 ? _c : (_d = config.debounced) === null || _d === void 0 ? void 0 : _d.timeout) !== null && _e !== void 0 ? _e : 300);
const _validateDebouncedWarnings = debounce(validateDebouncedWarnings, (_j = (_g = (_f = config.debounced) === null || _f === void 0 ? void 0 : _f.warnTimeout) !== null && _g !== void 0 ? _g : (_h = config.debounced) === null || _h === void 0 ? void 0 : _h.timeout) !== null && _j !== void 0 ? _j : 300);
async function executeErrorsValidation(data, altValidate) {

@@ -219,0 +211,0 @@ var _a;

{
"name": "@felte/react",
"version": "1.1.3",
"version": "1.1.4",
"description": "An extensible form library for ReactJS",

@@ -28,3 +28,3 @@ "main": "dist/cjs/index.cjs",

"dependencies": {
"@felte/core": "1.2.1"
"@felte/core": "1.2.2"
},

@@ -38,3 +38,3 @@ "publishConfig": {

"devDependencies": {
"@felte/common": "1.0.2",
"@felte/common": "1.0.3",
"@testing-library/react": "^12.1.2",

@@ -41,0 +41,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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc