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

react-form-maker

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-form-maker - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

41

dist/index.js

@@ -85,2 +85,10 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

switch (attributes.type) {
case 'div':
{
var child = props.formItemAttributes.child;
delete attributes.type;
delete attributes.child;
return /*#__PURE__*/React.createElement("div", attributes, child);
}
case 'select':

@@ -171,2 +179,34 @@ {

var getReactFormData = function getReactFormData(formItems) {
var data = {};
formItems.forEach(function (item) {
switch (item.type) {
case 'radio':
data[item.name] = document.querySelector("input[name=\"" + item.name + "\"]:checked").value;
break;
case ('submit'):
break;
case 'checkbox':
if (item.name) {
data[item.name] = document.getElementsByName(item.name).checked;
} else if (item.id) {
data[item.id] = document.getElementById(item.id).checked;
}
break;
default:
if (item.name) {
data[item.name] = document.getElementsByName(item.name).value;
} else if (item.id) {
data[item.id] = document.getElementById(item.id).value;
}
}
});
return data;
};
var ReactFormMaker = function ReactFormMaker(props) {

@@ -195,2 +235,3 @@ var formClassName = props.formClassName;

exports.ReactFormMaker = ReactFormMaker;
exports.getReactFormData = getReactFormData;
//# sourceMappingURL=index.js.map

42

dist/index.modern.js

@@ -83,2 +83,10 @@ import React from 'react';

switch (attributes.type) {
case 'div':
{
var child = props.formItemAttributes.child;
delete attributes.type;
delete attributes.child;
return /*#__PURE__*/React.createElement("div", attributes, child);
}
case 'select':

@@ -169,2 +177,34 @@ {

var getReactFormData = function getReactFormData(formItems) {
var data = {};
formItems.forEach(function (item) {
switch (item.type) {
case 'radio':
data[item.name] = document.querySelector("input[name=\"" + item.name + "\"]:checked").value;
break;
case ('submit'):
break;
case 'checkbox':
if (item.name) {
data[item.name] = document.getElementsByName(item.name).checked;
} else if (item.id) {
data[item.id] = document.getElementById(item.id).checked;
}
break;
default:
if (item.name) {
data[item.name] = document.getElementsByName(item.name).value;
} else if (item.id) {
data[item.id] = document.getElementById(item.id).value;
}
}
});
return data;
};
var ReactFormMaker = function ReactFormMaker(props) {

@@ -192,3 +232,3 @@ var formClassName = props.formClassName;

export { ReactFormMaker };
export { ReactFormMaker, getReactFormData };
//# sourceMappingURL=index.modern.js.map

4

package.json
{
"name": "react-form-maker",
"version": "0.1.0",
"version": "0.2.0",
"description": "make a react form faster by object",

@@ -26,3 +26,3 @@ "author": "ronny1020",

"test:watch": "react-scripts test --env=jsdom",
"predeploy": "cd example && npm install && npm run build",
"predeploy": "cd example && npm run build",
"deploy": "gh-pages -d example/build"

@@ -29,0 +29,0 @@ },

@@ -200,2 +200,13 @@ # react-form-maker

#### {type:div}
Create <div></div> ,and anything could be insert into it by property "child".
Any other property would be the attributes of the div.
## getReactFormData(formItems)
This function could get the date of <ReactFormMaker /> form.
The "formItems" should be the formItems used by <ReactFormMaker />.
The return is Object with key: value pair. If there is a name in formItem, the key would be the "name" property. Otherwise, the key would be the "id" property.
## Contributing

@@ -202,0 +213,0 @@

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