@bedrockstreaming/form-redux
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -5,6 +5,2 @@ import _ from 'lodash'; | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
var check = function (it) { | ||
@@ -15,3 +11,3 @@ return it && it.Math == Math && it; | ||
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 | ||
var global_1 = | ||
var global$a = | ||
// eslint-disable-next-line no-undef | ||
@@ -25,3 +21,5 @@ check(typeof globalThis == 'object' && globalThis) || | ||
var fails = function (exec) { | ||
var objectGetOwnPropertyDescriptor = {}; | ||
var fails$5 = function (exec) { | ||
try { | ||
@@ -34,25 +32,25 @@ return !!exec(); | ||
var fails$4 = fails$5; | ||
// Thank's IE8 for his funny defineProperty | ||
var descriptors = !fails(function () { | ||
var descriptors = !fails$4(function () { | ||
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; | ||
}); | ||
var objectPropertyIsEnumerable = {}; | ||
var nativePropertyIsEnumerable = {}.propertyIsEnumerable; | ||
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | ||
var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor; | ||
// Nashorn ~ JDK8 bug | ||
var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); | ||
var NASHORN_BUG = getOwnPropertyDescriptor$1 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); | ||
// `Object.prototype.propertyIsEnumerable` method implementation | ||
// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable | ||
var f = NASHORN_BUG ? function propertyIsEnumerable(V) { | ||
var descriptor = getOwnPropertyDescriptor(this, V); | ||
objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) { | ||
var descriptor = getOwnPropertyDescriptor$1(this, V); | ||
return !!descriptor && descriptor.enumerable; | ||
} : nativePropertyIsEnumerable; | ||
var objectPropertyIsEnumerable = { | ||
f: f | ||
}; | ||
var createPropertyDescriptor = function (bitmap, value) { | ||
var createPropertyDescriptor$2 = function (bitmap, value) { | ||
return { | ||
@@ -72,6 +70,9 @@ enumerable: !(bitmap & 1), | ||
var fails$3 = fails$5; | ||
var classof = classofRaw; | ||
var split = ''.split; | ||
// fallback for non-array-like ES3 and non-enumerable old V8 strings | ||
var indexedObject = fails(function () { | ||
var indexedObject = fails$3(function () { | ||
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 | ||
@@ -81,3 +82,3 @@ // eslint-disable-next-line no-prototype-builtins | ||
}) ? function (it) { | ||
return classofRaw(it) == 'String' ? split.call(it, '') : Object(it); | ||
return classof(it) == 'String' ? split.call(it, '') : Object(it); | ||
} : Object; | ||
@@ -87,3 +88,3 @@ | ||
// https://tc39.github.io/ecma262/#sec-requireobjectcoercible | ||
var requireObjectCoercible = function (it) { | ||
var requireObjectCoercible$2 = function (it) { | ||
if (it == undefined) throw TypeError("Can't call method on " + it); | ||
@@ -94,13 +95,15 @@ return it; | ||
// toObject with fallback for non-array-like ES3 strings | ||
var IndexedObject$1 = indexedObject; | ||
var requireObjectCoercible$1 = requireObjectCoercible$2; | ||
var toIndexedObject = function (it) { | ||
return indexedObject(requireObjectCoercible(it)); | ||
var toIndexedObject$3 = function (it) { | ||
return IndexedObject$1(requireObjectCoercible$1(it)); | ||
}; | ||
var isObject = function (it) { | ||
var isObject$4 = function (it) { | ||
return typeof it === 'object' ? it !== null : typeof it === 'function'; | ||
}; | ||
var isObject$3 = isObject$4; | ||
// `ToPrimitive` abstract operation | ||
@@ -110,8 +113,8 @@ // https://tc39.github.io/ecma262/#sec-toprimitive | ||
// and the second argument - flag - preferred type is a string | ||
var toPrimitive = function (input, PREFERRED_STRING) { | ||
if (!isObject(input)) return input; | ||
var toPrimitive$2 = function (input, PREFERRED_STRING) { | ||
if (!isObject$3(input)) return input; | ||
var fn, val; | ||
if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; | ||
if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; | ||
if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; | ||
if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$3(val = fn.call(input))) return val; | ||
if (typeof (fn = input.valueOf) == 'function' && !isObject$3(val = fn.call(input))) return val; | ||
if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$3(val = fn.call(input))) return val; | ||
throw TypeError("Can't convert object to primitive value"); | ||
@@ -122,9 +125,12 @@ }; | ||
var has = function (it, key) { | ||
var has$5 = function (it, key) { | ||
return hasOwnProperty.call(it, key); | ||
}; | ||
var document = global_1.document; | ||
var global$9 = global$a; | ||
var isObject$2 = isObject$4; | ||
var document = global$9.document; | ||
// typeof document.createElement is 'object' in old IE | ||
var EXISTS = isObject(document) && isObject(document.createElement); | ||
var EXISTS = isObject$2(document) && isObject$2(document.createElement); | ||
@@ -135,5 +141,9 @@ var documentCreateElement = function (it) { | ||
var DESCRIPTORS$4 = descriptors; | ||
var fails$2 = fails$5; | ||
var createElement = documentCreateElement; | ||
// Thank's IE8 for his funny defineProperty | ||
var ie8DomDefine = !descriptors && !fails(function () { | ||
return Object.defineProperty(documentCreateElement('div'), 'a', { | ||
var ie8DomDefine = !DESCRIPTORS$4 && !fails$2(function () { | ||
return Object.defineProperty(createElement('div'), 'a', { | ||
get: function () { return 7; } | ||
@@ -143,2 +153,10 @@ }).a != 7; | ||
var DESCRIPTORS$3 = descriptors; | ||
var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable; | ||
var createPropertyDescriptor$1 = createPropertyDescriptor$2; | ||
var toIndexedObject$2 = toIndexedObject$3; | ||
var toPrimitive$1 = toPrimitive$2; | ||
var has$4 = has$5; | ||
var IE8_DOM_DEFINE$1 = ie8DomDefine; | ||
var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | ||
@@ -148,17 +166,17 @@ | ||
// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor | ||
var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { | ||
O = toIndexedObject(O); | ||
P = toPrimitive(P, true); | ||
if (ie8DomDefine) try { | ||
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$3 ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { | ||
O = toIndexedObject$2(O); | ||
P = toPrimitive$1(P, true); | ||
if (IE8_DOM_DEFINE$1) try { | ||
return nativeGetOwnPropertyDescriptor(O, P); | ||
} catch (error) { /* empty */ } | ||
if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); | ||
if (has$4(O, P)) return createPropertyDescriptor$1(!propertyIsEnumerableModule$1.f.call(O, P), O[P]); | ||
}; | ||
var objectGetOwnPropertyDescriptor = { | ||
f: f$1 | ||
}; | ||
var objectDefineProperty = {}; | ||
var anObject = function (it) { | ||
if (!isObject(it)) { | ||
var isObject$1 = isObject$4; | ||
var anObject$2 = function (it) { | ||
if (!isObject$1(it)) { | ||
throw TypeError(String(it) + ' is not an object'); | ||
@@ -168,2 +186,7 @@ } return it; | ||
var DESCRIPTORS$2 = descriptors; | ||
var IE8_DOM_DEFINE = ie8DomDefine; | ||
var anObject$1 = anObject$2; | ||
var toPrimitive = toPrimitive$2; | ||
var nativeDefineProperty = Object.defineProperty; | ||
@@ -173,7 +196,7 @@ | ||
// https://tc39.github.io/ecma262/#sec-object.defineproperty | ||
var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) { | ||
anObject(O); | ||
objectDefineProperty.f = DESCRIPTORS$2 ? nativeDefineProperty : function defineProperty(O, P, Attributes) { | ||
anObject$1(O); | ||
P = toPrimitive(P, true); | ||
anObject(Attributes); | ||
if (ie8DomDefine) try { | ||
anObject$1(Attributes); | ||
if (IE8_DOM_DEFINE) try { | ||
return nativeDefineProperty(O, P, Attributes); | ||
@@ -186,8 +209,8 @@ } catch (error) { /* empty */ } | ||
var objectDefineProperty = { | ||
f: f$2 | ||
}; | ||
var DESCRIPTORS$1 = descriptors; | ||
var definePropertyModule$1 = objectDefineProperty; | ||
var createPropertyDescriptor = createPropertyDescriptor$2; | ||
var createNonEnumerableProperty = descriptors ? function (object, key, value) { | ||
return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value)); | ||
var createNonEnumerableProperty$4 = DESCRIPTORS$1 ? function (object, key, value) { | ||
return definePropertyModule$1.f(object, key, createPropertyDescriptor(1, value)); | ||
} : function (object, key, value) { | ||
@@ -198,20 +221,30 @@ object[key] = value; | ||
var setGlobal = function (key, value) { | ||
var redefine$1 = {exports: {}}; | ||
var global$8 = global$a; | ||
var createNonEnumerableProperty$3 = createNonEnumerableProperty$4; | ||
var setGlobal$3 = function (key, value) { | ||
try { | ||
createNonEnumerableProperty(global_1, key, value); | ||
createNonEnumerableProperty$3(global$8, key, value); | ||
} catch (error) { | ||
global_1[key] = value; | ||
global$8[key] = value; | ||
} return value; | ||
}; | ||
var global$7 = global$a; | ||
var setGlobal$2 = setGlobal$3; | ||
var SHARED = '__core-js_shared__'; | ||
var store = global_1[SHARED] || setGlobal(SHARED, {}); | ||
var store$3 = global$7[SHARED] || setGlobal$2(SHARED, {}); | ||
var sharedStore = store; | ||
var sharedStore = store$3; | ||
var store$2 = sharedStore; | ||
var functionToString = Function.toString; | ||
// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper | ||
if (typeof sharedStore.inspectSource != 'function') { | ||
sharedStore.inspectSource = function (it) { | ||
if (typeof store$2.inspectSource != 'function') { | ||
store$2.inspectSource = function (it) { | ||
return functionToString.call(it); | ||
@@ -221,17 +254,22 @@ }; | ||
var inspectSource = sharedStore.inspectSource; | ||
var inspectSource$2 = store$2.inspectSource; | ||
var WeakMap = global_1.WeakMap; | ||
var global$6 = global$a; | ||
var inspectSource$1 = inspectSource$2; | ||
var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap)); | ||
var WeakMap$1 = global$6.WeakMap; | ||
var shared = createCommonjsModule(function (module) { | ||
(module.exports = function (key, value) { | ||
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); | ||
var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource$1(WeakMap$1)); | ||
var shared$1 = {exports: {}}; | ||
var store$1 = sharedStore; | ||
(shared$1.exports = function (key, value) { | ||
return store$1[key] || (store$1[key] = value !== undefined ? value : {}); | ||
})('versions', []).push({ | ||
version: '3.6.5', | ||
mode: 'global', | ||
mode: 'global', | ||
copyright: '© 2020 Denis Pushkarev (zloirock.ru)' | ||
}); | ||
}); | ||
@@ -241,19 +279,30 @@ var id = 0; | ||
var uid = function (key) { | ||
var uid$1 = function (key) { | ||
return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); | ||
}; | ||
var shared = shared$1.exports; | ||
var uid = uid$1; | ||
var keys = shared('keys'); | ||
var sharedKey = function (key) { | ||
var sharedKey$1 = function (key) { | ||
return keys[key] || (keys[key] = uid(key)); | ||
}; | ||
var hiddenKeys = {}; | ||
var hiddenKeys$3 = {}; | ||
var WeakMap$1 = global_1.WeakMap; | ||
var set, get, has$1; | ||
var NATIVE_WEAK_MAP = nativeWeakMap; | ||
var global$5 = global$a; | ||
var isObject = isObject$4; | ||
var createNonEnumerableProperty$2 = createNonEnumerableProperty$4; | ||
var objectHas = has$5; | ||
var sharedKey = sharedKey$1; | ||
var hiddenKeys$2 = hiddenKeys$3; | ||
var WeakMap = global$5.WeakMap; | ||
var set, get, has$3; | ||
var enforce = function (it) { | ||
return has$1(it) ? get(it) : set(it, {}); | ||
return has$3(it) ? get(it) : set(it, {}); | ||
}; | ||
@@ -270,29 +319,29 @@ | ||
if (nativeWeakMap) { | ||
var store$1 = new WeakMap$1(); | ||
var wmget = store$1.get; | ||
var wmhas = store$1.has; | ||
var wmset = store$1.set; | ||
if (NATIVE_WEAK_MAP) { | ||
var store = new WeakMap(); | ||
var wmget = store.get; | ||
var wmhas = store.has; | ||
var wmset = store.set; | ||
set = function (it, metadata) { | ||
wmset.call(store$1, it, metadata); | ||
wmset.call(store, it, metadata); | ||
return metadata; | ||
}; | ||
get = function (it) { | ||
return wmget.call(store$1, it) || {}; | ||
return wmget.call(store, it) || {}; | ||
}; | ||
has$1 = function (it) { | ||
return wmhas.call(store$1, it); | ||
has$3 = function (it) { | ||
return wmhas.call(store, it); | ||
}; | ||
} else { | ||
var STATE = sharedKey('state'); | ||
hiddenKeys[STATE] = true; | ||
hiddenKeys$2[STATE] = true; | ||
set = function (it, metadata) { | ||
createNonEnumerableProperty(it, STATE, metadata); | ||
createNonEnumerableProperty$2(it, STATE, metadata); | ||
return metadata; | ||
}; | ||
get = function (it) { | ||
return has(it, STATE) ? it[STATE] : {}; | ||
return objectHas(it, STATE) ? it[STATE] : {}; | ||
}; | ||
has$1 = function (it) { | ||
return has(it, STATE); | ||
has$3 = function (it) { | ||
return objectHas(it, STATE); | ||
}; | ||
@@ -304,3 +353,3 @@ } | ||
get: get, | ||
has: has$1, | ||
has: has$3, | ||
enforce: enforce, | ||
@@ -310,8 +359,14 @@ getterFor: getterFor | ||
var redefine = createCommonjsModule(function (module) { | ||
var getInternalState = internalState.get; | ||
var enforceInternalState = internalState.enforce; | ||
var global$4 = global$a; | ||
var createNonEnumerableProperty$1 = createNonEnumerableProperty$4; | ||
var has$2 = has$5; | ||
var setGlobal$1 = setGlobal$3; | ||
var inspectSource = inspectSource$2; | ||
var InternalStateModule = internalState; | ||
var getInternalState = InternalStateModule.get; | ||
var enforceInternalState = InternalStateModule.enforce; | ||
var TEMPLATE = String(String).split('String'); | ||
(module.exports = function (O, key, value, options) { | ||
(redefine$1.exports = function (O, key, value, options) { | ||
var unsafe = options ? !!options.unsafe : false; | ||
@@ -321,8 +376,8 @@ var simple = options ? !!options.enumerable : false; | ||
if (typeof value == 'function') { | ||
if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key); | ||
if (typeof key == 'string' && !has$2(value, 'name')) createNonEnumerableProperty$1(value, 'name', key); | ||
enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : ''); | ||
} | ||
if (O === global_1) { | ||
if (O === global$4) { | ||
if (simple) O[key] = value; | ||
else setGlobal(key, value); | ||
else setGlobal$1(key, value); | ||
return; | ||
@@ -335,3 +390,3 @@ } else if (!unsafe) { | ||
if (simple) O[key] = value; | ||
else createNonEnumerableProperty(O, key, value); | ||
else createNonEnumerableProperty$1(O, key, value); | ||
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative | ||
@@ -341,6 +396,10 @@ })(Function.prototype, 'toString', function toString() { | ||
}); | ||
}); | ||
var path = global_1; | ||
var global$3 = global$a; | ||
var path$1 = global$3; | ||
var path = path$1; | ||
var global$2 = global$a; | ||
var aFunction = function (variable) { | ||
@@ -350,7 +409,9 @@ return typeof variable == 'function' ? variable : undefined; | ||
var getBuiltIn = function (namespace, method) { | ||
return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace]) | ||
: path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method]; | ||
var getBuiltIn$1 = function (namespace, method) { | ||
return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global$2[namespace]) | ||
: path[namespace] && path[namespace][method] || global$2[namespace] && global$2[namespace][method]; | ||
}; | ||
var objectGetOwnPropertyNames = {}; | ||
var ceil = Math.ceil; | ||
@@ -361,16 +422,20 @@ var floor = Math.floor; | ||
// https://tc39.github.io/ecma262/#sec-tointeger | ||
var toInteger = function (argument) { | ||
var toInteger$2 = function (argument) { | ||
return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); | ||
}; | ||
var min = Math.min; | ||
var toInteger$1 = toInteger$2; | ||
var min$1 = Math.min; | ||
// `ToLength` abstract operation | ||
// https://tc39.github.io/ecma262/#sec-tolength | ||
var toLength = function (argument) { | ||
return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 | ||
var toLength$1 = function (argument) { | ||
return argument > 0 ? min$1(toInteger$1(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 | ||
}; | ||
var toInteger = toInteger$2; | ||
var max = Math.max; | ||
var min$1 = Math.min; | ||
var min = Math.min; | ||
@@ -380,11 +445,15 @@ // Helper for a popular repeating case of the spec: | ||
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). | ||
var toAbsoluteIndex = function (index, length) { | ||
var toAbsoluteIndex$1 = function (index, length) { | ||
var integer = toInteger(index); | ||
return integer < 0 ? max(integer + length, 0) : min$1(integer, length); | ||
return integer < 0 ? max(integer + length, 0) : min(integer, length); | ||
}; | ||
var toIndexedObject$1 = toIndexedObject$3; | ||
var toLength = toLength$1; | ||
var toAbsoluteIndex = toAbsoluteIndex$1; | ||
// `Array.prototype.{ indexOf, includes }` methods implementation | ||
var createMethod = function (IS_INCLUDES) { | ||
return function ($this, el, fromIndex) { | ||
var O = toIndexedObject($this); | ||
var O = toIndexedObject$1($this); | ||
var length = toLength(O.length); | ||
@@ -415,5 +484,7 @@ var index = toAbsoluteIndex(fromIndex, length); | ||
var has$1 = has$5; | ||
var toIndexedObject = toIndexedObject$3; | ||
var indexOf = arrayIncludes.indexOf; | ||
var hiddenKeys$1 = hiddenKeys$3; | ||
var objectKeysInternal = function (object, names) { | ||
@@ -424,5 +495,5 @@ var O = toIndexedObject(object); | ||
var key; | ||
for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key); | ||
for (key in O) !has$1(hiddenKeys$1, key) && has$1(O, key) && result.push(key); | ||
// Don't enum bug & hidden keys | ||
while (names.length > i) if (has(O, key = names[i++])) { | ||
while (names.length > i) if (has$1(O, key = names[i++])) { | ||
~indexOf(result, key) || result.push(key); | ||
@@ -434,3 +505,3 @@ } | ||
// IE8- don't enum bug keys | ||
var enumBugKeys = [ | ||
var enumBugKeys$2 = [ | ||
'constructor', | ||
@@ -445,31 +516,38 @@ 'hasOwnProperty', | ||
var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype'); | ||
var internalObjectKeys$1 = objectKeysInternal; | ||
var enumBugKeys$1 = enumBugKeys$2; | ||
var hiddenKeys = enumBugKeys$1.concat('length', 'prototype'); | ||
// `Object.getOwnPropertyNames` method | ||
// https://tc39.github.io/ecma262/#sec-object.getownpropertynames | ||
var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { | ||
return objectKeysInternal(O, hiddenKeys$1); | ||
objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { | ||
return internalObjectKeys$1(O, hiddenKeys); | ||
}; | ||
var objectGetOwnPropertyNames = { | ||
f: f$3 | ||
}; | ||
var objectGetOwnPropertySymbols = {}; | ||
var f$4 = Object.getOwnPropertySymbols; | ||
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols; | ||
var objectGetOwnPropertySymbols = { | ||
f: f$4 | ||
}; | ||
var getBuiltIn = getBuiltIn$1; | ||
var getOwnPropertyNamesModule = objectGetOwnPropertyNames; | ||
var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols; | ||
var anObject = anObject$2; | ||
// all object keys, includes non-enumerable and symbols | ||
var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { | ||
var keys = objectGetOwnPropertyNames.f(anObject(it)); | ||
var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; | ||
var ownKeys$1 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { | ||
var keys = getOwnPropertyNamesModule.f(anObject(it)); | ||
var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f; | ||
return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; | ||
}; | ||
var copyConstructorProperties = function (target, source) { | ||
var has = has$5; | ||
var ownKeys = ownKeys$1; | ||
var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor; | ||
var definePropertyModule = objectDefineProperty; | ||
var copyConstructorProperties$1 = function (target, source) { | ||
var keys = ownKeys(source); | ||
var defineProperty = objectDefineProperty.f; | ||
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; | ||
var defineProperty = definePropertyModule.f; | ||
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; | ||
for (var i = 0; i < keys.length; i++) { | ||
@@ -481,29 +559,32 @@ var key = keys[i]; | ||
var fails$1 = fails$5; | ||
var replacement = /#|\.prototype\./; | ||
var isForced = function (feature, detection) { | ||
var isForced$1 = function (feature, detection) { | ||
var value = data[normalize(feature)]; | ||
return value == POLYFILL ? true | ||
: value == NATIVE ? false | ||
: typeof detection == 'function' ? fails(detection) | ||
: typeof detection == 'function' ? fails$1(detection) | ||
: !!detection; | ||
}; | ||
var normalize = isForced.normalize = function (string) { | ||
var normalize = isForced$1.normalize = function (string) { | ||
return String(string).replace(replacement, '.').toLowerCase(); | ||
}; | ||
var data = isForced.data = {}; | ||
var NATIVE = isForced.NATIVE = 'N'; | ||
var POLYFILL = isForced.POLYFILL = 'P'; | ||
var data = isForced$1.data = {}; | ||
var NATIVE = isForced$1.NATIVE = 'N'; | ||
var POLYFILL = isForced$1.POLYFILL = 'P'; | ||
var isForced_1 = isForced; | ||
var isForced_1 = isForced$1; | ||
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; | ||
var global$1 = global$a; | ||
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; | ||
var createNonEnumerableProperty = createNonEnumerableProperty$4; | ||
var redefine = redefine$1.exports; | ||
var setGlobal = setGlobal$3; | ||
var copyConstructorProperties = copyConstructorProperties$1; | ||
var isForced = isForced_1; | ||
/* | ||
@@ -529,7 +610,7 @@ options.target - name of the target object | ||
if (GLOBAL) { | ||
target = global_1; | ||
target = global$1; | ||
} else if (STATIC) { | ||
target = global_1[TARGET] || setGlobal(TARGET, {}); | ||
target = global$1[TARGET] || setGlobal(TARGET, {}); | ||
} else { | ||
target = (global_1[TARGET] || {}).prototype; | ||
target = (global$1[TARGET] || {}).prototype; | ||
} | ||
@@ -539,6 +620,6 @@ if (target) for (key in source) { | ||
if (options.noTargetGet) { | ||
descriptor = getOwnPropertyDescriptor$1(target, key); | ||
descriptor = getOwnPropertyDescriptor(target, key); | ||
targetProperty = descriptor && descriptor.value; | ||
} else targetProperty = target[key]; | ||
FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); | ||
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); | ||
// contained in target | ||
@@ -558,14 +639,27 @@ if (!FORCED && targetProperty !== undefined) { | ||
var internalObjectKeys = objectKeysInternal; | ||
var enumBugKeys = enumBugKeys$2; | ||
// `Object.keys` method | ||
// https://tc39.github.io/ecma262/#sec-object.keys | ||
var objectKeys = Object.keys || function keys(O) { | ||
return objectKeysInternal(O, enumBugKeys); | ||
var objectKeys$1 = Object.keys || function keys(O) { | ||
return internalObjectKeys(O, enumBugKeys); | ||
}; | ||
var requireObjectCoercible = requireObjectCoercible$2; | ||
// `ToObject` abstract operation | ||
// https://tc39.github.io/ecma262/#sec-toobject | ||
var toObject = function (argument) { | ||
var toObject$1 = function (argument) { | ||
return Object(requireObjectCoercible(argument)); | ||
}; | ||
var DESCRIPTORS = descriptors; | ||
var fails = fails$5; | ||
var objectKeys = objectKeys$1; | ||
var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols; | ||
var propertyIsEnumerableModule = objectPropertyIsEnumerable; | ||
var toObject = toObject$1; | ||
var IndexedObject = indexedObject; | ||
var nativeAssign = Object.assign; | ||
@@ -578,3 +672,3 @@ var defineProperty = Object.defineProperty; | ||
// should have correct order of operations (Edge bug) | ||
if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', { | ||
if (DESCRIPTORS && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', { | ||
enumerable: true, | ||
@@ -601,6 +695,6 @@ get: function () { | ||
var index = 1; | ||
var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; | ||
var propertyIsEnumerable = objectPropertyIsEnumerable.f; | ||
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; | ||
var propertyIsEnumerable = propertyIsEnumerableModule.f; | ||
while (argumentsLength > index) { | ||
var S = indexedObject(arguments[index++]); | ||
var S = IndexedObject(arguments[index++]); | ||
var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S); | ||
@@ -612,3 +706,3 @@ var length = keys.length; | ||
key = keys[j++]; | ||
if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key]; | ||
if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key]; | ||
} | ||
@@ -618,70 +712,46 @@ } return T; | ||
var $ = _export; | ||
var assign = objectAssign; | ||
// `Object.assign` method | ||
// https://tc39.github.io/ecma262/#sec-object.assign | ||
_export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, { | ||
assign: objectAssign | ||
$({ target: 'Object', stat: true, forced: Object.assign !== assign }, { | ||
assign: assign | ||
}); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
const INIT_FORM = 'forms/INIT_FORM'; | ||
const initForm = (formId, schema) => ({ | ||
type: INIT_FORM, | ||
formId, | ||
schema | ||
}); | ||
const NEXT_STEP = 'forms/NEXT_STEP'; | ||
const setNextStep = formId => ({ | ||
type: NEXT_STEP, | ||
formId | ||
}); | ||
const PREVIOUS_STEP = 'forms/PREVIOUS_STEP'; | ||
const setPreviousStep = formId => ({ | ||
type: PREVIOUS_STEP, | ||
formId | ||
}); | ||
const UPDATE_FORM_DATA = 'forms/UPDATE_FORM_DATA'; | ||
const updateFormData = (formId, data) => ({ | ||
type: UPDATE_FORM_DATA, | ||
formId, | ||
data | ||
}); | ||
const RESET_FORM = 'forms/RESET_FORM'; | ||
const resetForm = formId => ({ | ||
type: RESET_FORM, | ||
formId | ||
}); | ||
const SET_STEP = 'forms/SET_STEP'; | ||
const setStep = (formId, stepIndex) => ({ | ||
type: SET_STEP, | ||
formId, | ||
stepIndex | ||
}); | ||
return obj; | ||
} | ||
var INIT_FORM = 'forms/INIT_FORM'; | ||
var initForm = function initForm(formId, schema) { | ||
return { | ||
type: INIT_FORM, | ||
formId: formId, | ||
schema: schema | ||
}; | ||
}; | ||
var NEXT_STEP = 'forms/NEXT_STEP'; | ||
var setNextStep = function setNextStep(formId) { | ||
return { | ||
type: NEXT_STEP, | ||
formId: formId | ||
}; | ||
}; | ||
var PREVIOUS_STEP = 'forms/PREVIOUS_STEP'; | ||
var setPreviousStep = function setPreviousStep(formId) { | ||
return { | ||
type: PREVIOUS_STEP, | ||
formId: formId | ||
}; | ||
}; | ||
var UPDATE_FORM_DATA = 'forms/UPDATE_FORM_DATA'; | ||
var updateFormData = function updateFormData(formId, data) { | ||
return { | ||
type: UPDATE_FORM_DATA, | ||
formId: formId, | ||
data: data | ||
}; | ||
}; | ||
var RESET_FORM = 'forms/RESET_FORM'; | ||
var resetForm = function resetForm(formId) { | ||
return { | ||
type: RESET_FORM, | ||
formId: formId | ||
}; | ||
}; | ||
var SET_STEP = 'forms/SET_STEP'; | ||
var setStep = function setStep(formId, stepIndex) { | ||
return { | ||
type: SET_STEP, | ||
formId: formId, | ||
stepIndex: stepIndex | ||
}; | ||
}; | ||
var defaultFormState = { | ||
const defaultFormState = { | ||
stepsCount: 1, | ||
@@ -692,23 +762,16 @@ isLastStep: true, | ||
}; | ||
var DEFAULT_OBJECT = {}; | ||
var initialState = {}; | ||
const DEFAULT_OBJECT = {}; | ||
const initialState = {}; | ||
var checkFormId = function checkFormId(_ref) { | ||
var formId = _ref.formId; | ||
return !!formId; | ||
}; | ||
const checkFormId = ({ | ||
formId | ||
}) => !!formId; | ||
var checkFormExist = function checkFormExist(_ref2, state) { | ||
var formId = _ref2.formId; | ||
return !!state[formId]; | ||
}; | ||
const checkFormExist = ({ | ||
formId | ||
}, state) => !!state[formId]; | ||
var checkStepExist = function checkStepExist(stepsCount, newStepIndex) { | ||
return newStepIndex + 1 <= stepsCount; | ||
}; | ||
const checkStepExist = (stepsCount, newStepIndex) => newStepIndex + 1 <= stepsCount; | ||
var reducer = function reducer() { | ||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; | ||
var action = arguments.length > 1 ? arguments[1] : undefined; | ||
const reducer = (state = initialState, action) => { | ||
switch (action.type) { | ||
@@ -721,9 +784,11 @@ case INIT_FORM: | ||
var stepsById = _.get(action, ['schema', 'stepsById'], []); | ||
const stepsById = _.get(action, ['schema', 'stepsById'], []); | ||
var currentFormState = Object.assign(Object.assign({}, defaultFormState), { | ||
const currentFormState = Object.assign(Object.assign({}, defaultFormState), { | ||
stepsCount: stepsById.length, | ||
isLastStep: stepsById.length === 1 | ||
}); | ||
return Object.assign(Object.assign({}, state), _defineProperty({}, action.formId, currentFormState)); | ||
return Object.assign(Object.assign({}, state), { | ||
[action.formId]: currentFormState | ||
}); | ||
} | ||
@@ -741,14 +806,16 @@ | ||
var formState = _.get(state, action.formId, DEFAULT_OBJECT); | ||
const formState = _.get(state, action.formId, DEFAULT_OBJECT); | ||
var currentStepIndex = _.get(state, [action.formId, 'currentStepIndex'], 0); | ||
const currentStepIndex = _.get(state, [action.formId, 'currentStepIndex'], 0); | ||
var stepsCount = _.get(state, [action.formId, 'stepsCount'], 1); // Can't go under 0 | ||
const stepsCount = _.get(state, [action.formId, 'stepsCount'], 1); // Can't go under 0 | ||
var newStepIndex = currentStepIndex <= 0 ? 0 : currentStepIndex - 1; | ||
return Object.assign(Object.assign({}, state), _defineProperty({}, action.formId, Object.assign(Object.assign({}, formState), { | ||
isLastStep: stepsCount === newStepIndex + 1, | ||
currentStepIndex: newStepIndex | ||
}))); | ||
const newStepIndex = currentStepIndex <= 0 ? 0 : currentStepIndex - 1; | ||
return Object.assign(Object.assign({}, state), { | ||
[action.formId]: Object.assign(Object.assign({}, formState), { | ||
isLastStep: stepsCount === newStepIndex + 1, | ||
currentStepIndex: newStepIndex | ||
}) | ||
}); | ||
} | ||
@@ -766,15 +833,16 @@ | ||
var _formState = _.get(state, action.formId, DEFAULT_OBJECT); | ||
const formState = _.get(state, action.formId, DEFAULT_OBJECT); | ||
var _currentStepIndex = _.get(state, [action.formId, 'currentStepIndex'], 0); | ||
const currentStepIndex = _.get(state, [action.formId, 'currentStepIndex'], 0); | ||
var _stepsCount = _.get(state, [action.formId, 'stepsCount'], 1); // Can't go above steps count | ||
const stepsCount = _.get(state, [action.formId, 'stepsCount'], 1); // Can't go above steps count | ||
var _newStepIndex = _currentStepIndex >= _stepsCount - 1 ? _stepsCount - 1 : _currentStepIndex + 1; | ||
return Object.assign(Object.assign({}, state), _defineProperty({}, action.formId, Object.assign(Object.assign({}, _formState), { | ||
isLastStep: _stepsCount === _newStepIndex + 1, | ||
currentStepIndex: _newStepIndex | ||
}))); | ||
const newStepIndex = currentStepIndex >= stepsCount - 1 ? stepsCount - 1 : currentStepIndex + 1; | ||
return Object.assign(Object.assign({}, state), { | ||
[action.formId]: Object.assign(Object.assign({}, formState), { | ||
isLastStep: stepsCount === newStepIndex + 1, | ||
currentStepIndex: newStepIndex | ||
}) | ||
}); | ||
} | ||
@@ -792,8 +860,10 @@ | ||
var _formState2 = _.get(state, action.formId); | ||
const formState = _.get(state, action.formId); | ||
if (!_formState2) return state; | ||
return Object.assign(Object.assign({}, state), _defineProperty({}, action.formId, Object.assign(Object.assign({}, _formState2), { | ||
data: Object.assign(Object.assign({}, _formState2.data), action.data) | ||
}))); | ||
if (!formState) return state; | ||
return Object.assign(Object.assign({}, state), { | ||
[action.formId]: Object.assign(Object.assign({}, formState), { | ||
data: Object.assign(Object.assign({}, formState.data), action.data) | ||
}) | ||
}); | ||
} | ||
@@ -824,16 +894,18 @@ | ||
var _newStepIndex2 = _.isNumber(action.stepIndex) ? action.stepIndex : 0; | ||
const newStepIndex = _.isNumber(action.stepIndex) ? action.stepIndex : 0; | ||
var _stepsCount2 = _.get(state, [action.formId, 'stepsCount'], 1); | ||
const stepsCount = _.get(state, [action.formId, 'stepsCount'], 1); | ||
if (!checkStepExist(_stepsCount2, _newStepIndex2)) { | ||
if (!checkStepExist(stepsCount, newStepIndex)) { | ||
return state; | ||
} | ||
var _formState3 = _.get(state, action.formId, DEFAULT_OBJECT); | ||
const formState = _.get(state, action.formId, DEFAULT_OBJECT); | ||
return Object.assign(Object.assign({}, state), _defineProperty({}, action.formId, Object.assign(Object.assign({}, _formState3), { | ||
isLastStep: _stepsCount2 === _newStepIndex2 + 1, | ||
currentStepIndex: _newStepIndex2 % _stepsCount2 | ||
}))); | ||
return Object.assign(Object.assign({}, state), { | ||
[action.formId]: Object.assign(Object.assign({}, formState), { | ||
isLastStep: stepsCount === newStepIndex + 1, | ||
currentStepIndex: newStepIndex % stepsCount | ||
}) | ||
}); | ||
} | ||
@@ -846,19 +918,7 @@ | ||
var defaultObject = {}; | ||
var getFormData = function getFormData(formId) { | ||
return function (state) { | ||
return _.get(state, ['forms', formId, 'data'], defaultObject); | ||
}; | ||
}; | ||
var getCurrentStepIndex = function getCurrentStepIndex(formId) { | ||
return function (state) { | ||
return _.get(state, ['forms', formId, 'currentStepIndex'], 0); | ||
}; | ||
}; | ||
var isLastStep = function isLastStep(formId) { | ||
return function (state) { | ||
return _.get(state, ['forms', formId, 'isLastStep'], true); | ||
}; | ||
}; | ||
const defaultObject = {}; | ||
const getFormData = formId => state => _.get(state, ['forms', formId, 'data'], defaultObject); | ||
const getCurrentStepIndex = formId => state => _.get(state, ['forms', formId, 'currentStepIndex'], 0); | ||
const isLastStep = formId => state => _.get(state, ['forms', formId, 'isLastStep'], true); | ||
export { INIT_FORM, NEXT_STEP, PREVIOUS_STEP, RESET_FORM, SET_STEP, UPDATE_FORM_DATA, getCurrentStepIndex, getFormData, initForm, initialState, isLastStep, reducer, resetForm, setNextStep, setPreviousStep, setStep, updateFormData }; |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'lodash'], factory) : | ||
(global = global || self, factory(global.FormRedux = {}, global._)); | ||
}(this, (function (exports, _) { 'use strict'; | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FormRedux = {}, global._)); | ||
})(this, (function (exports, _) { 'use strict'; | ||
_ = _ && _.hasOwnProperty('default') ? _['default'] : _; | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var ___default = /*#__PURE__*/_interopDefaultLegacy(_); | ||
/*! ***************************************************************************** | ||
@@ -118,3 +120,3 @@ Copyright (c) Microsoft Corporation. | ||
var stepsById = _.get(action, ['schema', 'stepsById'], []); | ||
var stepsById = ___default["default"].get(action, ['schema', 'stepsById'], []); | ||
@@ -139,7 +141,7 @@ var currentFormState = __assign(__assign({}, defaultFormState), { | ||
var formState = _.get(state, action.formId, DEFAULT_OBJECT); | ||
var formState = ___default["default"].get(state, action.formId, DEFAULT_OBJECT); | ||
var currentStepIndex = _.get(state, [action.formId, 'currentStepIndex'], 0); | ||
var currentStepIndex = ___default["default"].get(state, [action.formId, 'currentStepIndex'], 0); | ||
var stepsCount = _.get(state, [action.formId, 'stepsCount'], 1); // Can't go under 0 | ||
var stepsCount = ___default["default"].get(state, [action.formId, 'stepsCount'], 1); // Can't go under 0 | ||
@@ -164,7 +166,7 @@ | ||
var formState = _.get(state, action.formId, DEFAULT_OBJECT); | ||
var formState = ___default["default"].get(state, action.formId, DEFAULT_OBJECT); | ||
var currentStepIndex = _.get(state, [action.formId, 'currentStepIndex'], 0); | ||
var currentStepIndex = ___default["default"].get(state, [action.formId, 'currentStepIndex'], 0); | ||
var stepsCount = _.get(state, [action.formId, 'stepsCount'], 1); // Can't go above steps count | ||
var stepsCount = ___default["default"].get(state, [action.formId, 'stepsCount'], 1); // Can't go above steps count | ||
@@ -189,3 +191,3 @@ | ||
var formState = _.get(state, action.formId); | ||
var formState = ___default["default"].get(state, action.formId); | ||
@@ -208,3 +210,3 @@ if (!formState) return state; | ||
return _.omit(state, [action.formId]); | ||
return ___default["default"].omit(state, [action.formId]); | ||
} | ||
@@ -222,5 +224,5 @@ | ||
var newStepIndex = _.isNumber(action.stepIndex) ? action.stepIndex : 0; | ||
var newStepIndex = ___default["default"].isNumber(action.stepIndex) ? action.stepIndex : 0; | ||
var stepsCount = _.get(state, [action.formId, 'stepsCount'], 1); | ||
var stepsCount = ___default["default"].get(state, [action.formId, 'stepsCount'], 1); | ||
@@ -231,3 +233,3 @@ if (!checkStepExist(stepsCount, newStepIndex)) { | ||
var formState = _.get(state, action.formId, DEFAULT_OBJECT); | ||
var formState = ___default["default"].get(state, action.formId, DEFAULT_OBJECT); | ||
@@ -248,3 +250,3 @@ return __assign(__assign({}, state), (_e = {}, _e[action.formId] = __assign(__assign({}, formState), { | ||
return function (state) { | ||
return _.get(state, ['forms', formId, 'data'], defaultObject); | ||
return ___default["default"].get(state, ['forms', formId, 'data'], defaultObject); | ||
}; | ||
@@ -254,3 +256,3 @@ }; | ||
return function (state) { | ||
return _.get(state, ['forms', formId, 'currentStepIndex'], 0); | ||
return ___default["default"].get(state, ['forms', formId, 'currentStepIndex'], 0); | ||
}; | ||
@@ -260,3 +262,3 @@ }; | ||
return function (state) { | ||
return _.get(state, ['forms', formId, 'isLastStep'], true); | ||
return ___default["default"].get(state, ['forms', formId, 'isLastStep'], true); | ||
}; | ||
@@ -285,2 +287,2 @@ }; | ||
}))); | ||
})); |
{ | ||
"name": "@bedrockstreaming/form-redux", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"main": "./form-redux.umd.js", | ||
@@ -9,3 +9,3 @@ "module": "./form-redux.esm.js", | ||
"peerDependencies": { | ||
"@bedrockstreaming/form-builder": "0.2.1", | ||
"@bedrockstreaming/form-builder": "0.3.0", | ||
"lodash": "4.17.21", | ||
@@ -15,2 +15,2 @@ "react": "17.0.2", | ||
} | ||
} | ||
} |
40288
1002