New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.0.0 to 1.0.1

27

dist/esm/packages/core/dist/esm/create-form-action.js

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

}
function setSelectValue(target) {
if (!target.multiple) {
data.update(($data) => {
return _set($data, getPath(target), target.value);
});
}
else {
const selectedOptions = Array.from(target.options)
.filter((opt) => opt.selected)
.map((opt) => opt.value);
data.update(($data) => {
return _set($data, getPath(target), selectedOptions);
});
}
}
function handleInput(e) {

@@ -220,3 +235,3 @@ const target = e.target;

}
if (isSelectElement(target) || target.type === 'hidden') {
if (target.type === 'hidden') {
data.update(($data) => {

@@ -226,9 +241,11 @@ return _set($data, getPath(target), target.value);

}
if (!isInputElement(target))
if (isSelectElement(target))
setSelectValue(target);
else if (!isInputElement(target))
return;
if (target.type === 'checkbox')
else if (target.type === 'checkbox')
setCheckboxValues(target);
if (target.type === 'radio')
else if (target.type === 'radio')
setRadioValues(target);
if (target.type === 'file')
else if (target.type === 'file')
setFileValue(target);

@@ -235,0 +252,0 @@ }

@@ -1,2 +0,2 @@

import { isFormControl, isInputElement, isFieldSetElement } from './typeGuards.js';
import { isFormControl, isInputElement, isSelectElement, isFieldSetElement } from './typeGuards.js';
import { _get } from './get.js';

@@ -103,2 +103,16 @@ import { _set } from './set.js';

}
else if (isSelectElement(el)) {
const multiple = el.multiple;
if (!multiple) {
defaultData = _set(defaultData, elName, el.value);
}
else {
const selectedOptions = Array.from(el.options)
.filter((opt) => opt.selected)
.map((opt) => opt.value);
defaultData = _set(defaultData, elName, selectedOptions);
}
defaultTouched = _set(defaultTouched, elName, false);
continue;
}
const inputValue = getInputTextOrNumber(el);

@@ -111,2 +125,3 @@ defaultData = _set(defaultData, elName, inputValue);

function setControlValue(el, value) {
var _a;
if (!isFormControl(el))

@@ -147,2 +162,28 @@ return;

}
else if (isSelectElement(el)) {
const multiple = el.multiple;
if (!multiple) {
el.value = String(fieldValue !== null && fieldValue !== void 0 ? fieldValue : '');
for (const option of el.options) {
if (option.value === fieldValue) {
option.selected = true;
}
else {
option.selected = false;
}
}
}
else if (Array.isArray(fieldValue)) {
el.value = String((_a = fieldValue[0]) !== null && _a !== void 0 ? _a : '');
for (const option of el.options) {
if (fieldValue.includes(option.value)) {
option.selected = true;
}
else {
option.selected = false;
}
}
}
return;
}
el.value = String(fieldValue !== null && fieldValue !== void 0 ? fieldValue : '');

@@ -149,0 +190,0 @@ }

6

package.json
{
"name": "@felte/react",
"version": "1.0.0",
"version": "1.0.1",
"description": "An extensible form library for ReactJS",

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

"dependencies": {
"@felte/core": "1.0.0"
"@felte/core": "1.0.1"
},

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

"devDependencies": {
"@felte/common": "1.0.0",
"@felte/common": "1.0.1",
"@testing-library/react": "^12.1.2",

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

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