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

react-final-form-arrays

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-final-form-arrays - npm Package Compare versions

Comparing version 3.1.3 to 3.1.4

151

dist/react-final-form-arrays.cjs.js
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var _extends = require('@babel/runtime/helpers/extends');

@@ -11,8 +9,22 @@ var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
var _excluded$2 = ["render", "children", "component"];
// shared logic between components that use either render prop,

@@ -22,8 +34,7 @@ // children render function, or component prop

var render = props.render,
children = props.children,
component = props.component,
rest = _objectWithoutPropertiesLoose__default['default'](props, ["render", "children", "component"]);
children = props.children,
component = props.component,
rest = _objectWithoutPropertiesLoose(props, _excluded$2);
if (component) {
return /*#__PURE__*/React.createElement(component, _extends__default['default']({}, rest, {
return /*#__PURE__*/React__namespace.createElement(component, _extends({}, rest, {
children: children,

@@ -35,3 +46,3 @@ render: render

if (render) {
return render(children === undefined ? rest : _extends__default['default']({}, rest, {
return render(children === undefined ? rest : _extends({}, rest, {
children: children

@@ -44,3 +55,2 @@ })); // inject children back in

}
return children(rest);

@@ -67,13 +77,12 @@ }

*/
function useConstant(init) {
var ref = React__default['default'].useRef();
var ref = React.useRef();
if (!ref.current) {
ref.current = init();
}
return ref.current;
}
var _excluded$1 = ["length"],
_excluded2 = ["meta", "input"];
var all = finalForm.fieldSubscriptionItems.reduce(function (result, key) {

@@ -83,23 +92,20 @@ result[key] = true;

}, {});
var useFieldArray = function useFieldArray(name, _temp) {
var _ref = _temp === void 0 ? {} : _temp,
_ref$subscription = _ref.subscription,
subscription = _ref$subscription === void 0 ? all : _ref$subscription,
defaultValue = _ref.defaultValue,
initialValue = _ref.initialValue,
_ref$isEqual = _ref.isEqual,
isEqual = _ref$isEqual === void 0 ? defaultIsEqual : _ref$isEqual,
validateProp = _ref.validate;
_ref$subscription = _ref.subscription,
subscription = _ref$subscription === void 0 ? all : _ref$subscription,
defaultValue = _ref.defaultValue,
initialValue = _ref.initialValue,
_ref$isEqual = _ref.isEqual,
isEqual = _ref$isEqual === void 0 ? defaultIsEqual : _ref$isEqual,
validateProp = _ref.validate;
var form = reactFinalForm.useForm('useFieldArray');
var formMutators = form.mutators;
var hasMutators = !!(formMutators && formMutators.push && formMutators.pop);
if (!hasMutators) {
throw new Error('Array mutators not found. You need to provide the mutators from final-form-arrays to your form');
}
var mutators = useConstant(function () {
return (// curry the field name onto all mutator calls
var mutators = React.useMemo(function () {
return (
// curry the field name onto all mutator calls
Object.keys(formMutators).reduce(function (result, key) {

@@ -110,10 +116,8 @@ result[key] = function () {

}
return formMutators[key].apply(formMutators, [name].concat(args));
};
return result;
}, {})
);
});
}, [name, formMutators]);
var validate = useConstant(function () {

@@ -123,7 +127,7 @@ return function (value, allValues, meta) {

var error = validateProp(value, allValues, meta);
if (!error || Array.isArray(error)) {
return error;
} else {
var arrayError = [] // gross, but we have to set a string key on the array
var arrayError = []
// gross, but we have to set a string key on the array
;

@@ -135,21 +139,19 @@ arrayError[finalForm.ARRAY_ERROR] = error;

});
var _useField = reactFinalForm.useField(name, {
subscription: _extends__default['default']({}, subscription, {
length: true
subscription: _extends({}, subscription, {
length: true
}),
defaultValue: defaultValue,
initialValue: initialValue,
isEqual: isEqual,
validate: validate,
format: function format(v) {
return v;
}
}),
defaultValue: defaultValue,
initialValue: initialValue,
isEqual: isEqual,
validate: validate,
format: function format(v) {
return v;
}
}),
_useField$meta = _useField.meta,
length = _useField$meta.length,
meta = _objectWithoutPropertiesLoose__default['default'](_useField$meta, ["length"]),
input = _useField.input,
fieldState = _objectWithoutPropertiesLoose__default['default'](_useField, ["meta", "input"]);
_useField$meta = _useField.meta,
length = _useField$meta.length,
meta = _objectWithoutPropertiesLoose(_useField$meta, _excluded$1),
input = _useField.input,
fieldState = _objectWithoutPropertiesLoose(_useField, _excluded2);
var forEach = function forEach(iterator) {

@@ -159,3 +161,2 @@ // required || for Flow, but results in uncovered line in Jest/Istanbul

var len = length || 0;
for (var i = 0; i < len; i++) {

@@ -165,3 +166,2 @@ iterator(name + "[" + i + "]", i);

};
var map = function map(iterator) {

@@ -172,12 +172,9 @@ // required || for Flow, but results in uncovered line in Jest/Istanbul

var results = [];
for (var i = 0; i < len; i++) {
results.push(iterator(name + "[" + i + "]", i));
}
return results;
};
return {
fields: _extends__default['default']({
fields: _extends({
name: name,

@@ -194,4 +191,5 @@ forEach: forEach,

var version = "3.1.2";
var version = "3.1.3";
var _excluded = ["name", "subscription", "defaultValue", "initialValue", "isEqual", "validate"];
var versions = {

@@ -202,25 +200,22 @@ 'final-form': finalForm.version,

};
var FieldArray = function FieldArray(_ref) {
var name = _ref.name,
subscription = _ref.subscription,
defaultValue = _ref.defaultValue,
initialValue = _ref.initialValue,
isEqual = _ref.isEqual,
validate = _ref.validate,
rest = _objectWithoutPropertiesLoose__default['default'](_ref, ["name", "subscription", "defaultValue", "initialValue", "isEqual", "validate"]);
subscription = _ref.subscription,
defaultValue = _ref.defaultValue,
initialValue = _ref.initialValue,
isEqual = _ref.isEqual,
validate = _ref.validate,
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
var _useFieldArray = useFieldArray(name, {
subscription: subscription,
defaultValue: defaultValue,
initialValue: initialValue,
isEqual: isEqual,
validate: validate
}),
fields = _useFieldArray.fields,
meta = _useFieldArray.meta;
return renderComponent(_extends__default['default']({
subscription: subscription,
defaultValue: defaultValue,
initialValue: initialValue,
isEqual: isEqual,
validate: validate
}),
fields = _useFieldArray.fields,
meta = _useFieldArray.meta;
return renderComponent(_extends({
fields: fields,
meta: _extends__default['default']({}, meta, {
meta: _extends({}, meta, {
__versions: versions

@@ -227,0 +222,0 @@ })

@@ -5,4 +5,6 @@ import _extends from '@babel/runtime/helpers/extends';

import { useForm, useField, version as version$2 } from 'react-final-form';
import React, { createElement } from 'react';
import * as React from 'react';
import React__default, { useMemo } from 'react';
var _excluded$2 = ["render", "children", "component"];
// shared logic between components that use either render prop,

@@ -12,8 +14,7 @@ // children render function, or component prop

var render = props.render,
children = props.children,
component = props.component,
rest = _objectWithoutPropertiesLoose(props, ["render", "children", "component"]);
children = props.children,
component = props.component,
rest = _objectWithoutPropertiesLoose(props, _excluded$2);
if (component) {
return /*#__PURE__*/createElement(component, _extends({}, rest, {
return /*#__PURE__*/React.createElement(component, _extends({}, rest, {
children: children,

@@ -33,3 +34,2 @@ render: render

}
return children(rest);

@@ -56,13 +56,12 @@ }

*/
function useConstant(init) {
var ref = React.useRef();
var ref = React__default.useRef();
if (!ref.current) {
ref.current = init();
}
return ref.current;
}
var _excluded$1 = ["length"],
_excluded2 = ["meta", "input"];
var all = fieldSubscriptionItems.reduce(function (result, key) {

@@ -72,23 +71,20 @@ result[key] = true;

}, {});
var useFieldArray = function useFieldArray(name, _temp) {
var _ref = _temp === void 0 ? {} : _temp,
_ref$subscription = _ref.subscription,
subscription = _ref$subscription === void 0 ? all : _ref$subscription,
defaultValue = _ref.defaultValue,
initialValue = _ref.initialValue,
_ref$isEqual = _ref.isEqual,
isEqual = _ref$isEqual === void 0 ? defaultIsEqual : _ref$isEqual,
validateProp = _ref.validate;
_ref$subscription = _ref.subscription,
subscription = _ref$subscription === void 0 ? all : _ref$subscription,
defaultValue = _ref.defaultValue,
initialValue = _ref.initialValue,
_ref$isEqual = _ref.isEqual,
isEqual = _ref$isEqual === void 0 ? defaultIsEqual : _ref$isEqual,
validateProp = _ref.validate;
var form = useForm('useFieldArray');
var formMutators = form.mutators;
var hasMutators = !!(formMutators && formMutators.push && formMutators.pop);
if (!hasMutators) {
throw new Error('Array mutators not found. You need to provide the mutators from final-form-arrays to your form');
}
var mutators = useConstant(function () {
return (// curry the field name onto all mutator calls
var mutators = useMemo(function () {
return (
// curry the field name onto all mutator calls
Object.keys(formMutators).reduce(function (result, key) {

@@ -99,10 +95,8 @@ result[key] = function () {

}
return formMutators[key].apply(formMutators, [name].concat(args));
};
return result;
}, {})
);
});
}, [name, formMutators]);
var validate = useConstant(function () {

@@ -112,7 +106,7 @@ return function (value, allValues, meta) {

var error = validateProp(value, allValues, meta);
if (!error || Array.isArray(error)) {
return error;
} else {
var arrayError = [] // gross, but we have to set a string key on the array
var arrayError = []
// gross, but we have to set a string key on the array
;

@@ -124,21 +118,19 @@ arrayError[ARRAY_ERROR] = error;

});
var _useField = useField(name, {
subscription: _extends({}, subscription, {
length: true
subscription: _extends({}, subscription, {
length: true
}),
defaultValue: defaultValue,
initialValue: initialValue,
isEqual: isEqual,
validate: validate,
format: function format(v) {
return v;
}
}),
defaultValue: defaultValue,
initialValue: initialValue,
isEqual: isEqual,
validate: validate,
format: function format(v) {
return v;
}
}),
_useField$meta = _useField.meta,
length = _useField$meta.length,
meta = _objectWithoutPropertiesLoose(_useField$meta, ["length"]),
input = _useField.input,
fieldState = _objectWithoutPropertiesLoose(_useField, ["meta", "input"]);
_useField$meta = _useField.meta,
length = _useField$meta.length,
meta = _objectWithoutPropertiesLoose(_useField$meta, _excluded$1),
input = _useField.input,
fieldState = _objectWithoutPropertiesLoose(_useField, _excluded2);
var forEach = function forEach(iterator) {

@@ -148,3 +140,2 @@ // required || for Flow, but results in uncovered line in Jest/Istanbul

var len = length || 0;
for (var i = 0; i < len; i++) {

@@ -154,3 +145,2 @@ iterator(name + "[" + i + "]", i);

};
var map = function map(iterator) {

@@ -161,10 +151,7 @@ // required || for Flow, but results in uncovered line in Jest/Istanbul

var results = [];
for (var i = 0; i < len; i++) {
results.push(iterator(name + "[" + i + "]", i));
}
return results;
};
return {

@@ -183,4 +170,5 @@ fields: _extends({

var version = "3.1.2";
var version = "3.1.3";
var _excluded = ["name", "subscription", "defaultValue", "initialValue", "isEqual", "validate"];
var versions = {

@@ -191,22 +179,19 @@ 'final-form': version$1,

};
var FieldArray = function FieldArray(_ref) {
var name = _ref.name,
subscription = _ref.subscription,
defaultValue = _ref.defaultValue,
initialValue = _ref.initialValue,
isEqual = _ref.isEqual,
validate = _ref.validate,
rest = _objectWithoutPropertiesLoose(_ref, ["name", "subscription", "defaultValue", "initialValue", "isEqual", "validate"]);
subscription = _ref.subscription,
defaultValue = _ref.defaultValue,
initialValue = _ref.initialValue,
isEqual = _ref.isEqual,
validate = _ref.validate,
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
var _useFieldArray = useFieldArray(name, {
subscription: subscription,
defaultValue: defaultValue,
initialValue: initialValue,
isEqual: isEqual,
validate: validate
}),
fields = _useFieldArray.fields,
meta = _useFieldArray.meta;
subscription: subscription,
defaultValue: defaultValue,
initialValue: initialValue,
isEqual: isEqual,
validate: validate
}),
fields = _useFieldArray.fields,
meta = _useFieldArray.meta;
return renderComponent(_extends({

@@ -213,0 +198,0 @@ fields: fields,

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/extends'), require('@babel/runtime/helpers/objectWithoutPropertiesLoose'), require('final-form'), require('react-final-form'), require('react')) :
typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/extends', '@babel/runtime/helpers/objectWithoutPropertiesLoose', 'final-form', 'react-final-form', 'react'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['react-final-form-arrays'] = {}, global._extends, global._objectWithoutPropertiesLoose, global.FinalForm, global.ReactFinalForm, global.React));
}(this, (function (exports, _extends, _objectWithoutPropertiesLoose, finalForm, reactFinalForm, React) { 'use strict';
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["react-final-form-arrays"] = {}, global._extends, global._objectWithoutPropertiesLoose, global.FinalForm, global.ReactFinalForm, global.React));
})(this, (function (exports, _extends, _objectWithoutPropertiesLoose, finalForm, reactFinalForm, React) { 'use strict';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
function _interopNamespaceDefault(e) {
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
var _excluded$2 = ["render", "children", "component"];
// shared logic between components that use either render prop,

@@ -17,8 +31,7 @@ // children render function, or component prop

var render = props.render,
children = props.children,
component = props.component,
rest = _objectWithoutPropertiesLoose__default['default'](props, ["render", "children", "component"]);
children = props.children,
component = props.component,
rest = _objectWithoutPropertiesLoose(props, _excluded$2);
if (component) {
return /*#__PURE__*/React.createElement(component, _extends__default['default']({}, rest, {
return /*#__PURE__*/React__namespace.createElement(component, _extends({}, rest, {
children: children,

@@ -30,3 +43,3 @@ render: render

if (render) {
return render(children === undefined ? rest : _extends__default['default']({}, rest, {
return render(children === undefined ? rest : _extends({}, rest, {
children: children

@@ -39,3 +52,2 @@ })); // inject children back in

}
return children(rest);

@@ -62,13 +74,12 @@ }

*/
function useConstant(init) {
var ref = React__default['default'].useRef();
var ref = React.useRef();
if (!ref.current) {
ref.current = init();
}
return ref.current;
}
var _excluded$1 = ["length"],
_excluded2 = ["meta", "input"];
var all = finalForm.fieldSubscriptionItems.reduce(function (result, key) {

@@ -78,23 +89,20 @@ result[key] = true;

}, {});
var useFieldArray = function useFieldArray(name, _temp) {
var _ref = _temp === void 0 ? {} : _temp,
_ref$subscription = _ref.subscription,
subscription = _ref$subscription === void 0 ? all : _ref$subscription,
defaultValue = _ref.defaultValue,
initialValue = _ref.initialValue,
_ref$isEqual = _ref.isEqual,
isEqual = _ref$isEqual === void 0 ? defaultIsEqual : _ref$isEqual,
validateProp = _ref.validate;
_ref$subscription = _ref.subscription,
subscription = _ref$subscription === void 0 ? all : _ref$subscription,
defaultValue = _ref.defaultValue,
initialValue = _ref.initialValue,
_ref$isEqual = _ref.isEqual,
isEqual = _ref$isEqual === void 0 ? defaultIsEqual : _ref$isEqual,
validateProp = _ref.validate;
var form = reactFinalForm.useForm('useFieldArray');
var formMutators = form.mutators;
var hasMutators = !!(formMutators && formMutators.push && formMutators.pop);
if (!hasMutators) {
throw new Error('Array mutators not found. You need to provide the mutators from final-form-arrays to your form');
}
var mutators = useConstant(function () {
return (// curry the field name onto all mutator calls
var mutators = React.useMemo(function () {
return (
// curry the field name onto all mutator calls
Object.keys(formMutators).reduce(function (result, key) {

@@ -105,10 +113,8 @@ result[key] = function () {

}
return formMutators[key].apply(formMutators, [name].concat(args));
};
return result;
}, {})
);
});
}, [name, formMutators]);
var validate = useConstant(function () {

@@ -118,7 +124,7 @@ return function (value, allValues, meta) {

var error = validateProp(value, allValues, meta);
if (!error || Array.isArray(error)) {
return error;
} else {
var arrayError = [] // gross, but we have to set a string key on the array
var arrayError = []
// gross, but we have to set a string key on the array
;

@@ -130,21 +136,19 @@ arrayError[finalForm.ARRAY_ERROR] = error;

});
var _useField = reactFinalForm.useField(name, {
subscription: _extends__default['default']({}, subscription, {
length: true
subscription: _extends({}, subscription, {
length: true
}),
defaultValue: defaultValue,
initialValue: initialValue,
isEqual: isEqual,
validate: validate,
format: function format(v) {
return v;
}
}),
defaultValue: defaultValue,
initialValue: initialValue,
isEqual: isEqual,
validate: validate,
format: function format(v) {
return v;
}
}),
_useField$meta = _useField.meta,
length = _useField$meta.length,
meta = _objectWithoutPropertiesLoose__default['default'](_useField$meta, ["length"]),
input = _useField.input,
fieldState = _objectWithoutPropertiesLoose__default['default'](_useField, ["meta", "input"]);
_useField$meta = _useField.meta,
length = _useField$meta.length,
meta = _objectWithoutPropertiesLoose(_useField$meta, _excluded$1),
input = _useField.input,
fieldState = _objectWithoutPropertiesLoose(_useField, _excluded2);
var forEach = function forEach(iterator) {

@@ -154,3 +158,2 @@ // required || for Flow, but results in uncovered line in Jest/Istanbul

var len = length || 0;
for (var i = 0; i < len; i++) {

@@ -160,3 +163,2 @@ iterator(name + "[" + i + "]", i);

};
var map = function map(iterator) {

@@ -167,12 +169,9 @@ // required || for Flow, but results in uncovered line in Jest/Istanbul

var results = [];
for (var i = 0; i < len; i++) {
results.push(iterator(name + "[" + i + "]", i));
}
return results;
};
return {
fields: _extends__default['default']({
fields: _extends({
name: name,

@@ -189,4 +188,5 @@ forEach: forEach,

var version = "3.1.2";
var version = "3.1.3";
var _excluded = ["name", "subscription", "defaultValue", "initialValue", "isEqual", "validate"];
var versions = {

@@ -197,25 +197,22 @@ 'final-form': finalForm.version,

};
var FieldArray = function FieldArray(_ref) {
var name = _ref.name,
subscription = _ref.subscription,
defaultValue = _ref.defaultValue,
initialValue = _ref.initialValue,
isEqual = _ref.isEqual,
validate = _ref.validate,
rest = _objectWithoutPropertiesLoose__default['default'](_ref, ["name", "subscription", "defaultValue", "initialValue", "isEqual", "validate"]);
subscription = _ref.subscription,
defaultValue = _ref.defaultValue,
initialValue = _ref.initialValue,
isEqual = _ref.isEqual,
validate = _ref.validate,
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
var _useFieldArray = useFieldArray(name, {
subscription: subscription,
defaultValue: defaultValue,
initialValue: initialValue,
isEqual: isEqual,
validate: validate
}),
fields = _useFieldArray.fields,
meta = _useFieldArray.meta;
return renderComponent(_extends__default['default']({
subscription: subscription,
defaultValue: defaultValue,
initialValue: initialValue,
isEqual: isEqual,
validate: validate
}),
fields = _useFieldArray.fields,
meta = _useFieldArray.meta;
return renderComponent(_extends({
fields: fields,
meta: _extends__default['default']({}, meta, {
meta: _extends({}, meta, {
__versions: versions

@@ -230,5 +227,3 @@ })

Object.defineProperty(exports, '__esModule', { value: true });
})));
}));
//# sourceMappingURL=react-final-form-arrays.umd.js.map

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

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@babel/runtime/helpers/extends"),require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),require("final-form"),require("react-final-form"),require("react")):"function"==typeof define&&define.amd?define(["exports","@babel/runtime/helpers/extends","@babel/runtime/helpers/objectWithoutPropertiesLoose","final-form","react-final-form","react"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self)["react-final-form-arrays"]={},e._extends,e._objectWithoutPropertiesLoose,e.FinalForm,e.ReactFinalForm,e.React)}(this,function(e,r,t,s,d,o){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=n(r),p=n(t),i=n(o);function m(e,t){return e===t||Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&!e.some(function(e,r){return e!==t[r]})}function h(e){var r=i.default.useRef();return r.current||(r.current=e()),r.current}function l(i,e){var r=void 0===(a=(l=void 0===e?{}:e).subscription)?v:a,t=l.defaultValue,n=l.initialValue,a=void 0===(e=l.isEqual)?m:e,u=l.validate,o=d.useForm("useFieldArray").mutators;if(!!!(o&&o.push&&o.pop))throw new Error("Array mutators not found. You need to provide the mutators from final-form-arrays to your form");var e=h(function(){return Object.keys(o).reduce(function(e,n){return e[n]=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return o[n].apply(o,[i].concat(r))},e},{})}),l=h(function(){return function(e,r,t){if(u){r=u(e,r,t);if(!r||Array.isArray(r))return r;t=[];return t[s.ARRAY_ERROR]=r,t}}}),n=d.useField(i,{subscription:c.default({},r,{length:!0}),defaultValue:t,initialValue:n,isEqual:a,validate:l,format:function(e){return e}}),f=(a=n.meta).length,l=p.default(a,["length"]),a=n.input,n=p.default(n,["meta","input"]);return{fields:c.default({name:i,forEach:function(e){for(var r=f||0,t=0;t<r;t++)e(i+"["+t+"]",t)},length:f||0,map:function(e){for(var r=f||0,t=[],n=0;n<r;n++)t.push(e(i+"["+n+"]",n));return t}},e,n,{value:a.value}),meta:l}}var v=s.fieldSubscriptionItems.reduce(function(e,r){return e[r]=!0,e},{}),t="3.1.2",f={"final-form":s.version,"react-final-form":d.version,"react-final-form-arrays":t};e.FieldArray=function(e){var r=e.name,t=e.subscription,n=e.defaultValue,i=e.initialValue,a=e.isEqual,u=e.validate,e=p.default(e,["name","subscription","defaultValue","initialValue","isEqual","validate"]),a=l(r,{subscription:t,defaultValue:n,initialValue:i,isEqual:a,validate:u}),u=a.fields,a=a.meta;return function(e,r){var t=e.render,n=e.children,i=e.component,e=p.default(e,["render","children","component"]);if(i)return o.createElement(i,c.default({},e,{children:n,render:t}));if(t)return t(void 0===n?e:c.default({},e,{children:n}));if("function"!=typeof n)throw new Error("Must specify either a render prop, a render function as children, or a component prop to "+r);return n(e)}(c.default({fields:u,meta:c.default({},a,{__versions:f})},e),"FieldArray("+r+")")},e.useFieldArray=l,e.version=t,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@babel/runtime/helpers/extends"),require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),require("final-form"),require("react-final-form"),require("react")):"function"==typeof define&&define.amd?define(["exports","@babel/runtime/helpers/extends","@babel/runtime/helpers/objectWithoutPropertiesLoose","final-form","react-final-form","react"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self)["react-final-form-arrays"]={},e._extends,e._objectWithoutPropertiesLoose,e.FinalForm,e.ReactFinalForm,e.React)}(this,function(e,c,d,p,m,h){"use strict";function r(t){var n=Object.create(null);return t&&Object.keys(t).forEach(function(e){var r;"default"!==e&&(r=Object.getOwnPropertyDescriptor(t,e),Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}}))}),n.default=t,Object.freeze(n)}var u=r(h),l=["render","children","component"];var b=function(e,t){return e===t||Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&!e.some(function(e,r){return e!==t[r]})};function f(i,e){var r,t,a,n=void 0===(n=(e=void 0===e?{}:e).subscription)?A:n,o=e.defaultValue,u=e.initialValue,l=void 0===(l=e.isEqual)?b:l,f=e.validate,s=m.useForm("useFieldArray").mutators;if(s&&s.push&&s.pop)return e=h.useMemo(function(){return Object.keys(s).reduce(function(e,n){return e[n]=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return s[n].apply(s,[i].concat(r))},e},{})},[i,s]),r=function(){return function(e,r,t){if(f)return!(e=f(e,r,t))||Array.isArray(e)?e:((r=[])[p.ARRAY_ERROR]=e,r)}},(t=h.useRef()).current||(t.current=r()),r=t.current,n=(t=m.useField(i,{subscription:c({},n,{length:!0}),defaultValue:o,initialValue:u,isEqual:l,validate:r,format:function(e){return e}})).meta,a=n.length,o=d(n,y),u=t.input,l=d(t,v),{fields:c({name:i,forEach:function(e){for(var r=a||0,t=0;t<r;t++)e(i+"["+t+"]",t)},length:a||0,map:function(e){for(var r=a||0,t=[],n=0;n<r;n++)t.push(e(i+"["+n+"]",n));return t}},e,l,{value:u.value}),meta:o};throw new Error("Array mutators not found. You need to provide the mutators from final-form-arrays to your form")}var y=["length"],v=["meta","input"],A=p.fieldSubscriptionItems.reduce(function(e,r){return e[r]=!0,e},{}),t="3.1.3",s=["name","subscription","defaultValue","initialValue","isEqual","validate"],g={"final-form":p.version,"react-final-form":m.version,"react-final-form-arrays":t};e.FieldArray=function(e){var r=e.name,t=e.subscription,n=e.defaultValue,i=e.initialValue,a=e.isEqual,o=e.validate,e=d(e,s),t=f(r,{subscription:t,defaultValue:n,initialValue:i,isEqual:a,validate:o}),n=t.fields,i=t.meta,a=c({fields:n,meta:c({},i,{__versions:g})},e),o="FieldArray("+r+")",t=a.render,n=a.children,i=a.component,a=d(a,l);if(i)return u.createElement(i,c({},a,{children:n,render:t}));if(t)return t(void 0===n?a:c({},a,{children:n}));if("function"!=typeof n)throw new Error("Must specify either a render prop, a render function as children, or a component prop to "+o);return n(a)},e.useFieldArray=f,e.version=t});
//# sourceMappingURL=react-final-form-arrays.umd.min.js.map
{
"name": "react-final-form-arrays",
"version": "3.1.3",
"version": "3.1.4",
"description": "A component for rendering and editing arrays 🏁 React Final Form",

@@ -28,52 +28,54 @@ "main": "dist/react-final-form-arrays.cjs.js",

"devDependencies": {
"@babel/core": "^7.12.3",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-decorators": "^7.12.1",
"@babel/plugin-proposal-export-namespace-from": "^7.12.1",
"@babel/plugin-proposal-function-sent": "^7.12.1",
"@babel/plugin-proposal-json-strings": "^7.12.1",
"@babel/plugin-proposal-numeric-separator": "^7.12.1",
"@babel/plugin-proposal-throw-expressions": "^7.12.1",
"@babel/core": "^7.19.3",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.19.3",
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
"@babel/plugin-proposal-function-sent": "^7.18.6",
"@babel/plugin-proposal-json-strings": "^7.18.6",
"@babel/plugin-proposal-numeric-separator": "^7.18.6",
"@babel/plugin-proposal-throw-expressions": "^7.18.6",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/plugin-transform-flow-strip-types": "^7.12.1",
"@babel/plugin-transform-runtime": "^7.12.1",
"@babel/preset-env": "^7.12.1",
"@babel/preset-flow": "^7.12.1",
"@babel/preset-react": "^7.12.1",
"@testing-library/jest-dom": "^5.11.4",
"@babel/plugin-transform-flow-strip-types": "^7.19.0",
"@babel/plugin-transform-react-jsx-source": "^7.18.6",
"@babel/plugin-transform-runtime": "^7.19.1",
"@babel/preset-env": "^7.19.4",
"@babel/preset-flow": "^7.18.6",
"@babel/preset-react": "^7.18.6",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^11.1.0",
"@types/react": "^16.9.53",
"@typescript-eslint/eslint-plugin": "^4.5.0",
"@types/react": "^18.0.21",
"@typescript-eslint/eslint-plugin": "^5.40.1",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.6.0",
"bundlesize": "^0.18.0",
"doctoc": "^1.4.0",
"eslint": "^7.11.0",
"eslint-config-react-app": "^5.2.1",
"babel-jest": "^29.2.1",
"bundlesize": "^0.18.1",
"doctoc": "^2.2.1",
"eslint": "^8.25.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"fast-check": "^2.5.0",
"final-form": "^4.20.1",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.31.10",
"eslint-plugin-react-hooks": "^4.6.0",
"fast-check": "^3.2.0",
"final-form": "^4.20.7",
"final-form-arrays": "^3.0.2",
"flow-bin": "^0.136.0",
"flow-bin": "^0.190.0",
"glow": "^1.2.2",
"husky": "^4.3.0",
"jest": "^26.6.0",
"jest-watch-typeahead": "^0.6.1",
"husky": "^8.0.1",
"jest": "^29.2.1",
"jest-environment-jsdom": "^29.2.1",
"jest-watch-typeahead": "^2.2.0",
"lint-staged": "^10.4.2",
"nps": "^5.10.0",
"nps-utils": "^1.7.0",
"prettier": "^2.1.2",
"prettier-eslint-cli": "^5.0.0",
"prettier": "^2.7.1",
"prettier-eslint-cli": "^7.1.0",
"raf": "^3.4.1",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"react-final-form": "^6.5.2",
"rollup": "^2.32.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-final-form": "^6.5.9",
"rollup": "^3.2.3",
"rollup-plugin-babel": "^4.4.0",

@@ -85,3 +87,3 @@ "rollup-plugin-commonjs": "^10.1.0",

"rollup-plugin-uglify": "^6.0.4",
"typescript": "^4.0.3"
"typescript": "^4.8.4"
},

@@ -91,6 +93,7 @@ "peerDependencies": {

"final-form-arrays": ">=1.0.4",
"react-final-form": "^6.2.1",
"react": "^16.8.0 || ^17.0.0"
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-final-form": "^6.2.1"
},
"jest": {
"testEnvironment": "jsdom",
"watchPlugins": [

@@ -125,4 +128,4 @@ "jest-watch-typeahead/filename",

"dependencies": {
"@babel/runtime": "^7.12.1"
"@babel/runtime": "^7.19.4"
}
}

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