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.20.12 to 3.20.13

25

condition/condition.js

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

var _typeof3 = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {

@@ -19,3 +17,3 @@ value: true

var _react = _interopRequireWildcard(require("react"));
var _react = require("react");

@@ -30,6 +28,2 @@ var _propTypes = _interopRequireDefault(require("prop-types"));

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

@@ -71,9 +65,8 @@

var Condition = /*#__PURE__*/_react["default"].memo(function (_ref2) {
var Condition = function Condition(_ref2) {
var condition = _ref2.condition,
children = _ref2.children,
values = _ref2.values,
field = _ref2.field;
var formOptions = (0, _useFormApi["default"])();
var dirty = formOptions.getState().dirty;
var formState = formOptions.getState();

@@ -90,6 +83,8 @@ var _useReducer = (0, _react.useReducer)(reducer, {

var conditionResult = (0, _parseCondition["default"])(condition, formOptions.getState().values, field);
var conditionResult = (0, _react.useMemo)(function () {
return (0, _parseCondition["default"])(condition, formState.values, field);
}, [formState.values, condition, field]);
var setters = conditionResult.set ? [conditionResult.set] : conditionResult.sets;
(0, _react.useEffect)(function () {
if (!dirty) {
if (!formState.dirty) {
dispatch({

@@ -99,3 +94,3 @@ type: 'formResetted'

}
}, [dirty]);
}, [formState.dirty]);
var setValue = (0, _react.useCallback)(function (setter) {

@@ -152,5 +147,3 @@ Object.entries(setter).forEach(function (_ref3) {

return conditionResult.visible ? children : null;
}, function (a, b) {
return (0, _isEqual["default"])(a.values, b.values) && (0, _isEqual["default"])(a.condition, b.condition);
});
};

@@ -157,0 +150,0 @@ var conditionProps = {

@@ -9,3 +9,3 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";

import React, { useCallback, useEffect, useReducer } from 'react';
import { useCallback, useEffect, useMemo, useReducer } from 'react';
import PropTypes from 'prop-types';

@@ -45,9 +45,9 @@ import isEqual from 'lodash/isEqual';

};
var Condition = /*#__PURE__*/React.memo(function (_ref2) {
var Condition = function Condition(_ref2) {
var condition = _ref2.condition,
children = _ref2.children,
values = _ref2.values,
field = _ref2.field;
var formOptions = useFormApi();
var dirty = formOptions.getState().dirty;
var formState = formOptions.getState();

@@ -64,6 +64,8 @@ var _useReducer = useReducer(reducer, {

var conditionResult = parseCondition(condition, formOptions.getState().values, field);
var conditionResult = useMemo(function () {
return parseCondition(condition, formState.values, field);
}, [formState.values, condition, field]);
var setters = conditionResult.set ? [conditionResult.set] : conditionResult.sets;
useEffect(function () {
if (!dirty) {
if (!formState.dirty) {
dispatch({

@@ -73,3 +75,3 @@ type: 'formResetted'

}
}, [dirty]);
}, [formState.dirty]);
var setValue = useCallback(function (setter) {

@@ -126,5 +128,4 @@ Object.entries(setter).forEach(function (_ref3) {

return conditionResult.visible ? children : null;
}, function (a, b) {
return isEqual(a.values, b.values) && isEqual(a.condition, b.condition);
});
};
var conditionProps = {

@@ -131,0 +132,0 @@ when: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string), PropTypes.func]),

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

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

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