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

@data-driven-forms/react-form-renderer

Package Overview
Dependencies
Maintainers
2
Versions
388
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@data-driven-forms/react-form-renderer - npm Package Compare versions

Comparing version 3.17.3 to 3.17.4

40

esm/form-renderer/form-renderer.js

@@ -1,7 +0,7 @@

import _typeof from "@babel/runtime/helpers/typeof";
import _extends from "@babel/runtime/helpers/extends";
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _typeof from "@babel/runtime/helpers/typeof";
var _excluded = ["actionMapper", "children", "clearedValue", "clearOnUnmount", "componentMapper", "decorators", "FormTemplate", "FormTemplateProps", "mutators", "onCancel", "onError", "onReset", "onSubmit", "schema", "schemaValidatorMapper", "subscription", "validatorMapper"],

@@ -33,2 +33,30 @@ _excluded2 = ["reset", "mutators", "getState", "submit"];

var renderChildren = function renderChildren(children, props) {
if (isFunc(children)) {
return children(props);
}
var childElement = children;
if (Array.isArray(children)) {
/**
* Only permit one child element
*/
if (children.length !== 1) {
throw new Error('FormRenderer expects only one child element!');
}
childElement = children[0];
}
if (_typeof(childElement) === 'object') {
/**
* Clone react element, pass form fields and schema as props, but override them with child props if present
*/
return /*#__PURE__*/cloneElement(children, _objectSpread(_objectSpread({}, props), childElement.props));
}
throw new Error("Invalid children prop! Expected one of [null, Function, object], got ".concat(_typeof(children)));
};
var FormRenderer = function FormRenderer(_ref) {

@@ -200,3 +228,4 @@ var actionMapper = _ref.actionMapper,

getRegisteredFields: internalGetRegisteredFields,
initialValues: props.initialValues
initialValues: props.initialValues,
schema: schema
})

@@ -207,8 +236,5 @@ }

schema: schema
}, FormTemplateProps)), isFunc(children) && children({
}, FormTemplateProps)), children && renderChildren(children, {
formFields: formFields,
schema: schema
}), _typeof(children) === 'object' && /*#__PURE__*/cloneElement(children, {
formFields: formFields,
schema: schema
}));

@@ -215,0 +241,0 @@ }

44

form-renderer/form-renderer.js

@@ -12,4 +12,2 @@ "use strict";

var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

@@ -19,4 +17,2 @@

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));

@@ -26,2 +22,6 @@

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _finalFormArrays = _interopRequireDefault(require("final-form-arrays"));

@@ -66,2 +66,30 @@

var renderChildren = function renderChildren(children, props) {
if (isFunc(children)) {
return children(props);
}
var childElement = children;
if (Array.isArray(children)) {
/**
* Only permit one child element
*/
if (children.length !== 1) {
throw new Error('FormRenderer expects only one child element!');
}
childElement = children[0];
}
if ((0, _typeof2["default"])(childElement) === 'object') {
/**
* Clone react element, pass form fields and schema as props, but override them with child props if present
*/
return /*#__PURE__*/(0, _react.cloneElement)(children, _objectSpread(_objectSpread({}, props), childElement.props));
}
throw new Error("Invalid children prop! Expected one of [null, Function, object], got ".concat((0, _typeof2["default"])(children)));
};
var FormRenderer = function FormRenderer(_ref) {

@@ -231,3 +259,4 @@ var actionMapper = _ref.actionMapper,

getRegisteredFields: internalGetRegisteredFields,
initialValues: props.initialValues
initialValues: props.initialValues,
schema: schema
})

@@ -238,8 +267,5 @@ }

schema: schema
}, FormTemplateProps)), isFunc(children) && children({
}, FormTemplateProps)), children && renderChildren(children, {
formFields: formFields,
schema: schema
}), (0, _typeof2["default"])(children) === 'object' && /*#__PURE__*/(0, _react.cloneElement)(children, {
formFields: formFields,
schema: schema
}));

@@ -246,0 +272,0 @@ }

{
"name": "@data-driven-forms/react-form-renderer",
"version": "3.17.3",
"version": "3.17.4",
"description": "React Form Renderer. Data Driven Forms converts JSON form definitions into fully functional React forms.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -8,2 +8,3 @@ import React, { ReactNode } from 'react';

import { AnyObject } from '../common-types/any-object';
import Schema from '../common-types/schema';

@@ -23,2 +24,3 @@ export interface FormOptions extends FormApi {

initialValues: AnyObject;
schema: Schema,
}

@@ -25,0 +27,0 @@

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