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

rc-field-form

Package Overview
Dependencies
Maintainers
5
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-field-form - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

1

es/Form.d.ts

@@ -19,4 +19,5 @@ import * as React from 'react';

preserve?: boolean;
clearOnDestroy?: boolean;
}
declare const Form: React.ForwardRefRenderFunction<FormInstance, FormProps>;
export default Form;

7

es/Form.js

@@ -5,3 +5,3 @@ import _extends from "@babel/runtime/helpers/esm/extends";

import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["name", "initialValues", "fields", "form", "preserve", "children", "component", "validateMessages", "validateTrigger", "onValuesChange", "onFieldsChange", "onFinish", "onFinishFailed"];
var _excluded = ["name", "initialValues", "fields", "form", "preserve", "children", "component", "validateMessages", "validateTrigger", "onValuesChange", "onFieldsChange", "onFinish", "onFinishFailed", "clearOnDestroy"];
import * as React from 'react';

@@ -29,2 +29,3 @@ import useForm from "./useForm";

onFinishFailed = _ref.onFinishFailed,
clearOnDestroy = _ref.clearOnDestroy,
restProps = _objectWithoutProperties(_ref, _excluded);

@@ -89,3 +90,5 @@ var formContext = React.useContext(FormContext);

React.useEffect(function () {
return destroyForm;
return function () {
return destroyForm(clearOnDestroy);
};
},

@@ -92,0 +95,0 @@ // eslint-disable-next-line react-hooks/exhaustive-deps

@@ -164,3 +164,3 @@ import type { ReactElement } from 'react';

setInitialValues: (values: Store, init: boolean) => void;
destroyForm: () => void;
destroyForm: (clearOnDestroy?: boolean) => void;
setCallbacks: (callbacks: Callbacks) => void;

@@ -167,0 +167,0 @@ registerWatch: (callback: WatchCallBack) => () => void;

@@ -102,10 +102,16 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";

});
_defineProperty(this, "destroyForm", function () {
var prevWithoutPreserves = new NameMap();
_this.getFieldEntities(true).forEach(function (entity) {
if (!_this.isMergedPreserve(entity.isPreserve())) {
prevWithoutPreserves.set(entity.getNamePath(), true);
}
});
_this.prevWithoutPreserves = prevWithoutPreserves;
_defineProperty(this, "destroyForm", function (clearOnDestroy) {
if (clearOnDestroy) {
// destroy form reset store
_this.updateStore({});
} else {
// Fill preserve fields
var prevWithoutPreserves = new NameMap();
_this.getFieldEntities(true).forEach(function (entity) {
if (!_this.isMergedPreserve(entity.isPreserve())) {
prevWithoutPreserves.set(entity.getNamePath(), true);
}
});
_this.prevWithoutPreserves = prevWithoutPreserves;
}
});

@@ -112,0 +118,0 @@ _defineProperty(this, "getInitialValue", function (namePath) {

@@ -19,4 +19,5 @@ import * as React from 'react';

preserve?: boolean;
clearOnDestroy?: boolean;
}
declare const Form: React.ForwardRefRenderFunction<FormInstance, FormProps>;
export default Form;

@@ -19,3 +19,3 @@ "use strict";

var _ListContext = _interopRequireDefault(require("./ListContext"));
var _excluded = ["name", "initialValues", "fields", "form", "preserve", "children", "component", "validateMessages", "validateTrigger", "onValuesChange", "onFieldsChange", "onFinish", "onFinishFailed"];
var _excluded = ["name", "initialValues", "fields", "form", "preserve", "children", "component", "validateMessages", "validateTrigger", "onValuesChange", "onFieldsChange", "onFinish", "onFinishFailed", "clearOnDestroy"];
var Form = function Form(_ref, ref) {

@@ -37,2 +37,3 @@ var name = _ref.name,

onFinishFailed = _ref.onFinishFailed,
clearOnDestroy = _ref.clearOnDestroy,
restProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);

@@ -97,3 +98,5 @@ var formContext = React.useContext(_FormContext.default);

React.useEffect(function () {
return destroyForm;
return function () {
return destroyForm(clearOnDestroy);
};
},

@@ -100,0 +103,0 @@ // eslint-disable-next-line react-hooks/exhaustive-deps

@@ -164,3 +164,3 @@ import type { ReactElement } from 'react';

setInitialValues: (values: Store, init: boolean) => void;
destroyForm: () => void;
destroyForm: (clearOnDestroy?: boolean) => void;
setCallbacks: (callbacks: Callbacks) => void;

@@ -167,0 +167,0 @@ registerWatch: (callback: WatchCallBack) => () => void;

@@ -110,10 +110,16 @@ "use strict";

});
(0, _defineProperty2.default)(this, "destroyForm", function () {
var prevWithoutPreserves = new _NameMap.default();
_this.getFieldEntities(true).forEach(function (entity) {
if (!_this.isMergedPreserve(entity.isPreserve())) {
prevWithoutPreserves.set(entity.getNamePath(), true);
}
});
_this.prevWithoutPreserves = prevWithoutPreserves;
(0, _defineProperty2.default)(this, "destroyForm", function (clearOnDestroy) {
if (clearOnDestroy) {
// destroy form reset store
_this.updateStore({});
} else {
// Fill preserve fields
var prevWithoutPreserves = new _NameMap.default();
_this.getFieldEntities(true).forEach(function (entity) {
if (!_this.isMergedPreserve(entity.isPreserve())) {
prevWithoutPreserves.set(entity.getNamePath(), true);
}
});
_this.prevWithoutPreserves = prevWithoutPreserves;
}
});

@@ -120,0 +126,0 @@ (0, _defineProperty2.default)(this, "getInitialValue", function (namePath) {

{
"name": "rc-field-form",
"version": "2.0.1",
"version": "2.1.0",
"description": "React Form Component",

@@ -5,0 +5,0 @@ "typings": "es/index.d.ts",

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